]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/mmc/sdhci.c
[MMC] sdhci: check controller version
[karo-tx-linux.git] / drivers / mmc / sdhci.c
index 5324eae6d72090caf0de6cea7841c90fc91d08bc..e37c8149249f3cbb2d2c97622589dcb76e63f8ee 100644 (file)
@@ -1073,6 +1073,7 @@ static int sdhci_resume (struct pci_dev *pdev)
 static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
 {
        int ret;
+       unsigned int version;
        struct sdhci_chip *chip;
        struct mmc_host *mmc;
        struct sdhci_host *host;
@@ -1131,6 +1132,16 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
                goto release;
        }
 
+       version = readw(host->ioaddr + SDHCI_HOST_VERSION);
+       version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT;
+       if (version != 0) {
+               printk(KERN_ERR "%s: Unknown controller version (%d). "
+                       "Cowardly refusing to continue.\n", host->slot_descr,
+                       version);
+               ret = -ENODEV;
+               goto unmap;
+       }
+
        caps = readl(host->ioaddr + SDHCI_CAPABILITIES);
 
        if ((caps & SDHCI_CAN_DO_DMA) && ((pdev->class & 0x0000FF) == 0x01))