From patchwork Mon Nov 12 00:52:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1726191 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 A9BA5DF288 for ; Mon, 12 Nov 2012 00:55:18 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TXiGz-0007ra-Mu; Mon, 12 Nov 2012 00:53:09 +0000 Received: from mail.df.lth.se ([194.47.250.12]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TXiGl-0007pk-Kk for linux-arm-kernel@lists.infradead.org; Mon, 12 Nov 2012 00:52:57 +0000 Received: from mer.df.lth.se (mer.df.lth.se [194.47.250.37]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.df.lth.se (Postfix) with ESMTPS id 60F2665D7B; Mon, 12 Nov 2012 01:52:53 +0100 (CET) Received: from mer.df.lth.se (triad@localhost.localdomain [127.0.0.1]) by mer.df.lth.se (8.14.3/8.14.3/Debian-9.4) with ESMTP id qAC0qrmw012965; Mon, 12 Nov 2012 01:52:53 +0100 Received: (from triad@localhost) by mer.df.lth.se (8.14.3/8.14.3/Submit) id qAC0qr2L012964; Mon, 12 Nov 2012 01:52:53 +0100 From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/6] ARM: integrator: remove static AP syscon mapping Date: Mon, 12 Nov 2012 01:52:52 +0100 Message-Id: <1352681572-12937-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121111_195256_009808_6E6A4765 X-CRM114-Status: GOOD ( 17.09 ) X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [194.47.250.12 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 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: Linus Walleij , arm@kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This removes the static mapping for the AP system controller for the device tree case. Fork the static mappings table and move the system controller to only be statically mapped in the ATAG boot path. Signed-off-by: Linus Walleij --- arch/arm/mach-integrator/integrator_ap.c | 58 +++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index 7d84080..becba43 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c @@ -62,7 +62,10 @@ #include "common.h" -/* +/* Base address to the AP system controller */ +static void __iomem *ap_syscon_base; + +/* * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx * is the (PA >> 12). * @@ -70,7 +73,6 @@ * just for now). */ #define VA_IC_BASE __io_address(INTEGRATOR_IC_BASE) -#define VA_SC_BASE __io_address(INTEGRATOR_SC_BASE) #define VA_EBI_BASE __io_address(INTEGRATOR_EBI_BASE) #define VA_CMIC_BASE __io_address(INTEGRATOR_HDR_IC) @@ -99,11 +101,6 @@ static struct map_desc ap_io_desc[] __initdata = { .length = SZ_4K, .type = MT_DEVICE }, { - .virtual = IO_ADDRESS(INTEGRATOR_SC_BASE), - .pfn = __phys_to_pfn(INTEGRATOR_SC_BASE), - .length = SZ_4K, - .type = MT_DEVICE - }, { .virtual = IO_ADDRESS(INTEGRATOR_EBI_BASE), .pfn = __phys_to_pfn(INTEGRATOR_EBI_BASE), .length = SZ_4K, @@ -203,8 +200,6 @@ device_initcall(irq_syscore_init); /* * Flash handling. */ -#define SC_CTRLC (VA_SC_BASE + INTEGRATOR_SC_CTRLC_OFFSET) -#define SC_CTRLS (VA_SC_BASE + INTEGRATOR_SC_CTRLS_OFFSET) #define EBI_CSR1 (VA_EBI_BASE + INTEGRATOR_EBI_CSR1_OFFSET) #define EBI_LOCK (VA_EBI_BASE + INTEGRATOR_EBI_LOCK_OFFSET) @@ -212,7 +207,8 @@ static int ap_flash_init(struct platform_device *dev) { u32 tmp; - writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP, SC_CTRLC); + writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP, + ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET); tmp = readl(EBI_CSR1) | INTEGRATOR_EBI_WRITE_ENABLE; writel(tmp, EBI_CSR1); @@ -229,7 +225,8 @@ static void ap_flash_exit(struct platform_device *dev) { u32 tmp; - writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP, SC_CTRLC); + writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP, + ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET); tmp = readl(EBI_CSR1) & ~INTEGRATOR_EBI_WRITE_ENABLE; writel(tmp, EBI_CSR1); @@ -243,9 +240,12 @@ static void ap_flash_exit(struct platform_device *dev) static void ap_flash_set_vpp(struct platform_device *pdev, int on) { - void __iomem *reg = on ? SC_CTRLS : SC_CTRLC; - - writel(INTEGRATOR_SC_CTRL_nFLVPPEN, reg); + if (on) + writel(INTEGRATOR_SC_CTRL_nFLVPPEN, + ap_syscon_base + INTEGRATOR_SC_CTRLS_OFFSET); + else + writel(INTEGRATOR_SC_CTRL_nFLVPPEN, + ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET); } static struct physmap_flash_data ap_flash_data = { @@ -464,9 +464,6 @@ static struct of_dev_auxdata ap_auxdata_lookup[] __initdata = { { /* sentinel */ }, }; -/* Base address to the AP system controller */ -static void __iomem *ap_syscon_base; - static void __init ap_init_of(void) { unsigned long sc_dec; @@ -523,7 +520,7 @@ static void __init ap_init_of(void) of_platform_populate(root, of_default_bus_match_table, ap_auxdata_lookup, parent); - sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET); + sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); for (i = 0; i < 4; i++) { struct lm_device *lmdev; @@ -567,6 +564,27 @@ MACHINE_END #ifdef CONFIG_ATAGS /* + * For the ATAG boot some static mappings are needed. This will + * go away with the ATAG support down the road. + */ + +static struct map_desc ap_io_desc_atag[] __initdata = { + { + .virtual = IO_ADDRESS(INTEGRATOR_SC_BASE), + .pfn = __phys_to_pfn(INTEGRATOR_SC_BASE), + .length = SZ_4K, + .type = MT_DEVICE + }, +}; + +static void __init ap_map_io_atag(void) +{ + iotable_init(ap_io_desc_atag, ARRAY_SIZE(ap_io_desc_atag)); + ap_syscon_base = __io_address(INTEGRATOR_SC_BASE); + ap_map_io(); +} + +/* * This is where non-devicetree initialization code is collected and stashed * for eventual deletion. */ @@ -634,7 +652,7 @@ static void __init ap_init(void) platform_device_register(&cfi_flash_device); - sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET); + sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); for (i = 0; i < 4; i++) { struct lm_device *lmdev; @@ -661,7 +679,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator") /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ .atag_offset = 0x100, .reserve = integrator_reserve, - .map_io = ap_map_io, + .map_io = ap_map_io_atag, .nr_irqs = NR_IRQS_INTEGRATOR_AP, .init_early = ap_init_early, .init_irq = ap_init_irq,