ti_usb_3410_5052.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /* vi: ts=8 sw=8
  2. *
  3. * TI 3410/5052 USB Serial Driver Header
  4. *
  5. * Copyright (C) 2004 Texas Instruments
  6. *
  7. * This driver is based on the Linux io_ti driver, which is
  8. * Copyright (C) 2000-2002 Inside Out Networks
  9. * Copyright (C) 2001-2002 Greg Kroah-Hartman
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * For questions or problems with this driver, contact Texas Instruments
  17. * technical support, or Al Borchers <alborchers@steinerpoint.com>, or
  18. * Peter Berger <pberger@brimson.com>.
  19. */
  20. #ifndef _TI_3410_5052_H_
  21. #define _TI_3410_5052_H_
  22. /* Configuration ids */
  23. #define TI_BOOT_CONFIG 1
  24. #define TI_ACTIVE_CONFIG 2
  25. /* Vendor and product ids */
  26. #define TI_VENDOR_ID 0x0451
  27. #define IBM_VENDOR_ID 0x04b3
  28. #define TI_3410_PRODUCT_ID 0x3410
  29. #define IBM_4543_PRODUCT_ID 0x4543
  30. #define IBM_454B_PRODUCT_ID 0x454b
  31. #define IBM_454C_PRODUCT_ID 0x454c
  32. #define TI_3410_EZ430_ID 0xF430 /* TI ez430 development tool */
  33. #define TI_5052_BOOT_PRODUCT_ID 0x5052 /* no EEPROM, no firmware */
  34. #define TI_5152_BOOT_PRODUCT_ID 0x5152 /* no EEPROM, no firmware */
  35. #define TI_5052_EEPROM_PRODUCT_ID 0x505A /* EEPROM, no firmware */
  36. #define TI_5052_FIRMWARE_PRODUCT_ID 0x505F /* firmware is running */
  37. #define FRI2_PRODUCT_ID 0x5053 /* Fish River Island II */
  38. /* Multi-Tech vendor and product ids */
  39. #define MTS_VENDOR_ID 0x06E0
  40. #define MTS_GSM_NO_FW_PRODUCT_ID 0xF108
  41. #define MTS_CDMA_NO_FW_PRODUCT_ID 0xF109
  42. #define MTS_CDMA_PRODUCT_ID 0xF110
  43. #define MTS_GSM_PRODUCT_ID 0xF111
  44. #define MTS_EDGE_PRODUCT_ID 0xF112
  45. #define MTS_MT9234MU_PRODUCT_ID 0xF114
  46. #define MTS_MT9234ZBA_PRODUCT_ID 0xF115
  47. #define MTS_MT9234ZBAOLD_PRODUCT_ID 0x0319
  48. /* Abbott Diabetics vendor and product ids */
  49. #define ABBOTT_VENDOR_ID 0x1a61
  50. #define ABBOTT_STEREO_PLUG_ID 0x3410
  51. #define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID
  52. #define ABBOTT_STRIP_PORT_ID 0x3420
  53. /* Commands */
  54. #define TI_GET_VERSION 0x01
  55. #define TI_GET_PORT_STATUS 0x02
  56. #define TI_GET_PORT_DEV_INFO 0x03
  57. #define TI_GET_CONFIG 0x04
  58. #define TI_SET_CONFIG 0x05
  59. #define TI_OPEN_PORT 0x06
  60. #define TI_CLOSE_PORT 0x07
  61. #define TI_START_PORT 0x08
  62. #define TI_STOP_PORT 0x09
  63. #define TI_TEST_PORT 0x0A
  64. #define TI_PURGE_PORT 0x0B
  65. #define TI_RESET_EXT_DEVICE 0x0C
  66. #define TI_WRITE_DATA 0x80
  67. #define TI_READ_DATA 0x81
  68. #define TI_REQ_TYPE_CLASS 0x82
  69. /* Module identifiers */
  70. #define TI_I2C_PORT 0x01
  71. #define TI_IEEE1284_PORT 0x02
  72. #define TI_UART1_PORT 0x03
  73. #define TI_UART2_PORT 0x04
  74. #define TI_RAM_PORT 0x05
  75. /* Modem status */
  76. #define TI_MSR_DELTA_CTS 0x01
  77. #define TI_MSR_DELTA_DSR 0x02
  78. #define TI_MSR_DELTA_RI 0x04
  79. #define TI_MSR_DELTA_CD 0x08
  80. #define TI_MSR_CTS 0x10
  81. #define TI_MSR_DSR 0x20
  82. #define TI_MSR_RI 0x40
  83. #define TI_MSR_CD 0x80
  84. #define TI_MSR_DELTA_MASK 0x0F
  85. #define TI_MSR_MASK 0xF0
  86. /* Line status */
  87. #define TI_LSR_OVERRUN_ERROR 0x01
  88. #define TI_LSR_PARITY_ERROR 0x02
  89. #define TI_LSR_FRAMING_ERROR 0x04
  90. #define TI_LSR_BREAK 0x08
  91. #define TI_LSR_ERROR 0x0F
  92. #define TI_LSR_RX_FULL 0x10
  93. #define TI_LSR_TX_EMPTY 0x20
  94. /* Line control */
  95. #define TI_LCR_BREAK 0x40
  96. /* Modem control */
  97. #define TI_MCR_LOOP 0x04
  98. #define TI_MCR_DTR 0x10
  99. #define TI_MCR_RTS 0x20
  100. /* Mask settings */
  101. #define TI_UART_ENABLE_RTS_IN 0x0001
  102. #define TI_UART_DISABLE_RTS 0x0002
  103. #define TI_UART_ENABLE_PARITY_CHECKING 0x0008
  104. #define TI_UART_ENABLE_DSR_OUT 0x0010
  105. #define TI_UART_ENABLE_CTS_OUT 0x0020
  106. #define TI_UART_ENABLE_X_OUT 0x0040
  107. #define TI_UART_ENABLE_XA_OUT 0x0080
  108. #define TI_UART_ENABLE_X_IN 0x0100
  109. #define TI_UART_ENABLE_DTR_IN 0x0800
  110. #define TI_UART_DISABLE_DTR 0x1000
  111. #define TI_UART_ENABLE_MS_INTS 0x2000
  112. #define TI_UART_ENABLE_AUTO_START_DMA 0x4000
  113. /* Parity */
  114. #define TI_UART_NO_PARITY 0x00
  115. #define TI_UART_ODD_PARITY 0x01
  116. #define TI_UART_EVEN_PARITY 0x02
  117. #define TI_UART_MARK_PARITY 0x03
  118. #define TI_UART_SPACE_PARITY 0x04
  119. /* Stop bits */
  120. #define TI_UART_1_STOP_BITS 0x00
  121. #define TI_UART_1_5_STOP_BITS 0x01
  122. #define TI_UART_2_STOP_BITS 0x02
  123. /* Bits per character */
  124. #define TI_UART_5_DATA_BITS 0x00
  125. #define TI_UART_6_DATA_BITS 0x01
  126. #define TI_UART_7_DATA_BITS 0x02
  127. #define TI_UART_8_DATA_BITS 0x03
  128. /* 232/485 modes */
  129. #define TI_UART_232 0x00
  130. #define TI_UART_485_RECEIVER_DISABLED 0x01
  131. #define TI_UART_485_RECEIVER_ENABLED 0x02
  132. /* Pipe transfer mode and timeout */
  133. #define TI_PIPE_MODE_CONTINOUS 0x01
  134. #define TI_PIPE_MODE_MASK 0x03
  135. #define TI_PIPE_TIMEOUT_MASK 0x7C
  136. #define TI_PIPE_TIMEOUT_ENABLE 0x80
  137. /* Config struct */
  138. struct ti_uart_config {
  139. __u16 wBaudRate;
  140. __u16 wFlags;
  141. __u8 bDataBits;
  142. __u8 bParity;
  143. __u8 bStopBits;
  144. char cXon;
  145. char cXoff;
  146. __u8 bUartMode;
  147. } __attribute__((packed));
  148. /* Get port status */
  149. struct ti_port_status {
  150. __u8 bCmdCode;
  151. __u8 bModuleId;
  152. __u8 bErrorCode;
  153. __u8 bMSR;
  154. __u8 bLSR;
  155. } __attribute__((packed));
  156. /* Purge modes */
  157. #define TI_PURGE_OUTPUT 0x00
  158. #define TI_PURGE_INPUT 0x80
  159. /* Read/Write data */
  160. #define TI_RW_DATA_ADDR_SFR 0x10
  161. #define TI_RW_DATA_ADDR_IDATA 0x20
  162. #define TI_RW_DATA_ADDR_XDATA 0x30
  163. #define TI_RW_DATA_ADDR_CODE 0x40
  164. #define TI_RW_DATA_ADDR_GPIO 0x50
  165. #define TI_RW_DATA_ADDR_I2C 0x60
  166. #define TI_RW_DATA_ADDR_FLASH 0x70
  167. #define TI_RW_DATA_ADDR_DSP 0x80
  168. #define TI_RW_DATA_UNSPECIFIED 0x00
  169. #define TI_RW_DATA_BYTE 0x01
  170. #define TI_RW_DATA_WORD 0x02
  171. #define TI_RW_DATA_DOUBLE_WORD 0x04
  172. struct ti_write_data_bytes {
  173. __u8 bAddrType;
  174. __u8 bDataType;
  175. __u8 bDataCounter;
  176. __be16 wBaseAddrHi;
  177. __be16 wBaseAddrLo;
  178. __u8 bData[0];
  179. } __attribute__((packed));
  180. struct ti_read_data_request {
  181. __u8 bAddrType;
  182. __u8 bDataType;
  183. __u8 bDataCounter;
  184. __be16 wBaseAddrHi;
  185. __be16 wBaseAddrLo;
  186. } __attribute__((packed));
  187. struct ti_read_data_bytes {
  188. __u8 bCmdCode;
  189. __u8 bModuleId;
  190. __u8 bErrorCode;
  191. __u8 bData[0];
  192. } __attribute__((packed));
  193. /* Interrupt struct */
  194. struct ti_interrupt {
  195. __u8 bICode;
  196. __u8 bIInfo;
  197. } __attribute__((packed));
  198. /* Interrupt codes */
  199. #define TI_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3)
  200. #define TI_GET_FUNC_FROM_CODE(c) ((c) & 0x0f)
  201. #define TI_CODE_HARDWARE_ERROR 0xFF
  202. #define TI_CODE_DATA_ERROR 0x03
  203. #define TI_CODE_MODEM_STATUS 0x04
  204. /* Download firmware max packet size */
  205. #define TI_DOWNLOAD_MAX_PACKET_SIZE 64
  206. /* Firmware image header */
  207. struct ti_firmware_header {
  208. __le16 wLength;
  209. __u8 bCheckSum;
  210. } __attribute__((packed));
  211. /* UART addresses */
  212. #define TI_UART1_BASE_ADDR 0xFFA0 /* UART 1 base address */
  213. #define TI_UART2_BASE_ADDR 0xFFB0 /* UART 2 base address */
  214. #define TI_UART_OFFSET_LCR 0x0002 /* UART MCR register offset */
  215. #define TI_UART_OFFSET_MCR 0x0004 /* UART MCR register offset */
  216. #endif /* _TI_3410_5052_H_ */