From patchwork Tue May 20 14:37:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 4210991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C7F799F23C for ; Tue, 20 May 2014 14:47:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 00653202DD for ; Tue, 20 May 2014 14:47:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1BE9420165 for ; Tue, 20 May 2014 14:47:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WmlHl-0001Uu-Lc; Tue, 20 May 2014 14:44:57 +0000 Received: from mail-pd0-f179.google.com ([209.85.192.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WmlHd-0001Ip-37 for linux-arm-kernel@lists.infradead.org; Tue, 20 May 2014 14:44:49 +0000 Received: by mail-pd0-f179.google.com with SMTP id x10so379687pdj.24 for ; Tue, 20 May 2014 07:44:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vr9KVqbpxroyLPlY3v1Zd/ZfHm20w5yDIG5JeRpF8YM=; b=GbzJDiNIMRUnN7DT192i21kFfWz4QG3O7uqoPhZ7xH9xJ5vogHlmxOi8SSbSRoUCSe dC6VENCFg+vj40YulKfZEBUISMI6Hc9jhxOJ2z46fHSoV+wEcnVkS0ayvaWv3S2wjF9b lDmrCoX0bLCyWxb032WHO38PTsm3/j7MmiDEMOW41hkMd/gzft+qxyrLu8ZvG6eDUd8k jRF+Ropdqwe//nT14THnUZ7J4qJesCISeuG/0kIcWdh1y5m//FtRfuorHRqEx5I8Pirt hdOrgIb82Lx7k7r6lxVuE+G0yBt1iNPErV13CLly+merrtQm4v6ZG34WuNWS8B9857K3 f26w== X-Gm-Message-State: ALoCoQkAQB1GagAuqG9Bi/WF6sOA5DJkubBAw4zA/0tojL2NHeeiTKC7ABPrlsJO/XLbciV/bdB4 X-Received: by 10.66.163.2 with SMTP id ye2mr7709785pab.110.1400596658564; Tue, 20 May 2014 07:37:38 -0700 (PDT) Received: from localhost.localdomain ([140.206.182.114]) by mx.google.com with ESMTPSA id ga1sm3478917pbb.82.2014.05.20.07.37.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 May 2014 07:37:37 -0700 (PDT) From: Haojian Zhuang To: yanhaifeng@gmail.com, xuwei5@hisilicon.com, arnd@arndb.de, olof@lixom.net, linux-arm-kernel@lists.infradead.org, khilman@kernel.org, jchxue@gmail.com Subject: [PATCH v3 1/6] ARM: hisi: store reboot reg in global variable Date: Tue, 20 May 2014 22:37:00 +0800 Message-Id: <1400596625-16830-2-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1400596625-16830-1-git-send-email-haojian.zhuang@linaro.org> References: <1400596625-16830-1-git-send-email-haojian.zhuang@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140520_074449_183201_B9A5089D X-CRM114-Status: GOOD ( 11.73 ) X-Spam-Score: -0.0 (/) Cc: Haojian Zhuang X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid to parse DT in restart() function. Parsing these in init_late() instead. Signed-off-by: Haojian Zhuang --- 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 a9f648f..48c91ae 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