mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jules Maselbas <jmaselbas@zdiv.net>
To: barebox@lists.infradead.org, Sascha Hauer <sha@pengutronix.de>
Subject: Re: [PATCH 3/3] soc: kvx: Add board_sn global var from OTP
Date: Wed, 26 Jul 2023 21:00:44 +0200	[thread overview]
Message-ID: <B3F2512E-030D-4851-8703-B87A96234469@zdiv.net> (raw)
In-Reply-To: <20230726122638.GQ18491@pengutronix.de>



On July 26, 2023 2:26:38 PM GMT+02:00, Sascha Hauer <sha@pengutronix.de> wrote:
> On Tue, Jul 11, 2023 at 11:11:23AM +0200, Jules Maselbas wrote:
> > Add the magic variable "kvx.board_sn" that will reflect the board serial
> > number stored in OTP.
> > 
> > Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> > ---
> >  drivers/soc/kvx/kvx_socinfo.c | 33 ++++++++++++++++++++++++++++++++-
> >  1 file changed, 32 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/soc/kvx/kvx_socinfo.c b/drivers/soc/kvx/kvx_socinfo.c
> > index 496e817755..87c20c327b 100644
> > --- a/drivers/soc/kvx/kvx_socinfo.c
> > +++ b/drivers/soc/kvx/kvx_socinfo.c
> > @@ -33,9 +33,11 @@
> >  
> >  static char *kvx_mppa_id;
> >  static char *kvx_arch_rev;
> > +static char *kvx_board_sn;
> >  
> >  BAREBOX_MAGICVAR(kvx.arch_rev, "KVX architecture revision");
> >  BAREBOX_MAGICVAR(kvx.mppa_id, "KVX MPPA chip id");
> > +BAREBOX_MAGICVAR(kvx.board_sn, "KVX board sn");
> >  
> >  static void kvx_soc_info_read_revision(void)
> >  {
> > @@ -123,11 +125,40 @@ static int kvx_read_mppa_id(struct device_node *socinfo)
> >  	return 0;
> >  }
> >  
> > +static int kvx_read_board_sn(struct device_node *socinfo)
> > +{
> > +	struct nvmem_cell *cell;
> > +	size_t len;
> > +	char *sn;
> > +
> > +	cell = of_nvmem_cell_get(socinfo, "board_sn");
> > +	if (IS_ERR(cell)) {
> > +		pr_debug("Fail to get board_sn cell\n");
> > +		return PTR_ERR(cell);
> > +	}
> > +
> > +	sn = (char *)nvmem_cell_read(cell, &len);
> > +	nvmem_cell_put(cell);
> > +	if (IS_ERR(sn)) {
> > +		pr_debug("Fail to read board_sn\n");
> > +		return PTR_ERR(sn);
> > +	}
> > +
> > +	kvx_board_sn = xzalloc(len + 1);
> > +	memcpy(kvx_board_sn, sn, len);
> > +	globalvar_add_simple_string("kvx.board_sn", &kvx_board_sn);
> > +	free(sn);
> > +
> > +	return 0;
> > +}
> > +
> >  static int kvx_socinfo_probe(struct device *dev)
> >  {
> >  	kvx_soc_info_read_revision();
> >  
> > -	return kvx_read_serial(dev->of_node);
> > +	kvx_read_board_sn(dev->device_node);
> > +
> > +	return kvx_read_mppa_id(dev->device_node);
> >  }
> 
> Ah, ok. Here is the missing hunk from patch 1. I just fixed this up
> while applying.
Thanks

> 
> Sascha
> 



  reply	other threads:[~2023-07-26 19:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11  9:11 [PATCH 1/3] soc: kvx: Rename function to match global variable Jules Maselbas
2023-07-11  9:11 ` [PATCH 2/3] soc: kvx: Fix memory leaks Jules Maselbas
2023-07-11  9:11 ` [PATCH 3/3] soc: kvx: Add board_sn global var from OTP Jules Maselbas
2023-07-26 12:26   ` Sascha Hauer
2023-07-26 19:00     ` Jules Maselbas [this message]
2023-07-26 12:18 ` [PATCH 1/3] soc: kvx: Rename function to match global variable Sascha Hauer

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=B3F2512E-030D-4851-8703-B87A96234469@zdiv.net \
    --to=jmaselbas@zdiv.net \
    --cc=barebox@lists.infradead.org \
    --cc=sha@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox