diff mbox series

[v1,4/4] configs: rcar3: Add shell function to select the linux devicetree

Message ID 20230616152122.588168-5-detlev.casanova@collabora.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series Introduce the sysinfo command | expand

Commit Message

Detlev Casanova June 16, 2023, 3:21 p.m. UTC
This function uses the sysinfo command to determine which linux device
tree is selected for the running board.

Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
---
 configs/rcar3_ulcb_defconfig       | 1 +
 include/configs/rcar-gen3-common.h | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Marek Vasut June 17, 2023, 12:45 a.m. UTC | #1
On 6/16/23 17:21, Detlev Casanova wrote:
> This function uses the sysinfo command to determine which linux device
> tree is selected for the running board.
> 
> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
> ---
>   configs/rcar3_ulcb_defconfig       | 1 +
>   include/configs/rcar-gen3-common.h | 9 ++++++++-
>   2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/configs/rcar3_ulcb_defconfig b/configs/rcar3_ulcb_defconfig
> index b8fdb5e3826..bb5f8f742ea 100644
> --- a/configs/rcar3_ulcb_defconfig
> +++ b/configs/rcar3_ulcb_defconfig
> @@ -47,6 +47,7 @@ CONFIG_CMD_EXT4=y
>   CONFIG_CMD_EXT4_WRITE=y
>   CONFIG_CMD_FAT=y
>   CONFIG_CMD_FS_GENERIC=y
> +CONFIG_CMD_SYSINFO=y
>   CONFIG_OF_CONTROL=y
>   CONFIG_OF_LIST="r8a77950-ulcb-u-boot r8a77960-ulcb-u-boot r8a77965-ulcb-u-boot"
>   CONFIG_MULTI_DTB_FIT_LZO=y
> diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h
> index 213caa75238..b278eb85a81 100644
> --- a/include/configs/rcar-gen3-common.h
> +++ b/include/configs/rcar-gen3-common.h
> @@ -33,6 +33,13 @@
>   /* ENV setting */
>   
>   #define CFG_EXTRA_ENV_SETTINGS	\
> -	"bootm_size=0x10000000\0"
> +	"bootm_size=0x10000000\0"					\
> +	"set_board_fdt=sysinfo revision board_rev; "			\
> +	"sysinfo id board_id; "						\
> +	"if test ${board_rev} = 2.1 && test ${board_id} = 0x0b; then "	\
> +		"setenv fdtfile renesas/r8a779m1-ulcb.dtb; "		\
> +	"elif test ${board_rev} = 2.0 && test ${board_id} = 0x0b; then "\
> +		"setenv fdtfile renesas/r8a77951-ulcb.dtb; "		\
> +	"fi\0"								\

You must also consider M3W and M3N ULCB, i.e. 77960/77965 ones.

You must also consider all the other boards which use this header file, 
salvator-xs comes to mind. That one also comes with M3W/M3N SoC. Also, 
all the other Gen3 boards use this header, E3 Ebise, V3* Condor/Eagle ...
Detlev Casanova June 19, 2023, 2:45 p.m. UTC | #2
On Friday, June 16, 2023 8:45:31 P.M. EDT Marek Vasut wrote:
> On 6/16/23 17:21, Detlev Casanova wrote:
> > This function uses the sysinfo command to determine which linux device
> > tree is selected for the running board.
> > 
> > Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
> > ---
> > 
> >   configs/rcar3_ulcb_defconfig       | 1 +
> >   include/configs/rcar-gen3-common.h | 9 ++++++++-
> >   2 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/configs/rcar3_ulcb_defconfig b/configs/rcar3_ulcb_defconfig
> > index b8fdb5e3826..bb5f8f742ea 100644
> > --- a/configs/rcar3_ulcb_defconfig
> > +++ b/configs/rcar3_ulcb_defconfig
> > @@ -47,6 +47,7 @@ CONFIG_CMD_EXT4=y
> > 
> >   CONFIG_CMD_EXT4_WRITE=y
> >   CONFIG_CMD_FAT=y
> >   CONFIG_CMD_FS_GENERIC=y
> > 
> > +CONFIG_CMD_SYSINFO=y
> > 
> >   CONFIG_OF_CONTROL=y
> >   CONFIG_OF_LIST="r8a77950-ulcb-u-boot r8a77960-ulcb-u-boot
> >   r8a77965-ulcb-u-boot" CONFIG_MULTI_DTB_FIT_LZO=y
> > 
> > diff --git a/include/configs/rcar-gen3-common.h
> > b/include/configs/rcar-gen3-common.h index 213caa75238..b278eb85a81
> > 100644
> > --- a/include/configs/rcar-gen3-common.h
> > +++ b/include/configs/rcar-gen3-common.h
> > @@ -33,6 +33,13 @@
> > 
> >   /* ENV setting */
> >   
> >   #define CFG_EXTRA_ENV_SETTINGS	\
> > 
> > -	"bootm_size=0x10000000\0"
> > +	"bootm_size=0x10000000\0"				
	\
> > +	"set_board_fdt=sysinfo revision board_rev; "			
\
> > +	"sysinfo id board_id; "					
	\
> > +	"if test ${board_rev} = 2.1 && test ${board_id} = 0x0b; then "	
\
> > +		"setenv fdtfile renesas/r8a779m1-ulcb.dtb; "		
\
> > +	"elif test ${board_rev} = 2.0 && test ${board_id} = 0x0b; then "\
> > +		"setenv fdtfile renesas/r8a77951-ulcb.dtb; "		
\
> > +	"fi\0"						
		\
> 
> You must also consider M3W and M3N ULCB, i.e. 77960/77965 ones.
> 
> You must also consider all the other boards which use this header file,
> salvator-xs comes to mind. That one also comes with M3W/M3N SoC. Also,
> all the other Gen3 boards use this header, E3 Ebise, V3* Condor/Eagle ...

Yeah, that's why I'm not sure this function should be here. I don't have the 
boards to check the revision values.
diff mbox series

Patch

diff --git a/configs/rcar3_ulcb_defconfig b/configs/rcar3_ulcb_defconfig
index b8fdb5e3826..bb5f8f742ea 100644
--- a/configs/rcar3_ulcb_defconfig
+++ b/configs/rcar3_ulcb_defconfig
@@ -47,6 +47,7 @@  CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_SYSINFO=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIST="r8a77950-ulcb-u-boot r8a77960-ulcb-u-boot r8a77965-ulcb-u-boot"
 CONFIG_MULTI_DTB_FIT_LZO=y
diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h
index 213caa75238..b278eb85a81 100644
--- a/include/configs/rcar-gen3-common.h
+++ b/include/configs/rcar-gen3-common.h
@@ -33,6 +33,13 @@ 
 /* ENV setting */
 
 #define CFG_EXTRA_ENV_SETTINGS	\
-	"bootm_size=0x10000000\0"
+	"bootm_size=0x10000000\0"					\
+	"set_board_fdt=sysinfo revision board_rev; "			\
+	"sysinfo id board_id; "						\
+	"if test ${board_rev} = 2.1 && test ${board_id} = 0x0b; then "	\
+		"setenv fdtfile renesas/r8a779m1-ulcb.dtb; "		\
+	"elif test ${board_rev} = 2.0 && test ${board_id} = 0x0b; then "\
+		"setenv fdtfile renesas/r8a77951-ulcb.dtb; "		\
+	"fi\0"								\
 
 #endif	/* __RCAR_GEN3_COMMON_H */