From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: justin@jmicron.com, linux-ide@vger.kernel.org
Subject: Re: [PATCH REPOST] libata: lengthen interval between SRST set and clear
Date: Thu, 28 Sep 2006 18:57:37 +0900 [thread overview]
Message-ID: <451B9C91.3030106@gmail.com> (raw)
In-Reply-To: <451B9B90.5020009@pobox.com>
Jeff Garzik wrote:
> Tejun Heo wrote:
>> 20us delay is not enough for some controllers and they end up not
>> sending the second H2D FIS to clear SRST resulting in softreset
>> failure. This problem has been spotted and diagnosed with SATA trace
>> by JMicron on sata_nv.
>>
>> This patch makes ata_bus_softreset() use msleep(1) instead of
>> udelay(20) between SRST set and clear.
>>
>> Signed-off-by: Tejun Heo <htejun@gmail.com>
>> Cc: Justin Tsai <justin@jmicron.com>
>>
>> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
>> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
>> index 753b015..007020e 100644
>> --- a/drivers/ata/libata-core.c
>> +++ b/drivers/ata/libata-core.c
>> @@ -2414,15 +2414,15 @@ static unsigned int ata_bus_softreset(st
>> /* software reset. causes dev0 to be selected */
>> if (ap->flags & ATA_FLAG_MMIO) {
>> writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr);
>> - udelay(20); /* FIXME: flush */
>> + msleep(1); /* FIXME: flush */
>> writeb(ap->ctl | ATA_SRST, (void __iomem *) ioaddr->ctl_addr);
>> - udelay(20); /* FIXME: flush */
>> + msleep(1); /* FIXME: flush */
>> writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr);
>> } else {
>> outb(ap->ctl, ioaddr->ctl_addr);
>> - udelay(10);
>> + msleep(1);
>> outb(ap->ctl | ATA_SRST, ioaddr->ctl_addr);
>> - udelay(10);
>> + msleep(1);
>> outb(ap->ctl, ioaddr->ctl_addr);
>
> I'm gonna NAK this one. The controller is operating out of spec
> (hardware bug) if this is necessary.
> The effect of msleep(1) is really msleep(10) or msleep(100) depending on
> the length of a timer tick. That's just far too long a length of time
> to be asserting SRST, especially for PATA.
>
> I suppose you can create a jmicron_soft_reset() inside ahci.c...
The problem actually has been spotted on sata_nv. It is suggested that
this is dependent on what type of device is attached to the controller.
This problem seems to be caused if the device is slow to ack the first
H2D Register FIS. So, we really don't know which controllers are
affected by this.
How about doing msleep(1) if it's SATA?
--
tejun
next prev parent reply other threads:[~2006-09-28 9:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-28 9:13 [PATCH REPOST] libata: lengthen interval between SRST set and clear Tejun Heo
2006-09-28 9:53 ` Jeff Garzik
2006-09-28 9:57 ` Tejun Heo [this message]
2006-09-28 10:00 ` Jeff Garzik
2006-09-28 20:11 ` Eric D. Mudama
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=451B9C91.3030106@gmail.com \
--to=htejun@gmail.com \
--cc=jgarzik@pobox.com \
--cc=justin@jmicron.com \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).