linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [RFC 3/3] mmc: tmio: discard obsolete SDIO irqs before enabling irqs
Date: Tue, 10 Jan 2017 09:09:19 +0100	[thread overview]
Message-ID: <20170110080919.GE25239@verge.net.au> (raw)
In-Reply-To: <20170105114326.12426-4-wsa+renesas@sang-engineering.com>

On Thu, Jan 05, 2017 at 12:43:26PM +0100, Wolfram Sang wrote:
> Before enabling SDIO irqs, clear the status bit, so we discard old and
> stale interrupts. Needed to get two wireless cards working.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/mmc/host/tmio_mmc_pio.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index d6033620a45c12..ebe3e12f0083dd 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -134,12 +134,21 @@ static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
>  	struct tmio_mmc_host *host = mmc_priv(mmc);
>  
>  	if (enable && !host->sdio_irq_enabled) {
> +		u16 sdio_status;
> +
>  		/* Keep device active while SDIO irq is enabled */
>  		pm_runtime_get_sync(mmc_dev(mmc));
> -		host->sdio_irq_enabled = true;
>  
> +		host->sdio_irq_enabled = true;
>  		host->sdio_irq_mask = TMIO_SDIO_MASK_ALL &
>  					~TMIO_SDIO_STAT_IOIRQ;
> +
> +		/* Clear obsolete interrupts before enabling */
> +		sdio_status = sd_ctrl_read16(host, CTL_SDIO_STATUS) & ~TMIO_SDIO_MASK_ALL;
> +		if (host->pdata->flags & TMIO_MMC_SDIO_STATUS_SETBITS)
> +			sdio_status |= 6;

Perhaps a #define would be an improvement over "6".

> +		sd_ctrl_write16(host, CTL_SDIO_STATUS, sdio_status);
> +
>  		sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask);
>  	} else if (!enable && host->sdio_irq_enabled) {
>  		host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
> -- 
> 2.11.0
> 

  reply	other threads:[~2017-01-10  8:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-05 11:43 [RFC 0/3] mmc: host: tmio: sdio irq improvements Wolfram Sang
2017-01-05 11:43 ` [RFC 1/3] mmc: host: tmio: refactor calls to sdio irq Wolfram Sang
2017-01-10  8:05   ` Simon Horman
2017-01-05 11:43 ` [RFC 2/3] mmc: host: tmio: SDIO_STATUS_QUIRK is rather SDIO_STATUS_SETBITS Wolfram Sang
2017-01-10  8:07   ` Simon Horman
2017-01-19 19:40     ` Wolfram Sang
2017-01-05 11:43 ` [RFC 3/3] mmc: tmio: discard obsolete SDIO irqs before enabling irqs Wolfram Sang
2017-01-10  8:09   ` Simon Horman [this message]
2017-01-19 19:42     ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170110080919.GE25239@verge.net.au \
    --to=horms@verge.net.au \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).