+++ /dev/null
-/*
- * 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)
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));
}
/**
- * 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;
}
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;
}