diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-05-28 17:04:03 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-05-28 17:04:03 -0400 |
commit | bb3b9d8eb97624956e7e3a9eba2c64576808b1dc (patch) | |
tree | b62b08c1a12b9fc71e1b01ad849f8486ab6cd420 /arch/arm/mach-omap2 | |
parent | b583f26d510ee1aef7348f38f1d959212f66b5e5 (diff) |
ARM: OMAP3: Initialize regulators for Beagle and Overo
Initialize regulators for Beagle and Overo.
Patch is based on earlier patches posted to linux-omap mailing
list.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/board-omap3beagle.c | 104 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-overo.c | 76 |
2 files changed, 152 insertions, 28 deletions
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index f25082c53c67..991ac9c38032 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/mtd/partitions.h> | 28 | #include <linux/mtd/partitions.h> |
29 | #include <linux/mtd/nand.h> | 29 | #include <linux/mtd/nand.h> |
30 | 30 | ||
31 | #include <linux/regulator/machine.h> | ||
31 | #include <linux/i2c/twl4030.h> | 32 | #include <linux/i2c/twl4030.h> |
32 | 33 | ||
33 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
@@ -120,6 +121,23 @@ static struct twl4030_hsmmc_info mmc[] = { | |||
120 | {} /* Terminator */ | 121 | {} /* Terminator */ |
121 | }; | 122 | }; |
122 | 123 | ||
124 | static struct platform_device omap3_beagle_lcd_device = { | ||
125 | .name = "omap3beagle_lcd", | ||
126 | .id = -1, | ||
127 | }; | ||
128 | |||
129 | static struct omap_lcd_config omap3_beagle_lcd_config __initdata = { | ||
130 | .ctrl_name = "internal", | ||
131 | }; | ||
132 | |||
133 | static struct regulator_consumer_supply beagle_vmmc1_supply = { | ||
134 | .supply = "vmmc", | ||
135 | }; | ||
136 | |||
137 | static struct regulator_consumer_supply beagle_vsim_supply = { | ||
138 | .supply = "vmmc_aux", | ||
139 | }; | ||
140 | |||
123 | static struct gpio_led gpio_leds[]; | 141 | static struct gpio_led gpio_leds[]; |
124 | 142 | ||
125 | static int beagle_twl_gpio_setup(struct device *dev, | 143 | static int beagle_twl_gpio_setup(struct device *dev, |
@@ -130,6 +148,10 @@ static int beagle_twl_gpio_setup(struct device *dev, | |||
130 | mmc[0].gpio_cd = gpio + 0; | 148 | mmc[0].gpio_cd = gpio + 0; |
131 | twl4030_mmc_init(mmc); | 149 | twl4030_mmc_init(mmc); |
132 | 150 | ||
151 | /* link regulators to MMC adapters */ | ||
152 | beagle_vmmc1_supply.dev = mmc[0].dev; | ||
153 | beagle_vsim_supply.dev = mmc[0].dev; | ||
154 | |||
133 | /* REVISIT: need ehci-omap hooks for external VBUS | 155 | /* REVISIT: need ehci-omap hooks for external VBUS |
134 | * power switch and overcurrent detect | 156 | * power switch and overcurrent detect |
135 | */ | 157 | */ |
@@ -158,12 +180,85 @@ static struct twl4030_gpio_platform_data beagle_gpio_data = { | |||
158 | .setup = beagle_twl_gpio_setup, | 180 | .setup = beagle_twl_gpio_setup, |
159 | }; | 181 | }; |
160 | 182 | ||
183 | static struct regulator_consumer_supply beagle_vdac_supply = { | ||
184 | .supply = "vdac", | ||
185 | .dev = &omap3_beagle_lcd_device.dev, | ||
186 | }; | ||
187 | |||
188 | static struct regulator_consumer_supply beagle_vdvi_supply = { | ||
189 | .supply = "vdvi", | ||
190 | .dev = &omap3_beagle_lcd_device.dev, | ||
191 | }; | ||
192 | |||
193 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ | ||
194 | static struct regulator_init_data beagle_vmmc1 = { | ||
195 | .constraints = { | ||
196 | .min_uV = 1850000, | ||
197 | .max_uV = 3150000, | ||
198 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
199 | | REGULATOR_MODE_STANDBY, | ||
200 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
201 | | REGULATOR_CHANGE_MODE | ||
202 | | REGULATOR_CHANGE_STATUS, | ||
203 | }, | ||
204 | .num_consumer_supplies = 1, | ||
205 | .consumer_supplies = &beagle_vmmc1_supply, | ||
206 | }; | ||
207 | |||
208 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ | ||
209 | static struct regulator_init_data beagle_vsim = { | ||
210 | .constraints = { | ||
211 | .min_uV = 1800000, | ||
212 | .max_uV = 3000000, | ||
213 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
214 | | REGULATOR_MODE_STANDBY, | ||
215 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
216 | | REGULATOR_CHANGE_MODE | ||
217 | | REGULATOR_CHANGE_STATUS, | ||
218 | }, | ||
219 | .num_consumer_supplies = 1, | ||
220 | .consumer_supplies = &beagle_vsim_supply, | ||
221 | }; | ||
222 | |||
223 | /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */ | ||
224 | static struct regulator_init_data beagle_vdac = { | ||
225 | .constraints = { | ||
226 | .min_uV = 1800000, | ||
227 | .max_uV = 1800000, | ||
228 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
229 | | REGULATOR_MODE_STANDBY, | ||
230 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
231 | | REGULATOR_CHANGE_STATUS, | ||
232 | }, | ||
233 | .num_consumer_supplies = 1, | ||
234 | .consumer_supplies = &beagle_vdac_supply, | ||
235 | }; | ||
236 | |||
237 | /* VPLL2 for digital video outputs */ | ||
238 | static struct regulator_init_data beagle_vpll2 = { | ||
239 | .constraints = { | ||
240 | .name = "VDVI", | ||
241 | .min_uV = 1800000, | ||
242 | .max_uV = 1800000, | ||
243 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
244 | | REGULATOR_MODE_STANDBY, | ||
245 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
246 | | REGULATOR_CHANGE_STATUS, | ||
247 | }, | ||
248 | .num_consumer_supplies = 1, | ||
249 | .consumer_supplies = &beagle_vdvi_supply, | ||
250 | }; | ||
251 | |||
161 | static struct twl4030_platform_data beagle_twldata = { | 252 | static struct twl4030_platform_data beagle_twldata = { |
162 | .irq_base = TWL4030_IRQ_BASE, | 253 | .irq_base = TWL4030_IRQ_BASE, |
163 | .irq_end = TWL4030_IRQ_END, | 254 | .irq_end = TWL4030_IRQ_END, |
164 | 255 | ||
165 | /* platform_data for children goes here */ | 256 | /* platform_data for children goes here */ |
166 | .gpio = &beagle_gpio_data, | 257 | .gpio = &beagle_gpio_data, |
258 | .vmmc1 = &beagle_vmmc1, | ||
259 | .vsim = &beagle_vsim, | ||
260 | .vdac = &beagle_vdac, | ||
261 | .vpll2 = &beagle_vpll2, | ||
167 | }; | 262 | }; |
168 | 263 | ||
169 | static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { | 264 | static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { |
@@ -195,15 +290,6 @@ static void __init omap3_beagle_init_irq(void) | |||
195 | omap_gpio_init(); | 290 | omap_gpio_init(); |
196 | } | 291 | } |
197 | 292 | ||
198 | static struct platform_device omap3_beagle_lcd_device = { | ||
199 | .name = "omap3beagle_lcd", | ||
200 | .id = -1, | ||
201 | }; | ||
202 | |||
203 | static struct omap_lcd_config omap3_beagle_lcd_config __initdata = { | ||
204 | .ctrl_name = "internal", | ||
205 | }; | ||
206 | |||
207 | static struct gpio_led gpio_leds[] = { | 293 | static struct gpio_led gpio_leds[] = { |
208 | { | 294 | { |
209 | .name = "beagleboard::usr0", | 295 | .name = "beagleboard::usr0", |
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index c7443ff98ee2..dff5528fbfb5 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/i2c/twl4030.h> | 29 | #include <linux/i2c/twl4030.h> |
30 | #include <linux/regulator/machine.h> | ||
30 | 31 | ||
31 | #include <linux/mtd/mtd.h> | 32 | #include <linux/mtd/mtd.h> |
32 | #include <linux/mtd/nand.h> | 33 | #include <linux/mtd/nand.h> |
@@ -272,21 +273,76 @@ static struct omap_uart_config overo_uart_config __initdata = { | |||
272 | .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), | 273 | .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), |
273 | }; | 274 | }; |
274 | 275 | ||
276 | static struct twl4030_hsmmc_info mmc[] = { | ||
277 | { | ||
278 | .mmc = 1, | ||
279 | .wires = 4, | ||
280 | .gpio_cd = -EINVAL, | ||
281 | .gpio_wp = -EINVAL, | ||
282 | }, | ||
283 | { | ||
284 | .mmc = 2, | ||
285 | .wires = 4, | ||
286 | .gpio_cd = -EINVAL, | ||
287 | .gpio_wp = -EINVAL, | ||
288 | .transceiver = true, | ||
289 | .ocr_mask = 0x00100000, /* 3.3V */ | ||
290 | }, | ||
291 | {} /* Terminator */ | ||
292 | }; | ||
293 | |||
294 | static struct regulator_consumer_supply overo_vmmc1_supply = { | ||
295 | .supply = "vmmc", | ||
296 | }; | ||
297 | |||
298 | static int overo_twl_gpio_setup(struct device *dev, | ||
299 | unsigned gpio, unsigned ngpio) | ||
300 | { | ||
301 | twl4030_mmc_init(mmc); | ||
302 | |||
303 | overo_vmmc1_supply.dev = mmc[0].dev; | ||
304 | |||
305 | return 0; | ||
306 | } | ||
307 | |||
275 | static struct twl4030_gpio_platform_data overo_gpio_data = { | 308 | static struct twl4030_gpio_platform_data overo_gpio_data = { |
276 | .gpio_base = OMAP_MAX_GPIO_LINES, | 309 | .gpio_base = OMAP_MAX_GPIO_LINES, |
277 | .irq_base = TWL4030_GPIO_IRQ_BASE, | 310 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
278 | .irq_end = TWL4030_GPIO_IRQ_END, | 311 | .irq_end = TWL4030_GPIO_IRQ_END, |
312 | .setup = overo_twl_gpio_setup, | ||
313 | }; | ||
314 | |||
315 | static struct twl4030_usb_data overo_usb_data = { | ||
316 | .usb_mode = T2_USB_MODE_ULPI, | ||
317 | }; | ||
318 | |||
319 | static struct regulator_init_data overo_vmmc1 = { | ||
320 | .constraints = { | ||
321 | .min_uV = 1850000, | ||
322 | .max_uV = 3150000, | ||
323 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
324 | | REGULATOR_MODE_STANDBY, | ||
325 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
326 | | REGULATOR_CHANGE_MODE | ||
327 | | REGULATOR_CHANGE_STATUS, | ||
328 | }, | ||
329 | .num_consumer_supplies = 1, | ||
330 | .consumer_supplies = &overo_vmmc1_supply, | ||
279 | }; | 331 | }; |
280 | 332 | ||
333 | /* mmc2 (WLAN) and Bluetooth don't use twl4030 regulators */ | ||
334 | |||
281 | static struct twl4030_platform_data overo_twldata = { | 335 | static struct twl4030_platform_data overo_twldata = { |
282 | .irq_base = TWL4030_IRQ_BASE, | 336 | .irq_base = TWL4030_IRQ_BASE, |
283 | .irq_end = TWL4030_IRQ_END, | 337 | .irq_end = TWL4030_IRQ_END, |
284 | .gpio = &overo_gpio_data, | 338 | .gpio = &overo_gpio_data, |
339 | .usb = &overo_usb_data, | ||
340 | .vmmc1 = &overo_vmmc1, | ||
285 | }; | 341 | }; |
286 | 342 | ||
287 | static struct i2c_board_info __initdata overo_i2c_boardinfo[] = { | 343 | static struct i2c_board_info __initdata overo_i2c_boardinfo[] = { |
288 | { | 344 | { |
289 | I2C_BOARD_INFO("twl4030", 0x48), | 345 | I2C_BOARD_INFO("tps65950", 0x48), |
290 | .flags = I2C_CLIENT_WAKE, | 346 | .flags = I2C_CLIENT_WAKE, |
291 | .irq = INT_34XX_SYS_NIRQ, | 347 | .irq = INT_34XX_SYS_NIRQ, |
292 | .platform_data = &overo_twldata, | 348 | .platform_data = &overo_twldata, |
@@ -327,23 +383,6 @@ static struct platform_device *overo_devices[] __initdata = { | |||
327 | &overo_lcd_device, | 383 | &overo_lcd_device, |
328 | }; | 384 | }; |
329 | 385 | ||
330 | static struct twl4030_hsmmc_info mmc[] __initdata = { | ||
331 | { | ||
332 | .mmc = 1, | ||
333 | .wires = 4, | ||
334 | .gpio_cd = -EINVAL, | ||
335 | .gpio_wp = -EINVAL, | ||
336 | }, | ||
337 | { | ||
338 | .mmc = 2, | ||
339 | .wires = 4, | ||
340 | .gpio_cd = -EINVAL, | ||
341 | .gpio_wp = -EINVAL, | ||
342 | .transceiver = true, | ||
343 | }, | ||
344 | {} /* Terminator */ | ||
345 | }; | ||
346 | |||
347 | static void __init overo_init(void) | 386 | static void __init overo_init(void) |
348 | { | 387 | { |
349 | overo_i2c_init(); | 388 | overo_i2c_init(); |
@@ -351,7 +390,6 @@ static void __init overo_init(void) | |||
351 | omap_board_config = overo_config; | 390 | omap_board_config = overo_config; |
352 | omap_board_config_size = ARRAY_SIZE(overo_config); | 391 | omap_board_config_size = ARRAY_SIZE(overo_config); |
353 | omap_serial_init(); | 392 | omap_serial_init(); |
354 | twl4030_mmc_init(mmc); | ||
355 | overo_flash_init(); | 393 | overo_flash_init(); |
356 | usb_musb_init(); | 394 | usb_musb_init(); |
357 | overo_ads7846_init(); | 395 | overo_ads7846_init(); |