* [PATCH] S3C2412 TACLS rate calculation fix
@ 2007-02-13 11:12 Ben Dooks
2007-02-13 11:22 ` Matthieu CASTET
0 siblings, 1 reply; 3+ messages in thread
From: Ben Dooks @ 2007-02-13 11:12 UTC (permalink / raw)
To: linux-mtd; +Cc: mreimer
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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] S3C2412 TACLS rate calculation fix
2007-02-13 11:12 [PATCH] S3C2412 TACLS rate calculation fix Ben Dooks
@ 2007-02-13 11:22 ` Matthieu CASTET
2007-02-13 18:47 ` Matt Reimer
0 siblings, 1 reply; 3+ messages in thread
From: Matthieu CASTET @ 2007-02-13 11:22 UTC (permalink / raw)
To: linux-mtd
Ben Dooks <ben <at> fluff.org.uk> writes:
>
> 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 <at> vpop.net>
>
Doesn't we lose the part that allow tacls to be 0 ?
Matthieu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] S3C2412 TACLS rate calculation fix
2007-02-13 11:22 ` Matthieu CASTET
@ 2007-02-13 18:47 ` Matt Reimer
0 siblings, 0 replies; 3+ messages in thread
From: Matt Reimer @ 2007-02-13 18:47 UTC (permalink / raw)
To: Matthieu CASTET; +Cc: linux-mtd
On 2/13/07, Matthieu CASTET <matthieu.castet@parrot.fr> wrote:
> Ben Dooks <ben <at> fluff.org.uk> writes:
>
> >
> > 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 <at> vpop.net>
> >
> Doesn't we lose the part that allow tacls to be 0 ?
Yes, we need that so 2410 can use 0 (which translates to 10 ns).
Also, I sent another patch that seems to have gotten hung up by the ml:
--- a/drivers/mtd/nand/s3c2410.c Tue Jan 30 12:15:08 2007
+++ b/drivers/mtd/nand/s3c2410.c.patched Tue Jan 30 12:15:08 2007
@@ -159,7 +159,8 @@ static int s3c_nand_calc_rate(int wanted
int result;
result = (wanted * clk) / NS_IN_KHZ;
- result++;
+ if (((wanted * clk) % NS_IN_KHZ) != 0)
+ result++;
pr_debug("result %d from %ld, %d\n", result, clk, wanted);
(Thanks the in-line clue Ben.)
Matt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-13 18:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-13 11:12 [PATCH] S3C2412 TACLS rate calculation fix Ben Dooks
2007-02-13 11:22 ` Matthieu CASTET
2007-02-13 18:47 ` Matt Reimer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.