Skip to contentSkip to conversation

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

PATCH Superseded dinguyen at opensource.altera.com 3 participants 8 messages Oct 21, 2014 – Oct 22, 2014 Device tree bindings

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 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.

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 (2):
ARM: dts: socfpga: Fix SD card detect
ARM: dts: socfpga: Add a 3.3V fixed regulator node

 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 ++++++++++++
 4 files changed, 40 insertions(+), 1 deletion(-)
Signature · 1 line
2.0.3
#1 lore raw

PATCH v3 1/2 ARM: dts: socfpga: Fix SD card detect

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".

---
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, 6 insertions(+)
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +6 -0
index d7296a5..03a3745 100644
@@ -37,6 +37,12 @@
 		 */
 		ethernet0 = &gmac1;
 	};
+
+	soc {
+		gpio at ff709000 {
+			status = "okay";
+		};
+	};
 };
 
 &gmac1 {
Signature · 1 line
2.0.3
#2 lore raw

PATCH v3 1/2 ARM: dts: socfpga: Fix SD card detect

Hi!

Quoted 21 lines · 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".

---
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, 6 insertions(+)
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +0 -0
index d7296a5..03a3745 100644
@@ -37,6 +37,12 @@
 		 */

arch/arm/boot/dts/socfpga_cyclone5_socdk.dts line 47

Quoted 10 lines
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +6 -0
 		ethernet0 = &gmac1;
 	};
+
+	soc {
+		gpio at ff709000 {
+			status = "okay";
+		};
+	};
 };
 

Looks weird. Don't you need to enable the GPIO bank instead:

	&gpio1 {
		status = "okay";
	}

???

Regards,
Steffen

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#3 lore raw

PATCH v3 1/2 ARM: dts: socfpga: Fix SD card detect

Quoted 37 lines · Steffen Trumtrar

Hi!

Quoted 21 lines · 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".

---
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, 6 insertions(+)
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +0 -0
index d7296a5..03a3745 100644
@@ -37,6 +37,12 @@
 		 */

arch/arm/boot/dts/socfpga_cyclone5_socdk.dts line 47

Quoted 10 lines
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +6 -0
 		ethernet0 = &gmac1;
 	};
+
+	soc {
+		gpio at ff709000 {
+			status = "okay";
+		};
+	};
 };
 

Looks weird. Don't you need to enable the GPIO bank instead:

Quoted 4 lines
	&gpio1 {
		status = "okay";
	}

No, this will not work as gpio1 is already a node inside gpio at ff709000. The reason for this was that the Designware GPIO IP can support 1, 2 or 3 gpio ports of varying widths. [1][2]

Dinh

[1]
http://article.gmane.org/gmane.linux.drivers.devicetree/72771/match=dw+apb+gpio
[2] http://article.gmane.org/gmane.linux.kernel/1671576/match=dw+apb+gpio

#4 lore raw

PATCH v3 1/2 ARM: dts: socfpga: Fix SD card detect

Dinh,

(without the HTML mail this time, sorry)

Quoted 19 lines · Dinh Nguyen
Quoted 18 lines · Steffen Trumtrar

Hi!

Quoted 15 lines · 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".

---
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, 6 insertions(+)
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +0 -0
index d7296a5..03a3745 100644
@@ -37,6 +37,12 @@
              */
Quoted 8 lines

arch/arm/boot/dts/socfpga_cyclone5_socdk.dts line 45

Quoted 8 lines
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +6 -0
             ethernet0 = &gmac1;
     };
+
+    soc {
+            gpio at ff709000 {
+                    status = "okay";
+            };
+    };

I haven't dug into the details you provided about the GPIO infrastructure of socfpga, but it does seem like it might be nice to some easier way to reference things in "arch/arm/boot/dts/socfpga.dtsi".

Looking at other examples they call the "gpio at ff708000" "gpio0" and the sub node something like "porta". Given that this is the only reference to the GPIO, it seems like now would be the time to change it.

-Doug

#5 lore raw

PATCH v3 1/2 ARM: dts: socfpga: Fix SD card detect

Quoted 45 lines · Doug Anderson

Dinh,

(without the HTML mail this time, sorry)

Quoted 19 lines · Dinh Nguyen
Quoted 18 lines · Steffen Trumtrar

Hi!

Quoted 15 lines · 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".

---
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, 6 insertions(+)
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +0 -0
index d7296a5..03a3745 100644
@@ -37,6 +37,12 @@
              */
Quoted 8 lines

arch/arm/boot/dts/socfpga_cyclone5_socdk.dts line 45

Quoted 8 lines
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +6 -0
             ethernet0 = &gmac1;
     };
+
+    soc {
+            gpio at ff709000 {
+                    status = "okay";
+            };
+    };

I haven't dug into the details you provided about the GPIO infrastructure of socfpga, but it does seem like it might be nice to some easier way to reference things in "arch/arm/boot/dts/socfpga.dtsi".

Quoted 4 lines

Looking at other examples they call the "gpio at ff708000" "gpio0" and the sub node something like "porta". Given that this is the only reference to the GPIO, it seems like now would be the time to change it.

Yeah...I like your idea. Let met get a new patch for that...

Thanks,
Dinh

#6 lore raw

Re: [PATCHv3 1/2] ARM: dts: socfpga: Fix SD card detect

In reply to dinguyen at opensource.altera.com

Dinh,

Quoted 21 lines · On Tue, Oct 21, 2014 at 9:15 AM, <[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".

---
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, 6 insertions(+)
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +0 -0
index d7296a5..03a3745 100644

arch/arm/boot/dts/socfpga_cyclone5_socdk.dts line 46

Quoted 10 lines
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +6 -0
@@ -37,6 +37,12 @@
                 */
                ethernet0 = &gmac1;
        };
+
+       soc {
+               gpio@ff709000 {
+                       status = "okay";
+               };
+       };
 

I haven't dug into the details you provided about the GPIO infrastructure of socfpga, but it does seem like it might be nice to some easier way to reference things in "arch/arm/boot/dts/socfpga.dtsi".

Looking at other examples they call the "gpio@ff708000" "gpio0" and the sub node something like "porta". Given that this is the only reference to the GPIO, it seems like now would be the time to change it.

#7 lore raw

PATCH v3 2/2 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 03a3745..f962135 100644
@@ -43,6 +43,13 @@
 			status = "okay";
 		};
 	};
+
+	regulator_3_3v: 3-3-v-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
 };
 
 &gmac1 {
@@ -76,6 +83,8 @@
 
 &mmc0 {
 	cd-gpios = <&gpio1 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