[PATCH v2 1/3] renesas: rcar3: Expose the board id in sysinfo

Marek Vasut marek.vasut at mailbox.org
Wed Jun 14 15:47:16 CEST 2023


On 6/12/23 21:51, Detlev Casanova wrote:
> This is a preparation commit for selecting the correct device tree name
> to be loaded depending on the board id.
> 
> Signed-off-by: Detlev Casanova <detlev.casanova at collabora.com>
> ---
>   .../arm/mach-rmobile/include/mach/sys_proto.h | 15 ++++++++++
>   drivers/sysinfo/rcar3.c                       | 30 +++++++++++--------
>   2 files changed, 33 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/mach-rmobile/include/mach/sys_proto.h b/arch/arm/mach-rmobile/include/mach/sys_proto.h
> index ec8036a354c..e020b24f7c2 100644
> --- a/arch/arm/mach-rmobile/include/mach/sys_proto.h
> +++ b/arch/arm/mach-rmobile/include/mach/sys_proto.h
> @@ -7,4 +7,19 @@
>   #ifndef _SYS_PROTO_H_
>   #define _SYS_PROTO_H_
>   
> +/*
> + * Renesas R-Car Board IDs
> + */
> +#define BOARD_SALVATOR_X	0x0
> +#define BOARD_KRIEK		0x1
> +#define BOARD_STARTER_KIT	0x2
> +#define BOARD_EAGLE		0x3
> +#define BOARD_SALVATOR_XS	0x4
> +#define BOARD_CONDOR		0x6
> +#define BOARD_DRAAK		0x7
> +#define BOARD_EBISU		0x8
> +#define BOARD_STARTER_KIT_PRE	0xB
> +#define BOARD_EBISU_4D		0xD
> +#define BOARD_CONDOR_I		0x10
> +
>   #endif
> diff --git a/drivers/sysinfo/rcar3.c b/drivers/sysinfo/rcar3.c
> index 7b127986da7..b8b837341a2 100644
> --- a/drivers/sysinfo/rcar3.c
> +++ b/drivers/sysinfo/rcar3.c
> @@ -8,23 +8,12 @@
>   #include <i2c_eeprom.h>
>   #include <log.h>
>   #include <sysinfo.h>
> +#include <asm/arch/sys_proto.h>
>   
>   #define BOARD_CODE_MASK		0xF8
>   #define BOARD_REV_MASK		0x07
>   #define BOARD_CODE_SHIFT	0x03
>   
> -#define BOARD_SALVATOR_X	0x0
> -#define BOARD_KRIEK		0x1
> -#define BOARD_STARTER_KIT	0x2
> -#define BOARD_EAGLE		0x3
> -#define BOARD_SALVATOR_XS	0x4
> -#define BOARD_CONDOR		0x6
> -#define BOARD_DRAAK		0x7
> -#define BOARD_EBISU		0x8
> -#define BOARD_STARTER_KIT_PRE	0xB
> -#define BOARD_EBISU_4D		0xD
> -#define BOARD_CONDOR_I		0x10
> -

This part ^ should not be in this patch .
All this patch should do is expose the board ID .
Please split that into separate patch.

>   /**
>    * struct sysinfo_rcar_priv - sysinfo private data
>    * @boardname: board model and revision
> @@ -32,6 +21,7 @@
>    */
>   struct sysinfo_rcar_priv {
>   	char	boardmodel[64];
> +	u8	board_id;
>   	u8	val;
>   };
>   
> @@ -42,6 +32,19 @@ static int sysinfo_rcar_detect(struct udevice *dev)
>   	return priv->val == 0xff;
>   }
>   
> +static int sysinfo_rcar_get_int(struct udevice *dev, int id, int *val)
> +{
> +	struct sysinfo_rcar_priv *priv = dev_get_priv(dev);
> +
> +	switch (id) {
> +	case SYSINFO_ID_BOARD_MODEL:

The BOARD_MODEL is a string, please add another 'BOARD_ID' into 
include/sysinfo.h to discern the properties.

> +		*val = priv->board_id;
> +		return 0;
> +	default:
> +		return -EINVAL;
> +	};
> +}

[...]


More information about the U-Boot mailing list