diff options
author | Mike Rapoport <mike@compulab.co.il> | 2011-05-12 17:31:02 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-05-17 06:31:05 -0400 |
commit | 0d4ab9a58ff6d29e84b6f29a5084323f0374ef6a (patch) | |
tree | 1c5f95d6273416958a60343143be4075cb9efbc9 /arch | |
parent | fdfb03ba375e34b8aaee22a501eb59c92b43726b (diff) |
omap: igep0020: minor refactoring
to allow easy addition of IGEP3
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/board-igep0020.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index ad20f7b5aa4a..ea7cbc69f7cd 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -299,17 +299,14 @@ static struct omap2_hsmmc_info mmc[] = { | |||
299 | static struct gpio_led igep_gpio_leds[] = { | 299 | static struct gpio_led igep_gpio_leds[] = { |
300 | [0] = { | 300 | [0] = { |
301 | .name = "gpio-led:red:d0", | 301 | .name = "gpio-led:red:d0", |
302 | .gpio = IGEP2_GPIO_LED0_RED, | ||
303 | .default_trigger = "default-off" | 302 | .default_trigger = "default-off" |
304 | }, | 303 | }, |
305 | [1] = { | 304 | [1] = { |
306 | .name = "gpio-led:green:d0", | 305 | .name = "gpio-led:green:d0", |
307 | .gpio = IGEP2_GPIO_LED0_GREEN, | ||
308 | .default_trigger = "default-off", | 306 | .default_trigger = "default-off", |
309 | }, | 307 | }, |
310 | [2] = { | 308 | [2] = { |
311 | .name = "gpio-led:red:d1", | 309 | .name = "gpio-led:red:d1", |
312 | .gpio = IGEP2_GPIO_LED1_RED, | ||
313 | .default_trigger = "default-off", | 310 | .default_trigger = "default-off", |
314 | }, | 311 | }, |
315 | [3] = { | 312 | [3] = { |
@@ -335,6 +332,10 @@ static struct platform_device igep_led_device = { | |||
335 | 332 | ||
336 | static void __init igep_leds_init(void) | 333 | static void __init igep_leds_init(void) |
337 | { | 334 | { |
335 | igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED; | ||
336 | igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN; | ||
337 | igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED; | ||
338 | |||
338 | platform_device_register(&igep_led_device); | 339 | platform_device_register(&igep_led_device); |
339 | } | 340 | } |
340 | 341 | ||
@@ -347,14 +348,15 @@ static struct gpio igep_gpio_leds[] __initdata = { | |||
347 | 348 | ||
348 | static inline void igep_leds_init(void) | 349 | static inline void igep_leds_init(void) |
349 | { | 350 | { |
351 | int i; | ||
352 | |||
350 | if (gpio_request_array(igep_gpio_leds, ARRAY_SIZE(igep_gpio_leds))) { | 353 | if (gpio_request_array(igep_gpio_leds, ARRAY_SIZE(igep_gpio_leds))) { |
351 | pr_warning("IGEP v2: Could not obtain leds gpios\n"); | 354 | pr_warning("IGEP v2: Could not obtain leds gpios\n"); |
352 | return; | 355 | return; |
353 | } | 356 | } |
354 | 357 | ||
355 | gpio_export(IGEP2_GPIO_LED0_RED, 0); | 358 | for (i = 0; i < ARRAY_SIZE(igep_gpio_leds); i++) |
356 | gpio_export(IGEP2_GPIO_LED0_GREEN, 0); | 359 | gpio_export(igep_gpio_leds[i].gpio, 0); |
357 | gpio_export(IGEP2_GPIO_LED1_RED, 0); | ||
358 | } | 360 | } |
359 | #endif | 361 | #endif |
360 | 362 | ||
@@ -372,6 +374,18 @@ static int igep_twl_gpio_setup(struct device *dev, | |||
372 | mmc[0].gpio_cd = gpio + 0; | 374 | mmc[0].gpio_cd = gpio + 0; |
373 | omap2_hsmmc_init(mmc); | 375 | omap2_hsmmc_init(mmc); |
374 | 376 | ||
377 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ | ||
378 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) | ||
379 | ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH, | ||
380 | "gpio-led:green:d1"); | ||
381 | if (ret == 0) | ||
382 | gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); | ||
383 | else | ||
384 | pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n"); | ||
385 | #else | ||
386 | igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; | ||
387 | #endif | ||
388 | |||
375 | /* | 389 | /* |
376 | * REVISIT: need ehci-omap hooks for external VBUS | 390 | * REVISIT: need ehci-omap hooks for external VBUS |
377 | * power switch and overcurrent detect | 391 | * power switch and overcurrent detect |
@@ -385,18 +399,6 @@ static int igep_twl_gpio_setup(struct device *dev, | |||
385 | if (ret < 0) | 399 | if (ret < 0) |
386 | pr_err("IGEP2: Could not obtain gpio for USBH_CPEN"); | 400 | pr_err("IGEP2: Could not obtain gpio for USBH_CPEN"); |
387 | 401 | ||
388 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ | ||
389 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) | ||
390 | ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH, | ||
391 | "gpio-led:green:d1"); | ||
392 | if (ret == 0) | ||
393 | gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); | ||
394 | else | ||
395 | pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n"); | ||
396 | #else | ||
397 | igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; | ||
398 | #endif | ||
399 | |||
400 | return 0; | 402 | return 0; |
401 | }; | 403 | }; |
402 | 404 | ||
@@ -531,11 +533,8 @@ static struct twl4030_platform_data igep_twldata = { | |||
531 | 533 | ||
532 | /* platform_data for children goes here */ | 534 | /* platform_data for children goes here */ |
533 | .usb = &igep_usb_data, | 535 | .usb = &igep_usb_data, |
534 | .codec = &igep2_codec_data, | ||
535 | .gpio = &igep_twl4030_gpio_pdata, | 536 | .gpio = &igep_twl4030_gpio_pdata, |
536 | .keypad = &igep2_keypad_pdata, | ||
537 | .vmmc1 = &igep_vmmc1, | 537 | .vmmc1 = &igep_vmmc1, |
538 | .vpll2 = &igep2_vpll2, | ||
539 | .vio = &igep_vio, | 538 | .vio = &igep_vio, |
540 | }; | 539 | }; |
541 | 540 | ||
@@ -549,8 +548,6 @@ static void __init igep_i2c_init(void) | |||
549 | { | 548 | { |
550 | int ret; | 549 | int ret; |
551 | 550 | ||
552 | omap3_pmic_init("twl4030", &igep_twldata); | ||
553 | |||
554 | /* | 551 | /* |
555 | * Bus 3 is attached to the DVI port where devices like the pico DLP | 552 | * Bus 3 is attached to the DVI port where devices like the pico DLP |
556 | * projector don't work reliably with 400kHz | 553 | * projector don't work reliably with 400kHz |
@@ -559,6 +556,12 @@ static void __init igep_i2c_init(void) | |||
559 | ARRAY_SIZE(igep2_i2c3_boardinfo)); | 556 | ARRAY_SIZE(igep2_i2c3_boardinfo)); |
560 | if (ret) | 557 | if (ret) |
561 | pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret); | 558 | pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret); |
559 | |||
560 | igep_twldata.codec = &igep2_codec_data; | ||
561 | igep_twldata.keypad = &igep2_keypad_pdata; | ||
562 | igep_twldata.vpll2 = &igep2_vpll2; | ||
563 | |||
564 | omap3_pmic_init("twl4030", &igep_twldata); | ||
562 | } | 565 | } |
563 | 566 | ||
564 | static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = { | 567 | static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = { |
@@ -630,15 +633,11 @@ static void __init igep_init(void) | |||
630 | /* Register I2C busses and drivers */ | 633 | /* Register I2C busses and drivers */ |
631 | igep_i2c_init(); | 634 | igep_i2c_init(); |
632 | platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices)); | 635 | platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices)); |
633 | omap_display_init(&igep2_dss_data); | ||
634 | omap_serial_init(); | 636 | omap_serial_init(); |
635 | usb_musb_init(NULL); | 637 | usb_musb_init(NULL); |
636 | usbhs_init(&igep2_usbhs_bdata); | ||
637 | 638 | ||
638 | igep_flash_init(); | 639 | igep_flash_init(); |
639 | igep_leds_init(); | 640 | igep_leds_init(); |
640 | igep2_display_init(); | ||
641 | igep2_init_smsc911x(); | ||
642 | 641 | ||
643 | /* | 642 | /* |
644 | * WLAN-BT combo module from MuRata which has a Marvell WLAN | 643 | * WLAN-BT combo module from MuRata which has a Marvell WLAN |
@@ -646,6 +645,10 @@ static void __init igep_init(void) | |||
646 | */ | 645 | */ |
647 | igep_wlan_bt_init(); | 646 | igep_wlan_bt_init(); |
648 | 647 | ||
648 | omap_display_init(&igep2_dss_data); | ||
649 | igep2_display_init(); | ||
650 | igep2_init_smsc911x(); | ||
651 | usbhs_init(&igep2_usbhs_bdata); | ||
649 | } | 652 | } |
650 | 653 | ||
651 | MACHINE_START(IGEP0020, "IGEP v2 board") | 654 | MACHINE_START(IGEP0020, "IGEP v2 board") |