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


Groups > linux.kernel > #1513331 > unrolled thread

[PATCH] sdhci-esdhc-imx: fix bus-width for 1-bit operation.

Started by"Leonardo G. Veiga" <leogveiga@gmail.com>
First post2016-11-01 17:10 +0100
Last post2016-11-02 21:10 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sdhci-esdhc-imx: fix bus-width for 1-bit operation. "Leonardo G. Veiga" <leogveiga@gmail.com> - 2016-11-01 17:10 +0100
    Re: [PATCH] sdhci-esdhc-imx: fix bus-width for 1-bit operation. Dong Aisheng <dongas86@gmail.com> - 2016-11-02 09:50 +0100
      Re: [PATCH] sdhci-esdhc-imx: fix bus-width for 1-bit operation. Stefan Agner <stefan@agner.ch> - 2016-11-02 17:50 +0100
    RE: [PATCH] sdhci-esdhc-imx: fix bus-width for 1-bit operation. Bough Chen <haibo.chen@nxp.com> - 2016-11-02 21:10 +0100

#1513331 — [PATCH] sdhci-esdhc-imx: fix bus-width for 1-bit operation.

From"Leonardo G. Veiga" <leogveiga@gmail.com>
Date2016-11-01 17:10 +0100
Subject[PATCH] sdhci-esdhc-imx: fix bus-width for 1-bit operation.
Message-ID<syJNo-2sA-15@gated-at.bofh.it>
From: Leonardo Graboski Veiga <leonardo.veiga@toradex.com>

The 1-bit operation mode, enabled by seeting the 'bus-width' property of
the device tree 'esdhc' node to <1>, not work while using SD card.

The behavior is only noticed when only the data pin 0 is connected to the
hardware. A series of kernel errors are printed to the console, all of them
returning the following error message followed by some explanation:
mmcblk0: error -84 transferring data

If four data lines are connected, it ignores the device-tree
property and works in 4-bit mode of operation without errors. The hardware
used for testing does not support 8-bit mode.

Check the 'bus-width' property and if set to <1>, enable the
SDHCI_QUIRK_FORCE_1_BIT_DATA quirk.

Signed-off-by: Leonardo Graboski Veiga <leonardo.veiga@toradex.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index c9fbc4c3..88d7d22 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1003,6 +1003,10 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
 		host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
 	}
 
+	if (!of_property_read_u32(np, "bus-width", &boarddata->max_bus_width)
+		&& boarddata->max_bus_width == 1)
+		host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
+
 	/* call to generic mmc_of_parse to support additional capabilities */
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-- 
2.7.4

[toc] | [next] | [standalone]


#1513747

FromDong Aisheng <dongas86@gmail.com>
Date2016-11-02 09:50 +0100
Message-ID<syZp8-3X5-17@gated-at.bofh.it>
In reply to#1513331
Hi Leonardo,

On Tue, Nov 1, 2016 at 11:58 PM, Leonardo G. Veiga <leogveiga@gmail.com> wrote:
> From: Leonardo Graboski Veiga <leonardo.veiga@toradex.com>
>
> The 1-bit operation mode, enabled by seeting the 'bus-width' property of
> the device tree 'esdhc' node to <1>, not work while using SD card.
>
> The behavior is only noticed when only the data pin 0 is connected to the
> hardware. A series of kernel errors are printed to the console, all of them
> returning the following error message followed by some explanation:
> mmcblk0: error -84 transferring data
>
> If four data lines are connected, it ignores the device-tree
> property and works in 4-bit mode of operation without errors. The hardware
> used for testing does not support 8-bit mode.
>
> Check the 'bus-width' property and if set to <1>, enable the
> SDHCI_QUIRK_FORCE_1_BIT_DATA quirk.
>
> Signed-off-by: Leonardo Graboski Veiga <leonardo.veiga@toradex.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index c9fbc4c3..88d7d22 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1003,6 +1003,10 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
>                 host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
>         }
>
> +       if (!of_property_read_u32(np, "bus-width", &boarddata->max_bus_width)
> +               && boarddata->max_bus_width == 1)
> +               host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
> +

This looks like a common SDHCI driver issue that it assumes the default
bus-width as 4 bit if no SDHCI_QUIRK_FORCE_1_BIT_DATA specified.
        if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
                mmc->caps |= MMC_CAP_4_BIT_DATA;

And I'm not sure Andrian or Ulf would like to see people keep using this quirk.
IMHO we probably could totally remove it since bus-width already tells
what the driver needs.

Andrian & Ulf,
Comments?

>         /* call to generic mmc_of_parse to support additional capabilities */
>         ret = mmc_of_parse(host->mmc);
>         if (ret)
> --
> 2.7.4
>

Regards
Dong Aisheng

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


#1513972

FromStefan Agner <stefan@agner.ch>
Date2016-11-02 17:50 +0100
Message-ID<sz6TE-jL-25@gated-at.bofh.it>
In reply to#1513747
On 2016-11-02 01:42, Dong Aisheng wrote:
> Hi Leonardo,
> 
> On Tue, Nov 1, 2016 at 11:58 PM, Leonardo G. Veiga <leogveiga@gmail.com> wrote:
>> From: Leonardo Graboski Veiga <leonardo.veiga@toradex.com>
>>
>> The 1-bit operation mode, enabled by seeting the 'bus-width' property of
>> the device tree 'esdhc' node to <1>, not work while using SD card.
>>
>> The behavior is only noticed when only the data pin 0 is connected to the
>> hardware. A series of kernel errors are printed to the console, all of them
>> returning the following error message followed by some explanation:
>> mmcblk0: error -84 transferring data
>>
>> If four data lines are connected, it ignores the device-tree
>> property and works in 4-bit mode of operation without errors. The hardware
>> used for testing does not support 8-bit mode.
>>
>> Check the 'bus-width' property and if set to <1>, enable the
>> SDHCI_QUIRK_FORCE_1_BIT_DATA quirk.
>>
>> Signed-off-by: Leonardo Graboski Veiga <leonardo.veiga@toradex.com>
>> ---
>>  drivers/mmc/host/sdhci-esdhc-imx.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
>> index c9fbc4c3..88d7d22 100644
>> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>> @@ -1003,6 +1003,10 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
>>                 host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
>>         }
>>
>> +       if (!of_property_read_u32(np, "bus-width", &boarddata->max_bus_width)
>> +               && boarddata->max_bus_width == 1)
>> +               host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
>> +
> 
> This looks like a common SDHCI driver issue that it assumes the default
> bus-width as 4 bit if no SDHCI_QUIRK_FORCE_1_BIT_DATA specified.
>         if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
>                 mmc->caps |= MMC_CAP_4_BIT_DATA;
> 
> And I'm not sure Andrian or Ulf would like to see people keep using this quirk.
> IMHO we probably could totally remove it since bus-width already tells
> what the driver needs.

Hm, I see what you are saying, the problem is that the core
(sdhci_setup_host) falls back to 4-bit if SDHCI_QUIRK_FORCE_1_BIT_DATA
is not set... Removing that should be fine for DT enabled SDHC drivers,
since mmc_of_parse sets MMC_CAP_4_BIT_DATA. But not sure about drivers
which parse dt on their own or still support platform data.... Those
might rely on MMC_CAP_4_BIT_DATA being set by default...

--
Stefan



> 
> Andrian & Ulf,
> Comments?
> 
>>         /* call to generic mmc_of_parse to support additional capabilities */
>>         ret = mmc_of_parse(host->mmc);
>>         if (ret)
>> --
>> 2.7.4
>>
> 
> Regards
> Dong Aisheng

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


#1514104

FromBough Chen <haibo.chen@nxp.com>
Date2016-11-02 21:10 +0100
Message-ID<sza1c-2sn-29@gated-at.bofh.it>
In reply to#1513331
+Aisheng.

Best Regards
Haibo Chen

> -----Original Message-----
> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
> owner@vger.kernel.org] On Behalf Of Leonardo G. Veiga
> Sent: Tuesday, November 01, 2016 11:58 PM
> To: ulf.hansson@linaro.org
> Cc: linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org;
> stefan@agner.ch; raul.munoz@toradex.com; leonardo.veiga@toradex.com
> Subject: [PATCH] sdhci-esdhc-imx: fix bus-width for 1-bit operation.
> 
> From: Leonardo Graboski Veiga <leonardo.veiga@toradex.com>
> 
> The 1-bit operation mode, enabled by seeting the 'bus-width' property of the
> device tree 'esdhc' node to <1>, not work while using SD card.
> 
> The behavior is only noticed when only the data pin 0 is connected to the
> hardware. A series of kernel errors are printed to the console, all of them
> returning the following error message followed by some explanation:
> mmcblk0: error -84 transferring data
> 
> If four data lines are connected, it ignores the device-tree property and works
> in 4-bit mode of operation without errors. The hardware used for testing does
> not support 8-bit mode.
> 
> Check the 'bus-width' property and if set to <1>, enable the
> SDHCI_QUIRK_FORCE_1_BIT_DATA quirk.
> 
> Signed-off-by: Leonardo Graboski Veiga <leonardo.veiga@toradex.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-
> esdhc-imx.c
> index c9fbc4c3..88d7d22 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1003,6 +1003,10 @@ sdhci_esdhc_imx_probe_dt(struct platform_device
> *pdev,
>  		host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
>  	}
> 
> +	if (!of_property_read_u32(np, "bus-width", &boarddata-
> >max_bus_width)
> +		&& boarddata->max_bus_width == 1)
> +		host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
> +
>  	/* call to generic mmc_of_parse to support additional capabilities */
>  	ret = mmc_of_parse(host->mmc);
>  	if (ret)
> --
> 2.7.4
> 
> --
> 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] | [standalone]


Back to top | Article view | linux.kernel


csiph-web