All of lore.kernel.org
 help / color / mirror / Atom feed
* Workaround for VIA chipset+ATAPI ZIP 100 problem
@ 2001-08-28  6:55 Timo Teras
  2001-08-28 11:07 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Timo Teras @ 2001-08-28  6:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: mihaim, stepan

[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]

Hi, all.

I've seen a couple of mails telling about the probelem with
some via chipsets and atapa floppy disks.
I experienced the same problem lately and decided to investigate this
matter a bit.

The problem symtops were ide bus lockup and the following messages:
hdd: lost interrupt 
ide-floppy: CoD != 0 in idefloppy_pc_intr 
hdd: ATAPI reset complete 

After extensive tracing the look seemed to change from 100% sure
to random ones and they only followed after a large write packet
command. I decided to try a small delay before every command
(the hardware might busy after the write and ignoring new requests).
This seemed to cure my atapi zip floppy.

I'm not a kernel or an ide expert, but I created a little patch
which works on my system quite stably. Any feedback on the solution
appreciated: eg. if it works for others or not and is the chipset
stuff I added okay. Also I'm not sure which versions of the via
chipset are the buggy ones so it enables the workaround whenever
a via chipset is found.

Regards,
  Timo Teräs

PS. Please send mails directly or Cc me, since I haven't subscribed
to this list.

[-- Attachment #2: via-ide-floppy-kludge.patch --]
[-- Type: text/plain, Size: 2343 bytes --]

diff -u -r linux.orig/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
--- linux.orig/drivers/ide/ide-floppy.c	Fri Feb  9 21:30:23 2001
+++ linux/drivers/ide/ide-floppy.c	Tue Aug 28 00:26:12 2001
@@ -238,6 +238,8 @@
 	int wp;							/* Write protect */
 
 	unsigned int flags;			/* Status/Action flags */
+
+        unsigned long via_kludge;
 } idefloppy_floppy_t;
 
 /*
@@ -1034,11 +1036,19 @@
 
 static void idefloppy_rw_callback (ide_drive_t *drive)
 {
+	idefloppy_floppy_t *floppy = drive->driver_data;
+
 #if IDEFLOPPY_DEBUG_LOG	
 	printk (KERN_INFO "ide-floppy: Reached idefloppy_rw_callback\n");
 #endif /* IDEFLOPPY_DEBUG_LOG */
 
 	idefloppy_end_request(1, HWGROUP(drive));
+
+	if (HWIF(drive)->chipset == ide_via82cxxx &&
+	    (floppy->pc->c[0] == IDEFLOPPY_WRITE10_CMD ||
+	     floppy->pc->c[0] == IDEFLOPPY_WRITE12_CMD)) {
+                floppy->via_kludge = jiffies + HZ/40;
+	}
 	return;
 }
 
@@ -1153,6 +1163,13 @@
 		idefloppy_end_request (0, HWGROUP(drive));
 		return ide_stopped;
 	}
+	if (floppy->via_kludge) {
+		long wait = floppy->via_kludge - jiffies;
+		if (wait > 0) {
+                        mdelay(wait*1000/HZ);
+		}
+                floppy->via_kludge = 0;
+	}
 	switch (rq->cmd) {
 		case READ:
 		case WRITE:
@@ -1541,6 +1558,7 @@
 	memset (floppy, 0, sizeof (idefloppy_floppy_t));
 	floppy->drive = drive;
 	floppy->pc = floppy->pc_stack;
+        floppy->via_kludge = 0;
 	if (gcw.drq_type == 1)
 		set_bit (IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags);
 	/*
diff -u -r linux.orig/drivers/ide/via82cxxx.c linux/drivers/ide/via82cxxx.c
--- linux.orig/drivers/ide/via82cxxx.c	Sat Feb  3 21:27:43 2001
+++ linux/drivers/ide/via82cxxx.c	Mon Aug 27 23:45:04 2001
@@ -494,6 +494,7 @@
 	hwif->tuneproc = &via82cxxx_tune_drive;
 	hwif->speedproc = &via_set_drive;
 	hwif->autodma = 0;
+        hwif->chipset = ide_via82cxxx;
 
 	for (i = 0; i < 2; i++) {
 		hwif->drives[i].io_32bit = 1;
diff -u -r linux.orig/include/linux/ide.h linux/include/linux/ide.h
--- linux.orig/include/linux/ide.h	Sat May 26 04:02:42 2001
+++ linux/include/linux/ide.h	Mon Aug 27 23:44:50 2001
@@ -405,7 +405,7 @@
 		ide_qd6580,	ide_umc8672,	ide_ht6560b,
 		ide_pdc4030,	ide_rz1000,	ide_trm290,
 		ide_cmd646,	ide_cy82c693,	ide_4drives,
-		ide_pmac
+		ide_pmac,       ide_via82cxxx
 } hwif_chipset_t;
 
 #ifdef CONFIG_BLK_DEV_IDEPCI

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Workaround for VIA chipset+ATAPI ZIP 100 problem
  2001-08-28  6:55 Workaround for VIA chipset+ATAPI ZIP 100 problem Timo Teras
@ 2001-08-28 11:07 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2001-08-28 11:07 UTC (permalink / raw)
  To: Timo Teras; +Cc: linux-kernel, mihaim, stepan

> +	if (floppy->via_kludge) {
> +		long wait = floppy->via_kludge - jiffies;

that will do strange things when the timer wraps. Use unsigned and
"time_before"

As to the rest perhaps Andre can comment

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-08-28 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-28  6:55 Workaround for VIA chipset+ATAPI ZIP 100 problem Timo Teras
2001-08-28 11:07 ` Alan Cox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.