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

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

diff -u --recursive --new-file v1.3.62/linux/drivers/block/ali14xx.c linux/drivers/block/ali14xx.c
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/block/ali14xx.c       Version 0.01  Feb 06, 1996
+ *  linux/drivers/block/ali14xx.c       Version 0.03  Feb 09, 1996
  *
  *  Copyright (C) 1996  Linus Torvalds & author (see below)
  */
@@ -37,8 +37,21 @@
 #include <linux/hdreg.h>
 #include <asm/io.h>
 #include "ide.h"
+#include "ide_modes.h"
 
-#define ALI_14xx_BUS_SPEED	40	/* PCI / VLB bus speed */
+/*
+ * This should be set to the system's local bus (PCI or VLB) speed,
+ * e.g., 33 for a 486DX33 or 486DX2/66.  Legal values are anything
+ * from 25 to 50.  Setting this too *low* will make the EIDE
+ * controller unable to communicate with the disks.
+ *
+ * I suggest using a default of 50, since it should work ok with any
+ * system.  (Low values cause problems because it multiplies by bus speed
+ * to get cycles, and thus gets a too-small cycle count and tries to
+ * access the disks too fast.  I tried this once under DOS and it locked
+ * up the system.)	-- derekn@vw.ece.cmu.edu
+ */
+#define ALI_14xx_BUS_SPEED	50	/* PCI / VLB bus speed */
 
 /* port addresses for auto-detection */
 #define ALI_NUM_PORTS 4
@@ -112,11 +125,11 @@
 	struct hd_driveid *id = drive->id;
 	unsigned long flags;
 
-	if (pio == 255)  {	/* auto-tune */
-		pio = id->tPIO;
-		if ((id->field_valid & 0x02) && (id->eide_pio_modes & 0x01))
-			pio = 3;
-	}
+	if (pio == 255)
+		pio = ide_get_best_pio_mode(drive);
+	if (pio > 3)
+		pio = 3;
+
 	/* calculate timing, according to PIO mode */
 	time1 = timeTab[pio].time1;
 	time2 = timeTab[pio].time2;

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