linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: haojian.zhuang@linaro.org (Haojian Zhuang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/6] ARM: hisi: store reboot reg in global variable
Date: Tue, 13 May 2014 17:44:36 +0800	[thread overview]
Message-ID: <1399974281-9737-2-git-send-email-haojian.zhuang@linaro.org> (raw)
In-Reply-To: <1399974281-9737-1-git-send-email-haojian.zhuang@linaro.org>

Avoid to parse DT in restart() function. Parsing these in init_late()
instead.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 arch/arm/mach-hisi/hisilicon.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-hisi/hisilicon.c b/arch/arm/mach-hisi/hisilicon.c
index 6489e57..a476388 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
-- 
1.9.1

  reply	other threads:[~2014-05-13  9:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-13  9:44 [PATCH v2 0/6] enable HiX5HD2 SoC Haojian Zhuang
2014-05-13  9:44 ` Haojian Zhuang [this message]
2014-05-13  9:44 ` [PATCH v2 2/6] ARM: debug: Rename Hi3716 to HI5XHD2 Haojian Zhuang
2014-05-13  9:44 ` [PATCH v2 3/6] ARM: hisi: enable hix5hd2 SoC Haojian Zhuang
2014-05-13  9:44 ` [PATCH v2 4/6] ARM: dts: Add hix5hd2-dkb dts file Haojian Zhuang
2014-05-13  9:44 ` [PATCH v2 5/6] ARM: config: add ARCH_HIX5HD2 in hi3xxx_defconfig Haojian Zhuang
2014-05-13  9:44 ` [PATCH v2 6/6] document: add dt binding on hix5hd2 SoC Haojian Zhuang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399974281-9737-2-git-send-email-haojian.zhuang@linaro.org \
    --to=haojian.zhuang@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).