[RFC PATCH] mtd: nand: raw: Add ONFI NAND unique id read support.

Zixun LI admin at hifiphile.com
Fri Nov 7 13:35:34 CET 2025


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

On Fri, Nov 7, 2025 at 11:45 AM Michael Nazzareno Trimarchi
<michael at amarulasolutions.com> wrote:
>
> Hi all
>
> On Fri, Nov 7, 2025 at 11:41 AM Eugen Hristev <eugen.hristev at linaro.org> wrote:
> >
> >
> > Something appears to be missing. Where is this function called ?
> >
>
> I prefer to apply if we have a use case and a consumer of this patch.
>
> Michael
>
> > Eugen>  #endif /* __LINUX_MTD_RAWNAND_H */
> >


More information about the U-Boot mailing list