[U-Boot] [PATCH v2 7/8] imx: mx6qpsabreauto: Add MX6QP SABREAUTO CPU3 board support

Stefano Babic sbabic at denx.de
Mon Jun 29 09:26:10 CEST 2015


Hi Peng,

On 29/06/2015 04:05, Peng Fan wrote:

>> To be sure I have not misunderstood the other patches: this is ok and
>> this is what I am expecting. Code checks the SOC and provides a
>> different action for QP or Quad or..
>>
>> But if some parts are defined at compile time, the check is losing its
>> original meaning and the behavior is already defined at build time.
> 
> is_mx6dqp is runtime checking, it's behavior is not defined at build time.
> There are some places which has the macro, #ifdef CONFIG_MX6QP, but all in
> header files, not in xx.c files.

Exactly, this is what I mean - here there is a runtime check, but this
can be vanified by some #ifdef in header.

>> The same here
> 
> Since this is board header files, different SOCs needs different dtbs.
> The behavior is defined at build time.

You're wrong. We accepted some code to detect at runtime which is the
correct DTB to be selected. In fact, one goal is to have a single kernel
as image, using the correct DTB to select the hardware.

This work if we have the same U-Boot is running on different SOC
variants. If U-Boot is hardcoded, why do we need to detect the right DTB
? It could be also hard-coded.

> I think it is not good to add
> such piece of code in board file:
> int board_late_init()
> {
> 	if (is_mx6dqp())
> 		setenv(fdt_file, "imx6qp-sabreauto.dtb") /* Just an example */

It must be checked if fdt_file is already set, because the customer can
decide to use its own, but well, yes, this is done by other boards -
check in code.

> }
> So I prefer to use "#if defined CONFIG_MX6QP" in board header file.

There is an important goal: having a single U-Boot image running on
boards that can have different (pin compatible) SOCs. We get this
managing the different layout of the IOMUXC, that was maybe the most
difficult part - why do we go back when we can't ?

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list