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