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