[PATCH v2 1/3] renesas: rcar3: Expose the board id in sysinfo
Detlev Casanova
detlev.casanova at collabora.com
Mon Jun 12 21:51:05 CEST 2023
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
-
/**
* 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:
+ *val = priv->board_id;
+ return 0;
+ default:
+ return -EINVAL;
+ };
+}
+
static int sysinfo_rcar_get_str(struct udevice *dev, int id, size_t size, char *val)
{
struct sysinfo_rcar_priv *priv = dev_get_priv(dev);
@@ -59,6 +62,7 @@ static int sysinfo_rcar_get_str(struct udevice *dev, int id, size_t size, char *
static const struct sysinfo_ops sysinfo_rcar_ops = {
.detect = sysinfo_rcar_detect,
.get_str = sysinfo_rcar_get_str,
+ .get_int = sysinfo_rcar_get_int,
};
static void sysinfo_rcar_parse(struct sysinfo_rcar_priv *priv)
@@ -68,6 +72,8 @@ static void sysinfo_rcar_parse(struct sysinfo_rcar_priv *priv)
bool salvator_xs = false;
bool ebisu_4d = false;
bool condor_i = false;
+
+ priv->board_id = board_id;
char rev_major = '?';
char rev_minor = '?';
--
2.39.3
More information about the U-Boot
mailing list