diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-11-10 21:47:07 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-11-11 02:56:29 -0500 |
commit | e609b7cb7ab18cf75d4bdd931a33e3caed6cd9e2 (patch) | |
tree | 4220031e186b62fc459369f014084041a999c945 /arch/arm/mach-shmobile/board-bonito.c | |
parent | b6b37e250558a8348ba9a22ba27376d22bca2c5c (diff) |
ARM: mach-shmobile: bonito: add PMIC settings
bonito board needs some settings by pmic which use i2c access.
It is dependent on the device to be used.
This patch adds standard settings.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/board-bonito.c')
-rw-r--r-- | arch/arm/mach-shmobile/board-bonito.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c index efaa5feb39b8..d78008bbdf70 100644 --- a/arch/arm/mach-shmobile/board-bonito.c +++ b/arch/arm/mach-shmobile/board-bonito.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/i2c.h> | ||
23 | #include <linux/init.h> | 24 | #include <linux/init.h> |
24 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
25 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
@@ -84,6 +85,56 @@ static void bonito_fpga_write(u32 offset, u16 val) | |||
84 | } | 85 | } |
85 | 86 | ||
86 | /* | 87 | /* |
88 | * PMIC settings | ||
89 | * | ||
90 | * FIXME | ||
91 | * | ||
92 | * bonito board needs some settings by pmic which use i2c access. | ||
93 | * pmic settings use device_initcall() here for use it. | ||
94 | */ | ||
95 | static __u8 *pmic_settings = NULL; | ||
96 | static __u8 pmic_do_2A[] = { | ||
97 | 0x1C, 0x09, | ||
98 | 0x1A, 0x80, | ||
99 | 0xff, 0xff, | ||
100 | }; | ||
101 | |||
102 | static int __init pmic_init(void) | ||
103 | { | ||
104 | struct i2c_adapter *a = i2c_get_adapter(0); | ||
105 | struct i2c_msg msg; | ||
106 | __u8 buf[2]; | ||
107 | int i, ret; | ||
108 | |||
109 | if (!pmic_settings) | ||
110 | return 0; | ||
111 | if (!a) | ||
112 | return 0; | ||
113 | |||
114 | msg.addr = 0x46; | ||
115 | msg.buf = buf; | ||
116 | msg.len = 2; | ||
117 | msg.flags = 0; | ||
118 | |||
119 | for (i = 0; ; i += 2) { | ||
120 | buf[0] = pmic_settings[i + 0]; | ||
121 | buf[1] = pmic_settings[i + 1]; | ||
122 | |||
123 | if ((0xff == buf[0]) && (0xff == buf[1])) | ||
124 | break; | ||
125 | |||
126 | ret = i2c_transfer(a, &msg, 1); | ||
127 | if (ret < 0) { | ||
128 | pr_err("i2c transfer fail\n"); | ||
129 | break; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | return 0; | ||
134 | } | ||
135 | device_initcall(pmic_init); | ||
136 | |||
137 | /* | ||
87 | * core board devices | 138 | * core board devices |
88 | */ | 139 | */ |
89 | static struct platform_device *bonito_core_devices[] __initdata = { | 140 | static struct platform_device *bonito_core_devices[] __initdata = { |
@@ -154,6 +205,8 @@ static void __init bonito_init(void) | |||
154 | 205 | ||
155 | r8a7740_pinmux_init(); | 206 | r8a7740_pinmux_init(); |
156 | 207 | ||
208 | pmic_settings = pmic_do_2A; | ||
209 | |||
157 | /* | 210 | /* |
158 | * core board settings | 211 | * core board settings |
159 | */ | 212 | */ |