[PATCH v2 3/3] mtd: spi-nand: macronix: Add randomizer support
Miquel Raynal
miquel.raynal at bootlin.com
Wed Sep 10 02:43:14 PDT 2025
On 10/09/2025 at 17:26:13 +08, Cheng Ming Lin <linchengming884 at gmail.com> wrote:
> 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.
Do we need a DT property for that?
In any case, it must be declared in the bindings (which I do not think
it is?).
> 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.
Didn't we discuss in the past of a volatile version for SPI NAND
devices? I thought we could use a volatile approach instead.
Thanks,
Miquèl
More information about the linux-mtd
mailing list