diff options
author | Tony Lindgren <tony@atomide.com> | 2006-07-01 14:56:44 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-07-01 14:56:44 -0400 |
commit | ce9c1a8388e16f2a158491ceb5c58a6101b905f6 (patch) | |
tree | 00028beeb3c308dc16c47622c5855a84ebf783b0 /drivers | |
parent | 0d1bca1602fb9996a3730e0e882945d7361507b1 (diff) |
[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: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/omap.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/mmc/omap.c b/drivers/mmc/omap.c index 4aa1e56235c9..2b7996da875b 100644 --- a/drivers/mmc/omap.c +++ b/drivers/mmc/omap.c | |||
@@ -61,6 +61,7 @@ struct mmc_omap_host { | |||
61 | unsigned char id; /* 16xx chips have 2 MMC blocks */ | 61 | unsigned char id; /* 16xx chips have 2 MMC blocks */ |
62 | struct clk * iclk; | 62 | struct clk * iclk; |
63 | struct clk * fclk; | 63 | struct clk * fclk; |
64 | struct resource *res; | ||
64 | void __iomem *base; | 65 | void __iomem *base; |
65 | int irq; | 66 | int irq; |
66 | unsigned char bus_mode; | 67 | unsigned char bus_mode; |
@@ -340,8 +341,6 @@ static void | |||
340 | mmc_omap_xfer_data(struct mmc_omap_host *host, int write) | 341 | mmc_omap_xfer_data(struct mmc_omap_host *host, int write) |
341 | { | 342 | { |
342 | int n; | 343 | int n; |
343 | void __iomem *reg; | ||
344 | u16 *p; | ||
345 | 344 | ||
346 | if (host->buffer_bytes_left == 0) { | 345 | if (host->buffer_bytes_left == 0) { |
347 | host->sg_idx++; | 346 | host->sg_idx++; |
@@ -658,8 +657,8 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data) | |||
658 | struct mmc_data *mmcdat = host->data; | 657 | struct mmc_data *mmcdat = host->data; |
659 | 658 | ||
660 | if (unlikely(host->dma_ch < 0)) { | 659 | if (unlikely(host->dma_ch < 0)) { |
661 | dev_err(mmc_dev(host->mmc), "DMA callback while DMA not | 660 | dev_err(mmc_dev(host->mmc), |
662 | enabled\n"); | 661 | "DMA callback while DMA not enabled\n"); |
663 | return; | 662 | return; |
664 | } | 663 | } |
665 | /* FIXME: We really should do something to _handle_ the errors */ | 664 | /* 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 | struct omap_mmc_conf *minfo = pdev->dev.platform_data; | 972 | struct omap_mmc_conf *minfo = pdev->dev.platform_data; |
974 | struct mmc_host *mmc; | 973 | struct mmc_host *mmc; |
975 | struct mmc_omap_host *host = NULL; | 974 | struct mmc_omap_host *host = NULL; |
975 | struct resource *r; | ||
976 | int ret = 0; | 976 | int ret = 0; |
977 | int irq; | ||
977 | 978 | ||
978 | if (platform_get_resource(pdev, IORESOURCE_MEM, 0) || | 979 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
979 | platform_get_irq(pdev, IORESOURCE_IRQ, 0)) { | 980 | irq = platform_get_irq(pdev, 0); |
980 | dev_err(&pdev->dev, "mmc_omap_probe: invalid resource type\n"); | 981 | if (!r || irq < 0) |
981 | return -ENODEV; | 982 | return -ENXIO; |
982 | } | ||
983 | 983 | ||
984 | if (!request_mem_region(pdev->resource[0].start, | 984 | r = request_mem_region(pdev->resource[0].start, |
985 | pdev->resource[0].end - pdev->resource[0].start + 1, | 985 | pdev->resource[0].end - pdev->resource[0].start + 1, |
986 | pdev->name)) { | 986 | pdev->name); |
987 | dev_dbg(&pdev->dev, "request_mem_region failed\n"); | 987 | if (!r) |
988 | return -EBUSY; | 988 | return -EBUSY; |
989 | } | ||
990 | 989 | ||
991 | mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev); | 990 | mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev); |
992 | if (!mmc) { | 991 | if (!mmc) { |
@@ -1003,6 +1002,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
1003 | host->dma_timer.data = (unsigned long) host; | 1002 | host->dma_timer.data = (unsigned long) host; |
1004 | 1003 | ||
1005 | host->id = pdev->id; | 1004 | host->id = pdev->id; |
1005 | host->res = r; | ||
1006 | host->irq = irq; | ||
1006 | 1007 | ||
1007 | if (cpu_is_omap24xx()) { | 1008 | if (cpu_is_omap24xx()) { |
1008 | host->iclk = clk_get(&pdev->dev, "mmc_ick"); | 1009 | host->iclk = clk_get(&pdev->dev, "mmc_ick"); |
@@ -1032,13 +1033,9 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
1032 | host->dma_ch = -1; | 1033 | host->dma_ch = -1; |
1033 | 1034 | ||
1034 | host->irq = pdev->resource[1].start; | 1035 | host->irq = pdev->resource[1].start; |
1035 | host->base = ioremap(pdev->res.start, SZ_4K); | 1036 | host->base = (void __iomem*)IO_ADDRESS(r->start); |
1036 | if (!host->base) { | ||
1037 | ret = -ENOMEM; | ||
1038 | goto out; | ||
1039 | } | ||
1040 | 1037 | ||
1041 | if (minfo->wire4) | 1038 | if (minfo->wire4) |
1042 | mmc->caps |= MMC_CAP_4_BIT_DATA; | 1039 | mmc->caps |= MMC_CAP_4_BIT_DATA; |
1043 | 1040 | ||
1044 | mmc->ops = &mmc_omap_ops; | 1041 | mmc->ops = &mmc_omap_ops; |
@@ -1057,8 +1054,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
1057 | 1054 | ||
1058 | if (host->power_pin >= 0) { | 1055 | if (host->power_pin >= 0) { |
1059 | if ((ret = omap_request_gpio(host->power_pin)) != 0) { | 1056 | if ((ret = omap_request_gpio(host->power_pin)) != 0) { |
1060 | dev_err(mmc_dev(host->mmc), "Unable to get GPIO | 1057 | dev_err(mmc_dev(host->mmc), |
1061 | pin for MMC power\n"); | 1058 | "Unable to get GPIO pin for MMC power\n"); |
1062 | goto out; | 1059 | goto out; |
1063 | } | 1060 | } |
1064 | omap_set_gpio_direction(host->power_pin, 0); | 1061 | omap_set_gpio_direction(host->power_pin, 0); |
@@ -1100,7 +1097,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
1100 | device_remove_file(&pdev->dev, &dev_attr_cover_switch); | 1097 | device_remove_file(&pdev->dev, &dev_attr_cover_switch); |
1101 | } | 1098 | } |
1102 | if (ret) { | 1099 | if (ret) { |
1103 | dev_wan(mmc_dev(host->mmc), "Unable to create sysfs attributes\n"); | 1100 | dev_warn(mmc_dev(host->mmc), "Unable to create sysfs attributes\n"); |
1104 | free_irq(OMAP_GPIO_IRQ(host->switch_pin), host); | 1101 | free_irq(OMAP_GPIO_IRQ(host->switch_pin), host); |
1105 | omap_free_gpio(host->switch_pin); | 1102 | omap_free_gpio(host->switch_pin); |
1106 | host->switch_pin = -1; | 1103 | host->switch_pin = -1; |