ARM: rockchip: remove headsmp.S and add bootram support
author黄涛 <huangtao@rock-chips.com>
Mon, 2 Dec 2013 02:50:42 +0000 (10:50 +0800)
committer黄涛 <huangtao@rock-chips.com>
Mon, 2 Dec 2013 02:50:42 +0000 (10:50 +0800)
arch/arm/boot/dts/rk3188.dtsi
arch/arm/mach-rockchip/Makefile
arch/arm/mach-rockchip/core.h
arch/arm/mach-rockchip/headsmp.S [deleted file]
arch/arm/mach-rockchip/platsmp.c

index 27607f16e6b0fc942a9918e86c04cd3aa9f239a6..b6a1a740ef75c149299062fef9d128f774d0e17e 100644 (file)
                arm,data-latency = <2 3 1>;
        };
 
-       sram@10080000 {
-               compatible = "rockchip,sram";
-               reg = <0x10080000 0x8000>;
+       bootrom@10120000 {
+               compatible = "rockchip,bootrom";
+               reg = <0x10120000 0x4000>;
+       };
+
+       bootram@10080000 {
+               compatible = "rockchip,bootram";
+               reg = <0x10080000 0x20>; /* 32 bytes */
+       };
+
+       sram@10080020 {
+               compatible = "mmio-sram";
+               reg = <0x10080020 (0x8000 - 0x20)>; /* 32k - 32 */
+               map-exec;
        };
 
        pmu@20004000 {
index 82e794e7d9df72f275ff4d1042d9942df64fc4a8..3bd6ba0ec95e4d8d4fd6aa207cedb676fe7c2f53 100644 (file)
@@ -1,2 +1,2 @@
 obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o
-obj-$(CONFIG_SMP) += platsmp.o headsmp.o
+obj-$(CONFIG_SMP) += platsmp.o
index ce70ab4e085c39d750f1089a5fa920579e3c2918..a23568585e6f41a17c058367492ec98a71600188 100644 (file)
@@ -17,9 +17,6 @@
 #ifndef __MACH_CORE_H
 #define __MACH_CORE_H
 
-extern char rockchip_secondary_trampoline;
-extern char rockchip_secondary_trampoline_end;
-
 extern unsigned long rockchip_boot_fn;
 
 extern struct smp_operations rockchip_smp_ops;
diff --git a/arch/arm/mach-rockchip/headsmp.S b/arch/arm/mach-rockchip/headsmp.S
deleted file mode 100644 (file)
index 34ab408..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2013 ROCKCHIP, Inc.
- * Copyright (c) 2013 MundoReader S.L.
- * Author: Heiko Stuebner <heiko@sntech.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-#include <linux/linkage.h>
-#include <linux/init.h>
-
-ENTRY(rockchip_secondary_trampoline)
-       ldr     pc, 1f
-ENDPROC(rockchip_secondary_trampoline)
-
-       .globl  rockchip_boot_fn
-rockchip_boot_fn:
-1:     .space  4
-
-ENTRY(rockchip_secondary_trampoline_end)
index 25b51506d631e430c4e415fe7efb6f6ca4744ff8..1c43e5df58126fbb05fc5cbbdfc60ed182908a62 100644 (file)
@@ -44,12 +44,23 @@ static void __iomem *pmu_base_addr;
 
 extern void secondary_startup(void);
 extern void v7_invalidate_l1(void);
+
 static void __naked rockchip_a9_secondary_startup(void)
 {
        v7_invalidate_l1();
        secondary_startup();
 }
 
+static void __naked rockchip_secondary_trampoline(void)
+{
+       asm volatile (
+               "ldr    pc, 1f\n"
+               ".globl rockchip_boot_fn\n"
+               "rockchip_boot_fn:\n"
+               "1:     .space  4\n"
+       );
+}
+
 static inline bool pmu_power_domain_is_on(int pd)
 {
        return !(readl_relaxed(pmu_base_addr + PMU_PWRDN_ST) & BIT(pd));
@@ -87,34 +98,39 @@ static int __cpuinit rockchip_boot_secondary(unsigned int cpu,
 }
 
 /**
- * rockchip_smp_prepare_sram - populate necessary sram block
- * Starting cores execute the code residing at the start of the on-chip sram
+ * rockchip_smp_prepare_bootram - populate necessary bootram block
+ * Starting cores execute the code residing at the start of the on-chip bootram
  * after power-on. Therefore make sure, this sram region is reserved and
  * big enough. After this check, copy the trampoline code that directs the
  * core to the real startup code in ram into the sram-region.
  */
-static int __init rockchip_smp_prepare_sram(void)
+static int __init rockchip_smp_prepare_bootram(void)
 {
-       void __iomem *sram_base_addr;
-       unsigned int trampoline_sz = &rockchip_secondary_trampoline_end -
-                                           &rockchip_secondary_trampoline;
+       struct device_node *node;
+       void __iomem *bootram_base_addr;
+
+       node = of_find_compatible_node(NULL, NULL, "rockchip,bootram");
+       if (!node) {
+               pr_err("%s: could not find bootram dt node\n", __func__);
+               return -ENODEV;
+       }
 
-       sram_base_addr = ioremap_nocache(0, trampoline_sz);
-       if (!sram_base_addr) {
-               pr_err("%s: could not map sram\n", __func__);
+       bootram_base_addr = of_iomap(node, 0);
+       if (!bootram_base_addr) {
+               pr_err("%s: could not map bootram\n", __func__);
                BUG();
        }
 
-       /* set the boot function for the sram code */
+       /* set the boot function for the bootram code */
        if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
                rockchip_boot_fn = virt_to_phys(rockchip_a9_secondary_startup);
        else
                rockchip_boot_fn = virt_to_phys(secondary_startup);
 
-       /* copy the trampoline to sram, that runs during startup of the core */
-       memcpy(sram_base_addr, &rockchip_secondary_trampoline, trampoline_sz);
+       /* copy the trampoline to bootram, that runs during startup of the core */
+       memcpy(bootram_base_addr, &rockchip_secondary_trampoline, 8);
 
-       iounmap(sram_base_addr);
+       iounmap(bootram_base_addr);
 
        return 0;
 }
@@ -133,12 +149,12 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
                BUG();
        }
 
-       if (rockchip_smp_prepare_sram())
+       if (rockchip_smp_prepare_bootram())
                return;
 
        node = of_find_compatible_node(NULL, NULL, "rockchip,pmu");
        if (!node) {
-               pr_err("%s: could not find sram dt node\n", __func__);
+               pr_err("%s: could not find pmu dt node\n", __func__);
                return;
        }