aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-u300/regulator.c
diff options
context:
space:
mode:
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 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/regulator/machine.h> 16#include <linux/regulator/machine.h>
17#include <linux/regulator/consumer.h> 17#include <linux/regulator/consumer.h>
18/* Those are just for writing in syscon */ 18#include <linux/mfd/syscon.h>
19#include <linux/of_address.h> 19#include <linux/regmap.h>
20#include <linux/io.h>
21 20
22/* Power Management Control 16bit (R/W) */ 21/* Power Management Control 16bit (R/W) */
23#define U300_SYSCON_PMCR (0x50) 22#define U300_SYSCON_PMCR (0x50)
@@ -59,9 +58,8 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
59{ 58{
60 struct device_node *np = pdev->dev.of_node; 59 struct device_node *np = pdev->dev.of_node;
61 struct device_node *syscon_np; 60 struct device_node *syscon_np;
62 static void __iomem *syscon_base; 61 struct regmap *regmap;
63 int err; 62 int err;
64 u32 val;
65 63
66 pr_info("U300: setting up board power\n"); 64 pr_info("U300: setting up board power\n");
67 65
@@ -70,9 +68,9 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
70 pr_crit("U300: no syscon node\n"); 68 pr_crit("U300: no syscon node\n");
71 return -ENODEV; 69 return -ENODEV;
72 } 70 }
73 syscon_base = of_iomap(syscon_np, 0); 71 regmap = syscon_node_to_regmap(syscon_np);
74 if (!syscon_base) { 72 if (!regmap) {
75 pr_crit("U300: could not remap syscon\n"); 73 pr_crit("U300: could not locate syscon regmap\n");
76 return -ENODEV; 74 return -ENODEV;
77 } 75 }
78 76
@@ -96,9 +94,8 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
96 * the rest of the U300 power management is implemented. 94 * the rest of the U300 power management is implemented.
97 */ 95 */
98 pr_info("U300: disable system controller pull-up\n"); 96 pr_info("U300: disable system controller pull-up\n");
99 val = readw(syscon_base + U300_SYSCON_PMCR); 97 regmap_update_bits(regmap, U300_SYSCON_PMCR,
100 val &= ~U300_SYSCON_PMCR_DCON_ENABLE; 98 U300_SYSCON_PMCR_DCON_ENABLE, 0);
101 writew(val, syscon_base + U300_SYSCON_PMCR);
102 99
103 /* Register globally exported PM poweroff hook */ 100 /* Register globally exported PM poweroff hook */
104 pm_power_off = u300_pm_poweroff; 101 pm_power_off = u300_pm_poweroff;