Hello.
Atsushi Nemoto wrote:
From: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>
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@xxxxxxxxxxxxx>
Signed-off-by: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>
Acked-by: Sergei Shtylyov <sshtylyov@xxxxxxxxxxxxx>
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