Skip to contentSkip to conversation

ARM64: dts: meson: update around mmc

PATCH Superseded Jerome Brunet 1 participant 10 messages Aug 21, 2017

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jerome Brunet

author reviewer
#0 lore raw

v2 cover ARM64: dts: meson: update around mmc

This patchset feature updates around mmc. It is linked to this series [0] but does not strictly depends on it. It adds:

* The regulator settling times for the gpio regulator of nanopi-k2 and the libretech-cc.
* UHS modes for the p20x and nanopi-k2.
* clk-gate pins: these are the pinmuxes used for the clk-stop work around explained here [1]

It also removes cap-sd-highspeed from eMMC nodes.

Special note on SDR104:
While the PCB of the p200 and the libretech-cc does not seems to handle SDR104 completely, the nanopi-k2 seems to be handling it correctly.

The patch enabling this mode on the nanopi-k2 is the last one of this series. It should propabably be left out until more people can test sdr104 on the nanopi-k2

This series has been tested on the gxbb-200, the gxbb-nanopi-k2 and the gxl-s905x-libretech-cc

Changes since v1 [2]:
* Reorder patches to put fixes first, then enhancements
* Fix error in the SDIO clk_gate pins (GPIOX_5 instead GPIOX_4)

[0]: https://lkml.kernel.org/r/20170821160301.21899-1-jbrunet at baylibre.com [1]: https://lkml.kernel.org/r/20170821160301.21899-11-jbrunet at baylibre.com [2]: https://lkml.kernel.org/r/20170804180816.18737-1-jbrunet at baylibre.com

Jerome Brunet (9):
ARM64: dts: meson-gx: Use correct mmc clock source 0
ARM64: dts: meson: remove cap-sd-highspeed from emmc nodes
ARM64: dts: meson: add mmc clk gate pins
ARM64: dts: meson-gxbb: nanopi-k2: add card regulator settle times
ARM64: dts: meson-gxl: libretech-cc: add card regulator settle times
ARM64: dts: meson-gxl: libretech-cc: remove sdr104 capability
ARM64: dts: meson-gxbb: p20x: enable sdcard UHS modes
ARM64: dts: meson-gxbb: nanopi-k2: enable sdcard UHS modes
ARM64: dts: meson-gxbb: nanopi-k2: enable sdr104 mode

 .../arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 10 +++---
 .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts      | 19 ++++++++---
 .../boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts    | 12 ++++---
 .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |  9 ++---
 arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi   | 13 +++++---
 .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi      | 10 +++---
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi        | 39 ++++++++++++++++++++--
 .../dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts |  7 ++--
 .../dts/amlogic/meson-gxl-s905x-libretech-cc.dts   | 10 ++++--
 .../dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts    | 10 +++---
 .../boot/dts/amlogic/meson-gxl-s905x-p212.dtsi     | 10 +++---
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi         | 39 ++++++++++++++++++++--
 .../arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts |  7 ++--
 arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |  1 -
 14 files changed, 146 insertions(+), 50 deletions(-)
Signature · 1 line
2.9.5
author reviewer
#1 lore raw

PATCH v2 1/9 ARM64: dts: meson-gx: Use correct mmc clock source 0

Now that the clock source 0 is properly described in the CCF, use it instead of assuming the default value (xtal)

---
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 6 +++---
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +3 -3
index 17d3efdf1469..9a1e478f80d5 100644
@@ -652,21 +652,21 @@
 
 &sd_emmc_a {
 	clocks = <&clkc CLKID_SD_EMMC_A>,
-		 <&xtal>,
+		 <&clkc CLKID_SD_EMMC_A_CLK0>,
 		 <&clkc CLKID_FCLK_DIV2>;
 	clock-names = "core", "clkin0", "clkin1";
 };
 
 &sd_emmc_b {
 	clocks = <&clkc CLKID_SD_EMMC_B>,
-		 <&xtal>,
+		 <&clkc CLKID_SD_EMMC_B_CLK0>,
 		 <&clkc CLKID_FCLK_DIV2>;
 	clock-names = "core", "clkin0", "clkin1";
 };
 
 &sd_emmc_c {
 	clocks = <&clkc CLKID_SD_EMMC_C>,
-		 <&xtal>,
+		 <&clkc CLKID_SD_EMMC_C_CLK0>,
 		 <&clkc CLKID_FCLK_DIV2>;
 	clock-names = "core", "clkin0", "clkin1";
 };
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +3 -3
index 8d4f3160a0ee..071eca074a91 100644
@@ -593,21 +593,21 @@
 
 &sd_emmc_a {
 	clocks = <&clkc CLKID_SD_EMMC_A>,
-		 <&xtal>,
+		 <&clkc CLKID_SD_EMMC_A_CLK0>,
 		 <&clkc CLKID_FCLK_DIV2>;
 	clock-names = "core", "clkin0", "clkin1";
 };
 
 &sd_emmc_b {
 	clocks = <&clkc CLKID_SD_EMMC_B>,
-		 <&xtal>,
+		 <&clkc CLKID_SD_EMMC_B_CLK0>,
 		 <&clkc CLKID_FCLK_DIV2>;
        clock-names = "core", "clkin0", "clkin1";
 };
 
 &sd_emmc_c {
 	clocks = <&clkc CLKID_SD_EMMC_C>,
-		 <&xtal>,
+		 <&clkc CLKID_SD_EMMC_C_CLK0>,
 		 <&clkc CLKID_FCLK_DIV2>;
 	clock-names = "core", "clkin0", "clkin1";
 };
Signature · 1 line
2.9.5
author reviewer
#2 lore raw

PATCH v2 2/9 ARM64: dts: meson: remove cap-sd-highspeed from emmc nodes

In reply to Jerome Brunet

It does not make much sense to define cap-sd-highspeed in the emmc nodes Just remove it.

---
 arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi            | 1 -
 arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts           | 1 -
 arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts         | 1 -
 arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts            | 1 -
 arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi               | 1 -
 arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi           | 1 -
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts | 1 -
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts    | 1 -
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi          | 1 -
 arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts            | 1 -
 arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts             | 1 -
 11 files changed, 11 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +0 -1
index dc478d094c11..cff39c5a2632 100644
@@ -208,7 +208,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	cap-mmc-highspeed;
 	max-frequency = <200000000>;
 	non-removable;
arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +0 -1
index fa462831ccaf..b48a4576158a 100644
@@ -239,7 +239,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	max-frequency = <200000000>;
 	non-removable;
 	disable-wp;
arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts +0 -1
index a1078b3e1c76..c64c2256d092 100644
@@ -267,7 +267,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	cap-mmc-highspeed;
 	max-frequency = <200000000>;
 	non-removable;
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +0 -1
index d147c853ab05..a12303becab4 100644
@@ -274,7 +274,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	max-frequency = <200000000>;
 	non-removable;
 	disable-wp;
arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi +0 -1
index 58b32f272a0e..30b880b694de 100644
@@ -234,7 +234,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	cap-mmc-highspeed;
 	max-frequency = <200000000>;
 	non-removable;
arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi +0 -1
index 346753fb6324..0262ef8d48e4 100644
@@ -201,7 +201,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	cap-mmc-highspeed;
 	max-frequency = <200000000>;
 	non-removable;
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts +0 -1
index 2a5804ce7f4b..f779a985f923 100644
@@ -144,7 +144,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	cap-mmc-highspeed;
 	max-frequency = <100000000>;
 	non-removable;
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts +0 -1
index 6633a5d8fdd3..83c35efbae8b 100644
@@ -224,7 +224,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	cap-mmc-highspeed;
 	max-frequency = <200000000>;
 	non-removable;
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +0 -1
index f3eea8e89d12..8899121f79e1 100644
@@ -137,7 +137,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	cap-mmc-highspeed;
 	max-frequency = <200000000>;
 	non-removable;
arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts +0 -1
index 5f626d683088..583da09acf66 100644
@@ -189,7 +189,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	cap-mmc-highspeed;
 	max-frequency = <200000000>;
 	non-removable;
arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts +0 -1
index 08f1dd69b679..470f72bb863c 100644
@@ -220,7 +220,6 @@
 	pinctrl-names = "default";
 
 	bus-width = <8>;
-	cap-sd-highspeed;
 	cap-mmc-highspeed;
 	max-frequency = <200000000>;
 	non-removable;
Signature · 1 line
2.9.5
author reviewer
#3 lore raw

PATCH v2 3/9 ARM64: dts: meson: add mmc clk gate pins

In reply to Jerome Brunet

Add the pinctrl to switch mmc clk pins in gpio (pulled down) mode. This is necessary to be able to gate the clk outside of the SoC while keeping it running in the controller

---
 .../arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi |  9 ++++--
 .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts      |  9 ++++--
 .../boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts    | 11 +++++---
 .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |  8 ++++--
 arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi   |  9 ++++--
 .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi      |  9 ++++--
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi        | 33 ++++++++++++++++++++++
 .../dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts |  6 ++--
 .../dts/amlogic/meson-gxl-s905x-libretech-cc.dts   |  6 ++--
 .../dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts    |  9 ++++--
 .../boot/dts/amlogic/meson-gxl-s905x-p212.dtsi     |  9 ++++--
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi         | 33 ++++++++++++++++++++++
 .../arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts |  6 ++--
 13 files changed, 126 insertions(+), 31 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +6 -3
index cff39c5a2632..9ac904f75013 100644
@@ -161,7 +161,8 @@
 &sd_emmc_a {
 	status = "okay";
 	pinctrl-0 = <&sdio_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdio_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 	#address-cells = <1>;
 	#size-cells = <0>;
 
@@ -187,7 +188,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -205,7 +207,8 @@
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	cap-mmc-highspeed;
arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +6 -3
index b48a4576158a..e4c6b2fd52ee 100644
@@ -192,7 +192,8 @@
 &sd_emmc_a {
 	status = "okay";
 	pinctrl-0 = <&sdio_pins>, <&sdio_irq_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdio_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 	#address-cells = <1>;
 	#size-cells = <0>;
 
@@ -218,7 +219,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -236,7 +238,8 @@
 &sd_emmc_c {
 	status = "disabled";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	max-frequency = <200000000>;
arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts +7 -4
index c64c2256d092..7342c31f73b6 100644
@@ -51,7 +51,7 @@
 / {
 	compatible = "nexbox,a95x", "amlogic,meson-gxbb";
 	model = "NEXBOX A95X";
-	
+
 	aliases {
 		serial0 = &uart_AO;
 	};
@@ -225,7 +225,8 @@
 &sd_emmc_a {
 	status = "okay";
 	pinctrl-0 = <&sdio_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdio_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 	#address-cells = <1>;
 	#size-cells = <0>;
 
@@ -246,7 +247,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -264,7 +266,8 @@
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	cap-mmc-highspeed;
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +5 -3
index a12303becab4..1ffa1c238a72 100644
@@ -50,7 +50,7 @@
 / {
 	compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
 	model = "Hardkernel ODROID-C2";
-	
+
 	aliases {
 		serial0 = &uart_AO;
 	};
@@ -253,7 +253,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -271,7 +272,8 @@
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	max-frequency = <200000000>;
arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi +6 -3
index 30b880b694de..99c409d1c8f8 100644
@@ -187,7 +187,8 @@
 &sd_emmc_a {
 	status = "okay";
 	pinctrl-0 = <&sdio_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdio_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 	#address-cells = <1>;
 	#size-cells = <0>;
 
@@ -213,7 +214,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -231,7 +233,8 @@
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	cap-mmc-highspeed;
arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi +6 -3
index 0262ef8d48e4..f2bc6dea1fc6 100644
@@ -155,7 +155,8 @@
 &sd_emmc_a {
 	status = "okay";
 	pinctrl-0 = <&sdio_pins &sdio_irq_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdio_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 	#address-cells = <1>;
 	#size-cells = <0>;
 
@@ -181,7 +182,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -198,7 +200,8 @@
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	cap-mmc-highspeed;
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +33 -0
index 9a1e478f80d5..1d6314e2eb8a 100644
@@ -383,6 +383,17 @@
 			};
 		};
 
+		emmc_clk_gate_pins: emmc_clk_gate {
+			mux {
+				groups = "BOOT_8";
+				function = "gpio_periphs";
+			};
+			cfg-pull-down {
+				pins = "BOOT_8";
+				bias-pull-down;
+			};
+		};
+
 		nor_pins: nor {
 			mux {
 				groups = "nor_d",
@@ -421,6 +432,17 @@
 			};
 		};
 
+		sdcard_clk_gate_pins: sdcard_clk_gate {
+			mux {
+				groups = "CARD_2";
+				function = "gpio_periphs";
+			};
+			cfg-pull-down {
+				pins = "CARD_2";
+				bias-pull-down;
+			};
+		};
+
 		sdio_pins: sdio {
 			mux {
 				groups = "sdio_d0",
@@ -433,6 +455,17 @@
 			};
 		};
 
+		sdio_clk_gate_pins: sdio_clk_gate {
+			mux {
+				groups = "GPIOX_4";
+				function = "gpio_periphs";
+			};
+			cfg-pull-down {
+				pins = "GPIOX_4";
+				bias-pull-down;
+			};
+		};
+
 		sdio_irq_pins: sdio_irq {
 			mux {
 				groups = "sdio_irq";
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts +4 -2
index f779a985f923..977b4240f3c1 100644
@@ -123,7 +123,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -141,7 +142,8 @@
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	cap-mmc-highspeed;
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +4 -2
index 51c4ecc3b31e..2b56f7d9be2b 100644
@@ -134,7 +134,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -156,7 +157,8 @@
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	cap-mmc-highspeed;
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts +6 -3
index 83c35efbae8b..df448b11a16b 100644
@@ -182,7 +182,8 @@
 &sd_emmc_a {
 	status = "okay";
 	pinctrl-0 = <&sdio_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdio_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 	#address-cells = <1>;
 	#size-cells = <0>;
 
@@ -203,7 +204,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -221,7 +223,8 @@
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	cap-mmc-highspeed;
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +6 -3
index 8899121f79e1..129af9068814 100644
@@ -95,7 +95,8 @@
 &sd_emmc_a {
 	status = "okay";
 	pinctrl-0 = <&sdio_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdio_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 	#address-cells = <1>;
 	#size-cells = <0>;
 
@@ -116,7 +117,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -134,7 +136,8 @@
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	cap-mmc-highspeed;
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +33 -0
index 071eca074a91..e3433a4bf451 100644
@@ -271,6 +271,17 @@
 			};
 		};
 
+		emmc_clk_gate_pins: emmc_clk_gate {
+			mux {
+				groups = "BOOT_8";
+				function = "gpio_periphs";
+			};
+			cfg-pull-down {
+				pins = "BOOT_8";
+				bias-pull-down;
+			};
+		};
+
 		nor_pins: nor {
 			mux {
 				groups = "nor_d",
@@ -309,6 +320,17 @@
 			};
 		};
 
+		sdcard_clk_gate_pins: sdcard_clk_gate {
+			mux {
+				groups = "CARD_2";
+				function = "gpio_periphs";
+			};
+			cfg-pull-down {
+				pins = "CARD_2";
+				bias-pull-down;
+			};
+		};
+
 		sdio_pins: sdio {
 			mux {
 				groups = "sdio_d0",
@@ -321,6 +343,17 @@
 			};
 		};
 
+		sdio_clk_gate_pins: sdio_clk_gate {
+			mux {
+				groups = "GPIOX_4";
+				function = "gpio_periphs";
+			};
+			cfg-pull-down {
+				pins = "GPIOX_4";
+				bias-pull-down;
+			};
+		};
+
 		sdio_irq_pins: sdio_irq {
 			mux {
 				groups = "sdio_irq";
arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts +4 -2
index 583da09acf66..7af153535073 100644
@@ -168,7 +168,8 @@
 &sd_emmc_b {
 	status = "okay";
 	pinctrl-0 = <&sdcard_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&sdcard_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <4>;
 	cap-sd-highspeed;
@@ -186,7 +187,8 @@
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_pins>;
-	pinctrl-names = "default";
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
 
 	bus-width = <8>;
 	cap-mmc-highspeed;
Signature · 1 line
2.9.5
author reviewer
#4 lore raw

PATCH v2 4/9 ARM64: dts: meson-gxbb: nanopi-k2: add card regulator settle times

In reply to Jerome Brunet

Changing the card voltage on the nanopi-k2 is not instantaneous, especially when switching from 3.3v to 1.8v.

It take at least 3ms for the regulator to go from 3.3v to 1.8v. Add margin to that to make sure we don't upset the sdcard during the voltage switch

Fixes 9bc7ffb08daf ("arm64: dts: amlogic: Add NanoPi K2")
---
 arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +3 -0
index e4c6b2fd52ee..de4ed28d78bc 100644
@@ -107,6 +107,9 @@
 
 		states = <3300000 0>,
 		         <1800000 1>;
+
+		regulator-settling-time-up-us = <100>;
+		regulator-settling-time-down-us = <5000>;
 	};
 
 	wifi_32k: wifi-32k {
Signature · 1 line
2.9.5
author reviewer
#5 lore raw

PATCH v2 5/9 ARM64: dts: meson-gxl: libretech-cc: add card regulator settle times

In reply to Jerome Brunet

Changing the card voltage on the cc is not instantaneous, especially when switching from 3.3v to 1.8v.

It take at least 30ms for the regulator to go from 3.3v to 1.8v. Add margin to that to make sure we don't upset the sdcard during the voltage switch

Fixes 61ff2af9b278 ("ARM64: dts: fixup libretech cc definition")
---
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +3 -0
index 2b56f7d9be2b..0537b92cd226 100644
@@ -92,6 +92,9 @@
 
 		states = <3300000 0>,
 		         <1800000 1>;
+
+		regulator-settling-time-up-us = <200>;
+		regulator-settling-time-down-us = <50000>;
 	};
 
 	vddio_boot: regulator-vddio_boot {
Signature · 1 line
2.9.5
author reviewer
#6 lore raw

PATCH v2 6/9 ARM64: dts: meson-gxl: libretech-cc: remove sdr104 capability

In reply to Jerome Brunet

Unfortunately, the PCB of the libretech-cc cannot handle sdcard at 200Mhz reliably, so sdr104 is removed

---
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 1 -
 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +0 -1
index 0537b92cd226..a582152f5e63 100644
@@ -145,7 +145,6 @@
 	sd-uhs-sdr12;
 	sd-uhs-sdr25;
 	sd-uhs-sdr50;
-	sd-uhs-sdr104;
 	max-frequency = <100000000>;
 	disable-wp;
 
Signature · 1 line
2.9.5
author reviewer
#7 lore raw

PATCH v2 7/9 ARM64: dts: meson-gxbb: p20x: enable sdcard UHS modes

In reply to Jerome Brunet

Enable sdcard UHS modes, up to SDR50, on p20x based boards. While the s905 supports SDR104 mode, it appears that the PCB of p20x based boards can't cope with a rate as high as 200Mhz.

---
 arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi +3 -0
index 99c409d1c8f8..d5dad8fa4993 100644
@@ -219,6 +219,9 @@
 
 	bus-width = <4>;
 	cap-sd-highspeed;
+	sd-uhs-sdr12;
+	sd-uhs-sdr25;
+	sd-uhs-sdr50;
 	max-frequency = <100000000>;
 	disable-wp;
 
Signature · 1 line
2.9.5
author reviewer
#8 lore raw

PATCH v2 8/9 ARM64: dts: meson-gxbb: nanopi-k2: enable sdcard UHS modes

In reply to Jerome Brunet

Enable UHS modes, up to SDR50, on the nanopi-k2 SBC.

---
 arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +3 -0
index de4ed28d78bc..38630871c2ea 100644
@@ -227,6 +227,9 @@
 
 	bus-width = <4>;
 	cap-sd-highspeed;
+	sd-uhs-sdr12;
+	sd-uhs-sdr25;
+	sd-uhs-sdr50;
 	max-frequency = <100000000>;
 	disable-wp;
 
Signature · 1 line
2.9.5
author reviewer
#9 lore raw

PATCH v2 9/9 ARM64: dts: meson-gxbb: nanopi-k2: enable sdr104 mode

In reply to Jerome Brunet

SDR104 seems to be OK on the nanopi-k2 SBC so enable it

---
 arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +2 -1
index 38630871c2ea..eb08bc1623f7 100644
@@ -230,7 +230,8 @@
 	sd-uhs-sdr12;
 	sd-uhs-sdr25;
 	sd-uhs-sdr50;
-	max-frequency = <100000000>;
+	sd-uhs-sdr104;
+	max-frequency = <200000000>;
 	disable-wp;
 
 	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
Signature · 1 line
2.9.5