diff mbox

mmc: sdhci-of-esdhc: disable SD clock for clock value 0

Message ID 20170921054238.46666-1-yangbo.lu@nxp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yangbo Lu Sept. 21, 2017, 5:42 a.m. UTC
SD clock should be disabled for clock value 0. It's not
right to just return. This may cause failure of signal
voltage switching.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/mmc/host/sdhci-of-esdhc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Adrian Hunter Sept. 21, 2017, 8:25 a.m. UTC | #1
On 21/09/17 08:42, Yangbo Lu wrote:
> SD clock should be disabled for clock value 0. It's not
> right to just return. This may cause failure of signal
> voltage switching.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Minor comment below, nevertheless:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-of-esdhc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index d96a057a7db8..b21008729aeb 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -36,6 +36,8 @@ struct sdhci_esdhc {
>  	unsigned int peripheral_clock;
>  };
>  
> +static void esdhc_clock_enable(struct sdhci_host *host, bool enable);

We usually move functions rather than forward declare them.

> +
>  /**
>   * esdhc_read*_fixup - Fixup the value read from incompatible eSDHC register
>   *		       to make it compatible with SD spec.
> @@ -469,8 +471,10 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
>  
>  	host->mmc->actual_clock = 0;
>  
> -	if (clock == 0)
> +	if (clock == 0) {
> +		esdhc_clock_enable(host, false);
>  		return;
> +	}
>  
>  	/* Workaround to start pre_div at 2 for VNN < VENDOR_V_23 */
>  	if (esdhc->vendor_ver < VENDOR_V_23)
> 

--
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
Ulf Hansson Sept. 22, 2017, 9:10 a.m. UTC | #2
On 21 September 2017 at 10:25, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 21/09/17 08:42, Yangbo Lu wrote:
>> SD clock should be disabled for clock value 0. It's not
>> right to just return. This may cause failure of signal
>> voltage switching.
>>
>> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
>
> Minor comment below, nevertheless:
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
>> ---
>>  drivers/mmc/host/sdhci-of-esdhc.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
>> index d96a057a7db8..b21008729aeb 100644
>> --- a/drivers/mmc/host/sdhci-of-esdhc.c
>> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
>> @@ -36,6 +36,8 @@ struct sdhci_esdhc {
>>       unsigned int peripheral_clock;
>>  };
>>
>> +static void esdhc_clock_enable(struct sdhci_host *host, bool enable);
>
> We usually move functions rather than forward declare them.

I agree, can you please re-spin.

[...]

Kind regards
Uffe
--
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/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index d96a057a7db8..b21008729aeb 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -36,6 +36,8 @@  struct sdhci_esdhc {
 	unsigned int peripheral_clock;
 };
 
+static void esdhc_clock_enable(struct sdhci_host *host, bool enable);
+
 /**
  * esdhc_read*_fixup - Fixup the value read from incompatible eSDHC register
  *		       to make it compatible with SD spec.
@@ -469,8 +471,10 @@  static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
 
 	host->mmc->actual_clock = 0;
 
-	if (clock == 0)
+	if (clock == 0) {
+		esdhc_clock_enable(host, false);
 		return;
+	}
 
 	/* Workaround to start pre_div at 2 for VNN < VENDOR_V_23 */
 	if (esdhc->vendor_ver < VENDOR_V_23)