From: Matthew Garrett <mjg@redhat.com> Date: Wed, 4 Aug 2010 14:19:52 -0400 Subject: [mmc] sdhci: fix system cannot enter S4 with SD card Message-id: <1280931592-20184-1-git-send-email-mjg@redhat.com> Patchwork-id: 27379 O-Subject: [RHEL 5.6 PATCH] [RHEL 5.6 PATCH] mmc: fix system cannot enter S4 with SD card Bugzilla: 606899 RH-Acked-by: Jarod Wilson <jarod@redhat.com> The suspend path of sdhci driver should disable SD card insertion and removal interrupts, and free the interrupt handler. On resume from sleep state, driver should attach the interrupt handler to the IRQ again. We don't need to enable SD card insertion and removal interrupts, as it is done by sdhci_init(). Signed-off-by: Arindam Nath <arindam.nath@amd.com> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 4e21b3b..870d6e1 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -1046,6 +1046,7 @@ out: static int sdhci_suspend (struct pci_dev *pdev, pm_message_t state) { struct sdhci_chip *chip; + u32 intmask; int i, ret; chip = pci_get_drvdata(pdev); @@ -1057,12 +1058,23 @@ static int sdhci_suspend (struct pci_dev *pdev, pm_message_t state) for (i = 0;i < chip->num_slots;i++) { if (!chip->hosts[i]) continue; + + intmask = readl(chip->hosts[i]->ioaddr + + SDHCI_INT_STATUS); + intmask &= ~(SDHCI_INT_CARD_INSERT | + SDHCI_INT_CARD_REMOVE); + writel(intmask, chip->hosts[i]->ioaddr + + SDHCI_INT_ENABLE); + writel(intmask, chip->hosts[i]->ioaddr + + SDHCI_SIGNAL_ENABLE); + ret = mmc_suspend_host(chip->hosts[i]->mmc, state); if (ret) { for (i--;i >= 0;i--) mmc_resume_host(chip->hosts[i]->mmc); return ret; } + free_irq(chip->hosts[i]->irq, chip->hosts[i]); } pci_save_state(pdev); @@ -1093,6 +1105,14 @@ 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]); ret = mmc_resume_host(chip->hosts[i]->mmc); if (ret)