memory: omap-gpmc: Add GPMC-NAND ops to get writebufferempty status
authorRoger Quadros <rogerq@ti.com>
Wed, 5 Aug 2015 10:34:50 +0000 (13:34 +0300)
committerRoger Quadros <rogerq@ti.com>
Fri, 15 Apr 2016 08:51:57 +0000 (11:51 +0300)
This is needed by OMAP NAND driver to poll the empty status
of the writebuffer.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
drivers/memory/omap-gpmc.c

index 0b62afd86f7e93838fcea7729d684450a4780152..90dfba5a8f554cc675520d2c08a4d9eb59575b3f 100644 (file)
@@ -81,6 +81,8 @@
 
 #define GPMC_CONFIG_LIMITEDADDRESS             BIT(1)
 
+#define GPMC_STATUS_EMPTYWRITEBUFFERSTATUS     BIT(0)
+
 #define        GPMC_CONFIG2_CSEXTRADELAY               BIT(7)
 #define        GPMC_CONFIG3_ADVEXTRADELAY              BIT(7)
 #define        GPMC_CONFIG4_OEEXTRADELAY               BIT(7)
@@ -1118,7 +1120,17 @@ void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
        }
 }
 
-static struct gpmc_nand_ops nand_ops;
+static bool gpmc_nand_writebuffer_empty(void)
+{
+       if (gpmc_read_reg(GPMC_STATUS) & GPMC_STATUS_EMPTYWRITEBUFFERSTATUS)
+               return true;
+
+       return false;
+}
+
+static struct gpmc_nand_ops nand_ops = {
+       .nand_writebuffer_empty = gpmc_nand_writebuffer_empty,
+};
 
 /**
  * gpmc_omap_get_nand_ops - Get the GPMC NAND interface