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

Michael Trimarchi michael at amarulasolutions.com
Fri Dec 4 18:51:37 CET 2015


Hi

On Fri, Dec 4, 2015 at 6:49 PM, Eric Nelson <eric at nelint.com> wrote:
> Hi Michael,
>
> On 12/04/2015 10:40 AM, Michael Trimarchi wrote:
>> On Fri, Dec 4, 2015 at 6:32 PM, Eric Nelson <eric at nelint.com> wrote:
> ...
>
>>> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
>>> index c5054d6..1ccc576 100644
>>> --- a/drivers/mmc/fsl_esdhc.c
>>> +++ b/drivers/mmc/fsl_esdhc.c
>>> @@ -502,15 +502,22 @@ static void set_sysctl(struct mmc *mmc, uint clock)
>>>
>>>         clk = (pre_div << 8) | (div << 4);
>>>
>>> +#ifdef CONFIG_FSL_USDHC
>>> +       esdhc_setbits32(&regs->sysctl, SYSCTL_RSTA);
>>> +#else
>>>         esdhc_clrbits32(&regs->sysctl, SYSCTL_CKEN);
>>> +#endif
>>>
>>
>> I really prefer is_usdhc()
>>
>
> Am I overlooking something?
>
> I'm not seeing any such animal, and using a run-time test would prevent
> the compiler from catching the use of the bits below:
>

If you create a static inline with your define compiler should be optimized but
I think that result will be much clean

Michael

> ...
>
>>> diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h
>>> index aa1b4cf..a4b87ce 100644
>>> --- a/include/fsl_esdhc.h
>>> +++ b/include/fsl_esdhc.h
>>> @@ -25,10 +25,12 @@
>>>  #define SYSCTL_INITA           0x08000000
>>>  #define SYSCTL_TIMEOUT_MASK    0x000f0000
>>>  #define SYSCTL_CLOCK_MASK      0x0000fff0
>>> +#if !defined(CONFIG_MX6)
>>>  #define SYSCTL_CKEN            0x00000008
>>>  #define SYSCTL_PEREN           0x00000004
>>>  #define SYSCTL_HCKEN           0x00000002
>>>  #define SYSCTL_IPGEN           0x00000001
>>> +#endif
>
> Please advise,
>
>
> Eric



-- 
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |


More information about the U-Boot mailing list