From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755609AbcETLuT (ORCPT ); Fri, 20 May 2016 07:50:19 -0400 Received: from mga14.intel.com ([192.55.52.115]:20347 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752892AbcETLuR (ORCPT ); Fri, 20 May 2016 07:50:17 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,339,1459839600"; d="scan'208";a="971087848" Subject: Re: [PATCH v2] mmc: sdhci: fix wakeup configuration To: Ludovic Desroches , ulf.hansson@linaro.org References: <1463145362-7773-1-git-send-email-ludovic.desroches@atmel.com> Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, nicolas.ferre@atmel.com, kliu5@marvell.com, jlfu@marvell.com, jszhang@marvell.com From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <573EF90B.7000109@intel.com> Date: Fri, 20 May 2016 14:46:19 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <1463145362-7773-1-git-send-email-ludovic.desroches@atmel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/05/16 16:16, Ludovic Desroches wrote: > 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: Ludovic Desroches Acked-by: Adrian Hunter > --- > drivers/mmc/host/sdhci.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > Changes: > - v2: > - update commit message and comments > - do not rename val and mask variables > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index e010ea4..e351859 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -2605,18 +2605,31 @@ static irqreturn_t sdhci_thread_irq(int irq, void *dev_id) > \*****************************************************************************/ > > #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) > { > u8 val; > u8 mask = SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE > | 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 |= mask ; > /* 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); > + irq_val &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE); > + } > sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL); > + sdhci_writel(host, irq_val, SDHCI_INT_ENABLE); > } > EXPORT_SYMBOL_GPL(sdhci_enable_irq_wakeups); > >