diff options
Diffstat (limited to 'drivers/mmc/sdhci.c')
-rw-r--r-- | drivers/mmc/sdhci.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 7522f76b15ec..d749f08601b8 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c | |||
@@ -606,7 +606,6 @@ static void sdhci_finish_command(struct sdhci_host *host) | |||
606 | static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) | 606 | static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) |
607 | { | 607 | { |
608 | int div; | 608 | int div; |
609 | u8 ctrl; | ||
610 | u16 clk; | 609 | u16 clk; |
611 | unsigned long timeout; | 610 | unsigned long timeout; |
612 | 611 | ||
@@ -615,13 +614,6 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) | |||
615 | 614 | ||
616 | writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL); | 615 | writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL); |
617 | 616 | ||
618 | ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL); | ||
619 | if (clock > 25000000) | ||
620 | ctrl |= SDHCI_CTRL_HISPD; | ||
621 | else | ||
622 | ctrl &= ~SDHCI_CTRL_HISPD; | ||
623 | writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); | ||
624 | |||
625 | if (clock == 0) | 617 | if (clock == 0) |
626 | goto out; | 618 | goto out; |
627 | 619 | ||
@@ -761,10 +753,17 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
761 | sdhci_set_power(host, ios->vdd); | 753 | sdhci_set_power(host, ios->vdd); |
762 | 754 | ||
763 | ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL); | 755 | ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL); |
756 | |||
764 | if (ios->bus_width == MMC_BUS_WIDTH_4) | 757 | if (ios->bus_width == MMC_BUS_WIDTH_4) |
765 | ctrl |= SDHCI_CTRL_4BITBUS; | 758 | ctrl |= SDHCI_CTRL_4BITBUS; |
766 | else | 759 | else |
767 | ctrl &= ~SDHCI_CTRL_4BITBUS; | 760 | ctrl &= ~SDHCI_CTRL_4BITBUS; |
761 | |||
762 | if (ios->timing == MMC_TIMING_SD_HS) | ||
763 | ctrl |= SDHCI_CTRL_HISPD; | ||
764 | else | ||
765 | ctrl &= ~SDHCI_CTRL_HISPD; | ||
766 | |||
768 | writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); | 767 | writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); |
769 | 768 | ||
770 | mmiowb(); | 769 | mmiowb(); |
@@ -994,7 +993,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) | |||
994 | 993 | ||
995 | intmask = readl(host->ioaddr + SDHCI_INT_STATUS); | 994 | intmask = readl(host->ioaddr + SDHCI_INT_STATUS); |
996 | 995 | ||
997 | if (!intmask) { | 996 | if (!intmask || intmask == 0xffffffff) { |
998 | result = IRQ_NONE; | 997 | result = IRQ_NONE; |
999 | goto out; | 998 | goto out; |
1000 | } | 999 | } |
@@ -1080,6 +1079,13 @@ static int sdhci_suspend (struct pci_dev *pdev, pm_message_t state) | |||
1080 | 1079 | ||
1081 | pci_save_state(pdev); | 1080 | pci_save_state(pdev); |
1082 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); | 1081 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); |
1082 | |||
1083 | for (i = 0;i < chip->num_slots;i++) { | ||
1084 | if (!chip->hosts[i]) | ||
1085 | continue; | ||
1086 | free_irq(chip->hosts[i]->irq, chip->hosts[i]); | ||
1087 | } | ||
1088 | |||
1083 | pci_disable_device(pdev); | 1089 | pci_disable_device(pdev); |
1084 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 1090 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
1085 | 1091 | ||
@@ -1108,6 +1114,11 @@ static int sdhci_resume (struct pci_dev *pdev) | |||
1108 | continue; | 1114 | continue; |
1109 | if (chip->hosts[i]->flags & SDHCI_USE_DMA) | 1115 | if (chip->hosts[i]->flags & SDHCI_USE_DMA) |
1110 | pci_set_master(pdev); | 1116 | pci_set_master(pdev); |
1117 | ret = request_irq(chip->hosts[i]->irq, sdhci_irq, | ||
1118 | IRQF_SHARED, chip->hosts[i]->slot_descr, | ||
1119 | chip->hosts[i]); | ||
1120 | if (ret) | ||
1121 | return ret; | ||
1111 | sdhci_init(chip->hosts[i]); | 1122 | sdhci_init(chip->hosts[i]); |
1112 | mmiowb(); | 1123 | mmiowb(); |
1113 | ret = mmc_resume_host(chip->hosts[i]->mmc); | 1124 | ret = mmc_resume_host(chip->hosts[i]->mmc); |
@@ -1274,6 +1285,9 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1274 | mmc->f_max = host->max_clk; | 1285 | mmc->f_max = host->max_clk; |
1275 | mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE | MMC_CAP_BYTEBLOCK; | 1286 | mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE | MMC_CAP_BYTEBLOCK; |
1276 | 1287 | ||
1288 | if (caps & SDHCI_CAN_DO_HISPD) | ||
1289 | mmc->caps |= MMC_CAP_SD_HIGHSPEED; | ||
1290 | |||
1277 | mmc->ocr_avail = 0; | 1291 | mmc->ocr_avail = 0; |
1278 | if (caps & SDHCI_CAN_VDD_330) | 1292 | if (caps & SDHCI_CAN_VDD_330) |
1279 | mmc->ocr_avail |= MMC_VDD_32_33|MMC_VDD_33_34; | 1293 | mmc->ocr_avail |= MMC_VDD_32_33|MMC_VDD_33_34; |
@@ -1282,13 +1296,6 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1282 | if (caps & SDHCI_CAN_VDD_180) | 1296 | if (caps & SDHCI_CAN_VDD_180) |
1283 | mmc->ocr_avail |= MMC_VDD_17_18|MMC_VDD_18_19; | 1297 | mmc->ocr_avail |= MMC_VDD_17_18|MMC_VDD_18_19; |
1284 | 1298 | ||
1285 | if ((host->max_clk > 25000000) && !(caps & SDHCI_CAN_DO_HISPD)) { | ||
1286 | printk(KERN_ERR "%s: Controller reports > 25 MHz base clock," | ||
1287 | " but no high speed support.\n", | ||
1288 | host->slot_descr); | ||
1289 | mmc->f_max = 25000000; | ||
1290 | } | ||
1291 | |||
1292 | if (mmc->ocr_avail == 0) { | 1299 | if (mmc->ocr_avail == 0) { |
1293 | printk(KERN_ERR "%s: Hardware doesn't report any " | 1300 | printk(KERN_ERR "%s: Hardware doesn't report any " |
1294 | "support voltages.\n", host->slot_descr); | 1301 | "support voltages.\n", host->slot_descr); |