From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
To: claudiu beznea <claudiu.beznea@tuxon.dev>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
Linus Walleij <linus.walleij@linaro.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Magnus Damm <magnus.damm@gmail.com>,
linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Biju Das <biju.das.jz@bp.renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v2 10/13] pinctrl: renesas: pinctrl-rzg2l: Add support to set pulling up/down the pins
Date: Thu, 30 May 2024 11:37:48 +0100 [thread overview]
Message-ID: <CA+V-a8smD3EMbDsbGJ0z+Sxuk2E_NrtukLp7kEMam98pyAsZ=Q@mail.gmail.com> (raw)
In-Reply-To: <862d7d16-367b-492e-b7be-e2fe71b904c2@tuxon.dev>
On Thu, May 30, 2024 at 8:48 AM claudiu beznea <claudiu.beznea@tuxon.dev> wrote:
>
> Hi, Prabhakar,
>
> On 23.04.2024 20:58, Prabhakar wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Add support to configure bias-disable, bias-pull-up and bias-pull-down
> > properties of the pin.
> >
> > Two new function pointers get_bias_param() and get_bias_val() are
> > introduced as the values in PUPD register differ when compared to
> > RZ/G2L family and RZ/V2H(P) SoC,
> >
> > Value | RZ/G2L | RZ/V2H
> > ---------------------------------
> > 00b: | Bias Disabled | Pull up/down disabled
> > 01b: | Pull-up | Pull up/down disabled
> > 10b: | Pull-down | Pull-down
> > 11b: | Prohibited | Pull-up
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> > RFC->v2
> > - New patch
> > ---
> > drivers/pinctrl/renesas/pinctrl-rzg2l.c | 73 +++++++++++++++++++++++++
> > 1 file changed, 73 insertions(+)
> >
> > diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > index 102fa75c71d3..c144bf43522b 100644
> > --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > @@ -122,6 +122,7 @@
> > #define IOLH(off) (0x1000 + (off) * 8)
> > #define SR(off) (0x1400 + (off) * 8)
> > #define IEN(off) (0x1800 + (off) * 8)
> > +#define PUPD(off) (0x1C00 + (off) * 8)
> > #define ISEL(off) (0x2C00 + (off) * 8)
> > #define SD_CH(off, ch) ((off) + (ch) * 4)
> > #define ETH_POC(off, ch) ((off) + (ch) * 4)
> > @@ -140,6 +141,7 @@
> > #define IEN_MASK 0x01
> > #define IOLH_MASK 0x03
> > #define SR_MASK 0x01
> > +#define PUPD_MASK 0x03
> >
> > #define PM_INPUT 0x1
> > #define PM_OUTPUT 0x2
> > @@ -265,6 +267,8 @@ struct rzg2l_pinctrl_data {
> > void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, void __iomem *addr);
> > u32 (*read_oen)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin);
> > int (*write_oen)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin, u8 oen);
> > + int (*get_bias_param)(u8 val);
> > + int (*get_bias_val)(enum pin_config_param param);
> > };
> >
> > /**
> > @@ -1081,6 +1085,38 @@ static int rzg2l_write_oen(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8
> > return 0;
> > }
> >
> > +static int rzg2l_get_bias_param(u8 val)
> > +{
> > + switch (val) {
> > + case 0:
> > + return PIN_CONFIG_BIAS_DISABLE;
> > + case 1:
> > + return PIN_CONFIG_BIAS_PULL_UP;
> > + case 2:
> > + return PIN_CONFIG_BIAS_PULL_DOWN;
> > + default:
> > + break;
> > + }
> > +
> > + return -EINVAL;
> > +}
> > +
> > +static int rzg2l_get_bias_val(enum pin_config_param param)
> > +{
> > + switch (param) {
> > + case PIN_CONFIG_BIAS_DISABLE:
> > + return 0;
> > + case PIN_CONFIG_BIAS_PULL_UP:
> > + return 1;
> > + case PIN_CONFIG_BIAS_PULL_DOWN:
> > + return 2;
> > + default:
> > + break;
> > + }
> > +
> > + return -EINVAL;
> > +}
> > +
> > static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
> > unsigned int _pin,
> > unsigned long *config)
> > @@ -1139,6 +1175,25 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
> > arg = rzg2l_read_pin_config(pctrl, SR(off), bit, SR_MASK);
> > break;
> >
> > + case PIN_CONFIG_BIAS_DISABLE:
> > + case PIN_CONFIG_BIAS_PULL_UP:
> > + case PIN_CONFIG_BIAS_PULL_DOWN: {
>
> Block { } can be removed here.
>
> > + if (!(cfg & PIN_CFG_PUPD))
> > + return -EINVAL;
> > +
> > + ret = pctrl->data->get_bias_param(rzg2l_read_pin_config(pctrl,
> > + PUPD(off),
> > + bit, PUPD_MASK));
> > + if (ret < 0)
> > + return ret;
> > +
> > + if (ret != param)
> > + return -EINVAL;
>
> Can this happen? Otherwise it can be removed.
>
Yes this can happen (and is needed) as we want to report only the
current BIAS setting of the pin.
For example without this condition I get the below for ET1_RXD3 pin:
pin 173 (ET1_RXD3): input bias disabled, input bias pull down (0x1
ohms), input bias pull up (0x1 ohms)
with the check included:
pin 173 (ET1_RXD3): input bias disabled
Cheers,
Prabhakar
next prev parent reply other threads:[~2024-05-30 10:38 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 17:58 [PATCH v2 00/13] Add PFC support for Renesas RZ/V2H(P) SoC Prabhakar
2024-04-23 17:58 ` [PATCH v2 01/13] dt-bindings: pinctrl: renesas,rzg2l-pinctrl: Remove the check from the object Prabhakar
2024-05-22 9:57 ` Geert Uytterhoeven
2024-04-23 17:58 ` [PATCH v2 02/13] dt-bindings: pinctrl: renesas: Document RZ/V2H(P) SoC Prabhakar
2024-04-24 9:05 ` Geert Uytterhoeven
2024-04-25 9:49 ` Lad, Prabhakar
2024-04-23 17:58 ` [PATCH v2 03/13] pinctrl: renesas: pinctrl-rzg2l: Allow more bits for pin configuration Prabhakar
2024-05-22 10:19 ` Geert Uytterhoeven
2024-05-28 18:47 ` Lad, Prabhakar
2024-04-23 17:58 ` [PATCH v2 04/13] pinctrl: renesas: pinctrl-rzg2l: Allow parsing of variable configuration for all architectures Prabhakar
2024-05-22 10:21 ` Geert Uytterhoeven
2024-04-23 17:58 ` [PATCH v2 05/13] pinctrl: renesas: pinctrl-rzg2l: Validate power registers for SD and ETH Prabhakar
2024-05-22 11:53 ` Geert Uytterhoeven
2024-04-23 17:58 ` [PATCH v2 06/13] pinctrl: renesas: pinctrl-rzg2l: Add function pointers for locking/unlocking the PFC register Prabhakar
2024-04-23 18:12 ` Biju Das
2024-04-25 11:40 ` Lad, Prabhakar
2024-05-22 12:23 ` Geert Uytterhoeven
2024-05-22 12:40 ` Biju Das
2024-05-28 19:15 ` Lad, Prabhakar
2024-05-22 12:05 ` Geert Uytterhoeven
2024-04-23 17:58 ` [PATCH v2 07/13] pinctrl: renesas: pinctrl-rzg2l: Add function pointer for writing to PMC register Prabhakar
2024-05-22 12:39 ` Geert Uytterhoeven
2024-05-28 19:33 ` Lad, Prabhakar
2024-04-23 17:58 ` [PATCH v2 08/13] pinctrl: renesas: pinctrl-rzg2l: Add function pointers for reading/writing OEN register Prabhakar
2024-05-22 12:44 ` Geert Uytterhoeven
2024-05-28 19:42 ` Lad, Prabhakar
2024-04-23 17:58 ` [PATCH v2 09/13] pinctrl: renesas: pinctrl-rzg2l: Add support to configure the slew-rate Prabhakar
2024-05-22 12:51 ` Geert Uytterhoeven
2024-04-23 17:58 ` [PATCH v2 10/13] pinctrl: renesas: pinctrl-rzg2l: Add support to set pulling up/down the pins Prabhakar
2024-05-22 13:14 ` Geert Uytterhoeven
2024-05-28 20:01 ` Lad, Prabhakar
2024-05-22 13:26 ` Geert Uytterhoeven
2024-05-28 20:01 ` Lad, Prabhakar
2024-05-30 7:48 ` claudiu beznea
2024-05-30 10:15 ` Lad, Prabhakar
2024-05-30 10:37 ` Lad, Prabhakar [this message]
2024-04-23 17:58 ` [PATCH v2 11/13] pinctrl: renesas: pinctrl-rzg2l: Pass pincontrol device pointer to pinconf_generic_parse_dt_config() Prabhakar
2024-05-22 13:17 ` Geert Uytterhoeven
2024-04-23 17:58 ` [PATCH v2 12/13] pinctrl: renesas: pinctrl-rzg2l: Add support for custom parameters Prabhakar
2024-05-22 13:21 ` Geert Uytterhoeven
2024-05-28 20:07 ` Lad, Prabhakar
2024-04-23 17:59 ` [PATCH v2 13/13] pinctrl: renesas: pinctrl-rzg2l: Add support for RZ/V2H SoC Prabhakar
2024-05-22 15:29 ` Geert Uytterhoeven
2024-05-29 20:32 ` Lad, Prabhakar
2024-05-16 8:02 ` [PATCH v2 00/13] Add PFC support for Renesas RZ/V2H(P) SoC Lad, Prabhakar
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-a8smD3EMbDsbGJ0z+Sxuk2E_NrtukLp7kEMam98pyAsZ=Q@mail.gmail.com' \
--to=prabhakar.csengg@gmail.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=fabrizio.castro.jz@renesas.com \
--cc=geert+renesas@glider.be \
--cc=krzk+dt@kernel.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=magnus.damm@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@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).