From patchwork Thu Jun 13 20:19:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2718451 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 90E1BC0AB1 for ; Thu, 13 Jun 2013 20:20:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 75E4C20306 for ; Thu, 13 Jun 2013 20:20:54 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C312520300 for ; Thu, 13 Jun 2013 20:20:52 +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 1UnE0b-0002Tk-VA; Thu, 13 Jun 2013 20:20:38 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UnE0Z-0005rF-Dw; Thu, 13 Jun 2013 20:20:35 +0000 Received: from eu1sys200aog117.obsmtp.com ([207.126.144.143]) by merlin.infradead.org with smtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UnE0V-0005pl-2R for linux-arm-kernel@lists.infradead.org; Thu, 13 Jun 2013 20:20:32 +0000 Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob117.postini.com ([207.126.147.11]) with SMTP ID DSNKUbopb1wYqVWS+YxEXsYYt0RTMuSqmsr/@postini.com; Thu, 13 Jun 2013 20:20:30 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 6B57DBD; Thu, 13 Jun 2013 20:19:53 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 530E4410; Thu, 13 Jun 2013 20:19:53 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 8F08AA8074; Thu, 13 Jun 2013 22:19:44 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.279.5; Thu, 13 Jun 2013 22:19:52 +0200 From: Linus Walleij To: , Arnd Bergmann Subject: [PATCH 1/2] ARM: u300: switch to using syscon regmap for board Date: Thu, 13 Jun 2013 22:19:45 +0200 Message-ID: <1371154785-28082-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130613_162031_362884_6214085D X-CRM114-Status: GOOD ( 15.78 ) X-Spam-Score: -4.2 (----) Cc: Linus Walleij , Dong Aisheng 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: , 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.6 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 From: Linus Walleij This switches the code using a local remapping of the system controller to enable the U300 board to be self-powered over to making the U300-specific syscon compatible with the MFD generic syscon driver, selecting the generic syscon driver, and augmenting the board power code to pick the regmap and manipulate the syscon from the regmap side of things. Cc: Dong Aisheng Suggested-by: Arnd Bergmann Signed-off-by: Linus Walleij --- arch/arm/boot/dts/ste-u300.dts | 2 +- arch/arm/mach-u300/Kconfig | 1 + arch/arm/mach-u300/regulator.c | 19 ++++++++----------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/dts/ste-u300.dts b/arch/arm/boot/dts/ste-u300.dts index 05a0821..8a1032c 100644 --- a/arch/arm/boot/dts/ste-u300.dts +++ b/arch/arm/boot/dts/ste-u300.dts @@ -31,7 +31,7 @@ }; syscon: syscon@c0011000 { - compatible = "stericsson,u300-syscon"; + compatible = "stericsson,u300-syscon", "syscon"; reg = <0xc0011000 0x1000>; clk32: app_32_clk@32k { #clock-cells = <0>; diff --git a/arch/arm/mach-u300/Kconfig b/arch/arm/mach-u300/Kconfig index e2f350f..09f4dda 100644 --- a/arch/arm/mach-u300/Kconfig +++ b/arch/arm/mach-u300/Kconfig @@ -20,6 +20,7 @@ config ARCH_U300 select PINCTRL_COH901 select PINCTRL_U300 select SPARSE_IRQ + select MFD_SYSCON select USE_OF help Support for ST-Ericsson U300 series mobile platforms. diff --git a/arch/arm/mach-u300/regulator.c b/arch/arm/mach-u300/regulator.c index 273fceb..bf40cd4 100644 --- a/arch/arm/mach-u300/regulator.c +++ b/arch/arm/mach-u300/regulator.c @@ -15,9 +15,8 @@ #include #include #include -/* Those are just for writing in syscon */ -#include -#include +#include +#include /* Power Management Control 16bit (R/W) */ #define U300_SYSCON_PMCR (0x50) @@ -59,9 +58,8 @@ static int __init __u300_init_boardpower(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct device_node *syscon_np; - static void __iomem *syscon_base; + struct regmap *regmap; int err; - u32 val; pr_info("U300: setting up board power\n"); @@ -70,9 +68,9 @@ static int __init __u300_init_boardpower(struct platform_device *pdev) pr_crit("U300: no syscon node\n"); return -ENODEV; } - syscon_base = of_iomap(syscon_np, 0); - if (!syscon_base) { - pr_crit("U300: could not remap syscon\n"); + regmap = syscon_node_to_regmap(syscon_np); + if (!regmap) { + pr_crit("U300: could not locate syscon regmap\n"); return -ENODEV; } @@ -96,9 +94,8 @@ static int __init __u300_init_boardpower(struct platform_device *pdev) * the rest of the U300 power management is implemented. */ pr_info("U300: disable system controller pull-up\n"); - val = readw(syscon_base + U300_SYSCON_PMCR); - val &= ~U300_SYSCON_PMCR_DCON_ENABLE; - writew(val, syscon_base + U300_SYSCON_PMCR); + regmap_update_bits(regmap, U300_SYSCON_PMCR, + U300_SYSCON_PMCR_DCON_ENABLE, 0); /* Register globally exported PM poweroff hook */ pm_power_off = u300_pm_poweroff;