* Re: mmc: sdio: runtime PM and 8686 problems
@ 2011-12-01 11:29 Joe Woodward
0 siblings, 0 replies; 26+ messages in thread
From: Joe Woodward @ 2011-12-01 11:29 UTC (permalink / raw)
To: Ohad Ben-Cohen; +Cc: Daniel Drake, linux-mmc, Chris Ball
I've had a play with the nRESET line (as far as I can tell it is the only pin I have access to), and no joy.
Also tried playing about a bit with the CMD sequence, again no joy.
I'm not entirely sure of the CMD sequence. It seems we get:
- CMD52 (x2)
- CMD0
- CMD8 (fails)
- CMD5 (fails)
In the "SDIO Simplified Specification Version 2.00" (https://www.sdcard.org/developers/overview/sdio/sdio_spec/Simplified_SDIO_Card_Spec.pdf) page 6 it seems only a CMD52 should be required to "Re-init IO". Previous thread posts state CMD5 (x2) are required by the 8686, but why CMD0/CMD8?
Incidentally errors only occur after the CMD0, but before the first error we get (i.e. a change of cs from 1 to 0):
"mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0 timing 0".
Any thoughts?
I think we've probably hit the end of the line here, unless someone else pops up who knows more about the Gumstix (i.e. has access to a schematic) or the W2CBW003 and it's SD8686 internals.
Thanks for the help anyway chaps!
Cheers,
Joe
-----Original Message-----
From: Ohad Ben-Cohen <ohad@wizery.com>
To: Joe Woodward <jw@terrafix.co.uk>
Cc: Daniel Drake <dsd@laptop.org>, linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>
Date: Thu, 1 Dec 2011 10:07:24 +0200
Subject: Re: mmc: sdio: runtime PM and 8686 problems
> On Wed, Nov 30, 2011 at 5:00 PM, Joe Woodward <jw@terrafix.co.uk>
> wrote:
> > It seems CMD5 fails (which seems to be what the workarounds were
> aiming to fix).
>
> Right; you get a timeout (-110), which means the 8686 didn't send any
> response.
>
> This is unexpected because the sdio reset (the CMD52 you see before
> the init sequence) should be enough to reset the device (we confirmed
> this with the Marvell folks on this list awhile ago).
>
> > I'm afraid I may not be of much more use as Gumstix (annoyingly)
> don't release schematics of their COMs, so actually probing any signals
> isn't really possible.
>
> Yes, it makes it difficult to debug.
>
> You can try to verify (in the code) that all the text book
> prerequisites are there (e.g. all SDIO lines are pulled up and muxed
> correctly. though since stuff work for you without SDIO runtime PM, I
> assume these are ok), and maybe even play a bit with stuff like
> delays, sdio resets and power cycles and see if things change. If you
> have access to the other inputs of the 8686 (it has several of them
> which are related to power and resets. Neither me nor Daniel have
> intimate knowledge about what any of those really do, but you could
> dig some info from emails send by Marvell folks on this list), then
> you can also try to play with them and see if things change. With
> luck, you could learn more about the problem and can hopefully get
> closer to finding a solution.
>
> It could be great if a solution will be found, but if not, we'll
> probably have to proceed with the revert...
>
> Good luck!
> Ohad.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
@ 2011-12-01 11:29 Joe Woodward
0 siblings, 0 replies; 26+ messages in thread
From: Joe Woodward @ 2011-12-01 11:29 UTC (permalink / raw)
To: Ohad Ben-Cohen; +Cc: Daniel Drake, linux-mmc, Chris Ball
I've had a play with the nRESET line (as far as I can tell it is the only pin I have access to), and no joy.
Also tried playing about a bit with the CMD sequence, again no joy.
I'm not entirely sure of the CMD sequence. It seems we get:
- CMD52 (x2)
- CMD0
- CMD8 (fails)
- CMD5 (fails)
In the "SDIO Simplified Specification Version 2.00" (https://www.sdcard.org/developers/overview/sdio/sdio_spec/Simplified_SDIO_Card_Spec.pdf) page 6 it seems only a CMD52 should be required to "Re-init IO". Previous thread posts state CMD5 (x2) are required by the 8686, but why CMD0/CMD8?
Incidentally errors only occur after the CMD0, but before the first error we get (i.e. a change of cs from 1 to 0):
"mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0 timing 0".
Any thoughts?
I think we've probably hit the end of the line here, unless someone else pops up who knows more about the Gumstix (i.e. has access to a schematic) or the W2CBW003 and it's SD8686 internals.
Thanks for the help anyway chaps!
Cheers,
Joe
-----Original Message-----
From: Ohad Ben-Cohen <ohad@wizery.com>
To: Joe Woodward <jw@terrafix.co.uk>
Cc: Daniel Drake <dsd@laptop.org>, linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>
Date: Thu, 1 Dec 2011 10:07:24 +0200
Subject: Re: mmc: sdio: runtime PM and 8686 problems
> On Wed, Nov 30, 2011 at 5:00 PM, Joe Woodward <jw@terrafix.co.uk>
> wrote:
> > It seems CMD5 fails (which seems to be what the workarounds were
> aiming to fix).
>
> Right; you get a timeout (-110), which means the 8686 didn't send any
> response.
>
> This is unexpected because the sdio reset (the CMD52 you see before
> the init sequence) should be enough to reset the device (we confirmed
> this with the Marvell folks on this list awhile ago).
>
> > I'm afraid I may not be of much more use as Gumstix (annoyingly)
> don't release schematics of their COMs, so actually probing any signals
> isn't really possible.
>
> Yes, it makes it difficult to debug.
>
> You can try to verify (in the code) that all the text book
> prerequisites are there (e.g. all SDIO lines are pulled up and muxed
> correctly. though since stuff work for you without SDIO runtime PM, I
> assume these are ok), and maybe even play a bit with stuff like
> delays, sdio resets and power cycles and see if things change. If you
> have access to the other inputs of the 8686 (it has several of them
> which are related to power and resets. Neither me nor Daniel have
> intimate knowledge about what any of those really do, but you could
> dig some info from emails send by Marvell folks on this list), then
> you can also try to play with them and see if things change. With
> luck, you could learn more about the problem and can hopefully get
> closer to finding a solution.
>
> It could be great if a solution will be found, but if not, we'll
> probably have to proceed with the revert...
>
> Good luck!
> Ohad.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread
* mmc: sdio: runtime PM and 8686 problems
@ 2011-11-18 8:53 Joe Woodward
2011-11-18 9:06 ` Ohad Ben-Cohen
0 siblings, 1 reply; 26+ messages in thread
From: Joe Woodward @ 2011-11-18 8:53 UTC (permalink / raw)
To: linux-mmc
(resending as my mailer seems to have decided that the first try was a reply to "RE: [PATCH 2/2] mmc: core: Support packed command for eMMC4.5
device,"... apologies!)
I have a GUMSTIX Overo (OMAP35xx) with a Marvel 8686 WiFi attached via SDIO (ok, I think it's actually a Wi2Wi W2CBW003 module containing an 8686).
Up to the 3.1 mainline kernel WiFi worked just fine! I could boot the kernel and load the libertas module successfully:
(during boot)
[ 3.193176] mmc1: new SDIO card at address 0001
(when loading module)
# modprobe libertas_sdio
[ 30.817749] lib80211: common routines for IEEE802.11 drivers
[ 31.143951] cfg80211: Calling CRDA to update world regulatory domain
[ 31.375823] libertas_sdio: Libertas SDIO driver
[ 31.380737] libertas_sdio: Copyright Pierre Ossman
[ 32.035186] libertas_sdio mmc1:0001:1: (unregistered net_device): 00:19:88:3e:4f:f9, fw 9.70.3p36, cap 0x00000303
[ 32.129943] libertas_sdio mmc1:0001:1: wlan0: Marvell WLAN 802.11 adapter
However it seems that runtime PM has now been turned on by default (by setting MMC_CAP_POWER_OFF_CARD in drivers/mmc/core/host.c), and the WiFi
has stopped working!
So, if I run the 3.2-rc2 (or rc1 for that matter) I get the following:
(during boot)
[ 3.486541] mmc1: new SDIO card at address 0001
(when loading module)
# modprobe libertas_sdio
[ 34.015350] lib80211: common routines for IEEE802.11 drivers
[ 34.345092] cfg80211: Calling CRDA to update world regulatory domain
[ 34.574096] libertas_sdio: Libertas SDIO driver
[ 34.578979] libertas_sdio: Copyright Pierre Ossman
[ 34.637481] libertas_sdio: probe of mmc1:0001:1 failed with error -16
Looking at arch/arm/mach-omap2/overo.c you can see that GPIO16 (OVERO_GPIO_W2W_NRESET) is the nRESET line for the 8686. This is held low for
10usecs during boot (see overo.c line 530 to 533).
I'm not 100% sure how power is connected to the SD8686 as GUMSTIX don't release schematics for their modules.
If I disable runtime PM (by commenting out the setting of MMC_CAP_POWER_OFF_CARD) everything works as before.
I can see plenty of threads relating to getting the SD8686 working for OLPC, and that some workarounds have made it in to the mainline kernel. From what
I understand the problem is that runtime PM removes power from the 8686 after boot and before the loading of the libertas module.
Are these workarounds expected to be enough for runtime PM to just "work"?
Is there anything special I should be doing with the nRESET line other than that which is done by default in the board file (holding nRESET low for 10usecs)?
Cheers,
Joe
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-18 8:53 Joe Woodward
@ 2011-11-18 9:06 ` Ohad Ben-Cohen
2011-11-18 10:00 ` Joe Woodward
0 siblings, 1 reply; 26+ messages in thread
From: Ohad Ben-Cohen @ 2011-11-18 9:06 UTC (permalink / raw)
To: Joe Woodward, Daniel Drake; +Cc: linux-mmc
Hi Joe,
On Fri, Nov 18, 2011 at 10:53 AM, Joe Woodward <jw@terrafix.co.uk> wrote:
> Are these workarounds expected to be enough for runtime PM to just "work"?
It definitely works for 12xx, and with Daniel's recent work merged I
think it also works fine for the sd8686 (Daniel, PCMIIW).
Ohad.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-18 9:06 ` Ohad Ben-Cohen
@ 2011-11-18 10:00 ` Joe Woodward
2011-11-18 12:15 ` Ohad Ben-Cohen
0 siblings, 1 reply; 26+ messages in thread
From: Joe Woodward @ 2011-11-18 10:00 UTC (permalink / raw)
To: Ohad Ben-Cohen, Daniel Drake; +Cc: linux-mmc
Ohad,
I'm assuming these changes have already made it to the mainline, and therefore are in the 3.2rc2 build I was testing...
If not do you have links to the patches?
Is there anything I can do to debug further the problems I'm seeing?
Cheers,
Joe
-----Original Message-----
From: Ohad Ben-Cohen <ohad@wizery.com>
To: Joe Woodward <jw@terrafix.co.uk>, Daniel Drake <dsd@laptop.org>
Cc: linux-mmc@vger.kernel.org
Date: Fri, 18 Nov 2011 11:06:44 +0200
Subject: Re: mmc: sdio: runtime PM and 8686 problems
> Hi Joe,
>
> On Fri, Nov 18, 2011 at 10:53 AM, Joe Woodward <jw@terrafix.co.uk>
> wrote:
> > Are these workarounds expected to be enough for runtime PM to just
> "work"?
>
> It definitely works for 12xx, and with Daniel's recent work merged I
> think it also works fine for the sd8686 (Daniel, PCMIIW).
>
> Ohad.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-18 10:00 ` Joe Woodward
@ 2011-11-18 12:15 ` Ohad Ben-Cohen
2011-11-29 11:17 ` Joe Woodward
0 siblings, 1 reply; 26+ messages in thread
From: Ohad Ben-Cohen @ 2011-11-18 12:15 UTC (permalink / raw)
To: Joe Woodward; +Cc: Daniel Drake, linux-mmc
On Fri, Nov 18, 2011 at 12:00 PM, Joe Woodward <jw@terrafix.co.uk> wrote:
> I'm assuming these changes have already made it to the mainline, and therefore are in the 3.2rc2 build I was testing...
Most probably, yeah.
> Is there anything I can do to debug further the problems I'm seeing?
Let's wait for Daniel to take a look, as he got libertas and sd8686
working with SDIO runtime PM.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-18 12:15 ` Ohad Ben-Cohen
@ 2011-11-29 11:17 ` Joe Woodward
2011-11-29 12:43 ` Ohad Ben-Cohen
0 siblings, 1 reply; 26+ messages in thread
From: Joe Woodward @ 2011-11-29 11:17 UTC (permalink / raw)
To: Ohad Ben-Cohen; +Cc: Daniel Drake, linux-mmc
Any more feedback on this?
I don't mind having to maintain my own patch to revert the change to core/host.c to disable runtime PM, but I'm a bit concerned by the commit comment:
"... Enable this trivially for a release or two. If no problems are reported,
we will follow up with a more extensive patch to remove this flag
altogether. If problems are reported, we can look at whitelist/blacklist
possibilities as before."
Certainly for my use case I'd appreciate keeping this flag around!
Cheers,
Joe
-----Original Message-----
From: Ohad Ben-Cohen <ohad@wizery.com>
To: Joe Woodward <jw@terrafix.co.uk>
Cc: Daniel Drake <dsd@laptop.org>, linux-mmc@vger.kernel.org
Date: Fri, 18 Nov 2011 14:15:03 +0200
Subject: Re: mmc: sdio: runtime PM and 8686 problems
> On Fri, Nov 18, 2011 at 12:00 PM, Joe Woodward <jw@terrafix.co.uk>
> wrote:
> > I'm assuming these changes have already made it to the mainline, and
> therefore are in the 3.2rc2 build I was testing...
>
> Most probably, yeah.
>
> > Is there anything I can do to debug further the problems I'm seeing?
>
> Let's wait for Daniel to take a look, as he got libertas and sd8686
> working with SDIO runtime PM.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-29 11:17 ` Joe Woodward
@ 2011-11-29 12:43 ` Ohad Ben-Cohen
2011-11-29 21:42 ` Daniel Drake
0 siblings, 1 reply; 26+ messages in thread
From: Ohad Ben-Cohen @ 2011-11-29 12:43 UTC (permalink / raw)
To: Joe Woodward, Daniel Drake; +Cc: linux-mmc, Chris Ball
On Tue, Nov 29, 2011 at 1:17 PM, Joe Woodward <jw@terrafix.co.uk> wrote:
> Any more feedback on this?
Daniel, can you please take a look ?
Joe, Daniel's patch is long term the right thing to do, so I hope we
could understand and solve the issue you have and still go on with
Daniel's long term plan.
At the same time, though, we're very much determined not to compromise
any existing functionality. So IMHO it's either fixing your regression
or reverting the change (and then possibly introducing white/black
listing as Daniel suggested), but we definitely aren't going to have
you maintain the fix for this out-of-tree.
Ohad.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-29 12:43 ` Ohad Ben-Cohen
@ 2011-11-29 21:42 ` Daniel Drake
2011-11-30 10:36 ` Ohad Ben-Cohen
0 siblings, 1 reply; 26+ messages in thread
From: Daniel Drake @ 2011-11-29 21:42 UTC (permalink / raw)
To: Ohad Ben-Cohen; +Cc: Joe Woodward, linux-mmc, Chris Ball
On Tue, Nov 29, 2011 at 6:43 AM, Ohad Ben-Cohen <ohad@wizery.com> wrote:
> On Tue, Nov 29, 2011 at 1:17 PM, Joe Woodward <jw@terrafix.co.uk> wrote:
>> Any more feedback on this?
>
> Daniel, can you please take a look ?
Even though I have the pleasure of working with 8686 quite a bit, I'm
blind to how it works on the inside, so I don't have any expert
insight.
So first thing to do is to investigate the source of this error, as before:
[ 34.637481] libertas_sdio: probe of mmc1:0001:1 failed with error -16
which is likely bubbling up from somewhere inside the mmc/sdio layer.
Daniel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-29 21:42 ` Daniel Drake
@ 2011-11-30 10:36 ` Ohad Ben-Cohen
2011-11-30 14:12 ` Daniel Drake
0 siblings, 1 reply; 26+ messages in thread
From: Ohad Ben-Cohen @ 2011-11-30 10:36 UTC (permalink / raw)
To: Daniel Drake; +Cc: Joe Woodward, linux-mmc, Chris Ball
Hi Daniel,
On Tue, Nov 29, 2011 at 11:42 PM, Daniel Drake <dsd@laptop.org> wrote:
> Even though I have the pleasure of working with 8686 quite a bit
(Is there a subtle cynicism here ? :)
> So first thing to do is to investigate the source of this error, as before:
> [ 34.637481] libertas_sdio: probe of mmc1:0001:1 failed with error -16
>
> which is likely bubbling up from somewhere inside the mmc/sdio layer.
Well, it sounds like Joe might need a hand here.
Since this regression is directly caused by commit 08da834 "mmc:
enable runtime PM by default", which you authored and have interest
in, it does make sense that you help Joe here. In case you're short of
time, then I suggest to revert 08da834 (which anyway was
experimental), and get back to it later, when you're more available.
Thanks,
Ohad.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-30 10:36 ` Ohad Ben-Cohen
@ 2011-11-30 14:12 ` Daniel Drake
2011-11-30 14:29 ` Ohad Ben-Cohen
0 siblings, 1 reply; 26+ messages in thread
From: Daniel Drake @ 2011-11-30 14:12 UTC (permalink / raw)
To: Ohad Ben-Cohen; +Cc: Joe Woodward, linux-mmc, Chris Ball
On Wed, Nov 30, 2011 at 4:36 AM, Ohad Ben-Cohen <ohad@wizery.com> wrote:
> Hi Daniel,
>
> On Tue, Nov 29, 2011 at 11:42 PM, Daniel Drake <dsd@laptop.org> wrote:
>> Even though I have the pleasure of working with 8686 quite a bit
>
> (Is there a subtle cynicism here ? :)
>
>> So first thing to do is to investigate the source of this error, as before:
>> [ 34.637481] libertas_sdio: probe of mmc1:0001:1 failed with error -16
>>
>> which is likely bubbling up from somewhere inside the mmc/sdio layer.
>
> Well, it sounds like Joe might need a hand here.
I can't reproduce it.
My suggestion is to follow the debugging steps from previous threads
on this topic such as
MMC runtime PM patches break libertas probe
The goal is to identify the line of code that is causing this error.
Use printk debugging in the codepaths mentioned earlier until the
point of failure is known. Let me know if further direction is needed.
> Since this regression is directly caused by commit 08da834 "mmc:
> enable runtime PM by default", which you authored and have interest
> in, it does make sense that you help Joe here. In case you're short of
> time, then I suggest to revert 08da834 (which anyway was
> experimental), and get back to it later, when you're more available.
My patch simply sets a flag to enable a whole load of code written by
you - code which I understand little about. I am now available to
help, but given that my understanding of mmc is limited, I didn't
write the code in question, and I also lack expert insight into 8686
powerup, I'm not sure how useful I can be.
Daniel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-30 14:12 ` Daniel Drake
@ 2011-11-30 14:29 ` Ohad Ben-Cohen
2011-11-30 14:57 ` Daniel Drake
` (2 more replies)
0 siblings, 3 replies; 26+ messages in thread
From: Ohad Ben-Cohen @ 2011-11-30 14:29 UTC (permalink / raw)
To: Daniel Drake; +Cc: Joe Woodward, linux-mmc, Chris Ball
On Wed, Nov 30, 2011 at 4:12 PM, Daniel Drake <dsd@laptop.org> wrote:
> My patch simply sets a flag to enable a whole load of code written by
> you - code which I understand little about. I am now available to
> help, but given that my understanding of mmc is limited, I didn't
> write the code in question, and I also lack expert insight into 8686
> powerup, I'm not sure how useful I can be.
Let's revert 08da834 then.
When SDIO runtime PM was originally introduced, we immediately faced
two regressions with two different chipsets, and in response decided
not to enable it by default.
With your work on the 8686 we hoped we found all the gotchas, so
08da834 did make sense (at least experimentally).
Unfortunately we now see that some setups out there still refuse to
work when SDIO runtime PM is enabled by default, and obviously we
can't live with these kind of regressions.
commit fd9fec7a00f58a16803e37a99a014ef82543ef6f
Author: Ohad Ben-Cohen <ohad@wizery.com>
Date: Wed Nov 30 16:22:13 2011 +0200
Revert "mmc: enable runtime PM by default"
When SDIO runtime PM was originally introduced, we immediately faced
two regressions with two different chipsets, and in response decided
not to enable it by default.
With the recent work on the 8686 we hoped we found all the gotchas,
so 08da834 did make sense (at least experimentally).
Unfortunately we now see that some setups out there still refuse to work
when SDIO runtime PM is enabled by default (see
http://www.spinics.net/lists/linux-mmc/msg11161.html), and obviously we
can't live with these kind of regressions.
This reverts commit 08da834a24312157f512224691ad1fddd11c1073.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Daniel Drake <dsd@laptop.org>
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index e8a5eb3..d31c78b 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -302,17 +302,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct
device *dev)
host->max_blk_size = 512;
host->max_blk_count = PAGE_CACHE_SIZE / 512;
- /*
- * Enable runtime power management by default. This flag was added due
- * to runtime power management causing disruption for some users, but
- * the power on/off code has been improved since then.
- *
- * We'll enable this flag by default as an experiment, and if no
- * problems are reported, we will follow up later and remove the flag
- * altogether.
- */
- host->caps = MMC_CAP_POWER_OFF_CARD;
-
return host;
free:
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-30 14:29 ` Ohad Ben-Cohen
@ 2011-11-30 14:57 ` Daniel Drake
2011-12-01 7:50 ` Ohad Ben-Cohen
2011-11-30 15:00 ` Joe Woodward
2011-12-19 9:10 ` Ohad Ben-Cohen
2 siblings, 1 reply; 26+ messages in thread
From: Daniel Drake @ 2011-11-30 14:57 UTC (permalink / raw)
To: Ohad Ben-Cohen; +Cc: Joe Woodward, linux-mmc, Chris Ball
On Wed, Nov 30, 2011 at 8:29 AM, Ohad Ben-Cohen <ohad@wizery.com> wrote:
> Let's revert 08da834 then.
Sounds fine to me, although it may make sense to wait and see if Joe
is able to perform further diagnosis, which may raise some clues.
If we go ahead with the revert, can you help me come up with a way to
whitelist it for OLPC? Would a DMI-based quirk in sdhci be acceptable
for you?
Thanks,
Daniel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-30 14:57 ` Daniel Drake
@ 2011-12-01 7:50 ` Ohad Ben-Cohen
0 siblings, 0 replies; 26+ messages in thread
From: Ohad Ben-Cohen @ 2011-12-01 7:50 UTC (permalink / raw)
To: Daniel Drake; +Cc: Joe Woodward, linux-mmc, Chris Ball
On Wed, Nov 30, 2011 at 4:57 PM, Daniel Drake <dsd@laptop.org> wrote:
> If we go ahead with the revert, can you help me come up with a way to
> whitelist it for OLPC?
Sure thing.
> Would a DMI-based quirk in sdhci be acceptable for you?
I wasn't following sdhci development so much as I'm not developing on
such hardware, so I'll have to take a look. AFAIK though sdhci is
maintained by Wolfram, so you need his consent. Whatever approach
Wolfram and you will agree on is of course fine with me.
Thanks,
Ohad.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-30 14:29 ` Ohad Ben-Cohen
2011-11-30 14:57 ` Daniel Drake
@ 2011-11-30 15:00 ` Joe Woodward
2011-12-01 8:07 ` Ohad Ben-Cohen
2011-12-19 9:10 ` Ohad Ben-Cohen
2 siblings, 1 reply; 26+ messages in thread
From: Joe Woodward @ 2011-11-30 15:00 UTC (permalink / raw)
To: Ohad Ben-Cohen, Daniel Drake; +Cc: linux-mmc, Chris Ball
(For reference I have a Gumstix Fire (OMAP3530) revision R3118 plugged in to a PALO43 expansion board. The Gumstix Fire contains a W2CBW003, which in
turn contains a Marvell 8686 SDIO WiFi).
Running linux-3.2-rc2 built with the omap2plus_defconfig (with a few features minor tweaks).
With the "stock" kernel I get:
# modprobe libertas_sdio
[ 25.813598] lib80211: common routines for IEEE802.11 drivers
[ 26.141082] cfg80211: Calling CRDA to update world regulatory domain
[ 26.373718] libertas_sdio: Libertas SDIO driver
[ 26.378479] libertas_sdio: Copyright Pierre Ossman
[ 26.433105] libertas_sdio: probe of mmc1:0001:1 failed with error -16
So, I've enabled MMC_DEBUG (in Kconfig) and the DEBUG defines in libertas/defs.h, and now get:
[ 4.036682] mmc1: new SDIO card at address 0001
[ 4.042510] -
[ 4.052459] mmc1: mmc_power_save_host: powering down
[ 31.223724] libertas_sdio: Libertas SDIO driver
[ 31.228485] libertas_sdio: Copyright Pierre Ossman
[ 31.233703] mmc1: mmc_power_restore_host: powering up
[ 31.239074] mmc1: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 20 width 0 timing 0
[ 31.239349] omap_hsmmc omap_hsmmc.1: context was not lost
[ 31.239379] omap_hsmmc omap_hsmmc.1: enabled
[ 31.239410] omap_hsmmc omap_hsmmc.1: Set clock to 0Hz
[ 31.243438] omap_hsmmc omap_hsmmc.1: disabled
[ 31.262451] mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0 timing 0
[ 31.262725] omap_hsmmc omap_hsmmc.1: context was not lost
[ 31.262725] omap_hsmmc omap_hsmmc.1: enabled
[ 31.262786] omap_hsmmc omap_hsmmc.1: Set clock to 400000Hz
[ 31.263092] omap_hsmmc omap_hsmmc.1: disabled
[ 31.286163] omap_hsmmc omap_hsmmc.1: context was not lost
[ 31.286193] omap_hsmmc omap_hsmmc.1: enabled
[ 31.286224] mmc1: starting CMD52 arg 00000c00 flags 00000195
[ 31.286254] omap_hsmmc omap_hsmmc.1: mmc1: CMD52, argument 0x00000c00
[ 31.286590] omap_hsmmc omap_hsmmc.1: IRQ Status is 1
[ 31.286621] mmc1: req done (CMD52): 0: 00001000 00000000 00000000 00000000
[ 31.286682] mmc1: starting CMD52 arg 80000c08 flags 00000195
[ 31.286682] omap_hsmmc omap_hsmmc.1: mmc1: CMD52, argument 0x80000c08
[ 31.287017] omap_hsmmc omap_hsmmc.1: IRQ Status is 1
[ 31.287048] mmc1: req done (CMD52): 0: 00001008 00000000 00000000 00000000
[ 31.287109] mmc1: clock 400000Hz busmode 2 powermode 2 cs 1 Vdd 20 width 0 timing 0
[ 31.287109] omap_hsmmc omap_hsmmc.1: Set clock to 400000Hz
[ 31.288146] mmc1: starting CMD0 arg 00000000 flags 000000c0
[ 31.288177] omap_hsmmc omap_hsmmc.1: mmc1: CMD0, argument 0x00000000
[ 31.288330] omap_hsmmc omap_hsmmc.1: IRQ Status is 1
[ 31.288360] mmc1: req done (CMD0): 0: 00000000 00000000 00000000 00000000
[ 31.289398] mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0 timing 0
[ 31.289428] omap_hsmmc omap_hsmmc.1: Set clock to 400000Hz
[ 31.290466] mmc1: starting CMD8 arg 000001aa flags 000002f5
[ 31.290466] omap_hsmmc omap_hsmmc.1: mmc1: CMD8, argument 0x000001aa
[ 31.290832] omap_hsmmc omap_hsmmc.1: IRQ Status is 18000
[ 31.290863] omap_hsmmc omap_hsmmc.1: MMC IRQ 0x18000 : ERRI CTO
[ 31.290893] mmc1: req done (CMD8): -110: 00000000 00000000 00000000 00000000
[ 31.290924] mmc1: starting CMD5 arg 00000000 flags 000002e1
[ 31.290954] omap_hsmmc omap_hsmmc.1: mmc1: CMD5, argument 0x00000000
[ 31.291290] omap_hsmmc omap_hsmmc.1: IRQ Status is 18000
[ 31.291320] omap_hsmmc omap_hsmmc.1: MMC IRQ 0x18000 : ERRI CTO
[ 31.291381] mmc1: req failed (CMD5): -110, retrying...
[ 31.291412] omap_hsmmc omap_hsmmc.1: mmc1: CMD5, argument 0x00000000
[ 31.291748] omap_hsmmc omap_hsmmc.1: IRQ Status is 18000
[ 31.291778] omap_hsmmc omap_hsmmc.1: MMC IRQ 0x18000 : ERRI CTO
[ 31.291839] mmc1: req failed (CMD5): -110, retrying...
[ 31.291870] omap_hsmmc omap_hsmmc.1: mmc1: CMD5, argument 0x00000000
[ 31.292205] omap_hsmmc omap_hsmmc.1: IRQ Status is 18000
[ 31.292236] omap_hsmmc omap_hsmmc.1: MMC IRQ 0x18000 : ERRI CTO
[ 31.292266] mmc1: req failed (CMD5): -110, retrying...
[ 31.292297] omap_hsmmc omap_hsmmc.1: mmc1: CMD5, argument 0x00000000
[ 31.292633] omap_hsmmc omap_hsmmc.1: IRQ Status is 18000
[ 31.292663] omap_hsmmc omap_hsmmc.1: MMC IRQ 0x18000 : ERRI CTO
[ 31.292694] mmc1: req done (CMD5): -110: 00000000 00000000 00000000 00000000
[ 31.292877] libertas_sdio: probe of mmc1:0001:1 failed with error -16
[ 31.387481] omap_hsmmc omap_hsmmc.1: disabled
Is this useful?
It seems CMD5 fails (which seems to be what the workarounds were aiming to fix).
I'm afraid I may not be of much more use as Gumstix (annoyingly) don't release schematics of their COMs, so actually probing any signals isn't really possible.
Cheers,
Joe
-----Original Message-----
From: Ohad Ben-Cohen <ohad@wizery.com>
To: Daniel Drake <dsd@laptop.org>
Cc: Joe Woodward <jw@terrafix.co.uk>, linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>
Date: Wed, 30 Nov 2011 16:29:21 +0200
Subject: Re: mmc: sdio: runtime PM and 8686 problems
> On Wed, Nov 30, 2011 at 4:12 PM, Daniel Drake <dsd@laptop.org> wrote:
> > My patch simply sets a flag to enable a whole load of code written by
> > you - code which I understand little about. I am now available to
> > help, but given that my understanding of mmc is limited, I didn't
> > write the code in question, and I also lack expert insight into 8686
> > powerup, I'm not sure how useful I can be.
>
> Let's revert 08da834 then.
>
> When SDIO runtime PM was originally introduced, we immediately faced
> two regressions with two different chipsets, and in response decided
> not to enable it by default.
>
> With your work on the 8686 we hoped we found all the gotchas, so
> 08da834 did make sense (at least experimentally).
>
> Unfortunately we now see that some setups out there still refuse to
> work when SDIO runtime PM is enabled by default, and obviously we
> can't live with these kind of regressions.
>
> commit fd9fec7a00f58a16803e37a99a014ef82543ef6f
> Author: Ohad Ben-Cohen <ohad@wizery.com>
> Date: Wed Nov 30 16:22:13 2011 +0200
>
> Revert "mmc: enable runtime PM by default"
>
> When SDIO runtime PM was originally introduced, we immediately
> faced
> two regressions with two different chipsets, and in response
> decided
> not to enable it by default.
>
> With the recent work on the 8686 we hoped we found all the gotchas,
> so 08da834 did make sense (at least experimentally).
>
> Unfortunately we now see that some setups out there still refuse to
> work
> when SDIO runtime PM is enabled by default (see
> http://www.spinics.net/lists/linux-mmc/msg11161.html), and
> obviously we
> can't live with these kind of regressions.
>
> This reverts commit 08da834a24312157f512224691ad1fddd11c1073.
>
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
> Cc: Daniel Drake <dsd@laptop.org>
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index e8a5eb3..d31c78b 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -302,17 +302,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct
> device *dev)
> host->max_blk_size = 512;
> host->max_blk_count = PAGE_CACHE_SIZE / 512;
>
> - /*
> - * Enable runtime power management by default. This flag was added
> due
> - * to runtime power management causing disruption for some users, but
> - * the power on/off code has been improved since then.
> - *
> - * We'll enable this flag by default as an experiment, and if no
> - * problems are reported, we will follow up later and remove the flag
> - * altogether.
> - */
> - host->caps = MMC_CAP_POWER_OFF_CARD;
> -
> return host;
>
> free:
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-30 15:00 ` Joe Woodward
@ 2011-12-01 8:07 ` Ohad Ben-Cohen
2011-12-01 11:28 ` Joe Woodward
0 siblings, 1 reply; 26+ messages in thread
From: Ohad Ben-Cohen @ 2011-12-01 8:07 UTC (permalink / raw)
To: Joe Woodward; +Cc: Daniel Drake, linux-mmc, Chris Ball
On Wed, Nov 30, 2011 at 5:00 PM, Joe Woodward <jw@terrafix.co.uk> wrote:
> It seems CMD5 fails (which seems to be what the workarounds were aiming to fix).
Right; you get a timeout (-110), which means the 8686 didn't send any response.
This is unexpected because the sdio reset (the CMD52 you see before
the init sequence) should be enough to reset the device (we confirmed
this with the Marvell folks on this list awhile ago).
> I'm afraid I may not be of much more use as Gumstix (annoyingly) don't release schematics of their COMs, so actually probing any signals isn't really possible.
Yes, it makes it difficult to debug.
You can try to verify (in the code) that all the text book
prerequisites are there (e.g. all SDIO lines are pulled up and muxed
correctly. though since stuff work for you without SDIO runtime PM, I
assume these are ok), and maybe even play a bit with stuff like
delays, sdio resets and power cycles and see if things change. If you
have access to the other inputs of the 8686 (it has several of them
which are related to power and resets. Neither me nor Daniel have
intimate knowledge about what any of those really do, but you could
dig some info from emails send by Marvell folks on this list), then
you can also try to play with them and see if things change. With
luck, you could learn more about the problem and can hopefully get
closer to finding a solution.
It could be great if a solution will be found, but if not, we'll
probably have to proceed with the revert...
Good luck!
Ohad.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-12-01 8:07 ` Ohad Ben-Cohen
@ 2011-12-01 11:28 ` Joe Woodward
2011-12-03 16:44 ` Daniel Drake
0 siblings, 1 reply; 26+ messages in thread
From: Joe Woodward @ 2011-12-01 11:28 UTC (permalink / raw)
To: Ohad Ben-Cohen; +Cc: Daniel Drake, linux-mmc, Chris Ball
I've had a play with the nRESET line (as far as I can tell it is the only pin I have access to), and no joy.
Also tried playing about a bit with the CMD sequence, again no joy.
I'm not entirely sure of the CMD sequence. It seems we get:
- CMD52 (x2)
- CMD0
- CMD8 (fails)
- CMD5 (fails)
In the "SDIO Simplified Specification Version 2.00" (https://www.sdcard.org/developers/overview/sdio/sdio_spec/Simplified_SDIO_Card_Spec.pdf) page 6 it
seems only a CMD52 should be required to "Re-init IO". Previous thread posts state CMD5 (x2) are required by the 8686, but why CMD0/CMD8?
Incidentally errors only occur after the CMD0, but before the first error we get (i.e. a change of cs from 1 to 0):
"mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0 timing 0".
Any thoughts?
I think we've probably hit the end of the line here, unless someone else pops up who knows more about the Gumstix (i.e. has access to a schematic) or the
W2CBW003 and it's SD8686 internals.
Thanks for the help anyway chaps!
Cheers,
Joe
-----Original Message-----
From: Ohad Ben-Cohen <ohad@wizery.com>
To: Joe Woodward <jw@terrafix.co.uk>
Cc: Daniel Drake <dsd@laptop.org>, linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>
Date: Thu, 1 Dec 2011 10:07:24 +0200
Subject: Re: mmc: sdio: runtime PM and 8686 problems
> On Wed, Nov 30, 2011 at 5:00 PM, Joe Woodward <jw@terrafix.co.uk>
> wrote:
> > It seems CMD5 fails (which seems to be what the workarounds were
> aiming to fix).
>
> Right; you get a timeout (-110), which means the 8686 didn't send any
> response.
>
> This is unexpected because the sdio reset (the CMD52 you see before
> the init sequence) should be enough to reset the device (we confirmed
> this with the Marvell folks on this list awhile ago).
>
> > I'm afraid I may not be of much more use as Gumstix (annoyingly)
> don't release schematics of their COMs, so actually probing any signals
> isn't really possible.
>
> Yes, it makes it difficult to debug.
>
> You can try to verify (in the code) that all the text book
> prerequisites are there (e.g. all SDIO lines are pulled up and muxed
> correctly. though since stuff work for you without SDIO runtime PM, I
> assume these are ok), and maybe even play a bit with stuff like
> delays, sdio resets and power cycles and see if things change. If you
> have access to the other inputs of the 8686 (it has several of them
> which are related to power and resets. Neither me nor Daniel have
> intimate knowledge about what any of those really do, but you could
> dig some info from emails send by Marvell folks on this list), then
> you can also try to play with them and see if things change. With
> luck, you could learn more about the problem and can hopefully get
> closer to finding a solution.
>
> It could be great if a solution will be found, but if not, we'll
> probably have to proceed with the revert...
>
> Good luck!
> Ohad.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-12-01 11:28 ` Joe Woodward
@ 2011-12-03 16:44 ` Daniel Drake
2011-12-03 16:45 ` Daniel Drake
2011-12-07 12:28 ` Joe Woodward
0 siblings, 2 replies; 26+ messages in thread
From: Daniel Drake @ 2011-12-03 16:44 UTC (permalink / raw)
To: Joe Woodward; +Cc: Ohad Ben-Cohen, linux-mmc, Chris Ball
On Thu, Dec 1, 2011 at 5:28 AM, Joe Woodward <jw@terrafix.co.uk> wrote:
> I've had a play with the nRESET line (as far as I can tell it is the only pin I have access to), and no joy.
>
> Also tried playing about a bit with the CMD sequence, again no joy.
>
> I'm not entirely sure of the CMD sequence. It seems we get:
> - CMD52 (x2)
> - CMD0
> - CMD8 (fails)
> - CMD5 (fails)
>
> In the "SDIO Simplified Specification Version 2.00" (https://www.sdcard.org/developers/overview/sdio/sdio_spec/Simplified_SDIO_Card_Spec.pdf) page 6 it
> seems only a CMD52 should be required to "Re-init IO". Previous thread posts state CMD5 (x2) are required by the 8686, but why CMD0/CMD8?
>
> Incidentally errors only occur after the CMD0, but before the first error we get (i.e. a change of cs from 1 to 0):
> "mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0 timing 0".
Can you see how this compares with older working kernels?
Some more things to try:
there are some delays in mmc_power_off - try increasing them to 1000.
mmc_sdio_power_restore does:
sdio_reset (cmd52)
mmc_go_idle (cmd0)
mmc_send_if_cond (cmd8)
mmc_send_io_op_cond (cmd52)
These are the commands you have been looking at from the angle of the logs.
Try sprinkling in a load of msleep(500) delays before and inbetween
those commands. And if you suspect some of them are not necessary
trying removing them, etc.
Non-scientific but this is how we have got things working so far :)
Thanks,
Daniel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-12-03 16:44 ` Daniel Drake
@ 2011-12-03 16:45 ` Daniel Drake
2011-12-07 12:28 ` Joe Woodward
1 sibling, 0 replies; 26+ messages in thread
From: Daniel Drake @ 2011-12-03 16:45 UTC (permalink / raw)
To: Joe Woodward; +Cc: Ohad Ben-Cohen, linux-mmc, Chris Ball
On Sat, Dec 3, 2011 at 10:44 AM, Daniel Drake <dsd@laptop.org> wrote:
> On Thu, Dec 1, 2011 at 5:28 AM, Joe Woodward <jw@terrafix.co.uk> wrote:
>> I've had a play with the nRESET line (as far as I can tell it is the only pin I have access to), and no joy.
The card is being reset and powered up successfully during boot, then
powered down, then it fails to power up again.
Can you confirm that the reset line is definitely being fiddled during
the second and failing power up?
Thanks
Daniel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-12-03 16:44 ` Daniel Drake
2011-12-03 16:45 ` Daniel Drake
@ 2011-12-07 12:28 ` Joe Woodward
1 sibling, 0 replies; 26+ messages in thread
From: Joe Woodward @ 2011-12-07 12:28 UTC (permalink / raw)
To: Daniel Drake; +Cc: Ohad Ben-Cohen, linux-mmc, Chris Ball
Right, a bit more information.
First I tried just adding delays as suggested:
# Delays in core.c:mmc_power_up() increased to 1000.
# Delay in core.c:mmc_power_off() increased to 1000.
# sdio.c:mmc_sdio_power_restore() modified to add delays.
...
msleep(500);
sdio_reset(host);
msleep(500);
mmc_go_idle(host);
msleep(500);
mmc_send_if_cond(host, host->ocr_avail);
msleep(500);
ret = mmc_send_io_op_cond(host, 0, &ocr);
...
And there was no improvement (it slowed down the probe a lot!), so I tried again with much longer delays (3 seconds rather than 500ms) and still no change.
So I added control of the nRESET line in sdio.c:mmc_sdio_power_restore().
...
gpio_set_value(16, 0); /* GPIO16 is the nRESET line */
msleep(10);
gpio_set_value(16, 1);
msleep(100);
msleep(3000);
sdio_reset(host);
msleep(3000);
mmc_go_idle(host);
msleep(3000);
mmc_send_if_cond(host, host->ocr_avail);
msleep(3000);
...
and things sprung in to life, well sometimes! Sadly this only worked intermittently, and only with longer delays.
I guess this may not be a suprise, as I'm force resetting the card but not doing a full "probe".
I'm afraid I can't probe the nRESET line as the SD8686 is hidden under a shielding can, and I don't have the schematics for the GUMSTIX Overo to be able to
look for the signal anywhere else.
With the SD8686 only working every now and again with the nRESET control it's difficult to make progress as I'm stabbing around in the dark - I never really
know if I'm improving things or not when adding/removing timeouts etc...
Previous kernel's never had runtime PM enabled, so I'm not sure what you mean to compare there?
Whatever procedure is first applied to the SD8686 with runtime PM disabled works 100% of the time.
Does anyone know if OLPC keep any out-of-tree patches to make runtime PM work for them on the SD8686 (maybe fudging GPIOs or similar)?
Cheers,
Joe
-----Original Message-----
From: Daniel Drake <dsd@laptop.org>
To: Joe Woodward <jw@terrafix.co.uk>
Cc: Ohad Ben-Cohen <ohad@wizery.com>, linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>
Date: Sat, 3 Dec 2011 10:44:18 -0600
Subject: Re: mmc: sdio: runtime PM and 8686 problems
> On Thu, Dec 1, 2011 at 5:28 AM, Joe Woodward <jw@terrafix.co.uk> wrote:
> > I've had a play with the nRESET line (as far as I can tell it is the
> only pin I have access to), and no joy.
> >
> > Also tried playing about a bit with the CMD sequence, again no joy.
> >
> > I'm not entirely sure of the CMD sequence. It seems we get:
> > - CMD52 (x2)
> > - CMD0
> > - CMD8 (fails)
> > - CMD5 (fails)
> >
> > In the "SDIO Simplified Specification Version 2.00"
> (https://www.sdcard.org/developers/overview/sdio/sdio_spec/Simplified_S
> DIO_Card_Spec.pdf) page 6 it
> > seems only a CMD52 should be required to "Re-init IO". Previous
> thread posts state CMD5 (x2) are required by the 8686, but why
> CMD0/CMD8?
> >
> > Incidentally errors only occur after the CMD0, but before the first
> error we get (i.e. a change of cs from 1 to 0):
> > "mmc1: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0
> timing 0".
>
> Can you see how this compares with older working kernels?
>
> Some more things to try:
> there are some delays in mmc_power_off - try increasing them to 1000.
>
>
> mmc_sdio_power_restore does:
> sdio_reset (cmd52)
> mmc_go_idle (cmd0)
> mmc_send_if_cond (cmd8)
> mmc_send_io_op_cond (cmd52)
>
> These are the commands you have been looking at from the angle of the
> logs.
>
> Try sprinkling in a load of msleep(500) delays before and inbetween
> those commands. And if you suspect some of them are not necessary
> trying removing them, etc.
>
> Non-scientific but this is how we have got things working so far :)
>
> Thanks,
> Daniel
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-11-30 14:29 ` Ohad Ben-Cohen
2011-11-30 14:57 ` Daniel Drake
2011-11-30 15:00 ` Joe Woodward
@ 2011-12-19 9:10 ` Ohad Ben-Cohen
2011-12-19 9:22 ` Ohad Ben-Cohen
2012-04-26 23:51 ` Steve Sakoman
2 siblings, 2 replies; 26+ messages in thread
From: Ohad Ben-Cohen @ 2011-12-19 9:10 UTC (permalink / raw)
To: Chris Ball; +Cc: Joe Woodward, linux-mmc, Neil Brown, Bing Zhao, Daniel Drake
Hi Chris,
On Wed, Nov 30, 2011 at 4:29 PM, Ohad Ben-Cohen <ohad@wizery.com> wrote:
> On Wed, Nov 30, 2011 at 4:12 PM, Daniel Drake <dsd@laptop.org> wrote:
>> My patch simply sets a flag to enable a whole load of code written by
>> you - code which I understand little about. I am now available to
>> help, but given that my understanding of mmc is limited, I didn't
>> write the code in question, and I also lack expert insight into 8686
>> powerup, I'm not sure how useful I can be.
>
> Let's revert 08da834 then.
We're slowly progressing towards understanding the issues we have with
the 8686 (it seems there are a few different hw revisions of it, some
of which do require toggling the reset pin before sending another init
sequence), but it might take some more time until a solution fully
materializes.
Since 3.2 is just around the corner, I suggest we should now proceed
with the revert (see patch below), and later revisit this once we have
a complete solution in hand.
Thanks,
Ohad.
>
> When SDIO runtime PM was originally introduced, we immediately faced
> two regressions with two different chipsets, and in response decided
> not to enable it by default.
>
> With your work on the 8686 we hoped we found all the gotchas, so
> 08da834 did make sense (at least experimentally).
>
> Unfortunately we now see that some setups out there still refuse to
> work when SDIO runtime PM is enabled by default, and obviously we
> can't live with these kind of regressions.
>
> commit fd9fec7a00f58a16803e37a99a014ef82543ef6f
> Author: Ohad Ben-Cohen <ohad@wizery.com>
> Date: Wed Nov 30 16:22:13 2011 +0200
>
> Revert "mmc: enable runtime PM by default"
>
> When SDIO runtime PM was originally introduced, we immediately faced
> two regressions with two different chipsets, and in response decided
> not to enable it by default.
>
> With the recent work on the 8686 we hoped we found all the gotchas,
> so 08da834 did make sense (at least experimentally).
>
> Unfortunately we now see that some setups out there still refuse to work
> when SDIO runtime PM is enabled by default (see
> http://www.spinics.net/lists/linux-mmc/msg11161.html), and obviously we
> can't live with these kind of regressions.
>
> This reverts commit 08da834a24312157f512224691ad1fddd11c1073.
>
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
> Cc: Daniel Drake <dsd@laptop.org>
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index e8a5eb3..d31c78b 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -302,17 +302,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct
> device *dev)
> host->max_blk_size = 512;
> host->max_blk_count = PAGE_CACHE_SIZE / 512;
>
> - /*
> - * Enable runtime power management by default. This flag was added due
> - * to runtime power management causing disruption for some users, but
> - * the power on/off code has been improved since then.
> - *
> - * We'll enable this flag by default as an experiment, and if no
> - * problems are reported, we will follow up later and remove the flag
> - * altogether.
> - */
> - host->caps = MMC_CAP_POWER_OFF_CARD;
> -
> return host;
>
> free:
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-12-19 9:10 ` Ohad Ben-Cohen
@ 2011-12-19 9:22 ` Ohad Ben-Cohen
2012-04-26 23:51 ` Steve Sakoman
1 sibling, 0 replies; 26+ messages in thread
From: Ohad Ben-Cohen @ 2011-12-19 9:22 UTC (permalink / raw)
To: Chris Ball; +Cc: Joe Woodward, linux-mmc, Neil Brown, Bing Zhao, Daniel Drake
On Mon, Dec 19, 2011 at 11:10 AM, Ohad Ben-Cohen <ohad@wizery.com> wrote:
> (it seems there are a few different hw revisions of it, some
> of which do require toggling the reset pin before sending another init
> sequence)
(it might just be different setups and not really different hw
revisions of the 8686)
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2011-12-19 9:10 ` Ohad Ben-Cohen
2011-12-19 9:22 ` Ohad Ben-Cohen
@ 2012-04-26 23:51 ` Steve Sakoman
2012-04-27 8:26 ` Joe Woodward
2012-04-28 9:51 ` NeilBrown
1 sibling, 2 replies; 26+ messages in thread
From: Steve Sakoman @ 2012-04-26 23:51 UTC (permalink / raw)
To: Ohad Ben-Cohen
Cc: Chris Ball, Joe Woodward, linux-mmc, Neil Brown, Bing Zhao,
Daniel Drake
On Mon, Dec 19, 2011 at 1:10 AM, Ohad Ben-Cohen <ohad@wizery.com> wrote:
> We're slowly progressing towards understanding the issues we have with
> the 8686 (it seems there are a few different hw revisions of it, some
> of which do require toggling the reset pin before sending another init
> sequence), but it might take some more time until a solution fully
> materializes.
>
> Since 3.2 is just around the corner, I suggest we should now proceed
> with the revert (see patch below), and later revisit this once we have
> a complete solution in hand.
Has any progress been made on this issue?
I too have been trying to power down/up the wifi module on the Overo.
I'm seeing the same issue described in this thread.
Some additional data:
I rebuilt my kernel (3.2) with a CD GPIO enabled for the mmc port the module
is connected to and in turn connected that GPIO to another one that I
can toggle from user space.
Toggling the CD GPIO after powering back up the module does indeed
work properly -- the module is detected, the driver loaded, and proper function
restored.
So basically the procedure I've used is:
- decide wifi can be powered down
- unload the libertas modules
- put the wifi hw in reset with gpio16
- wait till wifi is needed again
- take the chip out of reset
- toggle the CD gpio
- libertas modules are autoloaded, as is the firmware
- wifi is up and functioning
So the next step is to get rid of the silly two GPIO external hardware
hack. Is it possible to trigger a card insertion/removal event via
some standard API?
Or does the above information provide a clue as to why normal code
paths don't work?
Any other ideas?
Steve
>> When SDIO runtime PM was originally introduced, we immediately faced
>> two regressions with two different chipsets, and in response decided
>> not to enable it by default.
>>
>> With your work on the 8686 we hoped we found all the gotchas, so
>> 08da834 did make sense (at least experimentally).
>>
>> Unfortunately we now see that some setups out there still refuse to
>> work when SDIO runtime PM is enabled by default, and obviously we
>> can't live with these kind of regressions.
>>
>> commit fd9fec7a00f58a16803e37a99a014ef82543ef6f
>> Author: Ohad Ben-Cohen <ohad@wizery.com>
>> Date: Wed Nov 30 16:22:13 2011 +0200
>>
>> Revert "mmc: enable runtime PM by default"
>>
>> When SDIO runtime PM was originally introduced, we immediately faced
>> two regressions with two different chipsets, and in response decided
>> not to enable it by default.
>>
>> With the recent work on the 8686 we hoped we found all the gotchas,
>> so 08da834 did make sense (at least experimentally).
>>
>> Unfortunately we now see that some setups out there still refuse to work
>> when SDIO runtime PM is enabled by default (see
>> http://www.spinics.net/lists/linux-mmc/msg11161.html), and obviously we
>> can't live with these kind of regressions.
>>
>> This reverts commit 08da834a24312157f512224691ad1fddd11c1073.
>>
>> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
>> Cc: Daniel Drake <dsd@laptop.org>
>>
>> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
>> index e8a5eb3..d31c78b 100644
>> --- a/drivers/mmc/core/host.c
>> +++ b/drivers/mmc/core/host.c
>> @@ -302,17 +302,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct
>> device *dev)
>> host->max_blk_size = 512;
>> host->max_blk_count = PAGE_CACHE_SIZE / 512;
>>
>> - /*
>> - * Enable runtime power management by default. This flag was added due
>> - * to runtime power management causing disruption for some users, but
>> - * the power on/off code has been improved since then.
>> - *
>> - * We'll enable this flag by default as an experiment, and if no
>> - * problems are reported, we will follow up later and remove the flag
>> - * altogether.
>> - */
>> - host->caps = MMC_CAP_POWER_OFF_CARD;
>> -
>> return host;
>>
>> free:
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mmc: sdio: runtime PM and 8686 problems
2012-04-26 23:51 ` Steve Sakoman
@ 2012-04-27 8:26 ` Joe Woodward
2012-04-28 9:51 ` NeilBrown
1 sibling, 0 replies; 26+ messages in thread
From: Joe Woodward @ 2012-04-27 8:26 UTC (permalink / raw)
To: Steve Sakoman, Ohad Ben-Cohen
Cc: Chris Ball, linux-mmc, Neil Brown, Bing Zhao, Daniel Drake
-----Original Message-----
From: Steve Sakoman <sakoman@gmail.com>
To: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Chris Ball <cjb@laptop.org>, Joe Woodward <jw@terrafix.co.uk>, linux-mmc@vger.kernel.org, Neil Brown <neilb@suse.de>, Bing Zhao
<bzhao@marvell.com>, Daniel Drake <dsd@laptop.org>
Date: Thu, 26 Apr 2012 16:51:10 -0700
Subject: Re: mmc: sdio: runtime PM and 8686 problems
> On Mon, Dec 19, 2011 at 1:10 AM, Ohad Ben-Cohen <ohad@wizery.com>
> wrote:
>
> > We're slowly progressing towards understanding the issues we have
> with
> > the 8686 (it seems there are a few different hw revisions of it, some
> > of which do require toggling the reset pin before sending another
> init
> > sequence), but it might take some more time until a solution fully
> > materializes.
> >
> > Since 3.2 is just around the corner, I suggest we should now proceed
> > with the revert (see patch below), and later revisit this once we
> have
> > a complete solution in hand.
>
> Has any progress been made on this issue?
>
> I too have been trying to power down/up the wifi module on the Overo.
> I'm seeing the same issue described in this thread.
>
> Some additional data:
>
> I rebuilt my kernel (3.2) with a CD GPIO enabled for the mmc port the
> module
> is connected to and in turn connected that GPIO to another one that I
> can toggle from user space.
>
> Toggling the CD GPIO after powering back up the module does indeed
> work properly -- the module is detected, the driver loaded, and proper
> function
> restored.
>
> So basically the procedure I've used is:
>
> - decide wifi can be powered down
> - unload the libertas modules
> - put the wifi hw in reset with gpio16
> - wait till wifi is needed again
> - take the chip out of reset
> - toggle the CD gpio
> - libertas modules are autoloaded, as is the firmware
> - wifi is up and functioning
>
> So the next step is to get rid of the silly two GPIO external hardware
> hack. Is it possible to trigger a card insertion/removal event via
> some standard API?
>
> Or does the above information provide a clue as to why normal code
> paths don't work?
>
> Any other ideas?
>
> Steve
>
Since the patch has been reverted (i.e. no runtime PM) I haven't seen a problem.
I've not put any more work in to getting it to work with runtime PM i'm afriad.
On a side note, I'm doing something very similar to you with my Overo, except with one difference. Where you have routed a GPIO externally which you can toggle
from userspace, I've hacked the MMC driver (omap_hsmmc.c) to add a sysfs entry to force a re-scan. This also allows me to safely remove/insert SD cards (as the
Overo SDCard slot doesn't have a card-detect pin) when the device is running (I run from a ramfs).
I've thought for a while that a userspace hook to kick the MMC driver where this is no physical GPIO would be useful in mainline, but haven't done any more about
it.
Also, I've appled the first pass of patches to enable Libertas async firmware loading (as required by newer UDEVs).
I have two scripts pasted below to turn on/off the WiFi (the delays just work for me, I know they are not optimal).
Hope this helps.
Cheers,
Joe
> cat #wifi-down.sh
#!/bin/sh
echo "Turning off WiFi..."
echo "...stopping wlan0 interface"
ifdown wlan0
echo "...unloading WiFi kernel module"
modprobe -r libertas_sdio
echo "...disabling power to WiFi chip"
if [ -e /sys/class/gpio/gpio16/value ] ; then
echo "...already exported GPIO reset control"
else
echo "...exporting GPIO reset control"
echo 16 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio16/direction
fi
echo 0 > /sys/class/gpio/gpio16/value
echo "...removing wpa configuration file"
rm /tmp/wpa_supplicant.conf
echo "..rescanning the MMC/SDIO as we have powered down the WiFi chip"
echo 1 > /sys/bus/platform/drivers/omap_hsmmc/omap_hsmmc.1/mmc_host/mmc1/rescan
sleep 2
echo "...done"
#> cat wifi-up.sh
#!/bin/sh
# Get the network parameters.
SSID=$1
PSK=$2
echo "Turning on WiFi..."
echo "...enabling power to WiFi chip"
if [ -e /sys/class/gpio/gpio16/value ] ; then
echo "...already exported GPIO reset control"
else
echo "...exporting GPIO reset control"
echo 16 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio16/direction
fi
echo 0 > /sys/class/gpio/gpio16/value
usleep 10
echo 1 > /sys/class/gpio/gpio16/value
usleep 10
echo "..rescanning the MMC/SDIO as we have powered up the WiFi chip"
echo 1 > /sys/bus/platform/drivers/omap_hsmmc/omap_hsmmc.1/mmc_host/mmc1/rescan
### Wait for the device to be found.
sleep 2
### Set up the AP and password.
echo "...adding wpa configuration file"
rm /tmp/wpa_supplicant.conf
echo "ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1
network={
ssid=\"${SSID}\"
proto=WPA2 # try WPA RSN if you WPA2 fails
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
scan_ssid=1
psk=\"${PSK}\"
priority=10
}" > /tmp/wpa_supplicant.conf
echo "...loading WiFi kernel module"
modprobe libertas_sdio
### We must wait for the asynchronous firmware loading to complete.
sleep 2
echo "...starting wlan0 interface"
ifup wlan0
echo "...done"
=========
On 3.2 the rescan looks a bit like:
static ssize_t
omap_hsmmc_store_rescan(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev);
struct omap_hsmmc_host *host = mmc_priv(mmc);
printk (KERN_ERR "MMC: rescanning...\n");
if (!host->suspended)
schedule_work(&host->mmc_carddetect_work);
return size;
}
static DEVICE_ATTR(rescan, S_IWUGO, NULL, omap_hsmmc_store_rescan);
And I add in to omap_hsmmc_probe:
ret = device_create_file(&mmc->class_dev, &dev_attr_rescan);
if (ret < 0)
goto err_slot_name;
>
> >> When SDIO runtime PM was originally introduced, we immediately faced
> >> two regressions with two different chipsets, and in response decided
> >> not to enable it by default.
> >>
> >> With your work on the 8686 we hoped we found all the gotchas, so
> >> 08da834 did make sense (at least experimentally).
> >>
> >> Unfortunately we now see that some setups out there still refuse to
> >> work when SDIO runtime PM is enabled by default, and obviously we
> >> can't live with these kind of regressions.
> >>
> >> commit fd9fec7a00f58a16803e37a99a014ef82543ef6f
> >> Author: Ohad Ben-Cohen <ohad@wizery.com>
> >> Date: Wed Nov 30 16:22:13 2011 +0200
> >>
> >> Revert "mmc: enable runtime PM by default"
> >>
> >> When SDIO runtime PM was originally introduced, we immediately
> faced
> >> two regressions with two different chipsets, and in response
> decided
> >> not to enable it by default.
> >>
> >> With the recent work on the 8686 we hoped we found all the
> gotchas,
> >> so 08da834 did make sense (at least experimentally).
> >>
> >> Unfortunately we now see that some setups out there still
> refuse to work
> >> when SDIO runtime PM is enabled by default (see
> >> http://www.spinics.net/lists/linux-mmc/msg11161.html), and
> obviously we
> >> can't live with these kind of regressions.
> >>
> >> This reverts commit 08da834a24312157f512224691ad1fddd11c1073.
> >>
> >> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
> >> Cc: Daniel Drake <dsd@laptop.org>
> >>
> >> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> >> index e8a5eb3..d31c78b 100644
> >> --- a/drivers/mmc/core/host.c
> >> +++ b/drivers/mmc/core/host.c
> >> @@ -302,17 +302,6 @@ struct mmc_host *mmc_alloc_host(int extra,
> struct
> >> device *dev)
> >> host->max_blk_size = 512;
> >> host->max_blk_count = PAGE_CACHE_SIZE / 512;
> >>
> >> - /*
> >> - * Enable runtime power management by default. This flag
> was added due
> >> - * to runtime power management causing disruption for
> some users, but
> >> - * the power on/off code has been improved since then.
> >> - *
> >> - * We'll enable this flag by default as an experiment,
> and if no
> >> - * problems are reported, we will follow up later and
> remove the flag
> >> - * altogether.
> >> - */
> >> - host->caps = MMC_CAP_POWER_OFF_CARD;
> >> -
> >> return host;
> >>
> >> free:
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-mmc"
> in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: mmc: sdio: runtime PM and 8686 problems
2012-04-26 23:51 ` Steve Sakoman
2012-04-27 8:26 ` Joe Woodward
@ 2012-04-28 9:51 ` NeilBrown
1 sibling, 0 replies; 26+ messages in thread
From: NeilBrown @ 2012-04-28 9:51 UTC (permalink / raw)
To: Steve Sakoman
Cc: Ohad Ben-Cohen, Chris Ball, Joe Woodward, linux-mmc, Bing Zhao,
Daniel Drake
[-- Attachment #1: Type: text/plain, Size: 4967 bytes --]
On Thu, 26 Apr 2012 16:51:10 -0700 Steve Sakoman <sakoman@gmail.com> wrote:
> On Mon, Dec 19, 2011 at 1:10 AM, Ohad Ben-Cohen <ohad@wizery.com> wrote:
>
> > We're slowly progressing towards understanding the issues we have with
> > the 8686 (it seems there are a few different hw revisions of it, some
> > of which do require toggling the reset pin before sending another init
> > sequence), but it might take some more time until a solution fully
> > materializes.
> >
> > Since 3.2 is just around the corner, I suggest we should now proceed
> > with the revert (see patch below), and later revisit this once we have
> > a complete solution in hand.
>
> Has any progress been made on this issue?
>
> I too have been trying to power down/up the wifi module on the Overo.
> I'm seeing the same issue described in this thread.
>
> Some additional data:
>
> I rebuilt my kernel (3.2) with a CD GPIO enabled for the mmc port the module
> is connected to and in turn connected that GPIO to another one that I
> can toggle from user space.
>
> Toggling the CD GPIO after powering back up the module does indeed
> work properly -- the module is detected, the driver loaded, and proper function
> restored.
>
> So basically the procedure I've used is:
>
> - decide wifi can be powered down
> - unload the libertas modules
> - put the wifi hw in reset with gpio16
> - wait till wifi is needed again
> - take the chip out of reset
> - toggle the CD gpio
> - libertas modules are autoloaded, as is the firmware
> - wifi is up and functioning
>
> So the next step is to get rid of the silly two GPIO external hardware
> hack. Is it possible to trigger a card insertion/removal event via
> some standard API?
>
> Or does the above information provide a clue as to why normal code
> paths don't work?
>
> Any other ideas?
I thought I had a nicely working solution, but I recently discovered that it
doesn't work as well as I thought it did. I now think we need some help from
the mmc layer to get it really working.
My understanding of the underlying problem is that the wifi chip can get
into a state where it really needs a hardware reset, but it isn't given one.
Applying the reset at the right time is needed.
When the mmc layer wants to power-up the device, it tells the configured
regulator to turn on, then sends some standard command sequence.
If the regulator was actually off, this works (I think - it is a while since
I experimented). However if the regulator wasn't actually off, it doesn't
work - the wifi chip gets confused by getting the init sequence when it is
already inited, and fails to continue.
So pulsing the resent line low after turning on the power is necessary and
sufficient.
In my case, the regulator is shared by the bluetooth and the wifi so if
bluetooth is on while the wifi is off the regulator never gets turned off,
and so bad things happen when we try to turn the wifi back on.
I had worked around this by defining a separate 'fixed' regulator to power
the wifi chip. It declared the real regulator as the 'supply' regulator so
that when the mmc driver turns on this pseudo regulator, the real one gets
turned on too. The 'fixed' regulator can drive a gpio and I configured it to
drive the wifi reset line. So when the regulator was turned off, the wifi
was held in reset. When the regulator was turned back on, the reset was
release, the power was on, and it all worked beautifully.
But there are two problems with this:
1/ the reset line is also shared with the bluetooth :-( so I cannot hold it
down. It is safe to pulse it down, but the 'fixed' regulator won't do
that (without a bit of hacking)
2/ When the voltage is set for the 'fixed' regulator, it is not propagated
back to the real regulator, so the real regulator's voltage doesn't get
set properly to make the requirements of the wifi chip.
I can work around the first problem by hacking the 'fixed' regulator, but I
wouldn't expect that hack to go upstream.
I can work around the second by observing the hsmmc enables 2 regulators if
they are defined: vmmc and vmmc_aux
So I configure the real regulator as vmmc, which gets the voltage setting,
and configure the pseudo regulator as vmmc_aux. This gets powered on after
vmmc, so the reset happens at the right time.
But I think all this is really just hacking around the problem.
I think we need for omap_hsmmc.c to be able to accept a 'reset_gpio' config,
and to toggle that after power-on.
It is unfortunate to have to include functionality for one particular device
in common code like this, but I really cannot see any other way.
BTW I explicitly set MMC_CAP_POWER_OFF so I don't need any card detect
enabled and there is no need to rmmod the device. A simple "ifconfig wlan0
down" will power off the wifi chip, and "ifconfig wlan0 up" will power it on
again.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH 2/2] mmc: core: Support packed command for eMMC4.5 device
@ 2011-11-11 7:26 Seungwon Jeon
2011-11-11 9:38 ` S, Venkatraman
0 siblings, 1 reply; 26+ messages in thread
From: Seungwon Jeon @ 2011-11-11 7:26 UTC (permalink / raw)
To: merez
Cc: 'S, Venkatraman', linux-mmc, 'Chris Ball',
linux-kernel, linux-samsung-soc, kgene.kim, dh.han
Maya Erez wrote:
> On Thu, Nov 10, 2011 Maya Erez wrote:
> > S, Venkatraman <svenkatr@ti.com> wrote:
> >> On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon <tgih.jun@samsung.com>
> wrote:
> >> >> > +static u8 mmc_blk_chk_packable(struct mmc_queue *mq, struct
> >> request *req)
>
> The function prepares the checkable list and not only checks if packing is
> possible, therefore I think its name should change to reflect its real
> action
I labored at naming. Isn't it proper? :)
Do you have any recommendation?
group_pack_req?
>
> >> >> > + if (!(md->flags & MMC_BLK_CMD23) &&
> >> >> > + !card->ext_csd.packed_event_en)
> >> >> > + goto no_packed;
>
> Having the condition with a && can lead to cases where CMD23 is not
> supported and we send packed commands. Therfore the condition should be
> changed to || or be splitted to 2 separate checks.
> Also, according to the standard the generic error flag in
> PACKED_COMMAND_STATUS is set in case of any error and having
> PACKED_EVENT_EN is only optional. Therefore, I don't think that setting
> the packed_event_en should be a mandatory condition for using packed
> coammnds.
... cases where CMD23 is not supported and we send packed commands?
Packed command must not be allowed in such a case.
It works only with predefined mode which is essential fator.
And spec doesn't mentioned PACKED_EVENT_EN must be set.
So Packed command can be sent regardless PACKED_EVENT_EN,
but it's not complete without reporting of error.
Then host driver may suffer error recovery.
Why packed command is used without error reporting?
>
> >> >> > + if (mmc_req_rel_wr(cur) &&
> >> >> > + (md->flags & MMC_BLK_REL_WR) &&
> >> >> > + !en_rel_wr) {
> >> >> > + goto no_packed;
> >> >> > + }
>
> Can you please explain this condition and its purpose?
>
In the case where reliable write is request but enhanced reliable write
is not supported, write access must be partial according to
reliable write sector count. Because even a single request can be split,
packed command is not allowed in this case.
> >> >> > + phys_segments += next->nr_phys_segments;
> >> >> > + if (phys_segments > max_phys_segs) {
> >> >> > + blk_requeue_request(q, next);
> >> >> > + break;
> >> >> > + }
> >> >> I mentioned this before - if the next request is not packable and
> >> requeued,
> >> >> blk_fetch_request will retrieve it again and this while loop will
> never terminate.
> >> >>
> >> > If next request is not packable, it is requeued and 'break'
> terminates
> >> this loop.
> >> > So it not infinite.
> >> Right !! But that doesn't help finding the commands that are packable.
> Ideally, you'd need to pack all neighbouring requests into one packed
> command.
> >> The way CFQ works, it is not necessary that the fetch would return all
> outstanding
> >> requests that are packable (unless you invoke a forced dispatch) It
> would be good to see some numbers on the number of pack hits /
> misses
> >> that
> >> you would encounter with this logic, on a typical usecase.
> > Is it considered only for CFQ scheduler? How about other I/O scheduler?
> If all requests are drained from scheduler queue forcedly,
> > the number of candidate to be packed can be increased.
> > However we may lose the unique CFQ's strength and MMC D/D may take the
> CFQ's duty.
> > Basically, this patch accommodates the origin order requests from I/O
> scheduler.
> >
>
> In order to better utilize the packed commands feature and achieve the
> best performance improvements I think that the command packing should be
> done in the block layer, according to the scheduler policy.
> That is, the scheduler should be aware of the capability of the device to
> receive a request list and its constrains (such as maximum number of
> requests, max number of sectors etc) and use this information as a factor
> to its algorithm.
> This way you keep the decision making in the hands of the scheduler while
> the MMC layer will only have to send this list as a packed command.
>
Yes, it would be another interesting approach.
Command packing you mentioned means gathering request among same direction(read/write)?
Currently I/O scheduler may know device constrains which MMC driver informs
with the exception of order information for packed command.
But I think the dependency of I/O scheduler may be able to come up.
How can MMC layer treat packed command with I/O scheduler which doesn't support this?
> >> >> > + if (rqc)
> >> >> > + reqs = mmc_blk_chk_packable(mq, rqc);
>
> It would be best to keep all the calls to blk_fetch_request in the same
> location. Therefore, I suggest to move the call to mmc_blk_chk_packable to
> mmc/card/queue.c after the first request is fetched.
At the first time, I considered that way.
I'll do more, if possible.
>
> >> >> > cmd_abort:
> >> >> > - spin_lock_irq(&md->lock);
> >> >> > - while (ret)
> >> >> > - ret = __blk_end_request(req, -EIO,
> >> blk_rq_cur_bytes(req));
> >> >> > - spin_unlock_irq(&md->lock);
> >> >> > + if (mq_rq->packed_cmd != MMC_PACKED_NONE) {
>
> This should be the case for MMC_PACKED_NONE.
Right, I missed it.
>
> >> >> > + spin_lock_irq(&md->lock);
> >> >> > + while (ret)
> >> >> > + ret = __blk_end_request(req, -EIO,
> >> blk_rq_cur_bytes(req));
>
> Do we need the while or should it be an if? In other cases where
> __blk_end_request is called there is no such while.
This part is not only the new but also origin code which is moved in this patch.
Maybe...,'If' case is used for a whole of remained bytes and
'while' case is used for partial report of remained bytes.
Thank you for review.
Best regards,
Seugwon Jeon.
>
> Thanks,
> Maya Erez
> Consultant for Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH 2/2] mmc: core: Support packed command for eMMC4.5 device
2011-11-11 7:26 [PATCH 2/2] mmc: core: Support packed command for eMMC4.5 device Seungwon Jeon
@ 2011-11-11 9:38 ` S, Venkatraman
2011-11-11 19:01 ` merez
0 siblings, 1 reply; 26+ messages in thread
From: S, Venkatraman @ 2011-11-11 9:38 UTC (permalink / raw)
To: Seungwon Jeon
Cc: merez, linux-mmc, Chris Ball, linux-kernel, linux-samsung-soc,
kgene.kim, dh.han
On Fri, Nov 11, 2011 at 12:56 PM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> Maya Erez wrote:
>> On Thu, Nov 10, 2011 Maya Erez wrote:
>> > S, Venkatraman <svenkatr@ti.com> wrote:
>> >> On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon <tgih.jun@samsung.com>
>> wrote:
>> >> >> > +static u8 mmc_blk_chk_packable(struct mmc_queue *mq, struct
>> >> request *req)
>>
>> The function prepares the checkable list and not only checks if packing is
>> possible, therefore I think its name should change to reflect its real
>> action
> I labored at naming. Isn't it proper? :)
> Do you have any recommendation?
> group_pack_req?
>
>>
>> >> >> > + if (!(md->flags & MMC_BLK_CMD23) &&
>> >> >> > + !card->ext_csd.packed_event_en)
>> >> >> > + goto no_packed;
>>
>> Having the condition with a && can lead to cases where CMD23 is not
>> supported and we send packed commands. Therfore the condition should be
>> changed to || or be splitted to 2 separate checks.
>> Also, according to the standard the generic error flag in
>> PACKED_COMMAND_STATUS is set in case of any error and having
>> PACKED_EVENT_EN is only optional. Therefore, I don't think that setting
>> the packed_event_en should be a mandatory condition for using packed
>> coammnds.
> ... cases where CMD23 is not supported and we send packed commands?
> Packed command must not be allowed in such a case.
> It works only with predefined mode which is essential fator.
> And spec doesn't mentioned PACKED_EVENT_EN must be set.
> So Packed command can be sent regardless PACKED_EVENT_EN,
> but it's not complete without reporting of error.
> Then host driver may suffer error recovery.
> Why packed command is used without error reporting?
>
>>
>> >> >> > + if (mmc_req_rel_wr(cur) &&
>> >> >> > + (md->flags & MMC_BLK_REL_WR) &&
>> >> >> > + !en_rel_wr) {
>> >> >> > + goto no_packed;
>> >> >> > + }
>>
>> Can you please explain this condition and its purpose?
>>
> In the case where reliable write is request but enhanced reliable write
> is not supported, write access must be partial according to
> reliable write sector count. Because even a single request can be split,
> packed command is not allowed in this case.
>
>> >> >> > + phys_segments += next->nr_phys_segments;
>> >> >> > + if (phys_segments > max_phys_segs) {
>> >> >> > + blk_requeue_request(q, next);
>> >> >> > + break;
>> >> >> > + }
>> >> >> I mentioned this before - if the next request is not packable and
>> >> requeued,
>> >> >> blk_fetch_request will retrieve it again and this while loop will
>> never terminate.
>> >> >>
>> >> > If next request is not packable, it is requeued and 'break'
>> terminates
>> >> this loop.
>> >> > So it not infinite.
>> >> Right !! But that doesn't help finding the commands that are packable.
>> Ideally, you'd need to pack all neighbouring requests into one packed
>> command.
>> >> The way CFQ works, it is not necessary that the fetch would return all
>> outstanding
>> >> requests that are packable (unless you invoke a forced dispatch) It
>> would be good to see some numbers on the number of pack hits /
>> misses
>> >> that
>> >> you would encounter with this logic, on a typical usecase.
>> > Is it considered only for CFQ scheduler? How about other I/O scheduler?
>> If all requests are drained from scheduler queue forcedly,
>> > the number of candidate to be packed can be increased.
>> > However we may lose the unique CFQ's strength and MMC D/D may take the
>> CFQ's duty.
>> > Basically, this patch accommodates the origin order requests from I/O
>> scheduler.
>> >
>>
>> In order to better utilize the packed commands feature and achieve the
>> best performance improvements I think that the command packing should be
>> done in the block layer, according to the scheduler policy.
>> That is, the scheduler should be aware of the capability of the device to
>> receive a request list and its constrains (such as maximum number of
>> requests, max number of sectors etc) and use this information as a factor
>> to its algorithm.
>> This way you keep the decision making in the hands of the scheduler while
>> the MMC layer will only have to send this list as a packed command.
>>
> Yes, it would be another interesting approach.
> Command packing you mentioned means gathering request among same direction(read/write)?
> Currently I/O scheduler may know device constrains which MMC driver informs
> with the exception of order information for packed command.
> But I think the dependency of I/O scheduler may be able to come up.
> How can MMC layer treat packed command with I/O scheduler which doesn't support this?
The very act of packing presumes some sorting and re-ordering at the
I/O scheduler level.
When no such sorting is done (ex. noop), MMC should resort to
non-packed execution, respecting the system configuration choice.
Looking deeper into this, I think a better approach would be to set
the prep_rq_fn of the request_queue, with a custom mmc function that
decides if the requests are packable or not, and return a
BLKPREP_DEFER for those that can't be packed.
>
>> >> >> > + if (rqc)
>> >> >> > + reqs = mmc_blk_chk_packable(mq, rqc);
>>
>> It would be best to keep all the calls to blk_fetch_request in the same
>> location. Therefore, I suggest to move the call to mmc_blk_chk_packable to
>> mmc/card/queue.c after the first request is fetched.
>
> At the first time, I considered that way.
> I'll do more, if possible.
>>
>> >> >> > cmd_abort:
>> >> >> > - spin_lock_irq(&md->lock);
>> >> >> > - while (ret)
>> >> >> > - ret = __blk_end_request(req, -EIO,
>> >> blk_rq_cur_bytes(req));
>> >> >> > - spin_unlock_irq(&md->lock);
>> >> >> > + if (mq_rq->packed_cmd != MMC_PACKED_NONE) {
>>
>> This should be the case for MMC_PACKED_NONE.
> Right, I missed it.
>>
>> >> >> > + spin_lock_irq(&md->lock);
>> >> >> > + while (ret)
>> >> >> > + ret = __blk_end_request(req, -EIO,
>> >> blk_rq_cur_bytes(req));
>>
>> Do we need the while or should it be an if? In other cases where
>> __blk_end_request is called there is no such while.
> This part is not only the new but also origin code which is moved in this patch.
> Maybe...,'If' case is used for a whole of remained bytes and
> 'while' case is used for partial report of remained bytes.
>
> Thank you for review.
>
> Best regards,
> Seugwon Jeon.
>>
>> Thanks,
>> Maya Erez
>> Consultant for Qualcomm Innovation Center, Inc.
>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
>>
>>
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH 2/2] mmc: core: Support packed command for eMMC4.5 device
2011-11-11 9:38 ` S, Venkatraman
@ 2011-11-11 19:01 ` merez
2011-11-14 9:46 ` Seungwon Jeon
0 siblings, 1 reply; 26+ messages in thread
From: merez @ 2011-11-11 19:01 UTC (permalink / raw)
To: S, Venkatraman
Cc: Seungwon Jeon, merez, linux-mmc, Chris Ball, linux-kernel,
linux-samsung-soc, kgene.kim, dh.han
> On Fri, Nov 11, 2011 at 12:56 PM, Seungwon Jeon <tgih.jun@samsung.com>
> wrote:
>> Maya Erez wrote:
>>> On Thu, Nov 10, 2011 Maya Erez wrote:
>>> > S, Venkatraman <svenkatr@ti.com> wrote:
>>> >> On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon <tgih.jun@samsung.com>
>>> wrote:
>>> >> >> > +static u8 mmc_blk_chk_packable(struct mmc_queue *mq, struct
>>> >> request *req)
>>>
>>> The function prepares the checkable list and not only checks if packing
>>> is
>>> possible, therefore I think its name should change to reflect its real
>>> action
>> I labored at naming. Isn't it proper? :)
>> Do you have any recommendation?
>> group_pack_req?
>>
>>>
>>> >> >> > + if (!(md->flags & MMC_BLK_CMD23) &&
>>> >> >> > + !card->ext_csd.packed_event_en)
>>> >> >> > + goto no_packed;
>>>
>>> Having the condition with a && can lead to cases where CMD23 is not
>>> supported and we send packed commands. Therfore the condition should be
>>> changed to || or be splitted to 2 separate checks.
>>> Also, according to the standard the generic error flag in
>>> PACKED_COMMAND_STATUS is set in case of any error and having
>>> PACKED_EVENT_EN is only optional. Therefore, I don't think that setting
>>> the packed_event_en should be a mandatory condition for using packed
>>> coammnds.
>> ... cases where CMD23 is not supported and we send packed commands?
>> Packed command must not be allowed in such a case.
>> It works only with predefined mode which is essential fator.
>> And spec doesn't mentioned PACKED_EVENT_EN must be set.
>> So Packed command can be sent regardless PACKED_EVENT_EN,
>> but it's not complete without reporting of error.
>> Then host driver may suffer error recovery.
>> Why packed command is used without error reporting?
Let me better explain my comment:
If the first condition (!(md->flags & MMC_BLK_CMD23) is 1 (meaning
MMC_BLK_CMD23 flag is not set), then in case card->ext_csd.packed_event_en
is 1 the second condition will be 0 and we won't "goto no_packed;". In
this case, CMD_23 is not supported but we don't exit the function.
If you want both conditions to be mandatory you need to use here an ||.
>>
>>>
>>> >> >> > + if (mmc_req_rel_wr(cur) &&
>>> >> >> > + (md->flags & MMC_BLK_REL_WR) &&
>>> >> >> > + !en_rel_wr) {
>>> >> >> > + goto no_packed;
>>> >> >> > + }
>>>
>>> Can you please explain this condition and its purpose?
>>>
>> In the case where reliable write is request but enhanced reliable write
>> is not supported, write access must be partial according to
>> reliable write sector count. Because even a single request can be split,
>> packed command is not allowed in this case.
>>
>>> >> >> > + phys_segments += next->nr_phys_segments;
>>> >> >> > + if (phys_segments > max_phys_segs) {
>>> >> >> > + blk_requeue_request(q, next);
>>> >> >> > + break;
>>> >> >> > + }
>>> >> >> I mentioned this before - if the next request is not packable and
>>> >> requeued,
>>> >> >> blk_fetch_request will retrieve it again and this while loop will
>>> never terminate.
>>> >> >>
>>> >> > If next request is not packable, it is requeued and 'break'
>>> terminates
>>> >> this loop.
>>> >> > So it not infinite.
>>> >> Right !! But that doesn't help finding the commands that are
>>> packable.
>>> Ideally, you'd need to pack all neighbouring requests into one packed
>>> command.
>>> >> The way CFQ works, it is not necessary that the fetch would return
>>> all
>>> outstanding
>>> >> requests that are packable (unless you invoke a forced dispatch) It
>>> would be good to see some numbers on the number of pack hits /
>>> misses
>>> >> that
>>> >> you would encounter with this logic, on a typical usecase.
>>> > Is it considered only for CFQ scheduler? How about other I/O
>>> scheduler?
>>> If all requests are drained from scheduler queue forcedly,
>>> > the number of candidate to be packed can be increased.
>>> > However we may lose the unique CFQ's strength and MMC D/D may take
>>> the
>>> CFQ's duty.
>>> > Basically, this patch accommodates the origin order requests from I/O
>>> scheduler.
>>> >
>>>
>>> In order to better utilize the packed commands feature and achieve the
>>> best performance improvements I think that the command packing should
>>> be
>>> done in the block layer, according to the scheduler policy.
>>> That is, the scheduler should be aware of the capability of the device
>>> to
>>> receive a request list and its constrains (such as maximum number of
>>> requests, max number of sectors etc) and use this information as a
>>> factor
>>> to its algorithm.
>>> This way you keep the decision making in the hands of the scheduler
>>> while
>>> the MMC layer will only have to send this list as a packed command.
>>>
>> Yes, it would be another interesting approach.
>> Command packing you mentioned means gathering request among same
>> direction(read/write)?
>> Currently I/O scheduler may know device constrains which MMC driver
>> informs
>> with the exception of order information for packed command.
>> But I think the dependency of I/O scheduler may be able to come up.
>> How can MMC layer treat packed command with I/O scheduler which doesn't
>> support this?
>
> The very act of packing presumes some sorting and re-ordering at the
> I/O scheduler level.
> When no such sorting is done (ex. noop), MMC should resort to
> non-packed execution, respecting the system configuration choice.
>
> Looking deeper into this, I think a better approach would be to set
> the prep_rq_fn of the request_queue, with a custom mmc function that
> decides if the requests are packable or not, and return a
> BLKPREP_DEFER for those that can't be packed.
>
>>
>>> >> >> > + if (rqc)
>>> >> >> > + reqs = mmc_blk_chk_packable(mq, rqc);
>>>
>>> It would be best to keep all the calls to blk_fetch_request in the same
>>> location. Therefore, I suggest to move the call to mmc_blk_chk_packable
>>> to
>>> mmc/card/queue.c after the first request is fetched.
>>
>> At the first time, I considered that way.
>> I'll do more, if possible.
>>>
>>> >> >> > cmd_abort:
>>> >> >> > - spin_lock_irq(&md->lock);
>>> >> >> > - while (ret)
>>> >> >> > - ret = __blk_end_request(req, -EIO,
>>> >> blk_rq_cur_bytes(req));
>>> >> >> > - spin_unlock_irq(&md->lock);
>>> >> >> > + if (mq_rq->packed_cmd != MMC_PACKED_NONE) {
>>>
>>> This should be the case for MMC_PACKED_NONE.
>> Right, I missed it.
>>>
>>> >> >> > + spin_lock_irq(&md->lock);
>>> >> >> > + while (ret)
>>> >> >> > + ret = __blk_end_request(req, -EIO,
>>> >> blk_rq_cur_bytes(req));
>>>
>>> Do we need the while or should it be an if? In other cases where
>>> __blk_end_request is called there is no such while.
>> This part is not only the new but also origin code which is moved in
>> this patch.
>> Maybe...,'If' case is used for a whole of remained bytes and
>> 'while' case is used for partial report of remained bytes.
>>
>> Thank you for review.
>>
>> Best regards,
>> Seugwon Jeon.
>>>
>>> Thanks,
>>> Maya Erez
>>> Consultant for Qualcomm Innovation Center, Inc.
>>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
>
Thanks,
Maya Erez
Consultant for Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
^ permalink raw reply [flat|nested] 26+ messages in thread* RE: [PATCH 2/2] mmc: core: Support packed command for eMMC4.5 device
2011-11-11 19:01 ` merez
@ 2011-11-14 9:46 ` Seungwon Jeon
2011-11-15 12:48 ` merez
0 siblings, 1 reply; 26+ messages in thread
From: Seungwon Jeon @ 2011-11-14 9:46 UTC (permalink / raw)
To: merez, 'S, Venkatraman'
Cc: linux-mmc, 'Chris Ball', linux-kernel, linux-samsung-soc,
kgene.kim, dh.han
Maya Erez wrote:
> > On Fri, Nov 11, 2011 at 12:56 PM, Seungwon Jeon <tgih.jun@samsung.com>
> > wrote:
> >> Maya Erez wrote:
> >>> On Thu, Nov 10, 2011 Maya Erez wrote:
> >>> > S, Venkatraman <svenkatr@ti.com> wrote:
> >>> >> On Thu, Nov 3, 2011 at 7:23 AM, Seungwon Jeon <tgih.jun@samsung.com>
> >>> wrote:
> >>> >> >> > +static u8 mmc_blk_chk_packable(struct mmc_queue *mq, struct
> >>> >> request *req)
> >>>
> >>> The function prepares the checkable list and not only checks if packing
> >>> is
> >>> possible, therefore I think its name should change to reflect its real
> >>> action
> >> I labored at naming. Isn't it proper? :)
> >> Do you have any recommendation?
> >> group_pack_req?
> >>
> >>>
> >>> >> >> > + if (!(md->flags & MMC_BLK_CMD23) &&
> >>> >> >> > + !card->ext_csd.packed_event_en)
> >>> >> >> > + goto no_packed;
> >>>
> >>> Having the condition with a && can lead to cases where CMD23 is not
> >>> supported and we send packed commands. Therfore the condition should be
> >>> changed to || or be splitted to 2 separate checks.
> >>> Also, according to the standard the generic error flag in
> >>> PACKED_COMMAND_STATUS is set in case of any error and having
> >>> PACKED_EVENT_EN is only optional. Therefore, I don't think that setting
> >>> the packed_event_en should be a mandatory condition for using packed
> >>> coammnds.
> >> ... cases where CMD23 is not supported and we send packed commands?
> >> Packed command must not be allowed in such a case.
> >> It works only with predefined mode which is essential fator.
> >> And spec doesn't mentioned PACKED_EVENT_EN must be set.
> >> So Packed command can be sent regardless PACKED_EVENT_EN,
> >> but it's not complete without reporting of error.
> >> Then host driver may suffer error recovery.
> >> Why packed command is used without error reporting?
> Let me better explain my comment:
> If the first condition (!(md->flags & MMC_BLK_CMD23) is 1 (meaning
> MMC_BLK_CMD23 flag is not set), then in case card->ext_csd.packed_event_en
> is 1 the second condition will be 0 and we won't "goto no_packed;". In
> this case, CMD_23 is not supported but we don't exit the function.
> If you want both conditions to be mandatory you need to use here an ||.
Thank you for clearing comment.
This condition will be fixed.
> >>
> >>>
> >>> >> >> > + if (mmc_req_rel_wr(cur) &&
> >>> >> >> > + (md->flags & MMC_BLK_REL_WR) &&
> >>> >> >> > + !en_rel_wr) {
> >>> >> >> > + goto no_packed;
> >>> >> >> > + }
> >>>
> >>> Can you please explain this condition and its purpose?
> >>>
> >> In the case where reliable write is request but enhanced reliable write
> >> is not supported, write access must be partial according to
> >> reliable write sector count. Because even a single request can be split,
> >> packed command is not allowed in this case.
> >>
> >>> >> >> > + phys_segments += next->nr_phys_segments;
> >>> >> >> > + if (phys_segments > max_phys_segs) {
> >>> >> >> > + blk_requeue_request(q, next);
> >>> >> >> > + break;
> >>> >> >> > + }
> >>> >> >> I mentioned this before - if the next request is not packable and
> >>> >> requeued,
> >>> >> >> blk_fetch_request will retrieve it again and this while loop will
> >>> never terminate.
> >>> >> >>
> >>> >> > If next request is not packable, it is requeued and 'break'
> >>> terminates
> >>> >> this loop.
> >>> >> > So it not infinite.
> >>> >> Right !! But that doesn't help finding the commands that are
> >>> packable.
> >>> Ideally, you'd need to pack all neighbouring requests into one packed
> >>> command.
> >>> >> The way CFQ works, it is not necessary that the fetch would return
> >>> all
> >>> outstanding
> >>> >> requests that are packable (unless you invoke a forced dispatch) It
> >>> would be good to see some numbers on the number of pack hits /
> >>> misses
> >>> >> that
> >>> >> you would encounter with this logic, on a typical usecase.
> >>> > Is it considered only for CFQ scheduler? How about other I/O
> >>> scheduler?
> >>> If all requests are drained from scheduler queue forcedly,
> >>> > the number of candidate to be packed can be increased.
> >>> > However we may lose the unique CFQ's strength and MMC D/D may take
> >>> the
> >>> CFQ's duty.
> >>> > Basically, this patch accommodates the origin order requests from I/O
> >>> scheduler.
> >>> >
> >>>
> >>> In order to better utilize the packed commands feature and achieve the
> >>> best performance improvements I think that the command packing should
> >>> be
> >>> done in the block layer, according to the scheduler policy.
> >>> That is, the scheduler should be aware of the capability of the device
> >>> to
> >>> receive a request list and its constrains (such as maximum number of
> >>> requests, max number of sectors etc) and use this information as a
> >>> factor
> >>> to its algorithm.
> >>> This way you keep the decision making in the hands of the scheduler
> >>> while
> >>> the MMC layer will only have to send this list as a packed command.
> >>>
> >> Yes, it would be another interesting approach.
> >> Command packing you mentioned means gathering request among same
> >> direction(read/write)?
> >> Currently I/O scheduler may know device constrains which MMC driver
> >> informs
> >> with the exception of order information for packed command.
> >> But I think the dependency of I/O scheduler may be able to come up.
> >> How can MMC layer treat packed command with I/O scheduler which doesn't
> >> support this?
> >
> > The very act of packing presumes some sorting and re-ordering at the
> > I/O scheduler level.
> > When no such sorting is done (ex. noop), MMC should resort to
> > non-packed execution, respecting the system configuration choice.
> >
> > Looking deeper into this, I think a better approach would be to set
> > the prep_rq_fn of the request_queue, with a custom mmc function that
> > decides if the requests are packable or not, and return a
> > BLKPREP_DEFER for those that can't be packed.
> >
> >>
> >>> >> >> > + if (rqc)
> >>> >> >> > + reqs = mmc_blk_chk_packable(mq, rqc);
> >>>
> >>> It would be best to keep all the calls to blk_fetch_request in the same
> >>> location. Therefore, I suggest to move the call to mmc_blk_chk_packable
> >>> to
> >>> mmc/card/queue.c after the first request is fetched.
> >>
> >> At the first time, I considered that way.
> >> I'll do more, if possible.
I considered more.
I think that mmc_blk_chk_packable would rather be called only for r/w type
than all request type(e.g. discard, flush).
> >>>
> >>> >> >> > cmd_abort:
> >>> >> >> > - spin_lock_irq(&md->lock);
> >>> >> >> > - while (ret)
> >>> >> >> > - ret = __blk_end_request(req, -EIO,
> >>> >> blk_rq_cur_bytes(req));
> >>> >> >> > - spin_unlock_irq(&md->lock);
> >>> >> >> > + if (mq_rq->packed_cmd != MMC_PACKED_NONE) {
> >>>
> >>> This should be the case for MMC_PACKED_NONE.
> >> Right, I missed it.
> >>>
> >>> >> >> > + spin_lock_irq(&md->lock);
> >>> >> >> > + while (ret)
> >>> >> >> > + ret = __blk_end_request(req, -EIO,
> >>> >> blk_rq_cur_bytes(req));
> >>>
> >>> Do we need the while or should it be an if? In other cases where
> >>> __blk_end_request is called there is no such while.
> >> This part is not only the new but also origin code which is moved in
> >> this patch.
> >> Maybe...,'If' case is used for a whole of remained bytes and
> >> 'while' case is used for partial report of remained bytes.
> >>
> >> Thank you for review.
> >>
> >> Best regards,
> >> Seugwon Jeon.
> >>>
> >>> Thanks,
> >>> Maya Erez
> >>> Consultant for Qualcomm Innovation Center, Inc.
> >>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> >>> the body of a message to majordomo@vger.kernel.org
> >>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> >>
> >>
> >
> Thanks,
> Maya Erez
> Consultant for Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread* RE: [PATCH 2/2] mmc: core: Support packed command for eMMC4.5 device
2011-11-14 9:46 ` Seungwon Jeon
@ 2011-11-15 12:48 ` merez
2011-11-17 2:02 ` Seungwon Jeon
0 siblings, 1 reply; 26+ messages in thread
From: merez @ 2011-11-15 12:48 UTC (permalink / raw)
To: Seungwon Jeon
Cc: merez, 'S, Venkatraman', linux-mmc, 'Chris Ball',
linux-kernel, linux-samsung-soc, kgene.kim, dh.han
>> >>> >> >> > + if (rqc)
>> >>> >> >> > + reqs = mmc_blk_chk_packable(mq, rqc);
>> >>>
>> >>> It would be best to keep all the calls to blk_fetch_request in the
>> same
>> >>> location. Therefore, I suggest to move the call to
>> mmc_blk_chk_packable
>> >>> to
>> >>> mmc/card/queue.c after the first request is fetched.
>> >>
>> >> At the first time, I considered that way.
>> >> I'll do more, if possible.
> I considered more.
> I think that mmc_blk_chk_packable would rather be called only for r/w type
> than all request type(e.g. discard, flush).
>
mmc_blk_chk_packable can check the cmd_flags of the request to verify it's
not a flush/disacrad etc. In such cases will not pack.
^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH 2/2] mmc: core: Support packed command for eMMC4.5 device
2011-11-15 12:48 ` merez
@ 2011-11-17 2:02 ` Seungwon Jeon
2011-11-17 9:16 ` mmc: sdio: runtime PM and 8686 problems Joe Woodward
0 siblings, 1 reply; 26+ messages in thread
From: Seungwon Jeon @ 2011-11-17 2:02 UTC (permalink / raw)
To: merez
Cc: 'S, Venkatraman', linux-mmc, 'Chris Ball',
linux-kernel, linux-samsung-soc, kgene.kim, dh.han
Maya Erez wrote:
> >> >>> >> >> > + if (rqc)
> >> >>> >> >> > + reqs = mmc_blk_chk_packable(mq, rqc);
> >> >>>
> >> >>> It would be best to keep all the calls to blk_fetch_request in the
> >> same
> >> >>> location. Therefore, I suggest to move the call to
> >> mmc_blk_chk_packable
> >> >>> to
> >> >>> mmc/card/queue.c after the first request is fetched.
> >> >>
> >> >> At the first time, I considered that way.
> >> >> I'll do more, if possible.
> > I considered more.
> > I think that mmc_blk_chk_packable would rather be called only for r/w type
> > than all request type(e.g. discard, flush).
> >
> mmc_blk_chk_packable can check the cmd_flags of the request to verify it's
> not a flush/disacrad etc. In such cases will not pack.
Yes. It must be checked, but omitted.
I already have added this check. It will be applied next.
Thanks,
Seungwon Jeon.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 26+ messages in thread
* mmc: sdio: runtime PM and 8686 problems
2011-11-17 2:02 ` Seungwon Jeon
@ 2011-11-17 9:16 ` Joe Woodward
0 siblings, 0 replies; 26+ messages in thread
From: Joe Woodward @ 2011-11-17 9:16 UTC (permalink / raw)
To: linux-mmc
I have a GUMSTIX Overo (OMAP35xx) with a Marvel 8686 WiFi attached via SDIO (ok, I think it's actually a Wi2Wi W2CBW003 module containing an 8686).
Up to the 3.1 mainline kernel WiFi worked just fine! I could boot the kernel and load the libertas module successfully:
(during boot)
[ 3.193176] mmc1: new SDIO card at address 0001
(when loading module)
# modprobe libertas_sdio
[ 30.817749] lib80211: common routines for IEEE802.11 drivers
[ 31.143951] cfg80211: Calling CRDA to update world regulatory domain
[ 31.375823] libertas_sdio: Libertas SDIO driver
[ 31.380737] libertas_sdio: Copyright Pierre Ossman
[ 32.035186] libertas_sdio mmc1:0001:1: (unregistered net_device): 00:19:88:3e:4f:f9, fw 9.70.3p36, cap 0x00000303
[ 32.129943] libertas_sdio mmc1:0001:1: wlan0: Marvell WLAN 802.11 adapter
However it seems that runtime PM has now been turned on by default (by setting MMC_CAP_POWER_OFF_CARD in drivers/mmc/core/host.c), and the WiFi
has stopped working!
So, if I run the 3.2-rc2 (or rc1 for that matter) I get the following:
(during boot)
[ 3.486541] mmc1: new SDIO card at address 0001
(when loading module)
# modprobe libertas_sdio
[ 34.015350] lib80211: common routines for IEEE802.11 drivers
[ 34.345092] cfg80211: Calling CRDA to update world regulatory domain
[ 34.574096] libertas_sdio: Libertas SDIO driver
[ 34.578979] libertas_sdio: Copyright Pierre Ossman
[ 34.637481] libertas_sdio: probe of mmc1:0001:1 failed with error -16
Looking at arch/arm/mach-omap2/overo.c you can see that GPIO16 (OVERO_GPIO_W2W_NRESET) is the nRESET line for the 8686. This is held low for
10usecs during boot (see overo.c line 530 to 533).
I'm not 100% sure how power is connected to the SD8686 as GUMSTIX don't release schematics for their modules.
If I disable runtime PM (by commenting out the setting of MMC_CAP_POWER_OFF_CARD) everything works as before.
I can see plenty of threads relating to getting the SD8686 working for OLPC, and that some workarounds have made it in to the mainline kernel. From what
I understand the problem is that runtime PM removes power from the 8686 after boot and before the loading of the libertas module.
Are these workarounds expected to be enough for runtime PM to just "work"?
Is there anything special I should be doing with the nRESET line other than that which is done by default in the board file (holding nRESET low for 10usecs)?
Cheers,
Joe
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2012-04-28 9:51 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-01 11:29 mmc: sdio: runtime PM and 8686 problems Joe Woodward
-- strict thread matches above, loose matches on Subject: below --
2011-12-01 11:29 Joe Woodward
2011-11-18 8:53 Joe Woodward
2011-11-18 9:06 ` Ohad Ben-Cohen
2011-11-18 10:00 ` Joe Woodward
2011-11-18 12:15 ` Ohad Ben-Cohen
2011-11-29 11:17 ` Joe Woodward
2011-11-29 12:43 ` Ohad Ben-Cohen
2011-11-29 21:42 ` Daniel Drake
2011-11-30 10:36 ` Ohad Ben-Cohen
2011-11-30 14:12 ` Daniel Drake
2011-11-30 14:29 ` Ohad Ben-Cohen
2011-11-30 14:57 ` Daniel Drake
2011-12-01 7:50 ` Ohad Ben-Cohen
2011-11-30 15:00 ` Joe Woodward
2011-12-01 8:07 ` Ohad Ben-Cohen
2011-12-01 11:28 ` Joe Woodward
2011-12-03 16:44 ` Daniel Drake
2011-12-03 16:45 ` Daniel Drake
2011-12-07 12:28 ` Joe Woodward
2011-12-19 9:10 ` Ohad Ben-Cohen
2011-12-19 9:22 ` Ohad Ben-Cohen
2012-04-26 23:51 ` Steve Sakoman
2012-04-27 8:26 ` Joe Woodward
2012-04-28 9:51 ` NeilBrown
2011-11-11 7:26 [PATCH 2/2] mmc: core: Support packed command for eMMC4.5 device Seungwon Jeon
2011-11-11 9:38 ` S, Venkatraman
2011-11-11 19:01 ` merez
2011-11-14 9:46 ` Seungwon Jeon
2011-11-15 12:48 ` merez
2011-11-17 2:02 ` Seungwon Jeon
2011-11-17 9:16 ` mmc: sdio: runtime PM and 8686 problems Joe Woodward
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox