mtd: rawnand: Deprecate ->erase()
The ->erase() hook have been overloaded by some drivers for bad reasons: either the driver was not fitting in the NAND framework and should have been an MTD driver (docg4), or the driver uses a specific path for the ERASE operation (denali), instead of implementing it generically. In any case, we should discourage people from overloading this method and encourage them to implement ->exec_op() instead. Move the ->erase() hook to the nand_legacy struct to make it clear. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
cdc784c743
commit
f9ebd1bb41
@ -1275,7 +1275,7 @@ static int denali_attach_chip(struct nand_chip *chip)
|
|||||||
chip->ecc.write_page_raw = denali_write_page_raw;
|
chip->ecc.write_page_raw = denali_write_page_raw;
|
||||||
chip->ecc.read_oob = denali_read_oob;
|
chip->ecc.read_oob = denali_read_oob;
|
||||||
chip->ecc.write_oob = denali_write_oob;
|
chip->ecc.write_oob = denali_write_oob;
|
||||||
chip->erase = denali_erase;
|
chip->legacy.erase = denali_erase;
|
||||||
|
|
||||||
ret = denali_multidev_fixup(denali);
|
ret = denali_multidev_fixup(denali);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -4730,7 +4730,11 @@ int nand_erase_nand(struct nand_chip *chip, struct erase_info *instr,
|
|||||||
(page + pages_per_block))
|
(page + pages_per_block))
|
||||||
chip->pagebuf = -1;
|
chip->pagebuf = -1;
|
||||||
|
|
||||||
status = chip->erase(chip, page & chip->pagemask);
|
if (chip->legacy.erase)
|
||||||
|
status = chip->legacy.erase(chip,
|
||||||
|
page & chip->pagemask);
|
||||||
|
else
|
||||||
|
status = single_erase(chip, page & chip->pagemask);
|
||||||
|
|
||||||
/* See if block erase succeeded */
|
/* See if block erase succeeded */
|
||||||
if (status) {
|
if (status) {
|
||||||
@ -5756,7 +5760,6 @@ ident_done:
|
|||||||
chip->options |= NAND_ROW_ADDR_3;
|
chip->options |= NAND_ROW_ADDR_3;
|
||||||
|
|
||||||
chip->badblockbits = 8;
|
chip->badblockbits = 8;
|
||||||
chip->erase = single_erase;
|
|
||||||
|
|
||||||
/* Do not replace user supplied command function! */
|
/* Do not replace user supplied command function! */
|
||||||
if (mtd->writesize > 512 && chip->legacy.cmdfunc == nand_command)
|
if (mtd->writesize > 512 && chip->legacy.cmdfunc == nand_command)
|
||||||
|
@ -1189,6 +1189,7 @@ int nand_op_parser_exec_op(struct nand_chip *chip,
|
|||||||
* @waitfunc: hardware specific function for wait on ready.
|
* @waitfunc: hardware specific function for wait on ready.
|
||||||
* @block_bad: check if a block is bad, using OOB markers
|
* @block_bad: check if a block is bad, using OOB markers
|
||||||
* @block_markbad: mark a block bad
|
* @block_markbad: mark a block bad
|
||||||
|
* @erase: erase function
|
||||||
*
|
*
|
||||||
* If you look at this structure you're already wrong. These fields/hooks are
|
* If you look at this structure you're already wrong. These fields/hooks are
|
||||||
* all deprecated.
|
* all deprecated.
|
||||||
@ -1207,6 +1208,7 @@ struct nand_legacy {
|
|||||||
int (*waitfunc)(struct nand_chip *chip);
|
int (*waitfunc)(struct nand_chip *chip);
|
||||||
int (*block_bad)(struct nand_chip *chip, loff_t ofs);
|
int (*block_bad)(struct nand_chip *chip, loff_t ofs);
|
||||||
int (*block_markbad)(struct nand_chip *chip, loff_t ofs);
|
int (*block_markbad)(struct nand_chip *chip, loff_t ofs);
|
||||||
|
int (*erase)(struct nand_chip *chip, int page);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1228,7 +1230,6 @@ struct nand_legacy {
|
|||||||
* @buf_align: minimum buffer alignment required by a platform
|
* @buf_align: minimum buffer alignment required by a platform
|
||||||
* @dummy_controller: dummy controller implementation for drivers that can
|
* @dummy_controller: dummy controller implementation for drivers that can
|
||||||
* only control a single chip
|
* only control a single chip
|
||||||
* @erase: [REPLACEABLE] erase function
|
|
||||||
* @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring
|
* @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring
|
||||||
* data from array to read regs (tR).
|
* data from array to read regs (tR).
|
||||||
* @state: [INTERN] the current state of the NAND device
|
* @state: [INTERN] the current state of the NAND device
|
||||||
@ -1308,7 +1309,6 @@ struct nand_chip {
|
|||||||
int (*exec_op)(struct nand_chip *chip,
|
int (*exec_op)(struct nand_chip *chip,
|
||||||
const struct nand_operation *op,
|
const struct nand_operation *op,
|
||||||
bool check_only);
|
bool check_only);
|
||||||
int (*erase)(struct nand_chip *chip, int page);
|
|
||||||
int (*set_features)(struct nand_chip *chip, int feature_addr,
|
int (*set_features)(struct nand_chip *chip, int feature_addr,
|
||||||
uint8_t *subfeature_para);
|
uint8_t *subfeature_para);
|
||||||
int (*get_features)(struct nand_chip *chip, int feature_addr,
|
int (*get_features)(struct nand_chip *chip, int feature_addr,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user