blob: 8bf72639b148edf2a7ce5ef3f76bb2f815872f8f [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,
Alan Cox606d0992006-12-08 02:38:45 -080062 struct ktermios *old);
Linus Torvalds1da177e2005-04-16 15:20:36 -070063static 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
Lucy McCoy0ca12682007-05-18 12:10:41 -0700102static int keyspan_usa67_send_setup (struct usb_serial *serial,
103 struct usb_serial_port *port,
104 int reset_port);
105
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106/* Values used for baud rate calculation - device specific */
107#define KEYSPAN_INVALID_BAUD_RATE (-1)
108#define KEYSPAN_BAUD_RATE_OK (0)
109#define KEYSPAN_USA18X_BAUDCLK (12000000L) /* a guess */
110#define KEYSPAN_USA19_BAUDCLK (12000000L)
111#define KEYSPAN_USA19W_BAUDCLK (24000000L)
112#define KEYSPAN_USA19HS_BAUDCLK (14769231L)
113#define KEYSPAN_USA28_BAUDCLK (1843200L)
114#define KEYSPAN_USA28X_BAUDCLK (12000000L)
115#define KEYSPAN_USA49W_BAUDCLK (48000000L)
116
117/* Some constants used to characterise each device. */
118#define KEYSPAN_MAX_NUM_PORTS (4)
119#define KEYSPAN_MAX_FLIPS (2)
120
121/* Device info for the Keyspan serial converter, used
122 by the overall usb-serial probe function */
123#define KEYSPAN_VENDOR_ID (0x06cd)
124
125/* Product IDs for the products supported, pre-renumeration */
126#define keyspan_usa18x_pre_product_id 0x0105
127#define keyspan_usa19_pre_product_id 0x0103
128#define keyspan_usa19qi_pre_product_id 0x010b
129#define keyspan_mpr_pre_product_id 0x011b
130#define keyspan_usa19qw_pre_product_id 0x0118
131#define keyspan_usa19w_pre_product_id 0x0106
132#define keyspan_usa28_pre_product_id 0x0101
133#define keyspan_usa28x_pre_product_id 0x0102
134#define keyspan_usa28xa_pre_product_id 0x0114
135#define keyspan_usa28xb_pre_product_id 0x0113
136#define keyspan_usa49w_pre_product_id 0x0109
137#define keyspan_usa49wlc_pre_product_id 0x011a
138
139/* Product IDs post-renumeration. Note that the 28x and 28xb
140 have the same id's post-renumeration but behave identically
Ben Collins188d6362008-06-26 20:08:16 -0400141 so it's not an issue. As such, the 28xb is not listed in any
142 of the device tables. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143#define keyspan_usa18x_product_id 0x0112
144#define keyspan_usa19_product_id 0x0107
145#define keyspan_usa19qi_product_id 0x010c
146#define keyspan_usa19hs_product_id 0x0121
147#define keyspan_mpr_product_id 0x011c
148#define keyspan_usa19qw_product_id 0x0119
149#define keyspan_usa19w_product_id 0x0108
150#define keyspan_usa28_product_id 0x010f
151#define keyspan_usa28x_product_id 0x0110
152#define keyspan_usa28xa_product_id 0x0115
Lucy McCoy0ca12682007-05-18 12:10:41 -0700153#define keyspan_usa28xb_product_id 0x0110
154#define keyspan_usa28xg_product_id 0x0135
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155#define keyspan_usa49w_product_id 0x010a
156#define keyspan_usa49wlc_product_id 0x012a
Lucy McCoy0ca12682007-05-18 12:10:41 -0700157#define keyspan_usa49wg_product_id 0x0131
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158
159struct keyspan_device_details {
160 /* product ID value */
161 int product_id;
162
Lucy McCoy0ca12682007-05-18 12:10:41 -0700163 enum {msg_usa26, msg_usa28, msg_usa49, msg_usa90, msg_usa67} msg_format;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
165 /* Number of physical ports */
166 int num_ports;
167
168 /* 1 if endpoint flipping used on input, 0 if not */
169 int indat_endp_flip;
170
171 /* 1 if endpoint flipping used on output, 0 if not */
172 int outdat_endp_flip;
173
174 /* Table mapping input data endpoint IDs to physical
175 port number and flip if used */
176 int indat_endpoints[KEYSPAN_MAX_NUM_PORTS];
177
178 /* Same for output endpoints */
179 int outdat_endpoints[KEYSPAN_MAX_NUM_PORTS];
180
181 /* Input acknowledge endpoints */
182 int inack_endpoints[KEYSPAN_MAX_NUM_PORTS];
183
184 /* Output control endpoints */
185 int outcont_endpoints[KEYSPAN_MAX_NUM_PORTS];
186
187 /* Endpoint used for input status */
188 int instat_endpoint;
189
Lucy McCoy0ca12682007-05-18 12:10:41 -0700190 /* Endpoint used for input data 49WG only */
191 int indat_endpoint;
192
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 /* Endpoint used for global control functions */
194 int glocont_endpoint;
195
196 int (*calculate_baud_rate) (u32 baud_rate, u32 baudclk,
197 u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum);
198 u32 baudclk;
199};
200
201/* Now for each device type we setup the device detail
202 structure with the appropriate information (provided
203 in Keyspan's documentation) */
204
205static const struct keyspan_device_details usa18x_device_details = {
206 .product_id = keyspan_usa18x_product_id,
207 .msg_format = msg_usa26,
208 .num_ports = 1,
209 .indat_endp_flip = 0,
210 .outdat_endp_flip = 1,
211 .indat_endpoints = {0x81},
212 .outdat_endpoints = {0x01},
213 .inack_endpoints = {0x85},
214 .outcont_endpoints = {0x05},
215 .instat_endpoint = 0x87,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700216 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 .glocont_endpoint = 0x07,
218 .calculate_baud_rate = keyspan_usa19w_calc_baud,
219 .baudclk = KEYSPAN_USA18X_BAUDCLK,
220};
221
222static const struct keyspan_device_details usa19_device_details = {
223 .product_id = keyspan_usa19_product_id,
224 .msg_format = msg_usa28,
225 .num_ports = 1,
226 .indat_endp_flip = 1,
227 .outdat_endp_flip = 1,
228 .indat_endpoints = {0x81},
229 .outdat_endpoints = {0x01},
230 .inack_endpoints = {0x83},
231 .outcont_endpoints = {0x03},
232 .instat_endpoint = 0x84,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700233 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 .glocont_endpoint = -1,
235 .calculate_baud_rate = keyspan_usa19_calc_baud,
236 .baudclk = KEYSPAN_USA19_BAUDCLK,
237};
238
239static const struct keyspan_device_details usa19qi_device_details = {
240 .product_id = keyspan_usa19qi_product_id,
241 .msg_format = msg_usa28,
242 .num_ports = 1,
243 .indat_endp_flip = 1,
244 .outdat_endp_flip = 1,
245 .indat_endpoints = {0x81},
246 .outdat_endpoints = {0x01},
247 .inack_endpoints = {0x83},
248 .outcont_endpoints = {0x03},
249 .instat_endpoint = 0x84,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700250 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 .glocont_endpoint = -1,
252 .calculate_baud_rate = keyspan_usa28_calc_baud,
253 .baudclk = KEYSPAN_USA19_BAUDCLK,
254};
255
256static const struct keyspan_device_details mpr_device_details = {
257 .product_id = keyspan_mpr_product_id,
258 .msg_format = msg_usa28,
259 .num_ports = 1,
260 .indat_endp_flip = 1,
261 .outdat_endp_flip = 1,
262 .indat_endpoints = {0x81},
263 .outdat_endpoints = {0x01},
264 .inack_endpoints = {0x83},
265 .outcont_endpoints = {0x03},
266 .instat_endpoint = 0x84,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700267 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 .glocont_endpoint = -1,
269 .calculate_baud_rate = keyspan_usa28_calc_baud,
270 .baudclk = KEYSPAN_USA19_BAUDCLK,
271};
272
273static const struct keyspan_device_details usa19qw_device_details = {
274 .product_id = keyspan_usa19qw_product_id,
275 .msg_format = msg_usa26,
276 .num_ports = 1,
277 .indat_endp_flip = 0,
278 .outdat_endp_flip = 1,
279 .indat_endpoints = {0x81},
280 .outdat_endpoints = {0x01},
281 .inack_endpoints = {0x85},
282 .outcont_endpoints = {0x05},
283 .instat_endpoint = 0x87,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700284 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 .glocont_endpoint = 0x07,
286 .calculate_baud_rate = keyspan_usa19w_calc_baud,
287 .baudclk = KEYSPAN_USA19W_BAUDCLK,
288};
289
290static const struct keyspan_device_details usa19w_device_details = {
291 .product_id = keyspan_usa19w_product_id,
292 .msg_format = msg_usa26,
293 .num_ports = 1,
294 .indat_endp_flip = 0,
295 .outdat_endp_flip = 1,
296 .indat_endpoints = {0x81},
297 .outdat_endpoints = {0x01},
298 .inack_endpoints = {0x85},
299 .outcont_endpoints = {0x05},
300 .instat_endpoint = 0x87,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700301 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302 .glocont_endpoint = 0x07,
303 .calculate_baud_rate = keyspan_usa19w_calc_baud,
304 .baudclk = KEYSPAN_USA19W_BAUDCLK,
305};
306
307static const struct keyspan_device_details usa19hs_device_details = {
308 .product_id = keyspan_usa19hs_product_id,
309 .msg_format = msg_usa90,
310 .num_ports = 1,
311 .indat_endp_flip = 0,
312 .outdat_endp_flip = 0,
313 .indat_endpoints = {0x81},
314 .outdat_endpoints = {0x01},
315 .inack_endpoints = {-1},
316 .outcont_endpoints = {0x02},
317 .instat_endpoint = 0x82,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700318 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319 .glocont_endpoint = -1,
320 .calculate_baud_rate = keyspan_usa19hs_calc_baud,
321 .baudclk = KEYSPAN_USA19HS_BAUDCLK,
322};
323
324static const struct keyspan_device_details usa28_device_details = {
325 .product_id = keyspan_usa28_product_id,
326 .msg_format = msg_usa28,
327 .num_ports = 2,
328 .indat_endp_flip = 1,
329 .outdat_endp_flip = 1,
330 .indat_endpoints = {0x81, 0x83},
331 .outdat_endpoints = {0x01, 0x03},
332 .inack_endpoints = {0x85, 0x86},
333 .outcont_endpoints = {0x05, 0x06},
334 .instat_endpoint = 0x87,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700335 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 .glocont_endpoint = 0x07,
337 .calculate_baud_rate = keyspan_usa28_calc_baud,
338 .baudclk = KEYSPAN_USA28_BAUDCLK,
339};
340
341static const struct keyspan_device_details usa28x_device_details = {
342 .product_id = keyspan_usa28x_product_id,
343 .msg_format = msg_usa26,
344 .num_ports = 2,
345 .indat_endp_flip = 0,
346 .outdat_endp_flip = 1,
347 .indat_endpoints = {0x81, 0x83},
348 .outdat_endpoints = {0x01, 0x03},
349 .inack_endpoints = {0x85, 0x86},
350 .outcont_endpoints = {0x05, 0x06},
351 .instat_endpoint = 0x87,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700352 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353 .glocont_endpoint = 0x07,
354 .calculate_baud_rate = keyspan_usa19w_calc_baud,
355 .baudclk = KEYSPAN_USA28X_BAUDCLK,
356};
357
358static const struct keyspan_device_details usa28xa_device_details = {
359 .product_id = keyspan_usa28xa_product_id,
360 .msg_format = msg_usa26,
361 .num_ports = 2,
362 .indat_endp_flip = 0,
363 .outdat_endp_flip = 1,
364 .indat_endpoints = {0x81, 0x83},
365 .outdat_endpoints = {0x01, 0x03},
366 .inack_endpoints = {0x85, 0x86},
367 .outcont_endpoints = {0x05, 0x06},
368 .instat_endpoint = 0x87,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700369 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 .glocont_endpoint = 0x07,
371 .calculate_baud_rate = keyspan_usa19w_calc_baud,
372 .baudclk = KEYSPAN_USA28X_BAUDCLK,
373};
374
Lucy McCoy0ca12682007-05-18 12:10:41 -0700375static const struct keyspan_device_details usa28xg_device_details = {
376 .product_id = keyspan_usa28xg_product_id,
377 .msg_format = msg_usa67,
378 .num_ports = 2,
379 .indat_endp_flip = 0,
380 .outdat_endp_flip = 0,
381 .indat_endpoints = {0x84, 0x88},
382 .outdat_endpoints = {0x02, 0x06},
383 .inack_endpoints = {-1, -1},
384 .outcont_endpoints = {-1, -1},
385 .instat_endpoint = 0x81,
386 .indat_endpoint = -1,
387 .glocont_endpoint = 0x01,
388 .calculate_baud_rate = keyspan_usa19w_calc_baud,
389 .baudclk = KEYSPAN_USA28X_BAUDCLK,
390};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391/* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */
392
393static const struct keyspan_device_details usa49w_device_details = {
394 .product_id = keyspan_usa49w_product_id,
395 .msg_format = msg_usa49,
396 .num_ports = 4,
397 .indat_endp_flip = 0,
398 .outdat_endp_flip = 0,
399 .indat_endpoints = {0x81, 0x82, 0x83, 0x84},
400 .outdat_endpoints = {0x01, 0x02, 0x03, 0x04},
401 .inack_endpoints = {-1, -1, -1, -1},
402 .outcont_endpoints = {-1, -1, -1, -1},
403 .instat_endpoint = 0x87,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700404 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 .glocont_endpoint = 0x07,
406 .calculate_baud_rate = keyspan_usa19w_calc_baud,
407 .baudclk = KEYSPAN_USA49W_BAUDCLK,
408};
409
410static const struct keyspan_device_details usa49wlc_device_details = {
411 .product_id = keyspan_usa49wlc_product_id,
412 .msg_format = msg_usa49,
413 .num_ports = 4,
414 .indat_endp_flip = 0,
415 .outdat_endp_flip = 0,
416 .indat_endpoints = {0x81, 0x82, 0x83, 0x84},
417 .outdat_endpoints = {0x01, 0x02, 0x03, 0x04},
418 .inack_endpoints = {-1, -1, -1, -1},
419 .outcont_endpoints = {-1, -1, -1, -1},
420 .instat_endpoint = 0x87,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700421 .indat_endpoint = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422 .glocont_endpoint = 0x07,
423 .calculate_baud_rate = keyspan_usa19w_calc_baud,
424 .baudclk = KEYSPAN_USA19W_BAUDCLK,
425};
426
Lucy McCoy0ca12682007-05-18 12:10:41 -0700427static const struct keyspan_device_details usa49wg_device_details = {
428 .product_id = keyspan_usa49wg_product_id,
429 .msg_format = msg_usa49,
430 .num_ports = 4,
431 .indat_endp_flip = 0,
432 .outdat_endp_flip = 0,
433 .indat_endpoints = {-1, -1, -1, -1}, /* single 'global' data in EP */
434 .outdat_endpoints = {0x01, 0x02, 0x04, 0x06},
435 .inack_endpoints = {-1, -1, -1, -1},
436 .outcont_endpoints = {-1, -1, -1, -1},
437 .instat_endpoint = 0x81,
438 .indat_endpoint = 0x88,
439 .glocont_endpoint = 0x00, /* uses control EP */
440 .calculate_baud_rate = keyspan_usa19w_calc_baud,
441 .baudclk = KEYSPAN_USA19W_BAUDCLK,
442};
443
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444static const struct keyspan_device_details *keyspan_devices[] = {
445 &usa18x_device_details,
446 &usa19_device_details,
447 &usa19qi_device_details,
448 &mpr_device_details,
449 &usa19qw_device_details,
450 &usa19w_device_details,
451 &usa19hs_device_details,
452 &usa28_device_details,
453 &usa28x_device_details,
454 &usa28xa_device_details,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700455 &usa28xg_device_details,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 /* 28xb not required as it renumerates as a 28x */
457 &usa49w_device_details,
458 &usa49wlc_device_details,
Lucy McCoy0ca12682007-05-18 12:10:41 -0700459 &usa49wg_device_details,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460 NULL,
461};
462
463static struct usb_device_id keyspan_ids_combined[] = {
464 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
465 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
466 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
467 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
468 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
469 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
470 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
471 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
472 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
473 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
474 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
475 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) },
476 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
477 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
478 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
479 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
480 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
481 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
482 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
483 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
484 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
485 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
Lucy McCoy0ca12682007-05-18 12:10:41 -0700486 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xg_product_id) },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id)},
488 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
Lucy McCoy0ca12682007-05-18 12:10:41 -0700489 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wg_product_id)},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700490 { } /* Terminating entry */
491};
492
493MODULE_DEVICE_TABLE(usb, keyspan_ids_combined);
494
495static struct usb_driver keyspan_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496 .name = "keyspan",
497 .probe = usb_serial_probe,
498 .disconnect = usb_serial_disconnect,
499 .id_table = keyspan_ids_combined,
Greg Kroah-Hartmanba9dc652005-11-16 13:41:28 -0800500 .no_dynamic_id = 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501};
502
503/* usb_device_id table for the pre-firmware download keyspan devices */
504static struct usb_device_id keyspan_pre_ids[] = {
505 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
506 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
507 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
508 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
509 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
510 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
511 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
512 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
513 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
514 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
515 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
516 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) },
517 { } /* Terminating entry */
518};
519
520static struct usb_device_id keyspan_1port_ids[] = {
521 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
522 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
523 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
524 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
525 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
526 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
527 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
528 { } /* Terminating entry */
529};
530
531static struct usb_device_id keyspan_2port_ids[] = {
532 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
533 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
534 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
Lucy McCoy0ca12682007-05-18 12:10:41 -0700535 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xg_product_id) },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536 { } /* Terminating entry */
537};
538
539static struct usb_device_id keyspan_4port_ids[] = {
540 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id) },
541 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
Lucy McCoy0ca12682007-05-18 12:10:41 -0700542 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wg_product_id)},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 { } /* Terminating entry */
544};
545
546/* Structs for the devices, pre and post renumeration. */
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700547static struct usb_serial_driver keyspan_pre_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700548 .driver = {
549 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700550 .name = "keyspan_no_firm",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700551 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700552 .description = "Keyspan - (without firmware)",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700553 .id_table = keyspan_pre_ids,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554 .num_ports = 1,
555 .attach = keyspan_fake_startup,
556};
557
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700558static struct usb_serial_driver keyspan_1port_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700559 .driver = {
560 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700561 .name = "keyspan_1",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700562 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700563 .description = "Keyspan 1 port adapter",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 .id_table = keyspan_1port_ids,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 .num_ports = 1,
566 .open = keyspan_open,
567 .close = keyspan_close,
568 .write = keyspan_write,
569 .write_room = keyspan_write_room,
570 .chars_in_buffer = keyspan_chars_in_buffer,
571 .throttle = keyspan_rx_throttle,
572 .unthrottle = keyspan_rx_unthrottle,
573 .ioctl = keyspan_ioctl,
574 .set_termios = keyspan_set_termios,
575 .break_ctl = keyspan_break_ctl,
576 .tiocmget = keyspan_tiocmget,
577 .tiocmset = keyspan_tiocmset,
578 .attach = keyspan_startup,
579 .shutdown = keyspan_shutdown,
580};
581
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700582static struct usb_serial_driver keyspan_2port_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700583 .driver = {
584 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700585 .name = "keyspan_2",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700586 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700587 .description = "Keyspan 2 port adapter",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588 .id_table = keyspan_2port_ids,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589 .num_ports = 2,
590 .open = keyspan_open,
591 .close = keyspan_close,
592 .write = keyspan_write,
593 .write_room = keyspan_write_room,
594 .chars_in_buffer = keyspan_chars_in_buffer,
595 .throttle = keyspan_rx_throttle,
596 .unthrottle = keyspan_rx_unthrottle,
597 .ioctl = keyspan_ioctl,
598 .set_termios = keyspan_set_termios,
599 .break_ctl = keyspan_break_ctl,
600 .tiocmget = keyspan_tiocmget,
601 .tiocmset = keyspan_tiocmset,
602 .attach = keyspan_startup,
603 .shutdown = keyspan_shutdown,
604};
605
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700606static struct usb_serial_driver keyspan_4port_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700607 .driver = {
608 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700609 .name = "keyspan_4",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700610 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700611 .description = "Keyspan 4 port adapter",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 .id_table = keyspan_4port_ids,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 .num_ports = 4,
614 .open = keyspan_open,
615 .close = keyspan_close,
616 .write = keyspan_write,
617 .write_room = keyspan_write_room,
618 .chars_in_buffer = keyspan_chars_in_buffer,
619 .throttle = keyspan_rx_throttle,
620 .unthrottle = keyspan_rx_unthrottle,
621 .ioctl = keyspan_ioctl,
622 .set_termios = keyspan_set_termios,
623 .break_ctl = keyspan_break_ctl,
624 .tiocmget = keyspan_tiocmget,
625 .tiocmset = keyspan_tiocmset,
626 .attach = keyspan_startup,
627 .shutdown = keyspan_shutdown,
628};
629
630#endif