devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Balaji T K <balajitk@ti.com>
To: Andreas Fenkart <afenkart@gmail.com>
Cc: devicetree@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-doc@vger.kernel.org, Tony Lindgren <tony@atomide.com>,
	devicetree-discuss@lists.ozlabs.org, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org, Felipe Balbi <balbi@ti.com>,
	zonque@gmail.com, Grant Likely <grant.likely@secretlab.ca>,
	Chris Ball <cjb@laptop.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 3/4] mmc: omap_hsmmc: Remux pins to support SDIO interrupt on AM335x
Date: Tue, 15 Oct 2013 22:04:14 +0530	[thread overview]
Message-ID: <525D6E86.1040208@ti.com> (raw)
In-Reply-To: <1380971830-21492-4-git-send-email-afenkart@gmail.com>

Thanks Andreas for the patch,

On Saturday 05 October 2013 04:47 PM, Andreas Fenkart wrote:
> The am335x can't detect pending cirq in PM runtime suspend.
> This patch reconfigures dat1 as a GPIO before going to suspend.
> SDIO interrupts are detected with the GPIO, while in runtime
> suspend, standard detection of the module block otherwise.
>
> Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
>
> @@ -2293,23 +2440,66 @@ static int omap_hsmmc_resume(struct device *dev)
>   static int omap_hsmmc_runtime_suspend(struct device *dev)
>   {
>   	struct omap_hsmmc_host *host;
> +	unsigned long flags;
> +	int ret = 0;
>
>   	host = platform_get_drvdata(to_platform_device(dev));
>   	omap_hsmmc_context_save(host);
>   	dev_dbg(dev, "disabled\n");
>
> -	return 0;
> +	if (host->flags & HSMMC_SWAKEUP_QUIRK) {
> +		spin_lock_irqsave(&host->irq_lock, flags);
> +		OMAP_HSMMC_WRITE(host->base, ISE, 0);
> +		OMAP_HSMMC_WRITE(host->base, IE, 0);
> +		OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR);
> +		spin_unlock_irqrestore(&host->irq_lock, flags);
> +
> +		ret = pinctrl_select_state(host->pinctrl, host->idle);
> +		if (ret < 0)
> +			dev_warn(mmc_dev(host->mmc), "Unable to select idle pinmux\n");
> +
> +		enable_irq(mmc_slot(host).sdio_irq);
> +	}
> +
> +	spin_lock_irqsave(&host->irq_lock, flags);
> +	/* infinite loop, if irq not cleared in omap_hsmmc_enable_sdio_irq */
> +	host->flags |= HSMMC_RUNTIME_SUSPENDED;

Can you provide more details about the infinite loop and how it will get recovered.

> +	spin_unlock_irqrestore(&host->irq_lock, flags);
> +
> +	return ret;
>   }
>
>   static int omap_hsmmc_runtime_resume(struct device *dev)
>   {
>   	struct omap_hsmmc_host *host;
> +	unsigned long flags;
> +	int ret = 0;
>
>   	host = platform_get_drvdata(to_platform_device(dev));
>   	omap_hsmmc_context_restore(host);
>   	dev_dbg(dev, "enabled\n");
>
> -	return 0;
> +	spin_lock_irqsave(&host->irq_lock, flags);
> +	/* infinite loop, if irq not cleared in omap_hsmmc_enable_sdio_irq */
> +	host->flags &= ~HSMMC_RUNTIME_SUSPENDED;
> +	spin_unlock_irqrestore(&host->irq_lock, flags);
> +
> +	if (host->flags & HSMMC_SWAKEUP_QUIRK) {
> +		disable_irq(mmc_slot(host).sdio_irq);
> +
> +		ret = pinctrl_select_state(host->pinctrl, host->active);
> +		if (ret < 0)
> +			dev_warn(mmc_dev(host->mmc), "Unable to select active pinmux\n");
> +
> +		spin_lock_irqsave(&host->irq_lock, flags);
> +		if (host->flags & HSMMC_SDIO_IRQ_ENABLED) {
> +			OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR);
> +			OMAP_HSMMC_WRITE(host->base, ISE, CIRQ_EN);
> +			OMAP_HSMMC_WRITE(host->base, IE, CIRQ_EN);
> +		}
> +		spin_unlock_irqrestore(&host->irq_lock, flags);
> +	}
> +	return ret;
>   }
>
>   static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
> diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
> index 2bf1b30..fd5fff5 100644
> --- a/include/linux/platform_data/mmc-omap.h
> +++ b/include/linux/platform_data/mmc-omap.h
> @@ -115,6 +115,7 @@ struct omap_mmc_platform_data {
>
>   		int switch_pin;			/* gpio (card detect) */
>   		int gpio_wp;			/* gpio (write protect) */
> +		int gpio_cirq;			/* gpio (card irq) */
>
>   		int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
>   		int (*set_power)(struct device *dev, int slot,
> @@ -145,6 +146,9 @@ struct omap_mmc_platform_data {
>   		int card_detect_irq;
>   		int (*card_detect)(struct device *dev, int slot);
>
> +		/* SDIO IRQs */
> +		int sdio_irq;
> +
>   		unsigned int ban_openended:1;
>
>   	} slots[OMAP_MMC_MAX_SLOTS];
>

  reply	other threads:[~2013-10-15 16:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-05 11:17 [PATCH v3 0/4] mmc: omap_hsmmc: SDIO irq Andreas Fenkart
2013-10-05 11:17 ` [PATCH v3 1/4] mmc: omap_hsmmc: Fix context save and restore for DT Andreas Fenkart
2013-10-05 11:17 ` [PATCH v3 2/4] mmc: omap_hsmmc: Enable SDIO IRQ Andreas Fenkart
2013-10-08 16:11   ` Felipe Balbi
2013-10-29 15:06     ` Andreas Fenkart
2013-10-29 17:22       ` Felipe Balbi
2013-10-29 17:16   ` Kumar Gala
2013-10-05 11:17 ` [PATCH v3 3/4] mmc: omap_hsmmc: Remux pins to support SDIO interrupt on AM335x Andreas Fenkart
2013-10-15 16:34   ` Balaji T K [this message]
2013-10-18  6:20   ` NeilBrown
2013-10-18  7:29     ` Balaji T K
2013-10-18  7:45       ` NeilBrown
2013-10-18 10:12     ` Javier Martinez Canillas
2013-10-18 23:14       ` NeilBrown
2013-10-19  1:02         ` Javier Martinez Canillas
     [not found] ` <1380971830-21492-1-git-send-email-afenkart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-05 11:17   ` [PATCH v3 4/4] mmc: omap_hsmmc: debugfs entries for SDIO IRQ detection and GPIO remuxing Andreas Fenkart

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=525D6E86.1040208@ti.com \
    --to=balajitk@ti.com \
    --cc=afenkart@gmail.com \
    --cc=balbi@ti.com \
    --cc=cjb@laptop.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    --cc=zonque@gmail.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).