Commit 5295cf2e authored by Boris Brezillon's avatar Boris Brezillon Committed by Miquel Raynal
Browse files

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: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 50a487e7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -236,14 +236,15 @@ static void au1550_select_chip(struct nand_chip *this, int chip)

/**
 * au1550_command - Send command to NAND device
 * @mtd:	MTD device structure
 * @this:	NAND chip object
 * @command:	the command to be sent
 * @column:	the column 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,
						chip);
	int ce_override = 0, i;
+2 −2
Original line number Diff line number Diff line
@@ -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
 * 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,
					      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 bcma_drv_cc *cc = b47n->cc;
	u32 ctlcode;
+2 −2
Original line number Diff line number Diff line
@@ -1310,10 +1310,10 @@ static int brcmnand_low_level_op(struct brcmnand_host *host,
	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)
{
	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_controller *ctrl = host->ctrl;
	u64 addr = (u64)page_addr << chip->page_shift;
+2 −2
Original line number Diff line number Diff line
@@ -156,10 +156,10 @@ static uint8_t cafe_read_byte(struct nand_chip *chip)
	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)
{
	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);
	int adrbytes = 0;
	uint32_t ctl1;
+3 −2
Original line number Diff line number Diff line
@@ -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);
	void __iomem *docptr = doc->virtadr;

Loading