diff mbox

[v2,06/22] mtd: nand: omap2: Switch to using GPMC-NAND ops for writebuffer empty check

Message ID 1438938752-31010-7-git-send-email-rogerq@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Quadros Aug. 7, 2015, 9:12 a.m. UTC
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: Roger Quadros <rogerq@ti.com>
---
 drivers/mtd/nand/omap2.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

Roger Quadros Aug. 13, 2015, 7:18 a.m. UTC | #1
On 07/08/15 12:12, Roger Quadros wrote:
> 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: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/mtd/nand/omap2.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index f214fe2..5c2f6df 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c
> @@ -289,15 +289,11 @@ static void omap_write_buf8(struct mtd_info *mtd, const u_char *buf, int len)
>  	struct omap_nand_info *info = container_of(mtd,
>  						struct omap_nand_info, mtd);
>  	u_char *p = (u_char *)buf;
> -	u32	status = 0;
>  
>  	while (len--) {
>  		iowrite8(*p++, info->nand.IO_ADDR_W);
>  		/* wait until buffer is available for write */
> -		do {
> -			status = readl(info->reg.gpmc_status) &
> -					STATUS_BUFF_EMPTY;
> -		} while (!status);
> +		while (info->ops->nand_writebuffer_empty());

This should be
		while (!info->ops->nand_writebuffer_empty());

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

here as well.

>  	}
>  }
>  
> 

cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index f214fe2..5c2f6df 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -289,15 +289,11 @@  static void omap_write_buf8(struct mtd_info *mtd, const u_char *buf, int len)
 	struct omap_nand_info *info = container_of(mtd,
 						struct omap_nand_info, mtd);
 	u_char *p = (u_char *)buf;
-	u32	status = 0;
 
 	while (len--) {
 		iowrite8(*p++, info->nand.IO_ADDR_W);
 		/* wait until buffer is available for write */
-		do {
-			status = readl(info->reg.gpmc_status) &
-					STATUS_BUFF_EMPTY;
-		} while (!status);
+		while (info->ops->nand_writebuffer_empty());
 	}
 }
 
@@ -325,17 +321,13 @@  static void omap_write_buf16(struct mtd_info *mtd, const u_char * buf, int len)
 	struct omap_nand_info *info = container_of(mtd,
 						struct omap_nand_info, mtd);
 	u16 *p = (u16 *) buf;
-	u32	status = 0;
 	/* FIXME try bursts of writesw() or DMA ... */
 	len >>= 1;
 
 	while (len--) {
 		iowrite16(*p++, info->nand.IO_ADDR_W);
 		/* wait until buffer is available for write */
-		do {
-			status = readl(info->reg.gpmc_status) &
-					STATUS_BUFF_EMPTY;
-		} while (!status);
+		while (info->ops->nand_writebuffer_empty());
 	}
 }