aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-02 12:31:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-02 12:31:45 -0400
commit97b1007a2924aaa9126398623f6755a8c3c6a616 (patch)
treeb65c6edb631256e64bb3c72f083fa1be048de097 /drivers/mmc/host
parentdfab34aa61a0f8c14a67d7b4c1dae28e57ba592d (diff)
parente0d20b69d3fa74a21ec363989612bddd58b930b8 (diff)
Merge tag 'soc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC platform updates from Olof Johansson: "This branch contains part 1 of the platform updates for 3.10. Among the highlights: - Support for the new Atmel Cortex-A5 based platforms (SAMA5D3) - New support for CSR SiRFatlas6 SoCs - A handful of updates for NVidia T114 (a.k.a. Tegra 4) - A bunch of updates for the shmobile platforms - A handful of updates for davinci - A few updates for Qualcomm MSM - Plus a handful of other patches, defconfig updates, etc." * tag 'soc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (135 commits) ARM: tegra: pm: fix build error w/o PM_SLEEP ARM: davinci: ensure global variables are declared ARM: davinci: sram.c: fix incorrect type in assignment ARM: davinci: da8xx dt: make file local symbols static ARM: davinci: da8xx: add remoteproc support ARM: socfpga: Upgrade clk driver for socfpga to make use of dts clock entries ARM: socfpga: Add clock entries into device tree ARM: socfpga: Enable soft reset ARM: EXYNOS: replace cpumask by the corresponding macro ARM: EXYNOS: handle properly the return values ARM: EXYNOS: factor out the idle states ARM: OMAP4: Enable fix for Cortex-A9 erratas ARM: OMAP2+: Export SoC information to userspace ARM: OMAP2+: SoC name and revision unification ARM: OMAP2+: Move common part of late init into common function ARM: tegra: pm: remove duplicated include from pm.c ARM: davinci: da850: override mmc DT node device name ARM: davinci: da850: add mmc DT entries mmc: davinci_mmc: add DT support ARM: SAMSUNG: check processor type before cache restoration in resume ...
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/davinci_mmc.c88
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
1160static int __init davinci_mmcsd_probe(struct platform_device *pdev) 1164static 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};
1174MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
1175
1176static 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};
1187MODULE_DEVICE_TABLE(of, davinci_mmc_dt_ids);
1188
1189static 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 }
1225nodata:
1226 return pdata;
1227}
1228
1229static 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
1413static int __init davinci_mmcsd_init(void) 1491static int __init davinci_mmcsd_init(void)