[PATCH] ARM: mx6: Add function to read UNIQUE_ID

Tom Rini trini at konsulko.com
Thu Feb 4 22:09:13 CET 2021


On Thu, Feb 04, 2021 at 03:56:23PM -0500, Sean Anderson wrote:
> 
> 
> On 2/4/21 3:52 PM, Heinrich Schuchardt wrote:
> > On 2/4/21 9:29 PM, Sean Anderson wrote:
> >> This is almost identical to the imx7 version, except that the register
> >> names are different.
> >>
> >> Signed-off-by: Sean Anderson <sean.anderson at seco.com>
> >
> > Hello Sean,
> >
> > I tried to understand where this serial number is ending up.

See common/fdt_support.c and fdt_root().  That's the common use and way
it's populated and passed on.

> > It seems to be used by the bootm command. But shouldn't we use it to
> > define environment variable #serial instead?
> 
> Yes. Typically boards will use get_board_serial to set serial#. For
> example, the warp7 board does
> 
> int board_late_init(void)
> {
> 	/* ... snip ... */
> 
> #ifdef CONFIG_SERIAL_TAG
> 	/* Set serial# standard environment variable based on OTP settings */
> 	get_board_serial(&serialnr);
> 	snprintf(serial_string, sizeof(serial_string), "WaRP7-0x%08x%08x",
> 		 serialnr.low, serialnr.high);
> 	env_set("serial#", serial_string);
> #endif
> 
> 	return 0;
> }
> 
> I would like to do the same on an i.MX6-based board.

Please note that the WaRP7 case of mixing the serial# with some other
string is not the common / best practices case.  It's typically just the
die-ID or similar value without other text around it, which makes for an
easy generic function.  The WaRP7 case makes it harder for imx7 to have
a generic everyone gets it populated function like imx6 could have with
your patch and a few changes, and like I want to go adjust the currently
unused imx8 code to do.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210204/0cc448ab/attachment.sig>


More information about the U-Boot mailing list