diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-tegra/Kconfig | 4 | ||||
-rw-r--r-- | arch/arm/mach-tegra/include/mach/pinconf-tegra.h | 63 | ||||
-rw-r--r-- | arch/arm/mach-u300/core.c | 80 | ||||
-rw-r--r-- | arch/arm/mach-u300/include/mach/gpio-u300.h | 2 |
4 files changed, 111 insertions, 38 deletions
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 373652d76b90..32b420a90c3d 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig | |||
@@ -7,6 +7,8 @@ config ARCH_TEGRA_2x_SOC | |||
7 | select CPU_V7 | 7 | select CPU_V7 |
8 | select ARM_GIC | 8 | select ARM_GIC |
9 | select ARCH_REQUIRE_GPIOLIB | 9 | select ARCH_REQUIRE_GPIOLIB |
10 | select PINCTRL | ||
11 | select PINCTRL_TEGRA20 | ||
10 | select USB_ARCH_HAS_EHCI if USB_SUPPORT | 12 | select USB_ARCH_HAS_EHCI if USB_SUPPORT |
11 | select USB_ULPI if USB_SUPPORT | 13 | select USB_ULPI if USB_SUPPORT |
12 | select USB_ULPI_VIEWPORT if USB_SUPPORT | 14 | select USB_ULPI_VIEWPORT if USB_SUPPORT |
@@ -19,6 +21,8 @@ config ARCH_TEGRA_3x_SOC | |||
19 | select CPU_V7 | 21 | select CPU_V7 |
20 | select ARM_GIC | 22 | select ARM_GIC |
21 | select ARCH_REQUIRE_GPIOLIB | 23 | select ARCH_REQUIRE_GPIOLIB |
24 | select PINCTRL | ||
25 | select PINCTRL_TEGRA30 | ||
22 | select USB_ARCH_HAS_EHCI if USB_SUPPORT | 26 | select USB_ARCH_HAS_EHCI if USB_SUPPORT |
23 | select USB_ULPI if USB_SUPPORT | 27 | select USB_ULPI if USB_SUPPORT |
24 | select USB_ULPI_VIEWPORT if USB_SUPPORT | 28 | select USB_ULPI_VIEWPORT if USB_SUPPORT |
diff --git a/arch/arm/mach-tegra/include/mach/pinconf-tegra.h b/arch/arm/mach-tegra/include/mach/pinconf-tegra.h new file mode 100644 index 000000000000..1f24d304921e --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/pinconf-tegra.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * pinctrl configuration definitions for the NVIDIA Tegra pinmux | ||
3 | * | ||
4 | * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef __PINCONF_TEGRA_H__ | ||
17 | #define __PINCONF_TEGRA_H__ | ||
18 | |||
19 | enum tegra_pinconf_param { | ||
20 | /* argument: tegra_pinconf_pull */ | ||
21 | TEGRA_PINCONF_PARAM_PULL, | ||
22 | /* argument: tegra_pinconf_tristate */ | ||
23 | TEGRA_PINCONF_PARAM_TRISTATE, | ||
24 | /* argument: Boolean */ | ||
25 | TEGRA_PINCONF_PARAM_ENABLE_INPUT, | ||
26 | /* argument: Boolean */ | ||
27 | TEGRA_PINCONF_PARAM_OPEN_DRAIN, | ||
28 | /* argument: Boolean */ | ||
29 | TEGRA_PINCONF_PARAM_LOCK, | ||
30 | /* argument: Boolean */ | ||
31 | TEGRA_PINCONF_PARAM_IORESET, | ||
32 | /* argument: Boolean */ | ||
33 | TEGRA_PINCONF_PARAM_HIGH_SPEED_MODE, | ||
34 | /* argument: Boolean */ | ||
35 | TEGRA_PINCONF_PARAM_SCHMITT, | ||
36 | /* argument: Boolean */ | ||
37 | TEGRA_PINCONF_PARAM_LOW_POWER_MODE, | ||
38 | /* argument: Integer, range is HW-dependant */ | ||
39 | TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH, | ||
40 | /* argument: Integer, range is HW-dependant */ | ||
41 | TEGRA_PINCONF_PARAM_DRIVE_UP_STRENGTH, | ||
42 | /* argument: Integer, range is HW-dependant */ | ||
43 | TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING, | ||
44 | /* argument: Integer, range is HW-dependant */ | ||
45 | TEGRA_PINCONF_PARAM_SLEW_RATE_RISING, | ||
46 | }; | ||
47 | |||
48 | enum tegra_pinconf_pull { | ||
49 | TEGRA_PINCONFIG_PULL_NONE, | ||
50 | TEGRA_PINCONFIG_PULL_DOWN, | ||
51 | TEGRA_PINCONFIG_PULL_UP, | ||
52 | }; | ||
53 | |||
54 | enum tegra_pinconf_tristate { | ||
55 | TEGRA_PINCONFIG_DRIVEN, | ||
56 | TEGRA_PINCONFIG_TRISTATE, | ||
57 | }; | ||
58 | |||
59 | #define TEGRA_PINCONF_PACK(_param_, _arg_) ((_param_) << 16 | (_arg_)) | ||
60 | #define TEGRA_PINCONF_UNPACK_PARAM(_conf_) ((_conf_) >> 16) | ||
61 | #define TEGRA_PINCONF_UNPACK_ARG(_conf_) ((_conf_) & 0xffff) | ||
62 | |||
63 | #endif | ||
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 | ||
1480 | static struct resource pinmux_resources[] = { | 1481 | static 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 | ||
1510 | static 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 | ||
1530 | static struct platform_device gpio_device = { | 1539 | static struct platform_device gpio_device = { |
@@ -1597,71 +1606,67 @@ static struct platform_device dma_device = { | |||
1597 | }, | 1606 | }, |
1598 | }; | 1607 | }; |
1599 | 1608 | ||
1600 | static struct platform_device pinmux_device = { | 1609 | static 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 */ | 1613 | static unsigned long pin_highz_conf[] = { |
1608 | static struct pinmux_map __initdata u300_pinmux_map[] = { | 1614 | PIN_CONF_PACKED(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0), |
1615 | }; | ||
1616 | |||
1617 | /* Pin control settings */ | ||
1618 | static 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 | ||
1619 | struct u300_mux_hog { | 1635 | struct 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 | ||
1625 | static struct u300_mux_hog u300_mux_hogs[] = { | 1640 | static 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 | ||
1640 | static int __init u300_pinmux_fetch(void) | 1652 | static 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 | } |
1664 | subsys_initcall(u300_pinmux_fetch); | 1669 | subsys_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 | */ |
28 | struct u300_gpio_platform { | 29 | struct 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 */ |