mtd: rawnand: Pass a nand_chip object to chip->erase()
Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one or remove the mtd_info object when both are passed. Let's tackle the chip->erase() hook. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
f1d46942e8
commit
a2098a9e4f
|
@ -915,9 +915,9 @@ static int denali_waitfunc(struct nand_chip *chip)
|
||||||
return irq_status & INTR__INT_ACT ? 0 : NAND_STATUS_FAIL;
|
return irq_status & INTR__INT_ACT ? 0 : NAND_STATUS_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int denali_erase(struct mtd_info *mtd, int page)
|
static int denali_erase(struct nand_chip *chip, int page)
|
||||||
{
|
{
|
||||||
struct denali_nand_info *denali = mtd_to_denali(mtd);
|
struct denali_nand_info *denali = mtd_to_denali(nand_to_mtd(chip));
|
||||||
uint32_t irq_status;
|
uint32_t irq_status;
|
||||||
|
|
||||||
denali_reset_irq(denali);
|
denali_reset_irq(denali);
|
||||||
|
|
|
@ -892,9 +892,9 @@ static int docg4_read_oob(struct nand_chip *nand, int page)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int docg4_erase_block(struct mtd_info *mtd, int page)
|
static int docg4_erase_block(struct nand_chip *nand, int page)
|
||||||
{
|
{
|
||||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(nand);
|
||||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||||
void __iomem *docptr = doc->virtadr;
|
void __iomem *docptr = doc->virtadr;
|
||||||
uint16_t g4_page;
|
uint16_t g4_page;
|
||||||
|
|
|
@ -4623,14 +4623,13 @@ out:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* single_erase - [GENERIC] NAND standard block erase command function
|
* single_erase - [GENERIC] NAND standard block erase command function
|
||||||
* @mtd: MTD device structure
|
* @chip: NAND chip object
|
||||||
* @page: the page address of the block which will be erased
|
* @page: the page address of the block which will be erased
|
||||||
*
|
*
|
||||||
* Standard erase command for NAND chips. Returns NAND status.
|
* Standard erase command for NAND chips. Returns NAND status.
|
||||||
*/
|
*/
|
||||||
static int single_erase(struct mtd_info *mtd, int page)
|
static int single_erase(struct nand_chip *chip, int page)
|
||||||
{
|
{
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
|
||||||
unsigned int eraseblock;
|
unsigned int eraseblock;
|
||||||
|
|
||||||
/* Send commands to erase a block */
|
/* Send commands to erase a block */
|
||||||
|
@ -4715,7 +4714,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
|
||||||
(page + pages_per_block))
|
(page + pages_per_block))
|
||||||
chip->pagebuf = -1;
|
chip->pagebuf = -1;
|
||||||
|
|
||||||
status = chip->erase(mtd, page & chip->pagemask);
|
status = chip->erase(chip, page & chip->pagemask);
|
||||||
|
|
||||||
/* See if block erase succeeded */
|
/* See if block erase succeeded */
|
||||||
if (status) {
|
if (status) {
|
||||||
|
|
|
@ -1298,7 +1298,7 @@ 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 mtd_info *mtd, int page);
|
int (*erase)(struct nand_chip *chip, int page);
|
||||||
int (*set_features)(struct mtd_info *mtd, struct nand_chip *chip,
|
int (*set_features)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
int feature_addr, uint8_t *subfeature_para);
|
int feature_addr, uint8_t *subfeature_para);
|
||||||
int (*get_features)(struct mtd_info *mtd, struct nand_chip *chip,
|
int (*get_features)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
|
|
Loading…
Reference in New Issue