patch-1.3.63 linux/drivers/block/dtc2278.c

Next file: linux/drivers/block/ht6560b.c
Previous file: linux/drivers/block/cmd640.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.62/linux/drivers/block/dtc2278.c linux/drivers/block/dtc2278.c
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/block/dtc2278.c       Version 0.01  Feb 06, 1996
+ *  linux/drivers/block/dtc2278.c       Version 0.02  Feb 10, 1996
  *
  *  Copyright (C) 1996  Linus Torvalds & author (see below)
  */
@@ -16,6 +16,12 @@
 #include <linux/hdreg.h>
 #include <asm/io.h>
 #include "ide.h"
+#include "ide_modes.h"
+
+/*
+ * Changing this #undef to #define may solve start up problems in some systems.
+ */
+#undef ALWAYS_SET_DTC2278_PIO_MODE
 
 /*
  * From: andy@cercle.cts.com (Dyan Wile)
@@ -27,9 +33,9 @@
  * /dev/hd.. ) for the drives connected to the EIDE interface. (I get my
  * filesystem  corrupted with -u1, but under heavy disk load only :-)
  *
- * From: mlord@bnr.ca -- this chipset is now forced to use the "serialize" feature,
- * which hopefully will make it more reliable to use.. maybe it has the same bugs
- * as the CMD640B and RZ1000 ??
+ * This chipset is now forced to use the "serialize" feature,
+ * and irq-unmasking is disallowed.  If io_32bit is enabled,
+ * it must be done for BOTH drives on each interface.
  */
 
 static void sub22 (char b, char c)
@@ -50,24 +56,31 @@
 	}
 }
 
-static void tune_dtc2278 (ide_drive_t *drive, byte pio_mode)
+static void tune_dtc2278 (ide_drive_t *drive, byte pio)
 {
 	unsigned long flags;
 
-	if (pio_mode != 255) {	/* auto-tune not yet supported here */
-		if (pio_mode >= 3) {
-			save_flags(flags);
-			cli();
-			/*
-			 * This enables PIO mode4 (3?) on the first interface
-			 */
-			sub22(1,0xc3);
-			sub22(0,0xa0);
-			restore_flags(flags);
-		} else {
-			/* we don't know how to set it back again.. */
-		}
+	if (pio == 255)
+		pio = ide_get_best_pio_mode(drive);
+
+	if (pio >= 3) {
+		save_flags(flags);
+		cli();
+		/*
+		 * This enables PIO mode4 (3?) on the first interface
+		 */
+		sub22(1,0xc3);
+		sub22(0,0xa0);
+		restore_flags(flags);
+	} else {
+		/* we don't know how to set it back again.. */
 	}
+
+	/*
+	 * 32bit I/O has to be enabled for *both* drives at the same time.
+	 */
+	drive->io_32bit = 1;
+	HWIF(drive)->drives[!drive->select.b.unit].io_32bit = 1;
 }
 
 void init_dtc2278 (void)
@@ -83,10 +96,20 @@
 	inb(0x3f6);
 	outb_p(0x20,0xb4);
 	inb(0x3f6);
+#ifdef ALWAYS_SET_DTC2278_PIO_MODE
+	/*
+	 * This enables PIO mode4 (3?) on the first interface
+	 * and may solve start-up problems for some people.
+	 */
+	sub22(1,0xc3);
+	sub22(0,0xa0);
+#endif
 	restore_flags(flags);
 
 	ide_hwifs[0].serialized = 1;
 	ide_hwifs[0].chipset = ide_dtc2278;
 	ide_hwifs[1].chipset = ide_dtc2278;
 	ide_hwifs[0].tuneproc = &tune_dtc2278;
+	ide_hwifs[0].no_unmask = 1;
+	ide_hwifs[1].no_unmask = 1;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this