[U-Boot] [PATCH] ARM: imx: fsl_esdhc: fix usage of low 4 bits of sysctl register

Hector Palacios
2015-12-04T18:51:28Z

Hi Eric,

On 12/04/2015 07:33 PM, Eric Nelson wrote:
> Hi Fabio and Hector,
>
> On 12/04/2015 10:43 AM, Eric Nelson wrote:
>> On 12/04/2015 10:38 AM, Eric Nelson wrote:
>>> On 12/04/2015 10:32 AM, Eric Nelson wrote:
>>>> The low four bits of the SYSCTL register are reserved on the USDHC
>>>> controller on i.MX6 and i.MX7 processors, but are used for clocking
>>>> operations on earlier models.
>>>>
>>>> Guard against their usage by hiding the bit mask macros on those
>>>> processors.
>>>>
>>>> These bits are used to prevent glitches when changing clocks on
>>>> i.MX35 et al. Use the RSTA bit instead for i.MX6 and i.MX7.
>>>>
>>>> From the i.MX6DQ RM:
>>>> To prevent possible glitch on the card clock, clear the
>>>> FRC_SDCLK_ON bit when changing clock divisor value(SDCLKFS
>>>> or DVS in System Control Register) or setting RSTA bit.
>>>>
>>>> Signed-off-by: Eric Nelson <eric@nelint.com>
>>>
>>> I forgot to add an in-reply-to header.
>>>
>>> http://lists.denx.de/pipermail/u-boot/2015-December/thread.html#236651
>>>
>>>
>>
>> Fabio, I haven't been able to reproduce the "mmc erase/ENGcm03648"
>> issue (with or without a code change) for a couple of hours now.
>>
>> Can you give this a spin?
>>
>> It seems unlikely to address the issue unless what we're seeing is a
>> side effect of a glitch while switching clocks.
>>
>>
>
> I switched back to a v2014.10 release and am able to reproduce the
> issue at will.
>
> The sysctl patch had no effect, but adding an #ifndef around the
> ENGcm03648 block allows things to proceed.
>
> +#ifndef CONFIG_FSL_USDHC
> /* Workaround for ESDHC errata ENGcm03648 */
> if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
> ...
>
> Since the need to poll the DAT0 line is only documented in the
> errata for the i.MX35, I wonder if this isn't the right thing to do.
>
> The CC bit of irqstat does indicate that the command completed
> and without error (I'm seeing values of 1 in irqstat).
>
> From what I can tell, the linux kernel doesn't do this test and
> doesn't appear to have any trouble.
>
> What code base are you running against (u-boot-imx/master)?

I'm running v2015.04 on a non-upstream platform.

> What do you see if you do the same?

The command takes a while and it is erasing all blocks.
I still get a timeout error at the end and a zero number of sectors, though.

=> mmc erase 441000 10000

MMC erase: dev # 0, block # 4460544, count 65536 ... Timeout waiting card ready
0 blocks erased: ERROR

but all blocks were erased correctly.

--
H?ctor Palacios