linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Paul Barker <paul.barker.ct@bp.renesas.com>
Cc: Magnus Damm <magnus.damm@gmail.com>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	 Linus Walleij <linus.walleij@linaro.org>,
	 Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	linux-renesas-soc@vger.kernel.org,  devicetree@vger.kernel.org,
	linux-gpio@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/9] pinctrl: renesas: rzg2l: Support output enable on RZ/G2L
Date: Mon, 17 Jun 2024 14:15:29 +0200	[thread overview]
Message-ID: <CAMuHMdUgbnFoHWsB8NPu+Whn+FBkQ_EogS3yH+g-1wGTxensgQ@mail.gmail.com> (raw)
In-Reply-To: <20240611113204.3004-4-paul.barker.ct@bp.renesas.com>

Hi Paul,

On Tue, Jun 11, 2024 at 1:33 PM Paul Barker
<paul.barker.ct@bp.renesas.com> wrote:
> On the RZ/G2L SoC family, the direction of the Ethernet TXC/TX_CLK
> signal is selectable to support an Ethernet PHY operating in either MII
> or RGMII mode. By default, the signal is configured as an input and MII
> mode is supported. The ETH_MODE register can be modified to configure
> this signal as an output to support RGMII mode.
>
> As this signal is by default an input, and can optionally be switched to
> an output, it maps neatly onto an `output-enable` property in the device
> tree.
>
> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
> ---
> Changes v1->v2:
>   * Use oen_read and oen_write function pointers to be compatible with
>     recent patches adding RZ/V2H support.

Thanks for your patch!

> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -994,6 +994,61 @@ static bool rzg2l_ds_is_supported(struct rzg2l_pinctrl *pctrl, u32 caps,
>         return false;
>  }
>
> +static int rzg2l_pin_to_oen_bit(const struct rzg2l_hwcfg *hwcfg, u32 caps,
> +                               u32 port, u8 pin)
> +{
> +       if (!(caps & PIN_CFG_OEN) || pin > hwcfg->oen_max_pin)
> +               return -EINVAL;
> +
> +       /*
> +        * We can determine which Ethernet interface we're dealing with from
> +        * the caps.
> +        */
> +       if (caps & PIN_CFG_IO_VMC_ETH0)
> +               return 0;
> +       if (caps & PIN_CFG_IO_VMC_ETH1)
> +               return 1;
> +
> +       return -EINVAL;
> +}
> +
> +static u32 rzg2l_read_oen(struct rzg2l_pinctrl *pctrl, u32 caps, unsigned int _pin)

rzg2l_oen_read()

> +{
> +       u32 port = RZG2L_PIN_ID_TO_PORT(_pin);
> +       u8 pin = RZG2L_PIN_ID_TO_PIN(_pin);
> +       int bit;
> +
> +       bit = rzg2l_pin_to_oen_bit(pctrl->data->hwcfg, caps, port, pin);
> +       if (bit < 0)
> +               return 0;
> +
> +       return !(readb(pctrl->base + ETH_MODE) & BIT(bit));
> +}
> +
> +static int rzg2l_write_oen(struct rzg2l_pinctrl *pctrl, u32 caps, unsigned int _pin, u8 oen)

rzg2l_oen_write()

With these fixed:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

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:[~2024-06-17 12:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 11:31 [PATCH v2 0/9] Configure GbEth for RGMII on RZ/G2L family Paul Barker
2024-06-11 11:31 ` [PATCH v2 1/9] pinctrl: renesas: rzg2l: Clarify OEN read/write support Paul Barker
2024-06-17 11:52   ` Geert Uytterhoeven
2024-06-17 14:22     ` Paul Barker
2024-06-11 11:31 ` [PATCH v2 2/9] pinctrl: renesas: rzg2l: Clean up and refactor OEN read/write functions Paul Barker
2024-06-17 12:02   ` Geert Uytterhoeven
2024-06-25 19:56     ` Paul Barker
2024-06-26  6:19       ` claudiu beznea
2024-06-11 11:31 ` [PATCH v2 3/9] pinctrl: renesas: rzg2l: Support output enable on RZ/G2L Paul Barker
2024-06-17 12:15   ` Geert Uytterhoeven [this message]
2024-06-11 11:31 ` [PATCH v2 4/9] arm64: dts: renesas: rzg2l: Enable Ethernet TXC output Paul Barker
2024-06-11 11:31 ` [PATCH v2 5/9] arm64: dts: renesas: rzg2lc: " Paul Barker
2024-06-11 11:32 ` [PATCH v2 6/9] arm64: dts: renesas: rzg2ul: " Paul Barker
2024-06-11 11:32 ` [PATCH v2 7/9] arm64: dts: renesas: rzg2l: Set Ethernet PVDD to 1.8V Paul Barker
2024-06-11 11:32 ` [PATCH v2 8/9] arm64: dts: renesas: rzg2lc: " Paul Barker
2024-06-11 11:32 ` [PATCH v2 9/9] arm64: dts: renesas: rzg2ul: " Paul Barker
2024-06-11 13:14 ` [PATCH v2 0/9] Configure GbEth for RGMII on RZ/G2L family Linus Walleij

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=CAMuHMdUgbnFoHWsB8NPu+Whn+FBkQ_EogS3yH+g-1wGTxensgQ@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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=paul.barker.ct@bp.renesas.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).