diff mbox

[3/3] mmc: dw_mmc: display the clock message only one time when card is polling

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

Commit Message

Jaehoon Chung Nov. 24, 2016, 11:04 a.m. UTC
When card is polling (broken-cd), there is a spamming messge related to
clock.
After applied this patch, display the message only one time at boot
time. It's enough to check which clock values is used.
Also prevent to display the spamming message.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 13 ++++++++++++-
 drivers/mmc/host/dw_mmc.h |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

Comments

Jaehoon Chung Nov. 28, 2016, 1:42 a.m. UTC | #1
On 11/24/2016 08:04 PM, Jaehoon Chung wrote:
> When card is polling (broken-cd), there is a spamming messge related to
> clock.
> After applied this patch, display the message only one time at boot
> time. It's enough to check which clock values is used.
> Also prevent to display the spamming message.
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>

Applied on my dwmmc repository.

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/host/dw_mmc.c | 13 ++++++++++++-
>  drivers/mmc/host/dw_mmc.h |  1 +
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index d508225..dd7e95d 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1176,13 +1176,24 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
>  
>  		div = (host->bus_hz != clock) ? DIV_ROUND_UP(div, 2) : 0;
>  
> -		if (clock != slot->__clk_old || force_clkinit)
> +		if ((clock != slot->__clk_old &&
> +			!test_bit(DW_MMC_CARD_NEEDS_POLL, &slot->flags)) ||
> +			force_clkinit) {
>  			dev_info(&slot->mmc->class_dev,
>  				 "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n",
>  				 slot->id, host->bus_hz, clock,
>  				 div ? ((host->bus_hz / div) >> 1) :
>  				 host->bus_hz, div);
>  
> +			/*
> +			 * If card is polling, display the message only
> +			 * one time at boot time.
> +			 */
> +			if (slot->mmc->caps & MMC_CAP_NEEDS_POLL &&
> +					slot->mmc->f_min == clock)
> +				set_bit(DW_MMC_CARD_NEEDS_POLL, &slot->flags);
> +		}
> +
>  		/* disable clock */
>  		mci_writel(host, CLKENA, 0);
>  		mci_writel(host, CLKSRC, 0);
> diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
> index 4a6ae750..c594658 100644
> --- a/drivers/mmc/host/dw_mmc.h
> +++ b/drivers/mmc/host/dw_mmc.h
> @@ -272,6 +272,7 @@ struct dw_mci_slot {
>  #define DW_MMC_CARD_NEED_INIT	1
>  #define DW_MMC_CARD_NO_LOW_PWR	2
>  #define DW_MMC_CARD_NO_USE_HOLD 3
> +#define DW_MMC_CARD_NEEDS_POLL	4
>  	int			id;
>  	int			sdio_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 d508225..dd7e95d 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1176,13 +1176,24 @@  static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
 
 		div = (host->bus_hz != clock) ? DIV_ROUND_UP(div, 2) : 0;
 
-		if (clock != slot->__clk_old || force_clkinit)
+		if ((clock != slot->__clk_old &&
+			!test_bit(DW_MMC_CARD_NEEDS_POLL, &slot->flags)) ||
+			force_clkinit) {
 			dev_info(&slot->mmc->class_dev,
 				 "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n",
 				 slot->id, host->bus_hz, clock,
 				 div ? ((host->bus_hz / div) >> 1) :
 				 host->bus_hz, div);
 
+			/*
+			 * If card is polling, display the message only
+			 * one time at boot time.
+			 */
+			if (slot->mmc->caps & MMC_CAP_NEEDS_POLL &&
+					slot->mmc->f_min == clock)
+				set_bit(DW_MMC_CARD_NEEDS_POLL, &slot->flags);
+		}
+
 		/* disable clock */
 		mci_writel(host, CLKENA, 0);
 		mci_writel(host, CLKSRC, 0);
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 4a6ae750..c594658 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -272,6 +272,7 @@  struct dw_mci_slot {
 #define DW_MMC_CARD_NEED_INIT	1
 #define DW_MMC_CARD_NO_LOW_PWR	2
 #define DW_MMC_CARD_NO_USE_HOLD 3
+#define DW_MMC_CARD_NEEDS_POLL	4
 	int			id;
 	int			sdio_id;
 };