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

mtd: rawnand: Pass a nand_chip object to ecc->hwctl()



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.

Now is ecc->hwctl()'s turn.

Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 2b356ab4
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -157,9 +157,8 @@ static int cs553x_device_ready(struct mtd_info *mtd)
	return (foo & CS_NAND_STS_FLASH_RDY) && !(foo & CS_NAND_CTLR_BUSY);
}

static void cs_enable_hwecc(struct mtd_info *mtd, int mode)
static void cs_enable_hwecc(struct nand_chip *this, int mode)
{
	struct nand_chip *this = mtd_to_nand(mtd);
	void __iomem *mmio_base = this->IO_ADDR_R;

	writeb(0x07, mmio_base + MM_NAND_ECC_CTL);
+5 −5
Original line number Diff line number Diff line
@@ -146,16 +146,16 @@ static inline uint32_t nand_davinci_readecc_1bit(struct mtd_info *mtd)
			+ 4 * info->core_chipsel);
}

static void nand_davinci_hwctl_1bit(struct mtd_info *mtd, int mode)
static void nand_davinci_hwctl_1bit(struct nand_chip *chip, int mode)
{
	struct davinci_nand_info *info;
	uint32_t nandcfr;
	unsigned long flags;

	info = to_davinci_nand(mtd);
	info = to_davinci_nand(nand_to_mtd(chip));

	/* Reset ECC hardware */
	nand_davinci_readecc_1bit(mtd);
	nand_davinci_readecc_1bit(nand_to_mtd(chip));

	spin_lock_irqsave(&davinci_nand_lock, flags);

@@ -231,9 +231,9 @@ static int nand_davinci_correct_1bit(struct mtd_info *mtd, u_char *dat,
 * OOB without recomputing ECC.
 */

static void nand_davinci_hwctl_4bit(struct mtd_info *mtd, int mode)
static void nand_davinci_hwctl_4bit(struct nand_chip *chip, int mode)
{
	struct davinci_nand_info *info = to_davinci_nand(mtd);
	struct davinci_nand_info *info = to_davinci_nand(nand_to_mtd(chip));
	unsigned long flags;
	u32 val;

+2 −4
Original line number Diff line number Diff line
@@ -797,9 +797,8 @@ static int doc200x_block_bad(struct mtd_info *mtd, loff_t ofs)
	return 0;
}

static void doc200x_enable_hwecc(struct mtd_info *mtd, int mode)
static void doc200x_enable_hwecc(struct nand_chip *this, int mode)
{
	struct nand_chip *this = mtd_to_nand(mtd);
	struct doc_priv *doc = nand_get_controller_data(this);
	void __iomem *docptr = doc->virtadr;

@@ -816,9 +815,8 @@ static void doc200x_enable_hwecc(struct mtd_info *mtd, int mode)
	}
}

static void doc2001plus_enable_hwecc(struct mtd_info *mtd, int mode)
static void doc2001plus_enable_hwecc(struct nand_chip *this, int mode)
{
	struct nand_chip *this = mtd_to_nand(mtd);
	struct doc_priv *doc = nand_get_controller_data(this);
	void __iomem *docptr = doc->virtadr;

+3 −3
Original line number Diff line number Diff line
@@ -368,9 +368,9 @@ static int fsmc_setup_data_interface(struct mtd_info *mtd, int csline,
/*
 * fsmc_enable_hwecc - Enables Hardware ECC through FSMC registers
 */
static void fsmc_enable_hwecc(struct mtd_info *mtd, int mode)
static void fsmc_enable_hwecc(struct nand_chip *chip, int mode)
{
	struct fsmc_nand_data *host = mtd_to_fsmc(mtd);
	struct fsmc_nand_data *host = mtd_to_fsmc(nand_to_mtd(chip));

	writel_relaxed(readl(host->regs_va + FSMC_PC) & ~FSMC_ECCPLEN_256,
		       host->regs_va + FSMC_PC);
@@ -740,7 +740,7 @@ static int fsmc_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,

	for (i = 0, s = 0; s < eccsteps; s++, i += eccbytes, p += eccsize) {
		nand_read_page_op(chip, page, s * eccsize, NULL, 0);
		chip->ecc.hwctl(mtd, NAND_ECC_READ);
		chip->ecc.hwctl(chip, NAND_ECC_READ);
		nand_read_data_op(chip, p, eccsize, false);

		for (j = 0; j < eccbytes;) {
+2 −2
Original line number Diff line number Diff line
@@ -134,9 +134,9 @@ static int jz_nand_dev_ready(struct mtd_info *mtd)
	return gpiod_get_value_cansleep(nand->busy_gpio);
}

static void jz_nand_hwctl(struct mtd_info *mtd, int mode)
static void jz_nand_hwctl(struct nand_chip *chip, int mode)
{
	struct jz_nand *nand = mtd_to_jz_nand(mtd);
	struct jz_nand *nand = mtd_to_jz_nand(nand_to_mtd(chip));
	uint32_t reg;

	writel(0, nand->base + JZ_REG_NAND_IRQ_STAT);
Loading