public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben@fluff.org.uk>
To: linux-mtd@lists.infradead.org
Cc: mreimer@vpop.net
Subject: [PATCH] S3C2412 TACLS rate calculation fix
Date: Tue, 13 Feb 2007 11:12:04 +0000	[thread overview]
Message-ID: <20070213111204.GC2211@fluff.org.uk> (raw)

The TALCs value on the S3C2412 value does not have
an +1 adjustment unlike the S3C2410 and S3C2440.

The TALCs value on the S3C2440 is only 2 bits instead
of three, so change it to a maximum of 4.

Re-work of an patch by Matt Reimer <mreimer@vpop.net>

Signed-off-by: Ben Dooks <ben-linux@fluff.org>

diff -urpN -X ../dontdiff linux-2.6.20-rmk-12feb2007/drivers/mtd/nand/s3c2410.c linux-2.6.20-rmk-12feb2007-bjd1/drivers/mtd/nand/s3c2410.c
--- linux-2.6.20-rmk-12feb2007/drivers/mtd/nand/s3c2410.c	2007-02-04 18:44:54.000000000 +0000
+++ linux-2.6.20-rmk-12feb2007-bjd1/drivers/mtd/nand/s3c2410.c	2007-02-13 10:53:54.000000000 +0000
@@ -183,15 +183,17 @@ static int s3c2410_nand_inithw(struct s3
 {
 	struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
 	unsigned long clkrate = clk_get_rate(info->clk);
-	int tacls_max = (info->cpu_type == TYPE_S3C2412) ? 8 : 4;
+	int tacls_max = (info->cpu_type == TYPE_S3C2440) ? 3 : 7;
+	int tacls_adj = (info->cpu_type == TYPE_S3C2412) ? 0 : -1;
 	int tacls, twrph0, twrph1;
 	unsigned long cfg = 0;
 
 	/* calculate the timing information for the controller */
 
 	clkrate /= 1000;	/* turn clock into kHz for ease of use */
+	tacls_max -= tacls_adj;
 
-	if (plat != NULL) {
+	if (plat != NULL) {	
 		tacls = s3c_nand_calc_rate(plat->tacls, clkrate, tacls_max);
 		twrph0 = s3c_nand_calc_rate(plat->twrph0, clkrate, 8);
 		twrph1 = s3c_nand_calc_rate(plat->twrph1, clkrate, 8);
@@ -207,20 +209,23 @@ static int s3c2410_nand_inithw(struct s3
 		return -EINVAL;
 	}
 
-	dev_info(info->device, "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n",
-	       tacls, to_ns(tacls, clkrate), twrph0, to_ns(twrph0, clkrate), twrph1, to_ns(twrph1, clkrate));
+	dev_info(info->device,
+		 "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n",
+		 tacls, to_ns(tacls, clkrate),
+		 twrph0, to_ns(twrph0, clkrate),
+		 twrph1, to_ns(twrph1, clkrate));
 
  	switch (info->cpu_type) {
  	case TYPE_S3C2410:
 		cfg = S3C2410_NFCONF_EN;
-		cfg |= S3C2410_NFCONF_TACLS(tacls - 1);
+		cfg |= S3C2410_NFCONF_TACLS(tacls + tacls_adj);
 		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 + tacls_adj);
 		cfg |= S3C2440_NFCONF_TWRPH0(twrph0 - 1);
 		cfg |= S3C2440_NFCONF_TWRPH1(twrph1 - 1);
 

             reply	other threads:[~2007-02-13 11:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-13 11:12 Ben Dooks [this message]
2007-02-13 11:22 ` [PATCH] S3C2412 TACLS rate calculation fix Matthieu CASTET
2007-02-13 18:47   ` Matt Reimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070213111204.GC2211@fluff.org.uk \
    --to=ben@fluff.org.uk \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mreimer@vpop.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox