Skip to contentSkip to conversation

Support SD/SDIO controllers on RK3528

PATCH Applied Yao Zi 3 participants 6 messages May 8, 2025 – May 9, 2025

Subsystems (2)
lore
Share & tools
lore

Yao Zi

author
#0 lore raw

v6 cover Support SD/SDIO controllers on RK3528

RK3528 features two SDIO controllers and one SD/MMC controller. This series brings the SD/MMC one up on Radxa E20C board. Both HS and SDR104 modes are verified.

- Changed from v5
- Drop applied clock patches
- Rebase on top of linux-rockchip/for-next
- Link to v5: https://lore.kernel.org/all/[email protected]/
- Changed from v4
- rk3528 clock driver
- Switch to auxiliary GRF
- drop rockchip_clk_register_grf_branches
- Rename branch_mmc_grf to branch_grf_mmc to make style consistent (with branch_grf_gate)
- Link to v4: https://lore.kernel.org/all/[email protected]/
- Changed from v3
- Drop applied binding patch of MMC controller
- Rebase on top of linux-rockchip/for-next
- Link to v3: https://lore.kernel.org/all/[email protected]/
- Changed from v2
- Apply review tags
- Rebase on top of linux-rockchip/for-next and drop applied patches
- RK3528 devicetree
- Fix accidentally dropped status property of saradc node
- drop det and pwren pinctrls for SDIO{0,1} according to the reference design
- Correct max-frequency for SDIO{0,1}
- rk3528-radxa-e20c devicetree
- Don't disable sdio for sdmmc as claimed in the hw design guide
- Link to v2: https://lore.kernel.org/all/[email protected]/
- Changed from v1
- Apply review tags
- Rebase on top of linux-rockchip/for-next and saradc v2 series
- rk3528 clock driver:
- explicitly include minmax.h, replace MAX() with more robust max()
- readability improvements
- fix error checks: ERR_PTR(-ENODEV), instead of ERR_PTR(ENODEV), is returned when syscon_regmap_lookup_by_compatible() fails for missing such syscon
- RK3528 devicetree
- Add default pinctrl
- Move the per-SoC property, rockchip,default-sample-phase, into the SoC devicetree
- rk3528-radxa-e20c devicetree
- Assign sdcard to mmc1
- Add missing regulators
- Apply no-sdio for the sdmmc controller
- Sort nodes
- Link to v1: https://lore.kernel.org/all/[email protected]/

Thanks for your time and review.

Yao Zi (2):
arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528
arm64: dts: rockchip: Enable SD-card interface on Radxa E20C

 .../boot/dts/rockchip/rk3528-radxa-e20c.dts   | 30 ++++++++
 arch/arm64/boot/dts/rockchip/rk3528.dtsi      | 69 +++++++++++++++++++
 2 files changed, 99 insertions(+)
Signature · 1 line
2.49.0
author
#1 lore raw

PATCH v6 1/2 arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528

RK3528 features two SDIO controllers and one SD/MMC controller, describe them in devicetree. Since their sample and drive clocks are located in the VO and VPU GRFs, corresponding syscons are added to make these clocks available.

---
 arch/arm64/boot/dts/rockchip/rk3528.dtsi | 69 ++++++++++++++++++++++++
 1 file changed, 69 insertions(+)
arch/arm64/boot/dts/rockchip/rk3528.dtsi +69 -0
index 923cff6bb103..193b84b5e912 100644
@@ -329,6 +329,16 @@ qos_vpu: qos@ff280400 {
 			reg = <0x0 0xff280400 0x0 0x20>;
 		};
 
+		vpu_grf: syscon@ff340000 {
+			compatible = "rockchip,rk3528-vpu-grf", "syscon";
+			reg = <0x0 0xff340000 0x0 0x8000>;
+		};
+
+		vo_grf: syscon@ff360000 {
+			compatible = "rockchip,rk3528-vo-grf", "syscon";
+			reg = <0x0 0xff360000 0x0 0x10000>;
+		};
+
 		cru: clock-controller@ff4a0000 {
 			compatible = "rockchip,rk3528-cru";
 			reg = <0x0 0xff4a0000 0x0 0x30000>;
@@ -691,6 +701,65 @@ sdhci: mmc@ffbf0000 {
 			status = "disabled";
 		};
 
+		sdio0: mmc@ffc10000 {
+			compatible = "rockchip,rk3528-dw-mshc",
+				     "rockchip,rk3288-dw-mshc";
+			reg = <0x0 0xffc10000 0x0 0x4000>;
+			clocks = <&cru HCLK_SDIO0>,
+				 <&cru CCLK_SRC_SDIO0>,
+				 <&cru SCLK_SDIO0_DRV>,
+				 <&cru SCLK_SDIO0_SAMPLE>;
+			clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+			fifo-depth = <0x100>;
+			interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
+			max-frequency = <200000000>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>;
+			resets = <&cru SRST_H_SDIO0>;
+			reset-names = "reset";
+			status = "disabled";
+		};
+
+		sdio1: mmc@ffc20000 {
+			compatible = "rockchip,rk3528-dw-mshc",
+				     "rockchip,rk3288-dw-mshc";
+			reg = <0x0 0xffc20000 0x0 0x4000>;
+			clocks = <&cru HCLK_SDIO1>,
+				 <&cru CCLK_SRC_SDIO1>,
+				 <&cru SCLK_SDIO1_DRV>,
+				 <&cru SCLK_SDIO1_SAMPLE>;
+			clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+			fifo-depth = <0x100>;
+			interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
+			max-frequency = <200000000>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&sdio1_bus4>, <&sdio1_clk>, <&sdio1_cmd>;
+			resets = <&cru SRST_H_SDIO1>;
+			reset-names = "reset";
+			status = "disabled";
+		};
+
+		sdmmc: mmc@ffc30000 {
+			compatible = "rockchip,rk3528-dw-mshc",
+				     "rockchip,rk3288-dw-mshc";
+			reg = <0x0 0xffc30000 0x0 0x4000>;
+			clocks = <&cru HCLK_SDMMC0>,
+				 <&cru CCLK_SRC_SDMMC0>,
+				 <&cru SCLK_SDMMC_DRV>,
+				 <&cru SCLK_SDMMC_SAMPLE>;
+			clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+			fifo-depth = <0x100>;
+			interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
+			max-frequency = <150000000>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&sdmmc_bus4>, <&sdmmc_clk>, <&sdmmc_cmd>,
+				    <&sdmmc_det>;
+			resets = <&cru SRST_H_SDMMC0>;
+			reset-names = "reset";
+			rockchip,default-sample-phase = <90>;
+			status = "disabled";
+		};
+
 		dmac: dma-controller@ffd60000 {
 			compatible = "arm,pl330", "arm,primecell";
 			reg = <0x0 0xffd60000 0x0 0x4000>;
Signature · 1 line
2.49.0
Reviewed-by on v6 1/2
#2 lore raw

Re: [PATCH v6 1/2] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528

Quoted 6 lines · Yao Zi

RK3528 features two SDIO controllers and one SD/MMC controller, describe them in devicetree. Since their sample and drive clocks are located in the VO and VPU GRFs, corresponding syscons are added to make these clocks available.

This has not changed since v4, so this is still [1]:

[1] https://lore.kernel.org/r/[email protected]/

Regards,
Jonas

Quoted 3 lines
---
 arch/arm64/boot/dts/rockchip/rk3528.dtsi | 69 ++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

[snip]

author
#3 lore raw

PATCH v6 2/2 arm64: dts: rockchip: Enable SD-card interface on Radxa E20C

In reply to Yao Zi

SD-card is available on Radxa E20C board.

---
 .../boot/dts/rockchip/rk3528-radxa-e20c.dts   | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts +30 -0
index 0942baba6b8f..d45b6594b2de 100644
@@ -18,6 +18,7 @@ / {
 
 	aliases {
 		mmc0 = &sdhci;
+		mmc1 = &sdmmc;
 	};
 
 	chosen {
@@ -130,6 +131,18 @@ vcc5v0_sys: regulator-5v0-vcc-sys {
 		regulator-max-microvolt = <5000000>;
 	};
 
+	vccio_sd: regulator-vccio-sd {
+		compatible = "regulator-gpio";
+		gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&sdmmc_vol_ctrl_h>;
+		regulator-name = "vccio_sd";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <3300000>;
+		states = <1800000 0x0>, <3300000 0x1>;
+		vin-supply = <&vcc5v0_sys>;
+	};
+
 	vdd_arm: regulator-vdd-arm {
 		compatible = "pwm-regulator";
 		pwms = <&pwm1 0 5000 PWM_POLARITY_INVERTED>;
@@ -205,6 +218,12 @@ wan_led_g: wan-led-g {
 			rockchip,pins = <4 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
+
+	sdmmc {
+		sdmmc_vol_ctrl_h: sdmmc-vol-ctrl-h {
+			rockchip,pins = <4 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
 };
 
 &pwm1 {
@@ -235,6 +254,17 @@ &sdhci {
 	status = "okay";
 };
 
+&sdmmc {
+	bus-width = <4>;
+	cap-mmc-highspeed;
+	cap-sd-highspeed;
+	disable-wp;
+	sd-uhs-sdr104;
+	vmmc-supply = <&vcc_3v3>;
+	vqmmc-supply = <&vccio_sd>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0m0_xfer>;
Signature · 1 line
2.49.0
Reviewed-by on v6 2/2
#4 lore raw

Re: [PATCH v6 2/2] arm64: dts: rockchip: Enable SD-card interface on Radxa E20C

Quoted 3 lines · Yao Zi

SD-card is available on Radxa E20C board.

This has not changed since v4, so this is still [1]:

[1] https://lore.kernel.org/r/[email protected]/

Regards,
Jonas

Quoted 3 lines
---
 .../boot/dts/rockchip/rk3528-radxa-e20c.dts   | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)

[snip]

maintainer Applied
#5 lore raw
In reply to Yao Zi
Quoted 50 lines · Yao Zi

RK3528 features two SDIO controllers and one SD/MMC controller. This series brings the SD/MMC one up on Radxa E20C board. Both HS and SDR104 modes are verified.

- Changed from v5
- Drop applied clock patches
- Rebase on top of linux-rockchip/for-next
- Link to v5: https://lore.kernel.org/all/[email protected]/
- Changed from v4
- rk3528 clock driver
- Switch to auxiliary GRF
- drop rockchip_clk_register_grf_branches
- Rename branch_mmc_grf to branch_grf_mmc to make style consistent (with branch_grf_gate)
- Link to v4: https://lore.kernel.org/all/[email protected]/
- Changed from v3
- Drop applied binding patch of MMC controller
- Rebase on top of linux-rockchip/for-next
- Link to v3: https://lore.kernel.org/all/[email protected]/
- Changed from v2
- Apply review tags
- Rebase on top of linux-rockchip/for-next and drop applied patches
- RK3528 devicetree
- Fix accidentally dropped status property of saradc node
- drop det and pwren pinctrls for SDIO{0,1} according to the reference design
- Correct max-frequency for SDIO{0,1}
- rk3528-radxa-e20c devicetree
- Don't disable sdio for sdmmc as claimed in the hw design guide
- Link to v2: https://lore.kernel.org/all/[email protected]/
- Changed from v1
- Apply review tags
- Rebase on top of linux-rockchip/for-next and saradc v2 series
- rk3528 clock driver:
- explicitly include minmax.h, replace MAX() with more robust max()
- readability improvements
- fix error checks: ERR_PTR(-ENODEV), instead of ERR_PTR(ENODEV), is returned when syscon_regmap_lookup_by_compatible() fails for missing such syscon
- RK3528 devicetree
- Add default pinctrl
- Move the per-SoC property, rockchip,default-sample-phase, into the SoC devicetree
- rk3528-radxa-e20c devicetree
- Assign sdcard to mmc1
- Add missing regulators
- Apply no-sdio for the sdmmc controller
- Sort nodes
- Link to v1: https://lore.kernel.org/all/[email protected]/

Quoted 1 line

[...]

Applied, thanks!

[1/2] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528

      commit: 894a2640422208b1d3e4c238f126220d406e5fb1
[2/2] arm64: dts: rockchip: Enable SD-card interface on Radxa E20C
      commit: a2130d9123b23d74a717f52240fa3cb92bf8113c

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>