[ARM] pxa: add GPIO expander (PCA9539) support for zylonite
authorEric Miao <eric.miao@marvell.com>
Wed, 28 May 2008 02:44:16 +0000 (10:44 +0800)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 9 Jul 2008 20:38:33 +0000 (21:38 +0100)
     And also reserve 32 IRQs for the two GPIO expanders.

Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/zylonite_pxa300.c
include/asm-arm/arch-pxa/irqs.h

index 6f7ae972b8db658e137b705ae5cc2df9602fa92e..75bf61f1f1c30a743afe7ad34ddd27b83db57a92 100644 (file)
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/i2c.h>
+#include <linux/i2c/pca953x.h>
 
 #include <asm/gpio.h>
 #include <asm/arch/mfp-pxa300.h>
+#include <asm/arch/i2c.h>
 #include <asm/arch/zylonite.h>
 
 #include "generic.h"
@@ -109,6 +112,10 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
        GPIO12_MMC2_DAT3,
        GPIO13_MMC2_CLK,
        GPIO14_MMC2_CMD,
+
+       /* Standard I2C */
+       GPIO21_I2C_SCL,
+       GPIO22_I2C_SDA,
 };
 
 static mfp_cfg_t pxa300_mfp_cfg[] __initdata = {
@@ -192,6 +199,39 @@ static void __init zylonite_detect_lcd_panel(void)
                pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
 }
 
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+static struct pca953x_platform_data gpio_exp[] = {
+       [0] = {
+               .gpio_base      = 128,
+       },
+       [1] = {
+               .gpio_base      = 144,
+       },
+};
+
+struct i2c_board_info zylonite_i2c_board_info[] = {
+       {
+               .type           = "pca9539",
+               .addr           = 0x74,
+               .platform_data  = &gpio_exp[0],
+               .irq            = IRQ_GPIO(18),
+       }, {
+               .type           = "pca9539",
+               .addr           = 0x75,
+               .platform_data  = &gpio_exp[1],
+               .irq            = IRQ_GPIO(19),
+       },
+};
+
+static void __init zylonite_init_i2c(void)
+{
+       pxa_set_i2c_info(NULL);
+       i2c_register_board_info(0, ARRAY_AND_SIZE(zylonite_i2c_board_info));
+}
+#else
+static inline void zylonite_init_i2c(void) {}
+#endif
+
 void __init zylonite_pxa300_init(void)
 {
        if (cpu_is_pxa300() || cpu_is_pxa310()) {
@@ -207,6 +247,8 @@ void __init zylonite_pxa300_init(void)
 
                /* WM9713 IRQ */
                wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26);
+
+               zylonite_init_i2c();
        }
 
        if (cpu_is_pxa300()) {
index b6c8fe37768315bcc5081490572e2493e15910cf..d8573604846170c14db6e00c09fea1d8a7bcebd1 100644 (file)
       defined(CONFIG_MACH_PCM027) || \
       defined(CONFIG_MACH_MAGICIAN)
 #define NR_IRQS                        (IRQ_BOARD_END)
+#elif defined(CONFIG_MACH_ZYLONITE)
+#define NR_IRQS                        (IRQ_BOARD_START + 32)
 #else
 #define NR_IRQS                        (IRQ_BOARD_START)
 #endif