aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-u300
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-02-21 08:31:45 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-02-22 11:59:33 -0500
commit128a06d4bb997d90158e668173a6944d376c84cb (patch)
treecbfe9ed922f93fa4132d8d6db6e3a22aeb8637fa /arch/arm/mach-u300
parent4ecce45dd663f6945bed7e2e06c05b5d90f3a2a1 (diff)
pinctrl: spawn U300 pinctrl from the COH901 GPIO
This solves the riddle on how the U300 pin controller shall be able to reference the struct gpio_chip even though these are two separate drivers: spawn the pinctrl child from the GPIO driver and pass in the struct gpio_chip as platform data. In the process we rename the U300 "pinmux-u300" to "pinctrl-u300" so as not to confuse. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-u300')
-rw-r--r--arch/arm/mach-u300/core.c30
-rw-r--r--arch/arm/mach-u300/include/mach/gpio-u300.h2
2 files changed, 17 insertions, 15 deletions
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index bb1034f8c2f..030b2c0d322 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -1477,7 +1477,7 @@ static struct coh901318_platform coh901318_platform = {
1477 .max_channels = U300_DMA_CHANNELS, 1477 .max_channels = U300_DMA_CHANNELS,
1478}; 1478};
1479 1479
1480static struct resource pinmux_resources[] = { 1480static struct resource pinctrl_resources[] = {
1481 { 1481 {
1482 .start = U300_SYSCON_BASE, 1482 .start = U300_SYSCON_BASE,
1483 .end = U300_SYSCON_BASE + SZ_4K - 1, 1483 .end = U300_SYSCON_BASE + SZ_4K - 1,
@@ -1506,6 +1506,13 @@ static struct platform_device i2c1_device = {
1506 .resource = i2c1_resources, 1506 .resource = i2c1_resources,
1507}; 1507};
1508 1508
1509static struct platform_device pinctrl_device = {
1510 .name = "pinctrl-u300",
1511 .id = -1,
1512 .num_resources = ARRAY_SIZE(pinctrl_resources),
1513 .resource = pinctrl_resources,
1514};
1515
1509/* 1516/*
1510 * The different variants have a few different versions of the 1517 * The different variants have a few different versions of the
1511 * GPIO block, with different number of ports. 1518 * GPIO block, with different number of ports.
@@ -1525,6 +1532,7 @@ static struct u300_gpio_platform u300_gpio_plat = {
1525#endif 1532#endif
1526 .gpio_base = 0, 1533 .gpio_base = 0,
1527 .gpio_irq_base = IRQ_U300_GPIO_BASE, 1534 .gpio_irq_base = IRQ_U300_GPIO_BASE,
1535 .pinctrl_device = &pinctrl_device,
1528}; 1536};
1529 1537
1530static struct platform_device gpio_device = { 1538static struct platform_device gpio_device = {
@@ -1597,23 +1605,16 @@ static struct platform_device dma_device = {
1597 }, 1605 },
1598}; 1606};
1599 1607
1600static struct platform_device pinmux_device = {
1601 .name = "pinmux-u300",
1602 .id = -1,
1603 .num_resources = ARRAY_SIZE(pinmux_resources),
1604 .resource = pinmux_resources,
1605};
1606
1607/* Pinmux settings */ 1608/* Pinmux settings */
1608static struct pinctrl_map __initdata u300_pinmux_map[] = { 1609static struct pinctrl_map __initdata u300_pinmux_map[] = {
1609 /* anonymous maps for chip power and EMIFs */ 1610 /* anonymous maps for chip power and EMIFs */
1610 PIN_MAP_SYS_HOG("POWER", "pinmux-u300", "power"), 1611 PIN_MAP_SYS_HOG("POWER", "pinctrl-u300", "power"),
1611 PIN_MAP_SYS_HOG("EMIF0", "pinmux-u300", "emif0"), 1612 PIN_MAP_SYS_HOG("EMIF0", "pinctrl-u300", "emif0"),
1612 PIN_MAP_SYS_HOG("EMIF1", "pinmux-u300", "emif1"), 1613 PIN_MAP_SYS_HOG("EMIF1", "pinctrl-u300", "emif1"),
1613 /* per-device maps for MMC/SD, SPI and UART */ 1614 /* per-device maps for MMC/SD, SPI and UART */
1614 PIN_MAP("MMCSD", "pinmux-u300", "mmc0", "mmci"), 1615 PIN_MAP("MMCSD", "pinctrl-u300", "mmc0", "mmci"),
1615 PIN_MAP("SPI", "pinmux-u300", "spi0", "pl022"), 1616 PIN_MAP("SPI", "pinctrl-u300", "spi0", "pl022"),
1616 PIN_MAP("UART0", "pinmux-u300", "uart0", "uart0"), 1617 PIN_MAP("UART0", "pinctrl-u300", "uart0", "uart0"),
1617}; 1618};
1618 1619
1619struct u300_mux_hog { 1620struct u300_mux_hog {
@@ -1676,7 +1677,6 @@ static struct platform_device *platform_devs[] __initdata = {
1676 &gpio_device, 1677 &gpio_device,
1677 &nand_device, 1678 &nand_device,
1678 &wdog_device, 1679 &wdog_device,
1679 &pinmux_device,
1680}; 1680};
1681 1681
1682/* 1682/*
diff --git a/arch/arm/mach-u300/include/mach/gpio-u300.h b/arch/arm/mach-u300/include/mach/gpio-u300.h
index bf4c7935aec..e81400c1753 100644
--- a/arch/arm/mach-u300/include/mach/gpio-u300.h
+++ b/arch/arm/mach-u300/include/mach/gpio-u300.h
@@ -24,12 +24,14 @@ enum u300_gpio_variant {
24 * @ports: number of GPIO block ports 24 * @ports: number of GPIO block ports
25 * @gpio_base: first GPIO number for this block (use a free range) 25 * @gpio_base: first GPIO number for this block (use a free range)
26 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range) 26 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
27 * @pinctrl_device: pin control device to spawn as child
27 */ 28 */
28struct u300_gpio_platform { 29struct u300_gpio_platform {
29 enum u300_gpio_variant variant; 30 enum u300_gpio_variant variant;
30 u8 ports; 31 u8 ports;
31 int gpio_base; 32 int gpio_base;
32 int gpio_irq_base; 33 int gpio_irq_base;
34 struct platform_device *pinctrl_device;
33}; 35};
34 36
35#endif /* __MACH_U300_GPIO_U300_H */ 37#endif /* __MACH_U300_GPIO_U300_H */