diff options
author | Sekhar Nori <nsekhar@ti.com> | 2009-10-21 11:48:20 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-11-25 13:21:34 -0500 |
commit | 77316f0575264c56fb0c8f241b946a91e3a00602 (patch) | |
tree | fb73effd8a03ae5bf770cfda071111da31517e1e /arch/arm/mach-davinci/board-da830-evm.c | |
parent | a0433ac30c75e5c989088cc5503653cc7a12998a (diff) |
davinci: DA830/OMAP-L137 EVM: use runtime detection for UI card
This patch supports runtime detection of DA830 UI card and
eliminates the need for DA830_UI config option. Successful
probe of GPIO expander present on the UI card is used to
detect its presence. For this reason, GPIO_PCF857X is auto-
selected when DA830 EVM is configured. In case the UI card
is absent, the probe fails in reasonable time.
As a side effect this patch also gets rid of the voilation
of Documentation/SubmittingPatches section 2.2 in function
da830_evm_ui_expander_setup()
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/board-da830-evm.c')
-rw-r--r-- | arch/arm/mach-davinci/board-da830-evm.c | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index b433b22e1777..e7e97c90d4d0 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c | |||
@@ -36,58 +36,6 @@ | |||
36 | #define DA830_EMIF25_ASYNC_DATA_CE3_BASE 0x62000000 | 36 | #define DA830_EMIF25_ASYNC_DATA_CE3_BASE 0x62000000 |
37 | #define DA830_EMIF25_CONTROL_BASE 0x68000000 | 37 | #define DA830_EMIF25_CONTROL_BASE 0x68000000 |
38 | 38 | ||
39 | static struct at24_platform_data da830_evm_i2c_eeprom_info = { | ||
40 | .byte_len = SZ_256K / 8, | ||
41 | .page_size = 64, | ||
42 | .flags = AT24_FLAG_ADDR16, | ||
43 | .setup = davinci_get_mac_addr, | ||
44 | .context = (void *)0x7f00, | ||
45 | }; | ||
46 | |||
47 | static int da830_evm_ui_expander_setup(struct i2c_client *client, int gpio, | ||
48 | unsigned ngpio, void *context) | ||
49 | { | ||
50 | gpio_request(gpio + 6, "MUX_MODE"); | ||
51 | #ifdef CONFIG_DA830_UI_LCD | ||
52 | gpio_direction_output(gpio + 6, 0); | ||
53 | #else /* Must be NAND or NOR */ | ||
54 | gpio_direction_output(gpio + 6, 1); | ||
55 | #endif | ||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | static int da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio, | ||
60 | unsigned ngpio, void *context) | ||
61 | { | ||
62 | gpio_free(gpio + 6); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static struct pcf857x_platform_data da830_evm_ui_expander_info = { | ||
67 | .gpio_base = DAVINCI_N_GPIO, | ||
68 | .setup = da830_evm_ui_expander_setup, | ||
69 | .teardown = da830_evm_ui_expander_teardown, | ||
70 | }; | ||
71 | |||
72 | static struct i2c_board_info __initdata da830_evm_i2c_devices[] = { | ||
73 | { | ||
74 | I2C_BOARD_INFO("24c256", 0x50), | ||
75 | .platform_data = &da830_evm_i2c_eeprom_info, | ||
76 | }, | ||
77 | { | ||
78 | I2C_BOARD_INFO("tlv320aic3x", 0x18), | ||
79 | }, | ||
80 | { | ||
81 | I2C_BOARD_INFO("pcf8574", 0x3f), | ||
82 | .platform_data = &da830_evm_ui_expander_info, | ||
83 | }, | ||
84 | }; | ||
85 | |||
86 | static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = { | ||
87 | .bus_freq = 100, /* kHz */ | ||
88 | .bus_delay = 0, /* usec */ | ||
89 | }; | ||
90 | |||
91 | /* | 39 | /* |
92 | * USB1 VBUS is controlled by GPIO1[15], over-current is reported on GPIO2[4]. | 40 | * USB1 VBUS is controlled by GPIO1[15], over-current is reported on GPIO2[4]. |
93 | */ | 41 | */ |
@@ -425,7 +373,7 @@ static struct platform_device da830_evm_nand_device = { | |||
425 | .resource = da830_evm_nand_resources, | 373 | .resource = da830_evm_nand_resources, |
426 | }; | 374 | }; |
427 | 375 | ||
428 | static inline void da830_evm_init_nand(void) | 376 | static inline void da830_evm_init_nand(int mux_mode) |
429 | { | 377 | { |
430 | int ret; | 378 | int ret; |
431 | 379 | ||
@@ -437,13 +385,15 @@ static inline void da830_evm_init_nand(void) | |||
437 | ret = platform_device_register(&da830_evm_nand_device); | 385 | ret = platform_device_register(&da830_evm_nand_device); |
438 | if (ret) | 386 | if (ret) |
439 | pr_warning("da830_evm_init: NAND device not registered.\n"); | 387 | pr_warning("da830_evm_init: NAND device not registered.\n"); |
388 | |||
389 | gpio_direction_output(mux_mode, 1); | ||
440 | } | 390 | } |
441 | #else | 391 | #else |
442 | static inline void da830_evm_init_nand(void) { } | 392 | static inline void da830_evm_init_nand(int mux_mode) { } |
443 | #endif | 393 | #endif |
444 | 394 | ||
445 | #ifdef CONFIG_DA830_UI_LCD | 395 | #ifdef CONFIG_DA830_UI_LCD |
446 | static inline void da830_evm_init_lcdc(void) | 396 | static inline void da830_evm_init_lcdc(int mux_mode) |
447 | { | 397 | { |
448 | int ret; | 398 | int ret; |
449 | 399 | ||
@@ -455,11 +405,65 @@ static inline void da830_evm_init_lcdc(void) | |||
455 | ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata); | 405 | ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata); |
456 | if (ret) | 406 | if (ret) |
457 | pr_warning("da830_evm_init: lcd setup failed: %d\n", ret); | 407 | pr_warning("da830_evm_init: lcd setup failed: %d\n", ret); |
408 | |||
409 | gpio_direction_output(mux_mode, 0); | ||
458 | } | 410 | } |
459 | #else | 411 | #else |
460 | static inline void da830_evm_init_lcdc(void) { } | 412 | static inline void da830_evm_init_lcdc(int mux_mode) { } |
461 | #endif | 413 | #endif |
462 | 414 | ||
415 | static struct at24_platform_data da830_evm_i2c_eeprom_info = { | ||
416 | .byte_len = SZ_256K / 8, | ||
417 | .page_size = 64, | ||
418 | .flags = AT24_FLAG_ADDR16, | ||
419 | .setup = davinci_get_mac_addr, | ||
420 | .context = (void *)0x7f00, | ||
421 | }; | ||
422 | |||
423 | static int da830_evm_ui_expander_setup(struct i2c_client *client, int gpio, | ||
424 | unsigned ngpio, void *context) | ||
425 | { | ||
426 | gpio_request(gpio + 6, "UI MUX_MODE"); | ||
427 | |||
428 | da830_evm_init_lcdc(gpio + 6); | ||
429 | |||
430 | da830_evm_init_nand(gpio + 6); | ||
431 | |||
432 | return 0; | ||
433 | } | ||
434 | |||
435 | static int da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio, | ||
436 | unsigned ngpio, void *context) | ||
437 | { | ||
438 | gpio_free(gpio + 6); | ||
439 | return 0; | ||
440 | } | ||
441 | |||
442 | static struct pcf857x_platform_data da830_evm_ui_expander_info = { | ||
443 | .gpio_base = DAVINCI_N_GPIO, | ||
444 | .setup = da830_evm_ui_expander_setup, | ||
445 | .teardown = da830_evm_ui_expander_teardown, | ||
446 | }; | ||
447 | |||
448 | static struct i2c_board_info __initdata da830_evm_i2c_devices[] = { | ||
449 | { | ||
450 | I2C_BOARD_INFO("24c256", 0x50), | ||
451 | .platform_data = &da830_evm_i2c_eeprom_info, | ||
452 | }, | ||
453 | { | ||
454 | I2C_BOARD_INFO("tlv320aic3x", 0x18), | ||
455 | }, | ||
456 | { | ||
457 | I2C_BOARD_INFO("pcf8574", 0x3f), | ||
458 | .platform_data = &da830_evm_ui_expander_info, | ||
459 | }, | ||
460 | }; | ||
461 | |||
462 | static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = { | ||
463 | .bus_freq = 100, /* kHz */ | ||
464 | .bus_delay = 0, /* usec */ | ||
465 | }; | ||
466 | |||
463 | static __init void da830_evm_init(void) | 467 | static __init void da830_evm_init(void) |
464 | { | 468 | { |
465 | struct davinci_soc_info *soc_info = &davinci_soc_info; | 469 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
@@ -514,10 +518,6 @@ static __init void da830_evm_init(void) | |||
514 | 518 | ||
515 | da830_evm_init_mmc(); | 519 | da830_evm_init_mmc(); |
516 | 520 | ||
517 | da830_evm_init_lcdc(); | ||
518 | |||
519 | da830_evm_init_nand(); | ||
520 | |||
521 | ret = da8xx_register_rtc(); | 521 | ret = da8xx_register_rtc(); |
522 | if (ret) | 522 | if (ret) |
523 | pr_warning("da830_evm_init: rtc setup failed: %d\n", ret); | 523 | pr_warning("da830_evm_init: rtc setup failed: %d\n", ret); |