io_ti.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*****************************************************************************
  3. *
  4. * Copyright (C) 1997-2002 Inside Out Networks, Inc.
  5. *
  6. * Feb-16-2001 DMI Added I2C structure definitions
  7. * May-29-2002 gkh Ported to Linux
  8. *
  9. *
  10. ******************************************************************************/
  11. #ifndef _IO_TI_H_
  12. #define _IO_TI_H_
  13. /* Address Space */
  14. #define DTK_ADDR_SPACE_XDATA 0x03 /* Addr is placed in XDATA space */
  15. #define DTK_ADDR_SPACE_I2C_TYPE_II 0x82 /* Addr is placed in I2C area */
  16. #define DTK_ADDR_SPACE_I2C_TYPE_III 0x83 /* Addr is placed in I2C area */
  17. /* UART Defines */
  18. #define UMPMEM_BASE_UART1 0xFFA0 /* UMP UART1 base address */
  19. #define UMPMEM_BASE_UART2 0xFFB0 /* UMP UART2 base address */
  20. #define UMPMEM_OFFS_UART_LSR 0x05 /* UMP UART LSR register offset */
  21. /* Bits per character */
  22. #define UMP_UART_CHAR5BITS 0x00
  23. #define UMP_UART_CHAR6BITS 0x01
  24. #define UMP_UART_CHAR7BITS 0x02
  25. #define UMP_UART_CHAR8BITS 0x03
  26. /* Parity */
  27. #define UMP_UART_NOPARITY 0x00
  28. #define UMP_UART_ODDPARITY 0x01
  29. #define UMP_UART_EVENPARITY 0x02
  30. #define UMP_UART_MARKPARITY 0x03
  31. #define UMP_UART_SPACEPARITY 0x04
  32. /* Stop bits */
  33. #define UMP_UART_STOPBIT1 0x00
  34. #define UMP_UART_STOPBIT15 0x01
  35. #define UMP_UART_STOPBIT2 0x02
  36. /* Line status register masks */
  37. #define UMP_UART_LSR_OV_MASK 0x01
  38. #define UMP_UART_LSR_PE_MASK 0x02
  39. #define UMP_UART_LSR_FE_MASK 0x04
  40. #define UMP_UART_LSR_BR_MASK 0x08
  41. #define UMP_UART_LSR_ER_MASK 0x0F
  42. #define UMP_UART_LSR_RX_MASK 0x10
  43. #define UMP_UART_LSR_TX_MASK 0x20
  44. #define UMP_UART_LSR_DATA_MASK (LSR_PAR_ERR | LSR_FRM_ERR | LSR_BREAK)
  45. /* Port Settings Constants) */
  46. #define UMP_MASK_UART_FLAGS_RTS_FLOW 0x0001
  47. #define UMP_MASK_UART_FLAGS_RTS_DISABLE 0x0002
  48. #define UMP_MASK_UART_FLAGS_PARITY 0x0008
  49. #define UMP_MASK_UART_FLAGS_OUT_X_DSR_FLOW 0x0010
  50. #define UMP_MASK_UART_FLAGS_OUT_X_CTS_FLOW 0x0020
  51. #define UMP_MASK_UART_FLAGS_OUT_X 0x0040
  52. #define UMP_MASK_UART_FLAGS_OUT_XA 0x0080
  53. #define UMP_MASK_UART_FLAGS_IN_X 0x0100
  54. #define UMP_MASK_UART_FLAGS_DTR_FLOW 0x0800
  55. #define UMP_MASK_UART_FLAGS_DTR_DISABLE 0x1000
  56. #define UMP_MASK_UART_FLAGS_RECEIVE_MS_INT 0x2000
  57. #define UMP_MASK_UART_FLAGS_AUTO_START_ON_ERR 0x4000
  58. #define UMP_DMA_MODE_CONTINOUS 0x01
  59. #define UMP_PIPE_TRANS_TIMEOUT_ENA 0x80
  60. #define UMP_PIPE_TRANSFER_MODE_MASK 0x03
  61. #define UMP_PIPE_TRANS_TIMEOUT_MASK 0x7C
  62. /* Purge port Direction Mask Bits */
  63. #define UMP_PORT_DIR_OUT 0x01
  64. #define UMP_PORT_DIR_IN 0x02
  65. /* Address of Port 0 */
  66. #define UMPM_UART1_PORT 0x03
  67. /* Commands */
  68. #define UMPC_SET_CONFIG 0x05
  69. #define UMPC_OPEN_PORT 0x06
  70. #define UMPC_CLOSE_PORT 0x07
  71. #define UMPC_START_PORT 0x08
  72. #define UMPC_STOP_PORT 0x09
  73. #define UMPC_TEST_PORT 0x0A
  74. #define UMPC_PURGE_PORT 0x0B
  75. /* Force the Firmware to complete the current Read */
  76. #define UMPC_COMPLETE_READ 0x80
  77. /* Force UMP back into BOOT Mode */
  78. #define UMPC_HARDWARE_RESET 0x81
  79. /*
  80. * Copy current download image to type 0xf2 record in 16k I2C
  81. * firmware will change 0xff record to type 2 record when complete
  82. */
  83. #define UMPC_COPY_DNLD_TO_I2C 0x82
  84. /*
  85. * Special function register commands
  86. * wIndex is register address
  87. * wValue is MSB/LSB mask/data
  88. */
  89. #define UMPC_WRITE_SFR 0x83 /* Write SFR Register */
  90. /* wIndex is register address */
  91. #define UMPC_READ_SFR 0x84 /* Read SRF Register */
  92. /* Set or Clear DTR (wValue bit 0 Set/Clear) wIndex ModuleID (port) */
  93. #define UMPC_SET_CLR_DTR 0x85
  94. /* Set or Clear RTS (wValue bit 0 Set/Clear) wIndex ModuleID (port) */
  95. #define UMPC_SET_CLR_RTS 0x86
  96. /* Set or Clear LOOPBACK (wValue bit 0 Set/Clear) wIndex ModuleID (port) */
  97. #define UMPC_SET_CLR_LOOPBACK 0x87
  98. /* Set or Clear BREAK (wValue bit 0 Set/Clear) wIndex ModuleID (port) */
  99. #define UMPC_SET_CLR_BREAK 0x88
  100. /* Read MSR wIndex ModuleID (port) */
  101. #define UMPC_READ_MSR 0x89
  102. /* Toolkit commands */
  103. /* Read-write group */
  104. #define UMPC_MEMORY_READ 0x92
  105. #define UMPC_MEMORY_WRITE 0x93
  106. /*
  107. * UMP DMA Definitions
  108. */
  109. #define UMPD_OEDB1_ADDRESS 0xFF08
  110. #define UMPD_OEDB2_ADDRESS 0xFF10
  111. struct out_endpoint_desc_block {
  112. __u8 Configuration;
  113. __u8 XBufAddr;
  114. __u8 XByteCount;
  115. __u8 Unused1;
  116. __u8 Unused2;
  117. __u8 YBufAddr;
  118. __u8 YByteCount;
  119. __u8 BufferSize;
  120. } __attribute__((packed));
  121. /*
  122. * TYPE DEFINITIONS
  123. * Structures for Firmware commands
  124. */
  125. /* UART settings */
  126. struct ump_uart_config {
  127. __u16 wBaudRate; /* Baud rate */
  128. __u16 wFlags; /* Bitmap mask of flags */
  129. __u8 bDataBits; /* 5..8 - data bits per character */
  130. __u8 bParity; /* Parity settings */
  131. __u8 bStopBits; /* Stop bits settings */
  132. char cXon; /* XON character */
  133. char cXoff; /* XOFF character */
  134. __u8 bUartMode; /* Will be updated when a user */
  135. /* interface is defined */
  136. } __attribute__((packed));
  137. /*
  138. * TYPE DEFINITIONS
  139. * Structures for USB interrupts
  140. */
  141. /* Interrupt packet structure */
  142. struct ump_interrupt {
  143. __u8 bICode; /* Interrupt code (interrupt num) */
  144. __u8 bIInfo; /* Interrupt information */
  145. } __attribute__((packed));
  146. #define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01)
  147. #define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f)
  148. #define TIUMP_INTERRUPT_CODE_LSR 0x03
  149. #define TIUMP_INTERRUPT_CODE_MSR 0x04
  150. #endif