[PATCH 2/2] [MTD][NAND] pxa3xx: convert from ns to clock ticks more accurately

Eric Miao eric.y.miao at gmail.com
Wed Dec 10 10:26:09 EST 2008


>From e12b9d1a578bc2d70dc2233af3caf06e672dfcce Mon Sep 17 00:00:00 2001
From: Matt Reimer <mreimer at 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 at vpop.net>
Signed-off-by: Eric Miao <eric.miao at marvell.com>
---
 drivers/mtd/nand/pxa3xx_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index b797c1c..1e4f383 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -297,7 +297,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,
 				   const struct pxa3xx_nand_timing *t)
-- 
1.6.0.4



More information about the linux-mtd mailing list