Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Andreas Wass | 7712bbb | 2013-08-14 23:45:03 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Freescale MXS UARTAPP Register Definitions |
| 4 | * |
| 5 | * Copyright (C) 2013 Andreas Wass <andreas.wass@dalelven.com> |
| 6 | * |
| 7 | * Based on code from LTIB: |
| 8 | * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. |
Andreas Wass | 7712bbb | 2013-08-14 23:45:03 +0200 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #ifndef __ARCH_ARM___MXS_UARTAPP_H |
| 12 | #define __ARCH_ARM___MXS_UARTAPP_H |
| 13 | |
Stefano Babic | 33731bc | 2017-06-29 10:16:06 +0200 | [diff] [blame] | 14 | #include <asm/mach-imx/regs-common.h> |
Andreas Wass | 7712bbb | 2013-08-14 23:45:03 +0200 | [diff] [blame] | 15 | |
| 16 | #ifndef __ASSEMBLY__ |
| 17 | struct mxs_uartapp_regs { |
| 18 | mxs_reg_32(hw_uartapp_ctrl0) |
| 19 | mxs_reg_32(hw_uartapp_ctrl1) |
| 20 | mxs_reg_32(hw_uartapp_ctrl2) |
| 21 | mxs_reg_32(hw_uartapp_linectrl) |
| 22 | mxs_reg_32(hw_uartapp_linectrl2) |
| 23 | mxs_reg_32(hw_uartapp_intr) |
| 24 | mxs_reg_32(hw_uartapp_data) |
| 25 | mxs_reg_32(hw_uartapp_stat) |
| 26 | mxs_reg_32(hw_uartapp_debug) |
| 27 | mxs_reg_32(hw_uartapp_version) |
| 28 | mxs_reg_32(hw_uartapp_autobaud) |
| 29 | }; |
| 30 | #endif |
| 31 | |
| 32 | #define UARTAPP_CTRL0_SFTRST_MASK (1 << 31) |
| 33 | #define UARTAPP_CTRL0_CLKGATE_MASK (1 << 30) |
| 34 | #define UARTAPP_CTRL0_RUN_MASK (1 << 29) |
| 35 | #define UARTAPP_CTRL0_RX_SOURCE_MASK (1 << 28) |
| 36 | #define UARTAPP_CTRL0_RXTO_ENABLE_MASK (1 << 27) |
| 37 | #define UARTAPP_CTRL0_RXTIMEOUT_OFFSET 16 |
| 38 | #define UARTAPP_CTRL0_RXTIMEOUT_MASK (0x7FF << 16) |
| 39 | #define UARTAPP_CTRL0_XFER_COUNT_OFFSET 0 |
| 40 | #define UARTAPP_CTRL0_XFER_COUNT_MASK 0xFFFF |
| 41 | |
| 42 | #define UARTAPP_CTRL1_RUN_MASK (1 << 28) |
| 43 | |
| 44 | #define UARTAPP_CTRL1_XFER_COUNT_OFFSET 0 |
| 45 | #define UARTAPP_CTRL1_XFER_COUNT_MASK 0xFFFF |
| 46 | |
| 47 | #define UARTAPP_CTRL2_INVERT_RTS_MASK (1 << 31) |
| 48 | #define UARTAPP_CTRL2_INVERT_CTS_MASK (1 << 30) |
| 49 | #define UARTAPP_CTRL2_INVERT_TX_MASK (1 << 29) |
| 50 | #define UARTAPP_CTRL2_INVERT_RX_MASK (1 << 28) |
| 51 | #define UARTAPP_CTRL2_RTS_SEMAPHORE_MASK (1 << 27) |
| 52 | #define UARTAPP_CTRL2_DMAONERR_MASK (1 << 26) |
| 53 | #define UARTAPP_CTRL2_TXDMAE_MASK (1 << 25) |
| 54 | #define UARTAPP_CTRL2_RXDMAE_MASK (1 << 24) |
| 55 | #define UARTAPP_CTRL2_RXIFLSEL_OFFSET 20 |
| 56 | #define UARTAPP_CTRL2_RXIFLSEL_MASK (0x7 << 20) |
| 57 | |
| 58 | #define UARTAPP_CTRL2_RXIFLSEL_NOT_EMPTY (0x0 << 20) |
| 59 | #define UARTAPP_CTRL2_RXIFLSEL_ONE_QUARTER (0x1 << 20) |
| 60 | #define UARTAPP_CTRL2_RXIFLSEL_ONE_HALF (0x2 << 20) |
| 61 | #define UARTAPP_CTRL2_RXIFLSEL_THREE_QUARTERS (0x3 << 20) |
| 62 | #define UARTAPP_CTRL2_RXIFLSEL_SEVEN_EIGHTHS (0x4 << 20) |
| 63 | #define UARTAPP_CTRL2_RXIFLSEL_INVALID5 (0x5 << 20) |
| 64 | #define UARTAPP_CTRL2_RXIFLSEL_INVALID6 (0x6 << 20) |
| 65 | #define UARTAPP_CTRL2_RXIFLSEL_INVALID7 (0x7 << 20) |
| 66 | #define UARTAPP_CTRL2_TXIFLSEL_OFFSET 16 |
| 67 | #define UARTAPP_CTRL2_TXIFLSEL_MASK (0x7 << 16) |
| 68 | #define UARTAPP_CTRL2_TXIFLSEL_EMPTY (0x0 << 16) |
| 69 | #define UARTAPP_CTRL2_TXIFLSEL_ONE_QUARTER (0x1 << 16) |
| 70 | #define UARTAPP_CTRL2_TXIFLSEL_ONE_HALF (0x2 << 16) |
| 71 | #define UARTAPP_CTRL2_TXIFLSEL_THREE_QUARTERS (0x3 << 16) |
| 72 | #define UARTAPP_CTRL2_TXIFLSEL_SEVEN_EIGHTHS (0x4 << 16) |
| 73 | #define UARTAPP_CTRL2_TXIFLSEL_INVALID5 (0x5 << 16) |
| 74 | #define UARTAPP_CTRL2_TXIFLSEL_INVALID6 (0x6 << 16) |
| 75 | #define UARTAPP_CTRL2_TXIFLSEL_INVALID7 (0x7 << 16) |
| 76 | #define UARTAPP_CTRL2_CTSEN_MASK (1 << 15) |
| 77 | #define UARTAPP_CTRL2_RTSEN_MASK (1 << 14) |
| 78 | #define UARTAPP_CTRL2_OUT2_MASK (1 << 13) |
| 79 | #define UARTAPP_CTRL2_OUT1_MASK (1 << 12) |
| 80 | #define UARTAPP_CTRL2_RTS_MASK (1 << 11) |
| 81 | #define UARTAPP_CTRL2_DTR_MASK (1 << 10) |
| 82 | #define UARTAPP_CTRL2_RXE_MASK (1 << 9) |
| 83 | #define UARTAPP_CTRL2_TXE_MASK (1 << 8) |
| 84 | #define UARTAPP_CTRL2_LBE_MASK (1 << 7) |
| 85 | #define UARTAPP_CTRL2_USE_LCR2_MASK (1 << 6) |
| 86 | |
| 87 | #define UARTAPP_CTRL2_SIRLP_MASK (1 << 2) |
| 88 | #define UARTAPP_CTRL2_SIREN_MASK (1 << 1) |
| 89 | #define UARTAPP_CTRL2_UARTEN_MASK 0x01 |
| 90 | |
| 91 | #define UARTAPP_LINECTRL_BAUD_DIVINT_OFFSET 16 |
| 92 | #define UARTAPP_LINECTRL_BAUD_DIVINT_MASK (0xFFFF << 16) |
| 93 | #define UARTAPP_LINECTRL_EXTRACT_BAUD_DIVINT_OFFSET 6 |
| 94 | |
| 95 | #define UARTAPP_LINECTRL_BAUD_DIVFRAC_OFFSET 8 |
| 96 | #define UARTAPP_LINECTRL_BAUD_DIVFRAC_MASK (0x3F << 8) |
| 97 | #define UARTAPP_LINECTRL_EXTRACT_BAUD_DIVFRAC_MASK 0x3F |
| 98 | |
| 99 | #define UARTAPP_LINECTRL_SPS_MASK (1 << 7) |
| 100 | #define UARTAPP_LINECTRL_WLEN_OFFSET 5 |
| 101 | #define UARTAPP_LINECTRL_WLEN_MASK (0x03 << 5) |
| 102 | #define UARTAPP_LINECTRL_WLEN_5BITS (0x00 << 5) |
| 103 | #define UARTAPP_LINECTRL_WLEN_6BITS (0x01 << 5) |
| 104 | #define UARTAPP_LINECTRL_WLEN_7BITS (0x02 << 5) |
| 105 | #define UARTAPP_LINECTRL_WLEN_8BITS (0x03 << 5) |
| 106 | |
| 107 | #define UARTAPP_LINECTRL_FEN_MASK (1 << 4) |
| 108 | #define UARTAPP_LINECTRL_STP2_MASK (1 << 3) |
| 109 | #define UARTAPP_LINECTRL_EPS_MASK (1 << 2) |
| 110 | #define UARTAPP_LINECTRL_PEN_MASK (1 << 1) |
| 111 | #define UARTAPP_LINECTRL_BRK_MASK 1 |
| 112 | |
| 113 | #define UARTAPP_LINECTRL2_BAUD_DIVINT_OFFSET 16 |
| 114 | #define UARTAPP_LINECTRL2_BAUD_DIVINT_MASK (0xFFFF << 16) |
| 115 | #define UARTAPP_LINECTRL2_EXTRACT_BAUD_DIVINT_OFFSET 6 |
| 116 | |
| 117 | #define UARTAPP_LINECTRL2_BAUD_DIVFRAC_OFFSET 8 |
| 118 | #define UARTAPP_LINECTRL2_BAUD_DIVFRAC_MASK (0x3F << 8) |
| 119 | #define UARTAPP_LINECTRL2_EXTRACT_BAUD_DIVFRAC_MASK 0x3F |
| 120 | |
| 121 | #define UARTAPP_LINECTRL2_SPS_MASK (1 << 7) |
| 122 | #define UARTAPP_LINECTRL2_WLEN_OFFSET 5 |
| 123 | #define UARTAPP_LINECTRL2_WLEN_MASK (0x03 << 5) |
| 124 | #define UARTAPP_LINECTRL2_WLEN_5BITS (0x00 << 5) |
| 125 | #define UARTAPP_LINECTRL2_WLEN_6BITS (0x01 << 5) |
| 126 | #define UARTAPP_LINECTRL2_WLEN_7BITS (0x02 << 5) |
| 127 | #define UARTAPP_LINECTRL2_WLEN_8BITS (0x03 << 5) |
| 128 | |
| 129 | #define UARTAPP_LINECTRL2_FEN_MASK (1 << 4) |
| 130 | #define UARTAPP_LINECTRL2_STP2_MASK (1 << 3) |
| 131 | #define UARTAPP_LINECTRL2_EPS_MASK (1 << 2) |
| 132 | #define UARTAPP_LINECTRL2_PEN_MASK (1 << 1) |
| 133 | |
| 134 | #define UARTAPP_INTR_ABDIEN_MASK (1 << 27) |
| 135 | #define UARTAPP_INTR_OEIEN_MASK (1 << 26) |
| 136 | #define UARTAPP_INTR_BEIEN_MASK (1 << 25) |
| 137 | #define UARTAPP_INTR_PEIEN_MASK (1 << 24) |
| 138 | #define UARTAPP_INTR_FEIEN_MASK (1 << 23) |
| 139 | #define UARTAPP_INTR_RTIEN_MASK (1 << 22) |
| 140 | #define UARTAPP_INTR_TXIEN_MASK (1 << 21) |
| 141 | #define UARTAPP_INTR_RXIEN_MASK (1 << 20) |
| 142 | #define UARTAPP_INTR_DSRMIEN_MASK (1 << 19) |
| 143 | #define UARTAPP_INTR_DCDMIEN_MASK (1 << 18) |
| 144 | #define UARTAPP_INTR_CTSMIEN_MASK (1 << 17) |
| 145 | #define UARTAPP_INTR_RIMIEN_MASK (1 << 16) |
| 146 | |
| 147 | #define UARTAPP_INTR_ABDIS_MASK (1 << 11) |
| 148 | #define UARTAPP_INTR_OEIS_MASK (1 << 10) |
| 149 | #define UARTAPP_INTR_BEIS_MASK (1 << 9) |
| 150 | #define UARTAPP_INTR_PEIS_MASK (1 << 8) |
| 151 | #define UARTAPP_INTR_FEIS_MASK (1 << 7) |
| 152 | #define UARTAPP_INTR_RTIS_MASK (1 << 6) |
| 153 | #define UARTAPP_INTR_TXIS_MASK (1 << 5) |
| 154 | #define UARTAPP_INTR_RXIS_MASK (1 << 4) |
| 155 | #define UARTAPP_INTR_DSRMIS_MASK (1 << 3) |
| 156 | #define UARTAPP_INTR_DCDMIS_MASK (1 << 2) |
| 157 | #define UARTAPP_INTR_CTSMIS_MASK (1 << 1) |
| 158 | #define UARTAPP_INTR_RIMIS_MASK 0x1 |
| 159 | |
| 160 | #define UARTAPP_DATA_DATA_OFFSET 0 |
| 161 | #define UARTAPP_DATA_DATA_MASK 0xFFFFFFFF |
| 162 | #define UARTAPP_STAT_PRESENT_MASK (1 << 31) |
| 163 | #define UARTAPP_STAT_PRESENT_UNAVAILABLE (0x0 << 31) |
| 164 | #define UARTAPP_STAT_PRESENT_AVAILABLE (0x1 << 31) |
| 165 | |
| 166 | #define UARTAPP_STAT_HISPEED_MASK (1 << 30) |
| 167 | #define UARTAPP_STAT_HISPEED_UNAVAILABLE (0x0 << 30) |
| 168 | #define UARTAPP_STAT_HISPEED_AVAILABLE (0x1 << 30) |
| 169 | |
| 170 | #define UARTAPP_STAT_BUSY_MASK (1 << 29) |
| 171 | #define UARTAPP_STAT_CTS_MASK (1 << 28) |
| 172 | #define UARTAPP_STAT_TXFE_MASK (1 << 27) |
| 173 | #define UARTAPP_STAT_RXFF_MASK (1 << 26) |
| 174 | #define UARTAPP_STAT_TXFF_MASK (1 << 25) |
| 175 | #define UARTAPP_STAT_RXFE_MASK (1 << 24) |
| 176 | #define UARTAPP_STAT_RXBYTE_INVALID_OFFSET 20 |
| 177 | #define UARTAPP_STAT_RXBYTE_INVALID_MASK (0xF << 20) |
| 178 | |
| 179 | #define UARTAPP_STAT_OERR_MASK (1 << 19) |
| 180 | #define UARTAPP_STAT_BERR_MASK (1 << 18) |
| 181 | #define UARTAPP_STAT_PERR_MASK (1 << 17) |
| 182 | #define UARTAPP_STAT_FERR_MASK (1 << 16) |
| 183 | #define UARTAPP_STAT_RXCOUNT_OFFSET 0 |
| 184 | #define UARTAPP_STAT_RXCOUNT_MASK 0xFFFF |
| 185 | |
| 186 | #define UARTAPP_DEBUG_RXIBAUD_DIV_OFFSET 16 |
| 187 | #define UARTAPP_DEBUG_RXIBAUD_DIV_MASK (0xFFFF << 16) |
| 188 | |
| 189 | #define UARTAPP_DEBUG_RXFBAUD_DIV_OFFSET 10 |
| 190 | #define UARTAPP_DEBUG_RXFBAUD_DIV_MASK (0x3F << 10) |
| 191 | |
| 192 | #define UARTAPP_DEBUG_TXDMARUN_MASK (1 << 5) |
| 193 | #define UARTAPP_DEBUG_RXDMARUN_MASK (1 << 4) |
| 194 | #define UARTAPP_DEBUG_TXCMDEND_MASK (1 << 3) |
| 195 | #define UARTAPP_DEBUG_RXCMDEND_MASK (1 << 2) |
| 196 | #define UARTAPP_DEBUG_TXDMARQ_MASK (1 << 1) |
| 197 | #define UARTAPP_DEBUG_RXDMARQ_MASK 0x01 |
| 198 | |
| 199 | #define UARTAPP_VERSION_MAJOR_OFFSET 24 |
| 200 | #define UARTAPP_VERSION_MAJOR_MASK (0xFF << 24) |
| 201 | |
| 202 | #define UARTAPP_VERSION_MINOR_OFFSET 16 |
| 203 | #define UARTAPP_VERSION_MINOR_MASK (0xFF << 16) |
| 204 | |
| 205 | #define UARTAPP_VERSION_STEP_OFFSET 0 |
| 206 | #define UARTAPP_VERSION_STEP_MASK 0xFFFF |
| 207 | |
| 208 | #define UARTAPP_AUTOBAUD_REFCHAR1_OFFSET 24 |
| 209 | #define UARTAPP_AUTOBAUD_REFCHAR1_MASK (0xFF << 24) |
| 210 | |
| 211 | #define UARTAPP_AUTOBAUD_REFCHAR0_OFFSET 16 |
| 212 | #define UARTAPP_AUTOBAUD_REFCHAR0_MASK (0xFF << 16) |
| 213 | |
| 214 | #define UARTAPP_AUTOBAUD_UPDATE_TX_MASK (1 << 4) |
| 215 | #define UARTAPP_AUTOBAUD_TWO_REF_CHARS_MASK (1 << 3) |
| 216 | #define UARTAPP_AUTOBAUD_START_WITH_RUNBIT_MASK (1 << 2) |
| 217 | #define UARTAPP_AUTOBAUD_START_BAUD_DETECT_MASK (1 << 1) |
| 218 | #define UARTAPP_AUTOBAUD_BAUD_DETECT_ENABLE_MASK 0x01 |
| 219 | #endif /* __ARCH_ARM___UARTAPP_H */ |