blob: 0a8a40b5711e8d288a222aef5c86573c1a674cc1 [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
Justin P. Mattock631dd1a2010-10-18 11:03:14 +020012 See http://blemings.org/hugh/keyspan.html for more information.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
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 */
Alan Cox95da3102008-07-22 11:09:07 +010038static int keyspan_open (struct tty_struct *tty,
Alan Coxa509a7e2009-09-19 13:13:26 -070039 struct usb_serial_port *port);
Alan Cox335f8512009-06-11 12:26:29 +010040static void keyspan_close (struct usb_serial_port *port);
41static void keyspan_dtr_rts (struct usb_serial_port *port, int on);
Linus Torvalds1da177e2005-04-16 15:20:36 -070042static int keyspan_startup (struct usb_serial *serial);
Alan Sternf9c99bb2009-06-02 11:53:55 -040043static void keyspan_disconnect (struct usb_serial *serial);
44static void keyspan_release (struct usb_serial *serial);
Alan Cox95da3102008-07-22 11:09:07 +010045static int keyspan_write_room (struct tty_struct *tty);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
Alan Cox95da3102008-07-22 11:09:07 +010047static int keyspan_write (struct tty_struct *tty,
48 struct usb_serial_port *port,
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 const unsigned char *buf,
50 int count);
51
52static void keyspan_send_setup (struct usb_serial_port *port,
53 int reset_port);
54
55
Alan Cox95da3102008-07-22 11:09:07 +010056static void keyspan_set_termios (struct tty_struct *tty,
57 struct usb_serial_port *port,
Alan Cox606d0992006-12-08 02:38:45 -080058 struct ktermios *old);
Alan Cox95da3102008-07-22 11:09:07 +010059static void keyspan_break_ctl (struct tty_struct *tty,
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 int break_state);
Alan Cox60b33c12011-02-14 16:26:14 +000061static int keyspan_tiocmget (struct tty_struct *tty);
Alan Cox95da3102008-07-22 11:09:07 +010062static int keyspan_tiocmset (struct tty_struct *tty,
Alan Cox20b9d172011-02-14 16:26:50 +000063 unsigned int set,
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 unsigned int clear);
65static int keyspan_fake_startup (struct usb_serial *serial);
66
Greg Kroah-Hartman049c6b42012-09-14 16:30:23 -070067static int keyspan_usa19_calc_baud (struct usb_serial_port *port,
68 u32 baud_rate, u32 baudclk,
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 u8 *rate_hi, u8 *rate_low,
70 u8 *prescaler, int portnum);
71
Greg Kroah-Hartman049c6b42012-09-14 16:30:23 -070072static int keyspan_usa19w_calc_baud (struct usb_serial_port *port,
73 u32 baud_rate, u32 baudclk,
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 u8 *rate_hi, u8 *rate_low,
75 u8 *prescaler, int portnum);
76
Greg Kroah-Hartman049c6b42012-09-14 16:30:23 -070077static int keyspan_usa28_calc_baud (struct usb_serial_port *port,
78 u32 baud_rate, u32 baudclk,
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 u8 *rate_hi, u8 *rate_low,
80 u8 *prescaler, int portnum);
81
Greg Kroah-Hartman049c6b42012-09-14 16:30:23 -070082static int keyspan_usa19hs_calc_baud (struct usb_serial_port *port,
83 u32 baud_rate, u32 baudclk,
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 u8 *rate_hi, u8 *rate_low,
85 u8 *prescaler, int portnum);
86
87static int keyspan_usa28_send_setup (struct usb_serial *serial,
88 struct usb_serial_port *port,
89 int reset_port);
90static int keyspan_usa26_send_setup (struct usb_serial *serial,
91 struct usb_serial_port *port,
92 int reset_port);
93static int keyspan_usa49_send_setup (struct usb_serial *serial,
94 struct usb_serial_port *port,
95 int reset_port);
96
97static int keyspan_usa90_send_setup (struct usb_serial *serial,
98 struct usb_serial_port *port,
99 int reset_port);
100
Lucy McCoy0ca12682007-05-18 12:10:41 -0700101static int keyspan_usa67_send_setup (struct usb_serial *serial,
102 struct usb_serial_port *port,
103 int reset_port);
104
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105/* Values used for baud rate calculation - device specific */
106#define KEYSPAN_INVALID_BAUD_RATE (-1)
107#define KEYSPAN_BAUD_RATE_OK (0)
108#define KEYSPAN_USA18X_BAUDCLK (12000000L) /* a guess */
109#define KEYSPAN_USA19_BAUDCLK (12000000L)
110#define KEYSPAN_USA19W_BAUDCLK (24000000L)
111#define KEYSPAN_USA19HS_BAUDCLK (14769231L)
112#define KEYSPAN_USA28_BAUDCLK (1843200L)
113#define KEYSPAN_USA28X_BAUDCLK (12000000L)
114#define KEYSPAN_USA49W_BAUDCLK (48000000L)
115
116/* Some constants used to characterise each device. */
117#define KEYSPAN_MAX_NUM_PORTS (4)
118#define KEYSPAN_MAX_FLIPS (2)
119
120/* Device info for the Keyspan serial converter, used
121 by the overall usb-serial probe function */
122#define KEYSPAN_VENDOR_ID (0x06cd)
123
124/* Product IDs for the products supported, pre-renumeration */
125#define keyspan_usa18x_pre_product_id 0x0105
126#define keyspan_usa19_pre_product_id 0x0103
127#define keyspan_usa19qi_pre_product_id 0x010b
128#define keyspan_mpr_pre_product_id 0x011b
129#define keyspan_usa19qw_pre_product_id 0x0118
130#define keyspan_usa19w_pre_product_id 0x0106
131#define keyspan_usa28_pre_product_id 0x0101
132#define keyspan_usa28x_pre_product_id 0x0102
133#define keyspan_usa28xa_pre_product_id 0x0114
134#define keyspan_usa28xb_pre_product_id 0x0113
135#define keyspan_usa49w_pre_product_id 0x0109
136#define keyspan_usa49wlc_pre_product_id 0x011a
137
138/* Product IDs post-renumeration. Note that the 28x and 28xb
139 have the same id's post-renumeration but behave identically
Ben Collins188d6362008-06-26 20:08:16 -0400140 so it's not an issue. As such, the 28xb is not listed in any
141 of the device tables. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142#define keyspan_usa18x_product_id 0x0112
143#define keyspan_usa19_product_id 0x0107
144#define keyspan_usa19qi_product_id 0x010c
145#define keyspan_usa19hs_product_id 0x0121
146#define keyspan_mpr_product_id 0x011c
147#define keyspan_usa19qw_product_id 0x0119
148#define keyspan_usa19w_product_id 0x0108
149#define keyspan_usa28_product_id 0x010f
150#define keyspan_usa28x_product_id 0x0110
151#define keyspan_usa28xa_product_id 0x0115
Lucy McCoy0ca12682007-05-18 12:10:41 -0700152#define keyspan_usa28xb_product_id 0x0110
153#define keyspan_usa28xg_product_id 0x0135
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154#define keyspan_usa49w_product_id 0x010a
155#define keyspan_usa49wlc_product_id 0x012a
Lucy McCoy0ca12682007-05-18 12:10:41 -0700156#define keyspan_usa49wg_product_id 0x0131
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157
158struct keyspan_device_details {
159 /* product ID value */
160 int product_id;
161
Lucy McCoy0ca12682007-05-18 12:10:41 -0700162 enum {msg_usa26, msg_usa28, msg_usa49, msg_usa90, msg_usa67} msg_format;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163
164 /* Number of physical ports */
165 int num_ports;
166
167 /* 1 if endpoint flipping used on input, 0 if not */
168 int indat_endp_flip;
169
170 /* 1 if endpoint flipping used on output, 0 if not */
171 int outdat_endp_flip;
172
173 /* Table mapping input data endpoint IDs to physical
174 port number and flip if used */
175 int indat_endpoints[KEYSPAN_MAX_NUM_PORTS];
176
177 /* Same for output endpoints */
178 int outdat_endpoints[KEYSPAN_MAX_NUM_PORTS];
179
180 /* Input acknowledge endpoints */
181 int inack_endpoints[KEYSPAN_MAX_NUM_PORTS];
182
183 /* Output control endpoints */
184 int outcont_endpoints[KEYSPAN_MAX_NUM_PORTS];
185
186 /* Endpoint used for input status */
187 int instat_endpoint;
188
Lucy McCoy0ca12682007-05-18 12:10:41 -0700189 /* Endpoint used for input data 49WG only */
190 int indat_endpoint;
191
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 /* Endpoint used for global control functions */
193 int glocont_endpoint;
194
Greg Kroah-Hartman049c6b42012-09-14 16:30:23 -0700195 int (*calculate_baud_rate) (struct usb_serial_port *port,
196 u32 baud_rate, u32 baudclk,
197 u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 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
Németh Márton7d40d7e2010-01-10 15:34:24 +0100463static const struct usb_device_id keyspan_ids_combined[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464 { 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495/* usb_device_id table for the pre-firmware download keyspan devices */
Németh Márton7d40d7e2010-01-10 15:34:24 +0100496static const struct usb_device_id keyspan_pre_ids[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700497 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
498 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
499 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
500 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
501 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
502 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
503 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
504 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
505 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
506 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
507 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
508 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) },
509 { } /* Terminating entry */
510};
511
Németh Márton7d40d7e2010-01-10 15:34:24 +0100512static const struct usb_device_id keyspan_1port_ids[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
514 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
515 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
516 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
517 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
518 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
519 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
520 { } /* Terminating entry */
521};
522
Németh Márton7d40d7e2010-01-10 15:34:24 +0100523static const struct usb_device_id keyspan_2port_ids[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
525 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
526 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
Lucy McCoy0ca12682007-05-18 12:10:41 -0700527 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xg_product_id) },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528 { } /* Terminating entry */
529};
530
Németh Márton7d40d7e2010-01-10 15:34:24 +0100531static const struct usb_device_id keyspan_4port_ids[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id) },
533 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
Lucy McCoy0ca12682007-05-18 12:10:41 -0700534 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wg_product_id)},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535 { } /* Terminating entry */
536};
537
538/* Structs for the devices, pre and post renumeration. */
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700539static struct usb_serial_driver keyspan_pre_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700540 .driver = {
541 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700542 .name = "keyspan_no_firm",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700543 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700544 .description = "Keyspan - (without firmware)",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 .id_table = keyspan_pre_ids,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700546 .num_ports = 1,
547 .attach = keyspan_fake_startup,
548};
549
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700550static struct usb_serial_driver keyspan_1port_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700551 .driver = {
552 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700553 .name = "keyspan_1",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700554 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700555 .description = "Keyspan 1 port adapter",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556 .id_table = keyspan_1port_ids,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557 .num_ports = 1,
558 .open = keyspan_open,
559 .close = keyspan_close,
Alan Cox335f8512009-06-11 12:26:29 +0100560 .dtr_rts = keyspan_dtr_rts,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 .write = keyspan_write,
562 .write_room = keyspan_write_room,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 .set_termios = keyspan_set_termios,
564 .break_ctl = keyspan_break_ctl,
565 .tiocmget = keyspan_tiocmget,
566 .tiocmset = keyspan_tiocmset,
567 .attach = keyspan_startup,
Alan Sternf9c99bb2009-06-02 11:53:55 -0400568 .disconnect = keyspan_disconnect,
569 .release = keyspan_release,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570};
571
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700572static struct usb_serial_driver keyspan_2port_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700573 .driver = {
574 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700575 .name = "keyspan_2",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700576 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700577 .description = "Keyspan 2 port adapter",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700578 .id_table = keyspan_2port_ids,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579 .num_ports = 2,
580 .open = keyspan_open,
581 .close = keyspan_close,
Alan Cox335f8512009-06-11 12:26:29 +0100582 .dtr_rts = keyspan_dtr_rts,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583 .write = keyspan_write,
584 .write_room = keyspan_write_room,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 .set_termios = keyspan_set_termios,
586 .break_ctl = keyspan_break_ctl,
587 .tiocmget = keyspan_tiocmget,
588 .tiocmset = keyspan_tiocmset,
589 .attach = keyspan_startup,
Alan Sternf9c99bb2009-06-02 11:53:55 -0400590 .disconnect = keyspan_disconnect,
591 .release = keyspan_release,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592};
593
Greg Kroah-Hartmanea653702005-06-20 21:15:16 -0700594static struct usb_serial_driver keyspan_4port_device = {
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700595 .driver = {
596 .owner = THIS_MODULE,
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700597 .name = "keyspan_4",
Greg Kroah-Hartman18fcac32005-06-20 21:15:16 -0700598 },
Greg Kroah-Hartman269bda12005-06-20 21:15:16 -0700599 .description = "Keyspan 4 port adapter",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 .id_table = keyspan_4port_ids,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 .num_ports = 4,
602 .open = keyspan_open,
603 .close = keyspan_close,
Alan Cox335f8512009-06-11 12:26:29 +0100604 .dtr_rts = keyspan_dtr_rts,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605 .write = keyspan_write,
606 .write_room = keyspan_write_room,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 .set_termios = keyspan_set_termios,
608 .break_ctl = keyspan_break_ctl,
609 .tiocmget = keyspan_tiocmget,
610 .tiocmset = keyspan_tiocmset,
611 .attach = keyspan_startup,
Alan Sternf9c99bb2009-06-02 11:53:55 -0400612 .disconnect = keyspan_disconnect,
613 .release = keyspan_release,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700614};
615
Alan Stern4d2a7af2012-02-23 14:57:09 -0500616static struct usb_serial_driver * const serial_drivers[] = {
617 &keyspan_pre_device, &keyspan_1port_device,
618 &keyspan_2port_device, &keyspan_4port_device, NULL
619};
620
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621#endif