diff options
author | Olof Johansson <olof@lixom.net> | 2013-04-18 02:50:06 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2013-04-18 02:51:31 -0400 |
commit | c8bf98a28ff792800c9c8473382f79eb099912a5 (patch) | |
tree | b9b9f3999b6b41fb7861675f51bbc8e80c450de2 /drivers/mmc | |
parent | db39ad7d418b3b64f92295c3d9d7d8595ff68f08 (diff) | |
parent | 4f4d9d4dc55814bd98e6a580e55e0a0855feb5cf (diff) |
Merge tag 'davinci-for-v3.10/dt-2-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci into next/dt2
From Sekhar Nori:
v3.10 DT updates for DaVinci
This set of patches adds support for PWMs and SPI
controller present on DA850 and for SPI flash present on
DA850 EVM.
* tag 'davinci-for-v3.10/dt-2-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci:
ARM: davinci: da850-evm: add SPI flash support
ARM: davinci: da850: override SPI DT node device name
ARM: davinci: da850: add SPI1 DT node
spi/davinci: add DT binding documentation
spi/davinci: no wildcards in DT compatible property
ARM: davinci: da850: add EHRPWM & ECAP DT node
ARM: davinci: da850: override mmc DT node device name
ARM: davinci: da850: add mmc DT entries
mmc: davinci_mmc: add DT support
ARM: davinci: da850: add tps6507x regulator DT data
ARM: regulator: add tps6507x device tree data
ARM: davinci: remove test for undefined Kconfig macro
ARM: davinci: mmc: derive version information from device name
ARM: davinci: da850: add ECAP & EHRPWM clock nodes
ARM: davinci: clk framework support for enable/disable functionality
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/davinci_mmc.c | 88 |
1 files changed, 83 insertions, 5 deletions
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c index 20636772c09b..f8a96d652e9e 100644 --- a/drivers/mmc/host/davinci_mmc.c +++ b/drivers/mmc/host/davinci_mmc.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
35 | #include <linux/edma.h> | 35 | #include <linux/edma.h> |
36 | #include <linux/mmc/mmc.h> | 36 | #include <linux/mmc/mmc.h> |
37 | #include <linux/of.h> | ||
38 | #include <linux/of_device.h> | ||
37 | 39 | ||
38 | #include <linux/platform_data/mmc-davinci.h> | 40 | #include <linux/platform_data/mmc-davinci.h> |
39 | 41 | ||
@@ -522,14 +524,16 @@ static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host) | |||
522 | dma_cap_set(DMA_SLAVE, mask); | 524 | dma_cap_set(DMA_SLAVE, mask); |
523 | 525 | ||
524 | host->dma_tx = | 526 | host->dma_tx = |
525 | dma_request_channel(mask, edma_filter_fn, &host->txdma); | 527 | dma_request_slave_channel_compat(mask, edma_filter_fn, |
528 | &host->txdma, mmc_dev(host->mmc), "tx"); | ||
526 | if (!host->dma_tx) { | 529 | if (!host->dma_tx) { |
527 | dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n"); | 530 | dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n"); |
528 | return -ENODEV; | 531 | return -ENODEV; |
529 | } | 532 | } |
530 | 533 | ||
531 | host->dma_rx = | 534 | host->dma_rx = |
532 | dma_request_channel(mask, edma_filter_fn, &host->rxdma); | 535 | dma_request_slave_channel_compat(mask, edma_filter_fn, |
536 | &host->rxdma, mmc_dev(host->mmc), "rx"); | ||
533 | if (!host->dma_rx) { | 537 | if (!host->dma_rx) { |
534 | dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n"); | 538 | dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n"); |
535 | r = -ENODEV; | 539 | r = -ENODEV; |
@@ -1157,16 +1161,86 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host) | |||
1157 | mmc_davinci_reset_ctrl(host, 0); | 1161 | mmc_davinci_reset_ctrl(host, 0); |
1158 | } | 1162 | } |
1159 | 1163 | ||
1160 | static int __init davinci_mmcsd_probe(struct platform_device *pdev) | 1164 | static struct platform_device_id davinci_mmc_devtype[] = { |
1165 | { | ||
1166 | .name = "dm6441-mmc", | ||
1167 | .driver_data = MMC_CTLR_VERSION_1, | ||
1168 | }, { | ||
1169 | .name = "da830-mmc", | ||
1170 | .driver_data = MMC_CTLR_VERSION_2, | ||
1171 | }, | ||
1172 | {}, | ||
1173 | }; | ||
1174 | MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype); | ||
1175 | |||
1176 | static const struct of_device_id davinci_mmc_dt_ids[] = { | ||
1177 | { | ||
1178 | .compatible = "ti,dm6441-mmc", | ||
1179 | .data = &davinci_mmc_devtype[MMC_CTLR_VERSION_1], | ||
1180 | }, | ||
1181 | { | ||
1182 | .compatible = "ti,da830-mmc", | ||
1183 | .data = &davinci_mmc_devtype[MMC_CTLR_VERSION_2], | ||
1184 | }, | ||
1185 | {}, | ||
1186 | }; | ||
1187 | MODULE_DEVICE_TABLE(of, davinci_mmc_dt_ids); | ||
1188 | |||
1189 | static struct davinci_mmc_config | ||
1190 | *mmc_parse_pdata(struct platform_device *pdev) | ||
1161 | { | 1191 | { |
1192 | struct device_node *np; | ||
1162 | struct davinci_mmc_config *pdata = pdev->dev.platform_data; | 1193 | struct davinci_mmc_config *pdata = pdev->dev.platform_data; |
1194 | const struct of_device_id *match = | ||
1195 | of_match_device(of_match_ptr(davinci_mmc_dt_ids), &pdev->dev); | ||
1196 | u32 data; | ||
1197 | |||
1198 | np = pdev->dev.of_node; | ||
1199 | if (!np) | ||
1200 | return pdata; | ||
1201 | |||
1202 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
1203 | if (!pdata) { | ||
1204 | dev_err(&pdev->dev, "Failed to allocate memory for struct davinci_mmc_config\n"); | ||
1205 | goto nodata; | ||
1206 | } | ||
1207 | |||
1208 | if (match) | ||
1209 | pdev->id_entry = match->data; | ||
1210 | |||
1211 | if (of_property_read_u32(np, "max-frequency", &pdata->max_freq)) | ||
1212 | dev_info(&pdev->dev, "'max-frequency' property not specified, defaulting to 25MHz\n"); | ||
1213 | |||
1214 | of_property_read_u32(np, "bus-width", &data); | ||
1215 | switch (data) { | ||
1216 | case 1: | ||
1217 | case 4: | ||
1218 | case 8: | ||
1219 | pdata->wires = data; | ||
1220 | break; | ||
1221 | default: | ||
1222 | pdata->wires = 1; | ||
1223 | dev_info(&pdev->dev, "Unsupported buswidth, defaulting to 1 bit\n"); | ||
1224 | } | ||
1225 | nodata: | ||
1226 | return pdata; | ||
1227 | } | ||
1228 | |||
1229 | static int __init davinci_mmcsd_probe(struct platform_device *pdev) | ||
1230 | { | ||
1231 | struct davinci_mmc_config *pdata = NULL; | ||
1163 | struct mmc_davinci_host *host = NULL; | 1232 | struct mmc_davinci_host *host = NULL; |
1164 | struct mmc_host *mmc = NULL; | 1233 | struct mmc_host *mmc = NULL; |
1165 | struct resource *r, *mem = NULL; | 1234 | struct resource *r, *mem = NULL; |
1166 | int ret = 0, irq = 0; | 1235 | int ret = 0, irq = 0; |
1167 | size_t mem_size; | 1236 | size_t mem_size; |
1237 | const struct platform_device_id *id_entry; | ||
1168 | 1238 | ||
1169 | /* REVISIT: when we're fully converted, fail if pdata is NULL */ | 1239 | pdata = mmc_parse_pdata(pdev); |
1240 | if (pdata == NULL) { | ||
1241 | dev_err(&pdev->dev, "Couldn't get platform data\n"); | ||
1242 | return -ENOENT; | ||
1243 | } | ||
1170 | 1244 | ||
1171 | ret = -ENODEV; | 1245 | ret = -ENODEV; |
1172 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1246 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -1237,7 +1311,9 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev) | |||
1237 | if (pdata && (pdata->wires == 8)) | 1311 | if (pdata && (pdata->wires == 8)) |
1238 | mmc->caps |= (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA); | 1312 | mmc->caps |= (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA); |
1239 | 1313 | ||
1240 | host->version = pdata->version; | 1314 | id_entry = platform_get_device_id(pdev); |
1315 | if (id_entry) | ||
1316 | host->version = id_entry->driver_data; | ||
1241 | 1317 | ||
1242 | mmc->ops = &mmc_davinci_ops; | 1318 | mmc->ops = &mmc_davinci_ops; |
1243 | mmc->f_min = 312500; | 1319 | mmc->f_min = 312500; |
@@ -1406,8 +1482,10 @@ static struct platform_driver davinci_mmcsd_driver = { | |||
1406 | .name = "davinci_mmc", | 1482 | .name = "davinci_mmc", |
1407 | .owner = THIS_MODULE, | 1483 | .owner = THIS_MODULE, |
1408 | .pm = davinci_mmcsd_pm_ops, | 1484 | .pm = davinci_mmcsd_pm_ops, |
1485 | .of_match_table = of_match_ptr(davinci_mmc_dt_ids), | ||
1409 | }, | 1486 | }, |
1410 | .remove = __exit_p(davinci_mmcsd_remove), | 1487 | .remove = __exit_p(davinci_mmcsd_remove), |
1488 | .id_table = davinci_mmc_devtype, | ||
1411 | }; | 1489 | }; |
1412 | 1490 | ||
1413 | static int __init davinci_mmcsd_init(void) | 1491 | static int __init davinci_mmcsd_init(void) |