linux-mips
[Top] [All Lists]

Re: [PATCH 1/2] tx4938ide: Check minimum cycle time and SHWT range

To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Subject: Re: [PATCH 1/2] tx4938ide: Check minimum cycle time and SHWT range
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Date: Mon, 27 Oct 2008 17:07:05 +0300
Cc: linux-mips@linux-mips.org, linux-ide@vger.kernel.org, Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>, ralf@linux-mips.org
In-reply-to: <20081027.223913.128619425.anemo@mba.ocn.ne.jp>
Organization: MontaVista Software Inc.
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20081027.223913.128619425.anemo@mba.ocn.ne.jp>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.2) Gecko/20040803
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

<Prev in Thread] Current Thread [Next in Thread>