aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-u300/core.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2011-09-08 04:04:51 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-09-08 05:03:56 -0400
commitcc890cd78acd7ab03442907d354b6af34e973cb3 (patch)
tree67cf73ea730969ffc26c3a5c55de8d96bb8b6299 /arch/arm/mach-u300/core.c
parent526a0dc771a5cac3224e26abd1f018976b967516 (diff)
ARM: 7083/1: rewrite U300 GPIO to use gpiolib
This rewrites the U300 GPIO so as to use gpiolib and struct gpio_chip instead of just generic GPIO, hiding all the platform specifics and passing in GPIO chip variant as platform data at runtime instead of the compiletime kludges. As a result <mach/gpio.h> is now empty for U300 and using just defaults. Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Debian kernel maintainers <debian-kernel@lists.debian.org> Cc: Arnaud Patard <arnaud.patard@rtp-net.org> Reported-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-u300/core.c')
-rw-r--r--arch/arm/mach-u300/core.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 399c89f14df..fd435f44098 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -37,6 +37,7 @@
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/syscon.h> 38#include <mach/syscon.h>
39#include <mach/dma_channels.h> 39#include <mach/dma_channels.h>
40#include <mach/gpio-u300.h>
40 41
41#include "clock.h" 42#include "clock.h"
42#include "mmc.h" 43#include "mmc.h"
@@ -239,7 +240,7 @@ static struct resource gpio_resources[] = {
239 .end = IRQ_U300_GPIO_PORT2, 240 .end = IRQ_U300_GPIO_PORT2,
240 .flags = IORESOURCE_IRQ, 241 .flags = IORESOURCE_IRQ,
241 }, 242 },
242#ifdef U300_COH901571_3 243#if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
243 { 244 {
244 .name = "gpio3", 245 .name = "gpio3",
245 .start = IRQ_U300_GPIO_PORT3, 246 .start = IRQ_U300_GPIO_PORT3,
@@ -252,6 +253,7 @@ static struct resource gpio_resources[] = {
252 .end = IRQ_U300_GPIO_PORT4, 253 .end = IRQ_U300_GPIO_PORT4,
253 .flags = IORESOURCE_IRQ, 254 .flags = IORESOURCE_IRQ,
254 }, 255 },
256#endif
255#ifdef CONFIG_MACH_U300_BS335 257#ifdef CONFIG_MACH_U300_BS335
256 { 258 {
257 .name = "gpio5", 259 .name = "gpio5",
@@ -266,7 +268,6 @@ static struct resource gpio_resources[] = {
266 .flags = IORESOURCE_IRQ, 268 .flags = IORESOURCE_IRQ,
267 }, 269 },
268#endif /* CONFIG_MACH_U300_BS335 */ 270#endif /* CONFIG_MACH_U300_BS335 */
269#endif /* U300_COH901571_3 */
270}; 271};
271 272
272static struct resource keypad_resources[] = { 273static struct resource keypad_resources[] = {
@@ -1556,11 +1557,35 @@ static struct platform_device i2c1_device = {
1556 .resource = i2c1_resources, 1557 .resource = i2c1_resources,
1557}; 1558};
1558 1559
1560/*
1561 * The different variants have a few different versions of the
1562 * GPIO block, with different number of ports.
1563 */
1564static struct u300_gpio_platform u300_gpio_plat = {
1565#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
1566 .variant = U300_GPIO_COH901335,
1567 .ports = 3,
1568#endif
1569#ifdef CONFIG_MACH_U300_BS335
1570 .variant = U300_GPIO_COH901571_3_BS335,
1571 .ports = 7,
1572#endif
1573#ifdef CONFIG_MACH_U300_BS365
1574 .variant = U300_GPIO_COH901571_3_BS365,
1575 .ports = 5,
1576#endif
1577 .gpio_base = 0,
1578 .gpio_irq_base = IRQ_U300_GPIO_BASE,
1579};
1580
1559static struct platform_device gpio_device = { 1581static struct platform_device gpio_device = {
1560 .name = "u300-gpio", 1582 .name = "u300-gpio",
1561 .id = -1, 1583 .id = -1,
1562 .num_resources = ARRAY_SIZE(gpio_resources), 1584 .num_resources = ARRAY_SIZE(gpio_resources),
1563 .resource = gpio_resources, 1585 .resource = gpio_resources,
1586 .dev = {
1587 .platform_data = &u300_gpio_plat,
1588 },
1564}; 1589};
1565 1590
1566static struct platform_device keypad_device = { 1591static struct platform_device keypad_device = {
@@ -1666,7 +1691,7 @@ void __init u300_init_irq(void)
1666 BUG_ON(IS_ERR(clk)); 1691 BUG_ON(IS_ERR(clk));
1667 clk_enable(clk); 1692 clk_enable(clk);
1668 1693
1669 for (i = 0; i < NR_IRQS; i++) 1694 for (i = 0; i < U300_VIC_IRQS_END; i++)
1670 set_bit(i, (unsigned long *) &mask[0]); 1695 set_bit(i, (unsigned long *) &mask[0]);
1671 vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]); 1696 vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]);
1672 vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]); 1697 vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]);