All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Abduwaris Nurmemet" <daabu@qq.com>
Cc: devicetree@vger.kernel.org, linux-gpio@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/3] pinctrl: rockchip: program RK3308 I/O domains before SDIO probes
Date: Sun, 29 Nov 2026 07:25:44 +0000	[thread overview]
Message-ID: <sashiko-outbox-239359@kernel.org> (raw)
In-Reply-To: <tencent_17B4819AEC459370F0ED840B6B3CA378D206@qq.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] pinctrl: rockchip: duplicate I/O domain setup in
  rk3308_io_voltage_domains()
- [Medium] pinctrl: rockchip: missing VCCIO3 ctrl bit in
  rk3308_io_voltage_domains()
- [Medium] pinctrl: rockchip: RK3308B init skipped on retry in
  rockchip_pinctrl_probe()
--

commit aed3a3e244a9e788db0579166d5c5a680e27a845
Author: Abduwaris Nurmemet <daabu@qq.com>

pinctrl: rockchip: program RK3308 I/O domains before SDIO probes

This commit adds rk3308_io_voltage_domains() to program RK3308_SOC_CON0
for 1.8V I/O domains during rockchip_pinctrl_probe() based on an
"io-1v8-domains" bitmask property on the pinctrl node.

> diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
> index ba47b6f323ccc..c9c888b796ec1 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -4761,6 +4761,40 @@ static int rk3308_soc_data_init(struct rockchip_pinctrl *info)
>  	return 0;
>  }
>  
> +#define RK3308_SOC_CON0			0x300
> +#define RK3308_SOC_CON0_DOMAINS		GENMASK(5, 0)
> +
> +/*
> + * The RK3308 SDIO controller is only reliable at high clock rates when the
> + * I/O domain feeding its pins is configured for 1.8V. That setup has to
> + * happen before the SDIO controller probes, so do it here from the pinctrl
> + * driver rather than from the (later probing) io-domain driver.
> + *
> + * Boards opt in with an "io-1v8-domains" bitmask property on the pinctrl
> + * node, where each set bit marks an I/O domain that runs at 1.8V.
> + */
> +static void rk3308_io_voltage_domains(struct rockchip_pinctrl *info)
> +{
> +	struct device *dev = info->dev;
> +	u32 io_volt_select;
> +	int ret;
> +
> +	if (device_property_read_u32(dev, "io-1v8-domains", &io_volt_select))
> +		return;

[Severity: Medium]
Should this I/O domain configuration be handled by the existing
rockchip-iodomain driver in drivers/soc/rockchip/io-domain.c instead of
duplicating GRF_SOC_CON0 management in the pinctrl driver?

Mainline already supports RK3308 I/O domains via soc_data_rk3308
("rockchip,rk3308-io-voltage-domain"), which queries each vccio0-supply
through vccio5-supply regulator, leaves unspecified domains untouched, and
registers regulator voltage-change notifiers.  Programming RK3308_SOC_CON0
from a raw bitmask here bypasses the regulator framework and unconditionally
forces all six domains in GENMASK(5, 0) to either 1.8V or 3.3V.  If the
io-domain driver probes after dw_mmc-rockchip, fixing the probe ordering or
device dependency in drivers/soc/rockchip/io-domain.c would avoid
introducing a second, uncoordinated path for the same register.

> +
> +	if (io_volt_select & ~RK3308_SOC_CON0_DOMAINS) {
> +		dev_warn(dev, "ignored invalid io-1v8-domains\n");
> +		return;
> +	}
> +
> +	ret = regmap_write(info->regmap_base, RK3308_SOC_CON0,
> +			   io_volt_select | (RK3308_SOC_CON0_DOMAINS << 16));

[Severity: Medium]
Does programming domain 3 (BIT(3)) in RK3308_SOC_CON0 take effect without
also setting RK3308_SOC_CON0_VCCIO3 (BIT(8))?

On RK3308, VCCIO3 voltage selection is controlled by an external GPIO unless
BIT(8) in RK3308_SOC_CON0 is set, as done in rk3308_iodomain_init():

drivers/soc/rockchip/io-domain.c:rk3308_iodomain_init() {
	...
	val = RK3308_SOC_CON0_VCCIO3 | (RK3308_SOC_CON0_VCCIO3 << 16);
	ret = regmap_write(iod->grf, RK3308_SOC_CON0, val);
	...
}

Because rk3308_io_voltage_domains() only writes bits 5:0, setting BIT(3) in
io-1v8-domains has no effect on hardware unless the rockchip-iodomain driver
also probes.

> +	if (ret < 0)
> +		dev_warn(dev, "Couldn't update 1.8V I/O domains\n");
> +	else
> +		dev_info(dev, "1.8V I/O domains assigned 0x%03x\n", io_volt_select);
> +}
> +
>  static int rockchip_pinctrl_probe(struct platform_device *pdev)
>  {
>  	struct rockchip_pinctrl *info;
> @@ -4824,6 +4858,9 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
>  	/* try to find the optional reference to the ioc1 syscon */
>  	info->regmap_ioc1 = syscon_regmap_lookup_by_phandle_optional(np, "rockchip,ioc1");
>  
> +	if (ctrl->type == RK3308)
> +		rk3308_io_voltage_domains(info);
> +
>  	if (ctrl->type == RK3308) {
>  		ret = rk3308_soc_data_init(info);
>  		if (ret)

[Severity: Medium]
Will rk3308_io_voltage_domains() and rk3308_soc_data_init() be skipped if
rockchip_pinctrl_probe() defers or is re-run on an RK3308B?

ctrl points to the static rk3308_pin_ctrl structure, and
rk3308_soc_data_init() mutates ctrl->type in place to RK3308B when it reads
chip_id 0x3308 or 0x3308c.  If probe later fails or defers (for example when
looking up per-bank rockchip,grf syscons or registering the pinctrl device),
the next probe attempt sees ctrl->type == RK3308B and skips both blocks.
Running rk3308_io_voltage_domains() before rk3308_soc_data_init() also
writes RK3308_SOC_CON0 before RK3308_GRF_CHIP_ID has been validated.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_9AD984A6BE60BE89025645C689A413032507@qq.com?part=2

  reply	other threads:[~2026-11-29  7:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261129071403.4890-1-daabu@qq.com>
2026-11-29  7:14 ` [PATCH 1/3] dt-bindings: pinctrl: rockchip: document io-1v8-domains Abduwaris Nurmemet
2026-11-29  7:14   ` Abduwaris Nurmemet
2026-11-29  7:21   ` sashiko-bot
2026-11-29 16:14   ` Heiko Stuebner
2026-11-29 16:14     ` Heiko Stuebner
2026-11-29  7:14 ` [PATCH 2/3] pinctrl: rockchip: program RK3308 I/O domains before SDIO probes Abduwaris Nurmemet
2026-11-29  7:14   ` Abduwaris Nurmemet
2026-11-29  7:25   ` sashiko-bot [this message]
2026-11-29 16:15   ` Heiko Stuebner
2026-11-29 16:15     ` Heiko Stuebner
2026-11-29  7:14 ` [PATCH 3/3] arm64: dts: rockchip: fix SDIO WiFi on the Sakura Pi RK3308B Abduwaris Nurmemet
2026-11-29  7:14   ` Abduwaris Nurmemet
2026-11-29  7:25   ` sashiko-bot

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=sashiko-outbox-239359@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=daabu@qq.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.