public inbox for cip-dev@lists.cip-project.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@denx.de>
To: John Madieu <john.madieu.xa@bp.renesas.com>
Cc: cip-dev@lists.cip-project.org,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Subject: Re: [PATCH 6.1.y-cip 07/25] pinctrl: renesas: rzg2l: Unify OEN access by making pin-to-bit mapping configurable
Date: Tue, 4 Nov 2025 13:50:39 +0100	[thread overview]
Message-ID: <aQn2n2gbzfxfr7KY@duo.ucw.cz> (raw)
In-Reply-To: <20251103113608.36240-8-john.madieu.xa@bp.renesas.com>

[-- Attachment #1: Type: text/plain, Size: 1583 bytes --]

Hi!

> Refactor the RZG2L pinctrl driver to support reuse of the common
> rzg2l_read_oen() and rzg2l_write_oen() helpers across SoCs with
> different output-enable (OEN) bit mappings.
> 
> Introduce a new `pin_to_oen_bit` callback in `struct rzg2l_pinctrl_data`
> to allow SoCs to provide custom logic for mapping a pin to its OEN bit.
> Update the generic OEN read/write paths to use this callback when
> present.

> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -1063,7 +1064,10 @@ static u32 rzg2l_read_oen(struct rzg2l_pinctrl *pctrl, unsigned int _pin)
>  {
>  	int bit;
>  
> -	bit = rzg2l_pin_to_oen_bit(pctrl, _pin);
> +	if (!pctrl->data->pin_to_oen_bit)
> +		return 0;
> +
> +	bit = pctrl->data->pin_to_oen_bit(pctrl, _pin);
>  	if (bit < 0)
>  		return 0;
>

Returning success on failure... is strange, but I believe that is
changed in later patches.

> @@ -1077,9 +1081,12 @@ static int rzg2l_write_oen(struct rzg2l_pinctrl *pctrl, unsigned int _pin, u8 oe
>  	int bit;
>  	u8 val;
>  
> -	bit = rzg2l_pin_to_oen_bit(pctrl, _pin);
> +	if (!pctrl->data->pin_to_oen_bit)
> +		return -EINVAL;
> +
> +	bit = pctrl->data->pin_to_oen_bit(pctrl, _pin);
>  	if (bit < 0)
> -		return bit;
> +		return -EINVAL;
>  
>  	spin_lock_irqsave(&pctrl->lock, flags);
>  	val = readb(pctrl->base + oen_offset);

But his one is ugly. Any error return is converted to -EINVAL here.

Best regards,
								Pavel
-- 
In cooperation with DENX Software Engineering GmbH, HRB 165235 Munich,
Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2025-11-04 12:50 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03 11:35 [PATCH 6.1.y-cip 00/25] Add RZ/G3E GBETH support John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 01/25] pinctrl: renesas: rzg2l: Suppress binding attributes John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 02/25] soc: renesas: Add config option for RZ/V2N (R9A09G056) SoC John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 03/25] dt-bindings: pinctrl: renesas: Document RZ/V2N SoC John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 04/25] pinctrl: renesas: rzg2l: Add support for " John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 05/25] pinctrl: renesas: rzg2l: Fix invalid unsigned return in rzg3s_oen_read() John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 06/25] pinctrl: renesas: rzg2l: Parameterize OEN register offset John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 07/25] pinctrl: renesas: rzg2l: Unify OEN access by making pin-to-bit mapping configurable John Madieu
2025-11-04 12:50   ` Pavel Machek [this message]
2025-11-04 17:27     ` John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 08/25] pinctrl: renesas: rzg2l: Remove OEN ops for RZ/G3E John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 09/25] pinctrl: renesas: rzg2l: Unify OEN handling across RZ/{G2L,V2H,V2N} John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 10/25] pinctrl: renesas: rzg2l: Add PFC_OEN support for RZ/G3E SoC John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 11/25] pinctrl: renesas: rzg2l: Drop oen_read and oen_write callbacks John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 12/25] pinctrl: renesas: rzg2l: Fix OEN resume John Madieu
2025-11-04 12:55   ` Pavel Machek
2025-11-04 20:56     ` John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 13/25] clk: renesas: r9a09g047: Add clock and reset signals for the GBETH IPs John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 14/25] dt-bindings: net: Document support for Renesas RZ/V2H(P) GBETH John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 15/25] dt-bindings: net: renesas-gbeth: Add support for RZ/G3E (R9A09G047) SoC John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 16/25] dt-bindings: net: Rename renesas,r9a09g057-gbeth.yaml John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 17/25] net: stmmac: platform: Add snps,dwmac-5.20 IP compatible string John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 18/25] net: phy: Add helper for mapping RGMII link speed to clock rate John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 19/25] net: stmmac: provide set_clk_tx_rate() hook John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 20/25] net: stmmac: provide generic implementation for set_clk_tx_rate method John Madieu
2025-11-04 12:57   ` Pavel Machek
2025-11-04 19:42     ` John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 21/25] net: stmmac: provide stmmac_pltfr_find_clk() John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 22/25] net: stmmac: Add DWMAC glue layer for Renesas GBETH John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 23/25] arm64: dts: renesas: r9a09g047: Add GBETH nodes John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 24/25] arm64: dts: renesas: rzg3e-smarc-som: Enable eth{0-1} (GBETH) interfaces John Madieu
2025-11-03 11:35 ` [PATCH 6.1.y-cip 25/25] arm64: dts: renesas: r9a09g047: Enable Tx coe support John Madieu
2025-11-03 18:30 ` [PATCH 6.1.y-cip 00/25] Add RZ/G3E GBETH support Pavel Machek
2025-11-03 18:38   ` John Madieu
2025-11-06 19:15 ` Pavel Machek

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=aQn2n2gbzfxfr7KY@duo.ucw.cz \
    --to=pavel@denx.de \
    --cc=cip-dev@lists.cip-project.org \
    --cc=john.madieu.xa@bp.renesas.com \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    /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