]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
twl4030 gpio platform data
authorDavid Brownell <dbrownell@users.sourceforge.net>
Tue, 30 Sep 2008 18:42:51 +0000 (21:42 +0300)
committerTony Lindgren <tony@atomide.com>
Wed, 1 Oct 2008 10:37:36 +0000 (13:37 +0300)
Define platform data for configuring TWL4030 GPIOs,
and provide it for all boards using these chips.

For now all boards use the same fixed assignments for
GPIO and IRQ numbers.  Eventually we should be able
to shuffle them without changing platform headers.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/board-2430sdp.c
arch/arm/mach-omap2/board-3430sdp.c
arch/arm/mach-omap2/board-ldp.c
arch/arm/mach-omap2/board-omap2evm.c
arch/arm/mach-omap2/board-omap3beagle.c
arch/arm/mach-omap2/board-omap3evm.c
arch/arm/mach-omap2/board-overo.c
include/linux/i2c/twl4030.h

index 30735285138b48c60779b2f4596a88a64816b6d7..784211031b2ae8345ab2119eb109620936f5c260 100644 (file)
@@ -345,6 +345,12 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = {
 };
 
 
+static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
+       .gpio_base      = OMAP_MAX_GPIO_LINES,
+       .irq_base       = TWL4030_GPIO_IRQ_BASE,
+       .irq_end        = TWL4030_GPIO_IRQ_END,
+};
+
 static struct twl4030_usb_data sdp2430_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
 };
@@ -354,6 +360,7 @@ static struct twl4030_platform_data sdp2430_twldata = {
        .irq_end        = TWL4030_IRQ_END,
 
        /* platform_data for children goes here */
+       .gpio           = &sdp2430_gpio_data,
        .keypad         = &sdp2430_kp_data,
        .usb            = &sdp2430_usb_data,
 };
index e0c39c2ada575323a07ac46c1e3ef14f289bf9d4..66f0f9835d562228aa22a084e820b8c2d9245385 100644 (file)
@@ -300,6 +300,12 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = {
        { OMAP_TAG_LCD,         &sdp3430_lcd_config },
 };
 
+static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
+       .gpio_base      = OMAP_MAX_GPIO_LINES,
+       .irq_base       = TWL4030_GPIO_IRQ_BASE,
+       .irq_end        = TWL4030_GPIO_IRQ_END,
+};
+
 static struct twl4030_usb_data sdp3430_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
 };
@@ -309,6 +315,7 @@ static struct twl4030_platform_data sdp3430_twldata = {
        .irq_end        = TWL4030_IRQ_END,
 
        /* platform_data for children goes here */
+       .gpio           = &sdp3430_gpio_data,
        .keypad         = &sdp3430_kp_data,
        .usb            = &sdp3430_usb_data,
 };
index 219579b95e9be31e5eaba638fe583ba295d85737..48342f451b278b4a85041270b85756733ecc0a36 100644 (file)
@@ -187,12 +187,19 @@ static struct twl4030_usb_data ldp_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
 };
 
+static struct twl4030_gpio_platform_data ldp_gpio_data = {
+       .gpio_base      = OMAP_MAX_GPIO_LINES,
+       .irq_base       = TWL4030_GPIO_IRQ_BASE,
+       .irq_end        = TWL4030_GPIO_IRQ_END,
+};
+
 static struct twl4030_platform_data ldp_twldata = {
        .irq_base       = TWL4030_IRQ_BASE,
        .irq_end        = TWL4030_IRQ_END,
 
        /* platform_data for children goes here */
        .usb            = &ldp_usb_data,
+       .gpio           = &ldp_gpio_data,
 };
 
 static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
index be8348d7be603d448f653066c76d4bfbec441c19..a921cf19f77bfaf17fcfa8c479831fcc77cda231 100644 (file)
@@ -226,6 +226,12 @@ static struct omap_board_config_kernel omap2_evm_config[] __initdata = {
        { OMAP_TAG_LCD,         &omap2_evm_lcd_config },
 };
 
+static struct twl4030_gpio_platform_data omap2evm_gpio_data = {
+       .gpio_base      = OMAP_MAX_GPIO_LINES,
+       .irq_base       = TWL4030_GPIO_IRQ_BASE,
+       .irq_end        = TWL4030_GPIO_IRQ_END,
+};
+
 static struct twl4030_usb_data omap2evm_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
 };
@@ -237,6 +243,7 @@ static struct twl4030_platform_data omap2evm_twldata = {
        /* platform_data for children goes here */
        .keypad         = &omap2evm_kp_data,
        .usb            = &omap2evm_usb_data,
+       .gpio           = &omap2evm_gpio_data,
 };
 
 static struct i2c_board_info __initdata omap2evm_i2c_boardinfo[] = {
index ae677b991ba95910cfbc3b51e2a552ab00f3e0ec..aa5e9a60bb63baa252f7fe7f6a95e90f8e59e226 100644 (file)
@@ -114,12 +114,24 @@ static struct twl4030_usb_data beagle_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
 };
 
+static struct twl4030_gpio_platform_data beagle_gpio_data = {
+       .gpio_base      = OMAP_MAX_GPIO_LINES,
+       .irq_base       = TWL4030_GPIO_IRQ_BASE,
+       .irq_end        = TWL4030_GPIO_IRQ_END,
+
+       /* REVISIT:  setup() should use twl gpio index
+        *  - 0 as MMC card detect,
+        *  - 1 as EHCI port overcurrent (active low)
+        */
+};
+
 static struct twl4030_platform_data beagle_twldata = {
        .irq_base       = TWL4030_IRQ_BASE,
        .irq_end        = TWL4030_IRQ_END,
 
        /* platform_data for children goes here */
        .usb            = &beagle_usb_data,
+       .gpio           = &beagle_gpio_data,
 };
 
 static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
index 158138c25dc4ae6a6dfdfdc61a644d02deccf15e..2c1d76f37103494d25efcfd9fa28740a57d65e05 100644 (file)
@@ -90,6 +90,12 @@ static struct omap_uart_config omap3_evm_uart_config __initdata = {
        .enabled_uarts  = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
 
+static struct twl4030_gpio_platform_data omap3evm_gpio_data = {
+       .gpio_base      = OMAP_MAX_GPIO_LINES,
+       .irq_base       = TWL4030_GPIO_IRQ_BASE,
+       .irq_end        = TWL4030_GPIO_IRQ_END,
+};
+
 static struct twl4030_usb_data omap3evm_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
 };
@@ -129,6 +135,7 @@ static struct twl4030_platform_data omap3evm_twldata = {
        /* platform_data for children goes here */
        .keypad         = &omap3evm_kp_data,
        .usb            = &omap3evm_usb_data,
+       .gpio           = &omap3evm_gpio_data,
 };
 
 static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
index 2e6d2c7d457348d74bc98d202bd7c22e450fe9ab..a490f15f7f7b435e95e44a710eb230a39a82a08b 100644 (file)
@@ -145,6 +145,11 @@ static void __init overo_flash_init(void)
 static struct omap_uart_config overo_uart_config __initdata = {
        .enabled_uarts  = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
+static struct twl4030_gpio_platform_data overo_gpio_data = {
+       .gpio_base      = OMAP_MAX_GPIO_LINES,
+       .irq_base       = TWL4030_GPIO_IRQ_BASE,
+       .irq_end        = TWL4030_GPIO_IRQ_END,
+};
 
 static struct twl4030_usb_data overo_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
@@ -153,6 +158,7 @@ static struct twl4030_usb_data overo_usb_data = {
 static struct twl4030_platform_data overo_twldata = {
        .irq_base       = TWL4030_IRQ_BASE,
        .irq_end        = TWL4030_IRQ_END,
+       .gpio           = &overo_gpio_data,
        .usb            = &overo_usb_data,
 };
 
index 8a12ff0cbc5912ace528979d9fb2fdadfd2d61a7..b80e8b640aa5ff428f728e4906e1982a0da9e5dc 100644 (file)
 #define TWL4030_MODULE_RTC             0x14
 #define TWL4030_MODULE_SECURED_REG     0x15
 
+
+/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
+struct twl4030_gpio_platform_data {
+       int             gpio_base;
+       unsigned        irq_base, irq_end;
+
+       /* for gpio-N, bit (1 << N) is set if pullup should be used */
+       u32             pullups;
+
+       int             (*setup)(struct device *dev,
+                               unsigned gpio, unsigned ngpio);
+       int             (*teardown)(struct device *dev,
+                               unsigned gpio, unsigned ngpio);
+};
+
 struct twl4030_keypad_data {
        int rows;
        int cols;
@@ -71,9 +86,10 @@ struct twl4030_usb_data {
 };
 
 struct twl4030_platform_data {
-       unsigned        irq_base, irq_end;
-       struct twl4030_keypad_data *keypad;
-       struct twl4030_usb_data *usb;
+       unsigned                                irq_base, irq_end;
+       struct twl4030_gpio_platform_data       *gpio;
+       struct twl4030_keypad_data              *keypad;
+       struct twl4030_usb_data                 *usb;
 
        /* REVISIT more to come ... _nothing_ should be hard-wired */
 };
@@ -151,6 +167,8 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes);
 
 /*
  * Exported TWL4030 GPIO APIs
+ *
+ * WARNING -- use standard GPIO and IRQ calls instead; these will vanish.
  */
 int twl4030_get_gpio_datain(int gpio);
 int twl4030_request_gpio(int gpio);