diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2011-06-07 03:26:46 -0400 |
---|---|---|
committer | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2011-07-04 11:43:33 -0400 |
commit | b22f954bae35be115a10c6426dc070f7d652b32e (patch) | |
tree | 2144bd55d658b284eb8d56d315d4177adf2f9186 | |
parent | a53b8e3b995f8b7c8a8c4ef5aa367958e46139b3 (diff) |
OMAP4: Move common twl6030 configuration to twl-common
Reduce the amount of duplicated code by moving the common
configuration for TWL6030 (on OMAP4 platform) to the
twl-common file.
Use the omap4_pmic_get_config function from board files to
properly configure the PMIC with the common fields.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap2/board-4430sdp.c | 141 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-omap4panda.c | 146 | ||||
-rw-r--r-- | arch/arm/mach-omap2/twl-common.c | 163 | ||||
-rw-r--r-- | arch/arm/mach-omap2/twl-common.h | 20 |
4 files changed, 205 insertions, 265 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index d7df07ef2cea..933b25bb10de 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -302,14 +302,6 @@ static struct omap_musb_board_data musb_board_data = { | |||
302 | .power = 100, | 302 | .power = 100, |
303 | }; | 303 | }; |
304 | 304 | ||
305 | static struct twl4030_usb_data omap4_usbphy_data = { | ||
306 | .phy_init = omap4430_phy_init, | ||
307 | .phy_exit = omap4430_phy_exit, | ||
308 | .phy_power = omap4430_phy_power, | ||
309 | .phy_set_clock = omap4430_phy_set_clk, | ||
310 | .phy_suspend = omap4430_phy_suspend, | ||
311 | }; | ||
312 | |||
313 | static struct omap2_hsmmc_info mmc[] = { | 305 | static struct omap2_hsmmc_info mmc[] = { |
314 | { | 306 | { |
315 | .mmc = 2, | 307 | .mmc = 2, |
@@ -332,10 +324,6 @@ static struct regulator_consumer_supply sdp4430_vaux_supply[] = { | |||
332 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), | 324 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), |
333 | }; | 325 | }; |
334 | 326 | ||
335 | static struct regulator_consumer_supply sdp4430_vmmc_supply[] = { | ||
336 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), | ||
337 | }; | ||
338 | |||
339 | static int omap4_twl6030_hsmmc_late_init(struct device *dev) | 327 | static int omap4_twl6030_hsmmc_late_init(struct device *dev) |
340 | { | 328 | { |
341 | int ret = 0; | 329 | int ret = 0; |
@@ -394,61 +382,6 @@ static struct regulator_init_data sdp4430_vaux1 = { | |||
394 | .consumer_supplies = sdp4430_vaux_supply, | 382 | .consumer_supplies = sdp4430_vaux_supply, |
395 | }; | 383 | }; |
396 | 384 | ||
397 | static struct regulator_init_data sdp4430_vaux2 = { | ||
398 | .constraints = { | ||
399 | .min_uV = 1200000, | ||
400 | .max_uV = 2800000, | ||
401 | .apply_uV = true, | ||
402 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
403 | | REGULATOR_MODE_STANDBY, | ||
404 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
405 | | REGULATOR_CHANGE_MODE | ||
406 | | REGULATOR_CHANGE_STATUS, | ||
407 | }, | ||
408 | }; | ||
409 | |||
410 | static struct regulator_init_data sdp4430_vaux3 = { | ||
411 | .constraints = { | ||
412 | .min_uV = 1000000, | ||
413 | .max_uV = 3000000, | ||
414 | .apply_uV = true, | ||
415 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
416 | | REGULATOR_MODE_STANDBY, | ||
417 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
418 | | REGULATOR_CHANGE_MODE | ||
419 | | REGULATOR_CHANGE_STATUS, | ||
420 | }, | ||
421 | }; | ||
422 | |||
423 | /* VMMC1 for MMC1 card */ | ||
424 | static struct regulator_init_data sdp4430_vmmc = { | ||
425 | .constraints = { | ||
426 | .min_uV = 1200000, | ||
427 | .max_uV = 3000000, | ||
428 | .apply_uV = true, | ||
429 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
430 | | REGULATOR_MODE_STANDBY, | ||
431 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
432 | | REGULATOR_CHANGE_MODE | ||
433 | | REGULATOR_CHANGE_STATUS, | ||
434 | }, | ||
435 | .num_consumer_supplies = 1, | ||
436 | .consumer_supplies = sdp4430_vmmc_supply, | ||
437 | }; | ||
438 | |||
439 | static struct regulator_init_data sdp4430_vpp = { | ||
440 | .constraints = { | ||
441 | .min_uV = 1800000, | ||
442 | .max_uV = 2500000, | ||
443 | .apply_uV = true, | ||
444 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
445 | | REGULATOR_MODE_STANDBY, | ||
446 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
447 | | REGULATOR_CHANGE_MODE | ||
448 | | REGULATOR_CHANGE_STATUS, | ||
449 | }, | ||
450 | }; | ||
451 | |||
452 | static struct regulator_init_data sdp4430_vusim = { | 385 | static struct regulator_init_data sdp4430_vusim = { |
453 | .constraints = { | 386 | .constraints = { |
454 | .min_uV = 1200000, | 387 | .min_uV = 1200000, |
@@ -462,74 +395,10 @@ static struct regulator_init_data sdp4430_vusim = { | |||
462 | }, | 395 | }, |
463 | }; | 396 | }; |
464 | 397 | ||
465 | static struct regulator_init_data sdp4430_vana = { | ||
466 | .constraints = { | ||
467 | .min_uV = 2100000, | ||
468 | .max_uV = 2100000, | ||
469 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
470 | | REGULATOR_MODE_STANDBY, | ||
471 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
472 | | REGULATOR_CHANGE_STATUS, | ||
473 | }, | ||
474 | }; | ||
475 | |||
476 | static struct regulator_init_data sdp4430_vcxio = { | ||
477 | .constraints = { | ||
478 | .min_uV = 1800000, | ||
479 | .max_uV = 1800000, | ||
480 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
481 | | REGULATOR_MODE_STANDBY, | ||
482 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
483 | | REGULATOR_CHANGE_STATUS, | ||
484 | }, | ||
485 | }; | ||
486 | |||
487 | static struct regulator_init_data sdp4430_vdac = { | ||
488 | .constraints = { | ||
489 | .min_uV = 1800000, | ||
490 | .max_uV = 1800000, | ||
491 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
492 | | REGULATOR_MODE_STANDBY, | ||
493 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
494 | | REGULATOR_CHANGE_STATUS, | ||
495 | }, | ||
496 | }; | ||
497 | |||
498 | static struct regulator_init_data sdp4430_vusb = { | ||
499 | .constraints = { | ||
500 | .min_uV = 3300000, | ||
501 | .max_uV = 3300000, | ||
502 | .apply_uV = true, | ||
503 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
504 | | REGULATOR_MODE_STANDBY, | ||
505 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
506 | | REGULATOR_CHANGE_STATUS, | ||
507 | }, | ||
508 | }; | ||
509 | |||
510 | static struct regulator_init_data sdp4430_clk32kg = { | ||
511 | .constraints = { | ||
512 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
513 | }, | ||
514 | }; | ||
515 | |||
516 | static struct twl4030_platform_data sdp4430_twldata = { | 398 | static struct twl4030_platform_data sdp4430_twldata = { |
517 | .irq_base = TWL6030_IRQ_BASE, | ||
518 | .irq_end = TWL6030_IRQ_END, | ||
519 | |||
520 | /* Regulators */ | 399 | /* Regulators */ |
521 | .vmmc = &sdp4430_vmmc, | ||
522 | .vpp = &sdp4430_vpp, | ||
523 | .vusim = &sdp4430_vusim, | 400 | .vusim = &sdp4430_vusim, |
524 | .vana = &sdp4430_vana, | ||
525 | .vcxio = &sdp4430_vcxio, | ||
526 | .vdac = &sdp4430_vdac, | ||
527 | .vusb = &sdp4430_vusb, | ||
528 | .vaux1 = &sdp4430_vaux1, | 401 | .vaux1 = &sdp4430_vaux1, |
529 | .vaux2 = &sdp4430_vaux2, | ||
530 | .vaux3 = &sdp4430_vaux3, | ||
531 | .clk32kg = &sdp4430_clk32kg, | ||
532 | .usb = &omap4_usbphy_data | ||
533 | }; | 402 | }; |
534 | 403 | ||
535 | static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { | 404 | static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { |
@@ -547,6 +416,16 @@ static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = { | |||
547 | }; | 416 | }; |
548 | static int __init omap4_i2c_init(void) | 417 | static int __init omap4_i2c_init(void) |
549 | { | 418 | { |
419 | omap4_pmic_get_config(&sdp4430_twldata, TWL_COMMON_PDATA_USB, | ||
420 | TWL_COMMON_REGULATOR_VDAC | | ||
421 | TWL_COMMON_REGULATOR_VAUX2 | | ||
422 | TWL_COMMON_REGULATOR_VAUX3 | | ||
423 | TWL_COMMON_REGULATOR_VMMC | | ||
424 | TWL_COMMON_REGULATOR_VPP | | ||
425 | TWL_COMMON_REGULATOR_VANA | | ||
426 | TWL_COMMON_REGULATOR_VCXIO | | ||
427 | TWL_COMMON_REGULATOR_VUSB | | ||
428 | TWL_COMMON_REGULATOR_CLK32KG); | ||
550 | omap4_pmic_init("twl6030", &sdp4430_twldata); | 429 | omap4_pmic_init("twl6030", &sdp4430_twldata); |
551 | omap_register_i2c_bus(2, 400, NULL, 0); | 430 | omap_register_i2c_bus(2, 400, NULL, 0); |
552 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, | 431 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, |
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index ee2034e37468..9aaa96057666 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -154,14 +154,6 @@ static struct omap_musb_board_data musb_board_data = { | |||
154 | .power = 100, | 154 | .power = 100, |
155 | }; | 155 | }; |
156 | 156 | ||
157 | static struct twl4030_usb_data omap4_usbphy_data = { | ||
158 | .phy_init = omap4430_phy_init, | ||
159 | .phy_exit = omap4430_phy_exit, | ||
160 | .phy_power = omap4430_phy_power, | ||
161 | .phy_set_clock = omap4430_phy_set_clk, | ||
162 | .phy_suspend = omap4430_phy_suspend, | ||
163 | }; | ||
164 | |||
165 | static struct omap2_hsmmc_info mmc[] = { | 157 | static struct omap2_hsmmc_info mmc[] = { |
166 | { | 158 | { |
167 | .mmc = 1, | 159 | .mmc = 1, |
@@ -181,10 +173,6 @@ static struct omap2_hsmmc_info mmc[] = { | |||
181 | {} /* Terminator */ | 173 | {} /* Terminator */ |
182 | }; | 174 | }; |
183 | 175 | ||
184 | static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = { | ||
185 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), | ||
186 | }; | ||
187 | |||
188 | static struct regulator_consumer_supply omap4_panda_vmmc5_supply[] = { | 176 | static struct regulator_consumer_supply omap4_panda_vmmc5_supply[] = { |
189 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.4"), | 177 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.4"), |
190 | }; | 178 | }; |
@@ -269,128 +257,8 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) | |||
269 | return 0; | 257 | return 0; |
270 | } | 258 | } |
271 | 259 | ||
272 | static struct regulator_init_data omap4_panda_vaux2 = { | 260 | /* Panda board uses the common PMIC configuration */ |
273 | .constraints = { | 261 | static struct twl4030_platform_data omap4_panda_twldata; |
274 | .min_uV = 1200000, | ||
275 | .max_uV = 2800000, | ||
276 | .apply_uV = true, | ||
277 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
278 | | REGULATOR_MODE_STANDBY, | ||
279 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
280 | | REGULATOR_CHANGE_MODE | ||
281 | | REGULATOR_CHANGE_STATUS, | ||
282 | }, | ||
283 | }; | ||
284 | |||
285 | static struct regulator_init_data omap4_panda_vaux3 = { | ||
286 | .constraints = { | ||
287 | .min_uV = 1000000, | ||
288 | .max_uV = 3000000, | ||
289 | .apply_uV = true, | ||
290 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
291 | | REGULATOR_MODE_STANDBY, | ||
292 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
293 | | REGULATOR_CHANGE_MODE | ||
294 | | REGULATOR_CHANGE_STATUS, | ||
295 | }, | ||
296 | }; | ||
297 | |||
298 | /* VMMC1 for MMC1 card */ | ||
299 | static struct regulator_init_data omap4_panda_vmmc = { | ||
300 | .constraints = { | ||
301 | .min_uV = 1200000, | ||
302 | .max_uV = 3000000, | ||
303 | .apply_uV = true, | ||
304 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
305 | | REGULATOR_MODE_STANDBY, | ||
306 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
307 | | REGULATOR_CHANGE_MODE | ||
308 | | REGULATOR_CHANGE_STATUS, | ||
309 | }, | ||
310 | .num_consumer_supplies = ARRAY_SIZE(omap4_panda_vmmc_supply), | ||
311 | .consumer_supplies = omap4_panda_vmmc_supply, | ||
312 | }; | ||
313 | |||
314 | static struct regulator_init_data omap4_panda_vpp = { | ||
315 | .constraints = { | ||
316 | .min_uV = 1800000, | ||
317 | .max_uV = 2500000, | ||
318 | .apply_uV = true, | ||
319 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
320 | | REGULATOR_MODE_STANDBY, | ||
321 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
322 | | REGULATOR_CHANGE_MODE | ||
323 | | REGULATOR_CHANGE_STATUS, | ||
324 | }, | ||
325 | }; | ||
326 | |||
327 | static struct regulator_init_data omap4_panda_vana = { | ||
328 | .constraints = { | ||
329 | .min_uV = 2100000, | ||
330 | .max_uV = 2100000, | ||
331 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
332 | | REGULATOR_MODE_STANDBY, | ||
333 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
334 | | REGULATOR_CHANGE_STATUS, | ||
335 | }, | ||
336 | }; | ||
337 | |||
338 | static struct regulator_init_data omap4_panda_vcxio = { | ||
339 | .constraints = { | ||
340 | .min_uV = 1800000, | ||
341 | .max_uV = 1800000, | ||
342 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
343 | | REGULATOR_MODE_STANDBY, | ||
344 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
345 | | REGULATOR_CHANGE_STATUS, | ||
346 | }, | ||
347 | }; | ||
348 | |||
349 | static struct regulator_init_data omap4_panda_vdac = { | ||
350 | .constraints = { | ||
351 | .min_uV = 1800000, | ||
352 | .max_uV = 1800000, | ||
353 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
354 | | REGULATOR_MODE_STANDBY, | ||
355 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
356 | | REGULATOR_CHANGE_STATUS, | ||
357 | }, | ||
358 | }; | ||
359 | |||
360 | static struct regulator_init_data omap4_panda_vusb = { | ||
361 | .constraints = { | ||
362 | .min_uV = 3300000, | ||
363 | .max_uV = 3300000, | ||
364 | .apply_uV = true, | ||
365 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
366 | | REGULATOR_MODE_STANDBY, | ||
367 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
368 | | REGULATOR_CHANGE_STATUS, | ||
369 | }, | ||
370 | }; | ||
371 | |||
372 | static struct regulator_init_data omap4_panda_clk32kg = { | ||
373 | .constraints = { | ||
374 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
375 | }, | ||
376 | }; | ||
377 | |||
378 | static struct twl4030_platform_data omap4_panda_twldata = { | ||
379 | .irq_base = TWL6030_IRQ_BASE, | ||
380 | .irq_end = TWL6030_IRQ_END, | ||
381 | |||
382 | /* Regulators */ | ||
383 | .vmmc = &omap4_panda_vmmc, | ||
384 | .vpp = &omap4_panda_vpp, | ||
385 | .vana = &omap4_panda_vana, | ||
386 | .vcxio = &omap4_panda_vcxio, | ||
387 | .vdac = &omap4_panda_vdac, | ||
388 | .vusb = &omap4_panda_vusb, | ||
389 | .vaux2 = &omap4_panda_vaux2, | ||
390 | .vaux3 = &omap4_panda_vaux3, | ||
391 | .clk32kg = &omap4_panda_clk32kg, | ||
392 | .usb = &omap4_usbphy_data, | ||
393 | }; | ||
394 | 262 | ||
395 | /* | 263 | /* |
396 | * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM | 264 | * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM |
@@ -404,6 +272,16 @@ static struct i2c_board_info __initdata panda_i2c_eeprom[] = { | |||
404 | 272 | ||
405 | static int __init omap4_panda_i2c_init(void) | 273 | static int __init omap4_panda_i2c_init(void) |
406 | { | 274 | { |
275 | omap4_pmic_get_config(&omap4_panda_twldata, TWL_COMMON_PDATA_USB, | ||
276 | TWL_COMMON_REGULATOR_VDAC | | ||
277 | TWL_COMMON_REGULATOR_VAUX2 | | ||
278 | TWL_COMMON_REGULATOR_VAUX3 | | ||
279 | TWL_COMMON_REGULATOR_VMMC | | ||
280 | TWL_COMMON_REGULATOR_VPP | | ||
281 | TWL_COMMON_REGULATOR_VANA | | ||
282 | TWL_COMMON_REGULATOR_VCXIO | | ||
283 | TWL_COMMON_REGULATOR_VUSB | | ||
284 | TWL_COMMON_REGULATOR_CLK32KG); | ||
407 | omap4_pmic_init("twl6030", &omap4_panda_twldata); | 285 | omap4_pmic_init("twl6030", &omap4_panda_twldata); |
408 | omap_register_i2c_bus(2, 400, NULL, 0); | 286 | omap_register_i2c_bus(2, 400, NULL, 0); |
409 | /* | 287 | /* |
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 4f7b24c1a264..cf80f4cad729 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c | |||
@@ -23,8 +23,11 @@ | |||
23 | #include <linux/i2c.h> | 23 | #include <linux/i2c.h> |
24 | #include <linux/i2c/twl.h> | 24 | #include <linux/i2c/twl.h> |
25 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
26 | #include <linux/regulator/machine.h> | ||
27 | #include <linux/regulator/fixed.h> | ||
26 | 28 | ||
27 | #include <plat/i2c.h> | 29 | #include <plat/i2c.h> |
30 | #include <plat/usb.h> | ||
28 | 31 | ||
29 | #include "twl-common.h" | 32 | #include "twl-common.h" |
30 | 33 | ||
@@ -44,3 +47,163 @@ void __init omap_pmic_init(int bus, u32 clkrate, | |||
44 | 47 | ||
45 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); | 48 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); |
46 | } | 49 | } |
50 | |||
51 | static struct twl4030_usb_data omap4_usb_pdata = { | ||
52 | .phy_init = omap4430_phy_init, | ||
53 | .phy_exit = omap4430_phy_exit, | ||
54 | .phy_power = omap4430_phy_power, | ||
55 | .phy_set_clock = omap4430_phy_set_clk, | ||
56 | .phy_suspend = omap4430_phy_suspend, | ||
57 | }; | ||
58 | |||
59 | static struct regulator_init_data omap4_vdac_idata = { | ||
60 | .constraints = { | ||
61 | .min_uV = 1800000, | ||
62 | .max_uV = 1800000, | ||
63 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
64 | | REGULATOR_MODE_STANDBY, | ||
65 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
66 | | REGULATOR_CHANGE_STATUS, | ||
67 | }, | ||
68 | }; | ||
69 | |||
70 | static struct regulator_init_data omap4_vaux2_idata = { | ||
71 | .constraints = { | ||
72 | .min_uV = 1200000, | ||
73 | .max_uV = 2800000, | ||
74 | .apply_uV = true, | ||
75 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
76 | | REGULATOR_MODE_STANDBY, | ||
77 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
78 | | REGULATOR_CHANGE_MODE | ||
79 | | REGULATOR_CHANGE_STATUS, | ||
80 | }, | ||
81 | }; | ||
82 | |||
83 | static struct regulator_init_data omap4_vaux3_idata = { | ||
84 | .constraints = { | ||
85 | .min_uV = 1000000, | ||
86 | .max_uV = 3000000, | ||
87 | .apply_uV = true, | ||
88 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
89 | | REGULATOR_MODE_STANDBY, | ||
90 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
91 | | REGULATOR_CHANGE_MODE | ||
92 | | REGULATOR_CHANGE_STATUS, | ||
93 | }, | ||
94 | }; | ||
95 | |||
96 | static struct regulator_consumer_supply omap4_vmmc_supply[] = { | ||
97 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), | ||
98 | }; | ||
99 | |||
100 | /* VMMC1 for MMC1 card */ | ||
101 | static struct regulator_init_data omap4_vmmc_idata = { | ||
102 | .constraints = { | ||
103 | .min_uV = 1200000, | ||
104 | .max_uV = 3000000, | ||
105 | .apply_uV = true, | ||
106 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
107 | | REGULATOR_MODE_STANDBY, | ||
108 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
109 | | REGULATOR_CHANGE_MODE | ||
110 | | REGULATOR_CHANGE_STATUS, | ||
111 | }, | ||
112 | .num_consumer_supplies = ARRAY_SIZE(omap4_vmmc_supply), | ||
113 | .consumer_supplies = omap4_vmmc_supply, | ||
114 | }; | ||
115 | |||
116 | static struct regulator_init_data omap4_vpp_idata = { | ||
117 | .constraints = { | ||
118 | .min_uV = 1800000, | ||
119 | .max_uV = 2500000, | ||
120 | .apply_uV = true, | ||
121 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
122 | | REGULATOR_MODE_STANDBY, | ||
123 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | ||
124 | | REGULATOR_CHANGE_MODE | ||
125 | | REGULATOR_CHANGE_STATUS, | ||
126 | }, | ||
127 | }; | ||
128 | |||
129 | static struct regulator_init_data omap4_vana_idata = { | ||
130 | .constraints = { | ||
131 | .min_uV = 2100000, | ||
132 | .max_uV = 2100000, | ||
133 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
134 | | REGULATOR_MODE_STANDBY, | ||
135 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
136 | | REGULATOR_CHANGE_STATUS, | ||
137 | }, | ||
138 | }; | ||
139 | |||
140 | static struct regulator_init_data omap4_vcxio_idata = { | ||
141 | .constraints = { | ||
142 | .min_uV = 1800000, | ||
143 | .max_uV = 1800000, | ||
144 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
145 | | REGULATOR_MODE_STANDBY, | ||
146 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
147 | | REGULATOR_CHANGE_STATUS, | ||
148 | }, | ||
149 | }; | ||
150 | |||
151 | static struct regulator_init_data omap4_vusb_idata = { | ||
152 | .constraints = { | ||
153 | .min_uV = 3300000, | ||
154 | .max_uV = 3300000, | ||
155 | .apply_uV = true, | ||
156 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
157 | | REGULATOR_MODE_STANDBY, | ||
158 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
159 | | REGULATOR_CHANGE_STATUS, | ||
160 | }, | ||
161 | }; | ||
162 | |||
163 | static struct regulator_init_data omap4_clk32kg_idata = { | ||
164 | .constraints = { | ||
165 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
166 | }, | ||
167 | }; | ||
168 | |||
169 | void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, | ||
170 | u32 pdata_flags, u32 regulators_flags) | ||
171 | { | ||
172 | if (!pmic_data->irq_base) | ||
173 | pmic_data->irq_base = TWL6030_IRQ_BASE; | ||
174 | if (!pmic_data->irq_end) | ||
175 | pmic_data->irq_end = TWL6030_IRQ_END; | ||
176 | |||
177 | /* Common platform data configurations */ | ||
178 | if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb) | ||
179 | pmic_data->usb = &omap4_usb_pdata; | ||
180 | |||
181 | /* Common regulator configurations */ | ||
182 | if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac) | ||
183 | pmic_data->vdac = &omap4_vdac_idata; | ||
184 | |||
185 | if (regulators_flags & TWL_COMMON_REGULATOR_VAUX2 && !pmic_data->vaux2) | ||
186 | pmic_data->vaux2 = &omap4_vaux2_idata; | ||
187 | |||
188 | if (regulators_flags & TWL_COMMON_REGULATOR_VAUX3 && !pmic_data->vaux3) | ||
189 | pmic_data->vaux3 = &omap4_vaux3_idata; | ||
190 | |||
191 | if (regulators_flags & TWL_COMMON_REGULATOR_VMMC && !pmic_data->vmmc) | ||
192 | pmic_data->vmmc = &omap4_vmmc_idata; | ||
193 | |||
194 | if (regulators_flags & TWL_COMMON_REGULATOR_VPP && !pmic_data->vpp) | ||
195 | pmic_data->vpp = &omap4_vpp_idata; | ||
196 | |||
197 | if (regulators_flags & TWL_COMMON_REGULATOR_VANA && !pmic_data->vana) | ||
198 | pmic_data->vana = &omap4_vana_idata; | ||
199 | |||
200 | if (regulators_flags & TWL_COMMON_REGULATOR_VCXIO && !pmic_data->vcxio) | ||
201 | pmic_data->vcxio = &omap4_vcxio_idata; | ||
202 | |||
203 | if (regulators_flags & TWL_COMMON_REGULATOR_VUSB && !pmic_data->vusb) | ||
204 | pmic_data->vusb = &omap4_vusb_idata; | ||
205 | |||
206 | if (regulators_flags & TWL_COMMON_REGULATOR_CLK32KG && | ||
207 | !pmic_data->clk32kg) | ||
208 | pmic_data->clk32kg = &omap4_clk32kg_idata; | ||
209 | } | ||
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h index e9fe2ab4944a..d96c28987638 100644 --- a/arch/arm/mach-omap2/twl-common.h +++ b/arch/arm/mach-omap2/twl-common.h | |||
@@ -1,6 +1,23 @@ | |||
1 | #ifndef __OMAP_PMIC_COMMON__ | 1 | #ifndef __OMAP_PMIC_COMMON__ |
2 | #define __OMAP_PMIC_COMMON__ | 2 | #define __OMAP_PMIC_COMMON__ |
3 | 3 | ||
4 | #define TWL_COMMON_PDATA_USB (1 << 0) | ||
5 | |||
6 | /* Common LDO regulators for TWL4030/TWL6030 */ | ||
7 | #define TWL_COMMON_REGULATOR_VDAC (1 << 0) | ||
8 | #define TWL_COMMON_REGULATOR_VAUX1 (1 << 1) | ||
9 | #define TWL_COMMON_REGULATOR_VAUX2 (1 << 2) | ||
10 | #define TWL_COMMON_REGULATOR_VAUX3 (1 << 3) | ||
11 | |||
12 | /* TWL6030 LDO regulators */ | ||
13 | #define TWL_COMMON_REGULATOR_VMMC (1 << 4) | ||
14 | #define TWL_COMMON_REGULATOR_VPP (1 << 5) | ||
15 | #define TWL_COMMON_REGULATOR_VUSIM (1 << 6) | ||
16 | #define TWL_COMMON_REGULATOR_VANA (1 << 7) | ||
17 | #define TWL_COMMON_REGULATOR_VCXIO (1 << 8) | ||
18 | #define TWL_COMMON_REGULATOR_VUSB (1 << 9) | ||
19 | #define TWL_COMMON_REGULATOR_CLK32KG (1 << 10) | ||
20 | |||
4 | struct twl4030_platform_data; | 21 | struct twl4030_platform_data; |
5 | 22 | ||
6 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, | 23 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, |
@@ -25,4 +42,7 @@ static inline void omap4_pmic_init(const char *pmic_type, | |||
25 | omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data); | 42 | omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data); |
26 | } | 43 | } |
27 | 44 | ||
45 | void omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, | ||
46 | u32 pdata_flags, u32 regulators_flags); | ||
47 | |||
28 | #endif /* __OMAP_PMIC_COMMON__ */ | 48 | #endif /* __OMAP_PMIC_COMMON__ */ |