From: Abduwaris Nurmemet <daabu@qq.com>
To: linux-rockchip@lists.infradead.org
Cc: Heiko Stuebner <heiko@sntech.de>,
Linus Walleij <linusw@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
devicetree@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] pinctrl: rockchip: program RK3308 I/O domains before SDIO probes
Date: Sun, 29 Nov 2026 15:14:02 +0800 [thread overview]
Message-ID: <tencent_17B4819AEC459370F0ED840B6B3CA378D206@qq.com> (raw)
In-Reply-To: <20261129071403.4890-1-daabu@qq.com>
The RK3308 SDIO controller is only reliable at 50 MHz when the I/O
domain feeding its pins is switched to 1.8V. The generic io-domain
driver probes after the MMC controllers, which is too late: the SDIO
card is already being enumerated, so the bus either fails with
-84 or stays at a very low clock.
Program the domain selection from the pinctrl driver instead, which
probes before the MMC host. 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.
This follows the approach used for the Rock Pi-S by Brent Roman.
Signed-off-by: Abduwaris Nurmemet <daabu@qq.com>
---
drivers/pinctrl/pinctrl-rockchip.c | 37 ++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index ba47b6f..c9c888b 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;
+
+ 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));
+ 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)
--
2.47.3
next prev parent reply other threads:[~2026-11-29 7:14 UTC|newest]
Thread overview: 5+ 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 16:14 ` Heiko Stuebner
2026-11-29 7:14 ` Abduwaris Nurmemet [this message]
2026-11-29 16:15 ` [PATCH 2/3] pinctrl: rockchip: program RK3308 I/O domains before SDIO probes Heiko Stuebner
2026-11-29 7:14 ` [PATCH 3/3] arm64: dts: rockchip: fix SDIO WiFi on the Sakura Pi RK3308B Abduwaris Nurmemet
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=tencent_17B4819AEC459370F0ED840B6B3CA378D206@qq.com \
--to=daabu@qq.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=krzk+dt@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--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
all inboxes | Powered by JetHome®