Skip to contentSkip to conversation

libata: fix (hopefully) all the remaining problems with devices failing setup/identify

PATCH Applied [email protected] 3 participants 3 messages Oct 2, 2007 – Oct 23, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 10/10 libata: fix (hopefully) all the remaining problems with devices failing setup/identify

From: Alan <[email protected]>

Two fixes in this test patch. One of them allows old CF cards to refuse pio mode setting, and one to wait for the drive to settle after a set features changes the speed settings, which is based upon the workarounds used by drivers/ide.

Please test and report back if you have an afflicted system. This patch isn't for merging just testing.

The CF card fix will still display errors when the card works (got fixes for that once I know the cure works) but should then be found/usable.

Not signed off by anyone, not for merging

---

 drivers/ata/libata-core.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/ata/libata-core.c renamed from drivers/ata/libata-core.c~libata-fix-hopefully-all-the-remaining-problems-with +15 -0
diff -puN drivers/ata/libata-core.c~libata-fix-hopefully-all-the-remaining-problems-with drivers/ata/libata-core.c
@@ -5933,6 +5933,7 @@ inline unsigned int ata_host_intr (struc
 {
 	struct ata_eh_info *ehi = &ap->link.eh_info;
 	u8 status, host_stat = 0;
+	int i;
 
 	VPRINTK("ata%u: protocol %d task_state %d\n",
 		ap->print_id, qc->tf.protocol, ap->hsm_task_state);
@@ -5989,6 +5990,20 @@ inline unsigned int ata_host_intr (struc
 	if (unlikely(status & ATA_BUSY))
 		goto idle_irq;
 
+	if (unlikely(qc->tf.command == ATA_CMD_SET_FEATURES &&
+			qc->tf.feature == SETFEATURES_XFER)) {
+		/* Let the timings change settle and the drive catch up as
+		   some hardware needs up to 10uS to get its brain back in
+		   gear. Taken from the workarounds in drivers/ide done by
+		   Matthew Faupel/Niccolo Rigacci */
+		for (i = 0; i < 10; i++) {
+			if ((status & (ATA_BUSY | ATA_DRQ | ATA_ERR)) == 0)
+				break;
+			udelay(1);
+			status = ata_chk_status(ap);
+		}
+	}
+
 	/* ack bmdma irq events */
 	ap->ops->irq_clear(ap);
 

_

#1 lore raw
Quoted 7 lines · [email protected] wrote:

From: Alan <[email protected]>

Two fixes in this test patch. One of them allows old CF cards to refuse pio mode setting, and one to wait for the drive to settle after a set features changes the speed settings, which is based upon the workarounds used by drivers/ide.

Quoted 7 lines

Please test and report back if you have an afflicted system. This patch isn't for merging just testing.

The CF card fix will still display errors when the card works (got fixes for that once I know the cure works) but should then be found/usable.

Not signed off by anyone, not for merging

applied to libata-dev.git#for-testing, a throwaway branch for things like this

#2 lore raw
Quoted 11 lines · Jeff Garzik
Quoted 10 lines · [email protected] wrote:

From: Alan <[email protected]>

Two fixes in this test patch. One of them allows old CF cards to refuse pio mode setting, and one to wait for the drive to settle after a set features changes the speed settings, which is based upon the workarounds used by drivers/ide.

Please test and report back if you have an afflicted system. This patch isn't for merging just testing.

Quoted 7 lines
Quoted 4 lines

The CF card fix will still display errors when the card works (got fixes for that once I know the cure works) but should then be found/usable.

Not signed off by anyone, not for merging

applied to libata-dev.git#for-testing, a throwaway branch for things like this

(It has been quite some time. I'm catching up after a series of family events and moving.)

I don't think this would make any difference. Transfer mode configuration is done using polling to work around problems like this and because some controllers and devices raise IRQ too early.

Signature · 1 line
tejun