From patchwork Mon Mar 25 13:53:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 2331461 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 78D803FC54 for ; Mon, 25 Mar 2013 13:58:24 +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 1UK7s5-0003ni-7B; Mon, 25 Mar 2013 13:55:33 +0000 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UK7qG-00038X-3Z for linux-arm-kernel@lists.infradead.org; Mon, 25 Mar 2013 13:53:41 +0000 Received: by mail-wi0-f179.google.com with SMTP id hn17so4020347wib.6 for ; Mon, 25 Mar 2013 06:53:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=hLEwFhg/srVtP3FtOd1TYp3TYrtdjXDnZakB25GCRwg=; b=EW9PfG+vkuA0KlHInGpOYpMO65G84m1AeBgk9NGRXuHWao6ERMKBibw8G2lwomzFiX NCgFRgbYUkYyKwzJtRbFO3o2Fo+qU+8ZJQpvixTz33BCBOB3WmOrLM9u5D2TM2/bTVPi d5WUZ2h2eeWGwHpfuFhcUpi6cQVXKj6XyJocQDUztOIxjACrue/53Ei3/3VsuZaA/cf/ eC1Af7UieITJuNdmAGNQHlDhHvFN8JHe+rWQQr3MKImaaclI5XQAUZL8vV+5TDg8pxyI B0uB7DUePQxLRKH8/3rCDjySeQMI6txqYVFM/9f6Lbp2HVSS2kr/kMHWJXxhuhiDzGI8 LMbQ== X-Received: by 10.180.100.10 with SMTP id eu10mr25975431wib.4.1364219618110; Mon, 25 Mar 2013 06:53:38 -0700 (PDT) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPS id n2sm28080823wiy.6.2013.03.25.06.53.37 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Mon, 25 Mar 2013 06:53:37 -0700 (PDT) From: Michal Simek To: linux-arm-kernel@lists.infradead.org, monstr@monstr.eu, Josh Cartwright , Steffen Trumtrar Subject: [PATCH 04/10] arm: zynq: Load scu baseaddress at run time Date: Mon, 25 Mar 2013 14:53:10 +0100 Message-Id: <1364219596-4954-4-git-send-email-michal.simek@xilinx.com> X-Mailer: git-send-email 1.7.9.7 In-Reply-To: <1364219596-4954-1-git-send-email-michal.simek@xilinx.com> References: <1364219596-4954-1-git-send-email-michal.simek@xilinx.com> X-Gm-Message-State: ALoCoQnjy+qAhUzjqITxnZhiDy/YGZ7Mnto2cUcKfVwTdPyMg271ByYDY119F4N4r+VmbnCGyofS X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130325_095340_311159_3DE3C84F X-CRM114-Status: GOOD ( 12.31 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 Use Cortex a9 cp15 to read scu baseaddress. Signed-off-by: Michal Simek --- arch/arm/boot/dts/zynq-7000.dtsi | 5 +++++ arch/arm/mach-zynq/common.c | 33 +++++++++++++++++++++------------ arch/arm/mach-zynq/common.h | 2 ++ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index 2a72339..4943568 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi @@ -22,6 +22,11 @@ interrupt-parent = <&intc>; ranges; + scu: scu@f8f000000 { + compatible = "arm,cortex-a9-scu"; + reg = <0xf8f00000 0x58>; + }; + intc: interrupt-controller@f8f01000 { compatible = "arm,cortex-a9-gic"; #interrupt-cells = <3>; diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 68e0907..13f9d8b 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -33,10 +33,13 @@ #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; @@ -81,13 +73,30 @@ static void __init xilinx_zynq_timer_init(void) clocksource_of_init(); } +static struct map_desc zynq_cortex_a9_scu_map __initdata = { + .length = SZ_256, + .type = MT_DEVICE, +}; + +static void __init scu_init(void) +{ + 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); + BUG_ON(!scu_base); +} + /** * 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); + scu_init(); } static const char *xilinx_dt_match[] = { diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h index 5050bb1..38727a2 100644 --- a/arch/arm/mach-zynq/common.h +++ b/arch/arm/mach-zynq/common.h @@ -17,4 +17,6 @@ #ifndef __MACH_ZYNQ_COMMON_H__ #define __MACH_ZYNQ_COMMON_H__ +extern void __iomem *scu_base; + #endif