From 5b0d4d7c8a67c5ba3d35e6ceb0c5530cc6846db7 Mon Sep 17 00:00:00 2001 From: Matt Reimer 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 Signed-off-by: Eric Miao Signed-off-by: David Woodhouse --- drivers/mtd/nand/pxa3xx_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 7582581aefe..cc55cbc2b30 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c @@ -298,7 +298,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) -- 2.39.3