Merge tag 'socfpga_fixes_for_3.18' of git://git.rocketboards.org/linux-socfpga-next...
authorOlof Johansson <olof@lixom.net>
Fri, 24 Oct 2014 04:05:45 +0000 (21:05 -0700)
committerOlof Johansson <olof@lixom.net>
Fri, 24 Oct 2014 04:05:45 +0000 (21:05 -0700)
Merge "SOCFPGA fixes for 3.18" from Dinh Nguyen:

These patches fixes an SMP and SDMMC driver hang during boot up on the
SOCFPGA platform.

Patch "arm: socfpga: fix fetching cpu1start_addr for SMP" fixes the SMP
trampoline code in order for CPU1 to correctly fetch it's cpu1start_addr.

Patch "ARM: dts: socfpga: rename gpio nodes" renames that GPIO node in order
to allow a standard way of specifying status="okay" in the board DTS file.

Patch "ARM: dts: socfpga: Fix SD card detect" fixes a SDMMC driver hang
during boot. The reason for the hang was the deferred probe of the SDMMC
driver was waiting for the GPIO resource that would never come.

Patch "ARM: dts: socfpga: Add a 3.3V fixed regulator node" adds a fixed
regulator node for the SDMMC driver to use.

* tag 'socfpga_fixes_for_3.18' of git://git.rocketboards.org/linux-socfpga-next:
  ARM: dts: socfpga: Add a 3.3V fixed regulator node
  ARM: dts: socfpga: Fix SD card detect
  ARM: dts: socfpga: rename gpio nodes
  arm: socfpga: fix fetching cpu1start_addr for SMP

Signed-off-by: Olof Johansson <olof@lixom.net>
arch/arm/boot/dts/socfpga.dtsi
arch/arm/boot/dts/socfpga_arria5.dtsi
arch/arm/boot/dts/socfpga_arria5_socdk.dts
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts
arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
arch/arm/mach-socfpga/core.h
arch/arm/mach-socfpga/headsmp.S
arch/arm/mach-socfpga/platsmp.c
arch/arm/mach-socfpga/socfpga.c

index 45fce2cf6fede0a11ce2aca2d1de31aa70147ecf..4472fd92685c4b84d54e9dfb0041646f709e3477 100644 (file)
                        status = "disabled";
                };
 
-               gpio@ff708000 {
+               gpio0: gpio@ff708000 {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "snps,dw-apb-gpio";
                        clocks = <&per_base_clk>;
                        status = "disabled";
 
-                       gpio0: gpio-controller@0 {
+                       porta: gpio-controller@0 {
                                compatible = "snps,dw-apb-gpio-port";
                                gpio-controller;
                                #gpio-cells = <2>;
                        };
                };
 
-               gpio@ff709000 {
+               gpio1: gpio@ff709000 {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "snps,dw-apb-gpio";
                        clocks = <&per_base_clk>;
                        status = "disabled";
 
-                       gpio1: gpio-controller@0 {
+                       portb: gpio-controller@0 {
                                compatible = "snps,dw-apb-gpio-port";
                                gpio-controller;
                                #gpio-cells = <2>;
                        };
                };
 
-               gpio@ff70a000 {
+               gpio2: gpio@ff70a000 {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "snps,dw-apb-gpio";
                        clocks = <&per_base_clk>;
                        status = "disabled";
 
-                       gpio2: gpio-controller@0 {
+                       portc: gpio-controller@0 {
                                compatible = "snps,dw-apb-gpio-port";
                                gpio-controller;
                                #gpio-cells = <2>;
index 03e8268ae2196e697cededfe5db00eec393fac9d..1907cc60045218663fad56e7def2a8825311f9f1 100644 (file)
@@ -29,7 +29,7 @@
                        };
                };
 
-               dwmmc0@ff704000 {
+               mmc0: dwmmc0@ff704000 {
                        num-slots = <1>;
                        broken-cd;
                        bus-width = <4>;
index 27d551c384d06b884f4eee5d19f7c75e783938e3..ccaf41742fc3d05921ee80d67ba00304010a666b 100644 (file)
                */
                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 {
        };
 };
 
+&mmc0 {
+       vmmc-supply = <&regulator_3_3v>;
+       vqmmc-supply = <&regulator_3_3v>;
+};
+
 &usb1 {
        status = "okay";
 };
index d7296a5f750cd5edef23d62078b47361027de785..258865da8f6a6fe45a0fc9ae6c0281ef2f0c4824 100644 (file)
                 */
                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 {
        rxc-skew-ps = <2000>;
 };
 
+&gpio1 {
+       status = "okay";
+};
+
 &i2c0 {
        status = "okay";
 
@@ -69,7 +80,9 @@
 };
 
 &mmc0 {
-       cd-gpios = <&gpio1 18 0>;
+       cd-gpios = <&portb 18 0>;
+       vmmc-supply = <&regulator_3_3v>;
+       vqmmc-supply = <&regulator_3_3v>;
 };
 
 &usb1 {
index d26f155f5fd9f64fcdbd1bcf12626c6008683b9b..16ea6f5f2ab81092d76697d020ef575610dc8045 100644 (file)
                 */
                ethernet0 = &gmac1;
        };
+
+       regulator_3_3v: vcc3p3-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC3P3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
 };
 
 &gmac1 {
        rxc-skew-ps = <2000>;
 };
 
+&mmc0 {
+       vmmc-supply = <&regulator_3_3v>;
+       vqmmc-supply = <&regulator_3_3v>;
+};
+
 &usb1 {
        status = "okay";
 };
index 572b8f719ffbf040c6d6e5f4b5274f21e89045db..60c443dadb58c0cff441962c6c7c1e2317281cb1 100644 (file)
@@ -40,7 +40,7 @@ extern void __iomem *rst_manager_base_addr;
 extern struct smp_operations socfpga_smp_ops;
 extern char secondary_trampoline, secondary_trampoline_end;
 
-extern unsigned long cpu1start_addr;
+extern unsigned long socfpga_cpu1start_addr;
 
 #define SOCFPGA_SCU_VIRT_BASE   0xfffec000
 
index 95c115d8b5eee5407feb99ce996f5793ceb34747..f65ea0af4af37dbdce42f9bf1af740b4feeb9e22 100644 (file)
@@ -9,21 +9,26 @@
  */
 #include <linux/linkage.h>
 #include <linux/init.h>
+#include <asm/memory.h>
 
        .arch   armv7-a
 
 ENTRY(secondary_trampoline)
-       movw    r2, #:lower16:cpu1start_addr
-       movt  r2, #:upper16:cpu1start_addr
-
-       /* The socfpga VT cannot handle a 0xC0000000 page offset when loading
-               the cpu1start_addr, we bit clear it. Tested on HW and VT. */
-       bic     r2, r2, #0x40000000
-
-       ldr     r0, [r2]
-       ldr     r1, [r0]
-       bx      r1
+       /* CPU1 will always fetch from 0x0 when it is brought out of reset.
+        * Thus, we can just subtract the PAGE_OFFSET to get the physical
+        * address of &cpu1start_addr. This would not work for platforms
+        * where the physical memory does not start at 0x0.
+        */
+       adr     r0, 1f
+       ldmia   r0, {r1, r2}
+       sub     r2, r2, #PAGE_OFFSET
+       ldr     r3, [r2]
+       ldr     r4, [r3]
+       bx      r4
 
+       .align
+1:     .long   .
+       .long   socfpga_cpu1start_addr
 ENTRY(secondary_trampoline_end)
 
 ENTRY(socfpga_secondary_startup)
index 5356a72bc8ce901fdf82d0626f6ca59c9bfa85bf..16ca97b039f90d542c12182c560c870cc0089199 100644 (file)
@@ -33,11 +33,11 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
        int trampoline_size = &secondary_trampoline_end - &secondary_trampoline;
 
-       if (cpu1start_addr) {
+       if (socfpga_cpu1start_addr) {
                memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size);
 
                __raw_writel(virt_to_phys(socfpga_secondary_startup),
-                       (sys_manager_base_addr + (cpu1start_addr & 0x000000ff)));
+                       (sys_manager_base_addr + (socfpga_cpu1start_addr & 0x000000ff)));
 
                flush_cache_all();
                smp_wmb();
index adbf38314ca8c47aac8a52dd70ce68c46a0e9647..383d61e138af1e9dfeee1ccac39b6adb42f74236 100644 (file)
@@ -29,7 +29,7 @@
 void __iomem *socfpga_scu_base_addr = ((void __iomem *)(SOCFPGA_SCU_VIRT_BASE));
 void __iomem *sys_manager_base_addr;
 void __iomem *rst_manager_base_addr;
-unsigned long cpu1start_addr;
+unsigned long socfpga_cpu1start_addr;
 
 static struct map_desc scu_io_desc __initdata = {
        .virtual        = SOCFPGA_SCU_VIRT_BASE,
@@ -70,7 +70,7 @@ void __init socfpga_sysmgr_init(void)
        np = of_find_compatible_node(NULL, NULL, "altr,sys-mgr");
 
        if (of_property_read_u32(np, "cpu1-start-addr",
-                       (u32 *) &cpu1start_addr))
+                       (u32 *) &socfpga_cpu1start_addr))
                pr_err("SMP: Need cpu1-start-addr in device tree.\n");
 
        sys_manager_base_addr = of_iomap(np, 0);