diff options
Diffstat (limited to 'arch/arm/mach-u300/core.c')
-rw-r--r-- | arch/arm/mach-u300/core.c | 84 |
1 files changed, 82 insertions, 2 deletions
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index 399c89f14df..2f5929bdeaa 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
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> | ||
29 | #include <linux/pinctrl/pinmux.h> | ||
28 | 30 | ||
29 | #include <asm/types.h> | 31 | #include <asm/types.h> |
30 | #include <asm/setup.h> | 32 | #include <asm/setup.h> |
@@ -1535,6 +1537,14 @@ static struct coh901318_platform coh901318_platform = { | |||
1535 | .max_channels = U300_DMA_CHANNELS, | 1537 | .max_channels = U300_DMA_CHANNELS, |
1536 | }; | 1538 | }; |
1537 | 1539 | ||
1540 | static struct resource pinmux_resources[] = { | ||
1541 | { | ||
1542 | .start = U300_SYSCON_BASE, | ||
1543 | .end = U300_SYSCON_BASE + SZ_4K - 1, | ||
1544 | .flags = IORESOURCE_MEM, | ||
1545 | }, | ||
1546 | }; | ||
1547 | |||
1538 | static struct platform_device wdog_device = { | 1548 | static struct platform_device wdog_device = { |
1539 | .name = "coh901327_wdog", | 1549 | .name = "coh901327_wdog", |
1540 | .id = -1, | 1550 | .id = -1, |
@@ -1630,6 +1640,72 @@ static struct platform_device dma_device = { | |||
1630 | }, | 1640 | }, |
1631 | }; | 1641 | }; |
1632 | 1642 | ||
1643 | static struct platform_device pinmux_device = { | ||
1644 | .name = "pinmux-u300", | ||
1645 | .id = -1, | ||
1646 | .num_resources = ARRAY_SIZE(pinmux_resources), | ||
1647 | .resource = pinmux_resources, | ||
1648 | }; | ||
1649 | |||
1650 | /* Pinmux settings */ | ||
1651 | static struct pinmux_map u300_pinmux_map[] = { | ||
1652 | /* anonymous maps for chip power and EMIFs */ | ||
1653 | PINMUX_MAP_PRIMARY_SYS_HOG("POWER", "power"), | ||
1654 | PINMUX_MAP_PRIMARY_SYS_HOG("EMIF0", "emif0"), | ||
1655 | PINMUX_MAP_PRIMARY_SYS_HOG("EMIF1", "emif1"), | ||
1656 | /* per-device maps for MMC/SD, SPI and UART */ | ||
1657 | PINMUX_MAP_PRIMARY("MMCSD", "mmc0", "mmci"), | ||
1658 | PINMUX_MAP_PRIMARY("SPI", "spi0", "pl022"), | ||
1659 | PINMUX_MAP_PRIMARY("UART0", "uart0", "uart0"), | ||
1660 | }; | ||
1661 | |||
1662 | struct u300_mux_hog { | ||
1663 | const char *name; | ||
1664 | struct device *dev; | ||
1665 | struct pinmux *pmx; | ||
1666 | }; | ||
1667 | |||
1668 | static struct u300_mux_hog u300_mux_hogs[] = { | ||
1669 | { | ||
1670 | .name = "uart0", | ||
1671 | .dev = &uart0_device.dev, | ||
1672 | }, | ||
1673 | { | ||
1674 | .name = "spi0", | ||
1675 | .dev = &pl022_device.dev, | ||
1676 | }, | ||
1677 | { | ||
1678 | .name = "mmc0", | ||
1679 | .dev = &mmcsd_device.dev, | ||
1680 | }, | ||
1681 | }; | ||
1682 | |||
1683 | static int __init u300_pinmux_fetch(void) | ||
1684 | { | ||
1685 | int i; | ||
1686 | |||
1687 | for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) { | ||
1688 | struct pinmux *pmx; | ||
1689 | int ret; | ||
1690 | |||
1691 | pmx = pinmux_get(u300_mux_hogs[i].dev, NULL); | ||
1692 | if (IS_ERR(pmx)) { | ||
1693 | pr_err("u300: could not get pinmux hog %s\n", | ||
1694 | u300_mux_hogs[i].name); | ||
1695 | continue; | ||
1696 | } | ||
1697 | ret = pinmux_enable(pmx); | ||
1698 | if (ret) { | ||
1699 | pr_err("u300: could enable pinmux hog %s\n", | ||
1700 | u300_mux_hogs[i].name); | ||
1701 | continue; | ||
1702 | } | ||
1703 | u300_mux_hogs[i].pmx = pmx; | ||
1704 | } | ||
1705 | return 0; | ||
1706 | } | ||
1707 | subsys_initcall(u300_pinmux_fetch); | ||
1708 | |||
1633 | /* | 1709 | /* |
1634 | * Notice that AMBA devices are initialized before platform devices. | 1710 | * Notice that AMBA devices are initialized before platform devices. |
1635 | * | 1711 | * |
@@ -1643,10 +1719,10 @@ static struct platform_device *platform_devs[] __initdata = { | |||
1643 | &gpio_device, | 1719 | &gpio_device, |
1644 | &nand_device, | 1720 | &nand_device, |
1645 | &wdog_device, | 1721 | &wdog_device, |
1646 | &ave_device | 1722 | &ave_device, |
1723 | &pinmux_device, | ||
1647 | }; | 1724 | }; |
1648 | 1725 | ||
1649 | |||
1650 | /* | 1726 | /* |
1651 | * Interrupts: the U300 platforms have two pl190 ARM PrimeCells connected | 1727 | * Interrupts: the U300 platforms have two pl190 ARM PrimeCells connected |
1652 | * together so some interrupts are connected to the first one and some | 1728 | * together so some interrupts are connected to the first one and some |
@@ -1828,6 +1904,10 @@ void __init u300_init_devices(void) | |||
1828 | 1904 | ||
1829 | u300_assign_physmem(); | 1905 | u300_assign_physmem(); |
1830 | 1906 | ||
1907 | /* Initialize pinmuxing */ | ||
1908 | pinmux_register_mappings(u300_pinmux_map, | ||
1909 | ARRAY_SIZE(u300_pinmux_map)); | ||
1910 | |||
1831 | /* Register subdevices on the I2C buses */ | 1911 | /* Register subdevices on the I2C buses */ |
1832 | u300_i2c_register_board_devices(); | 1912 | u300_i2c_register_board_devices(); |
1833 | 1913 | ||