From patchwork Thu Jan 23 06:28:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Prisk X-Patchwork-Id: 3526731 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5DCBB9F2E9 for ; Thu, 23 Jan 2014 06:29:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72795201B9 for ; Thu, 23 Jan 2014 06:29:17 +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 8C6322018B for ; Thu, 23 Jan 2014 06:29:15 +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 1W6Dmb-0001nj-RW; Thu, 23 Jan 2014 06:28:58 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6DmZ-0006oC-H6; Thu, 23 Jan 2014 06:28:55 +0000 Received: from server.prisktech.co.nz ([115.188.14.127]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W6DmW-0006ni-NI for linux-arm-kernel@lists.infradead.org; Thu, 23 Jan 2014 06:28:53 +0000 Received: from localhost.localdomain (unknown [192.168.0.102]) by server.prisktech.co.nz (Postfix) with ESMTP id 6C635FC11D3; Thu, 23 Jan 2014 19:28:35 +1300 (NZDT) From: Tony Prisk To: linux@arm.linux.org.uk Subject: [PATCH] arm: vt8500: Fix gpio mux setup in vt8500_init() Date: Thu, 23 Jan 2014 19:28:47 +1300 Message-Id: <1390458527-30068-1-git-send-email-linux@prisktech.co.nz> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140123_012853_328437_38EA3FC2 X-CRM114-Status: GOOD ( 15.08 ) X-Spam-Score: -2.5 (--) Cc: Tony Prisk , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.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.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 With the switch to a pinctrl driver, and the dropping of the gpio driver, the code in vt8500_init now always fails, and drops back to LEGACY mode. Update the gpio mux init code, and removing the #ifdef's and the LEGACY mode fallback. Signed-off-by: Tony Prisk --- arch/arm/mach-vt8500/vt8500.c | 91 ++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 61 deletions(-) diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c index 4a73464..fe5243e 100644 --- a/arch/arm/mach-vt8500/vt8500.c +++ b/arch/arm/mach-vt8500/vt8500.c @@ -32,9 +32,6 @@ #include #include -#define LEGACY_GPIO_BASE 0xD8110000 -#define LEGACY_PMC_BASE 0xD8130000 - /* Registers in GPIO Controller */ #define VT8500_GPIO_MUX_REG 0x200 @@ -75,89 +72,61 @@ static void vt8500_power_off(void) void __init vt8500_init(void) { struct device_node *np; -#if defined(CONFIG_FB_VT8500) || defined(CONFIG_FB_WM8505) struct device_node *fb; - void __iomem *gpio_base; -#endif + void __iomem *base; -#ifdef CONFIG_FB_VT8500 fb = of_find_compatible_node(NULL, NULL, "via,vt8500-fb"); if (fb) { - np = of_find_compatible_node(NULL, NULL, "via,vt8500-gpio"); - if (np) { - gpio_base = of_iomap(np, 0); - - if (!gpio_base) - pr_err("%s: of_iomap(gpio_mux) failed\n", - __func__); + np = of_find_compatible_node(NULL, NULL, "via,vt8500-pinctrl"); + if (!np) { + pr_err("pinctrl node required for framebuffer\n"); + BUG(); + } - of_node_put(np); + base = of_iomap(np, 0); + if (base) { + writel(readl(base + VT8500_GPIO_MUX_REG) | 1, + base + VT8500_GPIO_MUX_REG); + iounmap(base); } else { - gpio_base = ioremap(LEGACY_GPIO_BASE, 0x1000); - if (!gpio_base) - pr_err("%s: ioremap(legacy_gpio_mux) failed\n", - __func__); + pr_err("%s: of_iomap(gpio_mux) failed\n", __func__); } - if (gpio_base) { - writel(readl(gpio_base + VT8500_GPIO_MUX_REG) | 1, - gpio_base + VT8500_GPIO_MUX_REG); - iounmap(gpio_base); - } else - pr_err("%s: Could not remap GPIO mux\n", __func__); + of_node_put(np); of_node_put(fb); } -#endif -#ifdef CONFIG_FB_WM8505 fb = of_find_compatible_node(NULL, NULL, "wm,wm8505-fb"); if (fb) { - np = of_find_compatible_node(NULL, NULL, "wm,wm8505-gpio"); - if (!np) - np = of_find_compatible_node(NULL, NULL, - "wm,wm8650-gpio"); - if (np) { - gpio_base = of_iomap(np, 0); - - if (!gpio_base) - pr_err("%s: of_iomap(gpio_mux) failed\n", - __func__); - - of_node_put(np); + np = of_find_compatible_node(NULL, NULL, "wm,prizm-pinctrl"); + if (!np) { + pr_err("pinctrl node required for framebuffer\n"); + BUG(); + } + + base = of_iomap(np, 0); + if (base) { + writel(readl(base + VT8500_GPIO_MUX_REG) | + 0x80000000, base + VT8500_GPIO_MUX_REG); + iounmap(base); } else { - gpio_base = ioremap(LEGACY_GPIO_BASE, 0x1000); - if (!gpio_base) - pr_err("%s: ioremap(legacy_gpio_mux) failed\n", - __func__); + pr_err("%s: of_iomap(gpio_mux) failed\n", __func__); } - if (gpio_base) { - writel(readl(gpio_base + VT8500_GPIO_MUX_REG) | - 0x80000000, gpio_base + VT8500_GPIO_MUX_REG); - iounmap(gpio_base); - } else - pr_err("%s: Could not remap GPIO mux\n", __func__); + of_node_put(np); of_node_put(fb); } -#endif np = of_find_compatible_node(NULL, NULL, "via,vt8500-pmc"); if (np) { pmc_base = of_iomap(np, 0); - - if (!pmc_base) - pr_err("%s:of_iomap(pmc) failed\n", __func__); + if (pmc_base) + pm_power_off = &vt8500_power_off; + else + pr_err("%s: of_iomap(pmc) failed\n", __func__); of_node_put(np); - } else { - pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000); - if (!pmc_base) - pr_err("%s:ioremap(power_off) failed\n", __func__); } - if (pmc_base) - pm_power_off = &vt8500_power_off; - else - pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); }