diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-05-22 16:15:13 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-06-17 13:54:35 +0200 |
commit | cf0ce095c932becf48ed794ecdfad925e931dc9c (patch) | |
tree | 107d791b310c669c79d44d084323a9817f521eda /arch/arm/mach-u300/regulator.c | |
parent | be2885a569f43fa6c44e2a5e1795583ae9941c27 (diff) | |
download | talos-obmc-linux-cf0ce095c932becf48ed794ecdfad925e931dc9c.tar.gz talos-obmc-linux-cf0ce095c932becf48ed794ecdfad925e931dc9c.zip |
ARM: u300: add syscon node
This adds a device tree node for the U300 system controller
and remaps this dynamically instead of using hard-coded
virtual addresses. The board power set-up code is altered
to fetch a reference to the syscon using ampersand <&syscon>
notation. This way of passing a pointer to the syscon will
also be used by the clocks.
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.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/arch/arm/mach-u300/regulator.c b/arch/arm/mach-u300/regulator.c index 1cbe88c74367..273fceb83685 100644 --- a/arch/arm/mach-u300/regulator.c +++ b/arch/arm/mach-u300/regulator.c @@ -16,8 +16,8 @@ #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 "u300-regs.h" /* Power Management Control 16bit (R/W) */ #define U300_SYSCON_PMCR (0x50) @@ -57,10 +57,25 @@ void u300_pm_poweroff(void) */ 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; int err; u32 val; pr_info("U300: setting up board power\n"); + + syscon_np = of_parse_phandle(np, "syscon", 0); + if (!syscon_np) { + 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"); + return -ENODEV; + } + main_power_15 = regulator_get(&pdev->dev, "vana15"); if (IS_ERR(main_power_15)) { @@ -81,9 +96,9 @@ 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(U300_SYSCON_VBASE + U300_SYSCON_PMCR); + val = readw(syscon_base + U300_SYSCON_PMCR); val &= ~U300_SYSCON_PMCR_DCON_ENABLE; - writew(val, U300_SYSCON_VBASE + U300_SYSCON_PMCR); + writew(val, syscon_base + U300_SYSCON_PMCR); /* Register globally exported PM poweroff hook */ pm_power_off = u300_pm_poweroff; |