aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/omap.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2012-10-17 14:13:42 -0400
committerTony Lindgren <tony@atomide.com>2012-10-17 14:13:42 -0400
commit46cddc01aa6a017193ae7320ef8bfc8242782a66 (patch)
treeda67a2fb45e512689bf909b4f832a8daea57e140 /drivers/mmc/host/omap.c
parent99f0b8d6b09b0db6452d0d6e252bfa28049bbea9 (diff)
parent53db20d123f7a1bf44e46b727775403672655fde (diff)
Merge branch 'omap-for-v3.8/cleanup-headers-mmc' into omap-for-v3.8/cleanup-headers
Conflicts: arch/arm/mach-omap1/devices.c arch/arm/mach-omap2/omap_hwmod_33xx_data.c arch/arm/mach-omap2/omap_hwmod_3xxx_data.c drivers/mmc/host/omap.c
Diffstat (limited to 'drivers/mmc/host/omap.c')
-rw-r--r--drivers/mmc/host/omap.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index c59c4d25165c..ae115c01283b 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -28,9 +28,8 @@
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/scatterlist.h> 29#include <linux/scatterlist.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/platform_data/mmc-omap.h>
31 32
32#include <plat/mmc.h>
33#include <plat-omap/dma-omap.h>
34 33
35#define OMAP_MMC_REG_CMD 0x00 34#define OMAP_MMC_REG_CMD 0x00
36#define OMAP_MMC_REG_ARGL 0x01 35#define OMAP_MMC_REG_ARGL 0x01
@@ -72,6 +71,13 @@
72#define OMAP_MMC_STAT_CARD_BUSY (1 << 2) 71#define OMAP_MMC_STAT_CARD_BUSY (1 << 2)
73#define OMAP_MMC_STAT_END_OF_CMD (1 << 0) 72#define OMAP_MMC_STAT_END_OF_CMD (1 << 0)
74 73
74#define mmc_omap7xx() (host->features & MMC_OMAP7XX)
75#define mmc_omap15xx() (host->features & MMC_OMAP15XX)
76#define mmc_omap16xx() (host->features & MMC_OMAP16XX)
77#define MMC_OMAP1_MASK (MMC_OMAP7XX | MMC_OMAP15XX | MMC_OMAP16XX)
78#define mmc_omap1() (host->features & MMC_OMAP1_MASK)
79#define mmc_omap2() (!mmc_omap1())
80
75#define OMAP_MMC_REG(host, reg) (OMAP_MMC_REG_##reg << (host)->reg_shift) 81#define OMAP_MMC_REG(host, reg) (OMAP_MMC_REG_##reg << (host)->reg_shift)
76#define OMAP_MMC_READ(host, reg) __raw_readw((host)->virt_base + OMAP_MMC_REG(host, reg)) 82#define OMAP_MMC_READ(host, reg) __raw_readw((host)->virt_base + OMAP_MMC_REG(host, reg))
77#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)->virt_base + OMAP_MMC_REG(host, reg)) 83#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)->virt_base + OMAP_MMC_REG(host, reg))
@@ -157,6 +163,7 @@ struct mmc_omap_host {
157 u32 buffer_bytes_left; 163 u32 buffer_bytes_left;
158 u32 total_bytes_left; 164 u32 total_bytes_left;
159 165
166 unsigned features;
160 unsigned use_dma:1; 167 unsigned use_dma:1;
161 unsigned brs_received:1, dma_done:1; 168 unsigned brs_received:1, dma_done:1;
162 unsigned dma_in_use:1; 169 unsigned dma_in_use:1;
@@ -998,7 +1005,7 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
998 * blocksize is at least that large. Blocksize is 1005 * blocksize is at least that large. Blocksize is
999 * usually 512 bytes; but not for some SD reads. 1006 * usually 512 bytes; but not for some SD reads.
1000 */ 1007 */
1001 burst = cpu_is_omap15xx() ? 32 : 64; 1008 burst = mmc_omap15xx() ? 32 : 64;
1002 if (burst > data->blksz) 1009 if (burst > data->blksz)
1003 burst = data->blksz; 1010 burst = data->blksz;
1004 1011
@@ -1114,8 +1121,7 @@ static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on,
1114 if (slot->pdata->set_power != NULL) 1121 if (slot->pdata->set_power != NULL)
1115 slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on, 1122 slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on,
1116 vdd); 1123 vdd);
1117 1124 if (mmc_omap2()) {
1118 if (cpu_is_omap24xx()) {
1119 u16 w; 1125 u16 w;
1120 1126
1121 if (power_on) { 1127 if (power_on) {
@@ -1249,7 +1255,7 @@ static int __devinit mmc_omap_new_slot(struct mmc_omap_host *host, int id)
1249 mmc->ops = &mmc_omap_ops; 1255 mmc->ops = &mmc_omap_ops;
1250 mmc->f_min = 400000; 1256 mmc->f_min = 400000;
1251 1257
1252 if (cpu_class_is_omap2()) 1258 if (mmc_omap2())
1253 mmc->f_max = 48000000; 1259 mmc->f_max = 48000000;
1254 else 1260 else
1255 mmc->f_max = 24000000; 1261 mmc->f_max = 24000000;
@@ -1369,6 +1375,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
1369 init_waitqueue_head(&host->slot_wq); 1375 init_waitqueue_head(&host->slot_wq);
1370 1376
1371 host->pdata = pdata; 1377 host->pdata = pdata;
1378 host->features = host->pdata->slots[0].features;
1372 host->dev = &pdev->dev; 1379 host->dev = &pdev->dev;
1373 platform_set_drvdata(pdev, host); 1380 platform_set_drvdata(pdev, host);
1374 1381
@@ -1401,7 +1408,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
1401 host->dma_tx_burst = -1; 1408 host->dma_tx_burst = -1;
1402 host->dma_rx_burst = -1; 1409 host->dma_rx_burst = -1;
1403 1410
1404 if (cpu_is_omap24xx()) 1411 if (mmc_omap2())
1405 sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX; 1412 sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX;
1406 else 1413 else
1407 sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX; 1414 sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX;
@@ -1417,7 +1424,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
1417 dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", 1424 dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n",
1418 sig); 1425 sig);
1419#endif 1426#endif
1420 if (cpu_is_omap24xx()) 1427 if (mmc_omap2())
1421 sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX; 1428 sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX;
1422 else 1429 else
1423 sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX; 1430 sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX;
@@ -1445,7 +1452,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
1445 } 1452 }
1446 1453
1447 host->nr_slots = pdata->nr_slots; 1454 host->nr_slots = pdata->nr_slots;
1448 host->reg_shift = (cpu_is_omap7xx() ? 1 : 2); 1455 host->reg_shift = (mmc_omap7xx() ? 1 : 2);
1449 1456
1450 host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0); 1457 host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0);
1451 if (!host->mmc_omap_wq) 1458 if (!host->mmc_omap_wq)