linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Biju Das <biju.das.jz@bp.renesas.com>
Subject: Re: [RFC PATCH 4/4] pinctrl: renesas: pinctrl-rzg2l: Add support to get/set drive-strength and output-impedance
Date: Tue, 26 Oct 2021 22:36:17 +0100	[thread overview]
Message-ID: <CA+V-a8uS6fiHAWbJTXtVJgHPqvtDGPf-RupQGaKJv7wWkurLYw@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdXHv7H3xxEYFLhfBf+Pun-w=F4k5S2RAYJY6qz75QpxhQ@mail.gmail.com>

Hi Geert,

Thank you for the review.

On Thu, Oct 7, 2021 at 6:23 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Thu, Sep 30, 2021 at 2:17 PM Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > Add support to get/set drive-strength and output-impedance of the pins.
> >
> > 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
> > @@ -47,6 +47,7 @@
> >  #define PIN_CFG_FILONOFF               BIT(9)
> >  #define PIN_CFG_FILNUM                 BIT(10)
> >  #define PIN_CFG_FILCLKSEL              BIT(11)
> > +#define PIN_CFG_GROUP_B                        BIT(12)
>
> Perhaps it would be easier to have separate PIN_CFG_IOLH_A and
> PIN_CFG_IOLH_B flags, instead of a PIN_CFG_IOLH flag and a
> PIN_CFG_GROUP_B modifier flag?
>
Agreed will do that.

> >
> >  #define RZG2L_MPXED_PIN_FUNCS          (PIN_CFG_IOLH | \
> >                                          PIN_CFG_SR | \
>
> > @@ -484,6 +513,38 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
> >                 break;
> >         }
> >
> > +       case PIN_CONFIG_OUTPUT_IMPEDANCE:
> > +       case PIN_CONFIG_DRIVE_STRENGTH: {
> > +               unsigned int mA[4] = { 2, 4, 8, 12 };
> > +               unsigned int oi[4] = { 100, 66, 50, 33 };
>
> static const
>
agreed.

> > +
> > +               if (param == PIN_CONFIG_DRIVE_STRENGTH) {
> > +                       if (!(cfg & PIN_CFG_IOLH) || groupb_pin)
> > +                               return -EINVAL;
> > +               } else {
> > +                       if (!(cfg & PIN_CFG_IOLH) || !groupb_pin)
> > +                               return -EINVAL;
> > +               }
> > +
> > +               spin_lock_irqsave(&pctrl->lock, flags);
> > +
> > +               /* handle _L/_H for 32-bit register read/write */
> > +               addr = pctrl->base + IOLH(port);
> > +               if (bit >= 4) {
> > +                       bit -= 4;
> > +                       addr += 4;
> > +               }
> > +
> > +               reg = readl(addr) & (IOLH_MASK << (bit * 8));
> > +               reg = reg >> (bit * 8);
> > +               if (param == PIN_CONFIG_DRIVE_STRENGTH)
> > +                       arg = mA[reg];
> > +               else
> > +                       arg = oi[reg];
> > +               spin_unlock_irqrestore(&pctrl->lock, flags);
>
> I think you've reached the point where it starts to make sense to
> have helper functions to read and modify these sub-register fields
> that may be located into the current or next register.
>
Ok will add helpers to read and rmw.

> And after that, you can split it in two smaller separate cases for
> drive strength and output impedance.
>
Agreed.

Cheers,
Prabhakar

> > +               break;
> > +       }
> > +
> >         default:
> >                 return -ENOTSUPP;
> >         }
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

      reply	other threads:[~2021-10-26 21:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 12:16 [RFC PATCH 0/4] Add "output-impedance" property to pinconf-generic Lad Prabhakar
2021-09-30 12:16 ` [RFC PATCH 1/4] dt-bindings: pincfg-node: Add "output-impedance" property Lad Prabhakar
2021-10-06 21:14   ` Rob Herring
2021-10-26 19:25     ` Lad, Prabhakar
2021-10-07 16:57   ` Geert Uytterhoeven
2021-10-26 19:27     ` Lad, Prabhakar
2021-09-30 12:16 ` [RFC PATCH 2/4] pinctrl: pinconf-generic: Add support for "output-impedance" to be extracted from DT files Lad Prabhakar
2021-10-07 17:02   ` Geert Uytterhoeven
2021-10-26 19:29     ` Lad, Prabhakar
2021-09-30 12:16 ` [RFC PATCH 3/4] dt-bindings: pinctrl: renesas,rzg2l-pinctrl: Add output-impedance property Lad Prabhakar
2021-10-07 17:03   ` Geert Uytterhoeven
2021-09-30 12:16 ` [RFC PATCH 4/4] pinctrl: renesas: pinctrl-rzg2l: Add support to get/set drive-strength and output-impedance Lad Prabhakar
2021-10-07 17:23   ` Geert Uytterhoeven
2021-10-26 21:36     ` Lad, Prabhakar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+V-a8uS6fiHAWbJTXtVJgHPqvtDGPf-RupQGaKJv7wWkurLYw@mail.gmail.com \
    --to=prabhakar.csengg@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).