[PARPORT] extensibility link


Tim Waugh (tim@cyberelk.demon.co.uk)
Wed, 13 Oct 1999 08:53:26 +0100 (BST)


Does anyone have a strong opinion about this patch?

Tim.
*/

Index: linux/include/linux/parport.h
diff -u linux/include/linux/parport.h:1.2 linux/include/linux/parport.h:1.3
--- linux/include/linux/parport.h:1.2 Mon Sep 27 22:14:35 1999
+++ linux/include/linux/parport.h Wed Oct 13 08:40:54 1999
@@ -71,6 +71,10 @@
 #define IEEE1284_MODE_EPPSL (1<<11) /* EPP 1.7 */
 #define IEEE1284_MODE_EPPSWE (1<<12) /* Software-emulated */
 #define IEEE1284_DEVICEID (1<<2) /* This is a flag */
+#define IEEE1284_EXT_LINK (1<<14) /* This flag causes the
+ * extensibility link to
+ * be requested, using
+ * bits 0-6. */
 
 /* For the benefit of parport_read/write, you can use these with
  * parport_negotiate to use address operations. They have no effect
Index: linux/drivers/parport/ieee1284.c
diff -u linux/drivers/parport/ieee1284.c:1.4 linux/drivers/parport/ieee1284.c:1.5
--- linux/drivers/parport/ieee1284.c:1.4 Fri Oct 8 23:09:14 1999
+++ linux/drivers/parport/ieee1284.c Wed Oct 13 08:40:54 1999
@@ -278,6 +278,9 @@
                 return -ENOSYS; /* FIXME (implement BECP) */
         }
 
+ if (mode & IEEE1284_EXT_LINK)
+ m = 1<<7; /* request extensibility link */
+
         port->ieee1284.phase = IEEE1284_PH_NEGOTIATION;
 
         /* Start off with nStrobe and nAutoFd high, and nSelectIn low */
@@ -354,12 +357,59 @@
                 return 1;
         }
 
+ /* More to do if we've requested extensibility link. */
+ if (mode & IEEE1284_EXT_LINK) {
+ m = mode & 0x7f;
+ udelay (1);
+ parport_write_data (port, m);
+ udelay (1);
+
+ /* Event 51: Set nStrobe low */
+ parport_frob_control (port,
+ PARPORT_CONTROL_STROBE,
+ PARPORT_CONTROL_STROBE);
+
+ /* Event 53: Set nStrobe high */
+ udelay (5);
+ parport_frob_control (port,
+ PARPORT_CONTROL_STROBE,
+ 0);
+
+ /* Event 55: nAck goes high */
+ if (parport_wait_peripheral (port,
+ PARPORT_STATUS_ACK,
+ PARPORT_STATUS_ACK)) {
+ /* This shouldn't really happen with a compliant
+ * device. */
+ DPRINTK (KERN_DEBUG
+ "%s: Mode 0x%02x not supported? (0x%02x)\n",
+ port->name, mode,
+ port->ops->read_status (port));
+ parport_ieee1284_terminate (port);
+ return 1;
+ }
+
+ /* Event 54: Peripheral sets XFlag to reflect support */
+ xflag = parport_read_status (port) & PARPORT_STATUS_SELECT;
+
+ /* xflag should be high. */
+ if (!xflag) {
+ /* Extended mode not supported. */
+ DPRINTK (KERN_DEBUG "%s: Extended mode 0x%02x not "
+ "supported\n", port->name, mode);
+ parport_ieee1284_terminate (port);
+ return 1;
+ }
+
+ /* Any further setup is left to the caller. */
+ }
+
         /* Mode is supported */
         DPRINTK (KERN_DEBUG "%s: In mode 0x%02x\n", port->name, mode);
         port->ieee1284.mode = mode;
 
         /* But ECP is special */
- if (mode & IEEE1284_MODE_ECP) {
+ if (!(mode & IEEE1284_EXT_LINK) && (mode & IEEE1284_MODE_ECP)) {
                 port->ieee1284.phase = IEEE1284_PH_ECP_SETUP;
 
                 /* Event 30: Set nAutoFd low */

-- 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 Wed 13 Oct 1999 - 03:58:40 EDT