[U-Boot] [PATCH v2 5/9] mx7: set soc environment according to exact SoC type

Stefan Agner stefan at agner.ch
Tue Jul 19 00:21:39 CEST 2016


On 2016-07-18 15:19, Fabio Estevam wrote:
> On Wed, Jul 13, 2016 at 4:25 AM, Stefan Agner <stefan at agner.ch> wrote:
>> From: Stefan Agner <stefan.agner at toradex.com>
>>
>> This can be useful if the same U-Boot binary is used for boards
>> available with a i.MX 7Solo and i.MX 7Dual.
>>
>> Signed-off-by: Stefan Agner <stefan.agner at toradex.com>
>> Reviewed-by: Simon Glass <sjg at chromium.org>
>> ---
>>
>>  arch/arm/cpu/armv7/mx7/soc.c | 14 ++++++++++++++
>>  include/configs/mx7_common.h |  2 ++
>>  2 files changed, 16 insertions(+)
>>
>> diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c
>> index ef46c92..dead1d3 100644
>> --- a/arch/arm/cpu/armv7/mx7/soc.c
>> +++ b/arch/arm/cpu/armv7/mx7/soc.c
>> @@ -248,6 +248,20 @@ int arch_cpu_init(void)
>>         return 0;
>>  }
>>
>> +#ifdef CONFIG_ARCH_MISC_INIT
>> +int arch_misc_init(void)
>> +{
>> +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
>> +       if (is_mx7d())
>> +               setenv("soc", "imx7d");
>> +       else
>> +               setenv("soc", "imx7s");
>> +#endif
>> +
>> +       return 0;
>> +}
>> +#endif
> 
> What about adding the following code in your board file?
> 
> int board_late_init(void)
> {
> #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
>     if (is_mx7d())
>         setenv("board_rev", "MX7D");
>     else
>         setenv("board_rev", "MX7S");
> #endif
> 
>     return 0;
> }
> 
> This was the suggestion I got from Tom when I was doing runtime SoC
> detection for mx6cubox.

I followed the runtime detection for Vybrid in:
arch/arm/cpu/armv7/vf610/generic.c

But sure, doing it at board level would be possible too.

Due to the similarity of i.MX 7Solo and 7Dual there will probably be
many board designs available in this two variants, hence I feel it would
be worthwhile to have it on arch level...

--
Stefan



More information about the U-Boot mailing list