Skip to contentSkip to conversation

sdmmc/sdio/emmc improvements for RK3328

PATCH Applied Diederik de Haas 4 participants 9 messages Jul 10, 2024 – Jul 29, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover sdmmc/sdio/emmc improvements for RK3328

This is a rebased resend of Alex Bee's prior patches which haven't been merged even though there doesn't seem to be anything wrong with it. These patches have been used in LibreELEC for years, which means I've been using it for years on my Rock64 and I've also added it to my latest 6.10-rc7 build and that worked fine too.

Link to v2:
https://lore.kernel.org/linux-rockchip/[email protected]/

Alex Bee (2):
arm64: dts: rockchip: Add sdmmc_ext for RK3328
arm64: dts: rockchip: Add sdmmc/sdio/emmc reset controls for RK3328

 arch/arm64/boot/dts/rockchip/rk3328.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

base-commit: d79d713d602e8b32cf935ddfdf61769cb74ba1dc

Signature · 1 line
2.45.2
#1 lore raw

PATCH v3 1/2 arm64: dts: rockchip: Add sdmmc_ext for RK3328

From: Alex Bee <[email protected]>

RK3328 SoC has a fourth mmc controller called SDMMC_EXT. Some boards have sdio wifi connected to it. In order to use it one would have to add the pinctrls from sdmmc0ext group which is done on board level.

---
 arch/arm64/boot/dts/rockchip/rk3328.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328.dtsi +14 -0
index b01efd6d042c..95c3f1303544 100644
@@ -1036,6 +1036,20 @@ usb_host0_ohci: usb@ff5d0000 {
 		status = "disabled";
 	};
 
+	sdmmc_ext: mmc@ff5f0000 {
+		compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
+		reg = <0x0 0xff5f0000 0x0 0x4000>;
+		interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru HCLK_SDMMC_EXT>, <&cru SCLK_SDMMC_EXT>,
+			 <&cru SCLK_SDMMC_EXT_DRV>, <&cru SCLK_SDMMC_EXT_SAMPLE>;
+		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+		fifo-depth = <0x100>;
+		max-frequency = <150000000>;
+		resets = <&cru SRST_SDMMCEXT>;
+		reset-names = "reset";
+		status = "disabled";
+	};
+
 	usbdrd3: usb@ff600000 {
 		compatible = "rockchip,rk3328-dwc3", "snps,dwc3";
 		reg = <0x0 0xff600000 0x0 0x100000>;
Signature · 1 line
2.45.2
Reviewed-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] arm64: dts: rockchip: Add sdmmc_ext for RK3328

Hello Diederik,

Quoted 9 lines · Diederik de Haas

From: Alex Bee <[email protected]>

RK3328 SoC has a fourth mmc controller called SDMMC_EXT. Some boards have sdio wifi connected to it. In order to use it one would have to add the pinctrls from sdmmc0ext group which is done on board level.

Looking good to me, cross-referencing the RK3328 TRM and the downstream RK3328 SoC dtsi checks out. Though, it will remain inert in our codebase, because no supported boards use it, but that's fine, we're still improving the correctness of the RK3328 SoC dtsi.

Quoted 30 lines
---
 arch/arm64/boot/dts/rockchip/rk3328.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328.dtsi +14 -0
index b01efd6d042c..95c3f1303544 100644
@@ -1036,6 +1036,20 @@ usb_host0_ohci: usb@ff5d0000 {
 		status = "disabled";
 	};
 
+	sdmmc_ext: mmc@ff5f0000 {
+		compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
+		reg = <0x0 0xff5f0000 0x0 0x4000>;
+		interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru HCLK_SDMMC_EXT>, <&cru SCLK_SDMMC_EXT>,
+			 <&cru SCLK_SDMMC_EXT_DRV>, <&cru SCLK_SDMMC_EXT_SAMPLE>;
+		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+		fifo-depth = <0x100>;
+		max-frequency = <150000000>;
+		resets = <&cru SRST_SDMMCEXT>;
+		reset-names = "reset";
+		status = "disabled";
+	};
+
 	usbdrd3: usb@ff600000 {
 		compatible = "rockchip,rk3328-dwc3", "snps,dwc3";
 		reg = <0x0 0xff600000 0x0 0x100000>;
#3 lore raw

Re: [PATCH v3 1/2] arm64: dts: rockchip: Add sdmmc_ext for RK3328

Hi Dragan,

Thanks for the reviews!

Quoted 4 lines · On Saturday, 13 July 2024 15:45:12 CEST Dragan Simic wrote:

Looking good to me, cross-referencing the RK3328 TRM and the downstream RK3328 SoC dtsi checks out. Though, it will remain inert in our codebase, because no supported boards use it, but that's fine, we're still improving the correctness of the RK3328 SoC dtsi.

Indeed. But it's hard to argue with technically correct ;-)

Cheers,
Diederik

#4 lore raw

Re: [PATCH v3 1/2] arm64: dts: rockchip: Add sdmmc_ext for RK3328

Am 13.07.24 um 16:35 schrieb Diederik de Haas:

Quoted 10 lines

Hi Dragan,

Thanks for the reviews!

Quoted 4 lines · On Saturday, 13 July 2024 15:45:12 CEST Dragan Simic wrote:

Looking good to me, cross-referencing the RK3328 TRM and the downstream RK3328 SoC dtsi checks out. Though, it will remain inert in our codebase, because no supported boards use it, but that's fine, we're still improving the correctness of the RK3328 SoC dtsi.

Indeed. But it's hard to argue with technically correct ;-)

FWIW: (upstream supported) ROC-RK3328-PC has sdio wifi connected to this controller.

Alex

Quoted 2 lines

Cheers,
Diederik

#5 lore raw

Re: [PATCH v3 1/2] arm64: dts: rockchip: Add sdmmc_ext for RK3328

Hello Alex,

Quoted 6 lines · Alex Bee

Am 13.07.24 um 16:35 schrieb Diederik de Haas:

Quoted 5 lines

Hi Dragan,

Thanks for the reviews!

On Saturday, 13 July 2024 15:45:12 CEST Dragan Simic wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

Looking good to me, cross-referencing the RK3328 TRM and the downstream RK3328 SoC dtsi checks out. Though, it will remain inert in our codebase, because no supported boards use it, but that's fine, we're still improving the correctness of the RK3328 SoC dtsi.

Indeed. But it's hard to argue with technically correct ;-)

FWIW: (upstream supported) ROC-RK3328-PC has sdio wifi connected to this controller.

Oh, it does? Good to hear, so the additions to the RK3328 SoC dtsi shouldn't remain inert. :)

#6 lore raw

PATCH v3 2/2 arm64: dts: rockchip: Add sdmmc/sdio/emmc reset controls for RK3328

In reply to Diederik de Haas

From: Alex Bee <[email protected]>

The DW MCI controller driver will use them to reset the IP block before initialisation.

Fixes d717f7352ec6 ("arm64: dts: rockchip: add sdmmc/sdio/emmc nodes for RK3328 SoCs")
---
 arch/arm64/boot/dts/rockchip/rk3328.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328.dtsi +6 -0
index 95c3f1303544..16b4faa22e4f 100644
@@ -910,6 +910,8 @@ sdmmc: mmc@ff500000 {
 		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
 		fifo-depth = <0x100>;
 		max-frequency = <150000000>;
+		resets = <&cru SRST_MMC0>;
+		reset-names = "reset";
 		status = "disabled";
 	};
 
@@ -922,6 +924,8 @@ sdio: mmc@ff510000 {
 		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
 		fifo-depth = <0x100>;
 		max-frequency = <150000000>;
+		resets = <&cru SRST_SDIO>;
+		reset-names = "reset";
 		status = "disabled";
 	};
 
@@ -934,6 +938,8 @@ emmc: mmc@ff520000 {
 		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
 		fifo-depth = <0x100>;
 		max-frequency = <150000000>;
+		resets = <&cru SRST_EMMC>;
+		reset-names = "reset";
 		status = "disabled";
 	};
 
Signature · 1 line
2.45.2
Reviewed-by on v3 2/2
#7 lore raw

Re: [PATCH v3 2/2] arm64: dts: rockchip: Add sdmmc/sdio/emmc reset controls for RK3328

Hello Diederik,

Quoted 9 lines · Diederik de Haas

From: Alex Bee <[email protected]>

The DW MCI controller driver will use them to reset the IP block before initialisation.

Fixes d717f7352ec6 ("arm64: dts: rockchip: add sdmmc/sdio/emmc nodes

for RK3328 SoCs")

Looking good to me, cross-referencing the RK3328 TRM checks out.

Quoted 35 lines
---
 arch/arm64/boot/dts/rockchip/rk3328.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328.dtsi +6 -0
index 95c3f1303544..16b4faa22e4f 100644
@@ -910,6 +910,8 @@ sdmmc: mmc@ff500000 {
 		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
 		fifo-depth = <0x100>;
 		max-frequency = <150000000>;
+		resets = <&cru SRST_MMC0>;
+		reset-names = "reset";
 		status = "disabled";
 	};
 
@@ -922,6 +924,8 @@ sdio: mmc@ff510000 {
 		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
 		fifo-depth = <0x100>;
 		max-frequency = <150000000>;
+		resets = <&cru SRST_SDIO>;
+		reset-names = "reset";
 		status = "disabled";
 	};
 
@@ -934,6 +938,8 @@ emmc: mmc@ff520000 {
 		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
 		fifo-depth = <0x100>;
 		max-frequency = <150000000>;
+		resets = <&cru SRST_EMMC>;
+		reset-names = "reset";
 		status = "disabled";
 	};
maintainer Applied
#8 lore raw
In reply to Diederik de Haas
Quoted 10 lines · Diederik de Haas

This is a rebased resend of Alex Bee's prior patches which haven't been merged even though there doesn't seem to be anything wrong with it. These patches have been used in LibreELEC for years, which means I've been using it for years on my Rock64 and I've also added it to my latest 6.10-rc7 build and that worked fine too.

Link to v2:
https://lore.kernel.org/linux-rockchip/[email protected]/

[...]

Applied, thanks!

[1/2] arm64: dts: rockchip: Add sdmmc_ext for RK3328

      commit: 82e3aaae388199a0aff33e5371db307b3274f77a
[2/2] arm64: dts: rockchip: Add sdmmc/sdio/emmc reset controls for RK3328
      commit: bd6e614356d4fc852480cfb14d705da0561d5777

Best regards,

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