diff mbox

mmc: sdhci-of-esdhc: limit SD clock for ls1012a/ls1046a

Message ID 1492671509-22044-1-git-send-email-yangbo.lu@nxp.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Yangbo Lu April 20, 2017, 6:58 a.m. UTC
The ls1046a datasheet specified that the max SD clock frequency
for eSDHC SDR104/HS200 was 167MHz, and the ls1012a datasheet
specified it's 125MHz for ls1012a. So this patch is to add the
limitation.

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

Comments

Adrian Hunter April 25, 2017, 9:44 a.m. UTC | #1
On 20/04/17 09:58, Yangbo Lu wrote:
> The ls1046a datasheet specified that the max SD clock frequency
> for eSDHC SDR104/HS200 was 167MHz, and the ls1012a datasheet
> specified it's 125MHz for ls1012a. So this patch is to add the
> limitation.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

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

> ---
>  drivers/mmc/host/sdhci-of-esdhc.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 49ac197..57966ef 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -456,6 +456,20 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
>  	if (esdhc->vendor_ver < VENDOR_V_23)
>  		pre_div = 2;
>  
> +	/*
> +	 * Limit SD clock to 167MHz for ls1046a according to its datasheet
> +	 */
> +	if (clock > 167000000 &&
> +	    of_find_compatible_node(NULL, NULL, "fsl,ls1046a-esdhc"))
> +		clock = 167000000;
> +
> +	/*
> +	 * Limit SD clock to 125MHz for ls1012a according to its datasheet
> +	 */
> +	if (clock > 125000000 &&
> +	    of_find_compatible_node(NULL, NULL, "fsl,ls1012a-esdhc"))
> +		clock = 125000000;
> +
>  	/* Workaround to reduce the clock frequency for p1010 esdhc */
>  	if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) {
>  		if (clock > 20000000)
> 

--
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 April 28, 2017, 10:37 a.m. UTC | #2
On 20 April 2017 at 08:58, Yangbo Lu <yangbo.lu@nxp.com> wrote:
> The ls1046a datasheet specified that the max SD clock frequency
> for eSDHC SDR104/HS200 was 167MHz, and the ls1012a datasheet
> specified it's 125MHz for ls1012a. So this patch is to add the
> limitation.
>
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-of-esdhc.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 49ac197..57966ef 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -456,6 +456,20 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
>         if (esdhc->vendor_ver < VENDOR_V_23)
>                 pre_div = 2;
>
> +       /*
> +        * Limit SD clock to 167MHz for ls1046a according to its datasheet
> +        */
> +       if (clock > 167000000 &&
> +           of_find_compatible_node(NULL, NULL, "fsl,ls1046a-esdhc"))
> +               clock = 167000000;
> +
> +       /*
> +        * Limit SD clock to 125MHz for ls1012a according to its datasheet
> +        */
> +       if (clock > 125000000 &&
> +           of_find_compatible_node(NULL, NULL, "fsl,ls1012a-esdhc"))
> +               clock = 125000000;
> +
>         /* Workaround to reduce the clock frequency for p1010 esdhc */
>         if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) {
>                 if (clock > 20000000)
> --
> 2.1.0.27.g96db324
>
--
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 49ac197..57966ef 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -456,6 +456,20 @@  static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
 	if (esdhc->vendor_ver < VENDOR_V_23)
 		pre_div = 2;
 
+	/*
+	 * Limit SD clock to 167MHz for ls1046a according to its datasheet
+	 */
+	if (clock > 167000000 &&
+	    of_find_compatible_node(NULL, NULL, "fsl,ls1046a-esdhc"))
+		clock = 167000000;
+
+	/*
+	 * Limit SD clock to 125MHz for ls1012a according to its datasheet
+	 */
+	if (clock > 125000000 &&
+	    of_find_compatible_node(NULL, NULL, "fsl,ls1012a-esdhc"))
+		clock = 125000000;
+
 	/* Workaround to reduce the clock frequency for p1010 esdhc */
 	if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) {
 		if (clock > 20000000)