Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84d62605 authored by Ludovic Desroches's avatar Ludovic Desroches Committed by Ulf Hansson
Browse files

mmc: sdhci: fix wakeup configuration



Activating wakeup event is not enough to get a wakeup signal. The
corresponding events have to be enabled in the Interrupt Status Enable
Register too. It follows the specification and is needed at least by
sdhci-of-at91.

Signed-off-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent e87c8561
Loading
Loading
Loading
Loading
+14 −1
Original line number Original line Diff line number Diff line
@@ -2605,18 +2605,31 @@ static irqreturn_t sdhci_thread_irq(int irq, void *dev_id)
\*****************************************************************************/
\*****************************************************************************/


#ifdef CONFIG_PM
#ifdef CONFIG_PM
/*
 * To enable wakeup events, the corresponding events have to be enabled in
 * the Interrupt Status Enable register too. See 'Table 1-6: Wakeup Signal
 * Table' in the SD Host Controller Standard Specification.
 * It is useless to restore SDHCI_INT_ENABLE state in
 * sdhci_disable_irq_wakeups() since it will be set by
 * sdhci_enable_card_detection() or sdhci_init().
 */
void sdhci_enable_irq_wakeups(struct sdhci_host *host)
void sdhci_enable_irq_wakeups(struct sdhci_host *host)
{
{
	u8 val;
	u8 val;
	u8 mask = SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE
	u8 mask = SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE
			| SDHCI_WAKE_ON_INT;
			| SDHCI_WAKE_ON_INT;
	u32 irq_val = SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE |
		      SDHCI_INT_CARD_INT;


	val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL);
	val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL);
	val |= mask ;
	val |= mask ;
	/* Avoid fake wake up */
	/* Avoid fake wake up */
	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) {
		val &= ~(SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE);
		val &= ~(SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE);
		irq_val &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE);
	}
	sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL);
	sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL);
	sdhci_writel(host, irq_val, SDHCI_INT_ENABLE);
}
}
EXPORT_SYMBOL_GPL(sdhci_enable_irq_wakeups);
EXPORT_SYMBOL_GPL(sdhci_enable_irq_wakeups);