diff mbox series

arm64: dts: rockchip: Fix microSD in Sapphire board

Message ID 20180917134714.2197-1-vicencb@gmail.com (mailing list archive)
State New, archived
Headers show
Series arm64: dts: rockchip: Fix microSD in Sapphire board | expand

Commit Message

Vicente Bergas Sept. 17, 2018, 1:47 p.m. UTC
The microSD card slot in the Sapphire board is not working because of
several issues:
 1.- The vmmc power supply is missing in the DTS. It is capable of 3.0V
 and has a GPIO-based enable control.
 2.- The vqmmc power supply can provide up to 3.3V, but it is capped in
 the DTS to just 3.0V because of the vmmc capability. This results in a
 conflict from the mmc driver requesting an unsupportable voltage range
 from 3.3V to 3.0V (min > max) as reported in dmesg. So, extend the
 range up to 3.3V. The hw should be able to stand this 0.3V tolerance.
 See mmc_regulator_set_vqmmc in drivers/mmc/core/core.c.
 3.- The card detect signal is non-working. There is a known conflict
 with jtag, but the workaround in drivers/soc/rockchip/grf.c does not
 work. Adding the broken-cd attribute to the DTS fixes the issue.

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
---
 .../boot/dts/rockchip/rk3399-sapphire.dtsi    | 24 ++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

Comments

Heiko Stuebner Sept. 22, 2018, 8:50 p.m. UTC | #1
Am Montag, 17. September 2018, 15:47:14 CEST schrieb Vicente Bergas:
> The microSD card slot in the Sapphire board is not working because of
> several issues:
>  1.- The vmmc power supply is missing in the DTS. It is capable of 3.0V
>  and has a GPIO-based enable control.
>  2.- The vqmmc power supply can provide up to 3.3V, but it is capped in
>  the DTS to just 3.0V because of the vmmc capability. This results in a
>  conflict from the mmc driver requesting an unsupportable voltage range
>  from 3.3V to 3.0V (min > max) as reported in dmesg. So, extend the
>  range up to 3.3V. The hw should be able to stand this 0.3V tolerance.
>  See mmc_regulator_set_vqmmc in drivers/mmc/core/core.c.
>  3.- The card detect signal is non-working. There is a known conflict
>  with jtag, but the workaround in drivers/soc/rockchip/grf.c does not
>  work. Adding the broken-cd attribute to the DTS fixes the issue.
> 
> Signed-off-by: Vicente Bergas <vicencb@gmail.com>

applied for 4.20

Thanks
Heiko
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
index 941b6270..f5ad789e 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
@@ -130,6 +130,19 @@ 
 		vin-supply = <&vcc_1v8>;
 	};
 
+	vcc3v0_sd: vcc3v0-sd {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&sdmmc0_pwr_h>;
+		regulator-always-on;
+		regulator-max-microvolt = <3000000>;
+		regulator-min-microvolt = <3000000>;
+		regulator-name = "vcc3v0_sd";
+		vin-supply = <&vcc3v3_sys>;
+	};
+
 	vcc3v3_sys: vcc3v3-sys {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc3v3_sys";
@@ -343,7 +356,7 @@ 
 				regulator-always-on;
 				regulator-boot-on;
 				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <3000000>;
+				regulator-max-microvolt = <3300000>;
 				regulator-state-mem {
 					regulator-on-in-suspend;
 					regulator-suspend-microvolt = <3000000>;
@@ -503,6 +516,13 @@ 
 		};
 	};
 
+	sd {
+		sdmmc0_pwr_h: sdmmc0-pwr-h {
+			rockchip,pins =
+				<RK_GPIO0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
 	usb2 {
 		vcc5v0_host_en: vcc5v0-host-en {
 			rockchip,pins =
@@ -533,6 +553,7 @@ 
 };
 
 &sdmmc {
+	broken-cd;
 	bus-width = <4>;
 	cap-mmc-highspeed;
 	cap-sd-highspeed;
@@ -541,6 +562,7 @@ 
 	max-frequency = <150000000>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
+	vmmc-supply = <&vcc3v0_sd>;
 	vqmmc-supply = <&vcc_sdio>;
 	status = "okay";
 };