[PATCH v1 3/4] sysinfo: rcar3: Implement BOARD_ID and BOARD_REVISION
Marek Vasut
marek.vasut at mailbox.org
Sat Jun 17 02:43:33 CEST 2023
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 at 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 ?
[...]
More information about the U-Boot
mailing list