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