diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 3b50b9b5cb2f..9f3828cc2734 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -27,11 +27,8 @@
 
 #define	ONENAND_FLAG_SYNCREAD	(1 << 0)
 #define	ONENAND_FLAG_SYNCWRITE	(1 << 1)
-#define	ONENAND_FLAG_HF		(1 << 2)
-#define	ONENAND_FLAG_VHF	(1 << 3)
 
 static unsigned onenand_flags;
-static unsigned latency;
 
 static struct omap_onenand_platform_data *gpmc_onenand_data;
 
@@ -86,12 +83,16 @@ static void omap2_onenand_set_async_mode(void __iomem *onenand_base)
 	writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
 }
 
-static void set_onenand_cfg(void __iomem *onenand_base)
+static void set_onenand_cfg(void __iomem *onenand_base, int latency)
 {
 	u32 reg = ONENAND_SYS_CFG1_RDY | ONENAND_SYS_CFG1_INT;
 
-	reg |=	(latency << ONENAND_SYS_CFG1_BRL_SHIFT) |
+	reg |= (latency << ONENAND_SYS_CFG1_BRL_SHIFT) |
 		ONENAND_SYS_CFG1_BL_16;
+	if (latency > 5)
+		reg |= ONENAND_SYS_CFG1_HF;
+	if (latency > 7)
+		reg |= ONENAND_SYS_CFG1_VHF;
 	if (onenand_flags & ONENAND_FLAG_SYNCREAD)
 		reg |= ONENAND_SYS_CFG1_SYNC_READ;
 	else
@@ -100,14 +101,6 @@ static void set_onenand_cfg(void __iomem *onenand_base)
 		reg |= ONENAND_SYS_CFG1_SYNC_WRITE;
 	else
 		reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE;
-	if (onenand_flags & ONENAND_FLAG_HF)
-		reg |= ONENAND_SYS_CFG1_HF;
-	else
-		reg &= ~ONENAND_SYS_CFG1_HF;
-	if (onenand_flags & ONENAND_FLAG_VHF)
-		reg |= ONENAND_SYS_CFG1_VHF;
-	else
-		reg &= ~ONENAND_SYS_CFG1_VHF;
 
 	writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
 }
@@ -142,7 +135,7 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
 	return freq;
 }
 
-static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t,
+static int omap2_onenand_calc_sync_timings(struct gpmc_timings *t,
 					    struct gpmc_settings *s,
 					    unsigned int flags,
 					    int freq)
@@ -154,7 +147,7 @@ static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t,
 	const int t_wpl  = 40;
 	const int t_wph  = 30;
 	int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo;
-	int div, gpmc_clk_ns;
+	int div, gpmc_clk_ns, latency;
 
 	if (flags & ONENAND_SYNC_READ)
 		onenand_flags = ONENAND_FLAG_SYNCREAD;
@@ -203,19 +196,11 @@ static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t,
 
 	div = gpmc_calc_divider(min_gpmc_clk_period);
 	gpmc_clk_ns = gpmc_ticks_to_ns(div);
-	if (gpmc_clk_ns < 15) /* >66MHz */
-		onenand_flags |= ONENAND_FLAG_HF;
-	else
-		onenand_flags &= ~ONENAND_FLAG_HF;
-	if (gpmc_clk_ns < 12) /* >83MHz */
-		onenand_flags |= ONENAND_FLAG_VHF;
-	else
-		onenand_flags &= ~ONENAND_FLAG_VHF;
-	if (onenand_flags & ONENAND_FLAG_VHF)
+	if (gpmc_clk_ns < 12)       /* >83 MHz */
 		latency = 8;
-	else if (onenand_flags & ONENAND_FLAG_HF)
+	else if (gpmc_clk_ns < 15)  /* >66 MHz */
 		latency = 6;
-	else if (gpmc_clk_ns >= 25) /* 40 MHz*/
+	else if (gpmc_clk_ns >= 25) /*  40 MHz */
 		latency = 3;
 	else
 		latency = 4;
@@ -251,6 +236,8 @@ static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t,
 	dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period;
 
 	gpmc_calc_timings(t, s, &dev_t);
+
+	return latency;
 }
 
 static int omap2_onenand_setup_async(void __iomem *onenand_base)
@@ -291,7 +278,7 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base)
 
 static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
 {
-	int ret, freq = *freq_ptr;
+	int ret, latency, freq = *freq_ptr;
 	struct gpmc_timings t;
 	struct gpmc_settings s;
 
@@ -300,12 +287,13 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
 		freq = omap2_onenand_get_freq(gpmc_onenand_data, onenand_base);
 		if (!freq)
 			return -ENODEV;
-		set_onenand_cfg(onenand_base);
 	}
 
 	gpmc_read_settings_dt(gpmc_onenand_data->of_node, &s);
 
-	omap2_onenand_calc_sync_timings(&t, &s, gpmc_onenand_data->flags, freq);
+	latency = omap2_onenand_calc_sync_timings(&t, &s,
+						  gpmc_onenand_data->flags,
+						  freq);
 
 	ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &s);
 	if (ret < 0)
@@ -315,7 +303,7 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
 	if (ret < 0)
 		return ret;
 
-	set_onenand_cfg(onenand_base);
+	set_onenand_cfg(onenand_base, latency);
 
 	*freq_ptr = freq;
 
