diff options
author | David Brownell <david-b@pacbell.net> | 2007-10-13 17:56:30 -0400 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2007-10-13 17:56:30 -0400 |
commit | 8056c6cb2bb1632aa9221dce0e43a61db37b420f (patch) | |
tree | 4ca321bba9db87c80c77f841c9a52c456be63aa5 /arch/arm | |
parent | b5067f8ff37ed6cfa024170a9819bb09d55e9c1f (diff) |
i2c/tps65010: New-style driver updates, part 2
Switch the tps65010 driver into a "new-style" I2C driver, and convert all
of its in-tree users (board support for OSK, H2, H3) accordingly.
That accounts for most of the board-specific code in this driver; the
rest of that code is now moved into board-specific initcalls.
Also remove some of the many now-superfluous #includes.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap1/board-h2.c | 45 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-h3.c | 39 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-osk.c | 64 |
3 files changed, 143 insertions, 5 deletions
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index 48c8c9195dc3..2f8f6ecf111f 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c | |||
@@ -20,22 +20,23 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/init.h> | ||
24 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
25 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/i2c.h> | ||
26 | #include <linux/mtd/mtd.h> | 26 | #include <linux/mtd/mtd.h> |
27 | #include <linux/mtd/nand.h> | 27 | #include <linux/mtd/nand.h> |
28 | #include <linux/mtd/partitions.h> | 28 | #include <linux/mtd/partitions.h> |
29 | #include <linux/input.h> | 29 | #include <linux/input.h> |
30 | #include <linux/workqueue.h> | ||
31 | 30 | ||
32 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
32 | #include <asm/gpio.h> | ||
33 | |||
33 | #include <asm/mach-types.h> | 34 | #include <asm/mach-types.h> |
34 | #include <asm/mach/arch.h> | 35 | #include <asm/mach/arch.h> |
35 | #include <asm/mach/flash.h> | 36 | #include <asm/mach/flash.h> |
36 | #include <asm/mach/map.h> | 37 | #include <asm/mach/map.h> |
37 | 38 | ||
38 | #include <asm/arch/gpio.h> | 39 | #include <asm/arch/tps65010.h> |
39 | #include <asm/arch/mux.h> | 40 | #include <asm/arch/mux.h> |
40 | #include <asm/arch/tc.h> | 41 | #include <asm/arch/tc.h> |
41 | #include <asm/arch/irda.h> | 42 | #include <asm/arch/irda.h> |
@@ -277,6 +278,20 @@ static struct platform_device *h2_devices[] __initdata = { | |||
277 | &h2_mcbsp1_device, | 278 | &h2_mcbsp1_device, |
278 | }; | 279 | }; |
279 | 280 | ||
281 | static struct i2c_board_info __initdata h2_i2c_board_info[] = { | ||
282 | { | ||
283 | I2C_BOARD_INFO("tps65010", 0x48), | ||
284 | .type = "tps65010", | ||
285 | .irq = OMAP_GPIO_IRQ(58), | ||
286 | }, | ||
287 | /* TODO when driver support is ready: | ||
288 | * - isp1301 OTG transceiver | ||
289 | * - optional ov9640 camera sensor at 0x30 | ||
290 | * - pcf9754 for aGPS control | ||
291 | * - ... etc | ||
292 | */ | ||
293 | }; | ||
294 | |||
280 | static void __init h2_init_smc91x(void) | 295 | static void __init h2_init_smc91x(void) |
281 | { | 296 | { |
282 | if ((omap_request_gpio(0)) < 0) { | 297 | if ((omap_request_gpio(0)) < 0) { |
@@ -367,6 +382,14 @@ static void __init h2_init(void) | |||
367 | omap_board_config = h2_config; | 382 | omap_board_config = h2_config; |
368 | omap_board_config_size = ARRAY_SIZE(h2_config); | 383 | omap_board_config_size = ARRAY_SIZE(h2_config); |
369 | omap_serial_init(); | 384 | omap_serial_init(); |
385 | |||
386 | /* irq for tps65010 chip */ | ||
387 | omap_cfg_reg(W4_GPIO58); | ||
388 | if (gpio_request(58, "tps65010") == 0) | ||
389 | gpio_direction_input(58); | ||
390 | |||
391 | i2c_register_board_info(1, h2_i2c_board_info, | ||
392 | ARRAY_SIZE(h2_i2c_board_info)); | ||
370 | } | 393 | } |
371 | 394 | ||
372 | static void __init h2_map_io(void) | 395 | static void __init h2_map_io(void) |
@@ -374,6 +397,22 @@ static void __init h2_map_io(void) | |||
374 | omap1_map_common_io(); | 397 | omap1_map_common_io(); |
375 | } | 398 | } |
376 | 399 | ||
400 | #ifdef CONFIG_TPS65010 | ||
401 | static int __init h2_tps_init(void) | ||
402 | { | ||
403 | if (!machine_is_omap_h2()) | ||
404 | return 0; | ||
405 | |||
406 | /* gpio3 for SD, gpio4 for VDD_DSP */ | ||
407 | /* FIXME send power to DSP iff it's configured */ | ||
408 | |||
409 | /* Enable LOW_PWR */ | ||
410 | tps65010_set_low_pwr(ON); | ||
411 | return 0; | ||
412 | } | ||
413 | fs_initcall(h2_tps_init); | ||
414 | #endif | ||
415 | |||
377 | MACHINE_START(OMAP_H2, "TI-H2") | 416 | MACHINE_START(OMAP_H2, "TI-H2") |
378 | /* Maintainer: Imre Deak <imre.deak@nokia.com> */ | 417 | /* Maintainer: Imre Deak <imre.deak@nokia.com> */ |
379 | .phys_io = 0xfff00000, | 418 | .phys_io = 0xfff00000, |
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c index 79d4ef4c54d4..add2f703204f 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
23 | #include <linux/workqueue.h> | 23 | #include <linux/workqueue.h> |
24 | #include <linux/i2c.h> | ||
24 | #include <linux/mtd/mtd.h> | 25 | #include <linux/mtd/mtd.h> |
25 | #include <linux/mtd/nand.h> | 26 | #include <linux/mtd/nand.h> |
26 | #include <linux/mtd/partitions.h> | 27 | #include <linux/mtd/partitions.h> |
@@ -29,12 +30,14 @@ | |||
29 | #include <asm/setup.h> | 30 | #include <asm/setup.h> |
30 | #include <asm/page.h> | 31 | #include <asm/page.h> |
31 | #include <asm/hardware.h> | 32 | #include <asm/hardware.h> |
33 | #include <asm/gpio.h> | ||
34 | |||
32 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
33 | #include <asm/mach/arch.h> | 36 | #include <asm/mach/arch.h> |
34 | #include <asm/mach/flash.h> | 37 | #include <asm/mach/flash.h> |
35 | #include <asm/mach/map.h> | 38 | #include <asm/mach/map.h> |
36 | 39 | ||
37 | #include <asm/arch/gpio.h> | 40 | #include <asm/arch/tps65010.h> |
38 | #include <asm/arch/gpioexpander.h> | 41 | #include <asm/arch/gpioexpander.h> |
39 | #include <asm/arch/irqs.h> | 42 | #include <asm/arch/irqs.h> |
40 | #include <asm/arch/mux.h> | 43 | #include <asm/arch/mux.h> |
@@ -413,6 +416,19 @@ static struct omap_board_config_kernel h3_config[] = { | |||
413 | { OMAP_TAG_LCD, &h3_lcd_config }, | 416 | { OMAP_TAG_LCD, &h3_lcd_config }, |
414 | }; | 417 | }; |
415 | 418 | ||
419 | static struct i2c_board_info __initdata h3_i2c_board_info[] = { | ||
420 | { | ||
421 | I2C_BOARD_INFO("tps65010", 0x48), | ||
422 | .type = "tps65013", | ||
423 | /* .irq = OMAP_GPIO_IRQ(??), */ | ||
424 | }, | ||
425 | /* TODO when driver support is ready: | ||
426 | * - isp1301 OTG transceiver | ||
427 | * - optional ov9640 camera sensor at 0x30 | ||
428 | * - ... | ||
429 | */ | ||
430 | }; | ||
431 | |||
416 | #define H3_NAND_RB_GPIO_PIN 10 | 432 | #define H3_NAND_RB_GPIO_PIN 10 |
417 | 433 | ||
418 | static int nand_dev_ready(struct nand_platform_data *data) | 434 | static int nand_dev_ready(struct nand_platform_data *data) |
@@ -446,6 +462,10 @@ static void __init h3_init(void) | |||
446 | omap_board_config = h3_config; | 462 | omap_board_config = h3_config; |
447 | omap_board_config_size = ARRAY_SIZE(h3_config); | 463 | omap_board_config_size = ARRAY_SIZE(h3_config); |
448 | omap_serial_init(); | 464 | omap_serial_init(); |
465 | |||
466 | /* FIXME setup irq for tps65013 chip */ | ||
467 | i2c_register_board_info(1, h3_i2c_board_info, | ||
468 | ARRAY_SIZE(h3_i2c_board_info)); | ||
449 | } | 469 | } |
450 | 470 | ||
451 | static void __init h3_init_smc91x(void) | 471 | static void __init h3_init_smc91x(void) |
@@ -470,6 +490,23 @@ static void __init h3_map_io(void) | |||
470 | omap1_map_common_io(); | 490 | omap1_map_common_io(); |
471 | } | 491 | } |
472 | 492 | ||
493 | #ifdef CONFIG_TPS65010 | ||
494 | static int __init h3_tps_init(void) | ||
495 | { | ||
496 | if (!machine_is_omap_h3()) | ||
497 | return 0; | ||
498 | |||
499 | /* gpio4 for SD, gpio3 for VDD_DSP */ | ||
500 | /* FIXME send power to DSP iff it's configured */ | ||
501 | |||
502 | /* Enable LOW_PWR */ | ||
503 | tps65013_set_low_pwr(ON); | ||
504 | |||
505 | return 0; | ||
506 | } | ||
507 | fs_initcall(h3_tps_init); | ||
508 | #endif | ||
509 | |||
473 | MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") | 510 | MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") |
474 | /* Maintainer: Texas Instruments, Inc. */ | 511 | /* Maintainer: Texas Instruments, Inc. */ |
475 | .phys_io = 0xfff00000, | 512 | .phys_io = 0xfff00000, |
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index e7130293a03f..a61bf455ee02 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c | |||
@@ -31,18 +31,21 @@ | |||
31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
32 | #include <linux/irq.h> | 32 | #include <linux/irq.h> |
33 | #include <linux/interrupt.h> | 33 | #include <linux/interrupt.h> |
34 | #include <linux/i2c.h> | ||
34 | 35 | ||
35 | #include <linux/mtd/mtd.h> | 36 | #include <linux/mtd/mtd.h> |
36 | #include <linux/mtd/partitions.h> | 37 | #include <linux/mtd/partitions.h> |
37 | 38 | ||
38 | #include <asm/hardware.h> | 39 | #include <asm/hardware.h> |
40 | #include <asm/gpio.h> | ||
41 | |||
39 | #include <asm/mach-types.h> | 42 | #include <asm/mach-types.h> |
40 | #include <asm/mach/arch.h> | 43 | #include <asm/mach/arch.h> |
41 | #include <asm/mach/map.h> | 44 | #include <asm/mach/map.h> |
42 | #include <asm/mach/flash.h> | 45 | #include <asm/mach/flash.h> |
43 | 46 | ||
44 | #include <asm/arch/gpio.h> | ||
45 | #include <asm/arch/usb.h> | 47 | #include <asm/arch/usb.h> |
48 | #include <asm/arch/tps65010.h> | ||
46 | #include <asm/arch/mux.h> | 49 | #include <asm/arch/mux.h> |
47 | #include <asm/arch/tc.h> | 50 | #include <asm/arch/tc.h> |
48 | #include <asm/arch/common.h> | 51 | #include <asm/arch/common.h> |
@@ -179,6 +182,19 @@ static struct platform_device *osk5912_devices[] __initdata = { | |||
179 | &osk5912_mcbsp1_device, | 182 | &osk5912_mcbsp1_device, |
180 | }; | 183 | }; |
181 | 184 | ||
185 | static struct i2c_board_info __initdata osk_i2c_board_info[] = { | ||
186 | { | ||
187 | I2C_BOARD_INFO("tps65010", 0x48), | ||
188 | .type = "tps65010", | ||
189 | .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)), | ||
190 | }, | ||
191 | /* TODO when driver support is ready: | ||
192 | * - aic23 audio chip at 0x1a | ||
193 | * - on Mistral, 24c04 eeprom at 0x50 | ||
194 | * - optionally on Mistral, ov9640 camera sensor at 0x30 | ||
195 | */ | ||
196 | }; | ||
197 | |||
182 | static void __init osk_init_smc91x(void) | 198 | static void __init osk_init_smc91x(void) |
183 | { | 199 | { |
184 | if ((omap_request_gpio(0)) < 0) { | 200 | if ((omap_request_gpio(0)) < 0) { |
@@ -397,6 +413,14 @@ static void __init osk_init(void) | |||
397 | omap_board_config_size = ARRAY_SIZE(osk_config); | 413 | omap_board_config_size = ARRAY_SIZE(osk_config); |
398 | USB_TRANSCEIVER_CTRL_REG |= (3 << 1); | 414 | USB_TRANSCEIVER_CTRL_REG |= (3 << 1); |
399 | 415 | ||
416 | /* irq for tps65010 chip */ | ||
417 | /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */ | ||
418 | if (gpio_request(OMAP_MPUIO(1), "tps65010") == 0) | ||
419 | gpio_direction_input(OMAP_MPUIO(1)); | ||
420 | |||
421 | i2c_register_board_info(1, osk_i2c_board_info, | ||
422 | ARRAY_SIZE(osk_i2c_board_info)); | ||
423 | |||
400 | omap_serial_init(); | 424 | omap_serial_init(); |
401 | osk_mistral_init(); | 425 | osk_mistral_init(); |
402 | } | 426 | } |
@@ -406,6 +430,44 @@ static void __init osk_map_io(void) | |||
406 | omap1_map_common_io(); | 430 | omap1_map_common_io(); |
407 | } | 431 | } |
408 | 432 | ||
433 | #ifdef CONFIG_TPS65010 | ||
434 | static int __init osk_tps_init(void) | ||
435 | { | ||
436 | if (!machine_is_omap_osk()) | ||
437 | return 0; | ||
438 | |||
439 | /* Let LED1 (D9) blink */ | ||
440 | tps65010_set_led(LED1, BLINK); | ||
441 | |||
442 | /* Disable LED 2 (D2) */ | ||
443 | tps65010_set_led(LED2, OFF); | ||
444 | |||
445 | /* Set GPIO 1 HIGH to disable VBUS power supply; | ||
446 | * OHCI driver powers it up/down as needed. | ||
447 | */ | ||
448 | tps65010_set_gpio_out_value(GPIO1, HIGH); | ||
449 | |||
450 | /* Set GPIO 2 low to turn on LED D3 */ | ||
451 | tps65010_set_gpio_out_value(GPIO2, HIGH); | ||
452 | |||
453 | /* Set GPIO 3 low to take ethernet out of reset */ | ||
454 | tps65010_set_gpio_out_value(GPIO3, LOW); | ||
455 | |||
456 | /* gpio4 for VDD_DSP */ | ||
457 | /* FIXME send power to DSP iff it's configured */ | ||
458 | |||
459 | /* Enable LOW_PWR */ | ||
460 | tps65010_set_low_pwr(ON); | ||
461 | |||
462 | /* Switch VLDO2 to 3.0V for AIC23 */ | ||
463 | tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V | ||
464 | | TPS_LDO1_ENABLE); | ||
465 | |||
466 | return 0; | ||
467 | } | ||
468 | fs_initcall(osk_tps_init); | ||
469 | #endif | ||
470 | |||
409 | MACHINE_START(OMAP_OSK, "TI-OSK") | 471 | MACHINE_START(OMAP_OSK, "TI-OSK") |
410 | /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ | 472 | /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ |
411 | .phys_io = 0xfff00000, | 473 | .phys_io = 0xfff00000, |