summaryrefslogtreecommitdiff
path: root/arch/arm/mach-davinci/board-da830-evm.c
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2009-10-21 19:48:20 +0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-25 21:21:34 +0300
commit77316f0575264c56fb0c8f241b946a91e3a00602 (patch)
treefb73effd8a03ae5bf770cfda071111da31517e1e /arch/arm/mach-davinci/board-da830-evm.c
parenta0433ac30c75e5c989088cc5503653cc7a12998a (diff)
downloadlinux-77316f0575264c56fb0c8f241b946a91e3a00602.tar.xz
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.c120
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 @@
#define DA830_EMIF25_ASYNC_DATA_CE3_BASE 0x62000000
#define DA830_EMIF25_CONTROL_BASE 0x68000000
-static struct at24_platform_data da830_evm_i2c_eeprom_info = {
- .byte_len = SZ_256K / 8,
- .page_size = 64,
- .flags = AT24_FLAG_ADDR16,
- .setup = davinci_get_mac_addr,
- .context = (void *)0x7f00,
-};
-
-static int da830_evm_ui_expander_setup(struct i2c_client *client, int gpio,
- unsigned ngpio, void *context)
-{
- gpio_request(gpio + 6, "MUX_MODE");
-#ifdef CONFIG_DA830_UI_LCD
- gpio_direction_output(gpio + 6, 0);
-#else /* Must be NAND or NOR */
- gpio_direction_output(gpio + 6, 1);
-#endif
- return 0;
-}
-
-static int da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
- unsigned ngpio, void *context)
-{
- gpio_free(gpio + 6);
- return 0;
-}
-
-static struct pcf857x_platform_data da830_evm_ui_expander_info = {
- .gpio_base = DAVINCI_N_GPIO,
- .setup = da830_evm_ui_expander_setup,
- .teardown = da830_evm_ui_expander_teardown,
-};
-
-static struct i2c_board_info __initdata da830_evm_i2c_devices[] = {
- {
- I2C_BOARD_INFO("24c256", 0x50),
- .platform_data = &da830_evm_i2c_eeprom_info,
- },
- {
- I2C_BOARD_INFO("tlv320aic3x", 0x18),
- },
- {
- I2C_BOARD_INFO("pcf8574", 0x3f),
- .platform_data = &da830_evm_ui_expander_info,
- },
-};
-
-static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = {
- .bus_freq = 100, /* kHz */
- .bus_delay = 0, /* usec */
-};
-
/*
* USB1 VBUS is controlled by GPIO1[15], over-current is reported on GPIO2[4].
*/
@@ -425,7 +373,7 @@ static struct platform_device da830_evm_nand_device = {
.resource = da830_evm_nand_resources,
};
-static inline void da830_evm_init_nand(void)
+static inline void da830_evm_init_nand(int mux_mode)
{
int ret;
@@ -437,13 +385,15 @@ static inline void da830_evm_init_nand(void)
ret = platform_device_register(&da830_evm_nand_device);
if (ret)
pr_warning("da830_evm_init: NAND device not registered.\n");
+
+ gpio_direction_output(mux_mode, 1);
}
#else
-static inline void da830_evm_init_nand(void) { }
+static inline void da830_evm_init_nand(int mux_mode) { }
#endif
#ifdef CONFIG_DA830_UI_LCD
-static inline void da830_evm_init_lcdc(void)
+static inline void da830_evm_init_lcdc(int mux_mode)
{
int ret;
@@ -455,11 +405,65 @@ static inline void da830_evm_init_lcdc(void)
ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata);
if (ret)
pr_warning("da830_evm_init: lcd setup failed: %d\n", ret);
+
+ gpio_direction_output(mux_mode, 0);
}
#else
-static inline void da830_evm_init_lcdc(void) { }
+static inline void da830_evm_init_lcdc(int mux_mode) { }
#endif
+static struct at24_platform_data da830_evm_i2c_eeprom_info = {
+ .byte_len = SZ_256K / 8,
+ .page_size = 64,
+ .flags = AT24_FLAG_ADDR16,
+ .setup = davinci_get_mac_addr,
+ .context = (void *)0x7f00,
+};
+
+static int da830_evm_ui_expander_setup(struct i2c_client *client, int gpio,
+ unsigned ngpio, void *context)
+{
+ gpio_request(gpio + 6, "UI MUX_MODE");
+
+ da830_evm_init_lcdc(gpio + 6);
+
+ da830_evm_init_nand(gpio + 6);
+
+ return 0;
+}
+
+static int da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
+ unsigned ngpio, void *context)
+{
+ gpio_free(gpio + 6);
+ return 0;
+}
+
+static struct pcf857x_platform_data da830_evm_ui_expander_info = {
+ .gpio_base = DAVINCI_N_GPIO,
+ .setup = da830_evm_ui_expander_setup,
+ .teardown = da830_evm_ui_expander_teardown,
+};
+
+static struct i2c_board_info __initdata da830_evm_i2c_devices[] = {
+ {
+ I2C_BOARD_INFO("24c256", 0x50),
+ .platform_data = &da830_evm_i2c_eeprom_info,
+ },
+ {
+ I2C_BOARD_INFO("tlv320aic3x", 0x18),
+ },
+ {
+ I2C_BOARD_INFO("pcf8574", 0x3f),
+ .platform_data = &da830_evm_ui_expander_info,
+ },
+};
+
+static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = {
+ .bus_freq = 100, /* kHz */
+ .bus_delay = 0, /* usec */
+};
+
static __init void da830_evm_init(void)
{
struct davinci_soc_info *soc_info = &davinci_soc_info;
@@ -514,10 +518,6 @@ static __init void da830_evm_init(void)
da830_evm_init_mmc();
- da830_evm_init_lcdc();
-
- da830_evm_init_nand();
-
ret = da8xx_register_rtc();
if (ret)
pr_warning("da830_evm_init: rtc setup failed: %d\n", ret);