diff options
Diffstat (limited to 'arch/arm/mach-omap1/gpio7xx.c')
| -rw-r--r-- | arch/arm/mach-omap1/gpio7xx.c | 95 |
1 files changed, 56 insertions, 39 deletions
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c index 1204c8b871a..4612d2506a2 100644 --- a/arch/arm/mach-omap1/gpio7xx.c +++ b/arch/arm/mach-omap1/gpio7xx.c @@ -17,6 +17,9 @@ */ #include <linux/gpio.h> +#include <linux/platform_data/gpio-omap.h> + +#include <mach/irqs.h> #define OMAP7XX_GPIO1_BASE 0xfffbc000 #define OMAP7XX_GPIO2_BASE 0xfffbc800 @@ -27,7 +30,7 @@ #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE /* mpu gpio */ -static struct __initdata resource omap7xx_mpu_gpio_resources[] = { +static struct resource omap7xx_mpu_gpio_resources[] = { { .start = OMAP1_MPUIO_VBASE, .end = OMAP1_MPUIO_VBASE + SZ_2K - 1, @@ -39,14 +42,25 @@ static struct __initdata resource omap7xx_mpu_gpio_resources[] = { }, }; -static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { - .virtual_irq_start = IH_MPUIO_BASE, - .bank_type = METHOD_MPUIO, - .bank_width = 32, +static struct omap_gpio_reg_offs omap7xx_mpuio_regs = { + .revision = USHRT_MAX, + .direction = OMAP_MPUIO_IO_CNTL / 2, + .datain = OMAP_MPUIO_INPUT_LATCH / 2, + .dataout = OMAP_MPUIO_OUTPUT / 2, + .irqstatus = OMAP_MPUIO_GPIO_INT / 2, + .irqenable = OMAP_MPUIO_GPIO_MASKIT / 2, + .irqenable_inv = true, + .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE >> 1, +}; + +static struct omap_gpio_platform_data omap7xx_mpu_gpio_config = { + .is_mpuio = true, + .bank_width = 16, .bank_stride = 2, + .regs = &omap7xx_mpuio_regs, }; -static struct __initdata platform_device omap7xx_mpu_gpio = { +static struct platform_device omap7xx_mpu_gpio = { .name = "omap_gpio", .id = 0, .dev = { @@ -57,7 +71,7 @@ static struct __initdata platform_device omap7xx_mpu_gpio = { }; /* gpio1 */ -static struct __initdata resource omap7xx_gpio1_resources[] = { +static struct resource omap7xx_gpio1_resources[] = { { .start = OMAP7XX_GPIO1_BASE, .end = OMAP7XX_GPIO1_BASE + SZ_2K - 1, @@ -69,13 +83,23 @@ static struct __initdata resource omap7xx_gpio1_resources[] = { }, }; -static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { - .virtual_irq_start = IH_GPIO_BASE, - .bank_type = METHOD_GPIO_7XX, +static struct omap_gpio_reg_offs omap7xx_gpio_regs = { + .revision = USHRT_MAX, + .direction = OMAP7XX_GPIO_DIR_CONTROL, + .datain = OMAP7XX_GPIO_DATA_INPUT, + .dataout = OMAP7XX_GPIO_DATA_OUTPUT, + .irqstatus = OMAP7XX_GPIO_INT_STATUS, + .irqenable = OMAP7XX_GPIO_INT_MASK, + .irqenable_inv = true, + .irqctrl = OMAP7XX_GPIO_INT_CONTROL, +}; + +static struct omap_gpio_platform_data omap7xx_gpio1_config = { .bank_width = 32, + .regs = &omap7xx_gpio_regs, }; -static struct __initdata platform_device omap7xx_gpio1 = { +static struct platform_device omap7xx_gpio1 = { .name = "omap_gpio", .id = 1, .dev = { @@ -86,7 +110,7 @@ static struct __initdata platform_device omap7xx_gpio1 = { }; /* gpio2 */ -static struct __initdata resource omap7xx_gpio2_resources[] = { +static struct resource omap7xx_gpio2_resources[] = { { .start = OMAP7XX_GPIO2_BASE, .end = OMAP7XX_GPIO2_BASE + SZ_2K - 1, @@ -98,13 +122,12 @@ static struct __initdata resource omap7xx_gpio2_resources[] = { }, }; -static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = { - .virtual_irq_start = IH_GPIO_BASE + 32, - .bank_type = METHOD_GPIO_7XX, +static struct omap_gpio_platform_data omap7xx_gpio2_config = { .bank_width = 32, + .regs = &omap7xx_gpio_regs, }; -static struct __initdata platform_device omap7xx_gpio2 = { +static struct platform_device omap7xx_gpio2 = { .name = "omap_gpio", .id = 2, .dev = { @@ -115,7 +138,7 @@ static struct __initdata platform_device omap7xx_gpio2 = { }; /* gpio3 */ -static struct __initdata resource omap7xx_gpio3_resources[] = { +static struct resource omap7xx_gpio3_resources[] = { { .start = OMAP7XX_GPIO3_BASE, .end = OMAP7XX_GPIO3_BASE + SZ_2K - 1, @@ -127,13 +150,12 @@ static struct __initdata resource omap7xx_gpio3_resources[] = { }, }; -static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = { - .virtual_irq_start = IH_GPIO_BASE + 64, - .bank_type = METHOD_GPIO_7XX, +static struct omap_gpio_platform_data omap7xx_gpio3_config = { .bank_width = 32, + .regs = &omap7xx_gpio_regs, }; -static struct __initdata platform_device omap7xx_gpio3 = { +static struct platform_device omap7xx_gpio3 = { .name = "omap_gpio", .id = 3, .dev = { @@ -144,7 +166,7 @@ static struct __initdata platform_device omap7xx_gpio3 = { }; /* gpio4 */ -static struct __initdata resource omap7xx_gpio4_resources[] = { +static struct resource omap7xx_gpio4_resources[] = { { .start = OMAP7XX_GPIO4_BASE, .end = OMAP7XX_GPIO4_BASE + SZ_2K - 1, @@ -156,13 +178,12 @@ static struct __initdata resource omap7xx_gpio4_resources[] = { }, }; -static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = { - .virtual_irq_start = IH_GPIO_BASE + 96, - .bank_type = METHOD_GPIO_7XX, +static struct omap_gpio_platform_data omap7xx_gpio4_config = { .bank_width = 32, + .regs = &omap7xx_gpio_regs, }; -static struct __initdata platform_device omap7xx_gpio4 = { +static struct platform_device omap7xx_gpio4 = { .name = "omap_gpio", .id = 4, .dev = { @@ -173,7 +194,7 @@ static struct __initdata platform_device omap7xx_gpio4 = { }; /* gpio5 */ -static struct __initdata resource omap7xx_gpio5_resources[] = { +static struct resource omap7xx_gpio5_resources[] = { { .start = OMAP7XX_GPIO5_BASE, .end = OMAP7XX_GPIO5_BASE + SZ_2K - 1, @@ -185,13 +206,12 @@ static struct __initdata resource omap7xx_gpio5_resources[] = { }, }; -static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = { - .virtual_irq_start = IH_GPIO_BASE + 128, - .bank_type = METHOD_GPIO_7XX, +static struct omap_gpio_platform_data omap7xx_gpio5_config = { .bank_width = 32, + .regs = &omap7xx_gpio_regs, }; -static struct __initdata platform_device omap7xx_gpio5 = { +static struct platform_device omap7xx_gpio5 = { .name = "omap_gpio", .id = 5, .dev = { @@ -202,7 +222,7 @@ static struct __initdata platform_device omap7xx_gpio5 = { }; /* gpio6 */ -static struct __initdata resource omap7xx_gpio6_resources[] = { +static struct resource omap7xx_gpio6_resources[] = { { .start = OMAP7XX_GPIO6_BASE, .end = OMAP7XX_GPIO6_BASE + SZ_2K - 1, @@ -214,13 +234,12 @@ static struct __initdata resource omap7xx_gpio6_resources[] = { }, }; -static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = { - .virtual_irq_start = IH_GPIO_BASE + 160, - .bank_type = METHOD_GPIO_7XX, +static struct omap_gpio_platform_data omap7xx_gpio6_config = { .bank_width = 32, + .regs = &omap7xx_gpio_regs, }; -static struct __initdata platform_device omap7xx_gpio6 = { +static struct platform_device omap7xx_gpio6 = { .name = "omap_gpio", .id = 6, .dev = { @@ -230,7 +249,7 @@ static struct __initdata platform_device omap7xx_gpio6 = { .resource = omap7xx_gpio6_resources, }; -static struct __initdata platform_device * omap7xx_gpio_dev[] = { +static struct platform_device *omap7xx_gpio_dev[] __initdata = { &omap7xx_mpu_gpio, &omap7xx_gpio1, &omap7xx_gpio2, @@ -255,8 +274,6 @@ static int __init omap7xx_gpio_init(void) for (i = 0; i < ARRAY_SIZE(omap7xx_gpio_dev); i++) platform_device_register(omap7xx_gpio_dev[i]); - gpio_bank_count = ARRAY_SIZE(omap7xx_gpio_dev); - return 0; } postcore_initcall(omap7xx_gpio_init); |
