From patchwork Mon Jan 6 14:36:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 3438551 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 0C9A1C02DC for ; Mon, 6 Jan 2014 14:39:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 628202016D for ; Mon, 6 Jan 2014 14:39:12 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 18AFE2017A for ; Mon, 6 Jan 2014 14:39:05 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0BJa-0005tK-CO; Mon, 06 Jan 2014 14:38:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0BJM-0003gk-ML; Mon, 06 Jan 2014 14:37:48 +0000 Received: from mail-ee0-f46.google.com ([74.125.83.46]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0BJK-0003eJ-49 for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2014 14:37:47 +0000 Received: by mail-ee0-f46.google.com with SMTP id d49so7895628eek.33 for ; Mon, 06 Jan 2014 06:37:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references:content-type; bh=2tOBSbC67Ji/qRHt7dUwtv2mGJJyB/+CpwvpXz/doB4=; b=aJKjQyzKhk676Po/KdsMG9hz5CjcUcxJDgLROGabNbvJDx316KMF3loy5J1F/WS1AU SR6ArXF35tZxqxTi5RVVPvz2nNUfzS9JaoS6FlDdEbl6iBCkQen3LLw7CEvAJPORpzxC PgZ+JDXhd5tRnzmpnKOk61Q37n+j6tB1IVZuuYgn2KkrIS9ZdEpMyWu6n3mSGfltJP0i nkiCoaSAkJH9+3tJuqhfbHDPHxzKHFSitOz87qPzIUm/2oWfgL2Lvtcb+qFMviTGzTq6 6M2xrcg5dEKlPxC9qu9XVSoaBXiRXn/4wVsvZm9elt76UhilTj6Z5dNNB4n/7YWHV/5t x0nQ== X-Gm-Message-State: ALoCoQnlMc62rE2wabWDIkhOpjYlaGXgzZG3oGRm83dqktl0Yxqaz7SLmesP9QBDUTdp4NR1u0hZ X-Received: by 10.14.7.2 with SMTP id 2mr87455186eeo.16.1389019044266; Mon, 06 Jan 2014 06:37:24 -0800 (PST) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPSA id h48sm171447943eev.3.2014.01.06.06.37.12 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Mon, 06 Jan 2014 06:37:14 -0800 (PST) From: Michal Simek To: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Soren Brinkmann , Steffen Trumtrar Subject: [PATCH 2/7] ARM: zynq: Split slcr in two parts Date: Mon, 6 Jan 2014 15:36:38 +0100 Message-Id: X-Mailer: git-send-email 1.8.2.3 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140106_093746_373243_13C66918 X-CRM114-Status: GOOD ( 20.36 ) X-Spam-Score: -1.9 (-) Cc: Mark Rutland , Josh Cartwright , monstr@monstr.eu, Russell King , Pawel Moll , Stephen Warren , Ian Campbell , Peter Crosthwaite , Rob Herring , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org 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=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS, 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 Split the slcr into an early part for unlocking and cpu starting and a later syscon driver. Also add "syscon" compatible property for slcr. Signed-off-by: Steffen Trumtrar Signed-off-by: Michal Simek --- arch/arm/boot/dts/zynq-7000.dtsi | 2 +- arch/arm/mach-zynq/Kconfig | 1 + arch/arm/mach-zynq/common.c | 4 +++- arch/arm/mach-zynq/common.h | 1 + arch/arm/mach-zynq/slcr.c | 20 ++++++++++++++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) -- 1.8.2.3 diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index 93d1980..81e5677 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi @@ -123,7 +123,7 @@ } ; slcr: slcr@f8000000 { - compatible = "xlnx,zynq-slcr"; + compatible = "xlnx,zynq-slcr", "syscon"; reg = <0xF8000000 0x1000>; clocks { diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig index 6b04260..323e505 100644 --- a/arch/arm/mach-zynq/Kconfig +++ b/arch/arm/mach-zynq/Kconfig @@ -14,5 +14,6 @@ config ARCH_ZYNQ select SPARSE_IRQ select CADENCE_TTC_TIMER select ARM_GLOBAL_TIMER + select MFD_SYSCON help Support for Xilinx Zynq ARM Cortex A9 Platform diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index bf6717f..38401cf 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -59,11 +59,13 @@ static void __init zynq_init_machine(void) of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); platform_device_register(&zynq_cpuidle_device); + + zynq_slcr_init(); } static void __init zynq_timer_init(void) { - zynq_slcr_init(); + zynq_early_slcr_init(); zynq_clock_init(zynq_slcr_base); clocksource_of_init(); diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h index c22c92c..1548b85 100644 --- a/arch/arm/mach-zynq/common.h +++ b/arch/arm/mach-zynq/common.h @@ -20,6 +20,7 @@ void zynq_secondary_startup(void); extern int zynq_slcr_init(void); +extern int zynq_early_slcr_init(void); extern void zynq_slcr_system_reset(void); extern void zynq_slcr_cpu_stop(int cpu); extern void zynq_slcr_cpu_start(int cpu); diff --git a/arch/arm/mach-zynq/slcr.c b/arch/arm/mach-zynq/slcr.c index 59ad09f..9746de7 100644 --- a/arch/arm/mach-zynq/slcr.c +++ b/arch/arm/mach-zynq/slcr.c @@ -15,7 +15,9 @@ */ #include +#include #include +#include #include #include "common.h" @@ -30,6 +32,7 @@ #define SLCR_A9_CPU_RST 0x1 void __iomem *zynq_slcr_base; +static struct regmap *zynq_slcr_regmap; /** * zynq_slcr_system_reset - Reset the entire system. @@ -87,6 +90,23 @@ void zynq_slcr_cpu_stop(int cpu) */ int __init zynq_slcr_init(void) { + zynq_slcr_regmap = syscon_regmap_lookup_by_compatible("xlnx,zynq-slcr"); + if (IS_ERR(zynq_slcr_regmap)) { + pr_err("%s: failed to find zynq-slcr\n", __func__); + return -ENODEV; + } + + return 0; +} + +/** + * zynq_early_slcr_init + * Returns 0 on success, negative errno otherwise. + * + * Called very early during boot from platform code to unlock SLCR. + */ +int __init zynq_early_slcr_init(void) +{ struct device_node *np; np = of_find_compatible_node(NULL, NULL, "xlnx,zynq-slcr");