patch-2.4.14 linux/drivers/block/paride/epat.c

Next file: linux/drivers/block/paride/pcd.c
Previous file: linux/drivers/block/paride/Config.in
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.13/linux/drivers/block/paride/epat.c linux/drivers/block/paride/epat.c
@@ -12,10 +12,11 @@
 /* Changes:
 
         1.01    GRG 1998.05.06 init_proto, release_proto
+        1.02    Joshua b. Jore CPP(renamed), epat_connect, epat_disconnect
 
 */
 
-#define EPAT_VERSION      "1.01"
+#define EPAT_VERSION      "1.02"
 
 #include <linux/module.h>
 #include <linux/delay.h>
@@ -197,30 +198,50 @@
 #define WRi(r,v)         epat_write_regr(pi,0,r,v)
 #define RRi(r)           (epat_read_regr(pi,0,r))
 
-/* FIXME:  the CCP stuff should be fixed to handle multiple EPATs on a chain */
+/* FIXME:  the CPP stuff should be fixed to handle multiple EPATs on a chain */
 
-#define CCP(x) 	w2(4);w0(0x22);w0(0xaa);w0(0x55);w0(0);w0(0xff);\
+#define CPP(x) 	w2(4);w0(0x22);w0(0xaa);w0(0x55);w0(0);w0(0xff);\
                 w0(0x87);w0(0x78);w0(x);w2(4);w2(5);w2(4);w0(0xff);
 
 static void epat_connect ( PIA *pi )
 
 {       pi->saved_r0 = r0();
         pi->saved_r2 = r2();
-	CCP(0); CCP(0xe0);
+
+#ifdef CONFIG_PARIDE_EPATC8
+ 	/* Initialize the chip */
+        CPP(0);CPP(0x40);CPP(0xe0);              
+        w0(0);w2(1);w2(4);
+        WR(0x8,0x12);WR(0xc,0x14);WR(0x12,0x10);
+        WR(0xe,0xf);WR(0xf,4);
+     /* WR(0xe,0xa);WR(0xf,4); */
+        WR(0xe,0xd);WR(0xf,0);
+     /* CPP(0x30); */
+
+        /* Connect to the chip */
+	CPP(0xe0);
+        w0(0);w2(1);w2(4); /* Idle into SPP */
+        if (pi->mode >= 3) {
+          w0(0);w2(1);w2(4);w2(0xc);
+          /* Request EPP */
+          w0(0x40);w2(6);w2(7);w2(4);w2(0xc);w2(4);
+        }
+#else
+ 	CPP(0); CPP(0xe0);
 	w0(0); w2(1); w2(4);
 	if (pi->mode >= 3) {
 		w0(0); w2(1); w2(4); w2(0xc);
 		w0(0x40); w2(6); w2(7); w2(4); w2(0xc); w2(4);
 	}
 	WR(8,0x10); WR(0xc,0x14); WR(0xa,0x38); WR(0x12,0x10);
+#endif
 }
 
-static void epat_disconnect ( PIA *pi )
-
-{       CCP(0x30);
-        w0(pi->saved_r0);
-        w2(pi->saved_r2);
-} 
+static void epat_disconnect (PIA *pi)
+{	CPP(0x30);
+	w0(pi->saved_r0);
+	w2(pi->saved_r2);
+}
 
 static int epat_test_proto( PIA *pi, char * scratch, int verbose )
 
@@ -282,6 +303,7 @@
 static void epat_init_proto( PIA *pi)
 
 {  	MOD_INC_USE_COUNT;
+	printk("epat_init_proto");
 }
 
 static void epat_release_proto( PIA *pi)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)