From patchwork Thu Mar 28 16:38:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 2358251 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id EC7FFDF2A1 for ; Thu, 28 Mar 2013 16:49: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 1ULFyh-0004ah-BS; Thu, 28 Mar 2013 16:47:03 +0000 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ULFqN-00089k-To for linux-arm-kernel@lists.infradead.org; Thu, 28 Mar 2013 16:38:29 +0000 Received: by mail-wi0-f180.google.com with SMTP id c10so3425174wiw.13 for ; Thu, 28 Mar 2013 09:38:23 -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:in-reply-to:references:x-gm-message-state; bh=znL8iHNwATLXJ73B5p0+dYeYPpZgOeLL0Yp5vMkbULc=; b=RTuhmnNdIhjNhYy6CS6m/PXT7H2rEL0dJbAZYC45VF9zgff34adwEmquiNJtKgMSJ3 XWrvdTkU9NVi2JDx8n/WNDL/4Mzk5Wx7WbDD05+jyb5O02nmHgOpL3TkA92CM3ETb915 2j57kmXHmG3UE3YQf7GlFG0l9RuF2TddIFdMw0FSNfE+tuvDz+sqf241feO/+emKt/lt iyt8PwzraKxm/uaguJLsC+yoh2Z/Bd2jlej4s44od1xck2VOdU4vlr8zF7kxcvo91oPn /K4Sd4yO/k5BlzWz4nRAIFtsLoXUc1k66vCYLimOBaeR2w3rLhTMSLuoGohTAsGkz8Eb LJ5A== X-Received: by 10.180.10.105 with SMTP id h9mr17620139wib.34.1364488703488; Thu, 28 Mar 2013 09:38:23 -0700 (PDT) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPS id h10sm16882056wic.8.2013.03.28.09.38.22 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Thu, 28 Mar 2013 09:38:22 -0700 (PDT) From: Michal Simek To: linux-arm-kernel@lists.infradead.org, monstr@monstr.eu, Josh Cartwright , Steffen Trumtrar , Rob Herring Subject: [PATCH v3 05/12] arm: zynq: Load scu baseaddress at run time Date: Thu, 28 Mar 2013 17:38:05 +0100 Message-Id: X-Mailer: git-send-email 1.7.9.7 In-Reply-To: <1364488692-18709-1-git-send-email-michal.simek@xilinx.com> References: <1364488692-18709-1-git-send-email-michal.simek@xilinx.com> In-Reply-To: References: X-Gm-Message-State: ALoCoQn8iOdpmMIMo+XEq9tUxdocr35dTVIEcuenVdqJWG9S4FWljDg6JwpjQvlCXZQ2bMNVhzLM X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130328_123828_129640_202C235C X-CRM114-Status: GOOD ( 13.70 ) 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 --- v3: Rename scu_base to zynq_scu_base v2: Remove dynamic mapping because it is probably not needed (code taken from vexpress platsmp code) Remove scu node from DTS Use zynq_scu_map_io() instead of scu_init() as Steffen suggested Add comment to scu_init to be sure that we know what we are doing here --- arch/arm/mach-zynq/common.c | 34 ++++++++++++++++++++++------------ arch/arm/mach-zynq/common.h | 2 ++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 68e0907..f9e5f3a 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 *zynq_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,31 @@ 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 zynq_scu_map_io(void) +{ + unsigned long base; + + base = scu_a9_get_base(); + zynq_cortex_a9_scu_map.pfn = __phys_to_pfn(base); + /* Expected address is in vmalloc area that's why simple assign here */ + zynq_cortex_a9_scu_map.virtual = base; + iotable_init(&zynq_cortex_a9_scu_map, 1); + zynq_scu_base = (void __iomem *)base; + BUG_ON(!zynq_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); + zynq_scu_map_io(); } static const char *xilinx_dt_match[] = { diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h index 5050bb1..d7164d5 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 *zynq_scu_base; + #endif