summaryrefslogtreecommitdiff
path: root/arch/arm/mach-u300/regulator.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-06-13 23:21:31 +0400
committerLinus Walleij <linus.walleij@linaro.org>2013-06-17 15:54:39 +0400
commit7fca1f20c0f3e9d7a3b23ee1fc9e832f520f3f1a (patch)
treef09643fa89e79047787665d117cd56f0068094d2 /arch/arm/mach-u300/regulator.c
parent985062588d55deebc62bee80e979ea03d4a917ea (diff)
downloadlinux-7fca1f20c0f3e9d7a3b23ee1fc9e832f520f3f1a.tar.xz
ARM: u300: switch to using syscon regmap for board
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 <dong.aisheng@linaro.org> Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-u300/regulator.c')
-rw-r--r--arch/arm/mach-u300/regulator.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/arch/arm/mach-u300/regulator.c b/arch/arm/mach-u300/regulator.c
index 273fceb83685..bf40cd478fe9 100644
--- a/arch/arm/mach-u300/regulator.c
+++ b/arch/arm/mach-u300/regulator.c
@@ -15,9 +15,8 @@
#include <linux/platform_device.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/consumer.h>
-/* Those are just for writing in syscon */
-#include <linux/of_address.h>
-#include <linux/io.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
/* 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;