patch-2.4.11-dontuse linux/drivers/usb/serial/keyspan.h

Next file: linux/drivers/usb/serial/keyspan_usa18x_fw.h
Previous file: linux/drivers/usb/serial/keyspan.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.10/linux/drivers/usb/serial/keyspan.h linux/drivers/usb/serial/keyspan.h
@@ -1,16 +1,15 @@
 /*
   Keyspan USB to Serial Converter driver
  
-  (C) Copyright (C) 2000
-      Hugh Blemings <hugh@linuxcare.com>
+  (C) Copyright (C) 2000-2001
+      Hugh Blemings <hugh@misc.nu>
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
 
-  See http://www.linuxcare.com.au/hugh/keyspan.html for more
-  information on this driver.
+  See http://misc.nu/hugh/keyspan.html for more information.
   
   Code in this driver inspired by and in a number of places taken
   from Brian Warner's original Keyspan-PDA driver.
@@ -24,8 +23,8 @@
   having the patience to sit down and explain why and where he'd changed
   stuff.
 
-  Tip 'o the hat to Linuxcare for supporting staff in their work on
-  open source projects.
+  Tip 'o the hat to IBM (and previously Linuxcare :) for supporting 
+  staff in their work on open source projects.
   
   See keyspan.c for update history.
 
@@ -52,6 +51,9 @@
 					 const unsigned char *buf,
 					 int count);
 
+static void keyspan_send_setup		(struct usb_serial_port *port,
+					 int reset_port);
+
 #if 0
 static void keyspan_write_bulk_callback (struct urb *urb);
 #endif
@@ -78,26 +80,30 @@
 //static void keyspan_usa19_setup_urbs	(struct usb_serial *serial);
 
 static int  keyspan_usa28_send_setup	(struct usb_serial *serial,
-					 struct usb_serial_port *port);
+					 struct usb_serial_port *port,
+					 int reset_port);
 static int  keyspan_usa26_send_setup	(struct usb_serial *serial,
-	       				 struct usb_serial_port *port);
+	       				 struct usb_serial_port *port,
+					 int reset_port);
 static int  keyspan_usa49_send_setup	(struct usb_serial *serial,
-					 struct usb_serial_port *port);
+					 struct usb_serial_port *port,
+					 int reset_port);
 
 	/* Functions from usbserial.c for ezusb firmware handling */
 extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit);
 extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest);
 
-	/* Struct used for firmware */
+	/* Struct used for firmware - increased size of data section
+	   to allow Keyspan's 'C' firmware struct to be used unmodified */
 struct ezusb_hex_record {
 	__u16 address;
 	__u8 data_size;
-	__u8 data[16];
+	__u8 data[64];
 };
 	/* Conditionally include firmware images, if they aren't
 	   included create a null pointer instead.  Current 
 	   firmware images aren't optimised to remove duplicate
-	   addresses. */
+	   addresses in the image itself. */
 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28
         #include "keyspan_usa28_fw.h"
 #else
@@ -110,6 +116,18 @@
 	static const struct ezusb_hex_record *keyspan_usa28x_firmware = NULL;
 #endif
 
+#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28XA
+        #include "keyspan_usa28xa_fw.h"
+#else
+	static const struct ezusb_hex_record *keyspan_usa28xa_firmware = NULL;
+#endif
+
+#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28XB
+        #include "keyspan_usa28xb_fw.h"
+#else
+	static const struct ezusb_hex_record *keyspan_usa28xb_firmware = NULL;
+#endif
+
 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19
         #include "keyspan_usa19_fw.h"
 #else
@@ -149,6 +167,33 @@
 #define		KEYSPAN_MAX_NUM_PORTS		(4)
 #define		KEYSPAN_MAX_FLIPS		(2)
 	
+	/* Device info for the Keyspan serial converter, used
+	   by the overall usb-serial probe function */
+#define KEYSPAN_VENDOR_ID			(0x06cd)
+
+	/* Product IDs for the eight products supported, pre-renumeration */
+#define	keyspan_usa18x_pre_product_id		0x0105
+#define	keyspan_usa19_pre_product_id		0x0103
+#define	keyspan_usa19w_pre_product_id		0x0106
+#define	keyspan_usa28_pre_product_id		0x0101
+#define	keyspan_usa28x_pre_product_id		0x0102
+#define	keyspan_usa28xa_pre_product_id		0x0114
+#define	keyspan_usa28xb_pre_product_id		0x0113
+#define	keyspan_usa49w_pre_product_id		0x0109
+
+	/* Product IDs post-renumeration.  Note that the 28x and 28xb
+	   have the same id's post-renumeration but behave identically
+	   so it's not an issue. */
+#define	keyspan_usa18x_product_id		0x0112
+#define	keyspan_usa19_product_id		0x0107
+#define	keyspan_usa19w_product_id		0x0108
+#define	keyspan_usa28_product_id		0x010f
+#define	keyspan_usa28x_product_id		0x0110
+#define	keyspan_usa28xa_product_id		0x0115
+#define	keyspan_usa28xb_product_id		0x0110
+#define	keyspan_usa49w_product_id		0x010a
+
+
 typedef struct {
 	/* product ID value */
 	int	product_id;
@@ -194,7 +239,7 @@
 	   in Keyspan's documentation) */
 
 static const keyspan_device_details usa18x_device_details = {
-	0x112,				/* product ID */
+	keyspan_usa18x_product_id,	/* product ID */
        	msg_usa26, 			/* msg type*/
 	1,				/* num ports */
 	0,				/* indat endpoint flip */
@@ -210,7 +255,7 @@
 };
 
 static const keyspan_device_details usa19_device_details = {
-	0x107,				/* product ID */
+	keyspan_usa19_product_id,	/* product ID */
        	msg_usa28, 			/* msg type*/
 	1,				/* num ports */
 	1,				/* indat endpoint flip */
@@ -226,7 +271,7 @@
 };
 
 static const keyspan_device_details usa19w_device_details = {
-	0x108,				/* product ID */
+	keyspan_usa19w_product_id,	/* product ID */
        	msg_usa26, 			/* msg type*/
 	1,				/* num ports */
 	0,				/* indat endpoint flip */
@@ -242,7 +287,7 @@
 };
 
 static const keyspan_device_details usa28x_device_details = {
-	0x110,				/* product ID */
+	keyspan_usa28x_product_id,	/* product ID */
        	msg_usa26, 			/* msg type*/
 	2,				/* num ports */
 	0,				/* indat endpoint flip */
@@ -257,8 +302,26 @@
 	KEYSPAN_USA28X_BAUDCLK
 };
 
+static const keyspan_device_details usa28xa_device_details = {
+	keyspan_usa28xa_product_id,	/* product ID */
+       	msg_usa26, 			/* msg type*/
+	2,				/* num ports */
+	0,				/* indat endpoint flip */
+	1,				/* outdat endpoint flip */
+  	{0x81, 0x83},			/* per port indat */
+  	{0x01, 0x03},			/* per port outdat */
+	{0x85, 0x86},			/* per port inack */
+	{0x05, 0x06},			/* per port outcont */
+	0x87,				/* instat endpoint */
+	0x07,				/* glocont endpoint */
+	keyspan_usa19w_calc_baud,	/* calc baud rate */
+	KEYSPAN_USA28X_BAUDCLK
+};
+
+	/* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */
+
 static const keyspan_device_details usa49w_device_details = {
-	0x010a,				/* product ID */
+	keyspan_usa49w_product_id,	/* product ID */
        	msg_usa49, 			/* msg type*/
 	4,				/* num ports */
 	0,				/* indat endpoint flip */
@@ -278,42 +341,27 @@
 	&usa19_device_details,
 	&usa19w_device_details,
 	&usa28x_device_details,
+	&usa28xa_device_details,
 	&usa49w_device_details,
 	NULL
 };
 
-	/* Device info for the Keyspan serial converter, used
-	   by the overall usb-serial probe function */
-#define KEYSPAN_VENDOR_ID			(0x06cd)
-
-    /* Product IDs for the five products supported, pre-renumeration */
-#define	keyspan_usa18x_pre_product_id	0x0105
-#define	keyspan_usa19_pre_product_id	0x0103
-#define	keyspan_usa19w_pre_product_id	0x0106
-#define	keyspan_usa28_pre_product_id	0x0101
-#define	keyspan_usa28x_pre_product_id	0x0102
-#define	keyspan_usa49w_pre_product_id	0x0109
-
-    /* Product IDs post-renumeration */
-#define	keyspan_usa18x_product_id	0x0112
-#define	keyspan_usa19_product_id	0x0107
-#define	keyspan_usa19w_product_id	0x0108
-#define	keyspan_usa28_product_id	0x010f
-#define	keyspan_usa28x_product_id	0x0110
-#define	keyspan_usa49w_product_id	0x010a
-
 static __devinitdata struct usb_device_id keyspan_ids_combined[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id)},
 	{ } /* Terminating entry */
 };
@@ -349,6 +397,16 @@
 	{ } /* Terminating entry */
 };
 
+static __devinitdata struct usb_device_id keyspan_usa28xa_pre_ids[] = {
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
+	{ } /* Terminating entry */
+};
+
+static __devinitdata struct usb_device_id keyspan_usa28xb_pre_ids[] = {
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
+	{ } /* Terminating entry */
+};
+
 static __devinitdata struct usb_device_id keyspan_usa49w_pre_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
 	{ } /* Terminating entry */
@@ -379,13 +437,17 @@
 	{ } /* Terminating entry */
 };
 
+static __devinitdata struct usb_device_id keyspan_usa28xa_ids[] = {
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
+	{ } /* Terminating entry */
+};
+
 static __devinitdata struct usb_device_id keyspan_usa49w_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id) },
 	{ } /* Terminating entry */
 };
 
-    /* Structs for the devices, pre and post renumeration.
-       These are incomplete at present - HAB 20000708  */
+    /* Structs for the devices, pre and post renumeration. */
 struct usb_serial_device_type keyspan_usa18x_pre_device = {
 	name:			"Keyspan USA18X - (without firmware)",
 	id_table:		keyspan_usa18x_pre_ids,
@@ -453,6 +515,32 @@
 	startup:		keyspan_fake_startup	
 };
 
+struct usb_serial_device_type keyspan_usa28xa_pre_device = {
+	name:			"Keyspan USA28XA - (without firmware)",
+	id_table:		keyspan_usa28xa_pre_ids,
+	needs_interrupt_in:	DONT_CARE,
+	needs_bulk_in:		DONT_CARE,
+	needs_bulk_out:		DONT_CARE,
+	num_interrupt_in:	NUM_DONT_CARE,
+	num_bulk_in:		NUM_DONT_CARE,
+	num_bulk_out:		NUM_DONT_CARE,
+	num_ports:		2,
+	startup:		keyspan_fake_startup	
+};
+
+struct usb_serial_device_type keyspan_usa28xb_pre_device = {
+	name:			"Keyspan USA28XB - (without firmware)",
+	id_table:		keyspan_usa28xb_pre_ids,
+	needs_interrupt_in:	DONT_CARE,
+	needs_bulk_in:		DONT_CARE,
+	needs_bulk_out:		DONT_CARE,
+	num_interrupt_in:	NUM_DONT_CARE,
+	num_bulk_in:		NUM_DONT_CARE,
+	num_bulk_out:		NUM_DONT_CARE,
+	num_ports:		2,
+	startup:		keyspan_fake_startup	
+};
+
 struct usb_serial_device_type keyspan_usa49w_pre_device = {
 	name:			"Keyspan USA49W - (without firmware)",
 	id_table:		keyspan_usa49w_pre_ids,
@@ -565,7 +653,7 @@
 
 
 struct usb_serial_device_type keyspan_usa28x_device = {
-	name:			"Keyspan USA28X",
+	name:			"Keyspan USA28X/XB",
 	id_table:		keyspan_usa28x_ids,
 	needs_interrupt_in:	DONT_CARE,	
 	needs_bulk_in:		DONT_CARE,
@@ -590,7 +678,33 @@
 	shutdown:		keyspan_shutdown,
 
 };
-				
+
+struct usb_serial_device_type keyspan_usa28xa_device = {
+	name:			"Keyspan USA28XA",
+	id_table:		keyspan_usa28xa_ids,
+	needs_interrupt_in:	DONT_CARE,	
+	needs_bulk_in:		DONT_CARE,
+	needs_bulk_out:		DONT_CARE,
+	num_interrupt_in:	NUM_DONT_CARE,
+	num_bulk_in:		NUM_DONT_CARE,
+	num_bulk_out:		NUM_DONT_CARE,
+	num_ports:		2,
+	open:			keyspan_open,
+	close:			keyspan_close,
+	write:			keyspan_write,
+	write_room:		keyspan_write_room,
+//	write_bulk_callback: 	keyspan_write_bulk_callback,
+//	read_int_callback:	keyspan_usa26_read_int_callback,
+	chars_in_buffer:	keyspan_chars_in_buffer,
+	throttle:		keyspan_rx_throttle,
+	unthrottle:		keyspan_rx_unthrottle,
+	ioctl:			keyspan_ioctl,
+	set_termios:		keyspan_set_termios,
+	break_ctl:		keyspan_break_ctl,
+	startup:		keyspan_startup,
+	shutdown:		keyspan_shutdown,
+
+};
 
 struct usb_serial_device_type keyspan_usa49w_device = {
 	name:			"Keyspan USA49W",

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