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: 30013 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 38E8A20560 for ; Tue, 13 May 2014 09:48:01 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id l6sf421337oag.3 for ; Tue, 13 May 2014 02:48:00 -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=WiN8/nBAm/shdut1YEf9QG6R68CUJYyElbK3DJcDuVg=; b=FkY2+9n9zEBFSHDMMOwtv0IA9FO+40LUyTH+Cxce6lN+Aho3ybKfA5U8DG0fISvIX4 GikZPybzDOzK6LOP6Z2EWBjaB7WrVgYMIqFlGq+nEGEvekAU9a12R/62/mLJaXsppwyo iP5QIzOkm9gc46TU7H5LecoCLGH1Xe6yVMXlF6veek5ItFIyHhhvd174rR1thkyMl+0h M8fHXg2xULIMtSV0zDk5PoFInMLsTz2sbvtOHIY6UXsSx5dFEoCZTmldjoURmeeVkrZK ICgdsbvc1zRX8yAtZCfKjwqtlqqeqr0YWqaVxcSKYB8veH8aGJ+7dP1m9pAggXxeiJH3 nC1A== X-Gm-Message-State: ALoCoQl+mmi5Af/FNiYlmUWAn8a22QljMEiPyj+CR/7H/20t0fFCnWRZfq1T1Xi33KJ8Y4dLMTuM X-Received: by 10.183.1.7 with SMTP id bc7mr6731057obd.47.1399974480790; Tue, 13 May 2014 02:48:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.26.51 with SMTP id 48ls753013qgu.23.gmail; Tue, 13 May 2014 02:48:00 -0700 (PDT) X-Received: by 10.52.2.229 with SMTP id 5mr23395416vdx.24.1399974480619; Tue, 13 May 2014 02:48:00 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id vl10si1125799vec.182.2014.05.13.02.48.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 02:48:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id il7so103778vcb.32 for ; Tue, 13 May 2014 02:48:00 -0700 (PDT) X-Received: by 10.58.23.6 with SMTP id i6mr27810731vef.12.1399974480546; Tue, 13 May 2014 02:48:00 -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 ib8csp137204vcb; Tue, 13 May 2014 02:48:00 -0700 (PDT) X-Received: by 10.140.91.161 with SMTP id z30mr43443355qgd.65.1399974480022; Tue, 13 May 2014 02:48:00 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id f5si2192867qas.240.2014.05.13.02.47.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 May 2014 02:48:00 -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 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-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 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.53 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.173 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 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