mtd: rawnand: Create a nand_chip operations structure
And move nand_chip hooks there. While moving entries from one structure to the other, adapt the documentation style. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-4-miquel.raynal@bootlin.com
This commit is contained in:
@@ -1027,16 +1027,31 @@ struct nand_legacy {
|
||||
struct nand_controller dummy_controller;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct nand_chip_ops - NAND chip operations
|
||||
* @suspend: Suspend operation
|
||||
* @resume: Resume operation
|
||||
* @lock_area: Lock operation
|
||||
* @unlock_area: Unlock operation
|
||||
* @setup_read_retry: Set the read-retry mode (mostly needed for MLC NANDs)
|
||||
*/
|
||||
struct nand_chip_ops {
|
||||
int (*suspend)(struct nand_chip *chip);
|
||||
void (*resume)(struct nand_chip *chip);
|
||||
int (*lock_area)(struct nand_chip *chip, loff_t ofs, uint64_t len);
|
||||
int (*unlock_area)(struct nand_chip *chip, loff_t ofs, uint64_t len);
|
||||
int (*setup_read_retry)(struct nand_chip *chip, int retry_mode);
|
||||
};
|
||||
|
||||
/**
|
||||
* struct nand_chip - NAND Private Flash Chip Data
|
||||
* @base: Inherit from the generic NAND device
|
||||
* @ops: NAND chip operations
|
||||
* @legacy: All legacy fields/hooks. If you develop a new driver,
|
||||
* don't even try to use any of these fields/hooks, and if
|
||||
* you're modifying an existing driver that is using those
|
||||
* fields/hooks, you should consider reworking the driver
|
||||
* avoid using them.
|
||||
* @setup_read_retry: [FLASHSPECIFIC] flash (vendor) specific function for
|
||||
* setting the read-retry mode. Mostly needed for MLC NAND.
|
||||
* @ecc: [BOARDSPECIFIC] ECC control structure
|
||||
* @buf_align: minimum buffer alignment required by a platform
|
||||
* @oob_poi: "poison value buffer," used for laying out OOB data
|
||||
@@ -1081,8 +1096,6 @@ struct nand_legacy {
|
||||
* @lock: lock protecting the suspended field. Also used to
|
||||
* serialize accesses to the NAND device.
|
||||
* @suspended: set to 1 when the device is suspended, 0 when it's not.
|
||||
* @suspend: [REPLACEABLE] specific NAND device suspend operation
|
||||
* @resume: [REPLACEABLE] specific NAND device resume operation
|
||||
* @bbt: [INTERN] bad block table pointer
|
||||
* @bbt_td: [REPLACEABLE] bad block table descriptor for flash
|
||||
* lookup.
|
||||
@@ -1096,17 +1109,13 @@ struct nand_legacy {
|
||||
* @manufacturer: [INTERN] Contains manufacturer information
|
||||
* @manufacturer.desc: [INTERN] Contains manufacturer's description
|
||||
* @manufacturer.priv: [INTERN] Contains manufacturer private information
|
||||
* @lock_area: [REPLACEABLE] specific NAND chip lock operation
|
||||
* @unlock_area: [REPLACEABLE] specific NAND chip unlock operation
|
||||
*/
|
||||
|
||||
struct nand_chip {
|
||||
struct nand_device base;
|
||||
|
||||
struct nand_chip_ops ops;
|
||||
struct nand_legacy legacy;
|
||||
|
||||
int (*setup_read_retry)(struct nand_chip *chip, int retry_mode);
|
||||
|
||||
unsigned int options;
|
||||
unsigned int bbt_options;
|
||||
|
||||
@@ -1138,8 +1147,6 @@ struct nand_chip {
|
||||
|
||||
struct mutex lock;
|
||||
unsigned int suspended : 1;
|
||||
int (*suspend)(struct nand_chip *chip);
|
||||
void (*resume)(struct nand_chip *chip);
|
||||
|
||||
u8 *oob_poi;
|
||||
struct nand_controller *controller;
|
||||
@@ -1159,9 +1166,6 @@ struct nand_chip {
|
||||
const struct nand_manufacturer *desc;
|
||||
void *priv;
|
||||
} manufacturer;
|
||||
|
||||
int (*lock_area)(struct nand_chip *chip, loff_t ofs, uint64_t len);
|
||||
int (*unlock_area)(struct nand_chip *chip, loff_t ofs, uint64_t len);
|
||||
};
|
||||
|
||||
extern const struct mtd_ooblayout_ops nand_ooblayout_sp_ops;
|
||||
|
Reference in New Issue
Block a user