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: 30474 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AF84520671 for ; Tue, 20 May 2014 14:46:59 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id uq10sf2428480igb.1 for ; Tue, 20 May 2014 07:46:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=WiWeljtX81iXtqDhsWGgFtgesD+gr4UN1JY22W7xCCA=; b=HvYRPkt7oOjkfZYX259pTbxsgkjI9YpLjYTFO0ipomallSjOqxqnpHgcmV4L0uxCta OLzHKpmkYUvEAgASYWUxua9l9cHyT9zTHDJIox4A6NHDryIwzNNzTk/PnwQiKmFWz9Gh YwEP7oqXl3wEmGW4Z512nrz9U6vbmfl5s220M626NxsGglW/57gZSOimbFT35RnxAkMO Uym9QGIlZ5XbKAwdLgyxR1jRXmUxItuRyfF8f4AlBK/cFzZx6uEE4LsDzNF6PaF9FBCa OC59CVKcZ6r1oj34cB2YRnObPZnfRB1RFxoI9zBKViPra3xO58TFNDA904W7JqtzdSIl XG2A== X-Gm-Message-State: ALoCoQnZjz3j5mWW8iaV1GiTX8wZefEftrOdxtzQ7fUe21d6fv+cPJGcGrWjoBXG4Q4tLcikj0BB X-Received: by 10.182.24.104 with SMTP id t8mr19647559obf.34.1400597219178; Tue, 20 May 2014 07:46:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.46 with SMTP id k43ls313959qgk.58.gmail; Tue, 20 May 2014 07:46:59 -0700 (PDT) X-Received: by 10.220.175.70 with SMTP id w6mr918073vcz.72.1400597218987; Tue, 20 May 2014 07:46:58 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id xn7si792609vcb.105.2014.05.20.07.46.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 May 2014 07:46:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id im17so726887vcb.24 for ; Tue, 20 May 2014 07:46:58 -0700 (PDT) X-Received: by 10.221.7.71 with SMTP id on7mr4189184vcb.18.1400597218829; Tue, 20 May 2014 07:46:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp36660vcb; Tue, 20 May 2014 07:46:58 -0700 (PDT) X-Received: by 10.140.51.74 with SMTP id t68mr57223554qga.50.1400597218226; Tue, 20 May 2014 07:46:58 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id t40si10787061qge.104.2014.05.20.07.46.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 May 2014 07:46:58 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; 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-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 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.192.179 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: haojian.zhuang@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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