]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mmc/omap.c
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6-omap-h63xx.git] / drivers / mmc / omap.c
index c25244b3657bb532458fab1dae08874cf0aedc7f..d593ef342e759f1a551e8303d250f981fd5f4fd6 100644 (file)
@@ -11,7 +11,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
@@ -61,6 +60,7 @@ struct mmc_omap_host {
        unsigned char           id; /* 16xx chips have 2 MMC blocks */
        struct clk *            iclk;
        struct clk *            fclk;
+       struct resource         *res;
        void __iomem            *base;
        int                     irq;
        unsigned char           bus_mode;
@@ -340,8 +340,6 @@ static void
 mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
 {
        int n;
-       void __iomem *reg;
-       u16 *p;
 
        if (host->buffer_bytes_left == 0) {
                host->sg_idx++;
@@ -379,7 +377,7 @@ static inline void mmc_omap_report_irq(u16 status)
                }
 }
 
-static irqreturn_t mmc_omap_irq(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
 {
        struct mmc_omap_host * host = (struct mmc_omap_host *)dev_id;
        u16 status;
@@ -516,7 +514,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id, struct pt_regs *regs)
        return IRQ_HANDLED;
 }
 
-static irqreturn_t mmc_omap_switch_irq(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t mmc_omap_switch_irq(int irq, void *dev_id)
 {
        struct mmc_omap_host *host = (struct mmc_omap_host *) dev_id;
 
@@ -642,8 +640,7 @@ mmc_omap_prepare_dma(struct mmc_omap_host *host, struct mmc_data *data)
        }
 
        /* Max limit for DMA frame count is 0xffff */
-       if (unlikely(count > 0xffff))
-               BUG();
+       BUG_ON(count > 0xffff);
 
        OMAP_MMC_WRITE(host->base, BUF, buf);
        omap_set_dma_transfer_params(dma_ch, OMAP_DMA_DATA_TYPE_S16,
@@ -658,12 +655,12 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data)
        struct mmc_data *mmcdat = host->data;
 
        if (unlikely(host->dma_ch < 0)) {
-               dev_err(mmc_dev(host->mmc), "DMA callback while DMA not
-                               enabled\n");
+               dev_err(mmc_dev(host->mmc),
+                       "DMA callback while DMA not enabled\n");
                return;
        }
        /* FIXME: We really should do something to _handle_ the errors */
-       if (ch_status & OMAP_DMA_TOUT_IRQ) {
+       if (ch_status & OMAP1_DMA_TOUT_IRQ) {
                dev_err(mmc_dev(host->mmc),"DMA timeout\n");
                return;
        }
@@ -973,20 +970,20 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
        struct omap_mmc_conf *minfo = pdev->dev.platform_data;
        struct mmc_host *mmc;
        struct mmc_omap_host *host = NULL;
+       struct resource *r;
        int ret = 0;
+       int irq;
        
-       if (platform_get_resource(pdev, IORESOURCE_MEM, 0) ||
-                       platform_get_irq(pdev, IORESOURCE_IRQ, 0)) {
-               dev_err(&pdev->dev, "mmc_omap_probe: invalid resource type\n");
-               return -ENODEV;
-       }
+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       irq = platform_get_irq(pdev, 0);
+       if (!r || irq < 0)
+               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->name)) {
-               dev_dbg(&pdev->dev, "request_mem_region failed\n");
+                              pdev->name);
+       if (!r)
                return -EBUSY;
-       }
 
        mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev);
        if (!mmc) {
@@ -1003,6 +1000,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
        host->dma_timer.data = (unsigned long) host;
 
        host->id = pdev->id;
+       host->res = r;
+       host->irq = irq;
 
        if (cpu_is_omap24xx()) {
                host->iclk = clk_get(&pdev->dev, "mmc_ick");
@@ -1032,19 +1031,16 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
        host->dma_ch = -1;
 
        host->irq = pdev->resource[1].start;
-       host->base = ioremap(pdev->res.start, SZ_4K);
-       if (!host->base) {
-               ret = -ENOMEM;
-               goto out;
-       }
-
-        if (minfo->wire4)
-                mmc->caps |= MMC_CAP_4_BIT_DATA;
+       host->base = (void __iomem*)IO_ADDRESS(r->start);
 
        mmc->ops = &mmc_omap_ops;
        mmc->f_min = 400000;
        mmc->f_max = 24000000;
        mmc->ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34;
+       mmc->caps = MMC_CAP_BYTEBLOCK;
+
+       if (minfo->wire4)
+                mmc->caps |= MMC_CAP_4_BIT_DATA;
 
        /* Use scatterlist DMA to reduce per-transfer costs.
         * NOTE max_seg_size assumption that small blocks aren't
@@ -1057,8 +1053,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
 
        if (host->power_pin >= 0) {
                if ((ret = omap_request_gpio(host->power_pin)) != 0) {
-                       dev_err(mmc_dev(host->mmc), "Unable to get GPIO
-                                       pin for MMC power\n");
+                       dev_err(mmc_dev(host->mmc),
+                               "Unable to get GPIO pin for MMC power\n");
                        goto out;
                }
                omap_set_gpio_direction(host->power_pin, 0);
@@ -1086,7 +1082,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
 
                omap_set_gpio_direction(host->switch_pin, 1);
                ret = request_irq(OMAP_GPIO_IRQ(host->switch_pin),
-                                 mmc_omap_switch_irq, SA_TRIGGER_RISING, DRIVER_NAME, host);
+                                 mmc_omap_switch_irq, IRQF_TRIGGER_RISING, DRIVER_NAME, host);
                if (ret) {
                        dev_warn(mmc_dev(host->mmc), "Unable to get IRQ for MMC cover switch\n");
                        omap_free_gpio(host->switch_pin);
@@ -1100,7 +1096,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
                                device_remove_file(&pdev->dev, &dev_attr_cover_switch);
                }
                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);
                        omap_free_gpio(host->switch_pin);
                        host->switch_pin = -1;