From: 黄涛 Date: Mon, 2 Dec 2013 02:50:42 +0000 (+0800) Subject: ARM: rockchip: remove headsmp.S and add bootram support X-Git-Tag: firefly_0821_release~6465 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2055deaf298605d427d6e75c98351ecc344423d3;p=firefly-linux-kernel-4.4.55.git ARM: rockchip: remove headsmp.S and add bootram support --- diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi index 27607f16e6b0..b6a1a740ef75 100644 --- a/arch/arm/boot/dts/rk3188.dtsi +++ b/arch/arm/boot/dts/rk3188.dtsi @@ -55,9 +55,20 @@ 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 { diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index 82e794e7d9df..3bd6ba0ec95e 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -1,2 +1,2 @@ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o -obj-$(CONFIG_SMP) += platsmp.o headsmp.o +obj-$(CONFIG_SMP) += platsmp.o diff --git a/arch/arm/mach-rockchip/core.h b/arch/arm/mach-rockchip/core.h index ce70ab4e085c..a23568585e6f 100644 --- a/arch/arm/mach-rockchip/core.h +++ b/arch/arm/mach-rockchip/core.h @@ -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 index 34ab408bf571..000000000000 --- a/arch/arm/mach-rockchip/headsmp.S +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2013 ROCKCHIP, Inc. - * Copyright (c) 2013 MundoReader S.L. - * Author: Heiko Stuebner - * - * 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 -#include - -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) diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c index 25b51506d631..1c43e5df5812 100644 --- a/arch/arm/mach-rockchip/platsmp.c +++ b/arch/arm/mach-rockchip/platsmp.c @@ -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; }