diff mbox series

[2/3] pinctrl: renesas: rzg2l: Add support for configuring open-drain outputs

Message ID 20240918120909.284930-3-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series pinctrl: renesas: rzg2l: Add support to configure open-drain and schmitt-trigger properties | expand

Commit Message

Lad, Prabhakar Sept. 18, 2024, 12:09 p.m. UTC
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Add support for configuring the multiplexed pins as open-drain outputs.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/pinctrl/renesas/pinctrl-rzg2l.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Geert Uytterhoeven Oct. 4, 2024, 7:56 a.m. UTC | #1
Hi Prabhakar,

On Wed, Sep 18, 2024 at 2:09 PM Prabhakar <prabhakar.csengg@gmail.com> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Add support for configuring the multiplexed pins as open-drain outputs.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Thanks for your patch!

> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c

> @@ -1466,6 +1477,13 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
>                         rzg2l_rmw_pin_config(pctrl, IOLH(off), bit, IOLH_MASK, index);
>                         break;
>
> +               case PIN_CONFIG_DRIVE_OPEN_DRAIN:
> +                       if (!(cfg & PIN_CFG_NOD))
> +                               return -EINVAL;
> +
> +                       rzg2l_rmw_pin_config(pctrl, NOD(off), bit, NOD_MASK, 1);
> +                       break;
> +

I think you also need a case for PIN_CONFIG_DRIVE_PUSH_PULL,
so you can disable the NOD bit again.

>                 case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE:
>                         if (!(cfg & PIN_CFG_IOLH_RZV2H))
>                                 return -EINVAL;

Gr{oetje,eeting}s,

                        Geert
Lad, Prabhakar Oct. 4, 2024, 11:47 a.m. UTC | #2
Hi Geert,

Thank you for the review.

On Fri, Oct 4, 2024 at 8:56 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Wed, Sep 18, 2024 at 2:09 PM Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Add support for configuring the multiplexed pins as open-drain outputs.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Thanks for your patch!
>
> > --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
>
> > @@ -1466,6 +1477,13 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
> >                         rzg2l_rmw_pin_config(pctrl, IOLH(off), bit, IOLH_MASK, index);
> >                         break;
> >
> > +               case PIN_CONFIG_DRIVE_OPEN_DRAIN:
> > +                       if (!(cfg & PIN_CFG_NOD))
> > +                               return -EINVAL;
> > +
> > +                       rzg2l_rmw_pin_config(pctrl, NOD(off), bit, NOD_MASK, 1);
> > +                       break;
> > +
>
> I think you also need a case for PIN_CONFIG_DRIVE_PUSH_PULL,
> so you can disable the NOD bit again.
>
Ok, I will implement PIN_CONFIG_DRIVE_PUSH_PULL to disable open drain
and send a v2.

Cheers,
Prabhakar
diff mbox series

Patch

diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index 5a403915fed2..42181cc877fe 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -139,6 +139,7 @@ 
 #define IEN(off)		(0x1800 + (off) * 8)
 #define PUPD(off)		(0x1C00 + (off) * 8)
 #define ISEL(off)		(0x2C00 + (off) * 8)
+#define NOD(off)		(0x3000 + (off) * 8)
 #define SD_CH(off, ch)		((off) + (ch) * 4)
 #define ETH_POC(off, ch)	((off) + (ch) * 4)
 #define QSPI			(0x3008)
@@ -160,6 +161,7 @@ 
 #define IOLH_MASK		0x03
 #define SR_MASK			0x01
 #define PUPD_MASK		0x03
+#define NOD_MASK		0x01
 
 #define PM_INPUT		0x1
 #define PM_OUTPUT		0x2
@@ -1337,6 +1339,15 @@  static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
 		break;
 	}
 
+	case PIN_CONFIG_DRIVE_OPEN_DRAIN:
+		if (!(cfg & PIN_CFG_NOD))
+			return -EINVAL;
+
+		arg = rzg2l_read_pin_config(pctrl, NOD(off), bit, NOD_MASK);
+		if (!arg)
+			return -EINVAL;
+		break;
+
 	case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE:
 		if (!(cfg & PIN_CFG_IOLH_RZV2H))
 			return -EINVAL;
@@ -1466,6 +1477,13 @@  static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
 			rzg2l_rmw_pin_config(pctrl, IOLH(off), bit, IOLH_MASK, index);
 			break;
 
+		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
+			if (!(cfg & PIN_CFG_NOD))
+				return -EINVAL;
+
+			rzg2l_rmw_pin_config(pctrl, NOD(off), bit, NOD_MASK, 1);
+			break;
+
 		case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE:
 			if (!(cfg & PIN_CFG_IOLH_RZV2H))
 				return -EINVAL;