diff options
Diffstat (limited to 'arch/arm/mach-u300')
-rw-r--r-- | arch/arm/mach-u300/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-u300/core.c | 118 | ||||
-rw-r--r-- | arch/arm/mach-u300/i2c.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-u300/include/mach/gpio-u300.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-u300/mmc.c | 52 | ||||
-rw-r--r-- | arch/arm/mach-u300/mmc.h | 18 |
6 files changed, 65 insertions, 128 deletions
diff --git a/arch/arm/mach-u300/Makefile b/arch/arm/mach-u300/Makefile index 285538124e5e..fd3a5c382f47 100644 --- a/arch/arm/mach-u300/Makefile +++ b/arch/arm/mach-u300/Makefile | |||
@@ -8,7 +8,6 @@ obj-n := | |||
8 | obj- := | 8 | obj- := |
9 | 9 | ||
10 | obj-$(CONFIG_ARCH_U300) += u300.o | 10 | obj-$(CONFIG_ARCH_U300) += u300.o |
11 | obj-$(CONFIG_MMC) += mmc.o | ||
12 | obj-$(CONFIG_SPI_PL022) += spi.o | 11 | obj-$(CONFIG_SPI_PL022) += spi.o |
13 | obj-$(CONFIG_MACH_U300_SPIDUMMY) += dummyspichip.o | 12 | obj-$(CONFIG_MACH_U300_SPIDUMMY) += dummyspichip.o |
14 | obj-$(CONFIG_I2C_STU300) += i2c.o | 13 | obj-$(CONFIG_I2C_STU300) += i2c.o |
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index b9865605da09..8b90c44d237f 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/termios.h> | 18 | #include <linux/termios.h> |
19 | #include <linux/dmaengine.h> | 19 | #include <linux/dmaengine.h> |
20 | #include <linux/amba/bus.h> | 20 | #include <linux/amba/bus.h> |
21 | #include <linux/amba/mmci.h> | ||
21 | #include <linux/amba/serial.h> | 22 | #include <linux/amba/serial.h> |
22 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
23 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
@@ -26,7 +27,8 @@ | |||
26 | #include <linux/mtd/nand.h> | 27 | #include <linux/mtd/nand.h> |
27 | #include <linux/mtd/fsmc.h> | 28 | #include <linux/mtd/fsmc.h> |
28 | #include <linux/pinctrl/machine.h> | 29 | #include <linux/pinctrl/machine.h> |
29 | #include <linux/pinctrl/pinmux.h> | 30 | #include <linux/pinctrl/consumer.h> |
31 | #include <linux/pinctrl/pinconf-generic.h> | ||
30 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
31 | 33 | ||
32 | #include <asm/types.h> | 34 | #include <asm/types.h> |
@@ -43,9 +45,9 @@ | |||
43 | #include <mach/gpio-u300.h> | 45 | #include <mach/gpio-u300.h> |
44 | 46 | ||
45 | #include "clock.h" | 47 | #include "clock.h" |
46 | #include "mmc.h" | ||
47 | #include "spi.h" | 48 | #include "spi.h" |
48 | #include "i2c.h" | 49 | #include "i2c.h" |
50 | #include "u300-gpio.h" | ||
49 | 51 | ||
50 | /* | 52 | /* |
51 | * Static I/O mappings that are needed for booting the U300 platforms. The | 53 | * Static I/O mappings that are needed for booting the U300 platforms. The |
@@ -116,11 +118,6 @@ static AMBA_APB_DEVICE(uart1, "uart1", 0, U300_UART1_BASE, | |||
116 | /* AHB device at 0x4000 offset */ | 118 | /* AHB device at 0x4000 offset */ |
117 | static AMBA_APB_DEVICE(pl172, "pl172", 0, U300_EMIF_CFG_BASE, { }, NULL); | 119 | static AMBA_APB_DEVICE(pl172, "pl172", 0, U300_EMIF_CFG_BASE, { }, NULL); |
118 | 120 | ||
119 | |||
120 | /* | ||
121 | * Everything within this next ifdef deals with external devices connected to | ||
122 | * the APP SPI bus. | ||
123 | */ | ||
124 | /* Fast device at 0x6000 offset */ | 121 | /* Fast device at 0x6000 offset */ |
125 | static AMBA_APB_DEVICE(pl022, "pl022", 0, U300_SPI_BASE, | 122 | static AMBA_APB_DEVICE(pl022, "pl022", 0, U300_SPI_BASE, |
126 | { IRQ_U300_SPI }, NULL); | 123 | { IRQ_U300_SPI }, NULL); |
@@ -128,8 +125,26 @@ static AMBA_APB_DEVICE(pl022, "pl022", 0, U300_SPI_BASE, | |||
128 | /* Fast device at 0x1000 offset */ | 125 | /* Fast device at 0x1000 offset */ |
129 | #define U300_MMCSD_IRQS { IRQ_U300_MMCSD_MCIINTR0, IRQ_U300_MMCSD_MCIINTR1 } | 126 | #define U300_MMCSD_IRQS { IRQ_U300_MMCSD_MCIINTR0, IRQ_U300_MMCSD_MCIINTR1 } |
130 | 127 | ||
128 | static struct mmci_platform_data mmcsd_platform_data = { | ||
129 | /* | ||
130 | * Do not set ocr_mask or voltage translation function, | ||
131 | * we have a regulator we can control instead. | ||
132 | */ | ||
133 | .f_max = 24000000, | ||
134 | .gpio_wp = -1, | ||
135 | .gpio_cd = U300_GPIO_PIN_MMC_CD, | ||
136 | .cd_invert = true, | ||
137 | .capabilities = MMC_CAP_MMC_HIGHSPEED | | ||
138 | MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, | ||
139 | #ifdef CONFIG_COH901318 | ||
140 | .dma_filter = coh901318_filter_id, | ||
141 | .dma_rx_param = (void *) U300_DMA_MMCSD_RX_TX, | ||
142 | /* Don't specify a TX channel, this RX channel is bidirectional */ | ||
143 | #endif | ||
144 | }; | ||
145 | |||
131 | static AMBA_APB_DEVICE(mmcsd, "mmci", 0, U300_MMCSD_BASE, | 146 | static AMBA_APB_DEVICE(mmcsd, "mmci", 0, U300_MMCSD_BASE, |
132 | U300_MMCSD_IRQS, NULL); | 147 | U300_MMCSD_IRQS, &mmcsd_platform_data); |
133 | 148 | ||
134 | /* | 149 | /* |
135 | * The order of device declaration may be important, since some devices | 150 | * The order of device declaration may be important, since some devices |
@@ -1424,7 +1439,7 @@ static struct coh901318_platform coh901318_platform = { | |||
1424 | .max_channels = U300_DMA_CHANNELS, | 1439 | .max_channels = U300_DMA_CHANNELS, |
1425 | }; | 1440 | }; |
1426 | 1441 | ||
1427 | static struct resource pinmux_resources[] = { | 1442 | static struct resource pinctrl_resources[] = { |
1428 | { | 1443 | { |
1429 | .start = U300_SYSCON_BASE, | 1444 | .start = U300_SYSCON_BASE, |
1430 | .end = U300_SYSCON_BASE + SZ_4K - 1, | 1445 | .end = U300_SYSCON_BASE + SZ_4K - 1, |
@@ -1453,6 +1468,13 @@ static struct platform_device i2c1_device = { | |||
1453 | .resource = i2c1_resources, | 1468 | .resource = i2c1_resources, |
1454 | }; | 1469 | }; |
1455 | 1470 | ||
1471 | static struct platform_device pinctrl_device = { | ||
1472 | .name = "pinctrl-u300", | ||
1473 | .id = -1, | ||
1474 | .num_resources = ARRAY_SIZE(pinctrl_resources), | ||
1475 | .resource = pinctrl_resources, | ||
1476 | }; | ||
1477 | |||
1456 | /* | 1478 | /* |
1457 | * The different variants have a few different versions of the | 1479 | * The different variants have a few different versions of the |
1458 | * GPIO block, with different number of ports. | 1480 | * GPIO block, with different number of ports. |
@@ -1472,6 +1494,7 @@ static struct u300_gpio_platform u300_gpio_plat = { | |||
1472 | #endif | 1494 | #endif |
1473 | .gpio_base = 0, | 1495 | .gpio_base = 0, |
1474 | .gpio_irq_base = IRQ_U300_GPIO_BASE, | 1496 | .gpio_irq_base = IRQ_U300_GPIO_BASE, |
1497 | .pinctrl_device = &pinctrl_device, | ||
1475 | }; | 1498 | }; |
1476 | 1499 | ||
1477 | static struct platform_device gpio_device = { | 1500 | static struct platform_device gpio_device = { |
@@ -1544,71 +1567,67 @@ static struct platform_device dma_device = { | |||
1544 | }, | 1567 | }, |
1545 | }; | 1568 | }; |
1546 | 1569 | ||
1547 | static struct platform_device pinmux_device = { | 1570 | static unsigned long pin_pullup_conf[] = { |
1548 | .name = "pinmux-u300", | 1571 | PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 1), |
1549 | .id = -1, | 1572 | }; |
1550 | .num_resources = ARRAY_SIZE(pinmux_resources), | 1573 | |
1551 | .resource = pinmux_resources, | 1574 | static unsigned long pin_highz_conf[] = { |
1575 | PIN_CONF_PACKED(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0), | ||
1552 | }; | 1576 | }; |
1553 | 1577 | ||
1554 | /* Pinmux settings */ | 1578 | /* Pin control settings */ |
1555 | static struct pinmux_map __initdata u300_pinmux_map[] = { | 1579 | static struct pinctrl_map __initdata u300_pinmux_map[] = { |
1556 | /* anonymous maps for chip power and EMIFs */ | 1580 | /* anonymous maps for chip power and EMIFs */ |
1557 | PINMUX_MAP_SYS_HOG("POWER", "pinmux-u300", "power"), | 1581 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "power"), |
1558 | PINMUX_MAP_SYS_HOG("EMIF0", "pinmux-u300", "emif0"), | 1582 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif0"), |
1559 | PINMUX_MAP_SYS_HOG("EMIF1", "pinmux-u300", "emif1"), | 1583 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif1"), |
1560 | /* per-device maps for MMC/SD, SPI and UART */ | 1584 | /* per-device maps for MMC/SD, SPI and UART */ |
1561 | PINMUX_MAP("MMCSD", "pinmux-u300", "mmc0", "mmci"), | 1585 | PIN_MAP_MUX_GROUP_DEFAULT("mmci", "pinctrl-u300", NULL, "mmc0"), |
1562 | PINMUX_MAP("SPI", "pinmux-u300", "spi0", "pl022"), | 1586 | PIN_MAP_MUX_GROUP_DEFAULT("pl022", "pinctrl-u300", NULL, "spi0"), |
1563 | PINMUX_MAP("UART0", "pinmux-u300", "uart0", "uart0"), | 1587 | PIN_MAP_MUX_GROUP_DEFAULT("uart0", "pinctrl-u300", NULL, "uart0"), |
1588 | /* This pin is used for clock return rather than GPIO */ | ||
1589 | PIN_MAP_CONFIGS_PIN_DEFAULT("mmci", "pinctrl-u300", "PIO APP GPIO 11", | ||
1590 | pin_pullup_conf), | ||
1591 | /* This pin is used for card detect */ | ||
1592 | PIN_MAP_CONFIGS_PIN_DEFAULT("mmci", "pinctrl-u300", "PIO MS INS", | ||
1593 | pin_highz_conf), | ||
1564 | }; | 1594 | }; |
1565 | 1595 | ||
1566 | struct u300_mux_hog { | 1596 | struct u300_mux_hog { |
1567 | const char *name; | ||
1568 | struct device *dev; | 1597 | struct device *dev; |
1569 | struct pinmux *pmx; | 1598 | struct pinctrl *p; |
1570 | }; | 1599 | }; |
1571 | 1600 | ||
1572 | static struct u300_mux_hog u300_mux_hogs[] = { | 1601 | static struct u300_mux_hog u300_mux_hogs[] = { |
1573 | { | 1602 | { |
1574 | .name = "uart0", | ||
1575 | .dev = &uart0_device.dev, | 1603 | .dev = &uart0_device.dev, |
1576 | }, | 1604 | }, |
1577 | { | 1605 | { |
1578 | .name = "spi0", | ||
1579 | .dev = &pl022_device.dev, | 1606 | .dev = &pl022_device.dev, |
1580 | }, | 1607 | }, |
1581 | { | 1608 | { |
1582 | .name = "mmc0", | ||
1583 | .dev = &mmcsd_device.dev, | 1609 | .dev = &mmcsd_device.dev, |
1584 | }, | 1610 | }, |
1585 | }; | 1611 | }; |
1586 | 1612 | ||
1587 | static int __init u300_pinmux_fetch(void) | 1613 | static int __init u300_pinctrl_fetch(void) |
1588 | { | 1614 | { |
1589 | int i; | 1615 | int i; |
1590 | 1616 | ||
1591 | for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) { | 1617 | for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) { |
1592 | struct pinmux *pmx; | 1618 | struct pinctrl *p; |
1593 | int ret; | ||
1594 | 1619 | ||
1595 | pmx = pinmux_get(u300_mux_hogs[i].dev, NULL); | 1620 | p = pinctrl_get_select_default(u300_mux_hogs[i].dev); |
1596 | if (IS_ERR(pmx)) { | 1621 | if (IS_ERR(p)) { |
1597 | pr_err("u300: could not get pinmux hog %s\n", | 1622 | pr_err("u300: could not get pinmux hog for dev %s\n", |
1598 | u300_mux_hogs[i].name); | 1623 | dev_name(u300_mux_hogs[i].dev)); |
1599 | continue; | ||
1600 | } | ||
1601 | ret = pinmux_enable(pmx); | ||
1602 | if (ret) { | ||
1603 | pr_err("u300: could enable pinmux hog %s\n", | ||
1604 | u300_mux_hogs[i].name); | ||
1605 | continue; | 1624 | continue; |
1606 | } | 1625 | } |
1607 | u300_mux_hogs[i].pmx = pmx; | 1626 | u300_mux_hogs[i].p = p; |
1608 | } | 1627 | } |
1609 | return 0; | 1628 | return 0; |
1610 | } | 1629 | } |
1611 | subsys_initcall(u300_pinmux_fetch); | 1630 | subsys_initcall(u300_pinctrl_fetch); |
1612 | 1631 | ||
1613 | /* | 1632 | /* |
1614 | * Notice that AMBA devices are initialized before platform devices. | 1633 | * Notice that AMBA devices are initialized before platform devices. |
@@ -1623,7 +1642,6 @@ static struct platform_device *platform_devs[] __initdata = { | |||
1623 | &gpio_device, | 1642 | &gpio_device, |
1624 | &nand_device, | 1643 | &nand_device, |
1625 | &wdog_device, | 1644 | &wdog_device, |
1626 | &pinmux_device, | ||
1627 | }; | 1645 | }; |
1628 | 1646 | ||
1629 | /* | 1647 | /* |
@@ -1808,8 +1826,8 @@ void __init u300_init_devices(void) | |||
1808 | u300_assign_physmem(); | 1826 | u300_assign_physmem(); |
1809 | 1827 | ||
1810 | /* Initialize pinmuxing */ | 1828 | /* Initialize pinmuxing */ |
1811 | pinmux_register_mappings(u300_pinmux_map, | 1829 | pinctrl_register_mappings(u300_pinmux_map, |
1812 | ARRAY_SIZE(u300_pinmux_map)); | 1830 | ARRAY_SIZE(u300_pinmux_map)); |
1813 | 1831 | ||
1814 | /* Register subdevices on the I2C buses */ | 1832 | /* Register subdevices on the I2C buses */ |
1815 | u300_i2c_register_board_devices(); | 1833 | u300_i2c_register_board_devices(); |
@@ -1826,16 +1844,6 @@ void __init u300_init_devices(void) | |||
1826 | writew(val, U300_SYSCON_VBASE + U300_SYSCON_SMCR); | 1844 | writew(val, U300_SYSCON_VBASE + U300_SYSCON_SMCR); |
1827 | } | 1845 | } |
1828 | 1846 | ||
1829 | static int core_module_init(void) | ||
1830 | { | ||
1831 | /* | ||
1832 | * This needs to be initialized later: it needs the input framework | ||
1833 | * to be initialized first. | ||
1834 | */ | ||
1835 | return mmc_init(&mmcsd_device); | ||
1836 | } | ||
1837 | module_init(core_module_init); | ||
1838 | |||
1839 | /* Forward declare this function from the watchdog */ | 1847 | /* Forward declare this function from the watchdog */ |
1840 | void coh901327_watchdog_reset(void); | 1848 | void coh901327_watchdog_reset(void); |
1841 | 1849 | ||
diff --git a/arch/arm/mach-u300/i2c.c b/arch/arm/mach-u300/i2c.c index 5140deeddf7b..a38f80238ea9 100644 --- a/arch/arm/mach-u300/i2c.c +++ b/arch/arm/mach-u300/i2c.c | |||
@@ -60,7 +60,6 @@ static struct regulator_consumer_supply supply_ldo_c[] = { | |||
60 | */ | 60 | */ |
61 | static struct regulator_consumer_supply supply_ldo_d[] = { | 61 | static struct regulator_consumer_supply supply_ldo_d[] = { |
62 | { | 62 | { |
63 | .dev = NULL, | ||
64 | .supply = "vana15", /* Powers the SoC (CPU etc) */ | 63 | .supply = "vana15", /* Powers the SoC (CPU etc) */ |
65 | }, | 64 | }, |
66 | }; | 65 | }; |
@@ -92,7 +91,6 @@ static struct regulator_consumer_supply supply_ldo_k[] = { | |||
92 | */ | 91 | */ |
93 | static struct regulator_consumer_supply supply_ldo_ext[] = { | 92 | static struct regulator_consumer_supply supply_ldo_ext[] = { |
94 | { | 93 | { |
95 | .dev = NULL, | ||
96 | .supply = "vext", /* External power */ | 94 | .supply = "vext", /* External power */ |
97 | }, | 95 | }, |
98 | }; | 96 | }; |
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 */ |
diff --git a/arch/arm/mach-u300/mmc.c b/arch/arm/mach-u300/mmc.c deleted file mode 100644 index 05abd6ad9fab..000000000000 --- a/arch/arm/mach-u300/mmc.c +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * arch/arm/mach-u300/mmc.c | ||
4 | * | ||
5 | * | ||
6 | * Copyright (C) 2009 ST-Ericsson SA | ||
7 | * License terms: GNU General Public License (GPL) version 2 | ||
8 | * | ||
9 | * Author: Linus Walleij <linus.walleij@stericsson.com> | ||
10 | * Author: Johan Lundin | ||
11 | * Author: Jonas Aaberg <jonas.aberg@stericsson.com> | ||
12 | */ | ||
13 | #include <linux/device.h> | ||
14 | #include <linux/amba/bus.h> | ||
15 | #include <linux/mmc/host.h> | ||
16 | #include <linux/dmaengine.h> | ||
17 | #include <linux/amba/mmci.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <mach/coh901318.h> | ||
20 | #include <mach/dma_channels.h> | ||
21 | |||
22 | #include "u300-gpio.h" | ||
23 | #include "mmc.h" | ||
24 | |||
25 | static struct mmci_platform_data mmc0_plat_data = { | ||
26 | /* | ||
27 | * Do not set ocr_mask or voltage translation function, | ||
28 | * we have a regulator we can control instead. | ||
29 | */ | ||
30 | /* Nominally 2.85V on our platform */ | ||
31 | .f_max = 24000000, | ||
32 | .gpio_wp = -1, | ||
33 | .gpio_cd = U300_GPIO_PIN_MMC_CD, | ||
34 | .cd_invert = true, | ||
35 | .capabilities = MMC_CAP_MMC_HIGHSPEED | | ||
36 | MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, | ||
37 | #ifdef CONFIG_COH901318 | ||
38 | .dma_filter = coh901318_filter_id, | ||
39 | .dma_rx_param = (void *) U300_DMA_MMCSD_RX_TX, | ||
40 | /* Don't specify a TX channel, this RX channel is bidirectional */ | ||
41 | #endif | ||
42 | }; | ||
43 | |||
44 | int __devinit mmc_init(struct amba_device *adev) | ||
45 | { | ||
46 | struct device *mmcsd_device = &adev->dev; | ||
47 | int ret = 0; | ||
48 | |||
49 | mmcsd_device->platform_data = &mmc0_plat_data; | ||
50 | |||
51 | return ret; | ||
52 | } | ||
diff --git a/arch/arm/mach-u300/mmc.h b/arch/arm/mach-u300/mmc.h deleted file mode 100644 index 92b85125abb3..000000000000 --- a/arch/arm/mach-u300/mmc.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * arch/arm/mach-u300/mmc.h | ||
4 | * | ||
5 | * | ||
6 | * Copyright (C) 2009 ST-Ericsson AB | ||
7 | * License terms: GNU General Public License (GPL) version 2 | ||
8 | * | ||
9 | * Author: Jonas Aaberg <jonas.aberg@stericsson.com> | ||
10 | */ | ||
11 | #ifndef MMC_H | ||
12 | #define MMC_H | ||
13 | |||
14 | #include <linux/amba/bus.h> | ||
15 | |||
16 | int __devinit mmc_init(struct amba_device *adev); | ||
17 | |||
18 | #endif | ||