From 20f7872ca476ddb51d5c2ba8257670b73cdeacf5 Mon Sep 17 00:00:00 2001
From: Matt Reimer <mreimer@vpop.net>
Date: Tue, 18 Nov 2008 10:54:32 -0800
Subject: [PATCH] [MTD][NAND] pxa3xx: convert from ns to clock ticks more accurately
The various fields in NDTR{01} are in units of clock ticks minus one, but the
ns2cycle macro mistakenly adds one, inflating the number of clock ticks and
making it impossible to set any of these fields to zero.
Signed-off-by: Matt Reimer <mreimer@sdgsystems.com>
---
drivers/mtd/nand/pxa3xx_nand.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -309,7 +309,7 @@ static struct pxa3xx_nand_flash *builtin_flash_types[] = {
#define NDTR1_tAR(c) (min((c), 15) << 0)
/* convert nano-seconds to nand flash controller clock cycles */
-#define ns2cycle(ns, clk) (int)(((ns) * (clk / 1000000) / 1000) + 1)
+#define ns2cycle(ns, clk) (int)(((ns) * (clk / 1000000) / 1000) - 1)
static void pxa3xx_nand_set_timing(struct pxa3xx_nand_info *info,
struct pxa3xx_nand_timing *t)
--
1.5.6.3