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