From: Tony Lindgren <tony@atomide.com>
To: Balaji T K <balajitk@ti.com>
Cc: Andreas Fenkart <afenkart@gmail.com>,
Chris Ball <chris@printf.net>,
Ulf Hansson <ulf.hansson@linaro.org>,
Grant Likely <grant.likely@secretlab.ca>,
Felipe Balbi <balbi@ti.com>,
Andreas Mueller <schnitzeltony@googlemail.com>,
Sebastian Reichel <sre@kernel.org>,
zonque@gmail.com, galak@codeaurora.org,
linux-doc@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-omap@vger.kernel.org
Subject: Re: [PATCH v14 6/6] mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on AM335x
Date: Mon, 2 Jun 2014 15:38:14 -0700 [thread overview]
Message-ID: <20140602223814.GD11004@atomide.com> (raw)
In-Reply-To: <538738F8.8000807@ti.com>
* Balaji T K <balajitk@ti.com> [140529 06:42]:
> On Thursday 29 May 2014 01:58 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, the GPIO will only wake
> >the module from suspend, SDIO irq detection will still happen through the
> >IP block.
> >
> >Idea of remuxing the pins by Tony Lindgren. Code contributions from
> >Tony Lindgren and Balaji T K <balajitk@ti.com>
> >
> >Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
> >Signed-off-by: Tony Lindgren <tony@atomide.com>
>
> Acked-by: Balaji T K <balajitk@ti.com>
>
> Hi Chris/Ulf,
>
> Can you please queue this series for 3.16
Yes please, not seeing these in linux next yet.
Regards,
Tony
> >diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
> >index 0233ba7..76bf087 100644
> >--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
> >+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
> >@@ -57,3 +57,56 @@ Examples:
> > &edma 25>;
> > dma-names = "tx", "rx";
> > };
> >+
> >+[workaround for missing swakeup on am33xx]
> >+
> >+This SOC is missing the swakeup line, it will not detect SDIO irq
> >+while in suspend.
> >+
> >+ ------
> >+ | PRCM |
> >+ ------
> >+ ^ |
> >+ swakeup | | fclk
> >+ | v
> >+ ------ ------- -----
> >+ | card | -- CIRQ --> | hsmmc | -- IRQ --> | CPU |
> >+ ------ ------- -----
> >+
> >+In suspend the fclk is off and the module is disfunctional. Even register reads
> >+will fail. A small logic in the host will request fclk restore, when an
> >+external event is detected. Once the clock is restored, the host detects the
> >+event normally. Since am33xx doesn't have this line it never wakes from
> >+suspend.
> >+
> >+The workaround is to reconfigure the dat1 line as a GPIO upon suspend. To make
> >+this work, we need to set the named pinctrl states "default" and "idle".
> >+Prepare idle to remux dat1 as a gpio, and default to remux it back as sdio
> >+dat1. The MMC driver will then toggle between idle and default state during
> >+runtime.
> >+
> >+In summary:
> >+1. select matching 'compatible' section, see example below.
> >+2. specify pinctrl states "default" and "idle", "sleep" is optional.
> >+3. specify the gpio irq used for detecting sdio irq in suspend
> >+
> >+If configuration is incomplete, a warning message is emitted "falling back to
> >+polling". Also check the "sdio irq mode" in /sys/kernel/debug/mmc0/regs. Mind
> >+not every application needs SDIO irq, e.g. MMC cards.
> >+
> >+ mmc1: mmc@48060100 {
> >+ compatible = "ti,am33xx-hsmmc";
> >+ ...
> >+ pinctrl-names = "default", "idle", "sleep"
> >+ pinctrl-0 = <&mmc1_pins>;
> >+ pinctrl-1 = <&mmc1_idle>;
> >+ pinctrl-2 = <&mmc1_sleep>;
> >+ ...
> >+ interrupts-extended = <&intc 64 &gpio2 28 0>;
> >+ };
> >+
> >+ mmc1_idle : pinmux_cirq_pin {
> >+ pinctrl-single,pins = <
> >+ 0x0f8 0x3f /* GPIO2_28 */
> >+ >;
> >+ };
> >diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> >index 0febb17..35ac2e4 100644
> >--- a/drivers/mmc/host/omap_hsmmc.c
> >+++ b/drivers/mmc/host/omap_hsmmc.c
> >@@ -1754,15 +1754,33 @@ static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host)
> > * and need to remux SDIO DAT1 to GPIO for wake-up from idle.
> > */
> > if (host->pdata->controller_flags & OMAP_HSMMC_SWAKEUP_MISSING) {
> >- ret = -ENODEV;
> >- devm_free_irq(host->dev, host->wake_irq, host);
> >- goto err;
> >+ struct pinctrl *p = devm_pinctrl_get(host->dev);
> >+ if (!p) {
> >+ ret = -ENODEV;
> >+ goto err_free_irq;
> >+ }
> >+ if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_DEFAULT))) {
> >+ dev_info(host->dev, "missing default pinctrl state\n");
> >+ devm_pinctrl_put(p);
> >+ ret = -EINVAL;
> >+ goto err_free_irq;
> >+ }
> >+
> >+ if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_IDLE))) {
> >+ dev_info(host->dev, "missing idle pinctrl state\n");
> >+ devm_pinctrl_put(p);
> >+ ret = -EINVAL;
> >+ goto err_free_irq;
> >+ }
> >+ devm_pinctrl_put(p);
> > }
> >
> > OMAP_HSMMC_WRITE(host->base, HCTL,
> > OMAP_HSMMC_READ(host->base, HCTL) | IWE);
> > return 0;
> >
> >+err_free_irq:
> >+ devm_free_irq(host->dev, host->wake_irq, host);
> > err:
> > dev_warn(host->dev, "no SDIO IRQ support, falling back to polling\n");
> > host->wake_irq = 0;
> >
>
next prev parent reply other threads:[~2014-06-02 22:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-29 8:27 [PATCH v14 0/6] mmc: omap_hsmmc: Enable SDIO IRQ Andreas Fenkart
2014-05-29 8:28 ` [PATCH v14 1/6] mmc: omap_hsmmc: Enable SDIO interrupt Andreas Fenkart
2014-08-24 8:26 ` Florian Vaussard
2014-08-24 17:46 ` Andreas Fenkart
2014-08-27 7:57 ` Florian Vaussard
2014-08-24 18:41 ` Tony Lindgren
2014-08-27 7:53 ` Florian Vaussard
2014-05-29 8:28 ` [PATCH v14 2/6] mmc: omap_hsmmc: Extend debugfs by SDIO IRQ handling, runtime state Andreas Fenkart
2014-05-29 13:38 ` Balaji T K
2014-05-29 8:28 ` [PATCH v14 3/6] mmc: omap_hsmmc: enable wakeup event for sdio OMAP4 Andreas Fenkart
2014-05-29 8:28 ` [PATCH v14 4/6] mmc: omap_hsmmc: abort runtime suspend if pending sdio irq detected Andreas Fenkart
2014-05-29 8:28 ` [PATCH v14 5/6] mmc: omap_hsmmc: switch default/idle pinctrl states in runtime hooks Andreas Fenkart
2014-05-29 8:28 ` [PATCH v14 6/6] mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on AM335x Andreas Fenkart
2014-05-29 13:41 ` Balaji T K
2014-06-02 22:38 ` Tony Lindgren [this message]
2014-06-16 9:26 ` [PATCH v14 0/6] mmc: omap_hsmmc: Enable SDIO IRQ Ulf Hansson
2014-08-06 6:18 ` Dmitry Lifshitz
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=20140602223814.GD11004@atomide.com \
--to=tony@atomide.com \
--cc=afenkart@gmail.com \
--cc=balajitk@ti.com \
--cc=balbi@ti.com \
--cc=chris@printf.net \
--cc=galak@codeaurora.org \
--cc=grant.likely@secretlab.ca \
--cc=linux-doc@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=schnitzeltony@googlemail.com \
--cc=sre@kernel.org \
--cc=ulf.hansson@linaro.org \
--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).