Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1318639 > unrolled thread

[RFC PATCH 10/21] mmc: sdhci: remove SDHCI_QUIRK_BROKEN_CARD_DETECTION

Started byShawn Lin <shawn.lin@rock-chips.com>
First post2016-01-27 06:20 +0100
Last post2016-01-27 08:30 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC PATCH 10/21] mmc: sdhci: remove SDHCI_QUIRK_BROKEN_CARD_DETECTION Shawn Lin <shawn.lin@rock-chips.com> - 2016-01-27 06:20 +0100
    RE: [RFC PATCH 10/21] mmc: sdhci: remove  SDHCI_QUIRK_BROKEN_CARD_DETECTION Haibo Chen <haibo.chen@nxp.com> - 2016-01-27 08:20 +0100
      Re: [RFC PATCH 10/21] mmc: sdhci: remove  SDHCI_QUIRK_BROKEN_CARD_DETECTION Shawn Lin <shawn.lin@rock-chips.com> - 2016-01-27 08:30 +0100

#1318639 — [RFC PATCH 10/21] mmc: sdhci: remove SDHCI_QUIRK_BROKEN_CARD_DETECTION

FromShawn Lin <shawn.lin@rock-chips.com>
Date2016-01-27 06:20 +0100
Subject[RFC PATCH 10/21] mmc: sdhci: remove SDHCI_QUIRK_BROKEN_CARD_DETECTION
Message-ID<qVqGl-6Zi-7@gated-at.bofh.it>
SDHCI_QUIRK_BROKEN_CARD_DETECTION is for "broken-cd".
If we add MMC_CAP_NONREMOVABLE("non-removeble"), we shoud
not add "broken-cd" together according to mmc.txt for
dt-bingdings. Also, "broken-cd" can obtain from mmc_of_parse,
which will add MMC_CAP_NEEDS_POLL into mmc->caps.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/mmc/host/sdhci.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index d622435..b208cb7 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -145,7 +145,7 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
 {
 	u32 present;
 
-	if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
+	if ((host->mmc->caps & MMC_CAP_NEEDS_POLL) ||
 	    (host->mmc->caps & MMC_CAP_NONREMOVABLE))
 		return;
 
@@ -1618,7 +1618,8 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
 		return 0;
 
 	/* If nonremovable, assume that the card is always present. */
-	if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
+	if (host->mmc->caps & MMC_CAP_NONREMOVABLE ||
+	    host->mmc->caps & MMC_CAP_NEEDS_POLL)
 		return 1;
 
 	/*
@@ -1628,10 +1629,6 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
 	if (!IS_ERR_VALUE(gpio_cd))
 		return !!gpio_cd;
 
-	/* If polling, assume that the card is always present. */
-	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
-		return 1;
-
 	/* Host native card detect */
 	return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT);
 }
@@ -2658,7 +2655,7 @@ void sdhci_enable_irq_wakeups(struct sdhci_host *host)
 	val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL);
 	val |= mask ;
 	/* Avoid fake wake up */
-	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
+	if (host->mmc->caps & MMC_CAP_NEEDS_POLL)
 		val &= ~(SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE);
 	sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL);
 }
@@ -3112,8 +3109,7 @@ int sdhci_add_host(struct sdhci_host *host)
 	if (caps[0] & SDHCI_CAN_DO_HISPD)
 		mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
 
-	if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
-	    !(mmc->caps & MMC_CAP_NONREMOVABLE) &&
+	if (!(mmc->caps & MMC_CAP_NONREMOVABLE) &&
 	    IS_ERR_VALUE(mmc_gpio_get_cd(host->mmc)))
 		mmc->caps |= MMC_CAP_NEEDS_POLL;
 
-- 
2.3.7

[toc] | [next] | [standalone]


#1318711 — RE: [RFC PATCH 10/21] mmc: sdhci: remove SDHCI_QUIRK_BROKEN_CARD_DETECTION

FromHaibo Chen <haibo.chen@nxp.com>
Date2016-01-27 08:20 +0100
SubjectRE: [RFC PATCH 10/21] mmc: sdhci: remove SDHCI_QUIRK_BROKEN_CARD_DETECTION
Message-ID<qVsyu-8nX-7@gated-at.bofh.it>
In reply to#1318639

Hi Shawn,


> -----Original Message-----
> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
> owner@vger.kernel.org] On Behalf Of Shawn Lin
> Sent: Wednesday, January 27, 2016 1:08 PM
> To: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: bcm-kernel-feedback-list@broadcom.com; linux-rpi-
> kernel@lists.infradead.org; linux-mmc@vger.kernel.org; linux-
> kernel@vger.kernel.org; Shawn Lin <shawn.lin@rock-chips.com>
> Subject: [RFC PATCH 10/21] mmc: sdhci: remove
> SDHCI_QUIRK_BROKEN_CARD_DETECTION
> 
> SDHCI_QUIRK_BROKEN_CARD_DETECTION is for "broken-cd".
> If we add MMC_CAP_NONREMOVABLE("non-removeble"), we shoud not add
> "broken-cd" together according to mmc.txt for dt-bingdings. Also, "broken-cd"
> can obtain from mmc_of_parse, which will add MMC_CAP_NEEDS_POLL into
> mmc->caps.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
> 
>  drivers/mmc/host/sdhci.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index
> d622435..b208cb7 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -145,7 +145,7 @@ static void sdhci_set_card_detection(struct sdhci_host
> *host, bool enable)  {
>  	u32 present;
> 
> -	if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
> +	if ((host->mmc->caps & MMC_CAP_NEEDS_POLL) ||
>  	    (host->mmc->caps & MMC_CAP_NONREMOVABLE))
>  		return;
> 
> @@ -1618,7 +1618,8 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
>  		return 0;
> 
>  	/* If nonremovable, assume that the card is always present. */
> -	if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
> +	if (host->mmc->caps & MMC_CAP_NONREMOVABLE ||
> +	    host->mmc->caps & MMC_CAP_NEEDS_POLL)
>  		return 1;
> 
>  	/*
> @@ -1628,10 +1629,6 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
>  	if (!IS_ERR_VALUE(gpio_cd))
>  		return !!gpio_cd;
> 
> -	/* If polling, assume that the card is always present. */
> -	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
> -		return 1;

Why simply  remove these code rather than use this:
If(host->mmc->caps & MMC_CAP_NEEDS_POLL)
       Return 1;

According to the comment, if polling, need to return 1,
But if you just simply remove this code, it will read the sdhci register SDHCI_PRESENT_STATE


Best Regards

Haibo Chen

> -
>  	/* Host native card detect */
>  	return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
> SDHCI_CARD_PRESENT);  } @@ -2658,7 +2655,7 @@ void
> sdhci_enable_irq_wakeups(struct sdhci_host *host)
>  	val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL);
>  	val |= mask ;
>  	/* Avoid fake wake up */
> -	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
> +	if (host->mmc->caps & MMC_CAP_NEEDS_POLL)
>  		val &= ~(SDHCI_WAKE_ON_INSERT |
> SDHCI_WAKE_ON_REMOVE);
>  	sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL);  } @@ -3112,8
> +3109,7 @@ int sdhci_add_host(struct sdhci_host *host)
>  	if (caps[0] & SDHCI_CAN_DO_HISPD)
>  		mmc->caps |= MMC_CAP_SD_HIGHSPEED |
> MMC_CAP_MMC_HIGHSPEED;
> 
> -	if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
> -	    !(mmc->caps & MMC_CAP_NONREMOVABLE) &&
> +	if (!(mmc->caps & MMC_CAP_NONREMOVABLE) &&
>  	    IS_ERR_VALUE(mmc_gpio_get_cd(host->mmc)))
>  		mmc->caps |= MMC_CAP_NEEDS_POLL;
> 
> --
> 2.3.7
> 
> 
> --
> 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

[toc] | [prev] | [next] | [standalone]


#1318717 — Re: [RFC PATCH 10/21] mmc: sdhci: remove SDHCI_QUIRK_BROKEN_CARD_DETECTION

FromShawn Lin <shawn.lin@rock-chips.com>
Date2016-01-27 08:30 +0100
SubjectRe: [RFC PATCH 10/21] mmc: sdhci: remove SDHCI_QUIRK_BROKEN_CARD_DETECTION
Message-ID<qVsIb-8rt-27@gated-at.bofh.it>
In reply to#1318711
On 2016/1/27 15:11, Haibo Chen wrote:
>
>
> Hi Shawn,
>
>

[...]

>> @@ -1618,7 +1618,8 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
>>   		return 0;
>>
>>   	/* If nonremovable, assume that the card is always present. */
>> -	if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
>> +	if (host->mmc->caps & MMC_CAP_NONREMOVABLE ||
>> +	    host->mmc->caps & MMC_CAP_NEEDS_POLL)
>>   		return 1;
>>
>>   	/*
>> @@ -1628,10 +1629,6 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
>>   	if (!IS_ERR_VALUE(gpio_cd))
>>   		return !!gpio_cd;
>>
>> -	/* If polling, assume that the card is always present. */
>> -	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
>> -		return 1;
>
> Why simply  remove these code rather than use this:
> If(host->mmc->caps & MMC_CAP_NEEDS_POLL)
>         Return 1;
>
> According to the comment, if polling, need to return 1,
> But if you just simply remove this code, it will read the sdhci register SDHCI_PRESENT_STATE

Hi Haibo

I have combine this check with "host->mmc->caps & MMC_CAP_NONREMOVABLE" 
above. :)

Thanks

>
>
> Best Regards
>
> Haibo Chen
>
>> -
>>   	/* Host native card detect */
>>   	return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
>> SDHCI_CARD_PRESENT);  } @@ -2658,7 +2655,7 @@ void
>> sdhci_enable_irq_wakeups(struct sdhci_host *host)
>>   	val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL);
>>   	val |= mask ;
>>   	/* Avoid fake wake up */
>> -	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
>> +	if (host->mmc->caps & MMC_CAP_NEEDS_POLL)
>>   		val &= ~(SDHCI_WAKE_ON_INSERT |
>> SDHCI_WAKE_ON_REMOVE);
>>   	sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL);  } @@ -3112,8
>> +3109,7 @@ int sdhci_add_host(struct sdhci_host *host)
>>   	if (caps[0] & SDHCI_CAN_DO_HISPD)
>>   		mmc->caps |= MMC_CAP_SD_HIGHSPEED |
>> MMC_CAP_MMC_HIGHSPEED;
>>
>> -	if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
>> -	    !(mmc->caps & MMC_CAP_NONREMOVABLE) &&
>> +	if (!(mmc->caps & MMC_CAP_NONREMOVABLE) &&
>>   	    IS_ERR_VALUE(mmc_gpio_get_cd(host->mmc)))
>>   		mmc->caps |= MMC_CAP_NEEDS_POLL;
>>
>> --
>> 2.3.7
>>
>>
>> --
>> 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
>
>
>


-- 
Best Regards
Shawn Lin

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web