mtd: rawnand: Pass a nand_chip object to chip->cmdfunc()
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->cmdfunc() 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
50a487e771
commit
5295cf2e04
|
@ -236,14 +236,15 @@ static void au1550_select_chip(struct nand_chip *this, int chip)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* au1550_command - Send command to NAND device
|
* au1550_command - Send command to NAND device
|
||||||
* @mtd: MTD device structure
|
* @this: NAND chip object
|
||||||
* @command: the command to be sent
|
* @command: the command to be sent
|
||||||
* @column: the column address for this command, -1 if none
|
* @column: the column address for this command, -1 if none
|
||||||
* @page_addr: the page address for this command, -1 if none
|
* @page_addr: the page address for this command, -1 if none
|
||||||
*/
|
*/
|
||||||
static void au1550_command(struct mtd_info *mtd, unsigned command, int column, int page_addr)
|
static void au1550_command(struct nand_chip *this, unsigned command,
|
||||||
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
struct nand_chip *this = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(this);
|
||||||
struct au1550nd_ctx *ctx = container_of(this, struct au1550nd_ctx,
|
struct au1550nd_ctx *ctx = container_of(this, struct au1550nd_ctx,
|
||||||
chip);
|
chip);
|
||||||
int ce_override = 0, i;
|
int ce_override = 0, i;
|
||||||
|
|
|
@ -210,11 +210,11 @@ static int bcm47xxnflash_ops_bcm4706_dev_ready(struct nand_chip *nand_chip)
|
||||||
* registers of ChipCommon core. Hacking cmd_ctrl to understand and convert
|
* registers of ChipCommon core. Hacking cmd_ctrl to understand and convert
|
||||||
* standard commands would be much more complicated.
|
* standard commands would be much more complicated.
|
||||||
*/
|
*/
|
||||||
static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd,
|
static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct nand_chip *nand_chip,
|
||||||
unsigned command, int column,
|
unsigned command, int column,
|
||||||
int page_addr)
|
int page_addr)
|
||||||
{
|
{
|
||||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(nand_chip);
|
||||||
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
|
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
|
||||||
struct bcma_drv_cc *cc = b47n->cc;
|
struct bcma_drv_cc *cc = b47n->cc;
|
||||||
u32 ctlcode;
|
u32 ctlcode;
|
||||||
|
|
|
@ -1310,10 +1310,10 @@ static int brcmnand_low_level_op(struct brcmnand_host *host,
|
||||||
return brcmnand_waitfunc(mtd, chip);
|
return brcmnand_waitfunc(mtd, chip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void brcmnand_cmdfunc(struct mtd_info *mtd, unsigned command,
|
static void brcmnand_cmdfunc(struct nand_chip *chip, unsigned command,
|
||||||
int column, int page_addr)
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||||
struct brcmnand_controller *ctrl = host->ctrl;
|
struct brcmnand_controller *ctrl = host->ctrl;
|
||||||
u64 addr = (u64)page_addr << chip->page_shift;
|
u64 addr = (u64)page_addr << chip->page_shift;
|
||||||
|
|
|
@ -156,10 +156,10 @@ static uint8_t cafe_read_byte(struct nand_chip *chip)
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
|
static void cafe_nand_cmdfunc(struct nand_chip *chip, unsigned command,
|
||||||
int column, int page_addr)
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||||
int adrbytes = 0;
|
int adrbytes = 0;
|
||||||
uint32_t ctl1;
|
uint32_t ctl1;
|
||||||
|
|
|
@ -637,9 +637,10 @@ static void doc200x_hwcontrol(struct nand_chip *this, int cmd,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doc2001plus_command(struct mtd_info *mtd, unsigned command, int column, int page_addr)
|
static void doc2001plus_command(struct nand_chip *this, unsigned command,
|
||||||
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
struct nand_chip *this = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(this);
|
||||||
struct doc_priv *doc = nand_get_controller_data(this);
|
struct doc_priv *doc = nand_get_controller_data(this);
|
||||||
void __iomem *docptr = doc->virtadr;
|
void __iomem *docptr = doc->virtadr;
|
||||||
|
|
||||||
|
|
|
@ -705,12 +705,12 @@ static uint32_t mtd_to_docg4_address(int page, int column)
|
||||||
return (g4_page << 16) | g4_index; /* pack */
|
return (g4_page << 16) | g4_index; /* pack */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void docg4_command(struct mtd_info *mtd, unsigned command, int column,
|
static void docg4_command(struct nand_chip *nand, unsigned command, int column,
|
||||||
int page_addr)
|
int page_addr)
|
||||||
{
|
{
|
||||||
/* handle standard nand commands */
|
/* handle standard nand commands */
|
||||||
|
|
||||||
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);
|
||||||
uint32_t g4_addr = mtd_to_docg4_address(page_addr, column);
|
uint32_t g4_addr = mtd_to_docg4_address(page_addr, column);
|
||||||
|
|
||||||
|
|
|
@ -317,10 +317,10 @@ static void fsl_elbc_do_read(struct nand_chip *chip, int oob)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cmdfunc send commands to the FCM */
|
/* cmdfunc send commands to the FCM */
|
||||||
static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
|
static void fsl_elbc_cmdfunc(struct nand_chip *chip, unsigned int command,
|
||||||
int column, int page_addr)
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||||
struct fsl_lbc_ctrl *ctrl = priv->ctrl;
|
struct fsl_lbc_ctrl *ctrl = priv->ctrl;
|
||||||
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = ctrl->nand;
|
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = ctrl->nand;
|
||||||
|
|
|
@ -301,9 +301,9 @@ static void fsl_ifc_do_read(struct nand_chip *chip,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cmdfunc send commands to the IFC NAND Machine */
|
/* cmdfunc send commands to the IFC NAND Machine */
|
||||||
static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
|
static void fsl_ifc_cmdfunc(struct nand_chip *chip, unsigned int command,
|
||||||
int column, int page_addr) {
|
int column, int page_addr) {
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||||
struct fsl_ifc_ctrl *ctrl = priv->ctrl;
|
struct fsl_ifc_ctrl *ctrl = priv->ctrl;
|
||||||
struct fsl_ifc_runtime __iomem *ifc = ctrl->rregs;
|
struct fsl_ifc_runtime __iomem *ifc = ctrl->rregs;
|
||||||
|
|
|
@ -429,10 +429,10 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hisi_nfc_cmdfunc(struct mtd_info *mtd, unsigned command, int column,
|
static void hisi_nfc_cmdfunc(struct nand_chip *chip, unsigned command,
|
||||||
int page_addr)
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
struct hinfc_host *host = nand_get_controller_data(chip);
|
struct hinfc_host *host = nand_get_controller_data(chip);
|
||||||
int is_cache_invalid = 1;
|
int is_cache_invalid = 1;
|
||||||
unsigned int flag = 0;
|
unsigned int flag = 0;
|
||||||
|
|
|
@ -330,10 +330,10 @@ static int mpc5121_nfc_dev_ready(struct nand_chip *nand)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write command to NAND flash */
|
/* Write command to NAND flash */
|
||||||
static void mpc5121_nfc_command(struct mtd_info *mtd, unsigned command,
|
static void mpc5121_nfc_command(struct nand_chip *chip, unsigned command,
|
||||||
int column, int page)
|
int column, int page)
|
||||||
{
|
{
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
||||||
|
|
||||||
prv->column = (column >= 0) ? column : 0;
|
prv->column = (column >= 0) ? column : 0;
|
||||||
|
@ -364,7 +364,7 @@ static void mpc5121_nfc_command(struct mtd_info *mtd, unsigned command,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAND_CMD_SEQIN:
|
case NAND_CMD_SEQIN:
|
||||||
mpc5121_nfc_command(mtd, NAND_CMD_READ0, column, page);
|
mpc5121_nfc_command(chip, NAND_CMD_READ0, column, page);
|
||||||
column = 0;
|
column = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1333,10 +1333,10 @@ static void preset_v3(struct mtd_info *mtd)
|
||||||
|
|
||||||
/* Used by the upper layer to write command to NAND Flash for
|
/* Used by the upper layer to write command to NAND Flash for
|
||||||
* different operations to be carried out on NAND Flash */
|
* different operations to be carried out on NAND Flash */
|
||||||
static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
|
static void mxc_nand_command(struct nand_chip *nand_chip, unsigned command,
|
||||||
int column, int page_addr)
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(nand_chip);
|
||||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||||
|
|
||||||
dev_dbg(host->dev, "mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n",
|
dev_dbg(host->dev, "mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n",
|
||||||
|
|
|
@ -730,7 +730,7 @@ EXPORT_SYMBOL_GPL(nand_soft_waitrdy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nand_command - [DEFAULT] Send command to NAND device
|
* nand_command - [DEFAULT] Send command to NAND device
|
||||||
* @mtd: MTD device structure
|
* @chip: NAND chip object
|
||||||
* @command: the command to be sent
|
* @command: the command to be sent
|
||||||
* @column: the column address for this command, -1 if none
|
* @column: the column address for this command, -1 if none
|
||||||
* @page_addr: the page address for this command, -1 if none
|
* @page_addr: the page address for this command, -1 if none
|
||||||
|
@ -738,10 +738,10 @@ EXPORT_SYMBOL_GPL(nand_soft_waitrdy);
|
||||||
* Send command to NAND device. This function is used for small page devices
|
* Send command to NAND device. This function is used for small page devices
|
||||||
* (512 Bytes per page).
|
* (512 Bytes per page).
|
||||||
*/
|
*/
|
||||||
static void nand_command(struct mtd_info *mtd, unsigned int command,
|
static void nand_command(struct nand_chip *chip, unsigned int command,
|
||||||
int column, int page_addr)
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
register struct nand_chip *chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
int ctrl = NAND_CTRL_CLE | NAND_CTRL_CHANGE;
|
int ctrl = NAND_CTRL_CLE | NAND_CTRL_CHANGE;
|
||||||
|
|
||||||
/* Write out the command to the device */
|
/* Write out the command to the device */
|
||||||
|
@ -864,7 +864,7 @@ static void nand_ccs_delay(struct nand_chip *chip)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nand_command_lp - [DEFAULT] Send command to NAND large page device
|
* nand_command_lp - [DEFAULT] Send command to NAND large page device
|
||||||
* @mtd: MTD device structure
|
* @chip: NAND chip object
|
||||||
* @command: the command to be sent
|
* @command: the command to be sent
|
||||||
* @column: the column address for this command, -1 if none
|
* @column: the column address for this command, -1 if none
|
||||||
* @page_addr: the page address for this command, -1 if none
|
* @page_addr: the page address for this command, -1 if none
|
||||||
|
@ -873,10 +873,10 @@ static void nand_ccs_delay(struct nand_chip *chip)
|
||||||
* devices. We don't have the separate regions as we have in the small page
|
* devices. We don't have the separate regions as we have in the small page
|
||||||
* devices. We must emulate NAND_CMD_READOOB to keep the code compatible.
|
* devices. We must emulate NAND_CMD_READOOB to keep the code compatible.
|
||||||
*/
|
*/
|
||||||
static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
|
static void nand_command_lp(struct nand_chip *chip, unsigned int command,
|
||||||
int column, int page_addr)
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
register struct nand_chip *chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
|
|
||||||
/* Emulate NAND_CMD_READOOB */
|
/* Emulate NAND_CMD_READOOB */
|
||||||
if (command == NAND_CMD_READOOB) {
|
if (command == NAND_CMD_READOOB) {
|
||||||
|
@ -1530,7 +1530,7 @@ int nand_read_page_op(struct nand_chip *chip, unsigned int page,
|
||||||
buf, len);
|
buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_READ0, offset_in_page, page);
|
chip->cmdfunc(chip, NAND_CMD_READ0, offset_in_page, page);
|
||||||
if (len)
|
if (len)
|
||||||
chip->read_buf(chip, buf, len);
|
chip->read_buf(chip, buf, len);
|
||||||
|
|
||||||
|
@ -1579,7 +1579,7 @@ static int nand_read_param_page_op(struct nand_chip *chip, u8 page, void *buf,
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_PARAM, page, -1);
|
chip->cmdfunc(chip, NAND_CMD_PARAM, page, -1);
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
p[i] = chip->read_byte(chip);
|
p[i] = chip->read_byte(chip);
|
||||||
|
|
||||||
|
@ -1642,7 +1642,7 @@ int nand_change_read_column_op(struct nand_chip *chip,
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, offset_in_page, -1);
|
chip->cmdfunc(chip, NAND_CMD_RNDOUT, offset_in_page, -1);
|
||||||
if (len)
|
if (len)
|
||||||
chip->read_buf(chip, buf, len);
|
chip->read_buf(chip, buf, len);
|
||||||
|
|
||||||
|
@ -1679,7 +1679,7 @@ int nand_read_oob_op(struct nand_chip *chip, unsigned int page,
|
||||||
mtd->writesize + offset_in_oob,
|
mtd->writesize + offset_in_oob,
|
||||||
buf, len);
|
buf, len);
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_READOOB, offset_in_oob, page);
|
chip->cmdfunc(chip, NAND_CMD_READOOB, offset_in_oob, page);
|
||||||
if (len)
|
if (len)
|
||||||
chip->read_buf(chip, buf, len);
|
chip->read_buf(chip, buf, len);
|
||||||
|
|
||||||
|
@ -1791,7 +1791,7 @@ int nand_prog_page_begin_op(struct nand_chip *chip, unsigned int page,
|
||||||
return nand_exec_prog_page_op(chip, page, offset_in_page, buf,
|
return nand_exec_prog_page_op(chip, page, offset_in_page, buf,
|
||||||
len, false);
|
len, false);
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_SEQIN, offset_in_page, page);
|
chip->cmdfunc(chip, NAND_CMD_SEQIN, offset_in_page, page);
|
||||||
|
|
||||||
if (buf)
|
if (buf)
|
||||||
chip->write_buf(chip, buf, len);
|
chip->write_buf(chip, buf, len);
|
||||||
|
@ -1833,7 +1833,7 @@ int nand_prog_page_end_op(struct nand_chip *chip)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
|
chip->cmdfunc(chip, NAND_CMD_PAGEPROG, -1, -1);
|
||||||
ret = chip->waitfunc(mtd, chip);
|
ret = chip->waitfunc(mtd, chip);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1878,9 +1878,9 @@ int nand_prog_page_op(struct nand_chip *chip, unsigned int page,
|
||||||
status = nand_exec_prog_page_op(chip, page, offset_in_page, buf,
|
status = nand_exec_prog_page_op(chip, page, offset_in_page, buf,
|
||||||
len, true);
|
len, true);
|
||||||
} else {
|
} else {
|
||||||
chip->cmdfunc(mtd, NAND_CMD_SEQIN, offset_in_page, page);
|
chip->cmdfunc(chip, NAND_CMD_SEQIN, offset_in_page, page);
|
||||||
chip->write_buf(chip, buf, len);
|
chip->write_buf(chip, buf, len);
|
||||||
chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
|
chip->cmdfunc(chip, NAND_CMD_PAGEPROG, -1, -1);
|
||||||
status = chip->waitfunc(mtd, chip);
|
status = chip->waitfunc(mtd, chip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1946,7 +1946,7 @@ int nand_change_write_column_op(struct nand_chip *chip,
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset_in_page, -1);
|
chip->cmdfunc(chip, NAND_CMD_RNDIN, offset_in_page, -1);
|
||||||
if (len)
|
if (len)
|
||||||
chip->write_buf(chip, buf, len);
|
chip->write_buf(chip, buf, len);
|
||||||
|
|
||||||
|
@ -1994,7 +1994,7 @@ int nand_readid_op(struct nand_chip *chip, u8 addr, void *buf,
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_READID, addr, -1);
|
chip->cmdfunc(chip, NAND_CMD_READID, addr, -1);
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
id[i] = chip->read_byte(chip);
|
id[i] = chip->read_byte(chip);
|
||||||
|
@ -2034,7 +2034,7 @@ int nand_status_op(struct nand_chip *chip, u8 *status)
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
|
chip->cmdfunc(chip, NAND_CMD_STATUS, -1, -1);
|
||||||
if (status)
|
if (status)
|
||||||
*status = chip->read_byte(chip);
|
*status = chip->read_byte(chip);
|
||||||
|
|
||||||
|
@ -2066,7 +2066,7 @@ int nand_exit_status_op(struct nand_chip *chip)
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_READ0, -1, -1);
|
chip->cmdfunc(chip, NAND_CMD_READ0, -1, -1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2115,8 +2115,8 @@ int nand_erase_op(struct nand_chip *chip, unsigned int eraseblock)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
chip->cmdfunc(mtd, NAND_CMD_ERASE1, -1, page);
|
chip->cmdfunc(chip, NAND_CMD_ERASE1, -1, page);
|
||||||
chip->cmdfunc(mtd, NAND_CMD_ERASE2, -1, -1);
|
chip->cmdfunc(chip, NAND_CMD_ERASE2, -1, -1);
|
||||||
|
|
||||||
ret = chip->waitfunc(mtd, chip);
|
ret = chip->waitfunc(mtd, chip);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -2166,7 +2166,7 @@ static int nand_set_features_op(struct nand_chip *chip, u8 feature,
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_SET_FEATURES, feature, -1);
|
chip->cmdfunc(chip, NAND_CMD_SET_FEATURES, feature, -1);
|
||||||
for (i = 0; i < ONFI_SUBFEATURE_PARAM_LEN; ++i)
|
for (i = 0; i < ONFI_SUBFEATURE_PARAM_LEN; ++i)
|
||||||
chip->write_byte(chip, params[i]);
|
chip->write_byte(chip, params[i]);
|
||||||
|
|
||||||
|
@ -2215,7 +2215,7 @@ static int nand_get_features_op(struct nand_chip *chip, u8 feature,
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_GET_FEATURES, feature, -1);
|
chip->cmdfunc(chip, NAND_CMD_GET_FEATURES, feature, -1);
|
||||||
for (i = 0; i < ONFI_SUBFEATURE_PARAM_LEN; ++i)
|
for (i = 0; i < ONFI_SUBFEATURE_PARAM_LEN; ++i)
|
||||||
params[i] = chip->read_byte(chip);
|
params[i] = chip->read_byte(chip);
|
||||||
|
|
||||||
|
@ -2270,7 +2270,7 @@ int nand_reset_op(struct nand_chip *chip)
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
|
chip->cmdfunc(chip, NAND_CMD_RESET, -1, -1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,6 @@ static bool hynix_nand_has_valid_jedecid(struct nand_chip *chip)
|
||||||
|
|
||||||
static int hynix_nand_cmd_op(struct nand_chip *chip, u8 cmd)
|
static int hynix_nand_cmd_op(struct nand_chip *chip, u8 cmd)
|
||||||
{
|
{
|
||||||
struct mtd_info *mtd = nand_to_mtd(chip);
|
|
||||||
|
|
||||||
if (chip->exec_op) {
|
if (chip->exec_op) {
|
||||||
struct nand_op_instr instrs[] = {
|
struct nand_op_instr instrs[] = {
|
||||||
NAND_OP_CMD(cmd, 0),
|
NAND_OP_CMD(cmd, 0),
|
||||||
|
@ -90,14 +88,13 @@ static int hynix_nand_cmd_op(struct nand_chip *chip, u8 cmd)
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, cmd, -1, -1);
|
chip->cmdfunc(chip, cmd, -1, -1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hynix_nand_reg_write_op(struct nand_chip *chip, u8 addr, u8 val)
|
static int hynix_nand_reg_write_op(struct nand_chip *chip, u8 addr, u8 val)
|
||||||
{
|
{
|
||||||
struct mtd_info *mtd = nand_to_mtd(chip);
|
|
||||||
u16 column = ((u16)addr << 8) | addr;
|
u16 column = ((u16)addr << 8) | addr;
|
||||||
|
|
||||||
if (chip->exec_op) {
|
if (chip->exec_op) {
|
||||||
|
@ -110,7 +107,7 @@ static int hynix_nand_reg_write_op(struct nand_chip *chip, u8 addr, u8 val)
|
||||||
return nand_exec_op(chip, &op);
|
return nand_exec_op(chip, &op);
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_NONE, column, -1);
|
chip->cmdfunc(chip, NAND_CMD_NONE, column, -1);
|
||||||
chip->write_byte(chip, val);
|
chip->write_byte(chip, val);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -129,10 +129,11 @@ static int nuc900_nand_devready(struct nand_chip *chip)
|
||||||
return ready;
|
return ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nuc900_nand_command_lp(struct mtd_info *mtd, unsigned int command,
|
static void nuc900_nand_command_lp(struct nand_chip *chip,
|
||||||
|
unsigned int command,
|
||||||
int column, int page_addr)
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
register struct nand_chip *chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
struct nuc900_nand *nand = mtd_to_nuc900(mtd);
|
struct nuc900_nand *nand = mtd_to_nuc900(mtd);
|
||||||
|
|
||||||
if (command == NAND_CMD_READOOB) {
|
if (command == NAND_CMD_READOOB) {
|
||||||
|
|
|
@ -1440,10 +1440,9 @@ static void post_command(struct qcom_nand_host *host, int command)
|
||||||
* NAND_CMD_READOOB would never be called because we have our own versions
|
* NAND_CMD_READOOB would never be called because we have our own versions
|
||||||
* of read_oob ops for nand_ecc_ctrl.
|
* of read_oob ops for nand_ecc_ctrl.
|
||||||
*/
|
*/
|
||||||
static void qcom_nandc_command(struct mtd_info *mtd, unsigned int command,
|
static void qcom_nandc_command(struct nand_chip *chip, unsigned int command,
|
||||||
int column, int page_addr)
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
|
||||||
struct qcom_nand_host *host = to_qcom_nand_host(chip);
|
struct qcom_nand_host *host = to_qcom_nand_host(chip);
|
||||||
struct nand_ecc_ctrl *ecc = &chip->ecc;
|
struct nand_ecc_ctrl *ecc = &chip->ecc;
|
||||||
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
|
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
|
||||||
|
|
|
@ -750,9 +750,10 @@ static void execmd_write_oob(struct mtd_info *mtd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void flctl_cmdfunc(struct mtd_info *mtd, unsigned int command,
|
static void flctl_cmdfunc(struct nand_chip *chip, unsigned int command,
|
||||||
int column, int page_addr)
|
int column, int page_addr)
|
||||||
{
|
{
|
||||||
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
struct sh_flctl *flctl = mtd_to_flctl(mtd);
|
struct sh_flctl *flctl = mtd_to_flctl(mtd);
|
||||||
uint32_t read_cmd = 0;
|
uint32_t read_cmd = 0;
|
||||||
|
|
||||||
|
|
|
@ -759,10 +759,10 @@ static void spinand_reset(struct spi_device *spi_nand)
|
||||||
dev_err(&spi_nand->dev, "wait timedout!\n");
|
dev_err(&spi_nand->dev, "wait timedout!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spinand_cmdfunc(struct mtd_info *mtd, unsigned int command,
|
static void spinand_cmdfunc(struct nand_chip *chip, unsigned int command,
|
||||||
int column, int page)
|
int column, int page)
|
||||||
{
|
{
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
struct spinand_info *info = nand_get_controller_data(chip);
|
struct spinand_info *info = nand_get_controller_data(chip);
|
||||||
struct spinand_state *state = info->priv;
|
struct spinand_state *state = info->priv;
|
||||||
|
|
||||||
|
|
|
@ -1292,7 +1292,7 @@ struct nand_chip {
|
||||||
int (*block_markbad)(struct nand_chip *chip, loff_t ofs);
|
int (*block_markbad)(struct nand_chip *chip, loff_t ofs);
|
||||||
void (*cmd_ctrl)(struct nand_chip *chip, int dat, unsigned int ctrl);
|
void (*cmd_ctrl)(struct nand_chip *chip, int dat, unsigned int ctrl);
|
||||||
int (*dev_ready)(struct nand_chip *chip);
|
int (*dev_ready)(struct nand_chip *chip);
|
||||||
void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column,
|
void (*cmdfunc)(struct nand_chip *chip, unsigned command, int column,
|
||||||
int page_addr);
|
int page_addr);
|
||||||
int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
|
int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
|
||||||
int (*exec_op)(struct nand_chip *chip,
|
int (*exec_op)(struct nand_chip *chip,
|
||||||
|
|
Loading…
Reference in New Issue