aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-u300
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 23:25:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 23:25:50 -0400
commit7fc86a7908a4e9eb2da4b6498f86193d113842d3 (patch)
treec1b2faab48d2a6003c8e8efae5f356a4e792ce0a /arch/arm/mach-u300
parent90597b6cfc1fc9926a4d54f09bbf5b3254b1b028 (diff)
parent51dddfe839a0ebcb5ff61a779e3f2768714f9957 (diff)
Merge tag 'pinctrl-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pinctrl updates for v3.4 from Linus Walleij (*): - Switches the PXA 168, 910 and MMP over to use pinctrl - Locking revamped - Massive refactorings... - Reform the driver API to use multiple states - Support pin config in the mapping tables - Pinctrl drivers for the nVidia Tegra series - Generic pin config support lib for simple pin controllers - Implement pin config for the U300 * tag 'pinctrl-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (48 commits) ARM: u300: configure some pins as an example pinctrl: support pinconfig on the U300 pinctrl/coh901: use generic pinconf enums and parameters pinctrl: introduce generic pin config pinctrl: fix error path in pinconf_map_to_setting() pinctrl: allow concurrent gpio and mux function ownership of pins pinctrl: forward-declare struct device pinctrl: split pincontrol states into its own header pinctrl: include machine header to core.h ARM: tegra: Select PINCTRL Kconfig variables pinctrl: add a driver for NVIDIA Tegra pinctrl: Show selected function and group in pinmux-pins debugfs pinctrl: enhance mapping table to support pin config operations pinctrl: API changes to support multiple states per device pinctrl: add usecount to pins for muxing pinctrl: refactor struct pinctrl handling in core.c vs pinmux.c pinctrl: fix and simplify locking pinctrl: fix the pin descriptor kerneldoc pinctrl: assume map table entries can't have a NULL name field pinctrl: introduce PINCTRL_STATE_DEFAULT, define hogs as that state ... (*) What is it with all these Linuses these days? There's a Linus at google too. Some day I will get myself my own broadsword, and run around screaming "There can be only one". I used to be _special_ dammit. Snif.
Diffstat (limited to 'arch/arm/mach-u300')
-rw-r--r--arch/arm/mach-u300/core.c80
-rw-r--r--arch/arm/mach-u300/include/mach/gpio-u300.h2
2 files changed, 44 insertions, 38 deletions
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index b4c6926a700c..a7b3f36e2262 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -26,7 +26,8 @@
26#include <linux/mtd/nand.h> 26#include <linux/mtd/nand.h>
27#include <linux/mtd/fsmc.h> 27#include <linux/mtd/fsmc.h>
28#include <linux/pinctrl/machine.h> 28#include <linux/pinctrl/machine.h>
29#include <linux/pinctrl/pinmux.h> 29#include <linux/pinctrl/consumer.h>
30#include <linux/pinctrl/pinconf-generic.h>
30#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
31 32
32#include <asm/types.h> 33#include <asm/types.h>
@@ -1477,7 +1478,7 @@ static struct coh901318_platform coh901318_platform = {
1477 .max_channels = U300_DMA_CHANNELS, 1478 .max_channels = U300_DMA_CHANNELS,
1478}; 1479};
1479 1480
1480static struct resource pinmux_resources[] = { 1481static struct resource pinctrl_resources[] = {
1481 { 1482 {
1482 .start = U300_SYSCON_BASE, 1483 .start = U300_SYSCON_BASE,
1483 .end = U300_SYSCON_BASE + SZ_4K - 1, 1484 .end = U300_SYSCON_BASE + SZ_4K - 1,
@@ -1506,6 +1507,13 @@ static struct platform_device i2c1_device = {
1506 .resource = i2c1_resources, 1507 .resource = i2c1_resources,
1507}; 1508};
1508 1509
1510static struct platform_device pinctrl_device = {
1511 .name = "pinctrl-u300",
1512 .id = -1,
1513 .num_resources = ARRAY_SIZE(pinctrl_resources),
1514 .resource = pinctrl_resources,
1515};
1516
1509/* 1517/*
1510 * The different variants have a few different versions of the 1518 * The different variants have a few different versions of the
1511 * GPIO block, with different number of ports. 1519 * GPIO block, with different number of ports.
@@ -1525,6 +1533,7 @@ static struct u300_gpio_platform u300_gpio_plat = {
1525#endif 1533#endif
1526 .gpio_base = 0, 1534 .gpio_base = 0,
1527 .gpio_irq_base = IRQ_U300_GPIO_BASE, 1535 .gpio_irq_base = IRQ_U300_GPIO_BASE,
1536 .pinctrl_device = &pinctrl_device,
1528}; 1537};
1529 1538
1530static struct platform_device gpio_device = { 1539static struct platform_device gpio_device = {
@@ -1597,71 +1606,67 @@ static struct platform_device dma_device = {
1597 }, 1606 },
1598}; 1607};
1599 1608
1600static struct platform_device pinmux_device = { 1609static unsigned long pin_pullup_conf[] = {
1601 .name = "pinmux-u300", 1610 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 1),
1602 .id = -1,
1603 .num_resources = ARRAY_SIZE(pinmux_resources),
1604 .resource = pinmux_resources,
1605}; 1611};
1606 1612
1607/* Pinmux settings */ 1613static unsigned long pin_highz_conf[] = {
1608static struct pinmux_map __initdata u300_pinmux_map[] = { 1614 PIN_CONF_PACKED(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0),
1615};
1616
1617/* Pin control settings */
1618static struct pinctrl_map __initdata u300_pinmux_map[] = {
1609 /* anonymous maps for chip power and EMIFs */ 1619 /* anonymous maps for chip power and EMIFs */
1610 PINMUX_MAP_SYS_HOG("POWER", "pinmux-u300", "power"), 1620 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "power"),
1611 PINMUX_MAP_SYS_HOG("EMIF0", "pinmux-u300", "emif0"), 1621 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif0"),
1612 PINMUX_MAP_SYS_HOG("EMIF1", "pinmux-u300", "emif1"), 1622 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif1"),
1613 /* per-device maps for MMC/SD, SPI and UART */ 1623 /* per-device maps for MMC/SD, SPI and UART */
1614 PINMUX_MAP("MMCSD", "pinmux-u300", "mmc0", "mmci"), 1624 PIN_MAP_MUX_GROUP_DEFAULT("mmci", "pinctrl-u300", NULL, "mmc0"),
1615 PINMUX_MAP("SPI", "pinmux-u300", "spi0", "pl022"), 1625 PIN_MAP_MUX_GROUP_DEFAULT("pl022", "pinctrl-u300", NULL, "spi0"),
1616 PINMUX_MAP("UART0", "pinmux-u300", "uart0", "uart0"), 1626 PIN_MAP_MUX_GROUP_DEFAULT("uart0", "pinctrl-u300", NULL, "uart0"),
1627 /* This pin is used for clock return rather than GPIO */
1628 PIN_MAP_CONFIGS_PIN_DEFAULT("mmci", "pinctrl-u300", "PIO APP GPIO 11",
1629 pin_pullup_conf),
1630 /* This pin is used for card detect */
1631 PIN_MAP_CONFIGS_PIN_DEFAULT("mmci", "pinctrl-u300", "PIO MS INS",
1632 pin_highz_conf),
1617}; 1633};
1618 1634
1619struct u300_mux_hog { 1635struct u300_mux_hog {
1620 const char *name;
1621 struct device *dev; 1636 struct device *dev;
1622 struct pinmux *pmx; 1637 struct pinctrl *p;
1623}; 1638};
1624 1639
1625static struct u300_mux_hog u300_mux_hogs[] = { 1640static struct u300_mux_hog u300_mux_hogs[] = {
1626 { 1641 {
1627 .name = "uart0",
1628 .dev = &uart0_device.dev, 1642 .dev = &uart0_device.dev,
1629 }, 1643 },
1630 { 1644 {
1631 .name = "spi0",
1632 .dev = &pl022_device.dev, 1645 .dev = &pl022_device.dev,
1633 }, 1646 },
1634 { 1647 {
1635 .name = "mmc0",
1636 .dev = &mmcsd_device.dev, 1648 .dev = &mmcsd_device.dev,
1637 }, 1649 },
1638}; 1650};
1639 1651
1640static int __init u300_pinmux_fetch(void) 1652static int __init u300_pinctrl_fetch(void)
1641{ 1653{
1642 int i; 1654 int i;
1643 1655
1644 for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) { 1656 for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) {
1645 struct pinmux *pmx; 1657 struct pinctrl *p;
1646 int ret;
1647 1658
1648 pmx = pinmux_get(u300_mux_hogs[i].dev, NULL); 1659 p = pinctrl_get_select_default(u300_mux_hogs[i].dev);
1649 if (IS_ERR(pmx)) { 1660 if (IS_ERR(p)) {
1650 pr_err("u300: could not get pinmux hog %s\n", 1661 pr_err("u300: could not get pinmux hog for dev %s\n",
1651 u300_mux_hogs[i].name); 1662 dev_name(u300_mux_hogs[i].dev));
1652 continue;
1653 }
1654 ret = pinmux_enable(pmx);
1655 if (ret) {
1656 pr_err("u300: could enable pinmux hog %s\n",
1657 u300_mux_hogs[i].name);
1658 continue; 1663 continue;
1659 } 1664 }
1660 u300_mux_hogs[i].pmx = pmx; 1665 u300_mux_hogs[i].p = p;
1661 } 1666 }
1662 return 0; 1667 return 0;
1663} 1668}
1664subsys_initcall(u300_pinmux_fetch); 1669subsys_initcall(u300_pinctrl_fetch);
1665 1670
1666/* 1671/*
1667 * Notice that AMBA devices are initialized before platform devices. 1672 * Notice that AMBA devices are initialized before platform devices.
@@ -1676,7 +1681,6 @@ static struct platform_device *platform_devs[] __initdata = {
1676 &gpio_device, 1681 &gpio_device,
1677 &nand_device, 1682 &nand_device,
1678 &wdog_device, 1683 &wdog_device,
1679 &pinmux_device,
1680}; 1684};
1681 1685
1682/* 1686/*
@@ -1861,8 +1865,8 @@ void __init u300_init_devices(void)
1861 u300_assign_physmem(); 1865 u300_assign_physmem();
1862 1866
1863 /* Initialize pinmuxing */ 1867 /* Initialize pinmuxing */
1864 pinmux_register_mappings(u300_pinmux_map, 1868 pinctrl_register_mappings(u300_pinmux_map,
1865 ARRAY_SIZE(u300_pinmux_map)); 1869 ARRAY_SIZE(u300_pinmux_map));
1866 1870
1867 /* Register subdevices on the I2C buses */ 1871 /* Register subdevices on the I2C buses */
1868 u300_i2c_register_board_devices(); 1872 u300_i2c_register_board_devices();
diff --git a/arch/arm/mach-u300/include/mach/gpio-u300.h b/arch/arm/mach-u300/include/mach/gpio-u300.h
index bf4c7935aecd..e81400c1753a 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 */