+ via-pata-controller-xfer-fixes.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     VIA PATA controller xfer fixes

has been added to the -mm tree.  Its filename is

     via-pata-controller-xfer-fixes.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: VIA PATA controller xfer fixes
From: matthieu castet <castet.matthieu@xxxxxxx>


On via controller(vt8235) and pata via, some ATAPI devices (CDR-6S48) fail
in the xfer mode initialisation.  This make the boot slow and the drive
unsuable.

It seems the interrupt for xfer mode is done before the drive is ready, so
the current libata code skip the interrupt.  But no new interrupt is done
by the controller, so the xfer mode fails.

A quirk is to wait for 10 us (by step of 1 us) and see if the device
becomes ready in the case of SETFEATURES_XFER feature.  The problem seems
pata_via only, so the quirk is put in the pata_via interrupt handler as
Tejun Heo request.

It won't affect working devices, as we don't wait if the device is already
ready.  It will adds an extra ata_altstatus in order to avoid to duplicate
ata_host_intr, but only in the case of SETFEATURES_XFER (with should happen
only few times).

Sorry for the lack of changelog in my previous mail, I tought the old
changelog + move it in pata via interrupt was enought.  And sorry again, I
sent you a bad patch (I forgot a quitl refresh).

Signed-off-by: Matthieu CASTET <castet.matthieu@xxxxxxx>
Cc: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@xxxxxxxxxxxxxx>
Cc: Jeff Garzik <jeff@xxxxxxxxxx>
Cc: Tejun Heo <htejun@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/scsi/pata_via.c |   69 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 67 insertions(+), 2 deletions(-)

diff -puN drivers/scsi/pata_via.c~via-pata-controller-xfer-fixes drivers/scsi/pata_via.c
--- a/drivers/scsi/pata_via.c~via-pata-controller-xfer-fixes
+++ a/drivers/scsi/pata_via.c
@@ -283,6 +283,71 @@ static void via_set_dmamode(struct ata_p
 	via_do_set_mode(ap, adev, adev->dma_mode, tclock[mode], set_ast, udma[mode]);
 }
 
+/**
+ *	pata_via_interrupt - ATA host interrupt handler for pata via
+ *	@irq: irq line (unused)
+ *	@dev_instance: pointer to our ata_host_set information structure
+ *	@regs: unused
+ *
+ *	Interrupt handler for via controller that is the default interrupt
+ *	handler with a quirk for some ATAPI devices.
+ *	Calls ata_host_intr() for each port that is not disabled.
+ *
+ *	LOCKING:
+ *	Obtains host_set lock during operation.
+ *
+ *	RETURNS:
+ *	IRQ_NONE or IRQ_HANDLED.
+ */
+
+static irqreturn_t pata_via_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
+{
+	struct ata_host_set *host_set = dev_instance;
+	unsigned int i;
+	unsigned int handled = 0;
+	unsigned long flags;
+
+	/* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */
+	spin_lock_irqsave(&host_set->lock, flags);
+
+	for (i = 0; i < host_set->n_ports; i++) {
+		struct ata_port *ap;
+
+		ap = host_set->ports[i];
+		if (ap &&
+				!(ap->flags & ATA_FLAG_DISABLED)) {
+			struct ata_queued_cmd *qc;
+
+			qc = ata_qc_from_tag(ap, ap->active_tag);
+			if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
+					(qc->flags & ATA_QCFLAG_ACTIVE)) {
+				if (qc->tf.command == ATA_CMD_SET_FEATURES &&
+						qc->tf.feature == SETFEATURES_XFER) {
+					/* With some ATAPI devices (CDR-6S48, ...), the
+					 * ata_altstatus take some times (~ 2us) to become not busy.
+					 * Without this quirk, it is impossible to set the xfer
+					 * mode, and the libata-core disable the device.
+					 */
+					int i;
+					for (i = 0; ata_altstatus(ap) & ATA_BUSY; i++) {
+						if (i > 10)
+							continue;
+						udelay(1);
+					}
+
+					if (i)
+						ata_port_printk(ap, KERN_WARNING, "ata_altstatus take %dus\n", i);
+				}
+				handled |= ata_host_intr(ap, qc);
+			}
+		}
+	}
+
+	spin_unlock_irqrestore(&host_set->lock, flags);
+
+	return IRQ_RETVAL(handled);
+}
+
 static struct scsi_host_template via_sht = {
 	.module			= THIS_MODULE,
 	.name			= DRV_NAME,
@@ -328,7 +393,7 @@ static struct ata_port_operations via_po
 	.eng_timeout	= ata_eng_timeout,
 	.data_xfer	= ata_pio_data_xfer,
 
-	.irq_handler	= ata_interrupt,
+	.irq_handler	= pata_via_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 
 	.port_start	= ata_port_start,
@@ -363,7 +428,7 @@ static struct ata_port_operations via_po
 	.eng_timeout	= ata_eng_timeout,
 	.data_xfer	= ata_pio_data_xfer_noirq,
 
-	.irq_handler	= ata_interrupt,
+	.irq_handler	= pata_via_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 
 	.port_start	= ata_port_start,
_

Patches currently in -mm which might be from castet.matthieu@xxxxxxx are

origin.patch
pnpacpi-reject-acpi_producer-resources.patch
via-pata-controller-xfer-fixes.patch
via-pata-controller-xfer-fixes-tidy.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux