All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timo Teras <timo.teras@votek.com>
To: linux-kernel@vger.kernel.org
Cc: mihaim@profm.ro, stepan@srnet.cz
Subject: Workaround for VIA chipset+ATAPI ZIP 100 problem
Date: Tue, 28 Aug 2001 09:55:12 +0300	[thread overview]
Message-ID: <3B8B4050.7778F59A@votek.com> (raw)

[-- 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

             reply	other threads:[~2001-08-28  6:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-28  6:55 Timo Teras [this message]
2001-08-28 11:07 ` Workaround for VIA chipset+ATAPI ZIP 100 problem Alan Cox

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=3B8B4050.7778F59A@votek.com \
    --to=timo.teras@votek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihaim@profm.ro \
    --cc=stepan@srnet.cz \
    /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 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.