Skip to contentSkip to conversation

ARM: dts: socfpga: fix booting with SD/MMC

PATCH New dinguyen at opensource.altera.com 2 participants 6 messages Oct 22, 2014 Device tree bindings

lore
Share & tools
lore
#0 lore raw

v4 cover ARM: dts: socfpga: fix booting with SD/MMC

From: Dinh Nguyen <[email protected]>

The SOCFPGA dev kit was hanging during bootup on the SD/MMC driver loading. The first patch fixes the booting and the 2nd patch adds a regulator node for the SD/MMC driver to use.

v4 diff(s):
- Add a new patch to rename the GPIO IP DTS node
- Use &gpio1 to set status="okay"
- Update the cd-gpios to use &portb

v3 diff(s): Thanks to Doug Anderson, the real issue was that the GPIO bank used by cd-gpios did not have status="okay" in the node. This cause the GPIO to not get probed correctly.

In fact, prior to patch 3cf890fc42b "mmc: dw_mmc: Pass back errors from mmc_of_parse()", the error was being masked, so it was not being detected.

v2 diff(s): Patch 2/2 ARM: dts: socfpga: Add a 3.3V fixed regulator node
- Move the regulator nodes to their respective board dts file and correctly rename the regulator to match the schematic

Dinh Nguyen (3):
ARM: dts: socfpga: rename gpio nodes
ARM: dts: socfpga: Fix SD card detect
ARM: dts: socfpga: Add a 3.3V fixed regulator node

 arch/arm/boot/dts/socfpga.dtsi                | 12 ++++++------
 arch/arm/boot/dts/socfpga_arria5.dtsi         |  2 +-
 arch/arm/boot/dts/socfpga_arria5_socdk.dts    | 12 ++++++++++++
 arch/arm/boot/dts/socfpga_cyclone5_socdk.dts  | 15 ++++++++++++++-
 arch/arm/boot/dts/socfpga_cyclone5_sockit.dts | 12 ++++++++++++
 5 files changed, 45 insertions(+), 8 deletions(-)
Signature · 1 line
2.0.3
#1 lore raw

PATCH v4 1/3 ARM: dts: socfpga: rename gpio nodes

From: Dinh Nguyen <[email protected]>

Since the Synopsys GPIO IP can support multiple ports of varying widths, it would make more sense to have the GPIO node DTS entry as this:

gpio0: gpio at ff708000{
	porta{
	};
};

Also, this is documented in the snps-dwapb-gpio.txt.

---
 arch/arm/boot/dts/socfpga.dtsi | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/boot/dts/socfpga.dtsi +6 -6
index 45fce2c..4472fd9 100644
@@ -547,7 +547,7 @@
 			status = "disabled";
 		};
 
-		gpio at ff708000 {
+		gpio0: gpio at ff708000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "snps,dw-apb-gpio";
@@ -555,7 +555,7 @@
 			clocks = <&per_base_clk>;
 			status = "disabled";
 
-			gpio0: gpio-controller at 0 {
+			porta: gpio-controller at 0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
@@ -567,7 +567,7 @@
 			};
 		};
 
-		gpio at ff709000 {
+		gpio1: gpio at ff709000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "snps,dw-apb-gpio";
@@ -575,7 +575,7 @@
 			clocks = <&per_base_clk>;
 			status = "disabled";
 
-			gpio1: gpio-controller at 0 {
+			portb: gpio-controller at 0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
@@ -587,7 +587,7 @@
 			};
 		};
 
-		gpio at ff70a000 {
+		gpio2: gpio at ff70a000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "snps,dw-apb-gpio";
@@ -595,7 +595,7 @@
 			clocks = <&per_base_clk>;
 			status = "disabled";
 
-			gpio2: gpio-controller at 0 {
+			portc: gpio-controller at 0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
Signature · 1 line
2.0.3
#2 lore raw

PATCH v4 1/3 ARM: dts: socfpga: rename gpio nodes

Dinh,

Quoted 10 lines · On Wed, Oct 22, 2014 at 12:07 PM, <[email protected]> wrote:

From: Dinh Nguyen <[email protected]>

Since the Synopsys GPIO IP can support multiple ports of varying widths, it would make more sense to have the GPIO node DTS entry as this:

gpio0: gpio at ff708000{
        porta{
        };
};
Quoted 7 lines

Also, this is documented in the snps-dwapb-gpio.txt.

---
 arch/arm/boot/dts/socfpga.dtsi | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

For this one patch the card detect is even more broken than it already was, but I guess that's OK. If it's not you could probably just squash this patch with the next.

#3 lore raw

PATCH v4 2/3 ARM: dts: socfpga: Fix SD card detect

In reply to dinguyen at opensource.altera.com

From: Dinh Nguyen <[email protected]>

Without this patch, the booting the SOCFPGA platform would hang at the SDMMC driver loading. The issue, debugged by Doug Anderson, turned out to be that the GPIO bank used by the SD card-detect was not set to status="okay".

Also update the cd-gpios to point to portb of the &gpio1 GPIO IP.

---
v4: Use &gpio1 to set status="okay" and update cd-gpio=&portb
v3: Correctly degugged the issue to be a gpio node not having status="okay"

---
 arch/arm/boot/dts/socfpga_cyclone5_socdk.dts | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +5 -1
index d7296a5..d91c943 100644
@@ -53,6 +53,10 @@
 	rxc-skew-ps = <2000>;
 };
 
+&gpio1 {
+	status = "okay";
+};
+
 &i2c0 {
 	status = "okay";
 
@@ -69,7 +73,7 @@
 };
 
 &mmc0 {
-	cd-gpios = <&gpio1 18 0>;
+	cd-gpios = <&portb 18 0>;
 };
 
 &usb1 {
Signature · 1 line
2.0.3
#4 lore raw

PATCH v4 2/3 ARM: dts: socfpga: Fix SD card detect

Dinh,

Quoted 9 lines · On Wed, Oct 22, 2014 at 12:07 PM, <[email protected]> wrote:

From: Dinh Nguyen <[email protected]>

Without this patch, the booting the SOCFPGA platform would hang at the SDMMC driver loading. The issue, debugged by Doug Anderson, turned out to be that the GPIO bank used by the SD card-detect was not set to status="okay".

Also update the cd-gpios to point to portb of the &gpio1 GPIO IP.

Quoted 8 lines

---
v4: Use &gpio1 to set status="okay" and update cd-gpio=&portb
v3: Correctly degugged the issue to be a gpio node not having status="okay"

---
 arch/arm/boot/dts/socfpga_cyclone5_socdk.dts | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
#5 lore raw

PATCH v4 3/3 ARM: dts: socfpga: Add a 3.3V fixed regulator node

In reply to dinguyen at opensource.altera.com

From: Dinh Nguyen <[email protected]>

Without the 3.3V regulator node, the SDMMC driver will give these warnings:

dw_mmc ff704000.dwmmc0: No vmmc regulator found
dw_mmc ff704000.dwmmc0: No vqmmc regulator found

This patch adds the regulator node, and points the SD/MMC to the regulator.

---
v3: Rename nodes to have schematic-name_regulator and remove "boot-on" and

    "always-on"
v2: Move the regulator nodes to their respective board dts file and
    correctly rename them to match the schematic
---
 arch/arm/boot/dts/socfpga_arria5.dtsi         |  2 +-
 arch/arm/boot/dts/socfpga_arria5_socdk.dts    | 12 ++++++++++++
 arch/arm/boot/dts/socfpga_cyclone5_socdk.dts  |  9 +++++++++
 arch/arm/boot/dts/socfpga_cyclone5_sockit.dts | 12 ++++++++++++
 4 files changed, 34 insertions(+), 1 deletion(-)
arch/arm/boot/dts/socfpga_arria5.dtsi +1 -1
index 03e8268..1907cc6 100644
@@ -29,7 +29,7 @@
 			};
 		};
 
-		dwmmc0 at ff704000 {
+		mmc0: dwmmc0 at ff704000 {
 			num-slots = <1>;
 			broken-cd;
 			bus-width = <4>;
arch/arm/boot/dts/socfpga_arria5_socdk.dts +12 -0
index 27d551c..ccaf417 100644
@@ -37,6 +37,13 @@
 		*/
 		ethernet0 = &gmac1;
 	};
+
+	regulator_3_3v: 3-3-v-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
 };
 
 &gmac1 {
@@ -68,6 +75,11 @@
 	};
 };
 
+&mmc0 {
+	vmmc-supply = <&regulator_3_3v>;
+	vqmmc-supply = <&regulator_3_3v>;
+};
+
 &usb1 {
 	status = "okay";
 };
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +9 -0
index d91c943..258865d 100644
@@ -37,6 +37,13 @@
 		 */
 		ethernet0 = &gmac1;
 	};
+
+	regulator_3_3v: 3-3-v-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
 };
 
 &gmac1 {
@@ -74,6 +81,8 @@
 
 &mmc0 {
 	cd-gpios = <&portb 18 0>;
+	vmmc-supply = <&regulator_3_3v>;
+	vqmmc-supply = <&regulator_3_3v>;
 };
 
 &usb1 {
arch/arm/boot/dts/socfpga_cyclone5_sockit.dts +12 -0
index d26f155..16ea6f5 100644
@@ -37,6 +37,13 @@
 		 */
 		ethernet0 = &gmac1;
 	};
+
+	regulator_3_3v: vcc3p3-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "VCC3P3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
 };
 
 &gmac1 {
@@ -53,6 +60,11 @@
 	rxc-skew-ps = <2000>;
 };
 
+&mmc0 {
+	vmmc-supply = <&regulator_3_3v>;
+	vqmmc-supply = <&regulator_3_3v>;
+};
+
 &usb1 {
 	status = "okay";
 };
Signature · 1 line
2.0.3