Commit 0f808c16 authored by Boris Brezillon's avatar Boris Brezillon Committed by Miquel Raynal
Browse files

mtd: rawnand: Pass a nand_chip object to chip->cmd_ctrl()



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->cmd_ctrl() hook.

Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent c17556f5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ static void ams_delta_read_buf(struct nand_chip *this, u_char *buf, int len)
 * NAND_CLE: bit 1 -> bit 7
 * NAND_ALE: bit 2 -> bit 6
 */
static void ams_delta_hwcontrol(struct mtd_info *mtd, int cmd,
static void ams_delta_hwcontrol(struct nand_chip *this, int cmd,
				unsigned int ctrl)
{

@@ -127,7 +127,7 @@ static void ams_delta_hwcontrol(struct mtd_info *mtd, int cmd,
	}

	if (cmd != NAND_CMD_NONE)
		ams_delta_write_byte(mtd_to_nand(mtd), cmd);
		ams_delta_write_byte(this, cmd);
}

static int ams_delta_nand_ready(struct mtd_info *mtd)
+2 −4
Original line number Diff line number Diff line
@@ -594,10 +594,9 @@ static int atmel_nfc_exec_op(struct atmel_hsmc_nand_controller *nc, bool poll)
	return ret;
}

static void atmel_hsmc_nand_cmd_ctrl(struct mtd_info *mtd, int dat,
static void atmel_hsmc_nand_cmd_ctrl(struct nand_chip *chip, int dat,
				     unsigned int ctrl)
{
	struct nand_chip *chip = mtd_to_nand(mtd);
	struct atmel_nand *nand = to_atmel_nand(chip);
	struct atmel_hsmc_nand_controller *nc;

@@ -621,10 +620,9 @@ static void atmel_hsmc_nand_cmd_ctrl(struct mtd_info *mtd, int dat,
	}
}

static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
static void atmel_nand_cmd_ctrl(struct nand_chip *chip, int cmd,
				unsigned int ctrl)
{
	struct nand_chip *chip = mtd_to_nand(mtd);
	struct atmel_nand *nand = to_atmel_nand(chip);
	struct atmel_nand_controller *nc;

+3 −4
Original line number Diff line number Diff line
@@ -170,10 +170,9 @@ static void bcm47xxnflash_ops_bcm4706_write(struct mtd_info *mtd,
 * NAND chip ops
 **************************************************/

static void bcm47xxnflash_ops_bcm4706_cmd_ctrl(struct mtd_info *mtd, int cmd,
					       unsigned int ctrl)
static void bcm47xxnflash_ops_bcm4706_cmd_ctrl(struct nand_chip *nand_chip,
					       int cmd, unsigned int ctrl)
{
	struct nand_chip *nand_chip = mtd_to_nand(mtd);
	struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
	u32 code = 0;

@@ -229,7 +228,7 @@ static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd,

	switch (command) {
	case NAND_CMD_RESET:
		nand_chip->cmd_ctrl(mtd, command, NAND_CTRL_CLE);
		nand_chip->cmd_ctrl(nand_chip, command, NAND_CTRL_CLE);

		ndelay(100);
		nand_wait_ready(nand_chip);
+2 −2
Original line number Diff line number Diff line
@@ -1231,7 +1231,7 @@ static void brcmnand_send_cmd(struct brcmnand_host *host, int cmd)
 * NAND MTD API: read/program/erase
 ***********************************************************************/

static void brcmnand_cmd_ctrl(struct mtd_info *mtd, int dat,
static void brcmnand_cmd_ctrl(struct nand_chip *chip, int dat,
			      unsigned int ctrl)
{
	/* intentionally left blank */
+1 −2
Original line number Diff line number Diff line
@@ -86,10 +86,9 @@ static void nand_cs_off(void)
/*
 *	hardware specific access to control-lines
 */
static void cmx270_hwcontrol(struct mtd_info *mtd, int dat,
static void cmx270_hwcontrol(struct nand_chip *this, int dat,
			     unsigned int ctrl)
{
	struct nand_chip *this = mtd_to_nand(mtd);
	unsigned int nandaddr = (unsigned int)this->IO_ADDR_W;

	dsb();
Loading