diff options
Diffstat (limited to 'drivers/mmc/omap.c')
-rw-r--r-- | drivers/mmc/omap.c | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/drivers/mmc/omap.c b/drivers/mmc/omap.c index c25244b3657..52c9e52e6b7 100644 --- a/drivers/mmc/omap.c +++ b/drivers/mmc/omap.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/module.h> | 14 | #include <linux/module.h> |
16 | #include <linux/moduleparam.h> | 15 | #include <linux/moduleparam.h> |
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
@@ -61,6 +60,7 @@ struct mmc_omap_host { | |||
61 | unsigned char id; /* 16xx chips have 2 MMC blocks */ | 60 | unsigned char id; /* 16xx chips have 2 MMC blocks */ |
62 | struct clk * iclk; | 61 | struct clk * iclk; |
63 | struct clk * fclk; | 62 | struct clk * fclk; |
63 | struct resource *res; | ||
64 | void __iomem *base; | 64 | void __iomem *base; |
65 | int irq; | 65 | int irq; |
66 | unsigned char bus_mode; | 66 | unsigned char bus_mode; |
@@ -340,8 +340,6 @@ static void | |||
340 | mmc_omap_xfer_data(struct mmc_omap_host *host, int write) | 340 | mmc_omap_xfer_data(struct mmc_omap_host *host, int write) |
341 | { | 341 | { |
342 | int n; | 342 | int n; |
343 | void __iomem *reg; | ||
344 | u16 *p; | ||
345 | 343 | ||
346 | if (host->buffer_bytes_left == 0) { | 344 | if (host->buffer_bytes_left == 0) { |
347 | host->sg_idx++; | 345 | host->sg_idx++; |
@@ -658,12 +656,12 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data) | |||
658 | struct mmc_data *mmcdat = host->data; | 656 | struct mmc_data *mmcdat = host->data; |
659 | 657 | ||
660 | if (unlikely(host->dma_ch < 0)) { | 658 | if (unlikely(host->dma_ch < 0)) { |
661 | dev_err(mmc_dev(host->mmc), "DMA callback while DMA not | 659 | dev_err(mmc_dev(host->mmc), |
662 | enabled\n"); | 660 | "DMA callback while DMA not enabled\n"); |
663 | return; | 661 | return; |
664 | } | 662 | } |
665 | /* FIXME: We really should do something to _handle_ the errors */ | 663 | /* FIXME: We really should do something to _handle_ the errors */ |
666 | if (ch_status & OMAP_DMA_TOUT_IRQ) { | 664 | if (ch_status & OMAP1_DMA_TOUT_IRQ) { |
667 | dev_err(mmc_dev(host->mmc),"DMA timeout\n"); | 665 | dev_err(mmc_dev(host->mmc),"DMA timeout\n"); |
668 | return; | 666 | return; |
669 | } | 667 | } |
@@ -973,20 +971,20 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
973 | struct omap_mmc_conf *minfo = pdev->dev.platform_data; | 971 | struct omap_mmc_conf *minfo = pdev->dev.platform_data; |
974 | struct mmc_host *mmc; | 972 | struct mmc_host *mmc; |
975 | struct mmc_omap_host *host = NULL; | 973 | struct mmc_omap_host *host = NULL; |
974 | struct resource *r; | ||
976 | int ret = 0; | 975 | int ret = 0; |
976 | int irq; | ||
977 | 977 | ||
978 | if (platform_get_resource(pdev, IORESOURCE_MEM, 0) || | 978 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
979 | platform_get_irq(pdev, IORESOURCE_IRQ, 0)) { | 979 | irq = platform_get_irq(pdev, 0); |
980 | dev_err(&pdev->dev, "mmc_omap_probe: invalid resource type\n"); | 980 | if (!r || irq < 0) |
981 | return -ENODEV; | 981 | return -ENXIO; |
982 | } | ||
983 | 982 | ||
984 | if (!request_mem_region(pdev->resource[0].start, | 983 | r = request_mem_region(pdev->resource[0].start, |
985 | pdev->resource[0].end - pdev->resource[0].start + 1, | 984 | pdev->resource[0].end - pdev->resource[0].start + 1, |
986 | pdev->name)) { | 985 | pdev->name); |
987 | dev_dbg(&pdev->dev, "request_mem_region failed\n"); | 986 | if (!r) |
988 | return -EBUSY; | 987 | return -EBUSY; |
989 | } | ||
990 | 988 | ||
991 | mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev); | 989 | mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev); |
992 | if (!mmc) { | 990 | if (!mmc) { |
@@ -1003,6 +1001,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
1003 | host->dma_timer.data = (unsigned long) host; | 1001 | host->dma_timer.data = (unsigned long) host; |
1004 | 1002 | ||
1005 | host->id = pdev->id; | 1003 | host->id = pdev->id; |
1004 | host->res = r; | ||
1005 | host->irq = irq; | ||
1006 | 1006 | ||
1007 | if (cpu_is_omap24xx()) { | 1007 | if (cpu_is_omap24xx()) { |
1008 | host->iclk = clk_get(&pdev->dev, "mmc_ick"); | 1008 | host->iclk = clk_get(&pdev->dev, "mmc_ick"); |
@@ -1032,19 +1032,16 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
1032 | host->dma_ch = -1; | 1032 | host->dma_ch = -1; |
1033 | 1033 | ||
1034 | host->irq = pdev->resource[1].start; | 1034 | host->irq = pdev->resource[1].start; |
1035 | host->base = ioremap(pdev->res.start, SZ_4K); | 1035 | host->base = (void __iomem*)IO_ADDRESS(r->start); |
1036 | if (!host->base) { | ||
1037 | ret = -ENOMEM; | ||
1038 | goto out; | ||
1039 | } | ||
1040 | |||
1041 | if (minfo->wire4) | ||
1042 | mmc->caps |= MMC_CAP_4_BIT_DATA; | ||
1043 | 1036 | ||
1044 | mmc->ops = &mmc_omap_ops; | 1037 | mmc->ops = &mmc_omap_ops; |
1045 | mmc->f_min = 400000; | 1038 | mmc->f_min = 400000; |
1046 | mmc->f_max = 24000000; | 1039 | mmc->f_max = 24000000; |
1047 | mmc->ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34; | 1040 | mmc->ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34; |
1041 | mmc->caps = MMC_CAP_BYTEBLOCK; | ||
1042 | |||
1043 | if (minfo->wire4) | ||
1044 | mmc->caps |= MMC_CAP_4_BIT_DATA; | ||
1048 | 1045 | ||
1049 | /* Use scatterlist DMA to reduce per-transfer costs. | 1046 | /* Use scatterlist DMA to reduce per-transfer costs. |
1050 | * NOTE max_seg_size assumption that small blocks aren't | 1047 | * NOTE max_seg_size assumption that small blocks aren't |
@@ -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); |
@@ -1086,7 +1083,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev) | |||
1086 | 1083 | ||
1087 | omap_set_gpio_direction(host->switch_pin, 1); | 1084 | omap_set_gpio_direction(host->switch_pin, 1); |
1088 | ret = request_irq(OMAP_GPIO_IRQ(host->switch_pin), | 1085 | ret = request_irq(OMAP_GPIO_IRQ(host->switch_pin), |
1089 | mmc_omap_switch_irq, SA_TRIGGER_RISING, DRIVER_NAME, host); | 1086 | mmc_omap_switch_irq, IRQF_TRIGGER_RISING, DRIVER_NAME, host); |
1090 | if (ret) { | 1087 | if (ret) { |
1091 | dev_warn(mmc_dev(host->mmc), "Unable to get IRQ for MMC cover switch\n"); | 1088 | dev_warn(mmc_dev(host->mmc), "Unable to get IRQ for MMC cover switch\n"); |
1092 | omap_free_gpio(host->switch_pin); | 1089 | omap_free_gpio(host->switch_pin); |
@@ -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; |