[RFC PATCH] mtd: nand: raw: Add ONFI NAND unique id read support.
Michael Nazzareno Trimarchi
michael at amarulasolutions.com
Fri Nov 7 15:36:13 CET 2025
Hi
On Fri, Nov 7, 2025 at 3:35 PM Zixun LI <admin at hifiphile.com> wrote:
>
> Hi again,
>
> I've managed to put this code inside BSP, this patch is no more needed as
> there is no consumer.
>
Ok, that's better for now
Michael
> Zixun
>
> On Fri, Nov 7, 2025 at 1:35 PM Zixun LI <admin at hifiphile.com> wrote:
> >
> > Hi,
> >
> > The intended use is to allow BSP to have a unique serial number,
> > in our case it's something like this:
> >
> > int ft_board_setup(void *blob, struct bd_info *bd)
> > {
> > char strtemp[34];
> > uint8_t unique_id[16];
> > struct mtd_info *mtd;
> > struct nand_chip *chip;
> >
> > mtd = get_nand_dev_by_index(0);
> > if (!mtd)
> > return -EINVAL;
> >
> > chip = mtd_to_nand(mtd);
> >
> > if (nand_onfi_read_unique_id(chip, unique_id, sizeof(unique_id)))
> > memset(unique_id, 0, sizeof(unique_id));
> >
> > bin2hex(strtemp, unique_id, sizeof(unique_id));
> > strtemp[sizeof(unique_id) * 2] = '\0';
> >
> > fdt_find_and_setprop(blob, "/board", "nand-unique-id",
> > strtemp, strlen(strtemp), 1);
> > }
> >
> > Zixun
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael at amarulasolutions.com
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info at amarulasolutions.com
www.amarulasolutions.com
More information about the U-Boot
mailing list