public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@csr.com>
To: linux-mmc@vger.kernel.org
Cc: linux-omap@vger.kernel.org, madhu.cr@ti.com
Subject: Re: [PATCH 3/3] mmc: omap_hsmmc: enable SDIO card interrupts
Date: Wed, 17 Feb 2010 18:09:55 +0000	[thread overview]
Message-ID: <4B7C30F3.904@csr.com> (raw)
In-Reply-To: <9ce6cf93ba1e6c3fd239f732ea5889a856948db3.1265801967.git.david.vrabel@csr.com>

David Vrabel wrote:
> 
> +static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
> +{
> +	struct omap_hsmmc_host *host = mmc_priv(mmc);
> +	u32 ie, con;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&host->irq_lock, flags);
> +
> +	/*
> +	 * When interrupts are enabled, CTPL must be set to enable
> +	 * DAT1 input buffer (or the card interrupt is always
> +	 * asserted) and FCLK must be enabled else wakeup does not
> +	 * work.
> +	 *
> +	 * FIXME: the power save code probably shouldn't be playing
> +	 * with FCLK and allow the clock subsystem to put it into
> +	 * smart-idle mode instead.
> +	 */
> +	con = OMAP_HSMMC_READ(host->base, CON);
> +	ie = OMAP_HSMMC_READ(host->base, IE);
> +	if (enable) {
> +		clk_enable(host->fclk);
> +		ie |= CIRQ_ENABLE;
> +		con |= CTPL;
> +	} else {
> +		clk_disable(host->fclk);
> +		ie &= ~CIRQ_ENABLE;
> +		con &= ~CTPL;
> +	}
> +	OMAP_HSMMC_WRITE(host->base, CON, con);
> +	OMAP_HSMMC_WRITE(host->base, IE, ie);
> +
> +	spin_unlock_irqrestore(&host->irq_lock, flags);
> +}

This isn't doing a posted write flush but when it's added this ends up
looking like:

	spin_lock_irqsave(&host->lock, flags);

	/*
	 * When interrupts are enabled, CTPL must be set to enable
	 * DAT1 input buffer (or the card interrupt is always
	 * asserted) and FCLK must be enabled else wakeup does not
	 * work.  Take care to disable FCLK after all the register
	 * accesses as they might not complete if FCLK is off.
	 *
	 * FIXME: the power save code probably shouldn't be playing
	 * with FCLK and allow the clock subsystem to put it into
	 * smart-idle mode instead.
	 */
	con = OMAP_HSMMC_READ(host->base, CON);
	ie = OMAP_HSMMC_READ(host->base, IE);
	if (enable) {
		clk_enable(host->fclk);
		ie |= CIRQ_ENABLE;
		con |= CTPL;
	} else {
		ie &= ~CIRQ_ENABLE;
		con &= ~CTPL;
	}
	OMAP_HSMMC_WRITE(host->base, CON, con);
	OMAP_HSMMC_WRITE(host->base, IE, ie);
	OMAP_HSMMC_READ(host->base, IE); /* flush posted write */
        if (!enable) {
            clk_disable(host->fclk);
        }

	spin_unlock_irqrestore(&host->lock, flags);

Could someone from TI could comment on why disabling FCLK affects
register read?

David
-- 
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park,  Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ                 http://www.csr.com/


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom

  reply	other threads:[~2010-02-17 18:10 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10 11:51 [PATCH 0/3] mmc: omap_hsmmc: support SDIO cards David Vrabel
2010-02-10 11:51 ` [PATCH 1/3] mmc: omap_hsmmc: use packet sync'd DMA David Vrabel
2010-02-17 17:21   ` Madhusudhan
2010-02-17 17:47     ` David Vrabel
2010-02-10 11:51 ` [PATCH 2/3] mmc: omap_hsmmc: don't turn SDIO cards off when idle David Vrabel
2010-02-10 11:52 ` [PATCH 3/3] mmc: omap_hsmmc: enable SDIO card interrupts David Vrabel
2010-02-17 18:09   ` David Vrabel [this message]
2010-02-17 21:34     ` Cousson, Benoit
2010-02-17 18:45   ` Madhusudhan
2010-02-17 19:39     ` David Vrabel
2010-02-17 20:49       ` Paul Walmsley
2010-02-18 13:20         ` David Vrabel
2010-02-18 17:43           ` Paul Walmsley
2010-02-18 18:39             ` Madhusudhan
2010-02-18 19:27               ` Nicolas Pitre
2010-02-18 20:20                 ` Madhusudhan
2010-02-18 20:21               ` Paul Walmsley
2010-02-18 22:16                 ` Steve Sakoman
2010-02-18 23:45                   ` Nicolas Pitre
2010-03-02 22:08                   ` Madhusudhan
2010-03-02 23:29                     ` Steve Sakoman
2010-02-19 21:47                 ` Madhusudhan
2010-02-18  0:26       ` Madhusudhan
2010-02-18 12:15         ` David Vrabel
2010-02-18 17:03           ` Madhusudhan
2010-02-19 21:05   ` Madhusudhan
2010-02-20  1:37     ` Madhusudhan
2010-02-22 14:28       ` David Vrabel
2010-02-11  8:29 ` [PATCH 0/3] mmc: omap_hsmmc: support SDIO cards Mike Rapoport
2010-02-11 11:10   ` David Vrabel
2010-02-11 11:42     ` Mike Rapoport
2010-02-11 12:12       ` David Vrabel
2010-02-11 12:31         ` Mike Rapoport
2010-02-18  6:57           ` Mike Rapoport
2010-02-18 16:53             ` Madhusudhan
2010-02-21  6:33               ` Mike Rapoport
2010-02-18  7:02     ` Mike Rapoport
2010-02-18 18:06       ` David Vrabel

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=4B7C30F3.904@csr.com \
    --to=david.vrabel@csr.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=madhu.cr@ti.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