diff mbox

[2/3] mmc: dw_mmc: add the debug message for polling and non-removable

Message ID 20161124110442.22058-2-jh80.chung@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jaehoon Chung Nov. 24, 2016, 11:04 a.m. UTC
If card is polling or non-removable, display the more exact message.
It's helpful to debug which detecting scheme is using.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Comments

Jaehoon Chung Nov. 28, 2016, 1:42 a.m. UTC | #1
On 11/24/2016 08:04 PM, Jaehoon Chung wrote:
> If card is polling or non-removable, display the more exact message.
> It's helpful to debug which detecting scheme is using.
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>

Applied on my dwmmc repository.

Best Regards,
Jaehoon Chung
> ---
>  drivers/mmc/host/dw_mmc.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index c6cc618..d508225 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1525,9 +1525,23 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
>  	int gpio_cd = mmc_gpio_get_cd(mmc);
>  
>  	/* Use platform get_cd function, else try onboard card detect */
> -	if ((mmc->caps & MMC_CAP_NEEDS_POLL) || !mmc_card_is_removable(mmc))
> +	if (((mmc->caps & MMC_CAP_NEEDS_POLL)
> +				|| !mmc_card_is_removable(mmc))) {
>  		present = 1;
> -	else if (gpio_cd >= 0)
> +
> +		if (!test_bit(DW_MMC_CARD_PRESENT, &slot->flags)) {
> +			if (mmc->caps & MMC_CAP_NEEDS_POLL) {
> +				dev_info(&mmc->class_dev,
> +					"card is polling.\n");
> +			} else {
> +				dev_info(&mmc->class_dev,
> +					"card is non-removable.\n");
> +			}
> +			set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
> +		}
> +
> +		return present;
> +	} else if (gpio_cd >= 0)
>  		present = gpio_cd;
>  	else
>  		present = (mci_readl(slot->host, CDETECT) & (1 << slot->id))
> 

--
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
diff mbox

Patch

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index c6cc618..d508225 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1525,9 +1525,23 @@  static int dw_mci_get_cd(struct mmc_host *mmc)
 	int gpio_cd = mmc_gpio_get_cd(mmc);
 
 	/* Use platform get_cd function, else try onboard card detect */
-	if ((mmc->caps & MMC_CAP_NEEDS_POLL) || !mmc_card_is_removable(mmc))
+	if (((mmc->caps & MMC_CAP_NEEDS_POLL)
+				|| !mmc_card_is_removable(mmc))) {
 		present = 1;
-	else if (gpio_cd >= 0)
+
+		if (!test_bit(DW_MMC_CARD_PRESENT, &slot->flags)) {
+			if (mmc->caps & MMC_CAP_NEEDS_POLL) {
+				dev_info(&mmc->class_dev,
+					"card is polling.\n");
+			} else {
+				dev_info(&mmc->class_dev,
+					"card is non-removable.\n");
+			}
+			set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
+		}
+
+		return present;
+	} else if (gpio_cd >= 0)
 		present = gpio_cd;
 	else
 		present = (mci_readl(slot->host, CDETECT) & (1 << slot->id))