public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-esdhc-imx: Write only 4 bit in case of TIMEOUT_CONTROL
@ 2013-07-16  6:36 Dirk Behme
  2013-07-16  7:38 ` Shawn Guo
  0 siblings, 1 reply; 6+ messages in thread
From: Dirk Behme @ 2013-07-16  6:36 UTC (permalink / raw)
  To: linux-mmc; +Cc: Chris Ball, Shawn Guo, Dirk Behme

In case of SDHCI_TIMEOUT_CONTROL write only 4 bits and not the
whole byte to avoid touching other unrelated bits in the i.MX6
SYS_CTRL register. E.g. IPP_RST_N shouldn't be touched accidently.

Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 1dd5ba8..1af3a2a 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -362,6 +362,18 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
 
 		esdhc_clrset_le(host, mask, new_val, reg);
 		return;
+	case SDHCI_TIMEOUT_CONTROL:
+		/*
+		 * On i.MX6 the timeout value DTOCV is 4 bit large. Touch only
+		 * these 4 bits (lower nibble of the byte), but not the upper
+		 * nibble of the byte. The upper nibble of the byte contains
+		 * IPP_RST_N which should keep the reset value, i.e. 1, and
+		 * shouldn't be touched here.
+		 */
+		if (is_imx6q_usdhc(imx_data)) {
+			esdhc_clrset_le(host, 0x0f, val, reg);
+			return;
+		}
 	}
 	esdhc_clrset_le(host, 0xff, val, reg);
 
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: sdhci-esdhc-imx: Write only 4 bit in case of TIMEOUT_CONTROL
  2013-07-16  6:36 [PATCH] mmc: sdhci-esdhc-imx: Write only 4 bit in case of TIMEOUT_CONTROL Dirk Behme
@ 2013-07-16  7:38 ` Shawn Guo
  2013-11-01  6:31   ` Dirk Behme
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn Guo @ 2013-07-16  7:38 UTC (permalink / raw)
  To: Dirk Behme; +Cc: linux-mmc, Chris Ball

Hi Dirk,

On Tue, Jul 16, 2013 at 08:36:11AM +0200, Dirk Behme wrote:
> In case of SDHCI_TIMEOUT_CONTROL write only 4 bits and not the
> whole byte to avoid touching other unrelated bits in the i.MX6
> SYS_CTRL register. E.g. IPP_RST_N shouldn't be touched accidently.
> 
> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>

Acked-by: Shawn Guo <shawn.guo@linaro.org>

I'm wondering if it fixes any issue in real life?

Shawn

> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 1dd5ba8..1af3a2a 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -362,6 +362,18 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
>  
>  		esdhc_clrset_le(host, mask, new_val, reg);
>  		return;
> +	case SDHCI_TIMEOUT_CONTROL:
> +		/*
> +		 * On i.MX6 the timeout value DTOCV is 4 bit large. Touch only
> +		 * these 4 bits (lower nibble of the byte), but not the upper
> +		 * nibble of the byte. The upper nibble of the byte contains
> +		 * IPP_RST_N which should keep the reset value, i.e. 1, and
> +		 * shouldn't be touched here.
> +		 */
> +		if (is_imx6q_usdhc(imx_data)) {
> +			esdhc_clrset_le(host, 0x0f, val, reg);
> +			return;
> +		}
>  	}
>  	esdhc_clrset_le(host, 0xff, val, reg);
>  
> -- 
> 1.8.2
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: sdhci-esdhc-imx: Write only 4 bit in case of TIMEOUT_CONTROL
  2013-07-16  7:38 ` Shawn Guo
@ 2013-11-01  6:31   ` Dirk Behme
  2013-11-26 21:22     ` Chris Ball
  0 siblings, 1 reply; 6+ messages in thread
From: Dirk Behme @ 2013-11-01  6:31 UTC (permalink / raw)
  To: Shawn Guo, linux-mmc@vger.kernel.org, Chris Ball

On 16.07.2013 09:38, Shawn Guo wrote:
> Hi Dirk,
>
> On Tue, Jul 16, 2013 at 08:36:11AM +0200, Dirk Behme wrote:
>> In case of SDHCI_TIMEOUT_CONTROL write only 4 bits and not the
>> whole byte to avoid touching other unrelated bits in the i.MX6
>> SYS_CTRL register. E.g. IPP_RST_N shouldn't be touched accidently.
>>
>> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
>
> Acked-by: Shawn Guo <shawn.guo@linaro.org>

What's the status of this? I can't find it e.g. in linux-next?

Does anybody like to help to apply this?

Many thanks and best regards

Dirk

>> ---
>>   drivers/mmc/host/sdhci-esdhc-imx.c | 12 ++++++++++++
>>   1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
>> index 1dd5ba8..1af3a2a 100644
>> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>> @@ -362,6 +362,18 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
>>
>>   		esdhc_clrset_le(host, mask, new_val, reg);
>>   		return;
>> +	case SDHCI_TIMEOUT_CONTROL:
>> +		/*
>> +		 * On i.MX6 the timeout value DTOCV is 4 bit large. Touch only
>> +		 * these 4 bits (lower nibble of the byte), but not the upper
>> +		 * nibble of the byte. The upper nibble of the byte contains
>> +		 * IPP_RST_N which should keep the reset value, i.e. 1, and
>> +		 * shouldn't be touched here.
>> +		 */
>> +		if (is_imx6q_usdhc(imx_data)) {
>> +			esdhc_clrset_le(host, 0x0f, val, reg);
>> +			return;
>> +		}
>>   	}
>>   	esdhc_clrset_le(host, 0xff, val, reg);
>>
>> --
>> 1.8.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: sdhci-esdhc-imx: Write only 4 bit in case of TIMEOUT_CONTROL
  2013-11-01  6:31   ` Dirk Behme
@ 2013-11-26 21:22     ` Chris Ball
  2013-11-27  6:47       ` Dirk Behme
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Ball @ 2013-11-26 21:22 UTC (permalink / raw)
  To: Dirk Behme; +Cc: Shawn Guo, linux-mmc@vger.kernel.org

Hi Dirk,

On Fri, Nov 01 2013, Dirk Behme wrote:
> On 16.07.2013 09:38, Shawn Guo wrote:
>> Hi Dirk,
>>
>> On Tue, Jul 16, 2013 at 08:36:11AM +0200, Dirk Behme wrote:
>>> In case of SDHCI_TIMEOUT_CONTROL write only 4 bits and not the
>>> whole byte to avoid touching other unrelated bits in the i.MX6
>>> SYS_CTRL register. E.g. IPP_RST_N shouldn't be touched accidently.
>>>
>>> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
>>
>> Acked-by: Shawn Guo <shawn.guo@linaro.org>
>
> What's the status of this? I can't find it e.g. in linux-next?
>
> Does anybody like to help to apply this?

Looks like you didn't answer Shawn's question yet, could you please?

>> I'm wondering if it fixes any issue in real life?

Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: sdhci-esdhc-imx: Write only 4 bit in case of TIMEOUT_CONTROL
  2013-11-26 21:22     ` Chris Ball
@ 2013-11-27  6:47       ` Dirk Behme
  2013-11-28  2:21         ` Shawn Guo
  0 siblings, 1 reply; 6+ messages in thread
From: Dirk Behme @ 2013-11-27  6:47 UTC (permalink / raw)
  To: Chris Ball; +Cc: Shawn Guo, linux-mmc@vger.kernel.org

On 26.11.2013 22:22, Chris Ball wrote:
> Hi Dirk,
>
> On Fri, Nov 01 2013, Dirk Behme wrote:
>> On 16.07.2013 09:38, Shawn Guo wrote:
>>> Hi Dirk,
>>>
>>> On Tue, Jul 16, 2013 at 08:36:11AM +0200, Dirk Behme wrote:
>>>> In case of SDHCI_TIMEOUT_CONTROL write only 4 bits and not the
>>>> whole byte to avoid touching other unrelated bits in the i.MX6
>>>> SYS_CTRL register. E.g. IPP_RST_N shouldn't be touched accidently.
>>>>
>>>> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
>>>
>>> Acked-by: Shawn Guo <shawn.guo@linaro.org>
>>
>> What's the status of this? I can't find it e.g. in linux-next?
>>
>> Does anybody like to help to apply this?
>
> Looks like you didn't answer Shawn's question yet, could you please?
>
>>> I'm wondering if it fixes any issue in real life?

I wasn't aware that this questions blocks applying that patch. I think 
I've answered Shawn's question in a private mail: Using RST_N doesn't 
work if the controller's IPP_RST_N bit is touched accidentally, i.e. if 
a reset is asserted if it shouldn't.

Many thanks and best regards

Dirk











^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: sdhci-esdhc-imx: Write only 4 bit in case of TIMEOUT_CONTROL
  2013-11-27  6:47       ` Dirk Behme
@ 2013-11-28  2:21         ` Shawn Guo
  0 siblings, 0 replies; 6+ messages in thread
From: Shawn Guo @ 2013-11-28  2:21 UTC (permalink / raw)
  To: Dirk Behme; +Cc: Chris Ball, linux-mmc@vger.kernel.org

On Wed, Nov 27, 2013 at 07:47:39AM +0100, Dirk Behme wrote:
> >>>I'm wondering if it fixes any issue in real life?
> 
> I wasn't aware that this questions blocks applying that patch. I
> think I've answered Shawn's question in a private mail: Using RST_N
> doesn't work if the controller's IPP_RST_N bit is touched
> accidentally, i.e. if a reset is asserted if it shouldn't.

Yea, anyway, it fixes the code.

Shawn


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-28  2:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-16  6:36 [PATCH] mmc: sdhci-esdhc-imx: Write only 4 bit in case of TIMEOUT_CONTROL Dirk Behme
2013-07-16  7:38 ` Shawn Guo
2013-11-01  6:31   ` Dirk Behme
2013-11-26 21:22     ` Chris Ball
2013-11-27  6:47       ` Dirk Behme
2013-11-28  2:21         ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox