From: Pierre Ossman Date: Fri, 30 Jun 2006 09:22:29 +0000 (-0700) Subject: [MMC] sdhci: check controller version X-Git-Tag: v2.6.18-rc1~146^2~4 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a9655051fb1efa568e53baf5dfb21e33bad6bf6;p=linux-2.6 [MMC] sdhci: check controller version Check the interface version of the controller and bail out if it's an unknown version. Signed-off-by: Pierre Ossman Signed-off-by: Andrew Morton Signed-off-by: Russell King --- diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 5324eae6d7..e37c814924 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -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)) diff --git a/drivers/mmc/sdhci.h b/drivers/mmc/sdhci.h index b1aa3acf09..758cf1c243 100644 --- a/drivers/mmc/sdhci.h +++ b/drivers/mmc/sdhci.h @@ -149,6 +149,10 @@ #define SDHCI_SLOT_INT_STATUS 0xFC #define SDHCI_HOST_VERSION 0xFE +#define SDHCI_VENDOR_VER_MASK 0xFF00 +#define SDHCI_VENDOR_VER_SHIFT 8 +#define SDHCI_SPEC_VER_MASK 0x00FF +#define SDHCI_SPEC_VER_SHIFT 0 struct sdhci_chip;