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: 17915 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BC0EC25BE0 for ; Thu, 13 Jun 2013 20:20:35 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id d41sf7015437eek.7 for ; Thu, 13 Jun 2013 13:20:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:from:to:cc :subject:date:message-id:x-mailer:mime-version:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=JpOgia11gyR+kDLNdVLV/XiTtf1dnUytv6vecd3aAMw=; b=pQbQnWFHOBwTs8wsF9rkIdUHVDxYc9oGZn3CMfHP5iyUzf0WvTH5OcpCxJt8e92os+ pCibYGPQZVTfuz5pJLpL4v1NDZv7KdB9SOTPHCtDA8Q3qE4zW0jj/qHoHVLvPQdzUkfw UQqQ4dmWqwo8ehAvxsxnrPIO0lrf6LAi6Pl3dt/uwvjnzOYPB+t2alpmNtuZg1kgUAju MRzctarmqXfj9w3KvVW1yo3AdoCcsfrR8H5cVwWyPNVp9FjQ+e4JBdzBKPc3w4FDe2Ol nM66mZJ8VUrfoGrL+iK5Hxk5+IOgj/9GkQShVhJR1AV+1pyKQqbLxXy26TuR5ywhnxxb cEEg== X-Received: by 10.180.76.115 with SMTP id j19mr7231641wiw.2.1371154834222; Thu, 13 Jun 2013 13:20:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.78.230 with SMTP id e6ls572281wix.31.gmail; Thu, 13 Jun 2013 13:20:34 -0700 (PDT) X-Received: by 10.180.83.166 with SMTP id r6mr4205437wiy.60.1371154834061; Thu, 13 Jun 2013 13:20:34 -0700 (PDT) Received: from mail-ve0-x22b.google.com (mail-ve0-x22b.google.com [2607:f8b0:400c:c01::22b]) by mx.google.com with ESMTPS id p7si3521117wiw.47.2013.06.13.13.20.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 13:20:33 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22b is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22b; Received: by mail-ve0-f171.google.com with SMTP id b10so8047551vea.16 for ; Thu, 13 Jun 2013 13:20:32 -0700 (PDT) X-Received: by 10.52.155.67 with SMTP id vu3mr897757vdb.94.1371154832233; Thu, 13 Jun 2013 13:20:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.191.99 with SMTP id gx3csp36781vec; Thu, 13 Jun 2013 13:20:31 -0700 (PDT) X-Received: by 10.15.21.78 with SMTP id c54mr3174790eeu.14.1371154831029; Thu, 13 Jun 2013 13:20:31 -0700 (PDT) Received: from eu1sys200aog117.obsmtp.com (eu1sys200aog117.obsmtp.com [207.126.144.143]) by mx.google.com with SMTP id h48si19997797eey.124.2013.06.13.13.20.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 13 Jun 2013 13:20:31 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.143 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.143; 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 Cc: Linus Walleij , Dong Aisheng 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-Gm-Message-State: ALoCoQlIl6h8PaMe0qz2lYIqLETKH/6vHDpsp4z9an9C8h6kqmGWDCIo3nMD6ltYBy8AN7WnJ5es X-Original-Sender: linus.walleij@stericsson.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22b is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;