提交 7fca1f20 编写于 作者: L Linus Walleij

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: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 98506258
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
}; };
syscon: syscon@c0011000 { syscon: syscon@c0011000 {
compatible = "stericsson,u300-syscon"; compatible = "stericsson,u300-syscon", "syscon";
reg = <0xc0011000 0x1000>; reg = <0xc0011000 0x1000>;
clk32: app_32_clk@32k { clk32: app_32_clk@32k {
#clock-cells = <0>; #clock-cells = <0>;
......
...@@ -20,6 +20,7 @@ config ARCH_U300 ...@@ -20,6 +20,7 @@ config ARCH_U300
select PINCTRL_COH901 select PINCTRL_COH901
select PINCTRL_U300 select PINCTRL_U300
select SPARSE_IRQ select SPARSE_IRQ
select MFD_SYSCON
select USE_OF select USE_OF
help help
Support for ST-Ericsson U300 series mobile platforms. Support for ST-Ericsson U300 series mobile platforms.
......
...@@ -15,9 +15,8 @@ ...@@ -15,9 +15,8 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
/* Those are just for writing in syscon */ #include <linux/mfd/syscon.h>
#include <linux/of_address.h> #include <linux/regmap.h>
#include <linux/io.h>
/* Power Management Control 16bit (R/W) */ /* Power Management Control 16bit (R/W) */
#define U300_SYSCON_PMCR (0x50) #define U300_SYSCON_PMCR (0x50)
...@@ -59,9 +58,8 @@ static int __init __u300_init_boardpower(struct platform_device *pdev) ...@@ -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 *np = pdev->dev.of_node;
struct device_node *syscon_np; struct device_node *syscon_np;
static void __iomem *syscon_base; struct regmap *regmap;
int err; int err;
u32 val;
pr_info("U300: setting up board power\n"); pr_info("U300: setting up board power\n");
...@@ -70,9 +68,9 @@ static int __init __u300_init_boardpower(struct platform_device *pdev) ...@@ -70,9 +68,9 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
pr_crit("U300: no syscon node\n"); pr_crit("U300: no syscon node\n");
return -ENODEV; return -ENODEV;
} }
syscon_base = of_iomap(syscon_np, 0); regmap = syscon_node_to_regmap(syscon_np);
if (!syscon_base) { if (!regmap) {
pr_crit("U300: could not remap syscon\n"); pr_crit("U300: could not locate syscon regmap\n");
return -ENODEV; return -ENODEV;
} }
...@@ -96,9 +94,8 @@ static int __init __u300_init_boardpower(struct platform_device *pdev) ...@@ -96,9 +94,8 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
* the rest of the U300 power management is implemented. * the rest of the U300 power management is implemented.
*/ */
pr_info("U300: disable system controller pull-up\n"); pr_info("U300: disable system controller pull-up\n");
val = readw(syscon_base + U300_SYSCON_PMCR); regmap_update_bits(regmap, U300_SYSCON_PMCR,
val &= ~U300_SYSCON_PMCR_DCON_ENABLE; U300_SYSCON_PMCR_DCON_ENABLE, 0);
writew(val, syscon_base + U300_SYSCON_PMCR);
/* Register globally exported PM poweroff hook */ /* Register globally exported PM poweroff hook */
pm_power_off = u300_pm_poweroff; pm_power_off = u300_pm_poweroff;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册