* [PATCH] ata: pata_platform: Disable prereset logic.
@ 2007-05-23 6:44 Paul Mundt
2007-05-23 8:07 ` Tejun Heo
0 siblings, 1 reply; 6+ messages in thread
From: Paul Mundt @ 2007-05-23 6:44 UTC (permalink / raw)
To: Jeff Garzik, Tejun Heo; +Cc: linux-ide, linux-kernel
On a number of boards the current prereset logic seems to misbehave:
scsi0 : pata_platform
ata1: PATA max PIO0 cmd 0xb06001f0 ctl 0xb06003f6 bmdma 0x00000000 irq 0
ata1: device not ready (errno=-19), forcing hardreset
ata1: BUG: prereset() requested invalid reset type
This triggers when there is no card inserted in the slot.
Simply disabling the prereset gets rid of this, and doesn't seem to cause
any problems for either PCMCIA or CF cards when they're actually present.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
--
drivers/ata/pata_platform.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index cbb7866..8a569c7 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -1,7 +1,7 @@
/*
* Generic platform device PATA driver
*
- * Copyright (C) 2006 Paul Mundt
+ * Copyright (C) 2006 - 2007 Paul Mundt
*
* Based on pata_pcmcia:
*
@@ -22,7 +22,7 @@
#include <linux/pata_platform.h>
#define DRV_NAME "pata_platform"
-#define DRV_VERSION "1.0"
+#define DRV_VERSION "1.1"
static int pio_mask = 1;
@@ -30,7 +30,8 @@ static int pio_mask = 1;
* Provide our own set_mode() as we don't want to change anything that has
* already been configured..
*/
-static int pata_platform_set_mode(struct ata_port *ap, struct ata_device **unused)
+static int pata_platform_set_mode(struct ata_port *ap,
+ struct ata_device **unused)
{
int i;
@@ -48,6 +49,12 @@ static int pata_platform_set_mode(struct ata_port *ap, struct ata_device **unuse
return 0;
}
+static void pata_platform_error_handler(struct ata_port *ap)
+{
+ ata_bmdma_drive_eh(ap, NULL, ata_std_softreset, NULL,
+ ata_std_postreset);
+}
+
static int ata_dummy_ret0(struct ata_port *ap) { return 0; }
static struct scsi_host_template pata_platform_sht = {
@@ -80,7 +87,7 @@ static struct ata_port_operations pata_platform_port_ops = {
.freeze = ata_bmdma_freeze,
.thaw = ata_bmdma_thaw,
- .error_handler = ata_bmdma_error_handler,
+ .error_handler = pata_platform_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
.cable_detect = ata_cable_unknown,
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] ata: pata_platform: Disable prereset logic.
2007-05-23 6:44 [PATCH] ata: pata_platform: Disable prereset logic Paul Mundt
@ 2007-05-23 8:07 ` Tejun Heo
2007-05-23 8:30 ` Paul Mundt
0 siblings, 1 reply; 6+ messages in thread
From: Tejun Heo @ 2007-05-23 8:07 UTC (permalink / raw)
To: Paul Mundt, Jeff Garzik, Tejun Heo, linux-ide, linux-kernel
Paul Mundt wrote:
> On a number of boards the current prereset logic seems to misbehave:
>
> scsi0 : pata_platform
> ata1: PATA max PIO0 cmd 0xb06001f0 ctl 0xb06003f6 bmdma 0x00000000 irq 0
> ata1: device not ready (errno=-19), forcing hardreset
> ata1: BUG: prereset() requested invalid reset type
>
> This triggers when there is no card inserted in the slot.
>
> Simply disabling the prereset gets rid of this, and doesn't seem to cause
> any problems for either PCMCIA or CF cards when they're actually present.
NACK. The BUG printking needs fixing but you can't just kill
prereset(). Did it work properly on 2.6.21.1? Can you modify
ata_wait_ready() such that it prints out the status value while waiting?
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ata: pata_platform: Disable prereset logic.
2007-05-23 8:07 ` Tejun Heo
@ 2007-05-23 8:30 ` Paul Mundt
2007-05-23 9:29 ` Tejun Heo
0 siblings, 1 reply; 6+ messages in thread
From: Paul Mundt @ 2007-05-23 8:30 UTC (permalink / raw)
To: Tejun Heo; +Cc: Jeff Garzik, linux-ide, linux-kernel
On Wed, May 23, 2007 at 10:07:08AM +0200, Tejun Heo wrote:
> Paul Mundt wrote:
> > On a number of boards the current prereset logic seems to misbehave:
> >
> > scsi0 : pata_platform
> > ata1: PATA max PIO0 cmd 0xb06001f0 ctl 0xb06003f6 bmdma 0x00000000 irq 0
> > ata1: device not ready (errno=-19), forcing hardreset
> > ata1: BUG: prereset() requested invalid reset type
> >
> > This triggers when there is no card inserted in the slot.
> >
> > Simply disabling the prereset gets rid of this, and doesn't seem to cause
> > any problems for either PCMCIA or CF cards when they're actually present.
>
> NACK. The BUG printking needs fixing but you can't just kill
> prereset(). Did it work properly on 2.6.21.1? Can you modify
> ata_wait_ready() such that it prints out the status value while waiting?
>
ata_wait_ready() works fine, it reports 0xff immediately (and this is
what I would expect when there is no card inserted).
The board that exhibits this behaviour wasn't supported in the older
kernels, I can backport and test if it will be useful, though.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ata: pata_platform: Disable prereset logic.
2007-05-23 8:30 ` Paul Mundt
@ 2007-05-23 9:29 ` Tejun Heo
2007-05-23 9:48 ` Paul Mundt
0 siblings, 1 reply; 6+ messages in thread
From: Tejun Heo @ 2007-05-23 9:29 UTC (permalink / raw)
To: Paul Mundt, Tejun Heo, Jeff Garzik, linux-ide, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]
Paul Mundt wrote:
> On Wed, May 23, 2007 at 10:07:08AM +0200, Tejun Heo wrote:
>> Paul Mundt wrote:
>>> On a number of boards the current prereset logic seems to misbehave:
>>>
>>> scsi0 : pata_platform
>>> ata1: PATA max PIO0 cmd 0xb06001f0 ctl 0xb06003f6 bmdma 0x00000000 irq 0
>>> ata1: device not ready (errno=-19), forcing hardreset
>>> ata1: BUG: prereset() requested invalid reset type
>>>
>>> This triggers when there is no card inserted in the slot.
>>>
>>> Simply disabling the prereset gets rid of this, and doesn't seem to cause
>>> any problems for either PCMCIA or CF cards when they're actually present.
>> NACK. The BUG printking needs fixing but you can't just kill
>> prereset(). Did it work properly on 2.6.21.1? Can you modify
>> ata_wait_ready() such that it prints out the status value while waiting?
>>
> ata_wait_ready() works fine, it reports 0xff immediately (and this is
> what I would expect when there is no card inserted).
Does the attached patch fix your problem?
--
tejun
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 525 bytes --]
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index a6de57e..79f2175 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3368,7 +3368,7 @@ int ata_std_prereset(struct ata_port *ap
*/
if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_port_offline(ap)) {
rc = ata_wait_ready(ap, deadline);
- if (rc) {
+ if (rc && rc != -ENODEV) {
ata_port_printk(ap, KERN_WARNING, "device not ready "
"(errno=%d), forcing hardreset\n", rc);
ehc->i.action |= ATA_EH_HARDRESET;
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] ata: pata_platform: Disable prereset logic.
2007-05-23 9:29 ` Tejun Heo
@ 2007-05-23 9:48 ` Paul Mundt
2007-05-23 9:58 ` [PATCH] libata: -ENODEV during prereset isn't an error Tejun Heo
0 siblings, 1 reply; 6+ messages in thread
From: Paul Mundt @ 2007-05-23 9:48 UTC (permalink / raw)
To: Tejun Heo; +Cc: Jeff Garzik, linux-ide, linux-kernel
On Wed, May 23, 2007 at 11:29:37AM +0200, Tejun Heo wrote:
> Paul Mundt wrote:
> > On Wed, May 23, 2007 at 10:07:08AM +0200, Tejun Heo wrote:
> >> Paul Mundt wrote:
> >>> On a number of boards the current prereset logic seems to misbehave:
> >>>
> >>> scsi0 : pata_platform
> >>> ata1: PATA max PIO0 cmd 0xb06001f0 ctl 0xb06003f6 bmdma 0x00000000 irq 0
> >>> ata1: device not ready (errno=-19), forcing hardreset
> >>> ata1: BUG: prereset() requested invalid reset type
> >>>
> >>> This triggers when there is no card inserted in the slot.
> >>>
> > ata_wait_ready() works fine, it reports 0xff immediately (and this is
> > what I would expect when there is no card inserted).
>
> Does the attached patch fix your problem?
>
Yes, that works fine, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] libata: -ENODEV during prereset isn't an error
2007-05-23 9:48 ` Paul Mundt
@ 2007-05-23 9:58 ` Tejun Heo
0 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2007-05-23 9:58 UTC (permalink / raw)
To: Paul Mundt, Tejun Heo, Jeff Garzik, linux-ide, linux-kernel
During prereset, -ENODEV return from ata_wait_ready() is not an error.
This causes unnecessary bug message on controllers which uses 0xff to
indicate empty port. Fix it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
This one is for 2.6.22 too. Thanks.
libata-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index a6de57e..79f2175 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3368,7 +3368,7 @@ int ata_std_prereset(struct ata_port *ap
*/
if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_port_offline(ap)) {
rc = ata_wait_ready(ap, deadline);
- if (rc) {
+ if (rc && rc != -ENODEV) {
ata_port_printk(ap, KERN_WARNING, "device not ready "
"(errno=%d), forcing hardreset\n", rc);
ehc->i.action |= ATA_EH_HARDRESET;
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-05-23 9:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-23 6:44 [PATCH] ata: pata_platform: Disable prereset logic Paul Mundt
2007-05-23 8:07 ` Tejun Heo
2007-05-23 8:30 ` Paul Mundt
2007-05-23 9:29 ` Tejun Heo
2007-05-23 9:48 ` Paul Mundt
2007-05-23 9:58 ` [PATCH] libata: -ENODEV during prereset isn't an error Tejun Heo
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).