From patchwork Mon Oct 20 09:14:48 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Welte X-Patchwork-Id: 5057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8B91ADDDE7 for ; Mon, 20 Oct 2008 20:21:39 +1100 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1Krqvp-00075V-ME; Mon, 20 Oct 2008 09:20:09 +0000 Received: from ganesha.gnumonks.org ([2001:780:45:1d:2e0:81ff:fe28:898a]) by bombadil.infradead.org with esmtps (Exim 4.68 #1 (Red Hat Linux)) id 1Krqvm-0006wR-As for linux-mtd@lists.infradead.org; Mon, 20 Oct 2008 09:20:07 +0000 Received: from uucp by ganesha.gnumonks.org with local-bsmtp (Exim 4.63) (envelope-from ) id 1Krqvl-0007pH-5Y; Mon, 20 Oct 2008 11:20:05 +0200 Received: from laforge by prithivi.gnumonks.org with local (Exim 4.69) (envelope-from ) id 1Krqqe-0006Vt-1J; Mon, 20 Oct 2008 11:14:48 +0200 Date: Mon, 20 Oct 2008 11:14:48 +0200 From: Harald Welte To: Ben Dooks Subject: [PATCH] S3C24xx NAND: allow for faster timings Message-ID: <20081020091447.GA1048@prithivi.gnumonks.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam-Score: -0.0 (/) Cc: linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- drivers/mtd/nand/s3c2410.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index 4413d76..81f66ba 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -168,9 +168,6 @@ static int s3c_nand_calc_rate(int wanted, unsigned long clk, int max) return -1; } - if (result < 1) - result = 1; - return result; } @@ -202,7 +199,7 @@ static int s3c2410_nand_inithw(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; } @@ -213,14 +210,14 @@ static int s3c2410_nand_inithw(struct s3c2410_nand_info *info, switch (info->cpu_type) { case TYPE_S3C2410: cfg = S3C2410_NFCONF_EN; - cfg |= S3C2410_NFCONF_TACLS(tacls - 1); + 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 - 1); + cfg = S3C2440_NFCONF_TACLS(tacls); cfg |= S3C2440_NFCONF_TWRPH0(twrph0 - 1); cfg |= S3C2440_NFCONF_TWRPH1(twrph1 - 1);