aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2014-05-13 17:11:28 +0800
committerHaojian Zhuang <haojian.zhuang@linaro.org>2014-06-26 09:42:05 +0800
commita8f2f24ea7c19244dffdd59e79768a0bb93c3f5c (patch)
tree87fdaf2b7b9266a74c0640202166af29628a16dc
parent7171511eaec5bf23fb06078f59784a3a0626b38f (diff)
ARM: hisi: store reboot reg in global variable
Avoid to parse DT in restart() function. Parsing these in init_late() instead. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
-rw-r--r--arch/arm/mach-hisi/hisilicon.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/arch/arm/mach-hisi/hisilicon.c b/arch/arm/mach-hisi/hisilicon.c
index 741faf3e7100..a2387bc74fda 100644
--- a/arch/arm/mach-hisi/hisilicon.c
+++ b/arch/arm/mach-hisi/hisilicon.c
@@ -45,33 +45,38 @@ static struct map_desc hi3620_io_desc[] __initdata = {
},
};
+static void __iomem *sysctrl_base;
+static u32 reboot_offset;
+
static void __init hi3620_map_io(void)
{
debug_ll_io_init();
iotable_init(hi3620_io_desc, ARRAY_SIZE(hi3620_io_desc));
}
-static void hi3xxx_restart(enum reboot_mode mode, const char *cmd)
+static void __init hi3xxx_init_late(void)
{
struct device_node *np;
- void __iomem *base;
- int offset;
np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
if (!np) {
pr_err("failed to find hisilicon,sysctrl node\n");
return;
}
- base = of_iomap(np, 0);
- if (!base) {
+ sysctrl_base = of_iomap(np, 0);
+ if (!sysctrl_base) {
pr_err("failed to map address in hisilicon,sysctrl node\n");
return;
}
- if (of_property_read_u32(np, "reboot-offset", &offset) < 0) {
+ if (of_property_read_u32(np, "reboot-offset", &reboot_offset) < 0) {
pr_err("failed to find reboot-offset property\n");
return;
}
- writel_relaxed(0xdeadbeef, base + offset);
+}
+
+static void hi3xxx_restart(enum reboot_mode mode, const char *cmd)
+{
+ writel_relaxed(0xdeadbeef, sysctrl_base + reboot_offset);
while (1)
cpu_do_idle();
@@ -85,6 +90,7 @@ static const char *hi3xxx_compat[] __initconst = {
DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)")
.map_io = hi3620_map_io,
.dt_compat = hi3xxx_compat,
+ .init_late = hi3xxx_init_late,
.smp = smp_ops(hi3xxx_smp_ops),
.restart = hi3xxx_restart,
MACHINE_END