keyspan.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /*
  2. Keyspan USB to Serial Converter driver
  3. (C) Copyright (C) 2000-2001
  4. Hugh Blemings <hugh@blemings.org>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. See http://misc.nu/hugh/keyspan.html for more information.
  10. Code in this driver inspired by and in a number of places taken
  11. from Brian Warner's original Keyspan-PDA driver.
  12. This driver has been put together with the support of Innosys, Inc.
  13. and Keyspan, Inc the manufacturers of the Keyspan USB-serial products.
  14. Thanks Guys :)
  15. Thanks to Paulus for miscellaneous tidy ups, some largish chunks
  16. of much nicer and/or completely new code and (perhaps most uniquely)
  17. having the patience to sit down and explain why and where he'd changed
  18. stuff.
  19. Tip 'o the hat to IBM (and previously Linuxcare :) for supporting
  20. staff in their work on open source projects.
  21. See keyspan.c for update history.
  22. */
  23. #ifndef __LINUX_USB_SERIAL_KEYSPAN_H
  24. #define __LINUX_USB_SERIAL_KEYSPAN_H
  25. /* Function prototypes for Keyspan serial converter */
  26. static int keyspan_open (struct usb_serial_port *port,
  27. struct file *filp);
  28. static void keyspan_close (struct usb_serial_port *port,
  29. struct file *filp);
  30. static int keyspan_startup (struct usb_serial *serial);
  31. static void keyspan_shutdown (struct usb_serial *serial);
  32. static void keyspan_rx_throttle (struct usb_serial_port *port);
  33. static void keyspan_rx_unthrottle (struct usb_serial_port *port);
  34. static int keyspan_write_room (struct usb_serial_port *port);
  35. static int keyspan_write (struct usb_serial_port *port,
  36. const unsigned char *buf,
  37. int count);
  38. static void keyspan_send_setup (struct usb_serial_port *port,
  39. int reset_port);
  40. static int keyspan_chars_in_buffer (struct usb_serial_port *port);
  41. static int keyspan_ioctl (struct usb_serial_port *port,
  42. struct file *file,
  43. unsigned int cmd,
  44. unsigned long arg);
  45. static void keyspan_set_termios (struct usb_serial_port *port,
  46. struct termios *old);
  47. static void keyspan_break_ctl (struct usb_serial_port *port,
  48. int break_state);
  49. static int keyspan_tiocmget (struct usb_serial_port *port,
  50. struct file *file);
  51. static int keyspan_tiocmset (struct usb_serial_port *port,
  52. struct file *file, unsigned int set,
  53. unsigned int clear);
  54. static int keyspan_fake_startup (struct usb_serial *serial);
  55. static int keyspan_usa19_calc_baud (u32 baud_rate, u32 baudclk,
  56. u8 *rate_hi, u8 *rate_low,
  57. u8 *prescaler, int portnum);
  58. static int keyspan_usa19w_calc_baud (u32 baud_rate, u32 baudclk,
  59. u8 *rate_hi, u8 *rate_low,
  60. u8 *prescaler, int portnum);
  61. static int keyspan_usa28_calc_baud (u32 baud_rate, u32 baudclk,
  62. u8 *rate_hi, u8 *rate_low,
  63. u8 *prescaler, int portnum);
  64. static int keyspan_usa19hs_calc_baud (u32 baud_rate, u32 baudclk,
  65. u8 *rate_hi, u8 *rate_low,
  66. u8 *prescaler, int portnum);
  67. static int keyspan_usa28_send_setup (struct usb_serial *serial,
  68. struct usb_serial_port *port,
  69. int reset_port);
  70. static int keyspan_usa26_send_setup (struct usb_serial *serial,
  71. struct usb_serial_port *port,
  72. int reset_port);
  73. static int keyspan_usa49_send_setup (struct usb_serial *serial,
  74. struct usb_serial_port *port,
  75. int reset_port);
  76. static int keyspan_usa90_send_setup (struct usb_serial *serial,
  77. struct usb_serial_port *port,
  78. int reset_port);
  79. /* Struct used for firmware - increased size of data section
  80. to allow Keyspan's 'C' firmware struct to be used unmodified */
  81. struct ezusb_hex_record {
  82. __u16 address;
  83. __u8 data_size;
  84. __u8 data[64];
  85. };
  86. /* Conditionally include firmware images, if they aren't
  87. included create a null pointer instead. Current
  88. firmware images aren't optimised to remove duplicate
  89. addresses in the image itself. */
  90. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28
  91. #include "keyspan_usa28_fw.h"
  92. #else
  93. static const struct ezusb_hex_record *keyspan_usa28_firmware = NULL;
  94. #endif
  95. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28X
  96. #include "keyspan_usa28x_fw.h"
  97. #else
  98. static const struct ezusb_hex_record *keyspan_usa28x_firmware = NULL;
  99. #endif
  100. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28XA
  101. #include "keyspan_usa28xa_fw.h"
  102. #else
  103. static const struct ezusb_hex_record *keyspan_usa28xa_firmware = NULL;
  104. #endif
  105. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28XB
  106. #include "keyspan_usa28xb_fw.h"
  107. #else
  108. static const struct ezusb_hex_record *keyspan_usa28xb_firmware = NULL;
  109. #endif
  110. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19
  111. #include "keyspan_usa19_fw.h"
  112. #else
  113. static const struct ezusb_hex_record *keyspan_usa19_firmware = NULL;
  114. #endif
  115. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19QI
  116. #include "keyspan_usa19qi_fw.h"
  117. #else
  118. static const struct ezusb_hex_record *keyspan_usa19qi_firmware = NULL;
  119. #endif
  120. #ifdef CONFIG_USB_SERIAL_KEYSPAN_MPR
  121. #include "keyspan_mpr_fw.h"
  122. #else
  123. static const struct ezusb_hex_record *keyspan_mpr_firmware = NULL;
  124. #endif
  125. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19QW
  126. #include "keyspan_usa19qw_fw.h"
  127. #else
  128. static const struct ezusb_hex_record *keyspan_usa19qw_firmware = NULL;
  129. #endif
  130. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA18X
  131. #include "keyspan_usa18x_fw.h"
  132. #else
  133. static const struct ezusb_hex_record *keyspan_usa18x_firmware = NULL;
  134. #endif
  135. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19W
  136. #include "keyspan_usa19w_fw.h"
  137. #else
  138. static const struct ezusb_hex_record *keyspan_usa19w_firmware = NULL;
  139. #endif
  140. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA49W
  141. #include "keyspan_usa49w_fw.h"
  142. #else
  143. static const struct ezusb_hex_record *keyspan_usa49w_firmware = NULL;
  144. #endif
  145. #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA49WLC
  146. #include "keyspan_usa49wlc_fw.h"
  147. #else
  148. static const struct ezusb_hex_record *keyspan_usa49wlc_firmware = NULL;
  149. #endif
  150. /* Values used for baud rate calculation - device specific */
  151. #define KEYSPAN_INVALID_BAUD_RATE (-1)
  152. #define KEYSPAN_BAUD_RATE_OK (0)
  153. #define KEYSPAN_USA18X_BAUDCLK (12000000L) /* a guess */
  154. #define KEYSPAN_USA19_BAUDCLK (12000000L)
  155. #define KEYSPAN_USA19W_BAUDCLK (24000000L)
  156. #define KEYSPAN_USA19HS_BAUDCLK (14769231L)
  157. #define KEYSPAN_USA28_BAUDCLK (1843200L)
  158. #define KEYSPAN_USA28X_BAUDCLK (12000000L)
  159. #define KEYSPAN_USA49W_BAUDCLK (48000000L)
  160. /* Some constants used to characterise each device. */
  161. #define KEYSPAN_MAX_NUM_PORTS (4)
  162. #define KEYSPAN_MAX_FLIPS (2)
  163. /* Device info for the Keyspan serial converter, used
  164. by the overall usb-serial probe function */
  165. #define KEYSPAN_VENDOR_ID (0x06cd)
  166. /* Product IDs for the products supported, pre-renumeration */
  167. #define keyspan_usa18x_pre_product_id 0x0105
  168. #define keyspan_usa19_pre_product_id 0x0103
  169. #define keyspan_usa19qi_pre_product_id 0x010b
  170. #define keyspan_mpr_pre_product_id 0x011b
  171. #define keyspan_usa19qw_pre_product_id 0x0118
  172. #define keyspan_usa19w_pre_product_id 0x0106
  173. #define keyspan_usa28_pre_product_id 0x0101
  174. #define keyspan_usa28x_pre_product_id 0x0102
  175. #define keyspan_usa28xa_pre_product_id 0x0114
  176. #define keyspan_usa28xb_pre_product_id 0x0113
  177. #define keyspan_usa49w_pre_product_id 0x0109
  178. #define keyspan_usa49wlc_pre_product_id 0x011a
  179. /* Product IDs post-renumeration. Note that the 28x and 28xb
  180. have the same id's post-renumeration but behave identically
  181. so it's not an issue. */
  182. #define keyspan_usa18x_product_id 0x0112
  183. #define keyspan_usa19_product_id 0x0107
  184. #define keyspan_usa19qi_product_id 0x010c
  185. #define keyspan_usa19hs_product_id 0x0121
  186. #define keyspan_mpr_product_id 0x011c
  187. #define keyspan_usa19qw_product_id 0x0119
  188. #define keyspan_usa19w_product_id 0x0108
  189. #define keyspan_usa28_product_id 0x010f
  190. #define keyspan_usa28x_product_id 0x0110
  191. #define keyspan_usa28xa_product_id 0x0115
  192. #define keyspan_usa28xb_product_id 0x0110
  193. #define keyspan_usa49w_product_id 0x010a
  194. #define keyspan_usa49wlc_product_id 0x012a
  195. struct keyspan_device_details {
  196. /* product ID value */
  197. int product_id;
  198. enum {msg_usa26, msg_usa28, msg_usa49, msg_usa90} msg_format;
  199. /* Number of physical ports */
  200. int num_ports;
  201. /* 1 if endpoint flipping used on input, 0 if not */
  202. int indat_endp_flip;
  203. /* 1 if endpoint flipping used on output, 0 if not */
  204. int outdat_endp_flip;
  205. /* Table mapping input data endpoint IDs to physical
  206. port number and flip if used */
  207. int indat_endpoints[KEYSPAN_MAX_NUM_PORTS];
  208. /* Same for output endpoints */
  209. int outdat_endpoints[KEYSPAN_MAX_NUM_PORTS];
  210. /* Input acknowledge endpoints */
  211. int inack_endpoints[KEYSPAN_MAX_NUM_PORTS];
  212. /* Output control endpoints */
  213. int outcont_endpoints[KEYSPAN_MAX_NUM_PORTS];
  214. /* Endpoint used for input status */
  215. int instat_endpoint;
  216. /* Endpoint used for global control functions */
  217. int glocont_endpoint;
  218. int (*calculate_baud_rate) (u32 baud_rate, u32 baudclk,
  219. u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum);
  220. u32 baudclk;
  221. };
  222. /* Now for each device type we setup the device detail
  223. structure with the appropriate information (provided
  224. in Keyspan's documentation) */
  225. static const struct keyspan_device_details usa18x_device_details = {
  226. .product_id = keyspan_usa18x_product_id,
  227. .msg_format = msg_usa26,
  228. .num_ports = 1,
  229. .indat_endp_flip = 0,
  230. .outdat_endp_flip = 1,
  231. .indat_endpoints = {0x81},
  232. .outdat_endpoints = {0x01},
  233. .inack_endpoints = {0x85},
  234. .outcont_endpoints = {0x05},
  235. .instat_endpoint = 0x87,
  236. .glocont_endpoint = 0x07,
  237. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  238. .baudclk = KEYSPAN_USA18X_BAUDCLK,
  239. };
  240. static const struct keyspan_device_details usa19_device_details = {
  241. .product_id = keyspan_usa19_product_id,
  242. .msg_format = msg_usa28,
  243. .num_ports = 1,
  244. .indat_endp_flip = 1,
  245. .outdat_endp_flip = 1,
  246. .indat_endpoints = {0x81},
  247. .outdat_endpoints = {0x01},
  248. .inack_endpoints = {0x83},
  249. .outcont_endpoints = {0x03},
  250. .instat_endpoint = 0x84,
  251. .glocont_endpoint = -1,
  252. .calculate_baud_rate = keyspan_usa19_calc_baud,
  253. .baudclk = KEYSPAN_USA19_BAUDCLK,
  254. };
  255. static const struct keyspan_device_details usa19qi_device_details = {
  256. .product_id = keyspan_usa19qi_product_id,
  257. .msg_format = msg_usa28,
  258. .num_ports = 1,
  259. .indat_endp_flip = 1,
  260. .outdat_endp_flip = 1,
  261. .indat_endpoints = {0x81},
  262. .outdat_endpoints = {0x01},
  263. .inack_endpoints = {0x83},
  264. .outcont_endpoints = {0x03},
  265. .instat_endpoint = 0x84,
  266. .glocont_endpoint = -1,
  267. .calculate_baud_rate = keyspan_usa28_calc_baud,
  268. .baudclk = KEYSPAN_USA19_BAUDCLK,
  269. };
  270. static const struct keyspan_device_details mpr_device_details = {
  271. .product_id = keyspan_mpr_product_id,
  272. .msg_format = msg_usa28,
  273. .num_ports = 1,
  274. .indat_endp_flip = 1,
  275. .outdat_endp_flip = 1,
  276. .indat_endpoints = {0x81},
  277. .outdat_endpoints = {0x01},
  278. .inack_endpoints = {0x83},
  279. .outcont_endpoints = {0x03},
  280. .instat_endpoint = 0x84,
  281. .glocont_endpoint = -1,
  282. .calculate_baud_rate = keyspan_usa28_calc_baud,
  283. .baudclk = KEYSPAN_USA19_BAUDCLK,
  284. };
  285. static const struct keyspan_device_details usa19qw_device_details = {
  286. .product_id = keyspan_usa19qw_product_id,
  287. .msg_format = msg_usa26,
  288. .num_ports = 1,
  289. .indat_endp_flip = 0,
  290. .outdat_endp_flip = 1,
  291. .indat_endpoints = {0x81},
  292. .outdat_endpoints = {0x01},
  293. .inack_endpoints = {0x85},
  294. .outcont_endpoints = {0x05},
  295. .instat_endpoint = 0x87,
  296. .glocont_endpoint = 0x07,
  297. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  298. .baudclk = KEYSPAN_USA19W_BAUDCLK,
  299. };
  300. static const struct keyspan_device_details usa19w_device_details = {
  301. .product_id = keyspan_usa19w_product_id,
  302. .msg_format = msg_usa26,
  303. .num_ports = 1,
  304. .indat_endp_flip = 0,
  305. .outdat_endp_flip = 1,
  306. .indat_endpoints = {0x81},
  307. .outdat_endpoints = {0x01},
  308. .inack_endpoints = {0x85},
  309. .outcont_endpoints = {0x05},
  310. .instat_endpoint = 0x87,
  311. .glocont_endpoint = 0x07,
  312. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  313. .baudclk = KEYSPAN_USA19W_BAUDCLK,
  314. };
  315. static const struct keyspan_device_details usa19hs_device_details = {
  316. .product_id = keyspan_usa19hs_product_id,
  317. .msg_format = msg_usa90,
  318. .num_ports = 1,
  319. .indat_endp_flip = 0,
  320. .outdat_endp_flip = 0,
  321. .indat_endpoints = {0x81},
  322. .outdat_endpoints = {0x01},
  323. .inack_endpoints = {-1},
  324. .outcont_endpoints = {0x02},
  325. .instat_endpoint = 0x82,
  326. .glocont_endpoint = -1,
  327. .calculate_baud_rate = keyspan_usa19hs_calc_baud,
  328. .baudclk = KEYSPAN_USA19HS_BAUDCLK,
  329. };
  330. static const struct keyspan_device_details usa28_device_details = {
  331. .product_id = keyspan_usa28_product_id,
  332. .msg_format = msg_usa28,
  333. .num_ports = 2,
  334. .indat_endp_flip = 1,
  335. .outdat_endp_flip = 1,
  336. .indat_endpoints = {0x81, 0x83},
  337. .outdat_endpoints = {0x01, 0x03},
  338. .inack_endpoints = {0x85, 0x86},
  339. .outcont_endpoints = {0x05, 0x06},
  340. .instat_endpoint = 0x87,
  341. .glocont_endpoint = 0x07,
  342. .calculate_baud_rate = keyspan_usa28_calc_baud,
  343. .baudclk = KEYSPAN_USA28_BAUDCLK,
  344. };
  345. static const struct keyspan_device_details usa28x_device_details = {
  346. .product_id = keyspan_usa28x_product_id,
  347. .msg_format = msg_usa26,
  348. .num_ports = 2,
  349. .indat_endp_flip = 0,
  350. .outdat_endp_flip = 1,
  351. .indat_endpoints = {0x81, 0x83},
  352. .outdat_endpoints = {0x01, 0x03},
  353. .inack_endpoints = {0x85, 0x86},
  354. .outcont_endpoints = {0x05, 0x06},
  355. .instat_endpoint = 0x87,
  356. .glocont_endpoint = 0x07,
  357. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  358. .baudclk = KEYSPAN_USA28X_BAUDCLK,
  359. };
  360. static const struct keyspan_device_details usa28xa_device_details = {
  361. .product_id = keyspan_usa28xa_product_id,
  362. .msg_format = msg_usa26,
  363. .num_ports = 2,
  364. .indat_endp_flip = 0,
  365. .outdat_endp_flip = 1,
  366. .indat_endpoints = {0x81, 0x83},
  367. .outdat_endpoints = {0x01, 0x03},
  368. .inack_endpoints = {0x85, 0x86},
  369. .outcont_endpoints = {0x05, 0x06},
  370. .instat_endpoint = 0x87,
  371. .glocont_endpoint = 0x07,
  372. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  373. .baudclk = KEYSPAN_USA28X_BAUDCLK,
  374. };
  375. /* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */
  376. static const struct keyspan_device_details usa49w_device_details = {
  377. .product_id = keyspan_usa49w_product_id,
  378. .msg_format = msg_usa49,
  379. .num_ports = 4,
  380. .indat_endp_flip = 0,
  381. .outdat_endp_flip = 0,
  382. .indat_endpoints = {0x81, 0x82, 0x83, 0x84},
  383. .outdat_endpoints = {0x01, 0x02, 0x03, 0x04},
  384. .inack_endpoints = {-1, -1, -1, -1},
  385. .outcont_endpoints = {-1, -1, -1, -1},
  386. .instat_endpoint = 0x87,
  387. .glocont_endpoint = 0x07,
  388. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  389. .baudclk = KEYSPAN_USA49W_BAUDCLK,
  390. };
  391. static const struct keyspan_device_details usa49wlc_device_details = {
  392. .product_id = keyspan_usa49wlc_product_id,
  393. .msg_format = msg_usa49,
  394. .num_ports = 4,
  395. .indat_endp_flip = 0,
  396. .outdat_endp_flip = 0,
  397. .indat_endpoints = {0x81, 0x82, 0x83, 0x84},
  398. .outdat_endpoints = {0x01, 0x02, 0x03, 0x04},
  399. .inack_endpoints = {-1, -1, -1, -1},
  400. .outcont_endpoints = {-1, -1, -1, -1},
  401. .instat_endpoint = 0x87,
  402. .glocont_endpoint = 0x07,
  403. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  404. .baudclk = KEYSPAN_USA19W_BAUDCLK,
  405. };
  406. static const struct keyspan_device_details *keyspan_devices[] = {
  407. &usa18x_device_details,
  408. &usa19_device_details,
  409. &usa19qi_device_details,
  410. &mpr_device_details,
  411. &usa19qw_device_details,
  412. &usa19w_device_details,
  413. &usa19hs_device_details,
  414. &usa28_device_details,
  415. &usa28x_device_details,
  416. &usa28xa_device_details,
  417. /* 28xb not required as it renumerates as a 28x */
  418. &usa49w_device_details,
  419. &usa49wlc_device_details,
  420. NULL,
  421. };
  422. static struct usb_device_id keyspan_ids_combined[] = {
  423. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
  424. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
  425. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
  426. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
  427. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
  428. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
  429. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
  430. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
  431. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
  432. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
  433. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
  434. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) },
  435. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
  436. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
  437. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
  438. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
  439. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
  440. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
  441. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
  442. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
  443. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
  444. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
  445. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_product_id) },
  446. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id)},
  447. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
  448. { } /* Terminating entry */
  449. };
  450. MODULE_DEVICE_TABLE(usb, keyspan_ids_combined);
  451. static struct usb_driver keyspan_driver = {
  452. .owner = THIS_MODULE,
  453. .name = "keyspan",
  454. .probe = usb_serial_probe,
  455. .disconnect = usb_serial_disconnect,
  456. .id_table = keyspan_ids_combined,
  457. };
  458. /* usb_device_id table for the pre-firmware download keyspan devices */
  459. static struct usb_device_id keyspan_pre_ids[] = {
  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_usa19qi_pre_product_id) },
  463. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
  464. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_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. { } /* Terminating entry */
  473. };
  474. static struct usb_device_id keyspan_1port_ids[] = {
  475. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
  476. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
  477. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
  478. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
  479. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
  480. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
  481. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
  482. { } /* Terminating entry */
  483. };
  484. static struct usb_device_id keyspan_2port_ids[] = {
  485. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
  486. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
  487. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
  488. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_product_id) },
  489. { } /* Terminating entry */
  490. };
  491. static struct usb_device_id keyspan_4port_ids[] = {
  492. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id) },
  493. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
  494. { } /* Terminating entry */
  495. };
  496. /* Structs for the devices, pre and post renumeration. */
  497. static struct usb_serial_device_type keyspan_pre_device = {
  498. .owner = THIS_MODULE,
  499. .name = "Keyspan - (without firmware)",
  500. .short_name = "keyspan_no_firm",
  501. .id_table = keyspan_pre_ids,
  502. .num_interrupt_in = NUM_DONT_CARE,
  503. .num_bulk_in = NUM_DONT_CARE,
  504. .num_bulk_out = NUM_DONT_CARE,
  505. .num_ports = 1,
  506. .attach = keyspan_fake_startup,
  507. };
  508. static struct usb_serial_device_type keyspan_1port_device = {
  509. .owner = THIS_MODULE,
  510. .name = "Keyspan 1 port adapter",
  511. .short_name = "keyspan_1",
  512. .id_table = keyspan_1port_ids,
  513. .num_interrupt_in = NUM_DONT_CARE,
  514. .num_bulk_in = NUM_DONT_CARE,
  515. .num_bulk_out = NUM_DONT_CARE,
  516. .num_ports = 1,
  517. .open = keyspan_open,
  518. .close = keyspan_close,
  519. .write = keyspan_write,
  520. .write_room = keyspan_write_room,
  521. .chars_in_buffer = keyspan_chars_in_buffer,
  522. .throttle = keyspan_rx_throttle,
  523. .unthrottle = keyspan_rx_unthrottle,
  524. .ioctl = keyspan_ioctl,
  525. .set_termios = keyspan_set_termios,
  526. .break_ctl = keyspan_break_ctl,
  527. .tiocmget = keyspan_tiocmget,
  528. .tiocmset = keyspan_tiocmset,
  529. .attach = keyspan_startup,
  530. .shutdown = keyspan_shutdown,
  531. };
  532. static struct usb_serial_device_type keyspan_2port_device = {
  533. .owner = THIS_MODULE,
  534. .name = "Keyspan 2 port adapter",
  535. .short_name = "keyspan_2",
  536. .id_table = keyspan_2port_ids,
  537. .num_interrupt_in = NUM_DONT_CARE,
  538. .num_bulk_in = NUM_DONT_CARE,
  539. .num_bulk_out = NUM_DONT_CARE,
  540. .num_ports = 2,
  541. .open = keyspan_open,
  542. .close = keyspan_close,
  543. .write = keyspan_write,
  544. .write_room = keyspan_write_room,
  545. .chars_in_buffer = keyspan_chars_in_buffer,
  546. .throttle = keyspan_rx_throttle,
  547. .unthrottle = keyspan_rx_unthrottle,
  548. .ioctl = keyspan_ioctl,
  549. .set_termios = keyspan_set_termios,
  550. .break_ctl = keyspan_break_ctl,
  551. .tiocmget = keyspan_tiocmget,
  552. .tiocmset = keyspan_tiocmset,
  553. .attach = keyspan_startup,
  554. .shutdown = keyspan_shutdown,
  555. };
  556. static struct usb_serial_device_type keyspan_4port_device = {
  557. .owner = THIS_MODULE,
  558. .name = "Keyspan 4 port adapter",
  559. .short_name = "keyspan_4",
  560. .id_table = keyspan_4port_ids,
  561. .num_interrupt_in = NUM_DONT_CARE,
  562. .num_bulk_in = 5,
  563. .num_bulk_out = 5,
  564. .num_ports = 4,
  565. .open = keyspan_open,
  566. .close = keyspan_close,
  567. .write = keyspan_write,
  568. .write_room = keyspan_write_room,
  569. .chars_in_buffer = keyspan_chars_in_buffer,
  570. .throttle = keyspan_rx_throttle,
  571. .unthrottle = keyspan_rx_unthrottle,
  572. .ioctl = keyspan_ioctl,
  573. .set_termios = keyspan_set_termios,
  574. .break_ctl = keyspan_break_ctl,
  575. .tiocmget = keyspan_tiocmget,
  576. .tiocmset = keyspan_tiocmset,
  577. .attach = keyspan_startup,
  578. .shutdown = keyspan_shutdown,
  579. };
  580. #endif