Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
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 | ||
631dd1a8 | 12 | See http://blemings.org/hugh/keyspan.html for more information. |
1da177e4 LT |
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 */ | |
95da310e | 38 | static int keyspan_open (struct tty_struct *tty, |
a509a7e4 | 39 | struct usb_serial_port *port); |
335f8514 AC |
40 | static void keyspan_close (struct usb_serial_port *port); |
41 | static void keyspan_dtr_rts (struct usb_serial_port *port, int on); | |
1da177e4 | 42 | static int keyspan_startup (struct usb_serial *serial); |
f9c99bb8 AS |
43 | static void keyspan_disconnect (struct usb_serial *serial); |
44 | static void keyspan_release (struct usb_serial *serial); | |
f79b2d0f JH |
45 | static int keyspan_port_probe(struct usb_serial_port *port); |
46 | static int keyspan_port_remove(struct usb_serial_port *port); | |
95da310e | 47 | static int keyspan_write_room (struct tty_struct *tty); |
1da177e4 | 48 | |
95da310e AC |
49 | static int keyspan_write (struct tty_struct *tty, |
50 | struct usb_serial_port *port, | |
1da177e4 LT |
51 | const unsigned char *buf, |
52 | int count); | |
53 | ||
54 | static void keyspan_send_setup (struct usb_serial_port *port, | |
55 | int reset_port); | |
56 | ||
57 | ||
95da310e AC |
58 | static void keyspan_set_termios (struct tty_struct *tty, |
59 | struct usb_serial_port *port, | |
606d099c | 60 | struct ktermios *old); |
95da310e | 61 | static void keyspan_break_ctl (struct tty_struct *tty, |
1da177e4 | 62 | int break_state); |
60b33c13 | 63 | static int keyspan_tiocmget (struct tty_struct *tty); |
95da310e | 64 | static int keyspan_tiocmset (struct tty_struct *tty, |
20b9d177 | 65 | unsigned int set, |
1da177e4 LT |
66 | unsigned int clear); |
67 | static int keyspan_fake_startup (struct usb_serial *serial); | |
68 | ||
049c6b4e GKH |
69 | static int keyspan_usa19_calc_baud (struct usb_serial_port *port, |
70 | u32 baud_rate, u32 baudclk, | |
1da177e4 LT |
71 | u8 *rate_hi, u8 *rate_low, |
72 | u8 *prescaler, int portnum); | |
73 | ||
049c6b4e GKH |
74 | static int keyspan_usa19w_calc_baud (struct usb_serial_port *port, |
75 | u32 baud_rate, u32 baudclk, | |
1da177e4 LT |
76 | u8 *rate_hi, u8 *rate_low, |
77 | u8 *prescaler, int portnum); | |
78 | ||
049c6b4e GKH |
79 | static int keyspan_usa28_calc_baud (struct usb_serial_port *port, |
80 | u32 baud_rate, u32 baudclk, | |
1da177e4 LT |
81 | u8 *rate_hi, u8 *rate_low, |
82 | u8 *prescaler, int portnum); | |
83 | ||
049c6b4e GKH |
84 | static int keyspan_usa19hs_calc_baud (struct usb_serial_port *port, |
85 | u32 baud_rate, u32 baudclk, | |
1da177e4 LT |
86 | u8 *rate_hi, u8 *rate_low, |
87 | u8 *prescaler, int portnum); | |
88 | ||
89 | static int keyspan_usa28_send_setup (struct usb_serial *serial, | |
90 | struct usb_serial_port *port, | |
91 | int reset_port); | |
92 | static int keyspan_usa26_send_setup (struct usb_serial *serial, | |
93 | struct usb_serial_port *port, | |
94 | int reset_port); | |
95 | static int keyspan_usa49_send_setup (struct usb_serial *serial, | |
96 | struct usb_serial_port *port, | |
97 | int reset_port); | |
98 | ||
99 | static int keyspan_usa90_send_setup (struct usb_serial *serial, | |
100 | struct usb_serial_port *port, | |
101 | int reset_port); | |
102 | ||
0ca1268e LM |
103 | static int keyspan_usa67_send_setup (struct usb_serial *serial, |
104 | struct usb_serial_port *port, | |
105 | int reset_port); | |
106 | ||
1da177e4 LT |
107 | /* Values used for baud rate calculation - device specific */ |
108 | #define KEYSPAN_INVALID_BAUD_RATE (-1) | |
109 | #define KEYSPAN_BAUD_RATE_OK (0) | |
110 | #define KEYSPAN_USA18X_BAUDCLK (12000000L) /* a guess */ | |
111 | #define KEYSPAN_USA19_BAUDCLK (12000000L) | |
112 | #define KEYSPAN_USA19W_BAUDCLK (24000000L) | |
113 | #define KEYSPAN_USA19HS_BAUDCLK (14769231L) | |
114 | #define KEYSPAN_USA28_BAUDCLK (1843200L) | |
115 | #define KEYSPAN_USA28X_BAUDCLK (12000000L) | |
116 | #define KEYSPAN_USA49W_BAUDCLK (48000000L) | |
117 | ||
118 | /* Some constants used to characterise each device. */ | |
119 | #define KEYSPAN_MAX_NUM_PORTS (4) | |
120 | #define KEYSPAN_MAX_FLIPS (2) | |
121 | ||
122 | /* Device info for the Keyspan serial converter, used | |
123 | by the overall usb-serial probe function */ | |
124 | #define KEYSPAN_VENDOR_ID (0x06cd) | |
125 | ||
126 | /* Product IDs for the products supported, pre-renumeration */ | |
127 | #define keyspan_usa18x_pre_product_id 0x0105 | |
128 | #define keyspan_usa19_pre_product_id 0x0103 | |
129 | #define keyspan_usa19qi_pre_product_id 0x010b | |
130 | #define keyspan_mpr_pre_product_id 0x011b | |
131 | #define keyspan_usa19qw_pre_product_id 0x0118 | |
132 | #define keyspan_usa19w_pre_product_id 0x0106 | |
133 | #define keyspan_usa28_pre_product_id 0x0101 | |
134 | #define keyspan_usa28x_pre_product_id 0x0102 | |
135 | #define keyspan_usa28xa_pre_product_id 0x0114 | |
136 | #define keyspan_usa28xb_pre_product_id 0x0113 | |
137 | #define keyspan_usa49w_pre_product_id 0x0109 | |
138 | #define keyspan_usa49wlc_pre_product_id 0x011a | |
139 | ||
140 | /* Product IDs post-renumeration. Note that the 28x and 28xb | |
141 | have the same id's post-renumeration but behave identically | |
188d6360 BC |
142 | so it's not an issue. As such, the 28xb is not listed in any |
143 | of the device tables. */ | |
1da177e4 LT |
144 | #define keyspan_usa18x_product_id 0x0112 |
145 | #define keyspan_usa19_product_id 0x0107 | |
146 | #define keyspan_usa19qi_product_id 0x010c | |
147 | #define keyspan_usa19hs_product_id 0x0121 | |
148 | #define keyspan_mpr_product_id 0x011c | |
149 | #define keyspan_usa19qw_product_id 0x0119 | |
150 | #define keyspan_usa19w_product_id 0x0108 | |
151 | #define keyspan_usa28_product_id 0x010f | |
152 | #define keyspan_usa28x_product_id 0x0110 | |
153 | #define keyspan_usa28xa_product_id 0x0115 | |
0ca1268e LM |
154 | #define keyspan_usa28xb_product_id 0x0110 |
155 | #define keyspan_usa28xg_product_id 0x0135 | |
1da177e4 LT |
156 | #define keyspan_usa49w_product_id 0x010a |
157 | #define keyspan_usa49wlc_product_id 0x012a | |
0ca1268e | 158 | #define keyspan_usa49wg_product_id 0x0131 |
1da177e4 LT |
159 | |
160 | struct keyspan_device_details { | |
161 | /* product ID value */ | |
162 | int product_id; | |
163 | ||
0ca1268e | 164 | enum {msg_usa26, msg_usa28, msg_usa49, msg_usa90, msg_usa67} msg_format; |
1da177e4 LT |
165 | |
166 | /* Number of physical ports */ | |
167 | int num_ports; | |
168 | ||
169 | /* 1 if endpoint flipping used on input, 0 if not */ | |
170 | int indat_endp_flip; | |
171 | ||
172 | /* 1 if endpoint flipping used on output, 0 if not */ | |
173 | int outdat_endp_flip; | |
174 | ||
175 | /* Table mapping input data endpoint IDs to physical | |
176 | port number and flip if used */ | |
177 | int indat_endpoints[KEYSPAN_MAX_NUM_PORTS]; | |
178 | ||
179 | /* Same for output endpoints */ | |
180 | int outdat_endpoints[KEYSPAN_MAX_NUM_PORTS]; | |
181 | ||
182 | /* Input acknowledge endpoints */ | |
183 | int inack_endpoints[KEYSPAN_MAX_NUM_PORTS]; | |
184 | ||
185 | /* Output control endpoints */ | |
186 | int outcont_endpoints[KEYSPAN_MAX_NUM_PORTS]; | |
187 | ||
188 | /* Endpoint used for input status */ | |
189 | int instat_endpoint; | |
190 | ||
0ca1268e LM |
191 | /* Endpoint used for input data 49WG only */ |
192 | int indat_endpoint; | |
193 | ||
1da177e4 LT |
194 | /* Endpoint used for global control functions */ |
195 | int glocont_endpoint; | |
196 | ||
049c6b4e GKH |
197 | int (*calculate_baud_rate) (struct usb_serial_port *port, |
198 | u32 baud_rate, u32 baudclk, | |
199 | u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum); | |
1da177e4 LT |
200 | u32 baudclk; |
201 | }; | |
202 | ||
203 | /* Now for each device type we setup the device detail | |
204 | structure with the appropriate information (provided | |
205 | in Keyspan's documentation) */ | |
206 | ||
207 | static const struct keyspan_device_details usa18x_device_details = { | |
208 | .product_id = keyspan_usa18x_product_id, | |
209 | .msg_format = msg_usa26, | |
210 | .num_ports = 1, | |
211 | .indat_endp_flip = 0, | |
212 | .outdat_endp_flip = 1, | |
213 | .indat_endpoints = {0x81}, | |
214 | .outdat_endpoints = {0x01}, | |
215 | .inack_endpoints = {0x85}, | |
216 | .outcont_endpoints = {0x05}, | |
217 | .instat_endpoint = 0x87, | |
0ca1268e | 218 | .indat_endpoint = -1, |
1da177e4 LT |
219 | .glocont_endpoint = 0x07, |
220 | .calculate_baud_rate = keyspan_usa19w_calc_baud, | |
221 | .baudclk = KEYSPAN_USA18X_BAUDCLK, | |
222 | }; | |
223 | ||
224 | static const struct keyspan_device_details usa19_device_details = { | |
225 | .product_id = keyspan_usa19_product_id, | |
226 | .msg_format = msg_usa28, | |
227 | .num_ports = 1, | |
228 | .indat_endp_flip = 1, | |
229 | .outdat_endp_flip = 1, | |
230 | .indat_endpoints = {0x81}, | |
231 | .outdat_endpoints = {0x01}, | |
232 | .inack_endpoints = {0x83}, | |
233 | .outcont_endpoints = {0x03}, | |
234 | .instat_endpoint = 0x84, | |
0ca1268e | 235 | .indat_endpoint = -1, |
1da177e4 LT |
236 | .glocont_endpoint = -1, |
237 | .calculate_baud_rate = keyspan_usa19_calc_baud, | |
238 | .baudclk = KEYSPAN_USA19_BAUDCLK, | |
239 | }; | |
240 | ||
241 | static const struct keyspan_device_details usa19qi_device_details = { | |
242 | .product_id = keyspan_usa19qi_product_id, | |
243 | .msg_format = msg_usa28, | |
244 | .num_ports = 1, | |
245 | .indat_endp_flip = 1, | |
246 | .outdat_endp_flip = 1, | |
247 | .indat_endpoints = {0x81}, | |
248 | .outdat_endpoints = {0x01}, | |
249 | .inack_endpoints = {0x83}, | |
250 | .outcont_endpoints = {0x03}, | |
251 | .instat_endpoint = 0x84, | |
0ca1268e | 252 | .indat_endpoint = -1, |
1da177e4 LT |
253 | .glocont_endpoint = -1, |
254 | .calculate_baud_rate = keyspan_usa28_calc_baud, | |
255 | .baudclk = KEYSPAN_USA19_BAUDCLK, | |
256 | }; | |
257 | ||
258 | static const struct keyspan_device_details mpr_device_details = { | |
259 | .product_id = keyspan_mpr_product_id, | |
260 | .msg_format = msg_usa28, | |
261 | .num_ports = 1, | |
262 | .indat_endp_flip = 1, | |
263 | .outdat_endp_flip = 1, | |
264 | .indat_endpoints = {0x81}, | |
265 | .outdat_endpoints = {0x01}, | |
266 | .inack_endpoints = {0x83}, | |
267 | .outcont_endpoints = {0x03}, | |
268 | .instat_endpoint = 0x84, | |
0ca1268e | 269 | .indat_endpoint = -1, |
1da177e4 LT |
270 | .glocont_endpoint = -1, |
271 | .calculate_baud_rate = keyspan_usa28_calc_baud, | |
272 | .baudclk = KEYSPAN_USA19_BAUDCLK, | |
273 | }; | |
274 | ||
275 | static const struct keyspan_device_details usa19qw_device_details = { | |
276 | .product_id = keyspan_usa19qw_product_id, | |
277 | .msg_format = msg_usa26, | |
278 | .num_ports = 1, | |
279 | .indat_endp_flip = 0, | |
280 | .outdat_endp_flip = 1, | |
281 | .indat_endpoints = {0x81}, | |
282 | .outdat_endpoints = {0x01}, | |
283 | .inack_endpoints = {0x85}, | |
284 | .outcont_endpoints = {0x05}, | |
285 | .instat_endpoint = 0x87, | |
0ca1268e | 286 | .indat_endpoint = -1, |
1da177e4 LT |
287 | .glocont_endpoint = 0x07, |
288 | .calculate_baud_rate = keyspan_usa19w_calc_baud, | |
289 | .baudclk = KEYSPAN_USA19W_BAUDCLK, | |
290 | }; | |
291 | ||
292 | static const struct keyspan_device_details usa19w_device_details = { | |
293 | .product_id = keyspan_usa19w_product_id, | |
294 | .msg_format = msg_usa26, | |
295 | .num_ports = 1, | |
296 | .indat_endp_flip = 0, | |
297 | .outdat_endp_flip = 1, | |
298 | .indat_endpoints = {0x81}, | |
299 | .outdat_endpoints = {0x01}, | |
300 | .inack_endpoints = {0x85}, | |
301 | .outcont_endpoints = {0x05}, | |
302 | .instat_endpoint = 0x87, | |
0ca1268e | 303 | .indat_endpoint = -1, |
1da177e4 LT |
304 | .glocont_endpoint = 0x07, |
305 | .calculate_baud_rate = keyspan_usa19w_calc_baud, | |
306 | .baudclk = KEYSPAN_USA19W_BAUDCLK, | |
307 | }; | |
308 | ||
309 | static const struct keyspan_device_details usa19hs_device_details = { | |
310 | .product_id = keyspan_usa19hs_product_id, | |
311 | .msg_format = msg_usa90, | |
312 | .num_ports = 1, | |
313 | .indat_endp_flip = 0, | |
314 | .outdat_endp_flip = 0, | |
315 | .indat_endpoints = {0x81}, | |
316 | .outdat_endpoints = {0x01}, | |
317 | .inack_endpoints = {-1}, | |
318 | .outcont_endpoints = {0x02}, | |
319 | .instat_endpoint = 0x82, | |
0ca1268e | 320 | .indat_endpoint = -1, |
1da177e4 LT |
321 | .glocont_endpoint = -1, |
322 | .calculate_baud_rate = keyspan_usa19hs_calc_baud, | |
323 | .baudclk = KEYSPAN_USA19HS_BAUDCLK, | |
324 | }; | |
325 | ||
326 | static const struct keyspan_device_details usa28_device_details = { | |
327 | .product_id = keyspan_usa28_product_id, | |
328 | .msg_format = msg_usa28, | |
329 | .num_ports = 2, | |
330 | .indat_endp_flip = 1, | |
331 | .outdat_endp_flip = 1, | |
332 | .indat_endpoints = {0x81, 0x83}, | |
333 | .outdat_endpoints = {0x01, 0x03}, | |
334 | .inack_endpoints = {0x85, 0x86}, | |
335 | .outcont_endpoints = {0x05, 0x06}, | |
336 | .instat_endpoint = 0x87, | |
0ca1268e | 337 | .indat_endpoint = -1, |
1da177e4 LT |
338 | .glocont_endpoint = 0x07, |
339 | .calculate_baud_rate = keyspan_usa28_calc_baud, | |
340 | .baudclk = KEYSPAN_USA28_BAUDCLK, | |
341 | }; | |
342 | ||
343 | static const struct keyspan_device_details usa28x_device_details = { | |
344 | .product_id = keyspan_usa28x_product_id, | |
345 | .msg_format = msg_usa26, | |
346 | .num_ports = 2, | |
347 | .indat_endp_flip = 0, | |
348 | .outdat_endp_flip = 1, | |
349 | .indat_endpoints = {0x81, 0x83}, | |
350 | .outdat_endpoints = {0x01, 0x03}, | |
351 | .inack_endpoints = {0x85, 0x86}, | |
352 | .outcont_endpoints = {0x05, 0x06}, | |
353 | .instat_endpoint = 0x87, | |
0ca1268e | 354 | .indat_endpoint = -1, |
1da177e4 LT |
355 | .glocont_endpoint = 0x07, |
356 | .calculate_baud_rate = keyspan_usa19w_calc_baud, | |
357 | .baudclk = KEYSPAN_USA28X_BAUDCLK, | |
358 | }; | |
359 | ||
360 | static const struct keyspan_device_details usa28xa_device_details = { | |
361 | .product_id = keyspan_usa28xa_product_id, | |
362 | .msg_format = msg_usa26, | |
363 | .num_ports = 2, | |
364 | .indat_endp_flip = 0, | |
365 | .outdat_endp_flip = 1, | |
366 | .indat_endpoints = {0x81, 0x83}, | |
367 | .outdat_endpoints = {0x01, 0x03}, | |
368 | .inack_endpoints = {0x85, 0x86}, | |
369 | .outcont_endpoints = {0x05, 0x06}, | |
370 | .instat_endpoint = 0x87, | |
0ca1268e | 371 | .indat_endpoint = -1, |
1da177e4 LT |
372 | .glocont_endpoint = 0x07, |
373 | .calculate_baud_rate = keyspan_usa19w_calc_baud, | |
374 | .baudclk = KEYSPAN_USA28X_BAUDCLK, | |
375 | }; | |
376 | ||
0ca1268e LM |
377 | static const struct keyspan_device_details usa28xg_device_details = { |
378 | .product_id = keyspan_usa28xg_product_id, | |
379 | .msg_format = msg_usa67, | |
380 | .num_ports = 2, | |
381 | .indat_endp_flip = 0, | |
382 | .outdat_endp_flip = 0, | |
383 | .indat_endpoints = {0x84, 0x88}, | |
384 | .outdat_endpoints = {0x02, 0x06}, | |
385 | .inack_endpoints = {-1, -1}, | |
386 | .outcont_endpoints = {-1, -1}, | |
387 | .instat_endpoint = 0x81, | |
388 | .indat_endpoint = -1, | |
389 | .glocont_endpoint = 0x01, | |
390 | .calculate_baud_rate = keyspan_usa19w_calc_baud, | |
391 | .baudclk = KEYSPAN_USA28X_BAUDCLK, | |
392 | }; | |
1da177e4 LT |
393 | /* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */ |
394 | ||
395 | static const struct keyspan_device_details usa49w_device_details = { | |
396 | .product_id = keyspan_usa49w_product_id, | |
397 | .msg_format = msg_usa49, | |
398 | .num_ports = 4, | |
399 | .indat_endp_flip = 0, | |
400 | .outdat_endp_flip = 0, | |
401 | .indat_endpoints = {0x81, 0x82, 0x83, 0x84}, | |
402 | .outdat_endpoints = {0x01, 0x02, 0x03, 0x04}, | |
403 | .inack_endpoints = {-1, -1, -1, -1}, | |
404 | .outcont_endpoints = {-1, -1, -1, -1}, | |
405 | .instat_endpoint = 0x87, | |
0ca1268e | 406 | .indat_endpoint = -1, |
1da177e4 LT |
407 | .glocont_endpoint = 0x07, |
408 | .calculate_baud_rate = keyspan_usa19w_calc_baud, | |
409 | .baudclk = KEYSPAN_USA49W_BAUDCLK, | |
410 | }; | |
411 | ||
412 | static const struct keyspan_device_details usa49wlc_device_details = { | |
413 | .product_id = keyspan_usa49wlc_product_id, | |
414 | .msg_format = msg_usa49, | |
415 | .num_ports = 4, | |
416 | .indat_endp_flip = 0, | |
417 | .outdat_endp_flip = 0, | |
418 | .indat_endpoints = {0x81, 0x82, 0x83, 0x84}, | |
419 | .outdat_endpoints = {0x01, 0x02, 0x03, 0x04}, | |
420 | .inack_endpoints = {-1, -1, -1, -1}, | |
421 | .outcont_endpoints = {-1, -1, -1, -1}, | |
422 | .instat_endpoint = 0x87, | |
0ca1268e | 423 | .indat_endpoint = -1, |
1da177e4 LT |
424 | .glocont_endpoint = 0x07, |
425 | .calculate_baud_rate = keyspan_usa19w_calc_baud, | |
426 | .baudclk = KEYSPAN_USA19W_BAUDCLK, | |
427 | }; | |
428 | ||
0ca1268e LM |
429 | static const struct keyspan_device_details usa49wg_device_details = { |
430 | .product_id = keyspan_usa49wg_product_id, | |
431 | .msg_format = msg_usa49, | |
432 | .num_ports = 4, | |
433 | .indat_endp_flip = 0, | |
434 | .outdat_endp_flip = 0, | |
435 | .indat_endpoints = {-1, -1, -1, -1}, /* single 'global' data in EP */ | |
436 | .outdat_endpoints = {0x01, 0x02, 0x04, 0x06}, | |
437 | .inack_endpoints = {-1, -1, -1, -1}, | |
438 | .outcont_endpoints = {-1, -1, -1, -1}, | |
439 | .instat_endpoint = 0x81, | |
440 | .indat_endpoint = 0x88, | |
441 | .glocont_endpoint = 0x00, /* uses control EP */ | |
442 | .calculate_baud_rate = keyspan_usa19w_calc_baud, | |
443 | .baudclk = KEYSPAN_USA19W_BAUDCLK, | |
444 | }; | |
445 | ||
1da177e4 LT |
446 | static const struct keyspan_device_details *keyspan_devices[] = { |
447 | &usa18x_device_details, | |
448 | &usa19_device_details, | |
449 | &usa19qi_device_details, | |
450 | &mpr_device_details, | |
451 | &usa19qw_device_details, | |
452 | &usa19w_device_details, | |
453 | &usa19hs_device_details, | |
454 | &usa28_device_details, | |
455 | &usa28x_device_details, | |
456 | &usa28xa_device_details, | |
0ca1268e | 457 | &usa28xg_device_details, |
1da177e4 LT |
458 | /* 28xb not required as it renumerates as a 28x */ |
459 | &usa49w_device_details, | |
460 | &usa49wlc_device_details, | |
0ca1268e | 461 | &usa49wg_device_details, |
1da177e4 LT |
462 | NULL, |
463 | }; | |
464 | ||
7d40d7e8 | 465 | static const struct usb_device_id keyspan_ids_combined[] = { |
1da177e4 LT |
466 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) }, |
467 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) }, | |
468 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) }, | |
469 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) }, | |
470 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) }, | |
471 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) }, | |
472 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) }, | |
473 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) }, | |
474 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) }, | |
475 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) }, | |
476 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) }, | |
477 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) }, | |
478 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) }, | |
479 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) }, | |
480 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) }, | |
481 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) }, | |
482 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) }, | |
483 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) }, | |
484 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) }, | |
485 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) }, | |
486 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) }, | |
487 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) }, | |
0ca1268e | 488 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xg_product_id) }, |
1da177e4 LT |
489 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id)}, |
490 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)}, | |
0ca1268e | 491 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wg_product_id)}, |
1da177e4 LT |
492 | { } /* Terminating entry */ |
493 | }; | |
494 | ||
495 | MODULE_DEVICE_TABLE(usb, keyspan_ids_combined); | |
496 | ||
1da177e4 | 497 | /* usb_device_id table for the pre-firmware download keyspan devices */ |
7d40d7e8 | 498 | static const struct usb_device_id keyspan_pre_ids[] = { |
1da177e4 LT |
499 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) }, |
500 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) }, | |
501 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) }, | |
502 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) }, | |
503 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) }, | |
504 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) }, | |
505 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) }, | |
506 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) }, | |
507 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) }, | |
508 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) }, | |
509 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) }, | |
510 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) }, | |
511 | { } /* Terminating entry */ | |
512 | }; | |
513 | ||
7d40d7e8 | 514 | static const struct usb_device_id keyspan_1port_ids[] = { |
1da177e4 LT |
515 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) }, |
516 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) }, | |
517 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) }, | |
518 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) }, | |
519 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) }, | |
520 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) }, | |
521 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) }, | |
522 | { } /* Terminating entry */ | |
523 | }; | |
524 | ||
7d40d7e8 | 525 | static const struct usb_device_id keyspan_2port_ids[] = { |
1da177e4 LT |
526 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) }, |
527 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) }, | |
528 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) }, | |
0ca1268e | 529 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xg_product_id) }, |
1da177e4 LT |
530 | { } /* Terminating entry */ |
531 | }; | |
532 | ||
7d40d7e8 | 533 | static const struct usb_device_id keyspan_4port_ids[] = { |
1da177e4 LT |
534 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id) }, |
535 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)}, | |
0ca1268e | 536 | { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wg_product_id)}, |
1da177e4 LT |
537 | { } /* Terminating entry */ |
538 | }; | |
539 | ||
540 | /* Structs for the devices, pre and post renumeration. */ | |
ea65370d | 541 | static struct usb_serial_driver keyspan_pre_device = { |
18fcac35 GKH |
542 | .driver = { |
543 | .owner = THIS_MODULE, | |
269bda1c | 544 | .name = "keyspan_no_firm", |
18fcac35 | 545 | }, |
269bda1c | 546 | .description = "Keyspan - (without firmware)", |
1da177e4 | 547 | .id_table = keyspan_pre_ids, |
1da177e4 LT |
548 | .num_ports = 1, |
549 | .attach = keyspan_fake_startup, | |
550 | }; | |
551 | ||
ea65370d | 552 | static struct usb_serial_driver keyspan_1port_device = { |
18fcac35 GKH |
553 | .driver = { |
554 | .owner = THIS_MODULE, | |
269bda1c | 555 | .name = "keyspan_1", |
18fcac35 | 556 | }, |
269bda1c | 557 | .description = "Keyspan 1 port adapter", |
1da177e4 | 558 | .id_table = keyspan_1port_ids, |
1da177e4 LT |
559 | .num_ports = 1, |
560 | .open = keyspan_open, | |
561 | .close = keyspan_close, | |
335f8514 | 562 | .dtr_rts = keyspan_dtr_rts, |
1da177e4 LT |
563 | .write = keyspan_write, |
564 | .write_room = keyspan_write_room, | |
1da177e4 LT |
565 | .set_termios = keyspan_set_termios, |
566 | .break_ctl = keyspan_break_ctl, | |
567 | .tiocmget = keyspan_tiocmget, | |
568 | .tiocmset = keyspan_tiocmset, | |
569 | .attach = keyspan_startup, | |
f9c99bb8 AS |
570 | .disconnect = keyspan_disconnect, |
571 | .release = keyspan_release, | |
f79b2d0f JH |
572 | .port_probe = keyspan_port_probe, |
573 | .port_remove = keyspan_port_remove, | |
1da177e4 LT |
574 | }; |
575 | ||
ea65370d | 576 | static struct usb_serial_driver keyspan_2port_device = { |
18fcac35 GKH |
577 | .driver = { |
578 | .owner = THIS_MODULE, | |
269bda1c | 579 | .name = "keyspan_2", |
18fcac35 | 580 | }, |
269bda1c | 581 | .description = "Keyspan 2 port adapter", |
1da177e4 | 582 | .id_table = keyspan_2port_ids, |
1da177e4 LT |
583 | .num_ports = 2, |
584 | .open = keyspan_open, | |
585 | .close = keyspan_close, | |
335f8514 | 586 | .dtr_rts = keyspan_dtr_rts, |
1da177e4 LT |
587 | .write = keyspan_write, |
588 | .write_room = keyspan_write_room, | |
1da177e4 LT |
589 | .set_termios = keyspan_set_termios, |
590 | .break_ctl = keyspan_break_ctl, | |
591 | .tiocmget = keyspan_tiocmget, | |
592 | .tiocmset = keyspan_tiocmset, | |
593 | .attach = keyspan_startup, | |
f9c99bb8 AS |
594 | .disconnect = keyspan_disconnect, |
595 | .release = keyspan_release, | |
f79b2d0f JH |
596 | .port_probe = keyspan_port_probe, |
597 | .port_remove = keyspan_port_remove, | |
1da177e4 LT |
598 | }; |
599 | ||
ea65370d | 600 | static struct usb_serial_driver keyspan_4port_device = { |
18fcac35 GKH |
601 | .driver = { |
602 | .owner = THIS_MODULE, | |
269bda1c | 603 | .name = "keyspan_4", |
18fcac35 | 604 | }, |
269bda1c | 605 | .description = "Keyspan 4 port adapter", |
1da177e4 | 606 | .id_table = keyspan_4port_ids, |
1da177e4 LT |
607 | .num_ports = 4, |
608 | .open = keyspan_open, | |
609 | .close = keyspan_close, | |
335f8514 | 610 | .dtr_rts = keyspan_dtr_rts, |
1da177e4 LT |
611 | .write = keyspan_write, |
612 | .write_room = keyspan_write_room, | |
1da177e4 LT |
613 | .set_termios = keyspan_set_termios, |
614 | .break_ctl = keyspan_break_ctl, | |
615 | .tiocmget = keyspan_tiocmget, | |
616 | .tiocmset = keyspan_tiocmset, | |
617 | .attach = keyspan_startup, | |
f9c99bb8 AS |
618 | .disconnect = keyspan_disconnect, |
619 | .release = keyspan_release, | |
f79b2d0f JH |
620 | .port_probe = keyspan_port_probe, |
621 | .port_remove = keyspan_port_remove, | |
1da177e4 LT |
622 | }; |
623 | ||
4d2a7aff AS |
624 | static struct usb_serial_driver * const serial_drivers[] = { |
625 | &keyspan_pre_device, &keyspan_1port_device, | |
626 | &keyspan_2port_device, &keyspan_4port_device, NULL | |
627 | }; | |
628 | ||
1da177e4 | 629 | #endif |