ucc_geth: migrate ucc_geth to phylib
[powerpc.git] / drivers / mmc / au1xmmc.c
index 914d62b..b834be2 100644 (file)
@@ -34,7 +34,6 @@
  * So we use the timer to check the status manually.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -153,8 +152,9 @@ static inline int au1xmmc_card_inserted(struct au1xmmc_host *host)
                ? 1 : 0;
 }
 
-static inline int au1xmmc_card_readonly(struct au1xmmc_host *host)
+static int au1xmmc_card_readonly(struct mmc_host *mmc)
 {
+       struct au1xmmc_host *host = mmc_priv(mmc);
        return (bcsr->status & au1xmmc_card_table[host->id].wpstatus)
                ? 1 : 0;
 }
@@ -194,6 +194,8 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
        u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT);
 
        switch (mmc_resp_type(cmd)) {
+       case MMC_RSP_NONE:
+               break;
        case MMC_RSP_R1:
                mmccmd |= SD_CMD_RT_1;
                break;
@@ -206,6 +208,10 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
        case MMC_RSP_R3:
                mmccmd |= SD_CMD_RT_3;
                break;
+       default:
+               printk(KERN_INFO "au1xmmc: unhandled response type %02x\n",
+                       mmc_resp_type(cmd));
+               return MMC_ERR_INVALID;
        }
 
        switch(cmd->opcode) {
@@ -310,7 +316,7 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)
                }
                else
                        data->bytes_xfered =
-                               (data->blocks * (1 << data->blksz_bits)) -
+                               (data->blocks * data->blksz) -
                                host->pio.len;
        }
 
@@ -575,7 +581,7 @@ static int
 au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data)
 {
 
-       int datalen = data->blocks * (1 << data->blksz_bits);
+       int datalen = data->blocks * data->blksz;
 
        if (dma != 0)
                host->flags |= HOST_F_DMA;
@@ -596,7 +602,7 @@ au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data)
        if (host->dma.len == 0)
                return MMC_ERR_TIMEOUT;
 
-       au_writel((1 << data->blksz_bits) - 1, HOST_BLKSIZE(host));
+       au_writel(data->blksz - 1, HOST_BLKSIZE(host));
 
        if (host->flags & HOST_F_DMA) {
                int i;
@@ -732,7 +738,7 @@ static void au1xmmc_set_ios(struct mmc_host* mmc, struct mmc_ios* ios)
        }
 }
 
-static void au1xmmc_dma_callback(int irq, void *dev_id, struct pt_regs *regs)
+static void au1xmmc_dma_callback(int irq, void *dev_id)
 {
        struct au1xmmc_host *host = (struct au1xmmc_host *) dev_id;
 
@@ -751,7 +757,7 @@ static void au1xmmc_dma_callback(int irq, void *dev_id, struct pt_regs *regs)
 #define STATUS_DATA_IN  (SD_STATUS_NE)
 #define STATUS_DATA_OUT (SD_STATUS_TH)
 
-static irqreturn_t au1xmmc_irq(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t au1xmmc_irq(int irq, void *dev_id)
 {
 
        u32 status;
@@ -876,9 +882,10 @@ static void au1xmmc_init_dma(struct au1xmmc_host *host)
        host->rx_chan = rxchan;
 }
 
-struct mmc_host_ops au1xmmc_ops = {
+static const struct mmc_host_ops au1xmmc_ops = {
        .request        = au1xmmc_request,
        .set_ios        = au1xmmc_set_ios,
+       .get_ro         = au1xmmc_card_readonly,
 };
 
 static int __devinit au1xmmc_probe(struct platform_device *pdev)
@@ -887,7 +894,7 @@ static int __devinit au1xmmc_probe(struct platform_device *pdev)
        int i, ret = 0;
 
        /* THe interrupt is shared among all controllers */
-       ret = request_irq(AU1100_SD_IRQ, au1xmmc_irq, SA_INTERRUPT, "MMC", 0);
+       ret = request_irq(AU1100_SD_IRQ, au1xmmc_irq, IRQF_DISABLED, "MMC", 0);
 
        if (ret) {
                printk(DRIVER_NAME "ERROR: Couldn't get int %d: %d\n",
@@ -915,6 +922,9 @@ static int __devinit au1xmmc_probe(struct platform_device *pdev)
                mmc->max_seg_size = AU1XMMC_DESCRIPTOR_SIZE;
                mmc->max_phys_segs = AU1XMMC_DESCRIPTOR_COUNT;
 
+               mmc->max_blk_size = 2048;
+               mmc->max_blk_count = 512;
+
                mmc->ocr_avail = AU1XMMC_OCR;
 
                host = mmc_priv(mmc);