Skip to contentSkip to conversation

arm64: dts: rockchip: add workaround for microSD card detection on Radxa ROCK 3A

PATCH In review FUKAUMI Naoki 2 participants 3 messages Sep 3, 2024 – Sep 5, 2024

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

PATCH 1/1 arm64: dts: rockchip: add workaround for microSD card detection on Radxa ROCK 3A

Radxa ROCK 3A doesn't detect microSD card insertion/removal correctly. it happens from Linux v5.19 to v6.11-rc6.

add workaround (broken-cd property) to make CD work.

Fixes 22a442e6586c ("arm64: dts: rockchip: add basic dts for the radxa rock3 model a")
---
 arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +2 -2
index 59f1403b4fa5..89599258ef9c 100644
@@ -722,12 +722,12 @@ &sdhci {
 };
 
 &sdmmc0 {
+	broken-cd;
 	bus-width = <4>;
 	cap-sd-highspeed;
-	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
 	disable-wp;
 	pinctrl-names = "default";
-	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
+	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd>;
 	sd-uhs-sdr50;
 	vmmc-supply = <&vcc3v3_sd>;
 	vqmmc-supply = <&vccio_sd>;
Signature · 7 lines
2.43.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
maintainer
#1 lore raw

Hi,

Am Dienstag, 3. September 2024, 10:55:50 CEST schrieb FUKAUMI Naoki:

Quoted 7 lines

Radxa ROCK 3A doesn't detect microSD card insertion/removal correctly. it happens from Linux v5.19 to v6.11-rc6.

add workaround (broken-cd property) to make CD work.

Fixes 22a442e6586c ("arm64: dts: rockchip: add basic dts for the radxa rock3 model a")

before going for such drastic measures as broken-cd, can you describe how you checked the card insert/removal ?

I.e. in the dts node below we have both cd-gpios as well as the sdmmc0_det pinctrl which would set the pinfunc 1 ... the hw-based card detect and possibly override the cd-gpios?

What happens if you just remove the sdmmc0_det and keep the cd-gpios property?

Also, what does cat /sys/kernel/debug/gpio report after that change with inserted and removed cards?

Heiko

Quoted 14 lines
---
 arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +1 -0
index 59f1403b4fa5..89599258ef9c 100644
@@ -722,12 +722,12 @@ &sdhci {
 };
 
 &sdmmc0 {
+	broken-cd;

arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts &sdhci { · line 733

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +1 -2
 	bus-width = <4>;
 	cap-sd-highspeed;
-	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
 	disable-wp;
 	pinctrl-names = "default";
-	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
+	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd>;
 	sd-uhs-sdr50;
 	vmmc-supply = <&vcc3v3_sd>;
 	vqmmc-supply = <&vccio_sd>;

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#2 lore raw

hi,

Quoted 6 lines · Heiko Stübner

Hi,

Am Dienstag, 3. September 2024, 10:55:50 CEST schrieb FUKAUMI Naoki:

Quoted 3 lines

Radxa ROCK 3A doesn't detect microSD card insertion/removal correctly. it happens from Linux v5.19 to v6.11-rc6.

Quoted 7 lines
Quoted 4 lines

add workaround (broken-cd property) to make CD work.

Fixes 22a442e6586c ("arm64: dts: rockchip: add basic dts for the radxa rock3 model a")

before going for such drastic measures as broken-cd, can you describe how you checked the card insert/removal ?

basically, dmesg.

Quoted 6 lines

I.e. in the dts node below we have both cd-gpios as well as the sdmmc0_det pinctrl which would set the pinfunc 1 ... the hw-based card detect and possibly override the cd-gpios?

What happens if you just remove the sdmmc0_det and keep the cd-gpios property?

nothing is changed if pinfunc is 0 or 1 , i.e. CD is not working both configuration.

Quoted 2 lines

Also, what does cat /sys/kernel/debug/gpio report after that change with inserted and removed cards?

it's always "hi".

$ sudo grep 'gpio-4 ' /sys/kernel/debug/gpio
 gpio-4   (                    |cd                  ) in  hi IRQ ACTIVE LOW

----

I forgot to explain about exception. only if microSD card is inserted before kernel boot, card is recognized and accessible. in this case, gpio-4 is "lo" till card is removed.
when card is removed, gpio-4 goes "hi", dmesg shows "mmc1: card 1234 removed".
after that, even if card is inserted again, gpio-4 never goes "lo", card is never detected.

btw, I usually put bootloader on microSD card. (kernel and userland are on USB-SSD) this time, I tried "boot from SPI flash", but nothing is changed.

I understand this is very strange, I'm okay if this patch is rejected. I want to know more information from other users to find out real solution.

Best regards,

--
FUKAUMI Naoki
Radxa Computer (Shenzhen) Co., Ltd.

Quoted 13 lines

Heiko

Quoted 11 lines
---
  arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +0 -0
index 59f1403b4fa5..89599258ef9c 100644
@@ -722,12 +722,12 @@ &sdhci {
  };
 
Quoted 18 lines

arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts &sdhci { · line 733

Quoted 13 lines
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +2 -2
  &sdmmc0 {
+	broken-cd;
  	bus-width = <4>;
  	cap-sd-highspeed;
-	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
  	disable-wp;
  	pinctrl-names = "default";
-	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
+	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd>;
  	sd-uhs-sdr50;
  	vmmc-supply = <&vcc3v3_sd>;
  	vqmmc-supply = <&vccio_sd>;

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip