patch-2.2.0-pre5 linux/drivers/block/opti621.c

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

diff -u --recursive --new-file v2.2.0-pre4/linux/drivers/block/opti621.c linux/drivers/block/opti621.c
@@ -1,20 +1,26 @@
 /*
- *  linux/drivers/block/opti621.c       Version 0.3  Nov 29, 1997
+ *  linux/drivers/block/opti621.c       Version 0.6  Jan 02, 1999
  *
- *  Copyright (C) 1996-1998  Linus Torvalds & author (see below)
+ *  Copyright (C) 1996-1998  Linus Torvalds & authors (see below)
  */
 
 /*
- * OPTi 82C621 chipset EIDE controller driver
- * Author: Jaromir Koutek (E-mail: Jaromir.Koutek@st.mff.cuni.cz)
- *
+ * Authors:
+ * Jaromir Koutek <miri@punknet.cz>,
+ * Jan Harkes <jaharkes@cwi.nl>,
+ * Mark Lord <mlord@pobox.com>
  * Some parts of code are from ali14xx.c and from rz1000.c.
+ *
+ * OPTi is trademark of OPTi, Octek is trademark of Octek.
+ *
  * I used docs from OPTi databook, from ftp.opti.com, file 9123-0002.ps
  * and disassembled/traced setupvic.exe (DOS program).
  * It increases kernel code about 2 kB.
+ * I don't have this card no more, but I hope I can get some in case
+ * of needed development.
  * My card is Octek PIDE 1.01 (on card) or OPTiViC (program).
  * It has a place for a secondary connector in circuit, but nothing
- * is there. It cost about $25. Also BIOS says no address for
+ * is there. Also BIOS says no address for
  * secondary controller (see bellow in ide_init_opti621).
  * I've only tested this on my system, which only has one disk.
  * It's Western Digital WDAC2850, with PIO mode 3. The PCI bus
@@ -26,8 +32,18 @@
  * with the third, 1GB drive: I got 3MB/s (hdparm), but sometimes
  * it slows to about 100kB/s! I don't know why and I have
  * not this drive now, so I can't try it again.
- * If you have two disk, please boot in single mode and carefully
- * (you can boot on read-only fs) try to set PIO mode 0 etc.
+ * I write this driver because I lost the paper ("manual") with
+ * settings of jumpers on the card and I have to boot Linux with
+ * Loadlin except LILO, cause I have to run the setupvic.exe program
+ * already or I get disk errors (my test: rpm -Vf
+ * /usr/X11R6/bin/XF86_SVGA - or any big file).
+ * Some numbers from hdparm -t /dev/hda:
+ * Timing buffer-cache reads:   32 MB in  3.02 seconds =10.60 MB/sec
+ * Timing buffered disk reads:  16 MB in  5.52 seconds = 2.90 MB/sec
+ * I have 4 Megs/s before, but I don't know why (maybe changes
+ * in hdparm test).
+ * After release of 0.1, I got some successful reports, so it might work.
+ *
  * The main problem with OPTi is that some timings for master
  * and slave must be the same. For example, if you have master
  * PIO 3 and slave PIO 0, driver have to set some timings of
@@ -38,25 +54,37 @@
  * for autoselect mode (you can change it to PIO 0, if you want).
  * If you then set the second drive to another PIO, the old value
  * (automatically selected) will be overrided by yours.
- * I don't know what there is a 25/33MHz switch in configuration
- * register, driver is written for use at any frequency which get
+ * There is a 25/33MHz switch in configuration
+ * register, but driver is written for use at any frequency which get
  * (use idebus=xx to select PCI bus speed).
  * Use ide0=autotune for automatical tune of the PIO modes.
  * If you get strange results, do not use this and set PIO manually
  * by hdparm.
- * I write this driver because I lost the paper ("manual") with
- * settings of jumpers on the card and I have to boot Linux with
- * Loadlin except LILO, cause I have to run the setupvic.exe program
- * already or I get disk errors (my test: rpm -Vf
- * /usr/X11R6/bin/XF86_SVGA - or any big file).
- * Some numbers from hdparm -t /dev/hda:
- * Timing buffer-cache reads:   32 MB in  3.02 seconds =10.60 MB/sec
- * Timing buffered disk reads:  16 MB in  5.52 seconds = 2.90 MB/sec
- * I have 4 Megs/s before, but I don't know why (maybe bad hdparm).
- * If you tried this driver, please send me a E-mail of your experiences.
- * My E-mail address is Jaromir.Koutek@st.mff.cuni.cz (I hope
- * till 30. 6. 2000), otherwise you can try miri@atrey.karlin.mff.cuni.cz.
- * I think OPTi is trademark of OPTi, Octek is trademark of Octek and so on.
+ *
+ * Version 0.1, Nov 8, 1996
+ * by Jaromir Koutek, for 2.1.8. 
+ * Initial version of driver.
+ * 
+ * Version 0.2
+ * Number 0.2 skipped.
+ *
+ * Version 0.3, Nov 29, 1997
+ * by Mark Lord (probably), for 2.1.68
+ * Updates for use with new IDE block driver.
+ *
+ * Version 0.4, Dec 14, 1997
+ * by Jan Harkes
+ * Fixed some errors and cleaned the code.
+ *
+ * Version 0.5, Jan 2, 1998
+ * by Jaromir Koutek
+ * Updates for use with (again) new IDE block driver.
+ * Update of documentation.
+ * 
+ * Version 0.6, Jan 2, 1999
+ * by Jaromir Koutek
+ * Reversed to version 0.3 of the driver, because
+ * 0.5 doesn't work.
  */
 
 #undef REALLY_SLOW_IO	/* most systems can safely undef this */
@@ -98,8 +126,10 @@
 
 #define READ_REG 0	/* index of Read cycle timing register */
 #define WRITE_REG 1	/* index of Write cycle timing register */
-#define MISC_REG 6	/* index of Miscellaneous register */
 #define CNTRL_REG 3	/* index of Control register */
+#define STRAP_REG 5	/* index of Strap register */
+#define MISC_REG 6	/* index of Miscellaneous register */
+
 int reg_base;
 
 #define PIO_NOT_EXIST 254
@@ -203,9 +233,10 @@
 		clks->recovery_time = 2;
 		/* minimal values */
 	}
+ 
 }
 
-/* Main tune procedure, hooked by tuneproc. */
+/* Main tune procedure, called from tuneproc. */
 static void opti621_tune_drive (ide_drive_t *drive, byte pio)
 {
 	/* primary and secondary drives share some registers,
@@ -218,7 +249,7 @@
 	byte cycle1, cycle2, misc;
 	ide_hwif_t *hwif = HWIF(drive);
 
-	/* set drive->drive_data for both drives */
+	/* sets drive->drive_data for both drives */
 	compute_pios(drive, pio);
  	pio1 = hwif->drives[0].drive_data;
  	pio2 = hwif->drives[1].drive_data;
@@ -250,7 +281,7 @@
 	outb(0xff, reg_base+5);		/* hmm, setupvic.exe does this ;-) */
 	inb(reg_base+CNTRL_REG); 	/* if reads 0xff, adapter not exist? */
 	read_reg(CNTRL_REG);		/* if reads 0xc0, no interface exist? */
-	read_reg(5);			/* read version, probably 0 */
+	read_reg(STRAP_REG);		/* read version, probably 0 */
 
 	/* program primary drive */
 	write_reg(0,      MISC_REG);	/* select Index-0 for Register-A */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov