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