blob: 124d46e76a2e464748500110c82034ffd6fd4ddf [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 Keyspan USB to Serial Converter driver
3
4 (C) Copyright (C) 2000-2001
5 Hugh Blemings <hugh@blemings.org>
6
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.
11
12 See http://misc.nu/hugh/keyspan.html for more information.
13
14 Code in this driver inspired by and in a number of places taken
15 from Brian Warner's original Keyspan-PDA driver.
16
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 :)
20
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.
25
26 Tip 'o the hat to IBM (and previously Linuxcare :) for supporting
27 staff in their work on open source projects.
28
29 See keyspan.c for update history.
30
31*/
32
33#ifndef __LINUX_USB_SERIAL_KEYSPAN_H
34#define __LINUX_USB_SERIAL_KEYSPAN_H
35
36
37/* Function prototypes for Keyspan serial converter */
38static int keyspan_open (struct usb_serial_port *port,
39 struct file *filp);
40static void keyspan_close (struct usb_serial_port *port,
41 struct file *filp);
42static int keyspan_startup (struct usb_serial *serial);
43static void keyspan_shutdown (struct usb_serial *serial);
44static void keyspan_rx_throttle (struct usb_serial_port *port);
45static void keyspan_rx_unthrottle (struct usb_serial_port *port);
46static int keyspan_write_room (struct usb_serial_port *port);
47
48static int keyspan_write (struct usb_serial_port *port,
49 const unsigned char *buf,
50 int count);
51
52static void keyspan_send_setup (struct usb_serial_port *port,
53 int reset_port);
54
55
56static int keyspan_chars_in_buffer (struct usb_serial_port *port);
57static int keyspan_ioctl (struct usb_serial_port *port,
58 struct file *file,
59 unsigned int cmd,
60 unsigned long arg);
61static void keyspan_set_termios (struct usb_serial_port *port,
62 struct termios *old);
63static void keyspan_break_ctl (struct usb_serial_port *port,
64 int break_state);
65static int keyspan_tiocmget (struct usb_serial_port *port,
66 struct file *file);
67static int keyspan_tiocmset (struct usb_serial_port *port,
68 struct file *file, unsigned int set,
69 unsigned int clear);
70static int keyspan_fake_startup (struct usb_serial *serial);
71
72static int keyspan_usa19_calc_baud (u32 baud_rate, u32 baudclk,
73 u8 *rate_hi, u8 *rate_low,
74 u8 *prescaler, int portnum);
75
76static int keyspan_usa19w_calc_baud (u32 baud_rate, u32 baudclk,
77 u8 *rate_hi, u8 *rate_low,
78 u8 *prescaler, int portnum);
79
80static int keyspan_usa28_calc_baud (u32 baud_rate, u32 baudclk,
81 u8 *rate_hi, u8 *rate_low,
82 u8 *prescaler, int portnum);
83
84static int keyspan_usa19hs_calc_baud (u32 baud_rate, u32 baudclk,
85 u8 *rate_hi, u8 *rate_low,
86 u8 *prescaler, int portnum);
87
88static int keyspan_usa28_send_setup (struct usb_serial *serial,
89 struct usb_serial_port *port,
90 int reset_port);
91static int keyspan_usa26_send_setup (struct usb_serial *serial,
92 struct usb_serial_port *port,
93 int reset_port);
94static int keyspan_usa49_send_setup (struct usb_serial *serial,
95 struct usb_serial_port *port,
96 int reset_port);
97
98static int keyspan_usa90_send_setup (struct usb_serial *serial,
99 struct usb_serial_port *port,
100 int reset_port);
101
102/* Struct used for firmware - increased size of data section
103 to allow Keyspan's 'C' firmware struct to be used unmodified */
104struct ezusb_hex_record {
105 __u16 address;
106 __u8 data_size;
107 __u8 data[64];
108};
109
110/* Conditionally include firmware images, if they aren't
111 included create a null pointer instead. Current
112 firmware images aren't optimised to remove duplicate
113 addresses in the image itself. */
114#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28
115 #include "keyspan_usa28_fw.h"
116#else
117 static const struct ezusb_hex_record *keyspan_usa28_firmware = NULL;
118#endif
119
120#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28X
121 #include "keyspan_usa28x_fw.h"
122#else
123 static const struct ezusb_hex_record *keyspan_usa28x_firmware = NULL;
124#endif
125
126#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28XA
127 #include "keyspan_usa28xa_fw.h"
128#else
129 static const struct ezusb_hex_record *keyspan_usa28xa_firmware = NULL;
130#endif
131
132#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28XB
133 #include "keyspan_usa28xb_fw.h"
134#else
135 static const struct ezusb_hex_record *keyspan_usa28xb_firmware = NULL;
136#endif
137
138#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19
139 #include "keyspan_usa19_fw.h"
140#else
141 static const struct ezusb_hex_record *keyspan_usa19_firmware = NULL;
142#endif
143
144#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19QI
145 #include "keyspan_usa19qi_fw.h"
146#else
147 static const struct ezusb_hex_record *keyspan_usa19qi_firmware = NULL;
148#endif
149
150#ifdef CONFIG_USB_SERIAL_KEYSPAN_MPR
151 #include "keyspan_mpr_fw.h"
152#else
153 static const struct ezusb_hex_record *keyspan_mpr_firmware = NULL;
154#endif
155
156#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19QW
157 #include "keyspan_usa19qw_fw.h"
158#else
159 static const struct ezusb_hex_record *keyspan_usa19qw_firmware = NULL;
160#endif
161
162#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA18X
163 #include "keyspan_usa18x_fw.h"
164#else
165 static const struct ezusb_hex_record *keyspan_usa18x_firmware = NULL;
166#endif
167
168#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19W
169 #include "keyspan_usa19w_fw.h"
170#else
171 static const struct ezusb_hex_record *keyspan_usa19w_firmware = NULL;
172#endif
173
174#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA49W
175 #include "keyspan_usa49w_fw.h"
176#else
177 static const struct ezusb_hex_record *keyspan_usa49w_firmware = NULL;
178#endif
179
180#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA49WLC
181 #include "keyspan_usa49wlc_fw.h"
182#else
183 static const struct ezusb_hex_record *keyspan_usa49wlc_firmware = NULL;
184#endif
185
186/* Values used for baud rate calculation - device specific */
187#define KEYSPAN_INVALID_BAUD_RATE (-1)
188#define KEYSPAN_BAUD_RATE_OK (0)
189#define KEYSPAN_USA18X_BAUDCLK (12000000L) /* a guess */
190#define KEYSPAN_USA19_BAUDCLK (12000000L)
191#define KEYSPAN_USA19W_BAUDCLK (24000000L)
192#define KEYSPAN_USA19HS_BAUDCLK (14769231L)
193#define KEYSPAN_USA28_BAUDCLK (1843200L)
194#define KEYSPAN_USA28X_BAUDCLK (12000000L)
195#define KEYSPAN_USA49W_BAUDCLK (48000000L)
196
197/* Some constants used to characterise each device. */
198#define KEYSPAN_MAX_NUM_PORTS (4)
199#define KEYSPAN_MAX_FLIPS (2)
200
201/* Device info for the Keyspan serial converter, used
202 by the overall usb-serial probe function */
203#define KEYSPAN_VENDOR_ID (0x06cd)
204
205/* Product IDs for the products supported, pre-renumeration */
206#define keyspan_usa18x_pre_product_id 0x0105
207#define keyspan_usa19_pre_product_id 0x0103
208#define keyspan_usa19qi_pre_product_id 0x010b
209#define keyspan_mpr_pre_product_id 0x011b
210#define keyspan_usa19qw_pre_product_id 0x0118
211#define keyspan_usa19w_pre_product_id 0x0106
212#define keyspan_usa28_pre_product_id 0x0101
213#define keyspan_usa28x_pre_product_id 0x0102
214#define keyspan_usa28xa_pre_product_id 0x0114
215#define keyspan_usa28xb_pre_product_id 0x0113
216#define keyspan_usa49w_pre_product_id 0x0109
217#define keyspan_usa49wlc_pre_product_id 0x011a
218
219/* Product IDs post-renumeration. Note that the 28x and 28xb
220 have the same id's post-renumeration but behave identically
221 so it's not an issue. */
222#define keyspan_usa18x_product_id 0x0112
223#define keyspan_usa19_product_id 0x0107
224#define keyspan_usa19qi_product_id 0x010c
225#define keyspan_usa19hs_product_id 0x0121
226#define keyspan_mpr_product_id 0x011c
227#define keyspan_usa19qw_product_id 0x0119
228#define keyspan_usa19w_product_id 0x0108
229#define keyspan_usa28_product_id 0x010f
230#define keyspan_usa28x_product_id 0x0110
231#define keyspan_usa28xa_product_id 0x0115
232#define keyspan_usa28xb_product_id 0x0110
233#define keyspan_usa49w_product_id 0x010a
234#define keyspan_usa49wlc_product_id 0x012a
235
236
237struct keyspan_device_details {
238 /* product ID value */
239 int product_id;
240
241 enum {msg_usa26, msg_usa28, msg_usa49, msg_usa90} msg_format;
242
243 /* Number of physical ports */
244 int num_ports;
245
246 /* 1 if endpoint flipping used on input, 0 if not */
247 int indat_endp_flip;
248
249 /* 1 if endpoint flipping used on output, 0 if not */
250 int outdat_endp_flip;
251
252 /* Table mapping input data endpoint IDs to physical
253 port number and flip if used */
254 int indat_endpoints[KEYSPAN_MAX_NUM_PORTS];
255
256 /* Same for output endpoints */
257 int outdat_endpoints[KEYSPAN_MAX_NUM_PORTS];
258
259 /* Input acknowledge endpoints */
260 int inack_endpoints[KEYSPAN_MAX_NUM_PORTS];
261
262 /* Output control endpoints */
263 int outcont_endpoints[KEYSPAN_MAX_NUM_PORTS];
264
265 /* Endpoint used for input status */
266 int instat_endpoint;
267
268 /* Endpoint used for global control functions */
269 int glocont_endpoint;
270
271 int (*calculate_baud_rate) (u32 baud_rate, u32 baudclk,
272 u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum);
273 u32 baudclk;
274};
275
276/* Now for each device type we setup the device detail
277 structure with the appropriate information (provided
278 in Keyspan's documentation) */
279
280static const struct keyspan_device_details usa18x_device_details = {
281 .product_id = keyspan_usa18x_product_id,
282 .msg_format = msg_usa26,
283 .num_ports = 1,
284 .indat_endp_flip = 0,
285 .outdat_endp_flip = 1,
286 .indat_endpoints = {0x81},
287 .outdat_endpoints = {0x01},
288 .inack_endpoints = {0x85},
289 .outcont_endpoints = {0x05},
290 .instat_endpoint = 0x87,
291 .glocont_endpoint = 0x07,
292 .calculate_baud_rate = keyspan_usa19w_calc_baud,
293 .baudclk = KEYSPAN_USA18X_BAUDCLK,
294};
295
296static const struct keyspan_device_details usa19_device_details = {
297 .product_id = keyspan_usa19_product_id,
298 .msg_format = msg_usa28,
299 .num_ports = 1,
300 .indat_endp_flip = 1,
301 .outdat_endp_flip = 1,
302 .indat_endpoints = {0x81},
303 .outdat_endpoints = {0x01},
304 .inack_endpoints = {0x83},
305 .outcont_endpoints = {0x03},
306 .instat_endpoint = 0x84,
307 .glocont_endpoint = -1,
308 .calculate_baud_rate = keyspan_usa19_calc_baud,
309 .baudclk = KEYSPAN_USA19_BAUDCLK,
310};
311
312static const struct keyspan_device_details usa19qi_device_details = {
313 .product_id = keyspan_usa19qi_product_id,
314 .msg_format = msg_usa28,
315 .num_ports = 1,
316 .indat_endp_flip = 1,
317 .outdat_endp_flip = 1,
318 .indat_endpoints = {0x81},
319 .outdat_endpoints = {0x01},
320 .inack_endpoints = {0x83},
321 .outcont_endpoints = {0x03},
322 .instat_endpoint = 0x84,
323 .glocont_endpoint = -1,
324 .calculate_baud_rate = keyspan_usa28_calc_baud,
325 .baudclk = KEYSPAN_USA19_BAUDCLK,
326};
327
328static const struct keyspan_device_details mpr_device_details = {
329 .product_id = keyspan_mpr_product_id,
330 .msg_format = msg_usa28,
331 .num_ports = 1,
332 .indat_endp_flip = 1,
333 .outdat_endp_flip = 1,
334 .indat_endpoints = {0x81},
335 .outdat_endpoints = {0x01},
336 .inack_endpoints = {0x83},
337 .outcont_endpoints = {0x03},
338 .instat_endpoint = 0x84,
339 .glocont_endpoint = -1,
340 .calculate_baud_rate = keyspan_usa28_calc_baud,
341 .baudclk = KEYSPAN_USA19_BAUDCLK,
342};
343
344static const struct keyspan_device_details usa19qw_device_details = {
345 .product_id = keyspan_usa19qw_product_id,
346 .msg_format = msg_usa26,
347 .num_ports = 1,
348 .indat_endp_flip = 0,
349 .outdat_endp_flip = 1,
350 .indat_endpoints = {0x81},
351 .outdat_endpoints = {0x01},
352 .inack_endpoints = {0x85},
353 .outcont_endpoints = {0x05},
354 .instat_endpoint = 0x87,
355 .glocont_endpoint = 0x07,
356 .calculate_baud_rate = keyspan_usa19w_calc_baud,
357 .baudclk = KEYSPAN_USA19W_BAUDCLK,
358};
359
360static const struct keyspan_device_details usa19w_device_details = {
361 .product_id = keyspan_usa19w_product_id,
362 .msg_format = msg_usa26,
363 .num_ports = 1,
364 .indat_endp_flip = 0,
365 .outdat_endp_flip = 1,
366 .indat_endpoints = {0x81},
367 .outdat_endpoints = {0x01},
368 .inack_endpoints = {0x85},
369 .outcont_endpoints = {0x05},
370 .instat_endpoint = 0x87,
371 .glocont_endpoint = 0x07,
372 .calculate_baud_rate = keyspan_usa19w_calc_baud,
373 .baudclk = KEYSPAN_USA19W_BAUDCLK,
374};
375
376static const struct keyspan_device_details usa19hs_device_details = {
377 .product_id = keyspan_usa19hs_product_id,
378 .msg_format = msg_usa90,
379 .num_ports = 1,
380 .indat_endp_flip = 0,
381 .outdat_endp_flip = 0,
382 .indat_endpoints = {0x81},
383 .outdat_endpoints = {0x01},
384 .inack_endpoints = {-1},
385 .outcont_endpoints = {0x02},
386 .instat_endpoint = 0x82,
387 .glocont_endpoint = -1,
388 .calculate_baud_rate = keyspan_usa19hs_calc_baud,
389 .baudclk = KEYSPAN_USA19HS_BAUDCLK,
390};
391
392static const struct keyspan_device_details usa28_device_details = {
393 .product_id = keyspan_usa28_product_id,
394 .msg_format = msg_usa28,
395 .num_ports = 2,
396 .indat_endp_flip = 1,
397 .outdat_endp_flip = 1,
398 .indat_endpoints = {0x81, 0x83},
399 .outdat_endpoints = {0x01, 0x03},
400 .inack_endpoints = {0x85, 0x86},
401 .outcont_endpoints = {0x05, 0x06},
402 .instat_endpoint = 0x87,
403 .glocont_endpoint = 0x07,
404 .calculate_baud_rate = keyspan_usa28_calc_baud,
405 .baudclk = KEYSPAN_USA28_BAUDCLK,
406};
407
408static const struct keyspan_device_details usa28x_device_details = {
409 .product_id = keyspan_usa28x_product_id,
410 .msg_format = msg_usa26,
411 .num_ports = 2,
412 .indat_endp_flip = 0,
413 .outdat_endp_flip = 1,
414 .indat_endpoints = {0x81, 0x83},
415 .outdat_endpoints = {0x01, 0x03},
416 .inack_endpoints = {0x85, 0x86},
417 .outcont_endpoints = {0x05, 0x06},
418 .instat_endpoint = 0x87,
419 .glocont_endpoint = 0x07,
420 .calculate_baud_rate = keyspan_usa19w_calc_baud,
421 .baudclk = KEYSPAN_USA28X_BAUDCLK,
422};
423
424static const struct keyspan_device_details usa28xa_device_details = {
425 .product_id = keyspan_usa28xa_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 .glocont_endpoint = 0x07,
436 .calculate_baud_rate = keyspan_usa19w_calc_baud,
437 .baudclk = KEYSPAN_USA28X_BAUDCLK,
438};
439
440/* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */
441
442static const struct keyspan_device_details usa49w_device_details = {
443 .product_id = keyspan_usa49w_product_id,
444 .msg_format = msg_usa49,
445 .num_ports = 4,
446 .indat_endp_flip = 0,
447 .outdat_endp_flip = 0,
448 .indat_endpoints = {0x81, 0x82, 0x83, 0x84},
449 .outdat_endpoints = {0x01, 0x02, 0x03, 0x04},
450 .inack_endpoints = {-1, -1, -1, -1},
451 .outcont_endpoints = {-1, -1, -1, -1},
452 .instat_endpoint = 0x87,
453 .glocont_endpoint = 0x07,
454 .calculate_baud_rate = keyspan_usa19w_calc_baud,
455 .baudclk = KEYSPAN_USA49W_BAUDCLK,
456};
457
458static const struct keyspan_device_details usa49wlc_device_details = {
459 .product_id = keyspan_usa49wlc_product_id,
460 .msg_format = msg_usa49,
461 .num_ports = 4,
462 .indat_endp_flip = 0,
463 .outdat_endp_flip = 0,
464 .indat_endpoints = {0x81, 0x82, 0x83, 0x84},
465 .outdat_endpoints = {0x01, 0x02, 0x03, 0x04},
466 .inack_endpoints = {-1, -1, -1, -1},
467 .outcont_endpoints = {-1, -1, -1, -1},
468 .instat_endpoint = 0x87,
469 .glocont_endpoint = 0x07,
470 .calculate_baud_rate = keyspan_usa19w_calc_baud,
471 .baudclk = KEYSPAN_USA19W_BAUDCLK,
472};
473
474static const struct keyspan_device_details *keyspan_devices[] = {
475 &usa18x_device_details,
476 &usa19_device_details,
477 &usa19qi_device_details,
478 &mpr_device_details,
479 &usa19qw_device_details,
480 &usa19w_device_details,
481 &usa19hs_device_details,
482 &usa28_device_details,
483 &usa28x_device_details,
484 &usa28xa_device_details,
485 /* 28xb not required as it renumerates as a 28x */
486 &usa49w_device_details,
487 &usa49wlc_device_details,
488 NULL,
489};
490
491static struct usb_device_id keyspan_ids_combined[] = {
492 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
493 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
494 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
495 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
496 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
497 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
498 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
499 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
500 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
501 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
502 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
503 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) },
504 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
505 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
506 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
507 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
508 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
509 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
510 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
511 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
512 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
513 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
514 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_product_id) },
515 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id)},
516 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
517 { } /* Terminating entry */
518};
519
520MODULE_DEVICE_TABLE(usb, keyspan_ids_combined);
521
522static struct usb_driver keyspan_driver = {
523 .owner = THIS_MODULE,
524 .name = "keyspan",
525 .probe = usb_serial_probe,
526 .disconnect = usb_serial_disconnect,
527 .id_table = keyspan_ids_combined,
528};
529
530/* usb_device_id table for the pre-firmware download keyspan devices */
531static struct usb_device_id keyspan_pre_ids[] = {
532 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
533 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
534 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
535 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
536 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
537 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
538 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
539 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
540 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
541 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
542 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
543 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) },
544 { } /* Terminating entry */
545};
546
547static struct usb_device_id keyspan_1port_ids[] = {
548 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
549 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
550 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
551 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
552 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
553 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
554 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
555 { } /* Terminating entry */
556};
557
558static struct usb_device_id keyspan_2port_ids[] = {
559 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
560 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
561 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
562 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_product_id) },
563 { } /* Terminating entry */
564};
565
566static struct usb_device_id keyspan_4port_ids[] = {
567 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id) },
568 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
569 { } /* Terminating entry */
570};
571
572/* Structs for the devices, pre and post renumeration. */
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700573static struct usb_serial_driver keyspan_pre_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700574 .driver = {
575 .owner = THIS_MODULE,
576 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 .name = "Keyspan - (without firmware)",
578 .short_name = "keyspan_no_firm",
579 .id_table = keyspan_pre_ids,
580 .num_interrupt_in = NUM_DONT_CARE,
581 .num_bulk_in = NUM_DONT_CARE,
582 .num_bulk_out = NUM_DONT_CARE,
583 .num_ports = 1,
584 .attach = keyspan_fake_startup,
585};
586
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700587static struct usb_serial_driver keyspan_1port_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700588 .driver = {
589 .owner = THIS_MODULE,
590 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 .name = "Keyspan 1 port adapter",
592 .short_name = "keyspan_1",
593 .id_table = keyspan_1port_ids,
594 .num_interrupt_in = NUM_DONT_CARE,
595 .num_bulk_in = NUM_DONT_CARE,
596 .num_bulk_out = NUM_DONT_CARE,
597 .num_ports = 1,
598 .open = keyspan_open,
599 .close = keyspan_close,
600 .write = keyspan_write,
601 .write_room = keyspan_write_room,
602 .chars_in_buffer = keyspan_chars_in_buffer,
603 .throttle = keyspan_rx_throttle,
604 .unthrottle = keyspan_rx_unthrottle,
605 .ioctl = keyspan_ioctl,
606 .set_termios = keyspan_set_termios,
607 .break_ctl = keyspan_break_ctl,
608 .tiocmget = keyspan_tiocmget,
609 .tiocmset = keyspan_tiocmset,
610 .attach = keyspan_startup,
611 .shutdown = keyspan_shutdown,
612};
613
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700614static struct usb_serial_driver keyspan_2port_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700615 .driver = {
616 .owner = THIS_MODULE,
617 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618 .name = "Keyspan 2 port adapter",
619 .short_name = "keyspan_2",
620 .id_table = keyspan_2port_ids,
621 .num_interrupt_in = NUM_DONT_CARE,
622 .num_bulk_in = NUM_DONT_CARE,
623 .num_bulk_out = NUM_DONT_CARE,
624 .num_ports = 2,
625 .open = keyspan_open,
626 .close = keyspan_close,
627 .write = keyspan_write,
628 .write_room = keyspan_write_room,
629 .chars_in_buffer = keyspan_chars_in_buffer,
630 .throttle = keyspan_rx_throttle,
631 .unthrottle = keyspan_rx_unthrottle,
632 .ioctl = keyspan_ioctl,
633 .set_termios = keyspan_set_termios,
634 .break_ctl = keyspan_break_ctl,
635 .tiocmget = keyspan_tiocmget,
636 .tiocmset = keyspan_tiocmset,
637 .attach = keyspan_startup,
638 .shutdown = keyspan_shutdown,
639};
640
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700641static struct usb_serial_driver keyspan_4port_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700642 .driver = {
643 .owner = THIS_MODULE,
644 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645 .name = "Keyspan 4 port adapter",
646 .short_name = "keyspan_4",
647 .id_table = keyspan_4port_ids,
648 .num_interrupt_in = NUM_DONT_CARE,
649 .num_bulk_in = 5,
650 .num_bulk_out = 5,
651 .num_ports = 4,
652 .open = keyspan_open,
653 .close = keyspan_close,
654 .write = keyspan_write,
655 .write_room = keyspan_write_room,
656 .chars_in_buffer = keyspan_chars_in_buffer,
657 .throttle = keyspan_rx_throttle,
658 .unthrottle = keyspan_rx_unthrottle,
659 .ioctl = keyspan_ioctl,
660 .set_termios = keyspan_set_termios,
661 .break_ctl = keyspan_break_ctl,
662 .tiocmget = keyspan_tiocmget,
663 .tiocmset = keyspan_tiocmset,
664 .attach = keyspan_startup,
665 .shutdown = keyspan_shutdown,
666};
667
668#endif