Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6e55216 authored by Roger Quadros's avatar Roger Quadros
Browse files

mtd: nand: omap: Switch to using GPMC-NAND ops for writebuffer empty check



Instead of accessing the gpmc_status register directly start
using the gpmc_nand_ops->nand_writebuffer_empty() helper
to check write buffer empty status.

Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
Acked-by: default avatarBrian Norris <computersforpeace@gmail.com>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
parent c509aefd
Loading
Loading
Loading
Loading
+4 −6
Original line number Original line Diff line number Diff line
@@ -291,14 +291,13 @@ static void omap_write_buf8(struct mtd_info *mtd, const u_char *buf, int len)
{
{
	struct omap_nand_info *info = mtd_to_omap(mtd);
	struct omap_nand_info *info = mtd_to_omap(mtd);
	u_char *p = (u_char *)buf;
	u_char *p = (u_char *)buf;
	u32	status = 0;
	bool status;


	while (len--) {
	while (len--) {
		iowrite8(*p++, info->nand.IO_ADDR_W);
		iowrite8(*p++, info->nand.IO_ADDR_W);
		/* wait until buffer is available for write */
		/* wait until buffer is available for write */
		do {
		do {
			status = readl(info->reg.gpmc_status) &
			status = info->ops->nand_writebuffer_empty();
					STATUS_BUFF_EMPTY;
		} while (!status);
		} while (!status);
	}
	}
}
}
@@ -326,7 +325,7 @@ static void omap_write_buf16(struct mtd_info *mtd, const u_char * buf, int len)
{
{
	struct omap_nand_info *info = mtd_to_omap(mtd);
	struct omap_nand_info *info = mtd_to_omap(mtd);
	u16 *p = (u16 *) buf;
	u16 *p = (u16 *) buf;
	u32	status = 0;
	bool status;
	/* FIXME try bursts of writesw() or DMA ... */
	/* FIXME try bursts of writesw() or DMA ... */
	len >>= 1;
	len >>= 1;


@@ -334,8 +333,7 @@ static void omap_write_buf16(struct mtd_info *mtd, const u_char * buf, int len)
		iowrite16(*p++, info->nand.IO_ADDR_W);
		iowrite16(*p++, info->nand.IO_ADDR_W);
		/* wait until buffer is available for write */
		/* wait until buffer is available for write */
		do {
		do {
			status = readl(info->reg.gpmc_status) &
			status = info->ops->nand_writebuffer_empty();
					STATUS_BUFF_EMPTY;
		} while (!status);
		} while (!status);
	}
	}
}
}