All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sdhci: poll for card even when card is logically unremovable
@ 2012-07-05 21:06 Daniel Drake
  2012-07-06  8:23 ` Jaehoon Chung
  2012-07-10  3:16 ` Chris Ball
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Drake @ 2012-07-05 21:06 UTC (permalink / raw)
  To: cjb; +Cc: linux-mmc

The Marvell CaFe is now marked as having bad card detection to fix
a problem during system resume.

Now on the OLPC XO-1 we are facing the issue that the card is marked
as logically unremovable (via MMC_UNSAFE_RESUME), which means that
mmc_card_is_removable considers the card non-removable. The existing
code logic decides not to poll for card presence in this case, and
card detection is also disabled because of the quirk being set.
This means that no SD cards are detected when inserted after boot.

Refine the logic to enable card presence polling in the case when
a card is logically unremovable, only avoiding the poll in the case
when the card is physically non-removable (denoted with
MMC_CAP_NONREMOVABLE).

Signed-off-by: Daniel Drake <dsd@laptop.org>
---
 drivers/mmc/host/sdhci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f4b8b4d..dd71a05 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2779,7 +2779,7 @@ int sdhci_add_host(struct sdhci_host *host)
 		mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
 
 	if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
-	    mmc_card_is_removable(mmc))
+	    !(host->mmc->caps & MMC_CAP_NONREMOVABLE))
 		mmc->caps |= MMC_CAP_NEEDS_POLL;
 
 	/* Any UHS-I mode in caps implies SDR12 and SDR25 support. */
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sdhci: poll for card even when card is logically unremovable
  2012-07-05 21:06 [PATCH] sdhci: poll for card even when card is logically unremovable Daniel Drake
@ 2012-07-06  8:23 ` Jaehoon Chung
  2012-07-06 14:49   ` Daniel Drake
  2012-07-10  3:16 ` Chris Ball
  1 sibling, 1 reply; 4+ messages in thread
From: Jaehoon Chung @ 2012-07-06  8:23 UTC (permalink / raw)
  To: Daniel Drake; +Cc: cjb, linux-mmc

Hi Daniel,

When enabled MMC_UNSAFE_RESUME, it assumed that card didn't remove
during suspend/resume.
If you need to remove the card during suspend/resume,
why enable MMC_UNSAFE_RESUME?

Best Regards,
Jaehoon Chung

On 07/06/2012 06:06 AM, Daniel Drake wrote:

> The Marvell CaFe is now marked as having bad card detection to fix
> a problem during system resume.
> 
> Now on the OLPC XO-1 we are facing the issue that the card is marked
> as logically unremovable (via MMC_UNSAFE_RESUME), which means that
> mmc_card_is_removable considers the card non-removable. The existing
> code logic decides not to poll for card presence in this case, and
> card detection is also disabled because of the quirk being set.
> This means that no SD cards are detected when inserted after boot.
> 
> Refine the logic to enable card presence polling in the case when
> a card is logically unremovable, only avoiding the poll in the case
> when the card is physically non-removable (denoted with
> MMC_CAP_NONREMOVABLE).
> 
> Signed-off-by: Daniel Drake <dsd@laptop.org>
> ---
>  drivers/mmc/host/sdhci.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index f4b8b4d..dd71a05 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2779,7 +2779,7 @@ int sdhci_add_host(struct sdhci_host *host)
>  		mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
>  
>  	if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
> -	    mmc_card_is_removable(mmc))
> +	    !(host->mmc->caps & MMC_CAP_NONREMOVABLE))
>  		mmc->caps |= MMC_CAP_NEEDS_POLL;
>  
>  	/* Any UHS-I mode in caps implies SDR12 and SDR25 support. */



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sdhci: poll for card even when card is logically unremovable
  2012-07-06  8:23 ` Jaehoon Chung
@ 2012-07-06 14:49   ` Daniel Drake
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Drake @ 2012-07-06 14:49 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: cjb, linux-mmc

On Fri, Jul 6, 2012 at 2:23 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Hi Daniel,
>
> When enabled MMC_UNSAFE_RESUME, it assumed that card didn't remove
> during suspend/resume.
> If you need to remove the card during suspend/resume,
> why enable MMC_UNSAFE_RESUME?

We don't want to remove the card during suspend/resume.

We want the card to remain present during suspend/resume with any open
mounts and files untouched (the previous patch), and we want the
ability to hotplug cards while the system is running (this patch)
after the user has unmounted it.

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sdhci: poll for card even when card is logically unremovable
  2012-07-05 21:06 [PATCH] sdhci: poll for card even when card is logically unremovable Daniel Drake
  2012-07-06  8:23 ` Jaehoon Chung
@ 2012-07-10  3:16 ` Chris Ball
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Ball @ 2012-07-10  3:16 UTC (permalink / raw)
  To: Daniel Drake; +Cc: linux-mmc

Hi Dan,

On Thu, Jul 05 2012, Daniel Drake wrote:
> The Marvell CaFe is now marked as having bad card detection to fix
> a problem during system resume.
>
> Now on the OLPC XO-1 we are facing the issue that the card is marked
> as logically unremovable (via MMC_UNSAFE_RESUME), which means that
> mmc_card_is_removable considers the card non-removable. The existing
> code logic decides not to poll for card presence in this case, and
> card detection is also disabled because of the quirk being set.
> This means that no SD cards are detected when inserted after boot.
>
> Refine the logic to enable card presence polling in the case when
> a card is logically unremovable, only avoiding the poll in the case
> when the card is physically non-removable (denoted with
> MMC_CAP_NONREMOVABLE).
>
> Signed-off-by: Daniel Drake <dsd@laptop.org>
> ---
>  drivers/mmc/host/sdhci.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index f4b8b4d..dd71a05 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2779,7 +2779,7 @@ int sdhci_add_host(struct sdhci_host *host)
>  		mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
>  
>  	if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
> -	    mmc_card_is_removable(mmc))
> +	    !(host->mmc->caps & MMC_CAP_NONREMOVABLE))
>  		mmc->caps |= MMC_CAP_NEEDS_POLL;
>  
>  	/* Any UHS-I mode in caps implies SDR12 and SDR25 support. */

Thanks, pushed to mmc-next for 3.6.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-10  3:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-05 21:06 [PATCH] sdhci: poll for card even when card is logically unremovable Daniel Drake
2012-07-06  8:23 ` Jaehoon Chung
2012-07-06 14:49   ` Daniel Drake
2012-07-10  3:16 ` Chris Ball

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.