patch-2.2.0-pre9 linux/drivers/misc/parport_ieee1284.c

Next file: linux/drivers/net/3c59x.c
Previous file: linux/drivers/isdn/isdn_ppp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre8/linux/drivers/misc/parport_ieee1284.c linux/drivers/misc/parport_ieee1284.c
@@ -47,8 +47,12 @@
  */
 int parport_ieee1284_nibble_mode_ok(struct parport *port, unsigned char mode) 
 {
+	/* make sure it's a valid state, set nStrobe & nAutoFeed high */
+	parport_write_control(port, (parport_read_control(port) \
+		& ~1 ) & ~2);
+	udelay(1);
 	parport_write_data(port, mode);
-	udelay(500);
+	udelay(1);
 	/* nSelectIn high, nAutoFd low */
 	parport_write_control(port, (parport_read_control(port) & ~8) | 2);
 	if (parport_wait_peripheral(port, 0x78, 0x38)) {
@@ -58,11 +62,12 @@
 	}
 	/* nStrobe low */
 	parport_write_control(port, parport_read_control(port) | 1);
-	udelay(5);				     /* Strobe wait */
-	/* nStrobe high */
-	parport_write_control(port, parport_read_control(port) & ~1);
-	udelay(5);
-	/* nAutoFd low */
-	parport_write_control(port, parport_read_control(port) & ~2);
-	return (parport_wait_peripheral(port, 0x20, 0))?2:1;
+	udelay(1);				     /* Strobe wait */
+	/* nStrobe high, nAutoFeed low, last step before transferring 
+	 *  reverse data */
+	parport_write_control(port, (parport_read_control(port) \
+		& ~1) & ~2);
+	udelay(1);
+	/* Data available? */
+	return (parport_wait_peripheral(port, 0x20, 0))?1:2;
 }

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