diff options
Diffstat (limited to 'drivers/mmc/host/omap.c')
-rw-r--r-- | drivers/mmc/host/omap.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index e7c61b9b044c..9f0e26fffaea 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/platform_data/mmc-omap.h> | 31 | #include <linux/platform_data/mmc-omap.h> |
32 | 32 | ||
33 | #include <plat/cpu.h> | ||
34 | #include <plat/dma.h> | 33 | #include <plat/dma.h> |
35 | 34 | ||
36 | #define OMAP_MMC_REG_CMD 0x00 | 35 | #define OMAP_MMC_REG_CMD 0x00 |
@@ -73,6 +72,13 @@ | |||
73 | #define OMAP_MMC_STAT_CARD_BUSY (1 << 2) | 72 | #define OMAP_MMC_STAT_CARD_BUSY (1 << 2) |
74 | #define OMAP_MMC_STAT_END_OF_CMD (1 << 0) | 73 | #define OMAP_MMC_STAT_END_OF_CMD (1 << 0) |
75 | 74 | ||
75 | #define mmc_omap7xx() (host->features & MMC_OMAP7XX) | ||
76 | #define mmc_omap15xx() (host->features & MMC_OMAP15XX) | ||
77 | #define mmc_omap16xx() (host->features & MMC_OMAP16XX) | ||
78 | #define MMC_OMAP1_MASK (MMC_OMAP7XX | MMC_OMAP15XX | MMC_OMAP16XX) | ||
79 | #define mmc_omap1() (host->features & MMC_OMAP1_MASK) | ||
80 | #define mmc_omap2() (!mmc_omap1()) | ||
81 | |||
76 | #define OMAP_MMC_REG(host, reg) (OMAP_MMC_REG_##reg << (host)->reg_shift) | 82 | #define OMAP_MMC_REG(host, reg) (OMAP_MMC_REG_##reg << (host)->reg_shift) |
77 | #define OMAP_MMC_READ(host, reg) __raw_readw((host)->virt_base + OMAP_MMC_REG(host, reg)) | 83 | #define OMAP_MMC_READ(host, reg) __raw_readw((host)->virt_base + OMAP_MMC_REG(host, reg)) |
78 | #define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)->virt_base + OMAP_MMC_REG(host, reg)) | 84 | #define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)->virt_base + OMAP_MMC_REG(host, reg)) |
@@ -148,6 +154,7 @@ struct mmc_omap_host { | |||
148 | u32 buffer_bytes_left; | 154 | u32 buffer_bytes_left; |
149 | u32 total_bytes_left; | 155 | u32 total_bytes_left; |
150 | 156 | ||
157 | unsigned features; | ||
151 | unsigned use_dma:1; | 158 | unsigned use_dma:1; |
152 | unsigned brs_received:1, dma_done:1; | 159 | unsigned brs_received:1, dma_done:1; |
153 | unsigned dma_in_use:1; | 160 | unsigned dma_in_use:1; |
@@ -989,7 +996,7 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req) | |||
989 | * blocksize is at least that large. Blocksize is | 996 | * blocksize is at least that large. Blocksize is |
990 | * usually 512 bytes; but not for some SD reads. | 997 | * usually 512 bytes; but not for some SD reads. |
991 | */ | 998 | */ |
992 | burst = cpu_is_omap15xx() ? 32 : 64; | 999 | burst = mmc_omap15xx() ? 32 : 64; |
993 | if (burst > data->blksz) | 1000 | if (burst > data->blksz) |
994 | burst = data->blksz; | 1001 | burst = data->blksz; |
995 | 1002 | ||
@@ -1105,8 +1112,7 @@ static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on, | |||
1105 | if (slot->pdata->set_power != NULL) | 1112 | if (slot->pdata->set_power != NULL) |
1106 | slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on, | 1113 | slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on, |
1107 | vdd); | 1114 | vdd); |
1108 | 1115 | if (mmc_omap2()) { | |
1109 | if (cpu_is_omap24xx()) { | ||
1110 | u16 w; | 1116 | u16 w; |
1111 | 1117 | ||
1112 | if (power_on) { | 1118 | if (power_on) { |
@@ -1240,7 +1246,7 @@ static int __devinit mmc_omap_new_slot(struct mmc_omap_host *host, int id) | |||
1240 | mmc->ops = &mmc_omap_ops; | 1246 | mmc->ops = &mmc_omap_ops; |
1241 | mmc->f_min = 400000; | 1247 | mmc->f_min = 400000; |
1242 | 1248 | ||
1243 | if (cpu_class_is_omap2()) | 1249 | if (mmc_omap2()) |
1244 | mmc->f_max = 48000000; | 1250 | mmc->f_max = 48000000; |
1245 | else | 1251 | else |
1246 | mmc->f_max = 24000000; | 1252 | mmc->f_max = 24000000; |
@@ -1360,6 +1366,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev) | |||
1360 | init_waitqueue_head(&host->slot_wq); | 1366 | init_waitqueue_head(&host->slot_wq); |
1361 | 1367 | ||
1362 | host->pdata = pdata; | 1368 | host->pdata = pdata; |
1369 | host->features = host->pdata->slots[0].features; | ||
1363 | host->dev = &pdev->dev; | 1370 | host->dev = &pdev->dev; |
1364 | platform_set_drvdata(pdev, host); | 1371 | platform_set_drvdata(pdev, host); |
1365 | 1372 | ||
@@ -1392,7 +1399,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev) | |||
1392 | host->dma_tx_burst = -1; | 1399 | host->dma_tx_burst = -1; |
1393 | host->dma_rx_burst = -1; | 1400 | host->dma_rx_burst = -1; |
1394 | 1401 | ||
1395 | if (cpu_is_omap24xx()) | 1402 | if (mmc_omap2()) |
1396 | sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX; | 1403 | sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX; |
1397 | else | 1404 | else |
1398 | sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX; | 1405 | sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX; |
@@ -1408,7 +1415,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev) | |||
1408 | dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", | 1415 | dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", |
1409 | sig); | 1416 | sig); |
1410 | #endif | 1417 | #endif |
1411 | if (cpu_is_omap24xx()) | 1418 | if (mmc_omap2()) |
1412 | sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX; | 1419 | sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX; |
1413 | else | 1420 | else |
1414 | sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX; | 1421 | sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX; |
@@ -1436,7 +1443,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev) | |||
1436 | } | 1443 | } |
1437 | 1444 | ||
1438 | host->nr_slots = pdata->nr_slots; | 1445 | host->nr_slots = pdata->nr_slots; |
1439 | host->reg_shift = (cpu_is_omap7xx() ? 1 : 2); | 1446 | host->reg_shift = (mmc_omap7xx() ? 1 : 2); |
1440 | 1447 | ||
1441 | host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0); | 1448 | host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0); |
1442 | if (!host->mmc_omap_wq) | 1449 | if (!host->mmc_omap_wq) |