From patchwork Tue May 13 09:44:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 4164431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 55D62BFF02 for ; Tue, 13 May 2014 09:49:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 787832011B for ; Tue, 13 May 2014 09:49:05 +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 A0CC320254 for ; Tue, 13 May 2014 09:49:04 +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 1Wk9HM-0001dd-Lu; Tue, 13 May 2014 09:45:44 +0000 Received: from mail-pa0-f53.google.com ([209.85.220.53]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wk9HE-0001Qk-5y for linux-arm-kernel@lists.infradead.org; Tue, 13 May 2014 09:45:36 +0000 Received: by mail-pa0-f53.google.com with SMTP id kp14so79081pab.40 for ; Tue, 13 May 2014 02:45:20 -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=ccO4yH1oBC/Y2DFHx24yCKWYxkNSAK8xnaouroRCRQ8=; b=JXl8m55AS5ESmOaWAzWfxzrfGuCghsLbOYROLekNWNm06ocoTjpurkW6yVel+IUeVf jH7t+lq/Rfc0hhZ5zj2PGS2IufSC2McuTLXNidWNoF1HMcLxeY88CBTKRsuwBa6/yatU hX0P67rbHTg+C/PVo6M4QTYsUWrzvJ97oRcZhaW2FBD3OL4AmfhBncBa9ZCvZ1zI8twB f/XcsywFW6pPp6n4FfCuOYjimK1yJrOSZlaqjt3ijDKKZC94TyN/96sNQZkUX/9gw9EC hLtEyE/6wBbzhFGNynxzn9qqZVYKv3SuM5NartcMjhBq+LLj9VPtqWnRGPW+2gUUtbeW U1Qg== X-Gm-Message-State: ALoCoQl1avS1Pd9YfUaV7TtoWlQK4s/uqGt00Yc3G3TJQwInrsPpDH4b39QMzHRafapMsYvJxJeJ X-Received: by 10.66.226.172 with SMTP id rt12mr3067573pac.101.1399974320109; Tue, 13 May 2014 02:45:20 -0700 (PDT) Received: from localhost.localdomain ([140.206.182.114]) by mx.google.com with ESMTPSA id kj1sm27294335pbd.20.2014.05.13.02.45.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 May 2014 02:45:19 -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 v2 1/6] ARM: hisi: store reboot reg in global variable Date: Tue, 13 May 2014 17:44:36 +0800 Message-Id: <1399974281-9737-2-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1399974281-9737-1-git-send-email-haojian.zhuang@linaro.org> References: <1399974281-9737-1-git-send-email-haojian.zhuang@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140513_024536_324286_6B4E85EE X-CRM114-Status: GOOD ( 11.87 ) X-Spam-Score: -0.7 (/) 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 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