aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rapoport <mike@compulab.co.il>2011-04-24 18:09:06 -0400
committerTony Lindgren <tony@atomide.com>2011-05-03 05:51:45 -0400
commitfbd8071c188e3053fb318d78214e54d4615d93f2 (patch)
treef95630f09350122e503701e8c4af14fec2b978a6
parent96974a249b0cf3537f49115a59be67e2c54f315c (diff)
omap: use common initialization for PMIC i2c bus
Introduce omap_pmic_init that registers i2c bus and PMIC device on that bus and add omap2/3/4 wrappers for common cases. Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c13
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c12
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c16
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c12
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c12
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c15
-rw-r--r--arch/arm/mach-omap2/board-igep0030.c13
-rw-r--r--arch/arm/mach-omap2/board-ldp.c12
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c13
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c21
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c13
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c12
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c21
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c12
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c17
-rw-r--r--arch/arm/mach-omap2/board-overo.c12
-rw-r--r--arch/arm/mach-omap2/board-rm680.c13
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c13
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c13
-rw-r--r--arch/arm/mach-omap2/common-board-devices.c21
-rw-r--r--arch/arm/mach-omap2/common-board-devices.h24
21 files changed, 78 insertions, 232 deletions
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 1fa6bb896f41..99b3f2de21ff 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -41,6 +41,7 @@
41 41
42#include "mux.h" 42#include "mux.h"
43#include "hsmmc.h" 43#include "hsmmc.h"
44#include "common-board-devices.h"
44 45
45#define SDP2430_CS0_BASE 0x04000000 46#define SDP2430_CS0_BASE 0x04000000
46#define SECONDARY_LCD_GPIO 147 47#define SECONDARY_LCD_GPIO 147
@@ -180,15 +181,6 @@ static struct twl4030_platform_data sdp2430_twldata = {
180 .vmmc1 = &sdp2430_vmmc1, 181 .vmmc1 = &sdp2430_vmmc1,
181}; 182};
182 183
183static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
184 {
185 I2C_BOARD_INFO("twl4030", 0x48),
186 .flags = I2C_CLIENT_WAKE,
187 .irq = INT_24XX_SYS_NIRQ,
188 .platform_data = &sdp2430_twldata,
189 },
190};
191
192static struct i2c_board_info __initdata sdp2430_i2c1_boardinfo[] = { 184static struct i2c_board_info __initdata sdp2430_i2c1_boardinfo[] = {
193 { 185 {
194 I2C_BOARD_INFO("isp1301_omap", 0x2D), 186 I2C_BOARD_INFO("isp1301_omap", 0x2D),
@@ -201,8 +193,7 @@ static int __init omap2430_i2c_init(void)
201{ 193{
202 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo, 194 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo,
203 ARRAY_SIZE(sdp2430_i2c1_boardinfo)); 195 ARRAY_SIZE(sdp2430_i2c1_boardinfo));
204 omap_register_i2c_bus(2, 2600, sdp2430_i2c_boardinfo, 196 omap2_pmic_init("twl4030", &sdp2430_twldata);
205 ARRAY_SIZE(sdp2430_i2c_boardinfo));
206 return 0; 197 return 0;
207} 198}
208 199
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 3726465d34e3..b12400e2c49a 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -528,20 +528,10 @@ static struct twl4030_platform_data sdp3430_twldata = {
528 .vpll2 = &sdp3430_vpll2, 528 .vpll2 = &sdp3430_vpll2,
529}; 529};
530 530
531static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
532 {
533 I2C_BOARD_INFO("twl4030", 0x48),
534 .flags = I2C_CLIENT_WAKE,
535 .irq = INT_34XX_SYS_NIRQ,
536 .platform_data = &sdp3430_twldata,
537 },
538};
539
540static int __init omap3430_i2c_init(void) 531static int __init omap3430_i2c_init(void)
541{ 532{
542 /* i2c1 for PMIC only */ 533 /* i2c1 for PMIC only */
543 omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo, 534 omap3_pmic_init("twl4030", &sdp3430_twldata);
544 ARRAY_SIZE(sdp3430_i2c_boardinfo));
545 /* i2c2 on camera connector (for sensor control) and optional isp1301 */ 535 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
546 omap_register_i2c_bus(2, 400, NULL, 0); 536 omap_register_i2c_bus(2, 400, NULL, 0);
547 /* i2c3 on display connector (for DVI, tfp410) */ 537 /* i2c3 on display connector (for DVI, tfp410) */
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 56702c5e577f..707354222d4c 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -42,6 +42,7 @@
42#include "hsmmc.h" 42#include "hsmmc.h"
43#include "timer-gp.h" 43#include "timer-gp.h"
44#include "control.h" 44#include "control.h"
45#include "common-board-devices.h"
45 46
46#define ETH_KS8851_IRQ 34 47#define ETH_KS8851_IRQ 34
47#define ETH_KS8851_POWER_ON 48 48#define ETH_KS8851_POWER_ON 48
@@ -575,14 +576,6 @@ static struct twl4030_platform_data sdp4430_twldata = {
575 .usb = &omap4_usbphy_data 576 .usb = &omap4_usbphy_data
576}; 577};
577 578
578static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
579 {
580 I2C_BOARD_INFO("twl6030", 0x48),
581 .flags = I2C_CLIENT_WAKE,
582 .irq = OMAP44XX_IRQ_SYS_1N,
583 .platform_data = &sdp4430_twldata,
584 },
585};
586static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { 579static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
587 { 580 {
588 I2C_BOARD_INFO("tmp105", 0x48), 581 I2C_BOARD_INFO("tmp105", 0x48),
@@ -598,12 +591,7 @@ static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
598}; 591};
599static int __init omap4_i2c_init(void) 592static int __init omap4_i2c_init(void)
600{ 593{
601 /* 594 omap4_pmic_init("twl6030", &sdp4430_twldata);
602 * Phoenix Audio IC needs I2C1 to
603 * start with 400 KHz or less
604 */
605 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
606 ARRAY_SIZE(sdp4430_i2c_boardinfo));
607 omap_register_i2c_bus(2, 400, NULL, 0); 595 omap_register_i2c_bus(2, 400, NULL, 0);
608 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, 596 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
609 ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); 597 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 4af5cf9ef43a..948161d3998e 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -541,19 +541,9 @@ static struct twl4030_platform_data cm_t35_twldata = {
541 .vpll2 = &cm_t35_vpll2, 541 .vpll2 = &cm_t35_vpll2,
542}; 542};
543 543
544static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = {
545 {
546 I2C_BOARD_INFO("tps65930", 0x48),
547 .flags = I2C_CLIENT_WAKE,
548 .irq = INT_34XX_SYS_NIRQ,
549 .platform_data = &cm_t35_twldata,
550 },
551};
552
553static void __init cm_t35_init_i2c(void) 544static void __init cm_t35_init_i2c(void)
554{ 545{
555 omap_register_i2c_bus(1, 2600, cm_t35_i2c_boardinfo, 546 omap3_pmic_init("tps65930", &cm_t35_twldata);
556 ARRAY_SIZE(cm_t35_i2c_boardinfo));
557} 547}
558 548
559static void __init cm_t35_init_early(void) 549static void __init cm_t35_init_early(void)
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 9f8338d15a21..983f44b78777 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -366,19 +366,9 @@ static struct twl4030_platform_data devkit8000_twldata = {
366 .keypad = &devkit8000_kp_data, 366 .keypad = &devkit8000_kp_data,
367}; 367};
368 368
369static struct i2c_board_info __initdata devkit8000_i2c_boardinfo[] = {
370 {
371 I2C_BOARD_INFO("tps65930", 0x48),
372 .flags = I2C_CLIENT_WAKE,
373 .irq = INT_34XX_SYS_NIRQ,
374 .platform_data = &devkit8000_twldata,
375 },
376};
377
378static int __init devkit8000_i2c_init(void) 369static int __init devkit8000_i2c_init(void)
379{ 370{
380 omap_register_i2c_bus(1, 2600, devkit8000_i2c_boardinfo, 371 omap3_pmic_init("tps65930", &devkit8000_twldata);
381 ARRAY_SIZE(devkit8000_i2c_boardinfo));
382 /* Bus 3 is attached to the DVI port where devices like the pico DLP 372 /* Bus 3 is attached to the DVI port where devices like the pico DLP
383 * projector don't work reliably with 400kHz */ 373 * projector don't work reliably with 400kHz */
384 omap_register_i2c_bus(3, 400, NULL, 0); 374 omap_register_i2c_bus(3, 400, NULL, 0);
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 5b9bde74b6bf..a0fd10e42b35 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -38,6 +38,7 @@
38#include "mux.h" 38#include "mux.h"
39#include "hsmmc.h" 39#include "hsmmc.h"
40#include "sdram-numonyx-m65kxxxxam.h" 40#include "sdram-numonyx-m65kxxxxam.h"
41#include "common-board-devices.h"
41 42
42#define IGEP2_SMSC911X_CS 5 43#define IGEP2_SMSC911X_CS 5
43#define IGEP2_SMSC911X_GPIO 176 44#define IGEP2_SMSC911X_GPIO 176
@@ -536,15 +537,6 @@ static struct twl4030_platform_data igep2_twldata = {
536 .vio = &igep2_vio, 537 .vio = &igep2_vio,
537}; 538};
538 539
539static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = {
540 {
541 I2C_BOARD_INFO("twl4030", 0x48),
542 .flags = I2C_CLIENT_WAKE,
543 .irq = INT_34XX_SYS_NIRQ,
544 .platform_data = &igep2_twldata,
545 },
546};
547
548static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = { 540static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
549 { 541 {
550 I2C_BOARD_INFO("eeprom", 0x50), 542 I2C_BOARD_INFO("eeprom", 0x50),
@@ -555,10 +547,7 @@ static void __init igep2_i2c_init(void)
555{ 547{
556 int ret; 548 int ret;
557 549
558 ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo, 550 omap3_pmic_init("twl4030", &igep2_twldata);
559 ARRAY_SIZE(igep2_i2c1_boardinfo));
560 if (ret)
561 pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret);
562 551
563 /* 552 /*
564 * Bus 3 is attached to the DVI port where devices like the pico DLP 553 * Bus 3 is attached to the DVI port where devices like the pico DLP
diff --git a/arch/arm/mach-omap2/board-igep0030.c b/arch/arm/mach-omap2/board-igep0030.c
index 2cf86c3cb1a3..a831e8549455 100644
--- a/arch/arm/mach-omap2/board-igep0030.c
+++ b/arch/arm/mach-omap2/board-igep0030.c
@@ -35,6 +35,7 @@
35#include "mux.h" 35#include "mux.h"
36#include "hsmmc.h" 36#include "hsmmc.h"
37#include "sdram-numonyx-m65kxxxxam.h" 37#include "sdram-numonyx-m65kxxxxam.h"
38#include "common-board-devices.h"
38 39
39#define IGEP3_GPIO_LED0_GREEN 54 40#define IGEP3_GPIO_LED0_GREEN 54
40#define IGEP3_GPIO_LED0_RED 53 41#define IGEP3_GPIO_LED0_RED 53
@@ -349,19 +350,9 @@ static struct twl4030_platform_data igep3_twl4030_pdata = {
349 .vio = &igep3_vio, 350 .vio = &igep3_vio,
350}; 351};
351 352
352static struct i2c_board_info __initdata igep3_i2c_boardinfo[] = {
353 {
354 I2C_BOARD_INFO("twl4030", 0x48),
355 .flags = I2C_CLIENT_WAKE,
356 .irq = INT_34XX_SYS_NIRQ,
357 .platform_data = &igep3_twl4030_pdata,
358 },
359};
360
361static int __init igep3_i2c_init(void) 353static int __init igep3_i2c_init(void)
362{ 354{
363 omap_register_i2c_bus(1, 2600, igep3_i2c_boardinfo, 355 omap3_pmic_init("twl4030", &igep3_twl4030_pdata);
364 ARRAY_SIZE(igep3_i2c_boardinfo));
365 356
366 return 0; 357 return 0;
367} 358}
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 155b423784c5..7482c7531ede 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -265,19 +265,9 @@ static struct twl4030_platform_data ldp_twldata = {
265 .keypad = &ldp_kp_twl4030_data, 265 .keypad = &ldp_kp_twl4030_data,
266}; 266};
267 267
268static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
269 {
270 I2C_BOARD_INFO("twl4030", 0x48),
271 .flags = I2C_CLIENT_WAKE,
272 .irq = INT_34XX_SYS_NIRQ,
273 .platform_data = &ldp_twldata,
274 },
275};
276
277static int __init omap_i2c_init(void) 268static int __init omap_i2c_init(void)
278{ 269{
279 omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo, 270 omap3_pmic_init("twl4030", &ldp_twldata);
280 ARRAY_SIZE(ldp_i2c_boardinfo));
281 omap_register_i2c_bus(2, 400, NULL, 0); 271 omap_register_i2c_bus(2, 400, NULL, 0);
282 omap_register_i2c_bus(3, 400, NULL, 0); 272 omap_register_i2c_bus(3, 400, NULL, 0);
283 return 0; 273 return 0;
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 33007fd4a083..13a16649d42c 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -52,6 +52,7 @@
52#include "hsmmc.h" 52#include "hsmmc.h"
53#include "timer-gp.h" 53#include "timer-gp.h"
54#include "pm.h" 54#include "pm.h"
55#include "common-board-devices.h"
55 56
56#define NAND_BLOCK_SIZE SZ_128K 57#define NAND_BLOCK_SIZE SZ_128K
57 58
@@ -453,15 +454,6 @@ static struct twl4030_platform_data beagle_twldata = {
453 .vpll2 = &beagle_vpll2, 454 .vpll2 = &beagle_vpll2,
454}; 455};
455 456
456static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
457 {
458 I2C_BOARD_INFO("twl4030", 0x48),
459 .flags = I2C_CLIENT_WAKE,
460 .irq = INT_34XX_SYS_NIRQ,
461 .platform_data = &beagle_twldata,
462 },
463};
464
465static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { 457static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
466 { 458 {
467 I2C_BOARD_INFO("eeprom", 0x50), 459 I2C_BOARD_INFO("eeprom", 0x50),
@@ -470,8 +462,7 @@ static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
470 462
471static int __init omap3_beagle_i2c_init(void) 463static int __init omap3_beagle_i2c_init(void)
472{ 464{
473 omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo, 465 omap3_pmic_init("twl4030", &beagle_twldata);
474 ARRAY_SIZE(beagle_i2c_boardinfo));
475 /* Bus 3 is attached to the DVI port where devices like the pico DLP 466 /* Bus 3 is attached to the DVI port where devices like the pico DLP
476 * projector don't work reliably with 400kHz */ 467 * projector don't work reliably with 400kHz */
477 omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom)); 468 omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom));
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 376ea87dce68..5066b0bbf63d 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -604,28 +604,13 @@ static struct twl4030_platform_data omap3evm_twldata = {
604 .vdac = &omap3_evm_vdac, 604 .vdac = &omap3_evm_vdac,
605 .vpll2 = &omap3_evm_vpll2, 605 .vpll2 = &omap3_evm_vpll2,
606 .vio = &omap3evm_vio, 606 .vio = &omap3evm_vio,
607}; 607 .vmmc1 = &omap3evm_vmmc1,
608 608 .vsim = &omap3evm_vsim,
609static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
610 {
611 I2C_BOARD_INFO("twl4030", 0x48),
612 .flags = I2C_CLIENT_WAKE,
613 .irq = INT_34XX_SYS_NIRQ,
614 .platform_data = &omap3evm_twldata,
615 },
616}; 609};
617 610
618static int __init omap3_evm_i2c_init(void) 611static int __init omap3_evm_i2c_init(void)
619{ 612{
620 /* 613 omap3_pmic_init("twl4030", &omap3evm_twldata);
621 * REVISIT: These entries can be set in omap3evm_twl_data
622 * after a merge with MFD tree
623 */
624 omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
625 omap3evm_twldata.vsim = &omap3evm_vsim;
626
627 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
628 ARRAY_SIZE(omap3evm_i2c_boardinfo));
629 omap_register_i2c_bus(2, 400, NULL, 0); 614 omap_register_i2c_bus(2, 400, NULL, 0);
630 omap_register_i2c_bus(3, 400, NULL, 0); 615 omap_register_i2c_bus(3, 400, NULL, 0);
631 return 0; 616 return 0;
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index a49e6cff55ab..60d9be49dbab 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -37,6 +37,7 @@
37#include "hsmmc.h" 37#include "hsmmc.h"
38#include "timer-gp.h" 38#include "timer-gp.h"
39#include "control.h" 39#include "control.h"
40#include "common-board-devices.h"
40 41
41#include <plat/mux.h> 42#include <plat/mux.h>
42#include <plat/board.h> 43#include <plat/board.h>
@@ -93,19 +94,9 @@ static struct twl4030_platform_data omap3logic_twldata = {
93 .vmmc1 = &omap3logic_vmmc1, 94 .vmmc1 = &omap3logic_vmmc1,
94}; 95};
95 96
96static struct i2c_board_info __initdata omap3logic_i2c_boardinfo[] = {
97 {
98 I2C_BOARD_INFO("twl4030", 0x48),
99 .flags = I2C_CLIENT_WAKE,
100 .irq = INT_34XX_SYS_NIRQ,
101 .platform_data = &omap3logic_twldata,
102 },
103};
104
105static int __init omap3logic_i2c_init(void) 97static int __init omap3logic_i2c_init(void)
106{ 98{
107 omap_register_i2c_bus(1, 2600, omap3logic_i2c_boardinfo, 99 omap3_pmic_init("twl4030", &omap3logic_twldata);
108 ARRAY_SIZE(omap3logic_i2c_boardinfo));
109 return 0; 100 return 0;
110} 101}
111 102
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 517701aae3ca..b99cc642c5e2 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -544,15 +544,6 @@ static struct twl4030_platform_data omap3pandora_twldata = {
544 .bci = &pandora_bci_data, 544 .bci = &pandora_bci_data,
545}; 545};
546 546
547static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = {
548 {
549 I2C_BOARD_INFO("tps65950", 0x48),
550 .flags = I2C_CLIENT_WAKE,
551 .irq = INT_34XX_SYS_NIRQ,
552 .platform_data = &omap3pandora_twldata,
553 },
554};
555
556static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = { 547static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
557 { 548 {
558 I2C_BOARD_INFO("bq27500", 0x55), 549 I2C_BOARD_INFO("bq27500", 0x55),
@@ -562,8 +553,7 @@ static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
562 553
563static int __init omap3pandora_i2c_init(void) 554static int __init omap3pandora_i2c_init(void)
564{ 555{
565 omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo, 556 omap3_pmic_init("tps65950", &omap3pandora_twldata);
566 ARRAY_SIZE(omap3pandora_i2c_boardinfo));
567 /* i2c2 pins are not connected */ 557 /* i2c2 pins are not connected */
568 omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo, 558 omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo,
569 ARRAY_SIZE(omap3pandora_i2c3_boardinfo)); 559 ARRAY_SIZE(omap3pandora_i2c3_boardinfo));
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 671ceb0c7a6f..a1d550f8ba91 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -455,15 +455,8 @@ static struct twl4030_platform_data omap3stalker_twldata = {
455 .codec = &omap3stalker_codec_data, 455 .codec = &omap3stalker_codec_data,
456 .vdac = &omap3_stalker_vdac, 456 .vdac = &omap3_stalker_vdac,
457 .vpll2 = &omap3_stalker_vpll2, 457 .vpll2 = &omap3_stalker_vpll2,
458}; 458 .vmmc1 = &omap3stalker_vmmc1,
459 459 .vsim = &omap3stalker_vsim,
460static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo[] = {
461 {
462 I2C_BOARD_INFO("twl4030", 0x48),
463 .flags = I2C_CLIENT_WAKE,
464 .irq = INT_34XX_SYS_NIRQ,
465 .platform_data = &omap3stalker_twldata,
466 },
467}; 460};
468 461
469static struct at24_platform_data fram_info = { 462static struct at24_platform_data fram_info = {
@@ -482,15 +475,7 @@ static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo3[] = {
482 475
483static int __init omap3_stalker_i2c_init(void) 476static int __init omap3_stalker_i2c_init(void)
484{ 477{
485 /* 478 omap3_pmic_init("twl4030", &omap3stalker_twldata);
486 * REVISIT: These entries can be set in omap3evm_twl_data
487 * after a merge with MFD tree
488 */
489 omap3stalker_twldata.vmmc1 = &omap3stalker_vmmc1;
490 omap3stalker_twldata.vsim = &omap3stalker_vsim;
491
492 omap_register_i2c_bus(1, 2600, omap3stalker_i2c_boardinfo,
493 ARRAY_SIZE(omap3stalker_i2c_boardinfo));
494 omap_register_i2c_bus(2, 400, NULL, 0); 479 omap_register_i2c_bus(2, 400, NULL, 0);
495 omap_register_i2c_bus(3, 400, omap3stalker_i2c_boardinfo3, 480 omap_register_i2c_bus(3, 400, omap3stalker_i2c_boardinfo3,
496 ARRAY_SIZE(omap3stalker_i2c_boardinfo3)); 481 ARRAY_SIZE(omap3stalker_i2c_boardinfo3));
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 15f9d7ddc230..0a9b3299427a 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -274,15 +274,6 @@ static struct twl4030_platform_data touchbook_twldata = {
274 .vpll2 = &touchbook_vpll2, 274 .vpll2 = &touchbook_vpll2,
275}; 275};
276 276
277static struct i2c_board_info __initdata touchbook_i2c_boardinfo[] = {
278 {
279 I2C_BOARD_INFO("twl4030", 0x48),
280 .flags = I2C_CLIENT_WAKE,
281 .irq = INT_34XX_SYS_NIRQ,
282 .platform_data = &touchbook_twldata,
283 },
284};
285
286static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = { 277static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = {
287 { 278 {
288 I2C_BOARD_INFO("bq27200", 0x55), 279 I2C_BOARD_INFO("bq27200", 0x55),
@@ -292,8 +283,7 @@ static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = {
292static int __init omap3_touchbook_i2c_init(void) 283static int __init omap3_touchbook_i2c_init(void)
293{ 284{
294 /* Standard TouchBook bus */ 285 /* Standard TouchBook bus */
295 omap_register_i2c_bus(1, 2600, touchbook_i2c_boardinfo, 286 omap3_pmic_init("twl4030", &touchbook_twldata);
296 ARRAY_SIZE(touchbook_i2c_boardinfo));
297 287
298 /* Additional TouchBook bus */ 288 /* Additional TouchBook bus */
299 omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo, 289 omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo,
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index f3a7b1011914..7eaad629c4c2 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -46,6 +46,7 @@
46#include "hsmmc.h" 46#include "hsmmc.h"
47#include "control.h" 47#include "control.h"
48#include "mux.h" 48#include "mux.h"
49#include "common-board-devices.h"
49 50
50#define GPIO_HUB_POWER 1 51#define GPIO_HUB_POWER 1
51#define GPIO_HUB_NRESET 62 52#define GPIO_HUB_NRESET 62
@@ -408,15 +409,6 @@ static struct twl4030_platform_data omap4_panda_twldata = {
408 .usb = &omap4_usbphy_data, 409 .usb = &omap4_usbphy_data,
409}; 410};
410 411
411static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
412 {
413 I2C_BOARD_INFO("twl6030", 0x48),
414 .flags = I2C_CLIENT_WAKE,
415 .irq = OMAP44XX_IRQ_SYS_1N,
416 .platform_data = &omap4_panda_twldata,
417 },
418};
419
420/* 412/*
421 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM 413 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
422 * is connected as I2C slave device, and can be accessed at address 0x50 414 * is connected as I2C slave device, and can be accessed at address 0x50
@@ -429,12 +421,7 @@ static struct i2c_board_info __initdata panda_i2c_eeprom[] = {
429 421
430static int __init omap4_panda_i2c_init(void) 422static int __init omap4_panda_i2c_init(void)
431{ 423{
432 /* 424 omap4_pmic_init("twl6030", &omap4_panda_twldata);
433 * Phoenix Audio IC needs I2C1 to
434 * start with 400 KHz or less
435 */
436 omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
437 ARRAY_SIZE(omap4_panda_i2c_boardinfo));
438 omap_register_i2c_bus(2, 400, NULL, 0); 425 omap_register_i2c_bus(2, 400, NULL, 0);
439 /* 426 /*
440 * Bus 3 is attached to the DVI port where devices like the pico DLP 427 * Bus 3 is attached to the DVI port where devices like the pico DLP
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 4a02f8434f59..809d3944f549 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -540,19 +540,9 @@ static struct twl4030_platform_data overo_twldata = {
540 .vpll2 = &overo_vpll2, 540 .vpll2 = &overo_vpll2,
541}; 541};
542 542
543static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
544 {
545 I2C_BOARD_INFO("tps65950", 0x48),
546 .flags = I2C_CLIENT_WAKE,
547 .irq = INT_34XX_SYS_NIRQ,
548 .platform_data = &overo_twldata,
549 },
550};
551
552static int __init overo_i2c_init(void) 543static int __init overo_i2c_init(void)
553{ 544{
554 omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo, 545 omap3_pmic_init("tps65950", &overo_twldata);
555 ARRAY_SIZE(overo_i2c_boardinfo));
556 /* i2c2 pins are used for gpio */ 546 /* i2c2 pins are used for gpio */
557 omap_register_i2c_bus(3, 400, NULL, 0); 547 omap_register_i2c_bus(3, 400, NULL, 0);
558 return 0; 548 return 0;
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 2af8b05e786d..8e710ffaec66 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -31,6 +31,7 @@
31#include "mux.h" 31#include "mux.h"
32#include "hsmmc.h" 32#include "hsmmc.h"
33#include "sdram-nokia.h" 33#include "sdram-nokia.h"
34#include "common-board-devices.h"
34 35
35static struct regulator_consumer_supply rm680_vemmc_consumers[] = { 36static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
36 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), 37 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
@@ -90,19 +91,9 @@ static struct twl4030_platform_data rm680_twl_data = {
90 /* add rest of the children here */ 91 /* add rest of the children here */
91}; 92};
92 93
93static struct i2c_board_info __initdata rm680_twl_i2c_board_info[] = {
94 {
95 I2C_BOARD_INFO("twl5031", 0x48),
96 .flags = I2C_CLIENT_WAKE,
97 .irq = INT_34XX_SYS_NIRQ,
98 .platform_data = &rm680_twl_data,
99 },
100};
101
102static void __init rm680_i2c_init(void) 94static void __init rm680_i2c_init(void)
103{ 95{
104 omap_register_i2c_bus(1, 2900, rm680_twl_i2c_board_info, 96 omap_pmic_init(1, 2900, "twl5031", INT_34XX_SYS_NIRQ, &rm680_twl_data);
105 ARRAY_SIZE(rm680_twl_i2c_board_info));
106 omap_register_i2c_bus(2, 400, NULL, 0); 97 omap_register_i2c_bus(2, 400, NULL, 0);
107 omap_register_i2c_bus(3, 400, NULL, 0); 98 omap_register_i2c_bus(3, 400, NULL, 0);
108} 99}
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index bbcb6775a6a3..a5bf5e92eae8 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -43,6 +43,7 @@
43 43
44#include "mux.h" 44#include "mux.h"
45#include "hsmmc.h" 45#include "hsmmc.h"
46#include "common-board-devices.h"
46 47
47#define SYSTEM_REV_B_USES_VAUX3 0x1699 48#define SYSTEM_REV_B_USES_VAUX3 0x1699
48#define SYSTEM_REV_S_USES_VAUX3 0x8 49#define SYSTEM_REV_S_USES_VAUX3 0x8
@@ -777,15 +778,6 @@ static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata_or_module =
777 .power_gpio = 98, 778 .power_gpio = 98,
778}; 779};
779 780
780static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = {
781 {
782 I2C_BOARD_INFO("twl5030", 0x48),
783 .flags = I2C_CLIENT_WAKE,
784 .irq = INT_34XX_SYS_NIRQ,
785 .platform_data = &rx51_twldata,
786 },
787};
788
789/* Audio setup data */ 781/* Audio setup data */
790static struct aic3x_setup_data rx51_aic34_setup = { 782static struct aic3x_setup_data rx51_aic34_setup = {
791 .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED, 783 .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED,
@@ -833,8 +825,7 @@ static int __init rx51_i2c_init(void)
833 rx51_twldata.vaux3 = &rx51_vaux3_cam; 825 rx51_twldata.vaux3 = &rx51_vaux3_cam;
834 } 826 }
835 rx51_twldata.vmmc2 = &rx51_vmmc2; 827 rx51_twldata.vmmc2 = &rx51_vmmc2;
836 omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1, 828 omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
837 ARRAY_SIZE(rx51_peripherals_i2c_board_info_1));
838 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2, 829 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
839 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); 830 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
840 omap_register_i2c_bus(3, 400, NULL, 0); 831 omap_register_i2c_bus(3, 400, NULL, 0);
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 8dee7549fbdf..e4870c20f193 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -31,6 +31,7 @@
31 31
32#include "mux.h" 32#include "mux.h"
33#include "hsmmc.h" 33#include "hsmmc.h"
34#include "common-board-devices.h"
34 35
35#define OMAP_ZOOM_WLAN_PMENA_GPIO (101) 36#define OMAP_ZOOM_WLAN_PMENA_GPIO (101)
36#define OMAP_ZOOM_WLAN_IRQ_GPIO (162) 37#define OMAP_ZOOM_WLAN_IRQ_GPIO (162)
@@ -349,15 +350,6 @@ static struct twl4030_platform_data zoom_twldata = {
349 .vdac = &zoom_vdac, 350 .vdac = &zoom_vdac,
350}; 351};
351 352
352static struct i2c_board_info __initdata zoom_i2c_boardinfo[] = {
353 {
354 I2C_BOARD_INFO("twl5030", 0x48),
355 .flags = I2C_CLIENT_WAKE,
356 .irq = INT_34XX_SYS_NIRQ,
357 .platform_data = &zoom_twldata,
358 },
359};
360
361static int __init omap_i2c_init(void) 353static int __init omap_i2c_init(void)
362{ 354{
363 if (machine_is_omap_zoom2()) { 355 if (machine_is_omap_zoom2()) {
@@ -365,8 +357,7 @@ static int __init omap_i2c_init(void)
365 zoom_audio_data.hs_extmute = 1; 357 zoom_audio_data.hs_extmute = 1;
366 zoom_audio_data.set_hs_extmute = zoom2_set_hs_extmute; 358 zoom_audio_data.set_hs_extmute = zoom2_set_hs_extmute;
367 } 359 }
368 omap_register_i2c_bus(1, 2400, zoom_i2c_boardinfo, 360 omap_pmic_init(1, 2400, "twl5030", INT_34XX_SYS_NIRQ, &zoom_twldata);
369 ARRAY_SIZE(zoom_i2c_boardinfo));
370 omap_register_i2c_bus(2, 400, NULL, 0); 361 omap_register_i2c_bus(2, 400, NULL, 0);
371 omap_register_i2c_bus(3, 400, NULL, 0); 362 omap_register_i2c_bus(3, 400, NULL, 0);
372 return 0; 363 return 0;
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index fad41ec62300..cea31dda3a73 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -20,14 +20,35 @@
20 * 20 *
21 */ 21 */
22 22
23#include <linux/i2c.h>
24#include <linux/i2c/twl.h>
25
23#include <linux/gpio.h> 26#include <linux/gpio.h>
24#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
25#include <linux/spi/ads7846.h> 28#include <linux/spi/ads7846.h>
26 29
30#include <plat/i2c.h>
27#include <plat/mcspi.h> 31#include <plat/mcspi.h>
28 32
29#include "common-board-devices.h" 33#include "common-board-devices.h"
30 34
35static struct i2c_board_info __initdata pmic_i2c_board_info = {
36 .addr = 0x48,
37 .flags = I2C_CLIENT_WAKE,
38};
39
40void __init omap_pmic_init(int bus, u32 clkrate,
41 const char *pmic_type, int pmic_irq,
42 struct twl4030_platform_data *pmic_data)
43{
44 strncpy(pmic_i2c_board_info.type, pmic_type,
45 sizeof(pmic_i2c_board_info.type));
46 pmic_i2c_board_info.irq = pmic_irq;
47 pmic_i2c_board_info.platform_data = pmic_data;
48
49 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
50}
51
31static struct omap2_mcspi_device_config ads7846_mcspi_config = { 52static struct omap2_mcspi_device_config ads7846_mcspi_config = {
32 .turbo_mode = 0, 53 .turbo_mode = 0,
33 .single_channel = 1, /* 0: slave, 1: master */ 54 .single_channel = 1, /* 0: slave, 1: master */
diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
index 75f9248d0bf2..0ec3e07239fc 100644
--- a/arch/arm/mach-omap2/common-board-devices.h
+++ b/arch/arm/mach-omap2/common-board-devices.h
@@ -1,6 +1,30 @@
1#ifndef __OMAP_COMMON_BOARD_DEVICES__ 1#ifndef __OMAP_COMMON_BOARD_DEVICES__
2#define __OMAP_COMMON_BOARD_DEVICES__ 2#define __OMAP_COMMON_BOARD_DEVICES__
3 3
4struct twl4030_platform_data;
5
6void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
7 struct twl4030_platform_data *pmic_data);
8
9static inline void omap2_pmic_init(const char *pmic_type,
10 struct twl4030_platform_data *pmic_data)
11{
12 omap_pmic_init(2, 2600, pmic_type, INT_24XX_SYS_NIRQ, pmic_data);
13}
14
15static inline void omap3_pmic_init(const char *pmic_type,
16 struct twl4030_platform_data *pmic_data)
17{
18 omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data);
19}
20
21static inline void omap4_pmic_init(const char *pmic_type,
22 struct twl4030_platform_data *pmic_data)
23{
24 /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */
25 omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data);
26}
27
4#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 28#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
5 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 29 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
6struct ads7846_platform_data; 30struct ads7846_platform_data;