public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Detlev Casanova <detlev.casanova@collabora.com>
To: u-boot@lists.denx.de, Marek Vasut <marek.vasut@mailbox.org>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Hai Pham <hai.pham.ud@renesas.com>,
	Tam Nguyen <tam.nguyen.xa@renesas.com>
Subject: Re: [PATCH 2/2] renesas: rcar3: Load the correct device tree
Date: Mon, 12 Jun 2023 11:04:36 -0400	[thread overview]
Message-ID: <2183617.irdbgypaU6@arisu> (raw)
In-Reply-To: <be0ead29-acb4-034e-5aa9-bdbf55f6172d@mailbox.org>

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@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.



      reply	other threads:[~2023-06-12 15:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 16:00 [PATCH 0/2] rcar: Select the correct device tree Detlev Casanova
2023-06-09 16:00 ` [PATCH 1/2] renesas: rcar3: Expose the board id in sysinfo Detlev Casanova
2023-06-10 11:55   ` Marek Vasut
2023-06-09 16:00 ` [PATCH 2/2] renesas: rcar3: Load the correct device tree Detlev Casanova
2023-06-10 11:58   ` Marek Vasut
2023-06-12 15:04     ` Detlev Casanova [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2183617.irdbgypaU6@arisu \
    --to=detlev.casanova@collabora.com \
    --cc=hai.pham.ud@renesas.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=marek.vasut@mailbox.org \
    --cc=tam.nguyen.xa@renesas.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox