[U-Boot] [PATCH 1/5] i.MX6Q: icorem6: Add modeboot env via board_late_init

Jagan Teki jagannadh.teki at gmail.com
Tue Apr 25 18:34:51 UTC 2017


Hi Stefano,

On Mon, Apr 17, 2017 at 9:18 PM, Jagan Teki <jagannadh.teki at gmail.com> wrote:
> On Wed, Apr 12, 2017 at 9:27 PM, Stefano Babic <sbabic at denx.de> wrote:
>> On 07/04/2017 19:50, Jagan Teki wrote:
>>> Hi Stefano,
>>>
>>> On Mon, Mar 27, 2017 at 11:32 PM, Jagan Teki <jagan at openedev.com> wrote:
>>>> From: Jagan Teki <jagan at amarulasolutions.com>
>>>>
>>>> Add runtime, modeboot env which is setting mmcboot, or
>>>> nandboot based on the bootdevice so-that conditional
>>>> macros b/w MMC and NAND for CONFIG_BOOTCOMMAND should
>>>> be avoided in config files.
>>>>
>>>> Cc: Matteo Lisi <matteo.lisi at engicam.com>
>>>> Cc: Michael Trimarchi <michael at amarulasolutions.com>
>>>> Cc: Stefano Babic <sbabic at denx.de>
>>>> Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
>>>
>>> Can you take this series?
>>>
>>
>> I could take, but I am just asking if you do not find another way to
>> avoid code duplication. You have very similar boards, and code is simply
>> duplicated. Let's see Pathch 1/5 and Patch 3/5:
>>
>>
>> +int board_late_init(void)
>> +{
>> +       switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
>> +                       IMX6_BMODE_SHIFT) {
>> +       case IMX6_BMODE_SD:
>> +       case IMX6_BMODE_ESD:
>> +               setenv("modeboot", "mmcboot");
>> +               break;
>> +       case IMX6_BMODE_NAND:
>> +               setenv("modeboot", "nandboot");
>> +               break;
>> +       default:
>> +               setenv("modeboot", "");
>> +               break;
>> +       }
>> +
>> +       return 0;
>> +}
>>
>> And patch 3/5:
>>
>> +int board_late_init(void)
>> +{
>> +       switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
>> +                       IMX6_BMODE_SHIFT) {
>> +       case IMX6_BMODE_SD:
>> +       case IMX6_BMODE_ESD:
>> +               setenv("modeboot", "mmcboot");
>> +               break;
>> +       case IMX6_BMODE_NAND:
>> +               setenv("modeboot", "nandboot");
>> +               break;
>> +       default:
>> +               setenv("modeboot", "");
>> +               break;
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>>
>>
>> Why do you not use the same factorization as for Freescale's boards ? A
>> board/engicam/common could contain shared code, and you reuse it among
>> boards. The same for the default environment: it is duplicated again.
>
> Yes, I understand completely. will factorized the code in coming MW.

Any help?

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.


More information about the U-Boot mailing list