[PATCH] sata_sil24: lengthen softreset timeout
authorTejun Heo <htejun@gmail.com>
Sat, 11 Mar 2006 02:44:08 +0000 (11:44 +0900)
committerJeff Garzik <jeff@garzik.org>
Sun, 12 Mar 2006 00:29:42 +0000 (19:29 -0500)
sil24 softreset timeout was > 100ms (100 loops with msleep(1)), which
turned out to be too short for some devices (ASI ARAID99 2000).  This
patch converts sil24 softreset waiting loop to use proper timeout
condition and lengthen the timeout to ATA_TMOUT_BOOT secs and check
interval to 100ms.  Chisato Yamauchi discovered the problem and
supplied initial patch.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Chisato Yamauchi <cyamauch@plamo.linet.gr.jp>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/scsi/sata_sil24.c

index fa1a5ac606393b646e23059535a7ef66440dd88e..9a53a5ed38c5ae10ce28e59c1bd729c4b94c5731 100644 (file)
@@ -435,8 +435,8 @@ static int sil24_softreset(struct ata_port *ap, int verbose,
        struct sil24_port_priv *pp = ap->private_data;
        struct sil24_prb *prb = &pp->cmd_block[0].ata.prb;
        dma_addr_t paddr = pp->cmd_block_dma;
+       unsigned long timeout = jiffies + ATA_TMOUT_BOOT * HZ;
        u32 irq_enable, irq_stat;
-       int cnt;
 
        DPRINTK("ENTER\n");
 
@@ -461,7 +461,7 @@ static int sil24_softreset(struct ata_port *ap, int verbose,
 
        writel((u32)paddr, port + PORT_CMD_ACTIVATE);
 
-       for (cnt = 0; cnt < 100; cnt++) {
+       do {
                irq_stat = readl(port + PORT_IRQ_STAT);
                writel(irq_stat, port + PORT_IRQ_STAT);         /* clear irq */
 
@@ -469,8 +469,8 @@ static int sil24_softreset(struct ata_port *ap, int verbose,
                if (irq_stat & (PORT_IRQ_COMPLETE | PORT_IRQ_ERROR))
                        break;
 
-               msleep(1);
-       }
+               msleep(100);
+       } while (time_before(jiffies, timeout));
 
        /* restore IRQs */
        writel(irq_enable, port + PORT_IRQ_ENABLE_SET);