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>
Cc: ralf@linux-mips.org
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

authored by Atsushi Nemoto and committed by Bartlomiej Zolnierkiewicz 630a8b25 ccd32e22

+8 -1
+8 -1
drivers/ide/tx4938ide.c
··· 39 39 /* Address-valid to DIOR/DIOW setup */ 40 40 shwt = DIV_ROUND_UP(t->setup, cycle); 41 41 42 + /* -DIOx recovery time (SHWT * 4) and cycle time requirement */ 43 + while ((shwt * 4 + wt + (wt ? 2 : 3)) * cycle < t->cycle) 44 + shwt++; 45 + if (shwt > 7) { 46 + pr_warning("tx4938ide: SHWT violation (%d)\n", shwt); 47 + shwt = 7; 48 + } 42 49 pr_debug("tx4938ide: ebus %d, bus cycle %dns, WT %d, SHWT %d\n", 43 50 ebus_ch, cycle, wt, shwt); 44 51 45 - __raw_writeq((cr & ~(0x3f007ull)) | (wt << 12) | shwt, 52 + __raw_writeq((cr & ~0x3f007ull) | (wt << 12) | shwt, 46 53 &tx4938_ebuscptr->cr[ebus_ch]); 47 54 } 48 55