* sdhci: sdio wakeup and free_irq
@ 2012-09-21 9:20 Kevin Liu
2012-09-24 3:25 ` Chris Ball
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Liu @ 2012-09-21 9:20 UTC (permalink / raw)
To: linux-mmc
Hi, all
Can latest code support sdio wakeup?
I see at last of sdhci_suspend_host, irq will be freed. But if the irq
is used for wakeup system like sdio wakeup irq? Then system can't be
woken up.
And we can't just skip the free_irq for sdio to resolve this issue
since the host has been suspended before.
Any idea?
Thanks
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sdhci: sdio wakeup and free_irq
2012-09-21 9:20 sdhci: sdio wakeup and free_irq Kevin Liu
@ 2012-09-24 3:25 ` Chris Ball
2012-09-24 4:21 ` Kevin Liu
0 siblings, 1 reply; 5+ messages in thread
From: Chris Ball @ 2012-09-24 3:25 UTC (permalink / raw)
To: Kevin Liu; +Cc: linux-mmc
Hi,
On Fri, Sep 21 2012, Kevin Liu wrote:
> Can latest code support sdio wakeup?
Yes, it should work. OLPC has been using it in production with
libertas_sdio for several years.
> I see at last of sdhci_suspend_host, irq will be freed. But if the irq
> is used for wakeup system like sdio wakeup irq? Then system can't be
> woken up.
free_irq() is just removing the handler while the stack is suspended, it
isn't stopping your hardware from waking up the system. Your hardware
needs to be programmed to wake the system if the SDIO IRQ fires; many
SoCs will do this as long as the SDIO is in 1-bit data width mode (which
doesn't require the card clock to be powered). We turn on 1-bit mode if
MMC_PM_KEEP_POWER is set in host->pm_flags.
The driver (libertas, mwifiex) is responsible for setting host->pm_flags
if it wants the SDIO to stay powered during the next system suspend.
Once the hardware wakes up the system, we'll register the handler again,
it will fire because the line is still raised, and we'll handle it the
normal way. The card isn't reinitialized if MMC_PM_KEEP_POWER is set.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sdhci: sdio wakeup and free_irq
2012-09-24 3:25 ` Chris Ball
@ 2012-09-24 4:21 ` Kevin Liu
2012-09-24 4:47 ` Chris Ball
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Liu @ 2012-09-24 4:21 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc
Hi, Chris
2012/9/24 Chris Ball <cjb@laptop.org>:
> Hi,
>
> On Fri, Sep 21 2012, Kevin Liu wrote:
>> Can latest code support sdio wakeup?
>
> Yes, it should work. OLPC has been using it in production with
> libertas_sdio for several years.
>
>> I see at last of sdhci_suspend_host, irq will be freed. But if the irq
>> is used for wakeup system like sdio wakeup irq? Then system can't be
>> woken up.
>
> free_irq() is just removing the handler while the stack is suspended, it
> isn't stopping your hardware from waking up the system. Your hardware
> needs to be programmed to wake the system if the SDIO IRQ fires; many
> SoCs will do this as long as the SDIO is in 1-bit data width mode (which
> doesn't require the card clock to be powered). We turn on 1-bit mode if
> MMC_PM_KEEP_POWER is set in host->pm_flags.
>
free_irq will also disable the interrupt line. Below is the comments and code:
The handler is removed and if the interrupt line is no longer in use
by any driver it is disabled.
/* If this was the last handler, shut down the IRQ line: */
if (!desc->action)
irq_shutdown(desc);
So if the irq is disabled, then system can't be woken up.
Thanks
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sdhci: sdio wakeup and free_irq
2012-09-24 4:21 ` Kevin Liu
@ 2012-09-24 4:47 ` Chris Ball
2012-09-24 5:54 ` Kevin Liu
0 siblings, 1 reply; 5+ messages in thread
From: Chris Ball @ 2012-09-24 4:47 UTC (permalink / raw)
To: Kevin Liu; +Cc: linux-mmc
Hi,
On Mon, Sep 24 2012, Kevin Liu wrote:
> So if the irq is disabled, then system can't be woken up.
You're assuming that the host controller IRQ is the method used to wake
up the system, but I just told you that the SDIO data line in 1-bit mode
should be used to wake up the system. I don't know of any systems
where the host controller IRQ is used.
On the systems that I know about (e.g. MMP2, MMP3) there's an interrupt
controller and a wakeup controller (PMU). You need to configure your
wakeup controller to pay attention to the card's data line (*not* the
host controller's interrupt line) to wake the system. It doesn't matter
that the host controller's interrupt line is being freed, because it's
not how the system gets woken up.
After the PMU wakes us up, we re-register the IRQ line and handle
the pending IRQ there. But the IRQ line itself isn't what wakes us.
e.g.:
#define WLAN_1BIT_MODE_IRQ 39
unsigned long mfpr;
mfpr = mfp_read(WLAN_1BIT_MODE_IRQ);
if (mmc_card_wake_sdio_irq(host->mmc))
{
mfpr &= ~(MFPR_EDGE_CLEAR|MFPR_EDGE_RISE);
mfpr |= MFPR_EDGE_FALL;
mfpr |= MFPR_PULLUP_EN;
}
mfp_write(WLAN_1BIT_MODE_IRQ, mfpr);
Which platform are you working on?
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sdhci: sdio wakeup and free_irq
2012-09-24 4:47 ` Chris Ball
@ 2012-09-24 5:54 ` Kevin Liu
0 siblings, 0 replies; 5+ messages in thread
From: Kevin Liu @ 2012-09-24 5:54 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc
Hi, Chris
2012/9/24 Chris Ball <cjb@laptop.org>:
> Hi,
>
> On Mon, Sep 24 2012, Kevin Liu wrote:
>> So if the irq is disabled, then system can't be woken up.
>
> You're assuming that the host controller IRQ is the method used to wake
> up the system, but I just told you that the SDIO data line in 1-bit mode
> should be used to wake up the system. I don't know of any systems
> where the host controller IRQ is used.
>
> On the systems that I know about (e.g. MMP2, MMP3) there's an interrupt
> controller and a wakeup controller (PMU). You need to configure your
> wakeup controller to pay attention to the card's data line (*not* the
> host controller's interrupt line) to wake the system. It doesn't matter
> that the host controller's interrupt line is being freed, because it's
> not how the system gets woken up.
>
> After the PMU wakes us up, we re-register the IRQ line and handle
> the pending IRQ there. But the IRQ line itself isn't what wakes us.
>
> e.g.:
>
> #define WLAN_1BIT_MODE_IRQ 39
> unsigned long mfpr;
>
> mfpr = mfp_read(WLAN_1BIT_MODE_IRQ);
> if (mmc_card_wake_sdio_irq(host->mmc))
> {
> mfpr &= ~(MFPR_EDGE_CLEAR|MFPR_EDGE_RISE);
> mfpr |= MFPR_EDGE_FALL;
> mfpr |= MFPR_PULLUP_EN;
> }
> mfp_write(WLAN_1BIT_MODE_IRQ, mfpr);
>
> Which platform are you working on?
I'm working on MMP3 now and I ever worked on MMP2.
MMP2 used IO edge detect irq (23) to wake up sysem and the wake up
source is set to GPIO. In fact the pin is DATA 1 pin of SDIO rather
than a GPIO pin but MMP2 implement it as this.
MMP3 delete the IO edge detect irq and we use a true GPIO rather than
the DATA 1 pin to wake up system. It seems you still use MMC DAT1 pin
on MMP3 to wake up system. Then which irq do you use to wake up
system? Because MMP3 need both wake up source and irq to wake up
system.
And I think both MMP2 and MMP3 didn't fully fulfill the MMC wake up
methodology (MMC irq is not used to wake up system). I heard the SOC
will improve this on further version, which means MMC/DAT1 and MMC irq
will be used to wake up system. I'm afraid current code can't work
then.
Thanks
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-24 5:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21 9:20 sdhci: sdio wakeup and free_irq Kevin Liu
2012-09-24 3:25 ` Chris Ball
2012-09-24 4:21 ` Kevin Liu
2012-09-24 4:47 ` Chris Ball
2012-09-24 5:54 ` Kevin Liu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.