hpt366: fix section mismatch warnings
[linux-2.6/openmoko-kernel/knife-kernel.git] / drivers / usb / serial / keyspan.h
blob8a0d17401529986b077da08a15a292d1e2de14af
1 /*
2 Keyspan USB to Serial Converter driver
4 (C) Copyright (C) 2000-2001
5 Hugh Blemings <hugh@blemings.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 See http://misc.nu/hugh/keyspan.html for more information.
14 Code in this driver inspired by and in a number of places taken
15 from Brian Warner's original Keyspan-PDA driver.
17 This driver has been put together with the support of Innosys, Inc.
18 and Keyspan, Inc the manufacturers of the Keyspan USB-serial products.
19 Thanks Guys :)
21 Thanks to Paulus for miscellaneous tidy ups, some largish chunks
22 of much nicer and/or completely new code and (perhaps most uniquely)
23 having the patience to sit down and explain why and where he'd changed
24 stuff.
26 Tip 'o the hat to IBM (and previously Linuxcare :) for supporting
27 staff in their work on open source projects.
29 See keyspan.c for update history.
33 #ifndef __LINUX_USB_SERIAL_KEYSPAN_H
34 #define __LINUX_USB_SERIAL_KEYSPAN_H
37 /* Function prototypes for Keyspan serial converter */
38 static int keyspan_open (struct usb_serial_port *port,
39 struct file *filp);
40 static void keyspan_close (struct usb_serial_port *port,
41 struct file *filp);
42 static int keyspan_startup (struct usb_serial *serial);
43 static void keyspan_shutdown (struct usb_serial *serial);
44 static void keyspan_rx_throttle (struct usb_serial_port *port);
45 static void keyspan_rx_unthrottle (struct usb_serial_port *port);
46 static int keyspan_write_room (struct usb_serial_port *port);
48 static int keyspan_write (struct usb_serial_port *port,
49 const unsigned char *buf,
50 int count);
52 static void keyspan_send_setup (struct usb_serial_port *port,
53 int reset_port);
56 static int keyspan_chars_in_buffer (struct usb_serial_port *port);
57 static int keyspan_ioctl (struct usb_serial_port *port,
58 struct file *file,
59 unsigned int cmd,
60 unsigned long arg);
61 static void keyspan_set_termios (struct usb_serial_port *port,
62 struct ktermios *old);
63 static void keyspan_break_ctl (struct usb_serial_port *port,
64 int break_state);
65 static int keyspan_tiocmget (struct usb_serial_port *port,
66 struct file *file);
67 static int keyspan_tiocmset (struct usb_serial_port *port,
68 struct file *file, unsigned int set,
69 unsigned int clear);
70 static int keyspan_fake_startup (struct usb_serial *serial);
72 static int keyspan_usa19_calc_baud (u32 baud_rate, u32 baudclk,
73 u8 *rate_hi, u8 *rate_low,
74 u8 *prescaler, int portnum);
76 static int keyspan_usa19w_calc_baud (u32 baud_rate, u32 baudclk,
77 u8 *rate_hi, u8 *rate_low,
78 u8 *prescaler, int portnum);
80 static int keyspan_usa28_calc_baud (u32 baud_rate, u32 baudclk,
81 u8 *rate_hi, u8 *rate_low,
82 u8 *prescaler, int portnum);
84 static int keyspan_usa19hs_calc_baud (u32 baud_rate, u32 baudclk,
85 u8 *rate_hi, u8 *rate_low,
86 u8 *prescaler, int portnum);
88 static int keyspan_usa28_send_setup (struct usb_serial *serial,
89 struct usb_serial_port *port,
90 int reset_port);
91 static int keyspan_usa26_send_setup (struct usb_serial *serial,
92 struct usb_serial_port *port,
93 int reset_port);
94 static int keyspan_usa49_send_setup (struct usb_serial *serial,
95 struct usb_serial_port *port,
96 int reset_port);
98 static int keyspan_usa90_send_setup (struct usb_serial *serial,
99 struct usb_serial_port *port,
100 int reset_port);
102 static int keyspan_usa67_send_setup (struct usb_serial *serial,
103 struct usb_serial_port *port,
104 int reset_port);
106 /* Struct used for firmware - increased size of data section
107 to allow Keyspan's 'C' firmware struct to be used unmodified */
108 struct ezusb_hex_record {
109 __u16 address;
110 __u8 data_size;
111 __u8 data[64];
114 /* Conditionally include firmware images, if they aren't
115 included create a null pointer instead. Current
116 firmware images aren't optimised to remove duplicate
117 addresses in the image itself. */
118 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28
119 #include "keyspan_usa28_fw.h"
120 #else
121 static const struct ezusb_hex_record *keyspan_usa28_firmware = NULL;
122 #endif
124 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28X
125 #include "keyspan_usa28x_fw.h"
126 #else
127 static const struct ezusb_hex_record *keyspan_usa28x_firmware = NULL;
128 #endif
130 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28XA
131 #include "keyspan_usa28xa_fw.h"
132 #else
133 static const struct ezusb_hex_record *keyspan_usa28xa_firmware = NULL;
134 #endif
136 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28XB
137 #include "keyspan_usa28xb_fw.h"
138 #else
139 static const struct ezusb_hex_record *keyspan_usa28xb_firmware = NULL;
140 #endif
142 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19
143 #include "keyspan_usa19_fw.h"
144 #else
145 static const struct ezusb_hex_record *keyspan_usa19_firmware = NULL;
146 #endif
148 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19QI
149 #include "keyspan_usa19qi_fw.h"
150 #else
151 static const struct ezusb_hex_record *keyspan_usa19qi_firmware = NULL;
152 #endif
154 #ifdef CONFIG_USB_SERIAL_KEYSPAN_MPR
155 #include "keyspan_mpr_fw.h"
156 #else
157 static const struct ezusb_hex_record *keyspan_mpr_firmware = NULL;
158 #endif
160 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19QW
161 #include "keyspan_usa19qw_fw.h"
162 #else
163 static const struct ezusb_hex_record *keyspan_usa19qw_firmware = NULL;
164 #endif
166 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA18X
167 #include "keyspan_usa18x_fw.h"
168 #else
169 static const struct ezusb_hex_record *keyspan_usa18x_firmware = NULL;
170 #endif
172 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19W
173 #include "keyspan_usa19w_fw.h"
174 #else
175 static const struct ezusb_hex_record *keyspan_usa19w_firmware = NULL;
176 #endif
178 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA49W
179 #include "keyspan_usa49w_fw.h"
180 #else
181 static const struct ezusb_hex_record *keyspan_usa49w_firmware = NULL;
182 #endif
184 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA49WLC
185 #include "keyspan_usa49wlc_fw.h"
186 #else
187 static const struct ezusb_hex_record *keyspan_usa49wlc_firmware = NULL;
188 #endif
190 /* Values used for baud rate calculation - device specific */
191 #define KEYSPAN_INVALID_BAUD_RATE (-1)
192 #define KEYSPAN_BAUD_RATE_OK (0)
193 #define KEYSPAN_USA18X_BAUDCLK (12000000L) /* a guess */
194 #define KEYSPAN_USA19_BAUDCLK (12000000L)
195 #define KEYSPAN_USA19W_BAUDCLK (24000000L)
196 #define KEYSPAN_USA19HS_BAUDCLK (14769231L)
197 #define KEYSPAN_USA28_BAUDCLK (1843200L)
198 #define KEYSPAN_USA28X_BAUDCLK (12000000L)
199 #define KEYSPAN_USA49W_BAUDCLK (48000000L)
201 /* Some constants used to characterise each device. */
202 #define KEYSPAN_MAX_NUM_PORTS (4)
203 #define KEYSPAN_MAX_FLIPS (2)
205 /* Device info for the Keyspan serial converter, used
206 by the overall usb-serial probe function */
207 #define KEYSPAN_VENDOR_ID (0x06cd)
209 /* Product IDs for the products supported, pre-renumeration */
210 #define keyspan_usa18x_pre_product_id 0x0105
211 #define keyspan_usa19_pre_product_id 0x0103
212 #define keyspan_usa19qi_pre_product_id 0x010b
213 #define keyspan_mpr_pre_product_id 0x011b
214 #define keyspan_usa19qw_pre_product_id 0x0118
215 #define keyspan_usa19w_pre_product_id 0x0106
216 #define keyspan_usa28_pre_product_id 0x0101
217 #define keyspan_usa28x_pre_product_id 0x0102
218 #define keyspan_usa28xa_pre_product_id 0x0114
219 #define keyspan_usa28xb_pre_product_id 0x0113
220 #define keyspan_usa49w_pre_product_id 0x0109
221 #define keyspan_usa49wlc_pre_product_id 0x011a
223 /* Product IDs post-renumeration. Note that the 28x and 28xb
224 have the same id's post-renumeration but behave identically
225 so it's not an issue. */
226 #define keyspan_usa18x_product_id 0x0112
227 #define keyspan_usa19_product_id 0x0107
228 #define keyspan_usa19qi_product_id 0x010c
229 #define keyspan_usa19hs_product_id 0x0121
230 #define keyspan_mpr_product_id 0x011c
231 #define keyspan_usa19qw_product_id 0x0119
232 #define keyspan_usa19w_product_id 0x0108
233 #define keyspan_usa28_product_id 0x010f
234 #define keyspan_usa28x_product_id 0x0110
235 #define keyspan_usa28xa_product_id 0x0115
236 #define keyspan_usa28xb_product_id 0x0110
237 #define keyspan_usa28xg_product_id 0x0135
238 #define keyspan_usa49w_product_id 0x010a
239 #define keyspan_usa49wlc_product_id 0x012a
240 #define keyspan_usa49wg_product_id 0x0131
242 struct keyspan_device_details {
243 /* product ID value */
244 int product_id;
246 enum {msg_usa26, msg_usa28, msg_usa49, msg_usa90, msg_usa67} msg_format;
248 /* Number of physical ports */
249 int num_ports;
251 /* 1 if endpoint flipping used on input, 0 if not */
252 int indat_endp_flip;
254 /* 1 if endpoint flipping used on output, 0 if not */
255 int outdat_endp_flip;
257 /* Table mapping input data endpoint IDs to physical
258 port number and flip if used */
259 int indat_endpoints[KEYSPAN_MAX_NUM_PORTS];
261 /* Same for output endpoints */
262 int outdat_endpoints[KEYSPAN_MAX_NUM_PORTS];
264 /* Input acknowledge endpoints */
265 int inack_endpoints[KEYSPAN_MAX_NUM_PORTS];
267 /* Output control endpoints */
268 int outcont_endpoints[KEYSPAN_MAX_NUM_PORTS];
270 /* Endpoint used for input status */
271 int instat_endpoint;
273 /* Endpoint used for input data 49WG only */
274 int indat_endpoint;
276 /* Endpoint used for global control functions */
277 int glocont_endpoint;
279 int (*calculate_baud_rate) (u32 baud_rate, u32 baudclk,
280 u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum);
281 u32 baudclk;
284 /* Now for each device type we setup the device detail
285 structure with the appropriate information (provided
286 in Keyspan's documentation) */
288 static const struct keyspan_device_details usa18x_device_details = {
289 .product_id = keyspan_usa18x_product_id,
290 .msg_format = msg_usa26,
291 .num_ports = 1,
292 .indat_endp_flip = 0,
293 .outdat_endp_flip = 1,
294 .indat_endpoints = {0x81},
295 .outdat_endpoints = {0x01},
296 .inack_endpoints = {0x85},
297 .outcont_endpoints = {0x05},
298 .instat_endpoint = 0x87,
299 .indat_endpoint = -1,
300 .glocont_endpoint = 0x07,
301 .calculate_baud_rate = keyspan_usa19w_calc_baud,
302 .baudclk = KEYSPAN_USA18X_BAUDCLK,
305 static const struct keyspan_device_details usa19_device_details = {
306 .product_id = keyspan_usa19_product_id,
307 .msg_format = msg_usa28,
308 .num_ports = 1,
309 .indat_endp_flip = 1,
310 .outdat_endp_flip = 1,
311 .indat_endpoints = {0x81},
312 .outdat_endpoints = {0x01},
313 .inack_endpoints = {0x83},
314 .outcont_endpoints = {0x03},
315 .instat_endpoint = 0x84,
316 .indat_endpoint = -1,
317 .glocont_endpoint = -1,
318 .calculate_baud_rate = keyspan_usa19_calc_baud,
319 .baudclk = KEYSPAN_USA19_BAUDCLK,
322 static const struct keyspan_device_details usa19qi_device_details = {
323 .product_id = keyspan_usa19qi_product_id,
324 .msg_format = msg_usa28,
325 .num_ports = 1,
326 .indat_endp_flip = 1,
327 .outdat_endp_flip = 1,
328 .indat_endpoints = {0x81},
329 .outdat_endpoints = {0x01},
330 .inack_endpoints = {0x83},
331 .outcont_endpoints = {0x03},
332 .instat_endpoint = 0x84,
333 .indat_endpoint = -1,
334 .glocont_endpoint = -1,
335 .calculate_baud_rate = keyspan_usa28_calc_baud,
336 .baudclk = KEYSPAN_USA19_BAUDCLK,
339 static const struct keyspan_device_details mpr_device_details = {
340 .product_id = keyspan_mpr_product_id,
341 .msg_format = msg_usa28,
342 .num_ports = 1,
343 .indat_endp_flip = 1,
344 .outdat_endp_flip = 1,
345 .indat_endpoints = {0x81},
346 .outdat_endpoints = {0x01},
347 .inack_endpoints = {0x83},
348 .outcont_endpoints = {0x03},
349 .instat_endpoint = 0x84,
350 .indat_endpoint = -1,
351 .glocont_endpoint = -1,
352 .calculate_baud_rate = keyspan_usa28_calc_baud,
353 .baudclk = KEYSPAN_USA19_BAUDCLK,
356 static const struct keyspan_device_details usa19qw_device_details = {
357 .product_id = keyspan_usa19qw_product_id,
358 .msg_format = msg_usa26,
359 .num_ports = 1,
360 .indat_endp_flip = 0,
361 .outdat_endp_flip = 1,
362 .indat_endpoints = {0x81},
363 .outdat_endpoints = {0x01},
364 .inack_endpoints = {0x85},
365 .outcont_endpoints = {0x05},
366 .instat_endpoint = 0x87,
367 .indat_endpoint = -1,
368 .glocont_endpoint = 0x07,
369 .calculate_baud_rate = keyspan_usa19w_calc_baud,
370 .baudclk = KEYSPAN_USA19W_BAUDCLK,
373 static const struct keyspan_device_details usa19w_device_details = {
374 .product_id = keyspan_usa19w_product_id,
375 .msg_format = msg_usa26,
376 .num_ports = 1,
377 .indat_endp_flip = 0,
378 .outdat_endp_flip = 1,
379 .indat_endpoints = {0x81},
380 .outdat_endpoints = {0x01},
381 .inack_endpoints = {0x85},
382 .outcont_endpoints = {0x05},
383 .instat_endpoint = 0x87,
384 .indat_endpoint = -1,
385 .glocont_endpoint = 0x07,
386 .calculate_baud_rate = keyspan_usa19w_calc_baud,
387 .baudclk = KEYSPAN_USA19W_BAUDCLK,
390 static const struct keyspan_device_details usa19hs_device_details = {
391 .product_id = keyspan_usa19hs_product_id,
392 .msg_format = msg_usa90,
393 .num_ports = 1,
394 .indat_endp_flip = 0,
395 .outdat_endp_flip = 0,
396 .indat_endpoints = {0x81},
397 .outdat_endpoints = {0x01},
398 .inack_endpoints = {-1},
399 .outcont_endpoints = {0x02},
400 .instat_endpoint = 0x82,
401 .indat_endpoint = -1,
402 .glocont_endpoint = -1,
403 .calculate_baud_rate = keyspan_usa19hs_calc_baud,
404 .baudclk = KEYSPAN_USA19HS_BAUDCLK,
407 static const struct keyspan_device_details usa28_device_details = {
408 .product_id = keyspan_usa28_product_id,
409 .msg_format = msg_usa28,
410 .num_ports = 2,
411 .indat_endp_flip = 1,
412 .outdat_endp_flip = 1,
413 .indat_endpoints = {0x81, 0x83},
414 .outdat_endpoints = {0x01, 0x03},
415 .inack_endpoints = {0x85, 0x86},
416 .outcont_endpoints = {0x05, 0x06},
417 .instat_endpoint = 0x87,
418 .indat_endpoint = -1,
419 .glocont_endpoint = 0x07,
420 .calculate_baud_rate = keyspan_usa28_calc_baud,
421 .baudclk = KEYSPAN_USA28_BAUDCLK,
424 static const struct keyspan_device_details usa28x_device_details = {
425 .product_id = keyspan_usa28x_product_id,
426 .msg_format = msg_usa26,
427 .num_ports = 2,
428 .indat_endp_flip = 0,
429 .outdat_endp_flip = 1,
430 .indat_endpoints = {0x81, 0x83},
431 .outdat_endpoints = {0x01, 0x03},
432 .inack_endpoints = {0x85, 0x86},
433 .outcont_endpoints = {0x05, 0x06},
434 .instat_endpoint = 0x87,
435 .indat_endpoint = -1,
436 .glocont_endpoint = 0x07,
437 .calculate_baud_rate = keyspan_usa19w_calc_baud,
438 .baudclk = KEYSPAN_USA28X_BAUDCLK,
441 static const struct keyspan_device_details usa28xa_device_details = {
442 .product_id = keyspan_usa28xa_product_id,
443 .msg_format = msg_usa26,
444 .num_ports = 2,
445 .indat_endp_flip = 0,
446 .outdat_endp_flip = 1,
447 .indat_endpoints = {0x81, 0x83},
448 .outdat_endpoints = {0x01, 0x03},
449 .inack_endpoints = {0x85, 0x86},
450 .outcont_endpoints = {0x05, 0x06},
451 .instat_endpoint = 0x87,
452 .indat_endpoint = -1,
453 .glocont_endpoint = 0x07,
454 .calculate_baud_rate = keyspan_usa19w_calc_baud,
455 .baudclk = KEYSPAN_USA28X_BAUDCLK,
458 static const struct keyspan_device_details usa28xg_device_details = {
459 .product_id = keyspan_usa28xg_product_id,
460 .msg_format = msg_usa67,
461 .num_ports = 2,
462 .indat_endp_flip = 0,
463 .outdat_endp_flip = 0,
464 .indat_endpoints = {0x84, 0x88},
465 .outdat_endpoints = {0x02, 0x06},
466 .inack_endpoints = {-1, -1},
467 .outcont_endpoints = {-1, -1},
468 .instat_endpoint = 0x81,
469 .indat_endpoint = -1,
470 .glocont_endpoint = 0x01,
471 .calculate_baud_rate = keyspan_usa19w_calc_baud,
472 .baudclk = KEYSPAN_USA28X_BAUDCLK,
474 /* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */
476 static const struct keyspan_device_details usa49w_device_details = {
477 .product_id = keyspan_usa49w_product_id,
478 .msg_format = msg_usa49,
479 .num_ports = 4,
480 .indat_endp_flip = 0,
481 .outdat_endp_flip = 0,
482 .indat_endpoints = {0x81, 0x82, 0x83, 0x84},
483 .outdat_endpoints = {0x01, 0x02, 0x03, 0x04},
484 .inack_endpoints = {-1, -1, -1, -1},
485 .outcont_endpoints = {-1, -1, -1, -1},
486 .instat_endpoint = 0x87,
487 .indat_endpoint = -1,
488 .glocont_endpoint = 0x07,
489 .calculate_baud_rate = keyspan_usa19w_calc_baud,
490 .baudclk = KEYSPAN_USA49W_BAUDCLK,
493 static const struct keyspan_device_details usa49wlc_device_details = {
494 .product_id = keyspan_usa49wlc_product_id,
495 .msg_format = msg_usa49,
496 .num_ports = 4,
497 .indat_endp_flip = 0,
498 .outdat_endp_flip = 0,
499 .indat_endpoints = {0x81, 0x82, 0x83, 0x84},
500 .outdat_endpoints = {0x01, 0x02, 0x03, 0x04},
501 .inack_endpoints = {-1, -1, -1, -1},
502 .outcont_endpoints = {-1, -1, -1, -1},
503 .instat_endpoint = 0x87,
504 .indat_endpoint = -1,
505 .glocont_endpoint = 0x07,
506 .calculate_baud_rate = keyspan_usa19w_calc_baud,
507 .baudclk = KEYSPAN_USA19W_BAUDCLK,
510 static const struct keyspan_device_details usa49wg_device_details = {
511 .product_id = keyspan_usa49wg_product_id,
512 .msg_format = msg_usa49,
513 .num_ports = 4,
514 .indat_endp_flip = 0,
515 .outdat_endp_flip = 0,
516 .indat_endpoints = {-1, -1, -1, -1}, /* single 'global' data in EP */
517 .outdat_endpoints = {0x01, 0x02, 0x04, 0x06},
518 .inack_endpoints = {-1, -1, -1, -1},
519 .outcont_endpoints = {-1, -1, -1, -1},
520 .instat_endpoint = 0x81,
521 .indat_endpoint = 0x88,
522 .glocont_endpoint = 0x00, /* uses control EP */
523 .calculate_baud_rate = keyspan_usa19w_calc_baud,
524 .baudclk = KEYSPAN_USA19W_BAUDCLK,
527 static const struct keyspan_device_details *keyspan_devices[] = {
528 &usa18x_device_details,
529 &usa19_device_details,
530 &usa19qi_device_details,
531 &mpr_device_details,
532 &usa19qw_device_details,
533 &usa19w_device_details,
534 &usa19hs_device_details,
535 &usa28_device_details,
536 &usa28x_device_details,
537 &usa28xa_device_details,
538 &usa28xg_device_details,
539 /* 28xb not required as it renumerates as a 28x */
540 &usa49w_device_details,
541 &usa49wlc_device_details,
542 &usa49wg_device_details,
543 NULL,
546 static struct usb_device_id keyspan_ids_combined[] = {
547 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
548 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
549 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
550 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
551 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
552 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
553 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
554 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
555 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
556 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
557 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
558 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) },
559 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
560 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
561 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
562 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
563 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
564 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
565 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
566 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
567 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
568 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
569 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_product_id) },
570 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xg_product_id) },
571 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id)},
572 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
573 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wg_product_id)},
574 { } /* Terminating entry */
577 MODULE_DEVICE_TABLE(usb, keyspan_ids_combined);
579 static struct usb_driver keyspan_driver = {
580 .name = "keyspan",
581 .probe = usb_serial_probe,
582 .disconnect = usb_serial_disconnect,
583 .id_table = keyspan_ids_combined,
584 .no_dynamic_id = 1,
587 /* usb_device_id table for the pre-firmware download keyspan devices */
588 static struct usb_device_id keyspan_pre_ids[] = {
589 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
590 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
591 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
592 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
593 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
594 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
595 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
596 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
597 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
598 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
599 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
600 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) },
601 { } /* Terminating entry */
604 static struct usb_device_id keyspan_1port_ids[] = {
605 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
606 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
607 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
608 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
609 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
610 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
611 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
612 { } /* Terminating entry */
615 static struct usb_device_id keyspan_2port_ids[] = {
616 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
617 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
618 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
619 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_product_id) },
620 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xg_product_id) },
621 { } /* Terminating entry */
624 static struct usb_device_id keyspan_4port_ids[] = {
625 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id) },
626 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
627 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wg_product_id)},
628 { } /* Terminating entry */
631 /* Structs for the devices, pre and post renumeration. */
632 static struct usb_serial_driver keyspan_pre_device = {
633 .driver = {
634 .owner = THIS_MODULE,
635 .name = "keyspan_no_firm",
637 .description = "Keyspan - (without firmware)",
638 .id_table = keyspan_pre_ids,
639 .num_interrupt_in = NUM_DONT_CARE,
640 .num_bulk_in = NUM_DONT_CARE,
641 .num_bulk_out = NUM_DONT_CARE,
642 .num_ports = 1,
643 .attach = keyspan_fake_startup,
646 static struct usb_serial_driver keyspan_1port_device = {
647 .driver = {
648 .owner = THIS_MODULE,
649 .name = "keyspan_1",
651 .description = "Keyspan 1 port adapter",
652 .id_table = keyspan_1port_ids,
653 .num_interrupt_in = NUM_DONT_CARE,
654 .num_bulk_in = NUM_DONT_CARE,
655 .num_bulk_out = NUM_DONT_CARE,
656 .num_ports = 1,
657 .open = keyspan_open,
658 .close = keyspan_close,
659 .write = keyspan_write,
660 .write_room = keyspan_write_room,
661 .chars_in_buffer = keyspan_chars_in_buffer,
662 .throttle = keyspan_rx_throttle,
663 .unthrottle = keyspan_rx_unthrottle,
664 .ioctl = keyspan_ioctl,
665 .set_termios = keyspan_set_termios,
666 .break_ctl = keyspan_break_ctl,
667 .tiocmget = keyspan_tiocmget,
668 .tiocmset = keyspan_tiocmset,
669 .attach = keyspan_startup,
670 .shutdown = keyspan_shutdown,
673 static struct usb_serial_driver keyspan_2port_device = {
674 .driver = {
675 .owner = THIS_MODULE,
676 .name = "keyspan_2",
678 .description = "Keyspan 2 port adapter",
679 .id_table = keyspan_2port_ids,
680 .num_interrupt_in = NUM_DONT_CARE,
681 .num_bulk_in = NUM_DONT_CARE,
682 .num_bulk_out = NUM_DONT_CARE,
683 .num_ports = 2,
684 .open = keyspan_open,
685 .close = keyspan_close,
686 .write = keyspan_write,
687 .write_room = keyspan_write_room,
688 .chars_in_buffer = keyspan_chars_in_buffer,
689 .throttle = keyspan_rx_throttle,
690 .unthrottle = keyspan_rx_unthrottle,
691 .ioctl = keyspan_ioctl,
692 .set_termios = keyspan_set_termios,
693 .break_ctl = keyspan_break_ctl,
694 .tiocmget = keyspan_tiocmget,
695 .tiocmset = keyspan_tiocmset,
696 .attach = keyspan_startup,
697 .shutdown = keyspan_shutdown,
700 static struct usb_serial_driver keyspan_4port_device = {
701 .driver = {
702 .owner = THIS_MODULE,
703 .name = "keyspan_4",
705 .description = "Keyspan 4 port adapter",
706 .id_table = keyspan_4port_ids,
707 .num_interrupt_in = NUM_DONT_CARE,
708 .num_bulk_in = NUM_DONT_CARE,
709 .num_bulk_out = NUM_DONT_CARE,
710 .num_ports = 4,
711 .open = keyspan_open,
712 .close = keyspan_close,
713 .write = keyspan_write,
714 .write_room = keyspan_write_room,
715 .chars_in_buffer = keyspan_chars_in_buffer,
716 .throttle = keyspan_rx_throttle,
717 .unthrottle = keyspan_rx_unthrottle,
718 .ioctl = keyspan_ioctl,
719 .set_termios = keyspan_set_termios,
720 .break_ctl = keyspan_break_ctl,
721 .tiocmget = keyspan_tiocmget,
722 .tiocmset = keyspan_tiocmset,
723 .attach = keyspan_startup,
724 .shutdown = keyspan_shutdown,
727 #endif