All of lore.kernel.org
 help / color / mirror / Atom feed
From: Detlev Casanova <detlev.casanova@collabora.com>
To: u-boot@lists.denx.de, Marek Vasut <marek.vasut@mailbox.org>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Hai Pham <hai.pham.ud@renesas.com>,
	Tam Nguyen <tam.nguyen.xa@renesas.com>
Subject: Re: [PATCH v1 3/4] sysinfo: rcar3: Implement BOARD_ID and BOARD_REVISION
Date: Mon, 19 Jun 2023 14:27:37 -0400	[thread overview]
Message-ID: <4842991.GXAFRqVoOG@arisu> (raw)
In-Reply-To: <33abeadc-14d0-267c-130e-224539383044@mailbox.org>

On Monday, June 19, 2023 12:11:18 P.M. EDT Marek Vasut wrote:
> 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.

Ok for this part, but shouldn't the sysinfo command use a common interface for 
all boards ? Or should it also have rev_major/rev_minor arguments ?



  reply	other threads:[~2023-06-19 18:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16 15:21 [PATCH v1 0/4] Introduce the sysinfo command Detlev Casanova
2023-06-16 15:21 ` [PATCH v1 1/4] sysinfo: Add IDs for board id and revision Detlev Casanova
2023-06-16 15:21 ` [PATCH v1 2/4] cmd: Add a sysinfo command Detlev Casanova
2023-06-17  0:41   ` Marek Vasut
2023-06-16 15:21 ` [PATCH v1 3/4] sysinfo: rcar3: Implement BOARD_ID and BOARD_REVISION Detlev Casanova
2023-06-17  0:43   ` Marek Vasut
2023-06-19 14:42     ` Detlev Casanova
2023-06-19 16:11       ` Marek Vasut
2023-06-19 18:27         ` Detlev Casanova [this message]
2023-06-19 21:54           ` Marek Vasut
2023-06-20 17:49             ` Detlev Casanova
2023-06-20 20:03               ` Marek Vasut
2023-06-20 20:40                 ` Detlev Casanova
2023-06-21  3:49                   ` Marek Vasut
2023-06-16 15:21 ` [PATCH v1 4/4] configs: rcar3: Add shell function to select the linux devicetree Detlev Casanova
2023-06-17  0:45   ` Marek Vasut
2023-06-19 14:45     ` Detlev Casanova

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4842991.GXAFRqVoOG@arisu \
    --to=detlev.casanova@collabora.com \
    --cc=hai.pham.ud@renesas.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=marek.vasut@mailbox.org \
    --cc=tam.nguyen.xa@renesas.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.