[PATCH v2 3/3] mtd: spi-nand: macronix: Add randomizer support
Cheng Ming Lin
linchengming884 at gmail.com
Wed Sep 10 02:26:13 PDT 2025
Hi Miquel,
Miquel Raynal <miquel.raynal at bootlin.com> 於 2025年9月10日 週三 下午5:12寫道:
>
>
> > +static int macronix_set_randomizer(struct spinand_device *spinand)
> > +{
> > + struct spi_mem_op exec_op = SPINAND_PROG_EXEC_1S_1S_0_OP(0);
> > + struct nand_device *nand = spinand_to_nand(spinand);
> > + struct device_node *dn = nanddev_get_of_node(nand);
> > + int randopt, ret;
> > + u8 cfg, status;
> > +
> > + ret = spinand_read_reg_op(spinand, MACRONIX_FEATURE_ADDR_RANDOMIZER, &cfg);
> > + if (ret)
> > + return ret;
> > + if (cfg)
> > + return 0;
> > +
> > + cfg = MACRONIX_CFG_ENPGM | MACRONIX_CFG_RANDEN;
> > + randopt = of_property_read_bool(dn, "mxic,randopt");
>
> Isn't that a leftover?
The property "mxic,randopt" corresponds to bit2 of the configuration
register 0x10. Its purpose is to control whether the randomizer also
covers the initial portion of the spare area.
Since the randomizer feature is only documented in Macronix datasheets,
it is not clear whether the "randopt" bit is used by all vendors. For
this reason, the handling is placed inside macronix.c.
For reference, please see page 28 of the following document:
Link: https://www.mxic.com.tw/Lists/Datasheet/Attachments/9036/MX35LF4G24AD,%203V,%204Gb,%20v1.4.pdf
>
> Thanks,
> Miquèl
Thanks,
Cheng Ming Lin
More information about the linux-mtd
mailing list