* MMC card removal during suspend
@ 2015-09-30 6:46 Mirza Krak
2015-09-30 10:24 ` Ulf Hansson
0 siblings, 1 reply; 5+ messages in thread
From: Mirza Krak @ 2015-09-30 6:46 UTC (permalink / raw)
To: linux-mmc
Hi.
I have a questing regard of what happens during suspend with the MMC
card, or even more correctly what does not happen.
I am running the 4.1.5 kernel on a Colibri VF SOM.
What I would like to happen when i suspend my system to memory is that
the MMC card is removed before suspend. The reason is that we will cut
the power rail to the MMC card during suspend on our board, which
means that it will fail on resume if we do not remove the card before
suspending.
From what I read on the "internet", above behavior used to be default.
It no longer is it seems.
My question is, is there a "correct" way of getting the behavior I would like?
My hack today is to declare a pre_suspend callback in mmc.c returning -ENOSYS.
--
Med Vänliga Hälsningar / Best Regards
*******************************************************************
Mirza Krak
Host Mobility AB
mirza.krak@hostmobility.com
Anders Personsgatan 12, 416 64 Göteborg
Sweden
http://www.hostmobility.com
Direct: +46 31 31 32 704
Phone: +46 31 31 32 700
Fax: +46 31 80 67 51
Mobile: +46 730 28 06 22
*******************************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MMC card removal during suspend
2015-09-30 6:46 MMC card removal during suspend Mirza Krak
@ 2015-09-30 10:24 ` Ulf Hansson
2015-09-30 16:10 ` Mirza Krak
0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2015-09-30 10:24 UTC (permalink / raw)
To: Mirza Krak; +Cc: linux-mmc
On 30 September 2015 at 08:46, Mirza Krak <mirza.krak@hostmobility.com> wrote:
> Hi.
>
> I have a questing regard of what happens during suspend with the MMC
> card, or even more correctly what does not happen.
>
> I am running the 4.1.5 kernel on a Colibri VF SOM.
>
> What I would like to happen when i suspend my system to memory is that
> the MMC card is removed before suspend. The reason is that we will cut
> the power rail to the MMC card during suspend on our board, which
> means that it will fail on resume if we do not remove the card before
> suspending.
At suspend, the mmc core tries to power off the card. Whether that's
actually done is up to each and every host driver to deal with via the
host_ops->set_ios() callback.
At resume, the mmc core expect the card to be powered off and starts
new round of power up and initialization cycle of the card.
This is the short story, obviously for eMMC which has specific
commands to deal with power management more things get involved.
>
> From what I read on the "internet", above behavior used to be default.
> It no longer is it seems.
Unfortunate the kernel doc for MMC is very poor. It certainly would
need some update.
In this case you better read the code, since what you read on the
internet seems to tell you something different.
>
> My question is, is there a "correct" way of getting the behavior I would like?
>
> My hack today is to declare a pre_suspend callback in mmc.c returning -ENOSYS.
>
> --
> Med Vänliga Hälsningar / Best Regards
>
> *******************************************************************
> Mirza Krak
> Host Mobility AB
> mirza.krak@hostmobility.com
> Anders Personsgatan 12, 416 64 Göteborg
> Sweden
> http://www.hostmobility.com
> Direct: +46 31 31 32 704
> Phone: +46 31 31 32 700
> Fax: +46 31 80 67 51
> Mobile: +46 730 28 06 22
> *******************************************************************
> --
> 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
Kind regards
Uffe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MMC card removal during suspend
2015-09-30 10:24 ` Ulf Hansson
@ 2015-09-30 16:10 ` Mirza Krak
2015-10-01 9:39 ` Ulf Hansson
2015-10-01 9:43 ` Jaehoon Chung
0 siblings, 2 replies; 5+ messages in thread
From: Mirza Krak @ 2015-09-30 16:10 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc
Hi again.
Thank you for your response Ulf.
I am going to start over though since I did not get everything right
the first time.
As stated I am running the 4.1.5 Linux kernel and what I am actually
using is a SD card. The host driver is sdhci-esdhc-imx.c.
And my initial issue was that on resume I get the following:
[ 31.848397] mmc0: card never left busy state
[ 31.848412] mmc0: error -110 during resume (card was removed?)
[ 31.848550] PM: resume of devices complete after 2062.936 msecs
[ 31.931086] PM: Finishing wakeup.
[ 31.931102] Restarting tasks ... done.
[ 31.954336] mmc0: card dade removed
[ 32.358711] mmc0: host does not support reading read-only switch,
assuming write-enable
[ 32.391857] mmc0: new SD card at address aaaa
[ 32.418228] mmcblk0: mmc0:aaaa SU02G 1.84 GiB
[ 32.446402] mmcblk0: p1
[ 32.835907] EXT4-fs (mmcblk0p1): recovery complete
[ 32.840873] EXT4-fs (mmcblk0p1): mounted filesystem with ordered
data mode. Opts: (null)
And that was the reason of my initial questions on what is supposed to
happen when suspending.
The card IS actually "removed" when in suspended state since we cut
the power-rail completely to the SD card.
I assume that this is a sdhci-esdhc-imx issue, but then I wonder what
would be a proper fix for this.
As stated before I get around this problem by adding a HACK to force
removal of the SD card before suspending in mmc_pm_notify.
Sorry if I am spamming but I am trying to learn :).
Best Regards
Mirza Krak
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MMC card removal during suspend
2015-09-30 16:10 ` Mirza Krak
@ 2015-10-01 9:39 ` Ulf Hansson
2015-10-01 9:43 ` Jaehoon Chung
1 sibling, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2015-10-01 9:39 UTC (permalink / raw)
To: Mirza Krak; +Cc: linux-mmc
On 30 September 2015 at 18:10, Mirza Krak <mirza.krak@hostmobility.com> wrote:
> Hi again.
>
> Thank you for your response Ulf.
>
> I am going to start over though since I did not get everything right
> the first time.
>
> As stated I am running the 4.1.5 Linux kernel and what I am actually
> using is a SD card. The host driver is sdhci-esdhc-imx.c.
>
> And my initial issue was that on resume I get the following:
> [ 31.848397] mmc0: card never left busy state
> [ 31.848412] mmc0: error -110 during resume (card was removed?)
Normally this should indicate that the card actually has been
physically removed from the slot. As of course you wouldn't be able to
re-initiate a non-existing card. :-)
In your case it indicates that something else is wrong.
> [ 31.848550] PM: resume of devices complete after 2062.936 msecs
> [ 31.931086] PM: Finishing wakeup.
> [ 31.931102] Restarting tasks ... done.
> [ 31.954336] mmc0: card dade removed
> [ 32.358711] mmc0: host does not support reading read-only switch,
> assuming write-enable
> [ 32.391857] mmc0: new SD card at address aaaa
> [ 32.418228] mmcblk0: mmc0:aaaa SU02G 1.84 GiB
> [ 32.446402] mmcblk0: p1
> [ 32.835907] EXT4-fs (mmcblk0p1): recovery complete
> [ 32.840873] EXT4-fs (mmcblk0p1): mounted filesystem with ordered
> data mode. Opts: (null)
>
> And that was the reason of my initial questions on what is supposed to
> happen when suspending.
>
> The card IS actually "removed" when in suspended state since we cut
> the power-rail completely to the SD card.
Actually its struct device is not being "removed", until a new
mmc_detect work is scheduled, which is when a resume has been
completed. mmc_pm_notify() (PM_POST_SUSPEND).
That detect work will find that the card isn't responding to commands,
power cycle it and re-try an new initialization of it. Apparently that
makes the card work again.
>
> I assume that this is a sdhci-esdhc-imx issue, but then I wonder what
> would be a proper fix for this.
sdhci and/or sdhci-esdhc-imx issue.
>
> As stated before I get around this problem by adding a HACK to force
> removal of the SD card before suspending in mmc_pm_notify.
>
> Sorry if I am spamming but I am trying to learn :).
>
So, to give you some advise on where to start.
1.
I would make sure that "suspending" the card by itself, without
actually suspending the entire system works okay. You can for example
do that by enabling MMC_CAP_AGGRESSIVE_PM, since that should then
suspend the card at request inactivity point. Add some debug prints to
make sure _mmc_sd_suspend()/_mmc_sd_resume() actually gets called.
2.
If 1) work, it's probably an issue in sdhci/sdhci-esdhc-imx
suspend/resume callbacks. Perhaps you might want to invoke these
callbacks manually as those should also work separately.
Good luck!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MMC card removal during suspend
2015-09-30 16:10 ` Mirza Krak
2015-10-01 9:39 ` Ulf Hansson
@ 2015-10-01 9:43 ` Jaehoon Chung
1 sibling, 0 replies; 5+ messages in thread
From: Jaehoon Chung @ 2015-10-01 9:43 UTC (permalink / raw)
To: Mirza Krak, Ulf Hansson; +Cc: linux-mmc
On 10/01/2015 01:10 AM, Mirza Krak wrote:
> Hi again.
>
> Thank you for your response Ulf.
>
> I am going to start over though since I did not get everything right
> the first time.
>
> As stated I am running the 4.1.5 Linux kernel and what I am actually
> using is a SD card. The host driver is sdhci-esdhc-imx.c.
>
> And my initial issue was that on resume I get the following:
> [ 31.848397] mmc0: card never left busy state
> [ 31.848412] mmc0: error -110 during resume (card was removed?)
> [ 31.848550] PM: resume of devices complete after 2062.936 msecs
> [ 31.931086] PM: Finishing wakeup.
> [ 31.931102] Restarting tasks ... done.
> [ 31.954336] mmc0: card dade removed
> [ 32.358711] mmc0: host does not support reading read-only switch,
> assuming write-enable
> [ 32.391857] mmc0: new SD card at address aaaa
> [ 32.418228] mmcblk0: mmc0:aaaa SU02G 1.84 GiB
> [ 32.446402] mmcblk0: p1
> [ 32.835907] EXT4-fs (mmcblk0p1): recovery complete
> [ 32.840873] EXT4-fs (mmcblk0p1): mounted filesystem with ordered
> data mode. Opts: (null)
>
> And that was the reason of my initial questions on what is supposed to
> happen when suspending.
Almost MMC cards supposed that should be removed. So we are using "non-removable" property in dt-file.
By default, assume that card can be removed.
Since sd-card can be changed during suspend.
(we don't know whether card is changed or not if it doesn't register to wakeup source,)
>
> The card IS actually "removed" when in suspended state since we cut
> the power-rail completely to the SD card.
>
> I assume that this is a sdhci-esdhc-imx issue, but then I wonder what
> would be a proper fix for this.
Sorry, i don't fully understand what problem you want to fix. :)
Best Regards,
Jaehoon Chung
>
> As stated before I get around this problem by adding a HACK to force
> removal of the SD card before suspending in mmc_pm_notify.
>
> Sorry if I am spamming but I am trying to learn :).
>
> Best Regards
>
> Mirza Krak
> --
> 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] 5+ messages in thread
end of thread, other threads:[~2015-10-01 9:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-30 6:46 MMC card removal during suspend Mirza Krak
2015-09-30 10:24 ` Ulf Hansson
2015-09-30 16:10 ` Mirza Krak
2015-10-01 9:39 ` Ulf Hansson
2015-10-01 9:43 ` Jaehoon Chung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).