Commit ce9c1a83 authored by Tony Lindgren's avatar Tony Lindgren Committed by Russell King

[ARM] 3678/1: MMC: Make OMAP MMC work

Patch from Tony Lindgren

This patch makes OMAP MMC work again:

- Fix compile errors
- Do not ioremap base as it is already statically mapped
- Clean-up platform device handling
- Fix compile warnings
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 0d1bca16
...@@ -162,8 +162,8 @@ static u64 mmc1_dmamask = 0xffffffff; ...@@ -162,8 +162,8 @@ static u64 mmc1_dmamask = 0xffffffff;
static struct resource mmc1_resources[] = { static struct resource mmc1_resources[] = {
{ {
.start = IO_ADDRESS(OMAP_MMC1_BASE), .start = OMAP_MMC1_BASE,
.end = IO_ADDRESS(OMAP_MMC1_BASE) + 0x7f, .end = OMAP_MMC1_BASE + 0x7f,
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
{ {
...@@ -191,8 +191,8 @@ static u64 mmc2_dmamask = 0xffffffff; ...@@ -191,8 +191,8 @@ static u64 mmc2_dmamask = 0xffffffff;
static struct resource mmc2_resources[] = { static struct resource mmc2_resources[] = {
{ {
.start = IO_ADDRESS(OMAP_MMC2_BASE), .start = OMAP_MMC2_BASE,
.end = IO_ADDRESS(OMAP_MMC2_BASE) + 0x7f, .end = OMAP_MMC2_BASE + 0x7f,
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
{ {
......
...@@ -61,6 +61,7 @@ struct mmc_omap_host { ...@@ -61,6 +61,7 @@ struct mmc_omap_host {
unsigned char id; /* 16xx chips have 2 MMC blocks */ unsigned char id; /* 16xx chips have 2 MMC blocks */
struct clk * iclk; struct clk * iclk;
struct clk * fclk; struct clk * fclk;
struct resource *res;
void __iomem *base; void __iomem *base;
int irq; int irq;
unsigned char bus_mode; unsigned char bus_mode;
...@@ -340,8 +341,6 @@ static void ...@@ -340,8 +341,6 @@ static void
mmc_omap_xfer_data(struct mmc_omap_host *host, int write) mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
{ {
int n; int n;
void __iomem *reg;
u16 *p;
if (host->buffer_bytes_left == 0) { if (host->buffer_bytes_left == 0) {
host->sg_idx++; host->sg_idx++;
...@@ -658,8 +657,8 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data) ...@@ -658,8 +657,8 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data)
struct mmc_data *mmcdat = host->data; struct mmc_data *mmcdat = host->data;
if (unlikely(host->dma_ch < 0)) { if (unlikely(host->dma_ch < 0)) {
dev_err(mmc_dev(host->mmc), "DMA callback while DMA not dev_err(mmc_dev(host->mmc),
enabled\n"); "DMA callback while DMA not enabled\n");
return; return;
} }
/* FIXME: We really should do something to _handle_ the errors */ /* FIXME: We really should do something to _handle_ the errors */
...@@ -973,20 +972,20 @@ static int __init mmc_omap_probe(struct platform_device *pdev) ...@@ -973,20 +972,20 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
struct omap_mmc_conf *minfo = pdev->dev.platform_data; struct omap_mmc_conf *minfo = pdev->dev.platform_data;
struct mmc_host *mmc; struct mmc_host *mmc;
struct mmc_omap_host *host = NULL; struct mmc_omap_host *host = NULL;
struct resource *r;
int ret = 0; int ret = 0;
int irq;
if (platform_get_resource(pdev, IORESOURCE_MEM, 0) || r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
platform_get_irq(pdev, IORESOURCE_IRQ, 0)) { irq = platform_get_irq(pdev, 0);
dev_err(&pdev->dev, "mmc_omap_probe: invalid resource type\n"); if (!r || irq < 0)
return -ENODEV; return -ENXIO;
}
if (!request_mem_region(pdev->resource[0].start, r = request_mem_region(pdev->resource[0].start,
pdev->resource[0].end - pdev->resource[0].start + 1, pdev->resource[0].end - pdev->resource[0].start + 1,
pdev->name)) { pdev->name);
dev_dbg(&pdev->dev, "request_mem_region failed\n"); if (!r)
return -EBUSY; return -EBUSY;
}
mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev); mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev);
if (!mmc) { if (!mmc) {
...@@ -1003,6 +1002,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev) ...@@ -1003,6 +1002,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
host->dma_timer.data = (unsigned long) host; host->dma_timer.data = (unsigned long) host;
host->id = pdev->id; host->id = pdev->id;
host->res = r;
host->irq = irq;
if (cpu_is_omap24xx()) { if (cpu_is_omap24xx()) {
host->iclk = clk_get(&pdev->dev, "mmc_ick"); host->iclk = clk_get(&pdev->dev, "mmc_ick");
...@@ -1032,11 +1033,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev) ...@@ -1032,11 +1033,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
host->dma_ch = -1; host->dma_ch = -1;
host->irq = pdev->resource[1].start; host->irq = pdev->resource[1].start;
host->base = ioremap(pdev->res.start, SZ_4K); host->base = (void __iomem*)IO_ADDRESS(r->start);
if (!host->base) {
ret = -ENOMEM;
goto out;
}
if (minfo->wire4) if (minfo->wire4)
mmc->caps |= MMC_CAP_4_BIT_DATA; mmc->caps |= MMC_CAP_4_BIT_DATA;
...@@ -1057,8 +1054,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev) ...@@ -1057,8 +1054,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
if (host->power_pin >= 0) { if (host->power_pin >= 0) {
if ((ret = omap_request_gpio(host->power_pin)) != 0) { if ((ret = omap_request_gpio(host->power_pin)) != 0) {
dev_err(mmc_dev(host->mmc), "Unable to get GPIO dev_err(mmc_dev(host->mmc),
pin for MMC power\n"); "Unable to get GPIO pin for MMC power\n");
goto out; goto out;
} }
omap_set_gpio_direction(host->power_pin, 0); omap_set_gpio_direction(host->power_pin, 0);
...@@ -1100,7 +1097,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev) ...@@ -1100,7 +1097,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
device_remove_file(&pdev->dev, &dev_attr_cover_switch); device_remove_file(&pdev->dev, &dev_attr_cover_switch);
} }
if (ret) { if (ret) {
dev_wan(mmc_dev(host->mmc), "Unable to create sysfs attributes\n"); dev_warn(mmc_dev(host->mmc), "Unable to create sysfs attributes\n");
free_irq(OMAP_GPIO_IRQ(host->switch_pin), host); free_irq(OMAP_GPIO_IRQ(host->switch_pin), host);
omap_free_gpio(host->switch_pin); omap_free_gpio(host->switch_pin);
host->switch_pin = -1; host->switch_pin = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment