Re: [PATCH v4 1/2] mtd: rawnand: Add support for Macronix NAND randomizer

From: Miquel Raynal
Date: Thu Jan 09 2020 - 11:51:14 EST


Hi Mason,

Mason Yang <masonccyang@xxxxxxxxxxx> wrote on Thu, 24 Oct 2019 15:40:06
+0800:

> Macronix NANDs support randomizer operation for user data scrambled,
> which can be enabled with a SET_FEATURE.
>
> User data written to the NAND device without randomizer is still readable
> after randomizer function enabled.
> The penalty of randomizer are subpage accesses prohibited and more time
> period is needed in program operation and entering deep power-down mode.
> i.e., tPROG 300us to 340us(randomizer enabled)
>
> For more high-reliability concern, if subpage write not available with
> hardware ECC and then to enable randomizer is recommended by default.
> Driver checks byte 167 of Vendor Blocks in ONFI parameter page table
> to see if this high-reliability function is supported. By adding a new
> specific DT property in children nodes to enable randomizer function.
>
> Signed-off-by: Mason Yang <masonccyang@xxxxxxxxxxx>
> ---
> drivers/mtd/nand/raw/nand_macronix.c | 69 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 69 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c
> index 58511ae..89101fa 100644
> --- a/drivers/mtd/nand/raw/nand_macronix.c
> +++ b/drivers/mtd/nand/raw/nand_macronix.c
> @@ -11,6 +11,14 @@
> #define MACRONIX_READ_RETRY_BIT BIT(0)
> #define MACRONIX_NUM_READ_RETRY_MODES 6
>
> +#define MACRONIX_RANDOMIZER_BIT BIT(1)
> +#define ONFI_FEATURE_ADDR_MXIC_RANDOMIZER 0xB0
> +#define ENPGM BIT(0)
> +#define RANDEN BIT(1)
> +#define RANDOPT BIT(2)

I forgot: please be consistent with the naming.

Thanks,
MiquÃl