From 0ce5d6bd62a9f1dbaa2d39c3535a8bdb31cf7951 Mon Sep 17 00:00:00 2001
From: Raghav Dogra <raghav.dogra@nxp.com>
Date: Wed, 24 Feb 2016 23:12:58 +0530
Subject: [PATCH 47/70] drivers/memory: Fix build error for arm64

Replace spin_event_timeout() with arch independent macro

Signed-off-by: Raghav Dogra <raghav.dogra@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
---
 drivers/memory/fsl_ifc.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

--- a/drivers/memory/fsl_ifc.c
+++ b/drivers/memory/fsl_ifc.c
@@ -39,7 +39,7 @@
 struct fsl_ifc_ctrl *fsl_ifc_ctrl_dev;
 EXPORT_SYMBOL(fsl_ifc_ctrl_dev);
 #define FSL_IFC_V1_3_0	0x01030000
-#define IFC_TIMEOUT_MSECS	100000 /* 100ms */
+#define IFC_TIMEOUT_MSECS	1000 /* 1000ms */
 
 /*
  * convert_ifc_address - convert the base address
@@ -365,7 +365,7 @@ static int fsl_ifc_resume(struct device
 	struct fsl_ifc_runtime __iomem *runtime = ctrl->rregs;
 	struct fsl_ifc_fcm *savd_gregs = ctrl->saved_gregs;
 	struct fsl_ifc_runtime *savd_rregs = ctrl->saved_rregs;
-	uint32_t ver = 0, ncfgr, status, ifc_bank, i;
+	uint32_t ver = 0, ncfgr, timeout, ifc_bank, i;
 
 /*
  * IFC interrupts disabled
@@ -469,12 +469,14 @@ static int fsl_ifc_resume(struct device
 		ifc_out32(ncfgr | IFC_NAND_SRAM_INIT_EN,
 					&runtime->ifc_nand.ncfgr);
 		/* wait for  SRAM_INIT bit to be clear or timeout */
-		status = spin_event_timeout(
-					!(ifc_in32(&runtime->ifc_nand.ncfgr)
-					& IFC_NAND_SRAM_INIT_EN),
-					IFC_TIMEOUT_MSECS, 0);
+		timeout = 10;
+		while ((ifc_in32(&runtime->ifc_nand.ncfgr) &
+			IFC_NAND_SRAM_INIT_EN) && timeout) {
+			mdelay(IFC_TIMEOUT_MSECS);
+			timeout--;
+		}
 
-		if (!status)
+		if (!timeout)
 			dev_err(ctrl->dev, "Timeout waiting for IFC SRAM INIT");
 	}
 
