[PATCH 2/2] renesas: rcar3: Load the correct device tree

Detlev Casanova detlev.casanova at collabora.com
Mon Jun 12 17:04:36 CEST 2023


On Saturday, June 10, 2023 7:58:35 A.M. EDT Marek Vasut wrote:
> On 6/9/23 18:00, Detlev Casanova wrote:
> > The Renesas R-Car Gen3 H3e (Starter Kit Premier) uses a different
> > device tree than the default one.
> > 
> > This uses the sysinfo's board id to determine if the board needs a
> > specific device tree.
> > 
> > Signed-off-by: Detlev Casanova <detlev.casanova at collabora.com>
> > ---
> > 
> >   board/renesas/ulcb/ulcb.c    | 34 ++++++++++++++++++++++++++++++++++
> >   configs/rcar3_ulcb_defconfig |  1 +
> >   2 files changed, 35 insertions(+)
> > 
> > diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c
> > index 1477750f921..3e2fe3a3ca9 100644
> > --- a/board/renesas/ulcb/ulcb.c
> > +++ b/board/renesas/ulcb/ulcb.c
> > @@ -28,6 +28,8 @@
> > 
> >   #include <i2c.h>
> >   #include <mmc.h>
> > 
> > +#include "../../../drivers/sysinfo/rcar3.h"
> > +
> > 
> >   DECLARE_GLOBAL_DATA_PTR;
> >   
> >   #define DVFS_MSTP926		BIT(26)
> > 
> > @@ -65,6 +67,38 @@ int board_init(void)
> > 
> >   	return 0;
> >   
> >   }
> > 
> > +int misc_init_r(void)
> > +{
> > +	struct udevice *dev;
> > +	int board_id;
> > +	int ret = sysinfo_get(&dev);
> > +        if (ret) {
> > +		debug("Cannot get sysinfo: %d\n", ret);
> > +		return 0;
> > +	}
> > +
> > +	ret = sysinfo_detect(dev);
> > +	if (ret) {
> > +		debug("Cannot detect sysinfo: %d\n", ret);
> > +		return 0;
> > +	}
> > +
> > +	ret = sysinfo_get_int(dev,
> > +		SYSINFO_ID_BOARD_MODEL,
> > +		&board_id);
> > +
> > +	if (ret) {
> > +		debug("Cannot get sysinfo int: %d\n", ret);
> > +		return 0;
> > +	}
> > +
> > +	if (board_id == BOARD_STARTER_KIT_PRE) {
> > +		env_set("fdtfile", "renesas/r8a779m1-ulcb.dtb");
> 
> About this, BOARD_STARTER_KIT_PRE is just H3 ULCB . I suspect the ID is
> the same on H3e ULCB ? I think we need some other method to discern the
> two board variants. Here is the sysinfo EEPROM from H3 ULCB:
> 
> CPU:   Renesas Electronics R8A7795 rev 2.0
> Model: Renesas Starter Kit Premier board rev 2.0
> DRAM:  896 MiB (effective 3.9 GiB)
> ...
> => i2c dev 7 ; i2c md 0x50 0 0x80
> Setting bus to 7
> 0000: 8e 17 52 5d e6 e6 b1 35 e4 e4 e4 e4 35 20 20 0a    ..R]...5....5  .
> 0010: f4 f4 44 44 f4 f4 44 44 44 44 f4 f4 f4 4f 01 52    ..DD..DDDD...O.R
> 0020: 52 52 52 53 51 4f 4d 01 52 53 60 00 00 00 00 00    RRRSQOM.RS`.....
> 0030: 00 00 11 00 01 2d ff ff ff ff ff ff ff ff ff ff    .....-..........
> 0040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
> 0050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
> 0060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
> 0070: 5a ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    Z...............
> 
> Can you dump and share the H3e ULCB EEPROM content ?

Indeed,  The board id will be the same for both H3 and H3e. The `val` changed 
from `5a` to `5b` at offset 0x70.

So I can probably also expose the rev_major and rev_minor through 
`sysinfo_get_int` to select the H3e specific device tree when rev_major == 3.

For reference:

CPU:   Renesas Electronics R8A7795 rev 3.0
Model: Renesas Starter Kit Premier board rev 2.1
DRAM:  896 MiB (effective 3.9 GiB)
[...]
=> i2c dev 7 ; i2c md 0x50 0 0x80
Setting bus to 7
0000: 8e 17 52 5d e6 e6 b1 35 e4 e4 e4 e4 35 20 20 0a    ..R]...5....5  .
0010: f4 f4 44 44 f4 f4 44 44 44 44 f4 f4 f4 4f 01 52    ..DD..DDDD...O.R
0020: 52 52 52 53 51 4f 4d 01 52 53 60 00 00 00 00 00    RRRSQOM.RS`.....
0030: 00 00 11 00 01 2d ff ff ff ff ff ff ff ff ff ff    .....-..........
0040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
0050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
0060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
0070: 5b ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    [...............


Detlev.




More information about the U-Boot mailing list