Re: [PATCH] mtd: nand: spi: rework detect procedure for different read id op

From: Boris Brezillon
Date: Thu Jan 09 2020 - 14:29:28 EST


On Thu, 9 Jan 2020 15:54:00 +0800
Chuanhong Guo <gch981213@xxxxxxxxx> wrote:

> @@ -215,15 +204,22 @@ struct spinand_manufacturer_ops {
> * struct spinand_manufacturer - SPI NAND manufacturer instance
> * @id: manufacturer ID
> * @name: manufacturer name
> + * @devid_len: number of bytes in device ID
> + * @spinand_table: array with info for spi nands under current manufacturer
> + * @nchips: number of chips available in spinand_table
> * @ops: manufacturer operations
> */
> struct spinand_manufacturer {
> u8 id;
> char *name;
> + u8 devid_len;

IIRC, some manufacturers support more than one scheme which means you
can't really take this decision at the manufacturer level. How about
adding a readid_method field to spinand_info?

enum spinand_readid_method {
SPINAND_READID_METHOD_OPCODE,
SPINAND_READID_METHOD_OPCODE_ADDR,
SPINAND_READID_METHOD_OPCODE_DUMMY,
};

> + const struct spinand_info *spinand_table;

s/spinand_table/chips/

> + size_t nchips;
> const struct spinand_manufacturer_ops *ops;
> };