[PATCH 2/3] pinctrl: rockchip: program RK3308 I/O domains before SDIO probes
Abduwaris Nurmemet
daabu at qq.com
Sat Nov 28 23:14:02 PST 2026
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 at 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
More information about the Linux-rockchip
mailing list