sdio: skip initialization on powered resume
PATCH v2 1/1 sdio: skip initialization on powered resume
Quoted Michal Miroslaw's comment:
Simplified SDIO spec v.2.00 (section 6.14 - Bus State Diagram) suggests, that initialization commands (CMD5, CMD3) are not accepted in CMD state. As the card stays in that state on powered suspend (no resetting CMD52 nor power cycle is issued) then reinitialization should be entirely skipped on resume unless the power was lost between suspend and resume (or card was temporarily removed from the slot).
---
Changes since v1:
* Subject changed (was "add MMC_PM_SKIP_RESUME_PROBE to...")
* No need to introduce new flag MMC_PM_SKIP_RESUME_PROBE
* Add Michal Miroslaw's comment as patch description
drivers/mmc/core/sdio.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/mmc/core/sdio.c +11 -3
@@ -605,15 +605,23 @@ static int mmc_sdio_suspend(struct mmc_host *host)static int mmc_sdio_resume (struct mmc_host *host) { -int i, err; +int i, err =0 ;BUG_ON (!host);BUG_ON (!host->card);/* Basic card reinitialization. */ mmc_claim_host (host); - err =mmc_sdio_init_card (host, host->ocr, host->card, - (host->pm_flags &MMC_PM_KEEP_POWER )); + +/* +* Simplified SDIO spec v2.00 (section 6.14 - Bus State Diagram) +* suggests that initialization should be skipped on powered resume. +*/ +if (!(host->pm_flags &MMC_PM_KEEP_POWER )) { + err =mmc_sdio_init_card (host, host->ocr, host->card, + host->pm_flags &MMC_PM_KEEP_POWER ); + } +if (!err) {/* We may have switched to 1-bit mode during suspend. */ err =sdio_enable_4bit_bus (host->card);
Signature · 1 line
1.5.3.6
Quoted 10 lines · Bing Zhao
Quoted Michal Miroslaw's comment:
Simplified SDIO spec v.2.00 (section 6.14 - Bus State Diagram) suggests, that initialization commands (CMD5, CMD3) are not accepted in CMD state. As the card stays in that state on powered suspend (no resetting CMD52 nor power cycle is issued) then reinitialization should be entirely skipped on resume unless the power was lost between suspend and resume (or card was temporarily removed from the slot).
Signed-off-by Bing Zhao <[email protected]>
Comments below.
drivers/mmc/core/sdio.c static int mmc_sdio_suspend(struct mmc_host *host) · line 623
Quoted 8 lines
drivers/mmc/core/sdio.c +8
-0+/* +* Simplified SDIO spec v2.00 (section 6.14 - Bus State Diagram) +* suggests that initialization should be skipped on powered resume. +*/ +if (!(host->pm_flags &MMC_PM_KEEP_POWER )) { + err =mmc_sdio_init_card (host, host->ocr, host->card, + host->pm_flags &MMC_PM_KEEP_POWER ); + }
Please look at the if() condition, and at the last argument to mmc_sdio_init_card(), then ponder.
I think the proper fix goes _inside_ mmc_sdio_init_card() as there are certainly still validation checks which are appropriate to perform.
Nicolas
Hi Nicolas,
Thanks for your comments.
Quoted 22 lines
-----Original Message-----
From: Nicolas Pitre [mailto:[email protected]]
Sent: Thursday, September 02, 2010 10:54 AM
To: Bing Zhao
Cc: [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton
Subject: Re: [PATCH v2] sdio: skip initialization on powered resumeQuoted 10 lines · Bing Zhao
Quoted Michal Miroslaw's comment:
Simplified SDIO spec v.2.00 (section 6.14 - Bus State Diagram) suggests, that initialization commands (CMD5, CMD3) are not accepted in CMD state. As the card stays in that state on powered suspend (no resetting CMD52 nor power cycle is issued) then reinitialization should be entirely skipped on resume unless the power was lost between suspend and resume (or card was temporarily removed from the slot).
Signed-off-by Bing Zhao <[email protected]>Comments below.
Quoted 11 lines
drivers/mmc/core/sdio.c static int mmc_sdio_suspend(struct mmc_host *host) · line 623
Quoted 8 lines
drivers/mmc/core/sdio.c +8
-0+/* +* Simplified SDIO spec v2.00 (section 6.14 - Bus State Diagram) +* suggests that initialization should be skipped on powered resume. +*/ +if (!(host->pm_flags &MMC_PM_KEEP_POWER )) { + err =mmc_sdio_init_card (host, host->ocr, host->card, + host->pm_flags &MMC_PM_KEEP_POWER ); + }Please look at the
if()condition, and at the last argument tommc_sdio_init_card(), then ponder.
You are right. The last argument passed to mmc_sdio_init_card() is zero actually.
err = mmc_sdio_init_card(host, host->ocr, host->card, 0);
Quoted 3 lines
I think the proper fix goes _inside_
mmc_sdio_init_card()as there are certainly still validation checks which are appropriate to perform.
When you have a thought for the fix, I can do the testing on my system.
Thanks,
Bing
Quoted 3 lines
Nicolas
Quoted 5 lines · Bing Zhao
Quoted 2 lines
Please look at the
if()condition, and at the last argument tommc_sdio_init_card(), then ponder.You are right. The last argument passed to
mmc_sdio_init_card()is zero actually.
Quoted 7 lines
err = mmc_sdio_init_card(host, host->ocr, host->card, 0);Quoted 3 lines
I think the proper fix goes _inside_
mmc_sdio_init_card()as there are certainly still validation checks which are appropriate to perform.When you have a thought for the fix, I can do the testing on my system.
I'm telling you that you should use the powered_resume argument of mmc_sdio_init_card() to skip problematic initializations inside mmc_sdio_init_card() when powered_resume is not zero. Looking at the existing code should give you examples of how powered_resume is used and why.
Nicolas
Hi Nicolas,
Quoted 20 lines
-----Original Message-----
From: Nicolas Pitre [mailto:[email protected]]
Sent: Thursday, September 02, 2010 4:30 PM
To: Bing Zhao
Cc: [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton
Subject: RE: [PATCH v2] sdio: skip initialization on powered resumeQuoted 11 lines · Bing Zhao
Quoted 2 lines
Please look at the
if()condition, and at the last argument tommc_sdio_init_card(), then ponder.You are right. The last argument passed to
mmc_sdio_init_card()is zero actually.err = mmc_sdio_init_card(host, host->ocr, host->card, 0);Quoted 3 lines
I think the proper fix goes _inside_
mmc_sdio_init_card()as there are certainly still validation checks which are appropriate to perform.
Quoted 7 lines
Quoted 1 line
When you have a thought for the fix, I can do the testing on my system.
I'm telling you that you should use the
powered_resumeargument ofmmc_sdio_init_card()to skip problematic initializations insidemmc_sdio_init_card()whenpowered_resumeis not zero. Looking at the existing code should give you examples of howpowered_resumeis used and why.
Thanks for the hint.
The new patch skips reading CCCR, common CIS, and validation of vendor/device IDs inside mmc_sdio_init_card() when powered_resume is not zero.
If it looks okay for you I will resend it as V3.
drivers/mmc/core/sdio.c | 38 +++++++++++++++++++++-----------------
1 files changed, 21 insertions(+), 17 deletions(-)
drivers/mmc/core/sdio.c +21 -17
@@ -434,28 +434,32 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, goto finish; } -/* -* Read the common registers. -*/ - err =sdio_read_cccr (card); -if (err) - goto remove; +if (!powered_resume) { +/* +* Read the common registers. +*/ + err =sdio_read_cccr (card); +if (err) + goto remove; -/* -* Read the common CIS tuples. -*/ - err =sdio_read_common_cis (card); -if (err) - goto remove; +/* +* Read the common CIS tuples. +*/ + err =sdio_read_common_cis (card); +if (err) + goto remove; + }if (oldcard) { -int same = (card->cis.vendor == oldcard->cis.vendor && - card->cis.device == oldcard->cis.device);mmc_remove_card (card); -if (!same) -return -ENOENT ; - card = oldcard; +if (!powered_resume) { +int same = (card->cis.vendor == oldcard->cis.vendor && + card->cis.device == oldcard->cis.device); +if (!same) +return -ENOENT ; + } +return 0 ; }
Regards,
Bing
Quoted 3 lines
Nicolas
Quoted 5 lines · Bing Zhao
Thanks for the hint.
The new patch skips reading CCCR, common CIS, and validation of vendor/device IDs inside
mmc_sdio_init_card()whenpowered_resumeis not zero.
Why do you skip the reading of the CIS and IDs validation? That's basically the main reason for still calling mmc_sdio_init_card(). And that only requires CMD 52 so that should be fine.
Nicolas
Hi Nicolas,
Quoted 11 lines
-----Original Message-----
From: Nicolas Pitre [mailto:[email protected]]
Sent: Tuesday, September 07, 2010 6:29 PM
To: Bing Zhao
Cc: [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton
Subject: RE: [PATCH v2] sdio: skip initialization on powered resumeQuoted 2 lines · Bing Zhao
Thanks for the hint.
Quoted 7 lines
Quoted 3 lines
The new patch skips reading CCCR, common CIS, and validation of vendor/device IDs inside
mmc_sdio_init_card()whenpowered_resumeis not zero.Why do you skip the reading of the CIS and IDs validation? That's basically the main reason for still calling
mmc_sdio_init_card(). And that only requires CMD 52 so that should be fine.
While the system is suspended, the SDIO card could be in sleep mode (deep sleep or IEEE Power Save) as well. Reading CIS or any other CMD52 will fail if the card happens to be in sleep at this moment. If we skip re-initialization (including CCCR/CIS and IDs validation), mmc_sdio_init_card() returns success. Then the client driver's resume() handler will be called and the card can be woken up by client driver.
Regards,
Bing
Quoted 3 lines
Nicolas
Hi Bing, Chris,
Quoted 17 lines · Bing Zhao
Hi Nicolas,
Quoted 15 lines
-----Original Message-----
From: Nicolas Pitre [mailto:[email protected]]
Sent: Tuesday, September 07, 2010 6:29 PM
To: Bing Zhao
Cc: [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton
Subject: RE: [PATCH v2] sdio: skip initialization on powered resumeQuoted 5 lines · Bing Zhao
Thanks for the hint.
The new patch skips reading CCCR, common CIS, and validation of vendor/device IDs inside
mmc_sdio_init_card()whenpowered_resumeis not zero.
Quoted 5 lines
Quoted 3 lines
Why do you skip the reading of the CIS and IDs validation? That's basically the main reason for still calling
mmc_sdio_init_card(). And that only requires CMD 52 so that should be fine.While the system is suspended, the SDIO card could be in sleep mode (deep sleep or IEEE Power Save) as well. Reading CIS or any other CMD52 will fail if the card happens to be in sleep at this moment. If we skip re-initialization (including CCCR/CIS and IDs validation),
mmc_sdio_init_card()returns success. Then the client driver'sresume()handler will be called and the card can be woken up by client driver.
In one of your previous patches, "sdio: don't use CMD[357] as part of a powered SDIO resume", its mentioned that there is an issue with CMD7 in mmc_sdio_init_card() that is called during SDIO resume on Marvell 8686.
But in mmc_resume_host(), there is still a call to mmc_detect_change() which in turn calls mmc_sdio_detect(), thus sending CMD7 to the card. Does CMD7 to your card succeed after your client driver resume is called?
Thanks,
Sahitya.
--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Hi Sahitya,
Quoted 37 lines
-----Original Message-----
From: Sahitya Tummala [mailto:[email protected]]
Sent: Tuesday, September 14, 2010 3:16 AM
To: Bing Zhao
Cc: Nicolas Pitre; [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton
Subject: RE: [PATCH v2] sdio: skip initialization on powered resumeHi Bing, Chris,
Quoted 17 lines · Bing Zhao
Hi Nicolas,
Quoted 15 lines
-----Original Message-----
From: Nicolas Pitre [mailto:[email protected]]
Sent: Tuesday, September 07, 2010 6:29 PM
To: Bing Zhao
Cc: [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton
Subject: RE: [PATCH v2] sdio: skip initialization on powered resumeQuoted 5 lines · Bing Zhao
Thanks for the hint.
The new patch skips reading CCCR, common CIS, and validation of vendor/device IDs inside
mmc_sdio_init_card()whenpowered_resumeis not zero.Quoted 5 lines
Quoted 3 lines
Why do you skip the reading of the CIS and IDs validation? That's basically the main reason for still calling
mmc_sdio_init_card(). And that only requires CMD 52 so that should be fine.While the system is suspended, the SDIO card could be in sleep mode (deep sleep or IEEE Power Save)
as well. Reading CIS or any other CMD52 will fail if the card happens to be in sleep at this moment. If we skip re-initialization (including CCCR/CIS and IDs validation),
mmc_sdio_init_card()returns success. Then the client driver'sresume()handler will be called and the card can be woken up by client driver.
Quoted 8 lines
In one of your previous patches, "sdio: don't use CMD[357] as part of a powered SDIO resume", its mentioned that there is an issue with CMD7 in
mmc_sdio_init_card()that is called during SDIO resume on Marvell 8686.But in
mmc_resume_host(), there is still a call tommc_detect_change()which in turn callsmmc_sdio_detect(), thus sending CMD7 to the card. Does CMD7 to your card succeed after your client driver resume is called?
If CMD7 is sent _before_ client driver's resume handler is called, while 8686 card is in sleep mode, it will fail. If CMD7 is sent _after_ client driver's resume handler is called, it should succeed.
By the way, a patch "mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume" (4c2ef25fe0b847d2ae818f74758ddb0be1c27d8e by Maxim Levitsky) has removed the call to mmc_detect_change() in mmc_resume_host().
Regards,
Bing
Quoted 9 lines
Thanks,
Sahitya.--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 3 lines · Bing Zhao
If CMD7 is sent _before_ client driver's resume handler is called, while 8686 card is in sleep mode, it will fail. If CMD7 is sent _after_ client driver's resume handler is called, it should succeed.
Maybe that's what we should do in the powered suspend case then.
Quoted 4 lines
By the way, a patch "mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume" (
4c2ef25fe0b847d2ae818f74758ddb0be1c27d8eby Maxim Levitsky) has removed the call tommc_detect_change()inmmc_resume_host().
If a card is removed while the host is suspended, then this should be detected.
Nicolas
Quoted 17 lines · Nicolas Pitre
Quoted 3 lines · Bing Zhao
If CMD7 is sent _before_ client driver's resume handler is called, while 8686 card is in sleep mode, it will fail. If CMD7 is sent _after_ client driver's resume handler is called, it should succeed.
Maybe that's what we should do in the powered suspend case then.
Quoted 4 lines
By the way, a patch "mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume" (
4c2ef25fe0b847d2ae818f74758ddb0be1c27d8eby Maxim Levitsky) has removed the call tommc_detect_change()inmmc_resume_host().If a card is removed while the host is suspended, then this should be detected.
Quoted 6 lines
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, Bing
Do you have any updated patch to skip mmc_sdio_init_card in resume back. We need such patch in enable host sleep feature for mrvl8787.
Thanks a lot.
Hi Zhangfei,
Quoted 33 lines
-----Original Message-----
From: zhangfei gao [mailto:[email protected]]
Sent: Friday, January 21, 2011 1:07 AM
To: Nicolas Pitre; Bing Zhao
Cc: Sahitya Tummala; [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton; Maxim Levitsky
Subject: Re: [PATCH v2] sdio: skip initialization on powered resumeQuoted 17 lines · Nicolas Pitre
Quoted 3 lines · Bing Zhao
If CMD7 is sent _before_ client driver's resume handler is called, while 8686 card is in sleep mode, it will fail. If CMD7 is sent _after_ client driver's resume handler is called, it should succeed.
Maybe that's what we should do in the powered suspend case then.
Quoted 4 lines
By the way, a patch "mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume" (
4c2ef25fe0b847d2ae818f74758ddb0be1c27d8eby Maxim Levitsky) has removed the call tommc_detect_change()inmmc_resume_host().If a card is removed while the host is suspended, then this should be detected.
Quoted 6 lines
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines
Hi, Bing
Do you have any updated patch to skip
mmc_sdio_init_cardin resume back. We need such patch in enable host sleep feature for mrvl8787.
I posted a patch that skips mmc_sdio_init_card() with MMC_PM_SKIP_RESUME_PROBE flag earlier:
[PATCH v1] sdio: add MMC_PM_SKIP_RESUME_PROBE to workaround powered resume
http://marc.info/?l=linux-mmc&m=128294262424567&w=2
Nicolas commented that it's too hackish with this approach.
http://marc.info/?l=linux-mmc&m=128294738230151&w=2
Other than that, I couldn't think of a better way to solve the issue here:
In mmc_sdio_init_card() CIS device/vendor IDs are read to check if the card has been replaced or not when the system was suspended. But reading these IDs will cause CMD52 timeout if the card is in sleep state. The function driver can wake up the card by writing to certain card specific register, so that the followed SDIO commands (CMD52, CMD53, etc.) can go through. But the resume handler of the function driver won't be invoked until the IDs get validated.
Regards,
Bing
Quoted 2 lines
Thanks a lot.
Nicolas Pitre
Acked-byQuoted 50 lines · Bing Zhao
Hi Zhangfei,
Quoted 33 lines
-----Original Message-----
From: zhangfei gao [mailto:[email protected]]
Sent: Friday, January 21, 2011 1:07 AM
To: Nicolas Pitre; Bing Zhao
Cc: Sahitya Tummala; [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton; Maxim Levitsky
Subject: Re: [PATCH v2] sdio: skip initialization on powered resumeQuoted 17 lines · Nicolas Pitre
Quoted 3 lines · Bing Zhao
If CMD7 is sent _before_ client driver's resume handler is called, while 8686 card is in sleep mode, it will fail. If CMD7 is sent _after_ client driver's resume handler is called, it should succeed.
Maybe that's what we should do in the powered suspend case then.
Quoted 4 lines
By the way, a patch "mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume" (
4c2ef25fe0b847d2ae818f74758ddb0be1c27d8eby Maxim Levitsky) has removed the call tommc_detect_change()inmmc_resume_host().If a card is removed while the host is suspended, then this should be detected.
Quoted 6 lines
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 4 lines
Hi, Bing
Do you have any updated patch to skip
mmc_sdio_init_cardin resume back. We need such patch in enable host sleep feature for mrvl8787.I posted a patch that skips
mmc_sdio_init_card()withMMC_PM_SKIP_RESUME_PROBEflag earlier:[PATCH v1] sdio: add
MMC_PM_SKIP_RESUME_PROBEto workaround powered resume
http://marc.info/?l=linux-mmc&m=128294262424567&w=2Nicolas commented that it's too hackish with this approach.
http://marc.info/?l=linux-mmc&m=128294738230151&w=2Other than that, I couldn't think of a better way to solve the issue here:
Quoted 7 lines
In
mmc_sdio_init_card()CIS device/vendor IDs are read to check if the card has been replaced or not when the system was suspended. But reading these IDs will cause CMD52 timeout if the card is in sleep state. The function driver can wake up the card by writing to certain card specific register, so that the followed SDIO commands (CMD52, CMD53, etc.) can go through. But the resume handler of the function driver won't be invoked until the IDs get validated.
Please add the extra explanation above to the commit log so that the context is not lost. And then
Then this could be revisited eventually when more devices are supported and a better abstraction to cover their needs could be created.
Nicolas
Quoted 73 lines
-----Original Message-----
From: Nicolas Pitre [mailto:[email protected]]
Sent: Friday, January 21, 2011 6:56 PM
To: Bing Zhao
Cc: zhangfei gao; Sahitya Tummala; [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton; Maxim Levitsky
Subject: RE: [PATCH v2] sdio: skip initialization on powered resumeQuoted 50 lines · Bing Zhao
Hi Zhangfei,
Quoted 33 lines
-----Original Message-----
From: zhangfei gao [mailto:[email protected]]
Sent: Friday, January 21, 2011 1:07 AM
To: Nicolas Pitre; Bing Zhao
Cc: Sahitya Tummala; [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton; Maxim Levitsky
Subject: Re: [PATCH v2] sdio: skip initialization on powered resumeQuoted 17 lines · Nicolas Pitre
Quoted 3 lines · Bing Zhao
If CMD7 is sent _before_ client driver's resume handler is called, while 8686 card is in sleep mode, it will fail. If CMD7 is sent _after_ client driver's resume handler is called, it should succeed.
Maybe that's what we should do in the powered suspend case then.
Quoted 4 lines
By the way, a patch "mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume" (
4c2ef25fe0b847d2ae818f74758ddb0be1c27d8eby Maxim Levitsky) has removed the call tommc_detect_change()inmmc_resume_host().If a card is removed while the host is suspended, then this should be detected.
Quoted 6 lines
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 4 lines
Hi, Bing
Do you have any updated patch to skip
mmc_sdio_init_cardin resume back. We need such patch in enable host sleep feature for mrvl8787.I posted a patch that skips
mmc_sdio_init_card()withMMC_PM_SKIP_RESUME_PROBEflag earlier:[PATCH v1] sdio: add
MMC_PM_SKIP_RESUME_PROBEto workaround powered resume
http://marc.info/?l=linux-mmc&m=128294262424567&w=2Nicolas commented that it's too hackish with this approach.
http://marc.info/?l=linux-mmc&m=128294738230151&w=2Other than that, I couldn't think of a better way to solve the issue here:
Quoted 7 lines
In
mmc_sdio_init_card()CIS device/vendor IDs are read to check if the card has been replaced or not when the system was suspended. But reading these IDs will cause CMD52 timeout if the card is in sleep state. The function driver can wake up the card by writing to certain card specific register, so that the followed SDIO commands (CMD52, CMD53, etc.) can go through. But the resume handler of the function driver won't be invoked until the IDs get validated.Please add the extra explanation above to the commit log so that the context is not lost. And then
Quoted 7 lines
Acked-by Nicolas Pitre <[email protected]>Then this could be revisited eventually when more devices are supported and a better abstraction to cover their needs could be created.
Nicolas
Hi Nicolas,
Thanks for ack. I'll resend the patch with extra explanation in commit log.
Hi Chris,
I'll rebase and test the patch based on git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git tree. Should I use "master" or "mmc-next" branch?
Thanks,
Bing
Hi Bing,
Quoted 1 line · Bing Zhao
I'll rebase and test the patch based on
git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.gittree. Should I use "master" or "mmc-next" branch?
mmc-next, please. Thanks!
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
Quoted 2 lines · zhangfei gao
Do you have any updated patch to skip
mmc_sdio_init_cardin resume back. We need such patch in enable host sleep feature for mrvl8787.
Is mrvl8787 a removable card ?
I'm asking because we already skip mmc_sdio_init_card() for powered-resumed nonremovable cards (check out commit 3cfc33a "mmc:
sdio: don't reinitialize nonremovable powered-resumed cards").
I'm not familiar with marvell's cards, but I do remember a thread mentioning they have dedicated reset GPIOs, and that may suggest they are nonremovables. If that's the case, simply setting MMC_CAP_NONREMOVABLE on the relevant slot should do the trick for you.
Hi Ohad,
Quoted 8 lines
-----Original Message-----
From: Ohad Ben-Cohen [mailto:[email protected]]
Sent: Saturday, January 22, 2011 2:01 PM
To: zhangfei gao
Cc: Nicolas Pitre; Bing Zhao; Sahitya Tummala; [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton; Maxim Levitsky
Subject: Re: [PATCH v2] sdio: skip initialization on powered resume
Quoted 5 lines
Quoted 2 lines · zhangfei gao
Do you have any updated patch to skip
mmc_sdio_init_cardin resume back. We need such patch in enable host sleep feature for mrvl8787.Is mrvl8787 a removable card ?
It can be either a removable or non-removable card, depending on what platform is used.
Quoted 4 lines
I'm asking because we already skip
mmc_sdio_init_card()for powered-resumed nonremovable cards (check out commit 3cfc33a "mmc:
sdio: don't reinitialize nonremovable powered-resumed cards").
Thanks for the info.
Quoted 5 lines
I'm not familiar with marvell's cards, but I do remember a thread mentioning they have dedicated reset GPIOs, and that may suggest they are nonremovables. If that's the case, simply setting
MMC_CAP_NONREMOVABLEon the relevant slot should do the trick for you.
I think this approach works for Zhangfei on his embedded platform on which the 8787 card is non-removable.
Regards,
Bing
Quoted 26 lines · Bing Zhao
Hi Ohad,
Quoted 8 lines
-----Original Message-----
From: Ohad Ben-Cohen [mailto:[email protected]]
Sent: Saturday, January 22, 2011 2:01 PM
To: zhangfei gao
Cc: Nicolas Pitre; Bing Zhao; Sahitya Tummala; [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton; Maxim Levitsky
Subject: Re: [PATCH v2] sdio: skip initialization on powered resumeQuoted 5 lines
Quoted 2 lines · zhangfei gao
Do you have any updated patch to skip
mmc_sdio_init_cardin resume back. We need such patch in enable host sleep feature for mrvl8787.Is mrvl8787 a removable card ?
It can be either a removable or non-removable card, depending on what platform is used.
Quoted 4 lines
I'm asking because we already skip
mmc_sdio_init_card()for powered-resumed nonremovable cards (check out commit 3cfc33a "mmc:
sdio: don't reinitialize nonremovable powered-resumed cards").Thanks for the info.
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
I'm not familiar with marvell's cards, but I do remember a thread mentioning they have dedicated reset GPIOs, and that may suggest they are nonremovables. If that's the case, simply setting
MMC_CAP_NONREMOVABLEon the relevant slot should do the trick for you.I think this approach works for Zhangfei on his embedded platform on which the 8787 card is non-removable.
Hi, Ohad,
Thanks for your patch, it is workable on the platform where mrvl8787 is non-removable.
However, we still have platform mrvl8787 is removable, SDHCI_PRESENT_STATE can be read out value.
Could we remove mmc_card_is_removable(host) condition, the skip is not related with whether card is removable or not, do you think so?
Thanks a lot.
Quoted 5 lines
Regards,
Bing
Hello Zhangfei,
Quoted 2 lines · zhangfei gao
Could we remove
mmc_card_is_removable(host)condition, the skip is not related with whether card is removable or not, do you think so?
But, as Nicolas pointed out before, what if the card is removed (or replaced) while the system was suspended ?
It seems that this won't be detected, and your driver, once resumed, will assume the card is still in place and will just fail. Are you ok with it ?
Can you please explain what's required to wake up mrvl8787 from this deep sleep ?
One thing we can do is letting drivers register a wake-up function within the SDIO core, just before suspending. Then, upon resume, if such a wake-up function was registered, SDIO core would invoke it just before it tries to read the CIS.
This way your card stays in deep sleep while the system is suspended, and when the system wakes up, SDIO core has a chance to make sure the card was not removed/replaced.
If the card is replaced, the wake-up function will probably just fail, and then SDIO core will have to reinitialize that new card. I'm not sure that's ideal, but those errors would happen anyway if we just skip the reinitialization and let the driver assume the card wasn't replaced.
What do you think ? Would that work for you ?
Btw we have the same thing with the wl1271. Since it's mostly nonremovable, we're ok with 3cfc33a, but that may change.
Thanks,
Ohad.
Quoted 4 lines · Ohad Ben-Cohen
One thing we can do is letting drivers register a wake-up function within the SDIO core, just before suspending. Then, upon resume, if such a wake-up function was registered, SDIO core would invoke it just before it tries to read the CIS.
I guess that would be non-trivial, since at that point the driver is not resumed yet, and you might need its facilities to receive some wake-up ACK from the chip before continuing.