]> Pileus Git - ~andy/linux/blobdiff - drivers/mmc/sdhci.c
Driver core: add device symlink back to sysfs
[~andy/linux] / drivers / mmc / sdhci.c
index 4bf1fea5e2c405acccfa1b7ebbc069a2d323a787..d749f08601b8138510d0d7e0e610e47586a1b58d 100644 (file)
@@ -22,9 +22,6 @@
 #include "sdhci.h"
 
 #define DRIVER_NAME "sdhci"
-#define DRIVER_VERSION "0.12"
-
-#define BUGMAIL "<sdhci-devel@list.drzeus.cx>"
 
 #define DBG(f, x...) \
        pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x)
@@ -154,8 +151,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
        /* hw clears the bit when it's done */
        while (readb(host->ioaddr + SDHCI_SOFTWARE_RESET) & mask) {
                if (timeout == 0) {
-                       printk(KERN_ERR "%s: Reset 0x%x never completed. "
-                               "Please report this to " BUGMAIL ".\n",
+                       printk(KERN_ERR "%s: Reset 0x%x never completed.\n",
                                mmc_hostname(host->mmc), (int)mask);
                        sdhci_dumpregs(host);
                        return;
@@ -474,12 +470,11 @@ static void sdhci_finish_data(struct sdhci_host *host)
 
        if ((data->error == MMC_ERR_NONE) && blocks) {
                printk(KERN_ERR "%s: Controller signalled completion even "
-                       "though there were blocks left. Please report this "
-                       "to " BUGMAIL ".\n", mmc_hostname(host->mmc));
+                       "though there were blocks left.\n",
+                       mmc_hostname(host->mmc));
                data->error = MMC_ERR_FAILED;
        } else if (host->size != 0) {
-               printk(KERN_ERR "%s: %d bytes were left untransferred. "
-                       "Please report this to " BUGMAIL ".\n",
+               printk(KERN_ERR "%s: %d bytes were left untransferred.\n",
                        mmc_hostname(host->mmc), host->size);
                data->error = MMC_ERR_FAILED;
        }
@@ -526,8 +521,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
        while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) {
                if (timeout == 0) {
                        printk(KERN_ERR "%s: Controller never released "
-                               "inhibit bit(s). Please report this to "
-                               BUGMAIL ".\n", mmc_hostname(host->mmc));
+                               "inhibit bit(s).\n", mmc_hostname(host->mmc));
                        sdhci_dumpregs(host);
                        cmd->error = MMC_ERR_FAILED;
                        tasklet_schedule(&host->finish_tasklet);
@@ -548,8 +542,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
        sdhci_set_transfer_mode(host, cmd->data);
 
        if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) {
-               printk(KERN_ERR "%s: Unsupported response type! "
-                       "Please report this to " BUGMAIL ".\n",
+               printk(KERN_ERR "%s: Unsupported response type!\n",
                        mmc_hostname(host->mmc));
                cmd->error = MMC_ERR_INVALID;
                tasklet_schedule(&host->finish_tasklet);
@@ -613,7 +606,6 @@ static void sdhci_finish_command(struct sdhci_host *host)
 static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
 {
        int div;
-       u8 ctrl;
        u16 clk;
        unsigned long timeout;
 
@@ -622,13 +614,6 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
 
        writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL);
 
-       ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL);
-       if (clock > 25000000)
-               ctrl |= SDHCI_CTRL_HISPD;
-       else
-               ctrl &= ~SDHCI_CTRL_HISPD;
-       writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL);
-
        if (clock == 0)
                goto out;
 
@@ -647,9 +632,8 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
        while (!((clk = readw(host->ioaddr + SDHCI_CLOCK_CONTROL))
                & SDHCI_CLOCK_INT_STABLE)) {
                if (timeout == 0) {
-                       printk(KERN_ERR "%s: Internal clock never stabilised. "
-                               "Please report this to " BUGMAIL ".\n",
-                               mmc_hostname(host->mmc));
+                       printk(KERN_ERR "%s: Internal clock never "
+                               "stabilised.\n", mmc_hostname(host->mmc));
                        sdhci_dumpregs(host);
                        return;
                }
@@ -769,10 +753,17 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
                sdhci_set_power(host, ios->vdd);
 
        ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL);
+
        if (ios->bus_width == MMC_BUS_WIDTH_4)
                ctrl |= SDHCI_CTRL_4BITBUS;
        else
                ctrl &= ~SDHCI_CTRL_4BITBUS;
+
+       if (ios->timing == MMC_TIMING_SD_HS)
+               ctrl |= SDHCI_CTRL_HISPD;
+       else
+               ctrl &= ~SDHCI_CTRL_HISPD;
+
        writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL);
 
        mmiowb();
@@ -899,9 +890,8 @@ static void sdhci_timeout_timer(unsigned long data)
        spin_lock_irqsave(&host->lock, flags);
 
        if (host->mrq) {
-               printk(KERN_ERR "%s: Timeout waiting for hardware interrupt. "
-                       "Please report this to " BUGMAIL ".\n",
-                       mmc_hostname(host->mmc));
+               printk(KERN_ERR "%s: Timeout waiting for hardware "
+                       "interrupt.\n", mmc_hostname(host->mmc));
                sdhci_dumpregs(host);
 
                if (host->data) {
@@ -935,8 +925,6 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
                printk(KERN_ERR "%s: Got command interrupt even though no "
                        "command operation was in progress.\n",
                        mmc_hostname(host->mmc));
-               printk(KERN_ERR "%s: Please report this to " BUGMAIL ".\n",
-                       mmc_hostname(host->mmc));
                sdhci_dumpregs(host);
                return;
        }
@@ -972,8 +960,6 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
                printk(KERN_ERR "%s: Got data interrupt even though no "
                        "data operation was in progress.\n",
                        mmc_hostname(host->mmc));
-               printk(KERN_ERR "%s: Please report this to " BUGMAIL ".\n",
-                       mmc_hostname(host->mmc));
                sdhci_dumpregs(host);
 
                return;
@@ -1007,7 +993,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
 
        intmask = readl(host->ioaddr + SDHCI_INT_STATUS);
 
-       if (!intmask) {
+       if (!intmask || intmask == 0xffffffff) {
                result = IRQ_NONE;
                goto out;
        }
@@ -1045,8 +1031,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
        intmask &= SDHCI_INT_BUS_POWER;
 
        if (intmask) {
-               printk(KERN_ERR "%s: Unexpected interrupt 0x%08x. Please "
-                       "report this to " BUGMAIL ".\n",
+               printk(KERN_ERR "%s: Unexpected interrupt 0x%08x.\n",
                        mmc_hostname(host->mmc), intmask);
                sdhci_dumpregs(host);
 
@@ -1094,6 +1079,13 @@ static int sdhci_suspend (struct pci_dev *pdev, pm_message_t state)
 
        pci_save_state(pdev);
        pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
+
+       for (i = 0;i < chip->num_slots;i++) {
+               if (!chip->hosts[i])
+                       continue;
+               free_irq(chip->hosts[i]->irq, chip->hosts[i]);
+       }
+
        pci_disable_device(pdev);
        pci_set_power_state(pdev, pci_choose_state(pdev, state));
 
@@ -1122,6 +1114,11 @@ static int sdhci_resume (struct pci_dev *pdev)
                        continue;
                if (chip->hosts[i]->flags & SDHCI_USE_DMA)
                        pci_set_master(pdev);
+               ret = request_irq(chip->hosts[i]->irq, sdhci_irq,
+                       IRQF_SHARED, chip->hosts[i]->slot_descr,
+                       chip->hosts[i]);
+               if (ret)
+                       return ret;
                sdhci_init(chip->hosts[i]);
                mmiowb();
                ret = mmc_resume_host(chip->hosts[i]->mmc);
@@ -1288,6 +1285,9 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
        mmc->f_max = host->max_clk;
        mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE | MMC_CAP_BYTEBLOCK;
 
+       if (caps & SDHCI_CAN_DO_HISPD)
+               mmc->caps |= MMC_CAP_SD_HIGHSPEED;
+
        mmc->ocr_avail = 0;
        if (caps & SDHCI_CAN_VDD_330)
                mmc->ocr_avail |= MMC_VDD_32_33|MMC_VDD_33_34;
@@ -1296,13 +1296,6 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
        if (caps & SDHCI_CAN_VDD_180)
                mmc->ocr_avail |= MMC_VDD_17_18|MMC_VDD_18_19;
 
-       if ((host->max_clk > 25000000) && !(caps & SDHCI_CAN_DO_HISPD)) {
-               printk(KERN_ERR "%s: Controller reports > 25 MHz base clock,"
-                       " but no high speed support.\n",
-                       host->slot_descr);
-               mmc->f_max = 25000000;
-       }
-
        if (mmc->ocr_avail == 0) {
                printk(KERN_ERR "%s: Hardware doesn't report any "
                        "support voltages.\n", host->slot_descr);
@@ -1528,8 +1521,7 @@ static struct pci_driver sdhci_driver = {
 static int __init sdhci_drv_init(void)
 {
        printk(KERN_INFO DRIVER_NAME
-               ": Secure Digital Host Controller Interface driver, "
-               DRIVER_VERSION "\n");
+               ": Secure Digital Host Controller Interface driver\n");
        printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n");
 
        return pci_register_driver(&sdhci_driver);
@@ -1551,7 +1543,6 @@ module_param(debug_quirks, uint, 0444);
 
 MODULE_AUTHOR("Pierre Ossman <drzeus@drzeus.cx>");
 MODULE_DESCRIPTION("Secure Digital Host Controller Interface driver");
-MODULE_VERSION(DRIVER_VERSION);
 MODULE_LICENSE("GPL");
 
 MODULE_PARM_DESC(debug_nodma, "Forcefully disable DMA transfers. (default 0)");