diff options
author | Harald Welte <laforge@openmoko.org> | 2008-11-19 17:11:22 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-19 17:11:22 +0000 |
commit | 87e863f323a3933b56a4cd1128a9f868ddea8bcc (patch) | |
tree | ab66d2f52d9749c47e60593278bf74e0bb1025f6 /drivers/mtd/nand | |
parent | 22920cc65faab3f8abab9e4a7077b8688fd38da0 (diff) |
S3C24xx NAND: allow for faster timings
Tacls can actually be zero with some NAND flash devices, so we need
to permit this.
Also, the TACLS register actually specifies the actual number of
HCLK clocks, where the TWRPH0 and TWRPH1 registers are auto-incremented
by one HCLK clock in hardware.
Signed-off-by: Harald Welte <laforge@openmoko.org>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/s3c2410.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index 04750ee2d0f..e14520091b2 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -149,6 +149,10 @@ static int s3c_nand_calc_rate(int wanted, unsigned long clk, int max) { int result; + /* Tacls can be 0ns in some cases */ + if (wanted == 0) + return 0; + result = (wanted * clk) / NS_IN_KHZ; result++; @@ -159,9 +163,6 @@ static int s3c_nand_calc_rate(int wanted, unsigned long clk, int max) return -1; } - if (result < 1) - result = 1; - return result; } @@ -194,7 +195,7 @@ static int s3c2410_nand_setrate(struct s3c2410_nand_info *info) twrph1 = 8; } - if (tacls < 0 || twrph0 < 0 || twrph1 < 0) { + if (tacls < 0 || twrph0 < 1 || twrph1 < 1) { dev_err(info->device, "cannot get suitable timings\n"); return -EINVAL; } @@ -255,11 +256,18 @@ static int s3c2410_nand_inithw(struct s3c2410_nand_info *info) switch (info->cpu_type) { case TYPE_S3C2410: - default: + cfg = S3C2410_NFCONF_EN; + cfg |= S3C2410_NFCONF_TACLS(tacls); + cfg |= S3C2410_NFCONF_TWRPH0(twrph0 - 1); + cfg |= S3C2410_NFCONF_TWRPH1(twrph1 - 1); break; case TYPE_S3C2440: case TYPE_S3C2412: + cfg = S3C2440_NFCONF_TACLS(tacls); + cfg |= S3C2440_NFCONF_TWRPH0(twrph0 - 1); + cfg |= S3C2440_NFCONF_TWRPH1(twrph1 - 1); + /* enable the controller and de-assert nFCE */ writel(S3C2440_NFCONT_ENABLE, info->regs + S3C2440_NFCONT); |