From patchwork Sat Mar 23 12:57:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Trumtrar X-Patchwork-Id: 2324611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A22123FC8A for ; Sat, 23 Mar 2013 13:00:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UJO1J-0006qd-PV; Sat, 23 Mar 2013 12:58:02 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UJO11-0006n3-BD for linux-arm-kernel@lists.infradead.org; Sat, 23 Mar 2013 12:57:47 +0000 Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:21e:67ff:fe11:9c5c]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1UJO0z-0006DQ-Fb; Sat, 23 Mar 2013 13:57:41 +0100 Received: from str by dude.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1UJO0z-000548-Cm; Sat, 23 Mar 2013 13:57:41 +0100 From: Steffen Trumtrar To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] ARM: zynq: read scu base from SoC Date: Sat, 23 Mar 2013 13:57:28 +0100 Message-Id: <1364043450-18700-2-git-send-email-s.trumtrar@pengutronix.de> X-Mailer: git-send-email 1.8.2.rc2 In-Reply-To: <1364043450-18700-1-git-send-email-s.trumtrar@pengutronix.de> References: <1364043450-18700-1-git-send-email-s.trumtrar@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:21e:67ff:fe11:9c5c X-SA-Exim-Mail-From: str@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130323_085744_336328_438A99EA X-CRM114-Status: GOOD ( 15.92 ) X-Spam-Score: -4.4 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Josh Cartwright , Steffen Trumtrar , Michal Simek 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 Instead of hardcoding the base address of the SCU get it from the device. While at it, add the SCU to the DT. Signed-off-by: Steffen Trumtrar Cc: Michal Simek Cc: Josh Cartwright --- arch/arm/boot/dts/zynq-7000.dtsi | 5 +++++ arch/arm/mach-zynq/common.c | 34 ++++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index 88564fa..c103082 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi @@ -199,6 +199,11 @@ }; }; + scu: scu@f8f000000 { + compatible = "arm,cortex-a9-scu"; + reg = <0xf8f00000 0x58>; + }; + timer: timer@f8f00600 { compatible = "arm,cortex-a9-twd-timer"; reg = <0xf8f00600 0x20>; diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 920e20a..014131c 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -32,11 +32,14 @@ #include #include #include +#include #include #include #include "common.h" +void __iomem *scu_base; + static struct of_device_id zynq_of_bus_ids[] __initdata = { { .compatible = "simple-bus", }, {} @@ -56,17 +59,6 @@ static void __init xilinx_init_machine(void) of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL); } -#define SCU_PERIPH_PHYS 0xF8F00000 -#define SCU_PERIPH_SIZE SZ_8K -#define SCU_PERIPH_VIRT (VMALLOC_END - SCU_PERIPH_SIZE) - -static struct map_desc scu_desc __initdata = { - .virtual = SCU_PERIPH_VIRT, - .pfn = __phys_to_pfn(SCU_PERIPH_PHYS), - .length = SCU_PERIPH_SIZE, - .type = MT_DEVICE, -}; - static void __init xilinx_zynq_timer_init(void) { struct device_node *np; @@ -82,13 +74,31 @@ static void __init xilinx_zynq_timer_init(void) xttcps_timer_init(); } +static struct map_desc zynq_cortex_a9_scu_map __initdata = { + .length = SZ_8K, + .type = MT_DEVICE, +}; + +void __init zynq_scu_map_io(void) +{ + if (scu_a9_has_base()) { + unsigned long base; + + base = scu_a9_get_base(); + zynq_cortex_a9_scu_map.pfn = __phys_to_pfn(base); + zynq_cortex_a9_scu_map.virtual = base; + iotable_init(&zynq_cortex_a9_scu_map, 1); + scu_base = ioremap(base, zynq_cortex_a9_scu_map.length); + } +} + /** * xilinx_map_io() - Create memory mappings needed for early I/O. */ static void __init xilinx_map_io(void) { debug_ll_io_init(); - iotable_init(&scu_desc, 1); + zynq_scu_map_io(); } static const char *xilinx_dt_match[] = {