patch-2.3.20 linux/drivers/parport/ieee1284.c

Next file: linux/drivers/parport/ieee1284_ops.c
Previous file: linux/drivers/net/pcmcia/rayctl.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.19/linux/drivers/parport/ieee1284.c linux/drivers/parport/ieee1284.c
@@ -151,8 +151,6 @@
 {
 	port = port->physport;
 
-	port->ieee1284.phase = IEEE1284_PH_TERMINATE;
-
 	/* EPP terminates differently. */
 	switch (port->ieee1284.mode) {
 	case IEEE1284_MODE_EPP:
@@ -161,17 +159,42 @@
 		/* Terminate from EPP mode. */
 
 		/* Event 68: Set nInit low */
-		parport_frob_control (port,
-				      PARPORT_CONTROL_INIT,
-				      PARPORT_CONTROL_INIT);
+		parport_frob_control (port, PARPORT_CONTROL_INIT, 0);
 		udelay (50);
 
 		/* Event 69: Set nInit high, nSelectIn low */
 		parport_frob_control (port,
-				      PARPORT_CONTROL_SELECT,
-				      PARPORT_CONTROL_SELECT);
+				      PARPORT_CONTROL_SELECT
+				      | PARPORT_CONTROL_INIT,
+				      PARPORT_CONTROL_SELECT
+				      | PARPORT_CONTROL_INIT);
 		break;
-		
+
+	case IEEE1284_MODE_ECP:
+	case IEEE1284_MODE_ECPRLE:
+	case IEEE1284_MODE_ECPSWE:
+		/* In ECP we can only terminate from fwd idle phase. */
+		if (port->ieee1284.phase != IEEE1284_PH_FWD_IDLE) {
+			/* Event 47: Set nInit high */
+			parport_frob_control (port,
+					      PARPORT_CONTROL_INIT
+					      | PARPORT_CONTROL_AUTOFD,
+					      PARPORT_CONTROL_INIT
+					      | PARPORT_CONTROL_AUTOFD);
+
+			/* Event 49: PError goes high */
+			parport_wait_peripheral (port,
+						 PARPORT_STATUS_PAPEROUT,
+						 PARPORT_STATUS_PAPEROUT);
+
+			parport_data_forward (port);
+			DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n",
+				 port->name);
+			port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
+		}
+
+		/* fall-though.. */
+
 	default:
 		/* Terminate from all other modes. */
 

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