* [PATCH 1/2] tx4938ide: Check minimum cycle time and SHWT range
@ 2008-10-27 13:39 Atsushi Nemoto
2008-10-27 14:07 ` Sergei Shtylyov
0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Nemoto @ 2008-10-27 13:39 UTC (permalink / raw)
To: linux-mips; +Cc: linux-ide, Bartlomiej Zolnierkiewicz, ralf, sshtylyov
SHWT value is used as address valid to -CSx assertion and -CSx to -DIOx
assertion setup time, and contrarywise, -DIOx to -CSx release and -CSx
release to address invalid hold time, so it actualy applies 4 times and
so constitutes -DIOx recovery time. Check requirement of the recovery
time and cycle time. Also check SHWT maximum value.
Suggested-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
drivers/ide/tx4938ide.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index fa660f9..7e4820e 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -39,10 +39,17 @@ static void tx4938ide_tune_ebusc(unsigned int ebus_ch,
/* Address-valid to DIOR/DIOW setup */
shwt = DIV_ROUND_UP(t->setup, cycle);
+ /* -DIOx recovery time (SHWT * 4) and cycle time requirement */
+ while (shwt * cycle * 4 + t->act8b < t->cycle)
+ shwt++;
+ if (shwt > 7) {
+ pr_warning("tx4938ide: SHWT violation (%d)\n", shwt);
+ shwt = 7;
+ }
pr_debug("tx4938ide: ebus %d, bus cycle %dns, WT %d, SHWT %d\n",
ebus_ch, cycle, wt, shwt);
- __raw_writeq((cr & ~(0x3f007ull)) | (wt << 12) | shwt,
+ __raw_writeq((cr & ~0x3f007ull) | (wt << 12) | shwt,
&tx4938_ebuscptr->cr[ebus_ch]);
}
--
1.5.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] tx4938ide: Check minimum cycle time and SHWT range
2008-10-27 13:39 [PATCH 1/2] tx4938ide: Check minimum cycle time and SHWT range Atsushi Nemoto
@ 2008-10-27 14:07 ` Sergei Shtylyov
2008-10-27 14:52 ` Atsushi Nemoto
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2008-10-27 14:07 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-mips, linux-ide, Bartlomiej Zolnierkiewicz, ralf
Hello.
Atsushi Nemoto wrote:
> SHWT value is used as address valid to -CSx assertion and -CSx to -DIOx
> assertion setup time, and contrarywise, -DIOx to -CSx release and -CSx
> release to address invalid hold time, so it actualy applies 4 times and
> so constitutes -DIOx recovery time. Check requirement of the recovery
> time and cycle time. Also check SHWT maximum value.
> Suggested-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
> index fa660f9..7e4820e 100644
> --- a/drivers/ide/tx4938ide.c
> +++ b/drivers/ide/tx4938ide.c
> @@ -39,10 +39,17 @@ static void tx4938ide_tune_ebusc(unsigned int ebus_ch,
> /* Address-valid to DIOR/DIOW setup */
> shwt = DIV_ROUND_UP(t->setup, cycle);
>
> + /* -DIOx recovery time (SHWT * 4) and cycle time requirement */
> + while (shwt * cycle * 4 + t->act8b < t->cycle)
This can lead to adding an extra setup cycle due to use of "non-quantized"
active time, here's more precise expression for the cycle time:
(shwt * 4 + wt + (wt ? 2 : 3)) * cycle
or even this, more obsure:
(shwt * 4 + wt + !wt + 2) * cycle
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] tx4938ide: Check minimum cycle time and SHWT range
2008-10-27 14:07 ` Sergei Shtylyov
@ 2008-10-27 14:52 ` Atsushi Nemoto
2008-10-27 23:12 ` Sergei Shtylyov
0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Nemoto @ 2008-10-27 14:52 UTC (permalink / raw)
To: sshtylyov; +Cc: linux-mips, linux-ide, bzolnier, ralf
On Mon, 27 Oct 2008 17:07:05 +0300, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> > + /* -DIOx recovery time (SHWT * 4) and cycle time requirement */
> > + while (shwt * cycle * 4 + t->act8b < t->cycle)
>
> This can lead to adding an extra setup cycle due to use of "non-quantized"
> active time, here's more precise expression for the cycle time:
>
> (shwt * 4 + wt + (wt ? 2 : 3)) * cycle
>
> or even this, more obsure:
>
> (shwt * 4 + wt + !wt + 2) * cycle
Hm, indeed. I prefer former one. Revised. Thanks!
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Subject: [PATCH] tx4938ide: Check minimum cycle time and SHWT range (v2)
SHWT value is used as address valid to -CSx assertion and -CSx to -DIOx
assertion setup time, and contrarywise, -DIOx to -CSx release and -CSx
release to address invalid hold time, so it actualy applies 4 times and
so constitutes -DIOx recovery time. Check requirement of the recovery
time and cycle time. Also check SHWT maximum value.
Suggested-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
drivers/ide/tx4938ide.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index a0d10a9..796289c 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -39,10 +39,17 @@ static void tx4938ide_tune_ebusc(unsigned int ebus_ch,
/* Address-valid to DIOR/DIOW setup */
shwt = DIV_ROUND_UP(t->setup, cycle);
+ /* -DIOx recovery time (SHWT * 4) and cycle time requirement */
+ while ((shwt * 4 + wt + (wt ? 2 : 3)) * cycle < t->cycle)
+ shwt++;
+ if (shwt > 7) {
+ pr_warning("tx4938ide: SHWT violation (%d)\n", shwt);
+ shwt = 7;
+ }
pr_debug("tx4938ide: ebus %d, bus cycle %dns, WT %d, SHWT %d\n",
ebus_ch, cycle, wt, shwt);
- __raw_writeq((cr & ~(0x3f007ull)) | (wt << 12) | shwt,
+ __raw_writeq((cr & ~0x3f007ull) | (wt << 12) | shwt,
&tx4938_ebuscptr->cr[ebus_ch]);
}
--
1.5.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] tx4938ide: Check minimum cycle time and SHWT range
2008-10-27 14:52 ` Atsushi Nemoto
@ 2008-10-27 23:12 ` Sergei Shtylyov
2008-10-29 19:12 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2008-10-27 23:12 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-mips, linux-ide, bzolnier, ralf
Hello.
Atsushi Nemoto wrote:
> From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> Subject: [PATCH] tx4938ide: Check minimum cycle time and SHWT range (v2)
>
> SHWT value is used as address valid to -CSx assertion and -CSx to -DIOx
> assertion setup time, and contrarywise, -DIOx to -CSx release and -CSx
> release to address invalid hold time, so it actualy applies 4 times and
> so constitutes -DIOx recovery time. Check requirement of the recovery
> time and cycle time. Also check SHWT maximum value.
>
> Suggested-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
> index a0d10a9..796289c 100644
> --- a/drivers/ide/tx4938ide.c
> +++ b/drivers/ide/tx4938ide.c
> @@ -39,10 +39,17 @@ static void tx4938ide_tune_ebusc(unsigned int ebus_ch,
> /* Address-valid to DIOR/DIOW setup */
> shwt = DIV_ROUND_UP(t->setup, cycle);
>
> + /* -DIOx recovery time (SHWT * 4) and cycle time requirement */
> + while ((shwt * 4 + wt + (wt ? 2 : 3)) * cycle < t->cycle)
>
Besides, it's worth making 'wt' variable signed, otherwise you're
risking underflow when subtracting 2 above...
WBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] tx4938ide: Check minimum cycle time and SHWT range
2008-10-27 23:12 ` Sergei Shtylyov
@ 2008-10-29 19:12 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-10-29 19:12 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Atsushi Nemoto, linux-mips, linux-ide, ralf
On Tuesday 28 October 2008, Sergei Shtylyov wrote:
> Hello.
>
> Atsushi Nemoto wrote:
>
> > From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> > Subject: [PATCH] tx4938ide: Check minimum cycle time and SHWT range (v2)
> >
> > SHWT value is used as address valid to -CSx assertion and -CSx to -DIOx
> > assertion setup time, and contrarywise, -DIOx to -CSx release and -CSx
> > release to address invalid hold time, so it actualy applies 4 times and
> > so constitutes -DIOx recovery time. Check requirement of the recovery
> > time and cycle time. Also check SHWT maximum value.
> >
> > Suggested-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> > Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> >
>
> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
applied
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-29 19:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-27 13:39 [PATCH 1/2] tx4938ide: Check minimum cycle time and SHWT range Atsushi Nemoto
2008-10-27 14:07 ` Sergei Shtylyov
2008-10-27 14:52 ` Atsushi Nemoto
2008-10-27 23:12 ` Sergei Shtylyov
2008-10-29 19:12 ` Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).