[PATCH] nvmem: rockchip-otp: implement SoC UID reading
Sascha Hauer
s.hauer at pengutronix.de
Wed Mar 18 03:32:33 PDT 2026
On Tue, Mar 17, 2026 at 10:44:32PM +0100, Marco Felsch wrote:
> Hi Sascha,
>
> On 26-03-17, Sascha Hauer wrote:
> > The Rockchip SoCs supported by the rockchip-otp driver have a SoC UID in
> > the OTP data. Read it out and forward it to barebox. The raw SoC UID
> > goes through some crc32 code before it is used. This is based on U-Boot
> > code which itself is based on the Rockchip Downstream Linux support.
> >
> > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > ---
> > drivers/nvmem/rockchip-otp.c | 54 ++++++++++++++++++++++++++++++++++--
> > 1 file changed, 51 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c
> > index d2145bba52..041d628480 100644
> > --- a/drivers/nvmem/rockchip-otp.c
> > +++ b/drivers/nvmem/rockchip-otp.c
> > @@ -9,6 +9,7 @@
> > #include <common.h>
> > #include <driver.h>
> > #include <init.h>
> > +#include <crc.h>
> > #include <of.h>
> > #include <of_device.h>
> > #include <linux/clk.h>
> > @@ -86,6 +87,7 @@ struct rockchip_data {
> > const char * const *clks;
> > int num_clks;
> > int (*reg_read)(void *ctx, unsigned int reg, void *val, size_t val_size);
> > + int cpuid_offset;
> ^
> Would be nice to have it as function hook, like the reg_read() in case
> RK SoCs find just another way to readout the ID in the future or the ID
> gets more bits (like NXP did for the i.MX8MP).
>
> In such cases the function hook is more future proof.
I think this is easy enough to refactor once we get in this situation
and once we really know in which way we have to adjust.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list