diff options
Diffstat (limited to 'drivers/mmc/omap.c')
| -rw-r--r-- | drivers/mmc/omap.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/drivers/mmc/omap.c b/drivers/mmc/omap.c index e0e14b3423c6..ddf06b32c159 100644 --- a/drivers/mmc/omap.c +++ b/drivers/mmc/omap.c | |||
| @@ -60,6 +60,7 @@ struct mmc_omap_host { | |||
| 60 | unsigned char id; /* 16xx chips have 2 MMC blocks */ | 60 | unsigned char id; /* 16xx chips have 2 MMC blocks */ |
| 61 | struct clk * iclk; | 61 | struct clk * iclk; |
| 62 | struct clk * fclk; | 62 | struct clk * fclk; |
| 63 | struct resource *res; | ||
| 63 | void __iomem *base; | 64 | void __iomem *base; |
| 64 | int irq; | 65 | int irq; |
| 65 | unsigned char bus_mode; | 66 | unsigned char bus_mode; |
| @@ -339,8 +340,6 @@ static void | |||
| 339 | mmc_omap_xfer_data(struct mmc_omap_host *host, int write) | 340 | mmc_omap_xfer_data(struct mmc_omap_host *host, int write) |
| 340 | { | 341 | { |
| 341 | int n; | 342 | int n; |
| 342 | void __iomem *reg; | ||
| 343 | u16 *p; | ||
| 344 | 343 | ||
| 345 | if (host->buffer_bytes_left == 0) { | 344 | if (host->buffer_bytes_left == 0) { |
| 346 | host->sg_idx++; | 345 | host->sg_idx++; |
| @@ -657,12 +656,12 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data) | |||
| 657 | struct mmc_data *mmcdat = host->data; | 656 | struct mmc_data *mmcdat = host->data; |
| 658 | 657 | ||
| 659 | if (unlikely(host->dma_ch < 0)) { | 658 | if (unlikely(host->dma_ch < 0)) { |
| 660 | dev_err(mmc_dev(host->mmc), "DMA callback while DMA not | 659 | dev_err(mmc_dev(host->mmc), |
| 661 | enabled\n"); | 660 | "DMA callback while DMA not enabled\n"); |
| 662 | return; | 661 | return; |
| 663 | } | 662 | } |
| 664 | /* FIXME: We really should do something to _handle_ the errors */ | 663 | /* FIXME: We really should do something to _handle_ the errors */ |
| 665 | if (ch_status & OMAP_DMA_TOUT_IRQ) { | 664 | if (ch_status & OMAP1_DMA_TOUT_IRQ) { |
| 666 | dev_err(mmc_dev(host->mmc),"DMA timeout\n"); | 665 | dev_err(mmc_dev(host->mmc),"DMA timeout\n"); |
| 667 | return; | 666 | return; |
| 668 | } | 667 | } |
| @@ -972,20 +971,20 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
| 972 | struct omap_mmc_conf *minfo = pdev->dev.platform_data; | 971 | struct omap_mmc_conf *minfo = pdev->dev.platform_data; |
| 973 | struct mmc_host *mmc; | 972 | struct mmc_host *mmc; |
| 974 | struct mmc_omap_host *host = NULL; | 973 | struct mmc_omap_host *host = NULL; |
| 974 | struct resource *r; | ||
| 975 | int ret = 0; | 975 | int ret = 0; |
| 976 | int irq; | ||
| 976 | 977 | ||
| 977 | if (platform_get_resource(pdev, IORESOURCE_MEM, 0) || | 978 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 978 | platform_get_irq(pdev, IORESOURCE_IRQ, 0)) { | 979 | irq = platform_get_irq(pdev, 0); |
| 979 | dev_err(&pdev->dev, "mmc_omap_probe: invalid resource type\n"); | 980 | if (!r || irq < 0) |
| 980 | return -ENODEV; | 981 | return -ENXIO; |
| 981 | } | ||
| 982 | 982 | ||
| 983 | if (!request_mem_region(pdev->resource[0].start, | 983 | r = request_mem_region(pdev->resource[0].start, |
| 984 | pdev->resource[0].end - pdev->resource[0].start + 1, | 984 | pdev->resource[0].end - pdev->resource[0].start + 1, |
| 985 | pdev->name)) { | 985 | pdev->name); |
| 986 | dev_dbg(&pdev->dev, "request_mem_region failed\n"); | 986 | if (!r) |
| 987 | return -EBUSY; | 987 | return -EBUSY; |
| 988 | } | ||
| 989 | 988 | ||
| 990 | mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev); | 989 | mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev); |
| 991 | if (!mmc) { | 990 | if (!mmc) { |
| @@ -1002,6 +1001,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
| 1002 | host->dma_timer.data = (unsigned long) host; | 1001 | host->dma_timer.data = (unsigned long) host; |
| 1003 | 1002 | ||
| 1004 | host->id = pdev->id; | 1003 | host->id = pdev->id; |
| 1004 | host->res = r; | ||
| 1005 | host->irq = irq; | ||
| 1005 | 1006 | ||
| 1006 | if (cpu_is_omap24xx()) { | 1007 | if (cpu_is_omap24xx()) { |
| 1007 | host->iclk = clk_get(&pdev->dev, "mmc_ick"); | 1008 | host->iclk = clk_get(&pdev->dev, "mmc_ick"); |
| @@ -1031,13 +1032,9 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
| 1031 | host->dma_ch = -1; | 1032 | host->dma_ch = -1; |
| 1032 | 1033 | ||
| 1033 | host->irq = pdev->resource[1].start; | 1034 | host->irq = pdev->resource[1].start; |
| 1034 | host->base = ioremap(pdev->res.start, SZ_4K); | 1035 | host->base = (void __iomem*)IO_ADDRESS(r->start); |
| 1035 | if (!host->base) { | ||
| 1036 | ret = -ENOMEM; | ||
| 1037 | goto out; | ||
| 1038 | } | ||
| 1039 | 1036 | ||
| 1040 | if (minfo->wire4) | 1037 | if (minfo->wire4) |
| 1041 | mmc->caps |= MMC_CAP_4_BIT_DATA; | 1038 | mmc->caps |= MMC_CAP_4_BIT_DATA; |
| 1042 | 1039 | ||
| 1043 | mmc->ops = &mmc_omap_ops; | 1040 | mmc->ops = &mmc_omap_ops; |
| @@ -1056,8 +1053,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
| 1056 | 1053 | ||
| 1057 | if (host->power_pin >= 0) { | 1054 | if (host->power_pin >= 0) { |
| 1058 | if ((ret = omap_request_gpio(host->power_pin)) != 0) { | 1055 | if ((ret = omap_request_gpio(host->power_pin)) != 0) { |
| 1059 | dev_err(mmc_dev(host->mmc), "Unable to get GPIO | 1056 | dev_err(mmc_dev(host->mmc), |
| 1060 | pin for MMC power\n"); | 1057 | "Unable to get GPIO pin for MMC power\n"); |
| 1061 | goto out; | 1058 | goto out; |
| 1062 | } | 1059 | } |
| 1063 | omap_set_gpio_direction(host->power_pin, 0); | 1060 | omap_set_gpio_direction(host->power_pin, 0); |
| @@ -1099,7 +1096,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
| 1099 | device_remove_file(&pdev->dev, &dev_attr_cover_switch); | 1096 | device_remove_file(&pdev->dev, &dev_attr_cover_switch); |
| 1100 | } | 1097 | } |
| 1101 | if (ret) { | 1098 | if (ret) { |
| 1102 | dev_wan(mmc_dev(host->mmc), "Unable to create sysfs attributes\n"); | 1099 | dev_warn(mmc_dev(host->mmc), "Unable to create sysfs attributes\n"); |
| 1103 | free_irq(OMAP_GPIO_IRQ(host->switch_pin), host); | 1100 | free_irq(OMAP_GPIO_IRQ(host->switch_pin), host); |
| 1104 | omap_free_gpio(host->switch_pin); | 1101 | omap_free_gpio(host->switch_pin); |
| 1105 | host->switch_pin = -1; | 1102 | host->switch_pin = -1; |
