11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * Definitions for MCT (Magic Control Technology) USB-RS232 Converter Driver 31da177e4SLinus Torvalds * 41da177e4SLinus Torvalds * Copyright (C) 2000 Wolfgang Grandegger (wolfgang@ces.ch) 51da177e4SLinus Torvalds * 61da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify 71da177e4SLinus Torvalds * it under the terms of the GNU General Public License as published by 81da177e4SLinus Torvalds * the Free Software Foundation; either version 2 of the License, or 91da177e4SLinus Torvalds * (at your option) any later version. 101da177e4SLinus Torvalds * 111da177e4SLinus Torvalds * This driver is for the device MCT USB-RS232 Converter (25 pin, Model No. 121da177e4SLinus Torvalds * U232-P25) from Magic Control Technology Corp. (there is also a 9 pin 131da177e4SLinus Torvalds * Model No. U232-P9). See http://www.mct.com.tw/p_u232.html for further 141da177e4SLinus Torvalds * information. The properties of this device are listed at the end of this 151da177e4SLinus Torvalds * file. This device is available from various distributors. I know Hana, 161da177e4SLinus Torvalds * http://www.hana.de and D-Link, http://www.dlink.com/products/usb/dsbs25. 171da177e4SLinus Torvalds * 181da177e4SLinus Torvalds * All of the information about the device was acquired by using SniffUSB 191da177e4SLinus Torvalds * on Windows98. The technical details of the reverse engineering are 201da177e4SLinus Torvalds * summarized at the end of this file. 211da177e4SLinus Torvalds */ 221da177e4SLinus Torvalds 231da177e4SLinus Torvalds #ifndef __LINUX_USB_SERIAL_MCT_U232_H 241da177e4SLinus Torvalds #define __LINUX_USB_SERIAL_MCT_U232_H 251da177e4SLinus Torvalds 261da177e4SLinus Torvalds #define MCT_U232_VID 0x0711 /* Vendor Id */ 271da177e4SLinus Torvalds #define MCT_U232_PID 0x0210 /* Original MCT Product Id */ 281da177e4SLinus Torvalds 291da177e4SLinus Torvalds /* U232-P25, Sitecom */ 301da177e4SLinus Torvalds #define MCT_U232_SITECOM_PID 0x0230 /* Sitecom Product Id */ 311da177e4SLinus Torvalds 321da177e4SLinus Torvalds /* DU-H3SP USB BAY hub */ 331da177e4SLinus Torvalds #define MCT_U232_DU_H3SP_PID 0x0200 /* D-Link DU-H3SP USB BAY */ 341da177e4SLinus Torvalds 351da177e4SLinus Torvalds /* Belkin badge the MCT U232-P9 as the F5U109 */ 361da177e4SLinus Torvalds #define MCT_U232_BELKIN_F5U109_VID 0x050d /* Vendor Id */ 371da177e4SLinus Torvalds #define MCT_U232_BELKIN_F5U109_PID 0x0109 /* Product Id */ 381da177e4SLinus Torvalds 391da177e4SLinus Torvalds /* 401da177e4SLinus Torvalds * Vendor Request Interface 411da177e4SLinus Torvalds */ 421da177e4SLinus Torvalds #define MCT_U232_SET_REQUEST_TYPE 0x40 431da177e4SLinus Torvalds #define MCT_U232_GET_REQUEST_TYPE 0xc0 441da177e4SLinus Torvalds 451da177e4SLinus Torvalds #define MCT_U232_GET_MODEM_STAT_REQUEST 2 /* Get Modem Status Register (MSR) */ 461da177e4SLinus Torvalds #define MCT_U232_GET_MODEM_STAT_SIZE 1 471da177e4SLinus Torvalds 481da177e4SLinus Torvalds #define MCT_U232_GET_LINE_CTRL_REQUEST 6 /* Get Line Control Register (LCR) */ 491da177e4SLinus Torvalds #define MCT_U232_GET_LINE_CTRL_SIZE 1 /* ... not used by this driver */ 501da177e4SLinus Torvalds 511da177e4SLinus Torvalds #define MCT_U232_SET_BAUD_RATE_REQUEST 5 /* Set Baud Rate Divisor */ 521da177e4SLinus Torvalds #define MCT_U232_SET_BAUD_RATE_SIZE 4 531da177e4SLinus Torvalds 541da177e4SLinus Torvalds #define MCT_U232_SET_LINE_CTRL_REQUEST 7 /* Set Line Control Register (LCR) */ 551da177e4SLinus Torvalds #define MCT_U232_SET_LINE_CTRL_SIZE 1 561da177e4SLinus Torvalds 571da177e4SLinus Torvalds #define MCT_U232_SET_MODEM_CTRL_REQUEST 10 /* Set Modem Control Register (MCR) */ 581da177e4SLinus Torvalds #define MCT_U232_SET_MODEM_CTRL_SIZE 1 591da177e4SLinus Torvalds 601da177e4SLinus Torvalds /* This USB device request code is not well understood. It is transmitted by 611da177e4SLinus Torvalds the MCT-supplied Windows driver whenever the baud rate changes. 621da177e4SLinus Torvalds */ 631da177e4SLinus Torvalds #define MCT_U232_SET_UNKNOWN1_REQUEST 11 /* Unknown functionality */ 641da177e4SLinus Torvalds #define MCT_U232_SET_UNKNOWN1_SIZE 1 651da177e4SLinus Torvalds 6645b844dfSDave Platt /* This USB device request code appears to control whether CTS is required 6745b844dfSDave Platt during transmission. 681da177e4SLinus Torvalds 6945b844dfSDave Platt Sending a zero byte allows data transmission to a device which is not 7045b844dfSDave Platt asserting CTS. Sending a '1' byte will cause transmission to be deferred 7145b844dfSDave Platt until the device asserts CTS. 721da177e4SLinus Torvalds */ 7345b844dfSDave Platt #define MCT_U232_SET_CTS_REQUEST 12 7445b844dfSDave Platt #define MCT_U232_SET_CTS_SIZE 1 751da177e4SLinus Torvalds 761da177e4SLinus Torvalds /* 771da177e4SLinus Torvalds * Baud rate (divisor) 781da177e4SLinus Torvalds * Actually, there are two of them, MCT website calls them "Philips solution" 791da177e4SLinus Torvalds * and "Intel solution". They are the regular MCT and "Sitecom" for us. 801da177e4SLinus Torvalds * This is pointless to document in the header, see the code for the bits. 811da177e4SLinus Torvalds */ 821da177e4SLinus Torvalds static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value); 831da177e4SLinus Torvalds 841da177e4SLinus Torvalds /* 851da177e4SLinus Torvalds * Line Control Register (LCR) 861da177e4SLinus Torvalds */ 871da177e4SLinus Torvalds #define MCT_U232_SET_BREAK 0x40 881da177e4SLinus Torvalds 891da177e4SLinus Torvalds #define MCT_U232_PARITY_SPACE 0x38 901da177e4SLinus Torvalds #define MCT_U232_PARITY_MARK 0x28 911da177e4SLinus Torvalds #define MCT_U232_PARITY_EVEN 0x18 921da177e4SLinus Torvalds #define MCT_U232_PARITY_ODD 0x08 931da177e4SLinus Torvalds #define MCT_U232_PARITY_NONE 0x00 941da177e4SLinus Torvalds 951da177e4SLinus Torvalds #define MCT_U232_DATA_BITS_5 0x00 961da177e4SLinus Torvalds #define MCT_U232_DATA_BITS_6 0x01 971da177e4SLinus Torvalds #define MCT_U232_DATA_BITS_7 0x02 981da177e4SLinus Torvalds #define MCT_U232_DATA_BITS_8 0x03 991da177e4SLinus Torvalds 1001da177e4SLinus Torvalds #define MCT_U232_STOP_BITS_2 0x04 1011da177e4SLinus Torvalds #define MCT_U232_STOP_BITS_1 0x00 1021da177e4SLinus Torvalds 1031da177e4SLinus Torvalds /* 1041da177e4SLinus Torvalds * Modem Control Register (MCR) 1051da177e4SLinus Torvalds */ 1061da177e4SLinus Torvalds #define MCT_U232_MCR_NONE 0x8 /* Deactivate DTR and RTS */ 1071da177e4SLinus Torvalds #define MCT_U232_MCR_RTS 0xa /* Activate RTS */ 1081da177e4SLinus Torvalds #define MCT_U232_MCR_DTR 0x9 /* Activate DTR */ 1091da177e4SLinus Torvalds 1101da177e4SLinus Torvalds /* 1111da177e4SLinus Torvalds * Modem Status Register (MSR) 1121da177e4SLinus Torvalds */ 1131da177e4SLinus Torvalds #define MCT_U232_MSR_INDEX 0x0 /* data[index] */ 1141da177e4SLinus Torvalds #define MCT_U232_MSR_CD 0x80 /* Current CD */ 1151da177e4SLinus Torvalds #define MCT_U232_MSR_RI 0x40 /* Current RI */ 1161da177e4SLinus Torvalds #define MCT_U232_MSR_DSR 0x20 /* Current DSR */ 1171da177e4SLinus Torvalds #define MCT_U232_MSR_CTS 0x10 /* Current CTS */ 1181da177e4SLinus Torvalds #define MCT_U232_MSR_DCD 0x08 /* Delta CD */ 1191da177e4SLinus Torvalds #define MCT_U232_MSR_DRI 0x04 /* Delta RI */ 1201da177e4SLinus Torvalds #define MCT_U232_MSR_DDSR 0x02 /* Delta DSR */ 1211da177e4SLinus Torvalds #define MCT_U232_MSR_DCTS 0x01 /* Delta CTS */ 1221da177e4SLinus Torvalds 1231da177e4SLinus Torvalds /* 1241da177e4SLinus Torvalds * Line Status Register (LSR) 1251da177e4SLinus Torvalds */ 1261da177e4SLinus Torvalds #define MCT_U232_LSR_INDEX 1 /* data[index] */ 1271da177e4SLinus Torvalds #define MCT_U232_LSR_ERR 0x80 /* OE | PE | FE | BI */ 1281da177e4SLinus Torvalds #define MCT_U232_LSR_TEMT 0x40 /* transmit register empty */ 1291da177e4SLinus Torvalds #define MCT_U232_LSR_THRE 0x20 /* transmit holding register empty */ 1301da177e4SLinus Torvalds #define MCT_U232_LSR_BI 0x10 /* break indicator */ 1311da177e4SLinus Torvalds #define MCT_U232_LSR_FE 0x08 /* framing error */ 1321da177e4SLinus Torvalds #define MCT_U232_LSR_OE 0x02 /* overrun error */ 1331da177e4SLinus Torvalds #define MCT_U232_LSR_PE 0x04 /* parity error */ 1341da177e4SLinus Torvalds #define MCT_U232_LSR_OE 0x02 /* overrun error */ 1351da177e4SLinus Torvalds #define MCT_U232_LSR_DR 0x01 /* receive data ready */ 1361da177e4SLinus Torvalds 1371da177e4SLinus Torvalds 1381da177e4SLinus Torvalds /* ----------------------------------------------------------------------------- 1391da177e4SLinus Torvalds * Technical Specification reverse engineered with SniffUSB on Windows98 1401da177e4SLinus Torvalds * ===================================================================== 1411da177e4SLinus Torvalds * 1421da177e4SLinus Torvalds * The technical details of the device have been acquired be using "SniffUSB" 1431da177e4SLinus Torvalds * and the vendor-supplied device driver (version 2.3A) under Windows98. To 1441da177e4SLinus Torvalds * identify the USB vendor-specific requests and to assign them to terminal 1451da177e4SLinus Torvalds * settings (flow control, baud rate, etc.) the program "SerialSettings" from 1461da177e4SLinus Torvalds * William G. Greathouse has been proven to be very useful. I also used the 1471da177e4SLinus Torvalds * Win98 "HyperTerminal" and "usb-robot" on Linux for testing. The results and 1481da177e4SLinus Torvalds * observations are summarized below: 1491da177e4SLinus Torvalds * 1501da177e4SLinus Torvalds * The USB requests seem to be directly mapped to the registers of a 8250, 1511da177e4SLinus Torvalds * 16450 or 16550 UART. The FreeBSD handbook (appendix F.4 "Input/Output 1521da177e4SLinus Torvalds * devices") contains a comprehensive description of UARTs and its registers. 1531da177e4SLinus Torvalds * The bit descriptions are actually taken from there. 1541da177e4SLinus Torvalds * 1551da177e4SLinus Torvalds * 1561da177e4SLinus Torvalds * Baud rate (divisor) 1571da177e4SLinus Torvalds * ------------------- 1581da177e4SLinus Torvalds * 1591da177e4SLinus Torvalds * BmRequestType: 0x40 (0100 0000B) 1601da177e4SLinus Torvalds * bRequest: 0x05 1611da177e4SLinus Torvalds * wValue: 0x0000 1621da177e4SLinus Torvalds * wIndex: 0x0000 1631da177e4SLinus Torvalds * wLength: 0x0004 1641da177e4SLinus Torvalds * Data: divisor = 115200 / baud_rate 1651da177e4SLinus Torvalds * 1661da177e4SLinus Torvalds * SniffUSB observations (Nov 2003): Contrary to the 'wLength' value of 4 1671da177e4SLinus Torvalds * shown above, observations with a Belkin F5U109 adapter, using the 1681da177e4SLinus Torvalds * MCT-supplied Windows98 driver (U2SPORT.VXD, "File version: 1.21P.0104 for 1691da177e4SLinus Torvalds * Win98/Me"), show this request has a length of 1 byte, presumably because 1701da177e4SLinus Torvalds * of the fact that the Belkin adapter and the 'Sitecom U232-P25' adapter 1711da177e4SLinus Torvalds * use a baud-rate code instead of a conventional RS-232 baud rate divisor. 1721da177e4SLinus Torvalds * The current source code for this driver does not reflect this fact, but 1731da177e4SLinus Torvalds * the driver works fine with this adapter/driver combination nonetheless. 1741da177e4SLinus Torvalds * 1751da177e4SLinus Torvalds * 1761da177e4SLinus Torvalds * Line Control Register (LCR) 1771da177e4SLinus Torvalds * --------------------------- 1781da177e4SLinus Torvalds * 1791da177e4SLinus Torvalds * BmRequestType: 0x40 (0100 0000B) 0xc0 (1100 0000B) 1801da177e4SLinus Torvalds * bRequest: 0x07 0x06 1811da177e4SLinus Torvalds * wValue: 0x0000 1821da177e4SLinus Torvalds * wIndex: 0x0000 1831da177e4SLinus Torvalds * wLength: 0x0001 1841da177e4SLinus Torvalds * Data: LCR (see below) 1851da177e4SLinus Torvalds * 1861da177e4SLinus Torvalds * Bit 7: Divisor Latch Access Bit (DLAB). When set, access to the data 1871da177e4SLinus Torvalds * transmit/receive register (THR/RBR) and the Interrupt Enable Register 1881da177e4SLinus Torvalds * (IER) is disabled. Any access to these ports is now redirected to the 1891da177e4SLinus Torvalds * Divisor Latch Registers. Setting this bit, loading the Divisor 1901da177e4SLinus Torvalds * Registers, and clearing DLAB should be done with interrupts disabled. 1911da177e4SLinus Torvalds * Bit 6: Set Break. When set to "1", the transmitter begins to transmit 1921da177e4SLinus Torvalds * continuous Spacing until this bit is set to "0". This overrides any 1931da177e4SLinus Torvalds * bits of characters that are being transmitted. 1941da177e4SLinus Torvalds * Bit 5: Stick Parity. When parity is enabled, setting this bit causes parity 1951da177e4SLinus Torvalds * to always be "1" or "0", based on the value of Bit 4. 1961da177e4SLinus Torvalds * Bit 4: Even Parity Select (EPS). When parity is enabled and Bit 5 is "0", 1971da177e4SLinus Torvalds * setting this bit causes even parity to be transmitted and expected. 1981da177e4SLinus Torvalds * Otherwise, odd parity is used. 1991da177e4SLinus Torvalds * Bit 3: Parity Enable (PEN). When set to "1", a parity bit is inserted 2001da177e4SLinus Torvalds * between the last bit of the data and the Stop Bit. The UART will also 2011da177e4SLinus Torvalds * expect parity to be present in the received data. 2021da177e4SLinus Torvalds * Bit 2: Number of Stop Bits (STB). If set to "1" and using 5-bit data words, 2031da177e4SLinus Torvalds * 1.5 Stop Bits are transmitted and expected in each data word. For 2041da177e4SLinus Torvalds * 6, 7 and 8-bit data words, 2 Stop Bits are transmitted and expected. 2051da177e4SLinus Torvalds * When this bit is set to "0", one Stop Bit is used on each data word. 2061da177e4SLinus Torvalds * Bit 1: Word Length Select Bit #1 (WLSB1) 2071da177e4SLinus Torvalds * Bit 0: Word Length Select Bit #0 (WLSB0) 2081da177e4SLinus Torvalds * Together these bits specify the number of bits in each data word. 2091da177e4SLinus Torvalds * 1 0 Word Length 2101da177e4SLinus Torvalds * 0 0 5 Data Bits 2111da177e4SLinus Torvalds * 0 1 6 Data Bits 2121da177e4SLinus Torvalds * 1 0 7 Data Bits 2131da177e4SLinus Torvalds * 1 1 8 Data Bits 2141da177e4SLinus Torvalds * 2151da177e4SLinus Torvalds * SniffUSB observations: Bit 7 seems not to be used. There seem to be two bugs 2161da177e4SLinus Torvalds * in the Win98 driver: the break does not work (bit 6 is not asserted) and the 2171da177e4SLinus Torvalds * stick parity bit is not cleared when set once. The LCR can also be read 2181da177e4SLinus Torvalds * back with USB request 6 but this has never been observed with SniffUSB. 2191da177e4SLinus Torvalds * 2201da177e4SLinus Torvalds * 2211da177e4SLinus Torvalds * Modem Control Register (MCR) 2221da177e4SLinus Torvalds * ---------------------------- 2231da177e4SLinus Torvalds * 2241da177e4SLinus Torvalds * BmRequestType: 0x40 (0100 0000B) 2251da177e4SLinus Torvalds * bRequest: 0x0a 2261da177e4SLinus Torvalds * wValue: 0x0000 2271da177e4SLinus Torvalds * wIndex: 0x0000 2281da177e4SLinus Torvalds * wLength: 0x0001 2291da177e4SLinus Torvalds * Data: MCR (Bit 4..7, see below) 2301da177e4SLinus Torvalds * 2311da177e4SLinus Torvalds * Bit 7: Reserved, always 0. 2321da177e4SLinus Torvalds * Bit 6: Reserved, always 0. 2331da177e4SLinus Torvalds * Bit 5: Reserved, always 0. 2341da177e4SLinus Torvalds * Bit 4: Loop-Back Enable. When set to "1", the UART transmitter and receiver 2351da177e4SLinus Torvalds * are internally connected together to allow diagnostic operations. In 2361da177e4SLinus Torvalds * addition, the UART modem control outputs are connected to the UART 2371da177e4SLinus Torvalds * modem control inputs. CTS is connected to RTS, DTR is connected to 2381da177e4SLinus Torvalds * DSR, OUT1 is connected to RI, and OUT 2 is connected to DCD. 2391da177e4SLinus Torvalds * Bit 3: OUT 2. An auxiliary output that the host processor may set high or 2401da177e4SLinus Torvalds * low. In the IBM PC serial adapter (and most clones), OUT 2 is used 2411da177e4SLinus Torvalds * to tri-state (disable) the interrupt signal from the 2421da177e4SLinus Torvalds * 8250/16450/16550 UART. 2431da177e4SLinus Torvalds * Bit 2: OUT 1. An auxiliary output that the host processor may set high or 2441da177e4SLinus Torvalds * low. This output is not used on the IBM PC serial adapter. 2451da177e4SLinus Torvalds * Bit 1: Request to Send (RTS). When set to "1", the output of the UART -RTS 2461da177e4SLinus Torvalds * line is Low (Active). 2471da177e4SLinus Torvalds * Bit 0: Data Terminal Ready (DTR). When set to "1", the output of the UART 2481da177e4SLinus Torvalds * -DTR line is Low (Active). 2491da177e4SLinus Torvalds * 2501da177e4SLinus Torvalds * SniffUSB observations: Bit 2 and 4 seem not to be used but bit 3 has been 2511da177e4SLinus Torvalds * seen _always_ set. 2521da177e4SLinus Torvalds * 2531da177e4SLinus Torvalds * 2541da177e4SLinus Torvalds * Modem Status Register (MSR) 2551da177e4SLinus Torvalds * --------------------------- 2561da177e4SLinus Torvalds * 2571da177e4SLinus Torvalds * BmRequestType: 0xc0 (1100 0000B) 2581da177e4SLinus Torvalds * bRequest: 0x02 2591da177e4SLinus Torvalds * wValue: 0x0000 2601da177e4SLinus Torvalds * wIndex: 0x0000 2611da177e4SLinus Torvalds * wLength: 0x0001 2621da177e4SLinus Torvalds * Data: MSR (see below) 2631da177e4SLinus Torvalds * 2641da177e4SLinus Torvalds * Bit 7: Data Carrier Detect (CD). Reflects the state of the DCD line on the 2651da177e4SLinus Torvalds * UART. 2661da177e4SLinus Torvalds * Bit 6: Ring Indicator (RI). Reflects the state of the RI line on the UART. 2671da177e4SLinus Torvalds * Bit 5: Data Set Ready (DSR). Reflects the state of the DSR line on the UART. 2681da177e4SLinus Torvalds * Bit 4: Clear To Send (CTS). Reflects the state of the CTS line on the UART. 2691da177e4SLinus Torvalds * Bit 3: Delta Data Carrier Detect (DDCD). Set to "1" if the -DCD line has 2701da177e4SLinus Torvalds * changed state one more more times since the last time the MSR was 2711da177e4SLinus Torvalds * read by the host. 2721da177e4SLinus Torvalds * Bit 2: Trailing Edge Ring Indicator (TERI). Set to "1" if the -RI line has 2731da177e4SLinus Torvalds * had a low to high transition since the last time the MSR was read by 2741da177e4SLinus Torvalds * the host. 2751da177e4SLinus Torvalds * Bit 1: Delta Data Set Ready (DDSR). Set to "1" if the -DSR line has changed 2761da177e4SLinus Torvalds * state one more more times since the last time the MSR was read by the 2771da177e4SLinus Torvalds * host. 2781da177e4SLinus Torvalds * Bit 0: Delta Clear To Send (DCTS). Set to "1" if the -CTS line has changed 2791da177e4SLinus Torvalds * state one more times since the last time the MSR was read by the 2801da177e4SLinus Torvalds * host. 2811da177e4SLinus Torvalds * 2821da177e4SLinus Torvalds * SniffUSB observations: the MSR is also returned as first byte on the 2831da177e4SLinus Torvalds * interrupt-in endpoint 0x83 to signal changes of modem status lines. The USB 2841da177e4SLinus Torvalds * request to read MSR cannot be applied during normal device operation. 2851da177e4SLinus Torvalds * 2861da177e4SLinus Torvalds * 2871da177e4SLinus Torvalds * Line Status Register (LSR) 2881da177e4SLinus Torvalds * -------------------------- 2891da177e4SLinus Torvalds * 2901da177e4SLinus Torvalds * Bit 7 Error in Receiver FIFO. On the 8250/16450 UART, this bit is zero. 2911da177e4SLinus Torvalds * This bit is set to "1" when any of the bytes in the FIFO have one or 2921da177e4SLinus Torvalds * more of the following error conditions: PE, FE, or BI. 2931da177e4SLinus Torvalds * Bit 6 Transmitter Empty (TEMT). When set to "1", there are no words 2941da177e4SLinus Torvalds * remaining in the transmit FIFO or the transmit shift register. The 2951da177e4SLinus Torvalds * transmitter is completely idle. 2961da177e4SLinus Torvalds * Bit 5 Transmitter Holding Register Empty (THRE). When set to "1", the FIFO 2971da177e4SLinus Torvalds * (or holding register) now has room for at least one additional word 2981da177e4SLinus Torvalds * to transmit. The transmitter may still be transmitting when this bit 2991da177e4SLinus Torvalds * is set to "1". 3001da177e4SLinus Torvalds * Bit 4 Break Interrupt (BI). The receiver has detected a Break signal. 3011da177e4SLinus Torvalds * Bit 3 Framing Error (FE). A Start Bit was detected but the Stop Bit did not 3021da177e4SLinus Torvalds * appear at the expected time. The received word is probably garbled. 3031da177e4SLinus Torvalds * Bit 2 Parity Error (PE). The parity bit was incorrect for the word received. 3041da177e4SLinus Torvalds * Bit 1 Overrun Error (OE). A new word was received and there was no room in 3051da177e4SLinus Torvalds * the receive buffer. The newly-arrived word in the shift register is 3061da177e4SLinus Torvalds * discarded. On 8250/16450 UARTs, the word in the holding register is 3071da177e4SLinus Torvalds * discarded and the newly- arrived word is put in the holding register. 3081da177e4SLinus Torvalds * Bit 0 Data Ready (DR). One or more words are in the receive FIFO that the 3091da177e4SLinus Torvalds * host may read. A word must be completely received and moved from the 3101da177e4SLinus Torvalds * shift register into the FIFO (or holding register for 8250/16450 3111da177e4SLinus Torvalds * designs) before this bit is set. 3121da177e4SLinus Torvalds * 3131da177e4SLinus Torvalds * SniffUSB observations: the LSR is returned as second byte on the interrupt-in 3141da177e4SLinus Torvalds * endpoint 0x83 to signal error conditions. Such errors have been seen with 3151da177e4SLinus Torvalds * minicom/zmodem transfers (CRC errors). 3161da177e4SLinus Torvalds * 3171da177e4SLinus Torvalds * 3181da177e4SLinus Torvalds * Unknown #1 3191da177e4SLinus Torvalds * ------------------- 3201da177e4SLinus Torvalds * 3211da177e4SLinus Torvalds * BmRequestType: 0x40 (0100 0000B) 3221da177e4SLinus Torvalds * bRequest: 0x0b 3231da177e4SLinus Torvalds * wValue: 0x0000 3241da177e4SLinus Torvalds * wIndex: 0x0000 3251da177e4SLinus Torvalds * wLength: 0x0001 3261da177e4SLinus Torvalds * Data: 0x00 3271da177e4SLinus Torvalds * 3281da177e4SLinus Torvalds * SniffUSB observations (Nov 2003): With the MCT-supplied Windows98 driver 3291da177e4SLinus Torvalds * (U2SPORT.VXD, "File version: 1.21P.0104 for Win98/Me"), this request 3301da177e4SLinus Torvalds * occurs immediately after a "Baud rate (divisor)" message. It was not 3311da177e4SLinus Torvalds * observed at any other time. It is unclear what purpose this message 3321da177e4SLinus Torvalds * serves. 3331da177e4SLinus Torvalds * 3341da177e4SLinus Torvalds * 3351da177e4SLinus Torvalds * Unknown #2 3361da177e4SLinus Torvalds * ------------------- 3371da177e4SLinus Torvalds * 3381da177e4SLinus Torvalds * BmRequestType: 0x40 (0100 0000B) 3391da177e4SLinus Torvalds * bRequest: 0x0c 3401da177e4SLinus Torvalds * wValue: 0x0000 3411da177e4SLinus Torvalds * wIndex: 0x0000 3421da177e4SLinus Torvalds * wLength: 0x0001 3431da177e4SLinus Torvalds * Data: 0x00 3441da177e4SLinus Torvalds * 3451da177e4SLinus Torvalds * SniffUSB observations (Nov 2003): With the MCT-supplied Windows98 driver 3461da177e4SLinus Torvalds * (U2SPORT.VXD, "File version: 1.21P.0104 for Win98/Me"), this request 3471da177e4SLinus Torvalds * occurs immediately after the 'Unknown #1' message (see above). It was 3481da177e4SLinus Torvalds * not observed at any other time. It is unclear what other purpose (if 3491da177e4SLinus Torvalds * any) this message might serve, but without it, the USB/RS-232 adapter 3501da177e4SLinus Torvalds * will not write to RS-232 devices which do not assert the 'CTS' signal. 3511da177e4SLinus Torvalds * 3521da177e4SLinus Torvalds * 3531da177e4SLinus Torvalds * Flow control 3541da177e4SLinus Torvalds * ------------ 3551da177e4SLinus Torvalds * 3561da177e4SLinus Torvalds * SniffUSB observations: no flow control specific requests have been realized 3571da177e4SLinus Torvalds * apart from DTR/RTS settings. Both signals are dropped for no flow control 3581da177e4SLinus Torvalds * but asserted for hardware or software flow control. 3591da177e4SLinus Torvalds * 3601da177e4SLinus Torvalds * 3611da177e4SLinus Torvalds * Endpoint usage 3621da177e4SLinus Torvalds * -------------- 3631da177e4SLinus Torvalds * 3641da177e4SLinus Torvalds * SniffUSB observations: the bulk-out endpoint 0x1 and interrupt-in endpoint 3651da177e4SLinus Torvalds * 0x81 is used to transmit and receive characters. The second interrupt-in 3661da177e4SLinus Torvalds * endpoint 0x83 signals exceptional conditions like modem line changes and 3671da177e4SLinus Torvalds * errors. The first byte returned is the MSR and the second byte the LSR. 3681da177e4SLinus Torvalds * 3691da177e4SLinus Torvalds * 3701da177e4SLinus Torvalds * Other observations 3711da177e4SLinus Torvalds * ------------------ 3721da177e4SLinus Torvalds * 3731da177e4SLinus Torvalds * Queued bulk transfers like used in visor.c did not work. 3741da177e4SLinus Torvalds * 3751da177e4SLinus Torvalds * 3761da177e4SLinus Torvalds * Properties of the USB device used (as found in /var/log/messages) 3771da177e4SLinus Torvalds * ----------------------------------------------------------------- 3781da177e4SLinus Torvalds * 3791da177e4SLinus Torvalds * Manufacturer: MCT Corporation. 3801da177e4SLinus Torvalds * Product: USB-232 Interfact Controller 3811da177e4SLinus Torvalds * SerialNumber: U2S22050 3821da177e4SLinus Torvalds * 3831da177e4SLinus Torvalds * Length = 18 3841da177e4SLinus Torvalds * DescriptorType = 01 3851da177e4SLinus Torvalds * USB version = 1.00 3861da177e4SLinus Torvalds * Vendor:Product = 0711:0210 3871da177e4SLinus Torvalds * MaxPacketSize0 = 8 3881da177e4SLinus Torvalds * NumConfigurations = 1 3891da177e4SLinus Torvalds * Device version = 1.02 3901da177e4SLinus Torvalds * Device Class:SubClass:Protocol = 00:00:00 3911da177e4SLinus Torvalds * Per-interface classes 3921da177e4SLinus Torvalds * Configuration: 3931da177e4SLinus Torvalds * bLength = 9 3941da177e4SLinus Torvalds * bDescriptorType = 02 3951da177e4SLinus Torvalds * wTotalLength = 0027 3961da177e4SLinus Torvalds * bNumInterfaces = 01 3971da177e4SLinus Torvalds * bConfigurationValue = 01 3981da177e4SLinus Torvalds * iConfiguration = 00 3991da177e4SLinus Torvalds * bmAttributes = c0 4001da177e4SLinus Torvalds * MaxPower = 100mA 4011da177e4SLinus Torvalds * 4021da177e4SLinus Torvalds * Interface: 0 4031da177e4SLinus Torvalds * Alternate Setting: 0 4041da177e4SLinus Torvalds * bLength = 9 4051da177e4SLinus Torvalds * bDescriptorType = 04 4061da177e4SLinus Torvalds * bInterfaceNumber = 00 4071da177e4SLinus Torvalds * bAlternateSetting = 00 4081da177e4SLinus Torvalds * bNumEndpoints = 03 4091da177e4SLinus Torvalds * bInterface Class:SubClass:Protocol = 00:00:00 4101da177e4SLinus Torvalds * iInterface = 00 4111da177e4SLinus Torvalds * Endpoint: 4121da177e4SLinus Torvalds * bLength = 7 4131da177e4SLinus Torvalds * bDescriptorType = 05 4141da177e4SLinus Torvalds * bEndpointAddress = 81 (in) 4151da177e4SLinus Torvalds * bmAttributes = 03 (Interrupt) 4161da177e4SLinus Torvalds * wMaxPacketSize = 0040 4171da177e4SLinus Torvalds * bInterval = 02 4181da177e4SLinus Torvalds * Endpoint: 4191da177e4SLinus Torvalds * bLength = 7 4201da177e4SLinus Torvalds * bDescriptorType = 05 4211da177e4SLinus Torvalds * bEndpointAddress = 01 (out) 4221da177e4SLinus Torvalds * bmAttributes = 02 (Bulk) 4231da177e4SLinus Torvalds * wMaxPacketSize = 0040 4241da177e4SLinus Torvalds * bInterval = 00 4251da177e4SLinus Torvalds * Endpoint: 4261da177e4SLinus Torvalds * bLength = 7 4271da177e4SLinus Torvalds * bDescriptorType = 05 4281da177e4SLinus Torvalds * bEndpointAddress = 83 (in) 4291da177e4SLinus Torvalds * bmAttributes = 03 (Interrupt) 4301da177e4SLinus Torvalds * wMaxPacketSize = 0002 4311da177e4SLinus Torvalds * bInterval = 02 4321da177e4SLinus Torvalds * 4331da177e4SLinus Torvalds * 4341da177e4SLinus Torvalds * Hardware details (added by Martin Hamilton, 2001/12/06) 4351da177e4SLinus Torvalds * ----------------------------------------------------------------- 4361da177e4SLinus Torvalds * 4371da177e4SLinus Torvalds * This info was gleaned from opening a Belkin F5U109 DB9 USB serial 4381da177e4SLinus Torvalds * adaptor, which turns out to simply be a re-badged U232-P9. We 4391da177e4SLinus Torvalds * know this because there is a sticky label on the circuit board 4401da177e4SLinus Torvalds * which says "U232-P9" ;-) 4411da177e4SLinus Torvalds * 4421da177e4SLinus Torvalds * The circuit board inside the adaptor contains a Philips PDIUSBD12 44345b844dfSDave Platt * USB endpoint chip and a Philips P87C52UBAA microcontroller with 4441da177e4SLinus Torvalds * embedded UART. Exhaustive documentation for these is available at: 4451da177e4SLinus Torvalds * 4461da177e4SLinus Torvalds * http://www.semiconductors.philips.com/pip/p87c52ubaa 4471da177e4SLinus Torvalds * http://www.semiconductors.philips.com/pip/pdiusbd12 4481da177e4SLinus Torvalds * 4491da177e4SLinus Torvalds * Thanks to Julian Highfield for the pointer to the Philips database. 4501da177e4SLinus Torvalds * 4511da177e4SLinus Torvalds */ 4521da177e4SLinus Torvalds 4531da177e4SLinus Torvalds #endif /* __LINUX_USB_SERIAL_MCT_U232_H */ 4541da177e4SLinus Torvalds 455