aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2012-10-15 15:10:33 -0400
committerTony Lindgren <tony@atomide.com>2012-10-15 15:10:33 -0400
commit53db20d123f7a1bf44e46b727775403672655fde (patch)
tree5fc1d05f02eff332a4c45f7e6d38c38611c36f3b
parent68f39e74fbc3e58ad52d008072bddacc9eee1c7e (diff)
mmc: omap: Remove cpu_is_omap usage from the driver
This is needed for the ARM common zImage support. We can use the existing slot features to pass omap1 specific options to the driver. For omap2 we don't want to pass anything new as that will be eventually moved to use device tree based init. Note that this patch depends on earlier patch that moves plat/mmc.h into include/linux/platform_data. Cc: linux-mmc@vger.kernel.org Cc: Venkatraman S <svenkatr@ti.com> Acked-by: Chris Ball <cjb@laptop.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap1/devices.c7
-rw-r--r--drivers/mmc/host/omap.c23
-rw-r--r--include/linux/platform_data/mmc-omap.h3
3 files changed, 25 insertions, 8 deletions
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index f85836ae6691..d807d949913d 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -175,6 +175,13 @@ static int __init omap_mmc_add(const char *name, int id, unsigned long base,
175 res[3].name = "tx"; 175 res[3].name = "tx";
176 res[3].flags = IORESOURCE_DMA; 176 res[3].flags = IORESOURCE_DMA;
177 177
178 if (cpu_is_omap7xx())
179 data->slots[0].features = MMC_OMAP7XX;
180 if (cpu_is_omap15xx())
181 data->slots[0].features = MMC_OMAP15XX;
182 if (cpu_is_omap16xx())
183 data->slots[0].features = MMC_OMAP16XX;
184
178 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); 185 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
179 if (ret == 0) 186 if (ret == 0)
180 ret = platform_device_add_data(pdev, data, sizeof(*data)); 187 ret = platform_device_add_data(pdev, data, sizeof(*data));
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)
diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
index 39a7abc5604c..2bf6ea82ff94 100644
--- a/include/linux/platform_data/mmc-omap.h
+++ b/include/linux/platform_data/mmc-omap.h
@@ -107,6 +107,9 @@ struct omap_mmc_platform_data {
107 /* we can put the features above into this variable */ 107 /* we can put the features above into this variable */
108#define HSMMC_HAS_PBIAS (1 << 0) 108#define HSMMC_HAS_PBIAS (1 << 0)
109#define HSMMC_HAS_UPDATED_RESET (1 << 1) 109#define HSMMC_HAS_UPDATED_RESET (1 << 1)
110#define MMC_OMAP7XX (1 << 2)
111#define MMC_OMAP15XX (1 << 3)
112#define MMC_OMAP16XX (1 << 4)
110 unsigned features; 113 unsigned features;
111 114
112 int switch_pin; /* gpio (card detect) */ 115 int switch_pin; /* gpio (card detect) */