[PARPORT] [patch] 2.2.5-imm EPP problems


Andrea Arcangeli (andrea@e-mind.com)
Sun, 4 Apr 1999 03:05:08 +0200 (CEST)


Well, if you remeber my friend Luca had problems with his Zip-plus and imm
in 2.2.5 (block read errors and the ZIP was looping with the
read/write-led on).

Tomorrow I am been at Luca's home and so I spent some good time in
debugging the problem.

I checked that 2.2.5-imm was working _fine_ in all modes except all EPP
modes (epp8/16/32). So the bug was really EPP-handshake specific.

The buffers|lenght thing looked suspictious to me (I have to admit that I
didn't thought too much about it, but as first read it didn't make too
much sense to me ;) and so I changed to code to do the old behavior and
with this patch applyed imm-2.2.5 now works _fine_ (while without this
patch it does not work at all).

(patch against 2.2.5)
--- linux/drivers/scsi/imm.c Mon Feb 15 08:17:31 1999
+++ /usr/src/unstable/linux/drivers/scsi/imm.c Sat Apr 3 17:19:16 1999
@@ -420,6 +420,14 @@
     return 1; /* All went well - we hope! */
 }
 
+static inline int imm_epp_out(unsigned short base, char *buffer, int len)
+{
+ int i;
+ for (i = len; i; i--)
+ w_epp(base, *buffer++);
+ return 1;
+}
+
 static int imm_nibble_in(unsigned short base, char *buffer, int len)
 {
     unsigned char l;
@@ -476,21 +484,11 @@
     case IMM_EPP_32:
     case IMM_EPP_16:
     case IMM_EPP_8:
- epp_reset(ppb);
- w_ctr(ppb, 0x4);
-#ifdef CONFIG_SCSI_IZIP_EPP16
- if (!(((long) buffer | len) & 0x01))
- outsw(ppb + 4, buffer, len >> 1);
-#else
- if (!(((long) buffer | len) & 0x03))
- outsl(ppb + 4, buffer, len >> 2);
-#endif
- else
- outsb(ppb + 4, buffer, len);
- w_ctr(ppb, 0xc);
- r = !(r_str(ppb) & 0x01);
- w_ctr(ppb, 0xc);
- ecp_sync(ppb);
+ epp_reset(ppb);
+ w_ctr(ppb, 0x4);
+ r = imm_epp_out(ppb, buffer, len);
+ w_ctr(ppb, 0xc);
+ ecp_sync(ppb);
         break;
 
     case IMM_NIBBLE:
@@ -506,6 +504,14 @@
     return r;
 }
 
+static inline int imm_epp_in(unsigned short base, char *buffer, int len)
+{
+ int i;
+ for (i = len; i; i--)
+ *buffer++ = r_epp(base);
+ return 1;
+}
+
 static int imm_in(int host_no, char *buffer, int len)
 {
     int r;
@@ -538,21 +544,11 @@
     case IMM_EPP_32:
     case IMM_EPP_16:
     case IMM_EPP_8:
- epp_reset(ppb);
- w_ctr(ppb, 0x24);
-#ifdef CONFIG_SCSI_IZIP_EPP16
- if (!(((long) buffer | len) & 0x01))
- insw(ppb + 4, buffer, len >> 1);
-#else
- if (!(((long) buffer | len) & 0x03))
- insl(ppb + 4, buffer, len >> 2);
-#endif
- else
- insb(ppb + 4, buffer, len);
- w_ctr(ppb, 0x2c);
- r = !(r_str(ppb) & 0x01);
- w_ctr(ppb, 0x2c);
- ecp_sync(ppb);
+ epp_reset(ppb);
+ w_ctr(ppb, 0x24);
+ r = imm_epp_in(ppb, buffer, len);
+ w_ctr(ppb, 0x2c);
+ ecp_sync(ppb);
         break;
 
     default:

I also seen that ppa has equivalent code but I haven't checked yet if ppa
works fine here or not with the `buffer | len' thing.

Andrea Arcangeli

-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --



This archive was generated by hypermail 2.0b3 on Sat 03 Apr 1999 - 20:17:26 EST