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>,
	Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH v5 6/6] sysinfo: rcar3: Implement BOARD_ID and BOARD_REV_*
Date: Mon, 16 Oct 2023 13:03:46 -0400	[thread overview]
Message-ID: <6050643.DvuYhMxLoT@arisu> (raw)
In-Reply-To: <affa00c1-b6ae-4ef0-9f5f-8a6d6d74d0d8@mailbox.org>

On Saturday, October 7, 2023 5:35:27 P.M. EDT Marek Vasut wrote:
> On 10/2/23 17:20, Detlev Casanova wrote:
> > Expose that information to the sysinfo command to let scripts make
> > decisions based on the board id and revision.
> > 
> > Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
> > ---
> > 
> >   drivers/sysinfo/rcar3.c | 89 +++++++++++++++++++++++++++++------------
> >   1 file changed, 63 insertions(+), 26 deletions(-)
> > 
> > diff --git a/drivers/sysinfo/rcar3.c b/drivers/sysinfo/rcar3.c
> > index 633e80bc19b..a554323506a 100644
> > --- a/drivers/sysinfo/rcar3.c
> > +++ b/drivers/sysinfo/rcar3.c
> > @@ -32,6 +32,10 @@
> > 
> >    */
> >   
> >   struct sysinfo_rcar_priv {
> >   
> >   	char	boardmodel[64];
> > 
> > +	u8	id;
> > +	u8	rev_major;
> > +	u8	rev_minor;
> > +	bool	has_rev;
> > 
> >   	u8	val;
> >   
> >   };
> > 
> > @@ -56,9 +60,33 @@ static int sysinfo_rcar_get_str(struct udevice *dev,
> > int id, size_t size, char *> 
> >   	};
> >   
> >   }
> > 
> > +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;
> > +	case SYSINFO_ID_BOARD_REV_MAJOR:
> > +		if (!priv->has_rev)
> > +			return -EINVAL;
> > +		*val = priv->rev_major;
> > +		return 0;
> > +	case SYSINFO_ID_BOARD_REV_MINOR:
> > +		if (!priv->has_rev)
> > +			return -EINVAL;
> > +		*val = priv->rev_minor;
> > +		return 0;
> > +	default:
> > +		return -EINVAL;
> > +	};
> > +}
> > +
> > 
> >   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)
> > 
> > @@ -69,8 +97,9 @@ static void sysinfo_rcar_parse(struct sysinfo_rcar_priv
> > *priv)> 
> >   	bool ebisu_4d = false;
> >   	bool condor_i = false;
> >   	char rev[4] = "?.?";
> > 
> > -	u8 rev_major = 0;
> > -	u8 rev_minor = 0;
> > +
> > +	priv->id = board_id;
> > +	priv->has_rev = false;
> 
> Would it make more sense to assign
> 
> priv->rev_major = 1;
> priv->rev_minor = 0;
> 
> And get rid of priv->has_rev entirely ?
> 
> Basically say that the default case is rev. 1.0 board.
> 
> [...]

I'm not really sure about this has it doesn't differentiate between rev 1.0 and 
unknown revision.




  reply	other threads:[~2023-10-16 17:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02 15:20 [PATCH v5 0/6] Introduce the sysinfo command Detlev Casanova
2023-10-02 15:20 ` [PATCH v5 1/6] sysinfo: Add IDs for board id and revision Detlev Casanova
2023-10-02 18:56   ` Simon Glass
2023-10-16 17:37   ` Heinrich Schuchardt
2023-10-16 18:11     ` Marek Vasut
2023-10-18 17:00     ` Detlev Casanova
2023-10-02 15:20 ` [PATCH v5 2/6] cmd: Add a sysinfo command Detlev Casanova
2023-10-02 18:56   ` Simon Glass
2023-10-16 14:21     ` Detlev Casanova
2023-10-16 21:54       ` Simon Glass
2023-10-02 15:20 ` [PATCH v5 3/6] sysinfo: Add a test Detlev Casanova
2023-10-02 18:56   ` Simon Glass
2023-10-02 15:20 ` [PATCH v5 4/6] sysinfo: Add documentation Detlev Casanova
2023-10-02 18:56   ` Simon Glass
2023-10-16 18:02   ` Heinrich Schuchardt
2023-10-02 15:20 ` [PATCH v5 5/6] sysinfo: rcar3: Use int instead of char for revision Detlev Casanova
2023-10-07 21:32   ` Marek Vasut
2023-10-02 15:20 ` [PATCH v5 6/6] sysinfo: rcar3: Implement BOARD_ID and BOARD_REV_* Detlev Casanova
2023-10-07 21:35   ` Marek Vasut
2023-10-16 17:03     ` Detlev Casanova [this message]
2023-10-16 18:12       ` Marek Vasut

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=6050643.DvuYhMxLoT@arisu \
    --to=detlev.casanova@collabora.com \
    --cc=hai.pham.ud@renesas.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=marek.vasut@mailbox.org \
    --cc=sjg@chromium.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.