[RFC PATCH] mtd: nand: raw: Add ONFI NAND unique id read support.
Zixun LI
admin at hifiphile.com
Fri Nov 7 15:35:01 CET 2025
Hi again,
I've managed to put this code inside BSP, this patch is no more needed as
there is no consumer.
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
More information about the U-Boot
mailing list