
On 6/19/23 16:42, Detlev Casanova wrote:
On Friday, June 16, 2023 8:43:33 P.M. EDT Marek Vasut wrote:
On 6/16/23 17:21, Detlev Casanova wrote:
Expose that information to the command shell to let scripts select the correct devicetree name.
Signed-off-by: Detlev Casanova detlev.casanova@collabora.com
drivers/sysinfo/rcar3.c | 46 ++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/drivers/sysinfo/rcar3.c b/drivers/sysinfo/rcar3.c index 7b127986da7..89ad46c5422 100644 --- a/drivers/sysinfo/rcar3.c +++ b/drivers/sysinfo/rcar3.c @@ -32,6 +32,8 @@
*/
struct sysinfo_rcar_priv {
char boardmodel[64];
u8 id;
char revision[4];
u8 val;
};
@@ -48,17 +50,37 @@ static int sysinfo_rcar_get_str(struct udevice *dev, int id, size_t size, char *> switch (id) {
case SYSINFO_ID_BOARD_MODEL:
strncpy(val, priv->boardmodel, size);
val[size - 1] = '\0';
strlcpy(val, priv->boardmodel, size);
break;
- case SYSINFO_ID_BOARD_REVISION:
strlcpy(val, priv->revision, size);
break;
- default:
return -EINVAL;
- };
- val[size - 1] = '\0';
- return 0;
+}
+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_ID:
*val = priv->id; return 0;
Why not return SYSINFO_ID_BOARD_REVISION as integer here ?
Because the revision (on r-car3 boards at least) is in the format X.Y. It could be returned as "(X << 8) | Y" or split in major/minor. But different boards will use different revisions and I think that having a str is easier to deal with in a shell script.
With rcar they are numbers, so lets go with major/minor integers please.