Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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@vpop.net>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Matt Reimer and committed by
David Woodhouse
5b0d4d7c 7f9938d0

+1 -1
+1 -1
drivers/mtd/nand/pxa3xx_nand.c
··· 298 298 #define NDTR1_tAR(c) (min((c), 15) << 0) 299 299 300 300 /* convert nano-seconds to nand flash controller clock cycles */ 301 - #define ns2cycle(ns, clk) (int)(((ns) * (clk / 1000000) / 1000) + 1) 301 + #define ns2cycle(ns, clk) (int)(((ns) * (clk / 1000000) / 1000) - 1) 302 302 303 303 static void pxa3xx_nand_set_timing(struct pxa3xx_nand_info *info, 304 304 const struct pxa3xx_nand_timing *t)