1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef __REG_I2CIP_H_ 5 #define __REG_I2CIP_H_ 6 7 #include "plat_types.h" 8 9 #define I2CIP_TX_FIFO_DEPTH (8) 10 #define I2CIP_RX_FIFO_DEPTH (8) 11 12 #define NANO_TO_MICRO 1000 13 14 #define I2CIP_SS_SCL_HCNT_REG_OFFSET 0x14 15 #define I2CIP_SS_SCL_HCNT_SHIFT (0) 16 #define I2CIP_SS_SCL_HCNT_MASK ((0xffff)<<I2CIP_SS_SCL_HCNT_SHIFT) 17 18 #define I2CIP_SS_SCL_LCNT_REG_OFFSET 0x18 19 #define I2CIP_SS_SCL_LCNT_SHIFT (0) 20 #define I2CIP_SS_SCL_LCNT_MASK ((0xffff)<<I2CIP_SS_SCL_LCNT_SHIFT) 21 22 #define I2CIP_FS_SCL_HCNT_REG_OFFSET 0x1C 23 #define I2CIP_FS_SCL_HCNT_SHIFT (0) 24 #define I2CIP_FS_SCL_HCNT_MASK ((0xffff)<<I2CIP_FS_SCL_HCNT_SHIFT) 25 26 #define I2CIP_FS_SCL_LCNT_REG_OFFSET 0x20 27 #define I2CIP_FS_SCL_LCNT_SHIFT (0) 28 #define I2CIP_FS_SCL_LCNT_MASK ((0xffff)<<I2CIP_FS_SCL_LCNT_SHIFT) 29 30 #define I2CIP_HS_SCL_HCNT_REG_OFFSET 0x24 31 #define I2CIP_HS_SCL_HCNT_SHIFT (0) 32 #define I2CIP_HS_SCL_HCNT_MASK ((0xffff)<<I2CIP_HS_SCL_hCNT_SHIFT) 33 34 #define I2CIP_HS_SCL_LCNT_REG_OFFSET 0x28 35 #define I2CIP_HS_SCL_LCNT_SHIFT (0) 36 #define I2CIP_HS_SCL_LCNT_MASK ((0xffff)<<I2CIP_HS_SCL_LCNT_SHIFT) 37 38 /* High and low times in different speed modes (in ns) */ 39 #define MIN_SS_SCL_HIGHTIME 4000 40 #define MIN_SS_SCL_LOWTIME 4700 41 #define MIN_FS_SCL_HIGHTIME 600 42 #define MIN_FS_SCL_LOWTIME 1300 43 #define MIN_HS_SCL_HIGHTIME 60 44 #define MIN_HS_SCL_LOWTIME 160 45 46 /* Worst case timeout for 1 byte is kept as 2ms */ 47 #define I2C_BYTE_TO (CONFIG_SYSTICK_HZ/500) 48 #define I2C_STOPDET_TO (CONFIG_SYSTICK_HZ/500) 49 #define I2C_BYTE_TO_BB (I2C_BYTE_TO * 16) 50 51 /* i2c control register definitions */ 52 #define I2CIP_CTRL_REG_OFFSET 0x0 53 #define I2CIP_SPEED_SHIFT (1) 54 #define I2CIP_SPEED_MASK ((0x3)<<I2CIP_SPEED_SHIFT) 55 #define I2CIP_HIGH_SPEED_SHIFT (1) 56 #define I2CIP_HIGH_SPEED_MASK ((0x3)<<I2CIP_HIGH_SPEED_SHIFT) 57 #define I2CIP_FAST_SPEED_SHIFT (1) 58 #define I2CIP_FAST_SPEED_MASK ((0x2)<<I2CIP_HIGH_SPEED_SHIFT) 59 #define I2CIP_STANDARD_SPEED_SHIFT (1) 60 #define I2CIP_STANDARD_SPEED_MASK ((0x1)<<I2CIP_STANDARD_SPEED_SHIFT) 61 #define I2CIP_SLAVE_DISABLE_SHIFT (6) 62 #define I2CIP_SLAVE_DISABLE_MASK ((0x1)<<I2CIP_SLAVE_DISABLE_SHIFT) 63 #define I2CIP_RESTART_ENABLE_SHIFT (5) 64 #define I2CIP_RESTART_ENABLE_MASK ((0x1)<<I2CIP_RESTART_ENABLE_SHIFT) 65 #define I2CIP_MASTER_MODE_SHIFT (0) 66 #define I2CIP_MASTER_MODE_MASK ((0x1)<<I2CIP_MASTER_MODE_SHIFT) 67 #define I2CIP_10BITADDR_MASTER_SHIFT (4) 68 #define I2CIP_10BITADDR_MASTER_MASK ((0x1)<<I2CIP_10BITADDR_MASTER_SHIFT) 69 #define I2CIP_10BITADDR_SLAVE_SHIFT (3) 70 #define I2CIP_10BITADDR_SLAVE_MASK ((0x1)<<I2CIP_10BITADDR_SLAVE_SHIFT) 71 72 /* i2c target address register definitions */ 73 #define I2CIP_TARGET_ADDRESS_REG_OFFSET 0x04 74 #define I2CIP_TARGET_ADDRESS_SHIFT 0 75 #define I2CIP_TARGET_ADDRESS_MASK ((0x3ff)<<I2CIP_TARGET_ADDRESS_SHIFT) 76 #define I2CIP_TARGET_ADDRESS_IC_10BITADDR_MASTER_SHIFT 12 77 #define I2CIP_TARGET_ADDRESS_IC_10BITADDR_MASTER_MASK (1 << I2CIP_TARGET_ADDRESS_IC_10BITADDR_MASTER_SHIFT) 78 #define I2CIP_TARGET_ADDRESS_SPECIAL_BIT_SHIFT 11 79 #define I2CIP_TARGET_ADDRESS_SPECIAL_BIT_MASK ((0x1)<<I2CIP_TARGET_ADDRESS_SPECIAL_BIT_SHIFT) 80 #define I2CIP_TARGET_ADDRESS_GC_OR_START_SHIFT 10 81 #define I2CIP_TARGET_ADDRESS_GC_OR_START_MASK ((0x1)<<I2CIP_TARGET_ADDRESS_GC_OR_START_SHIFT) 82 83 /* i2c slave address register definitions */ 84 #define I2CIP_ADDRESS_AS_SLAVE_REG_OFFSET 0x08 85 #define I2CIP_ADDRESS_AS_SLAVE_SHIFT (0) 86 #define I2CIP_ADDRESS_AS_SLAVE_MASK ((0x3ff)<<I2CIP_ADDRESS_AS_SLAVE_SHIFT) 87 88 /* i2c data buffer and command register definitions */ 89 #define I2CIP_CMD_DATA_REG_OFFSET 0x10 90 #define I2CIP_CMD_DATA_CMD_SHIFT (8) 91 #define I2CIP_CMD_DATA_CMD_MASK ((0x1)<<I2CIP_CMD_DATA_CMD_SHIFT) 92 #define I2CIP_CMD_DATA_CMD_READ_SHIFT (8) 93 #define I2CIP_CMD_DATA_CMD_READ_MASK ((0x1)<<I2CIP_CMD_DATA_CMD_READ_SHIFT) 94 #define I2CIP_CMD_DATA_CMD_WRITE_SHIFT (8) 95 #define I2CIP_CMD_DATA_CMD_WRITE_MASK ((0x0)<<I2CIP_CMD_DATA_CMD_WRITE_SHIFT) 96 #define I2CIP_CMD_DATA_STOP_SHIFT (9) 97 #define I2CIP_CMD_DATA_STOP_MASK ((0x1)<<I2CIP_CMD_DATA_STOP_SHIFT) 98 #define I2CIP_CMD_DATA_RESTART_SHIFT (10) 99 #define I2CIP_CMD_DATA_RESTART_MASK ((0x1)<<I2CIP_CMD_DATA_RESTART_SHIFT) 100 101 /* i2c interrupt status register definitions */ 102 #define I2CIP_INT_STATUS_REG_OFFSET 0x2C 103 #define I2CIP_INT_STATUS_GEN_CALL_SHIFT (11) 104 #define I2CIP_INT_STATUS_GEN_CALL_MASK ((0x1)<<I2CIP_INT_STATUS_GEN_CALL_SHIFT) 105 #define I2CIP_INT_STATUS_START_DET_SHIFT (10) 106 #define I2CIP_INT_STATUS_START_DET_MASK ((0x1)<<I2CIP_INT_STATUS_START_DET_SHIFT) 107 #define I2CIP_INT_STATUS_STOP_DET_SHIFT (9) 108 #define I2CIP_INT_STATUS_STOP_DET_MASK ((0x1)<<I2CIP_INT_STATUS_STOP_DET_SHIFT) 109 #define I2CIP_INT_STATUS_ACTIVITY_SHIFT (8) 110 #define I2CIP_INT_STATUS_ACTIVITY_MASK ((0x1)<<I2CIP_INT_STATUS_ACTIVITY_SHIFT) 111 #define I2CIP_INT_STATUS_RX_DONE_SHIFT (7) 112 #define I2CIP_INT_STATUS_RX_DONE_MASK ((0x1)<<I2CIP_INT_STATUS_RX_DONE_SHIFT) 113 #define I2CIP_INT_STATUS_TX_ABRT_SHIFT (6) 114 #define I2CIP_INT_STATUS_TX_ABRT_MASK ((0x1)<<I2CIP_INT_STATUS_TX_ABRT_SHIFT) 115 #define I2CIP_INT_STATUS_RD_REQ_SHIFT (5) 116 #define I2CIP_INT_STATUS_RD_REQ_MASK ((0x1)<<I2CIP_INT_STATUS_RD_REQ_SHIFT) 117 #define I2CIP_INT_STATUS_TX_EMPTY_SHIFT (4) 118 #define I2CIP_INT_STATUS_TX_EMPTY_MASK ((0x1)<<I2CIP_INT_STATUS_TX_EMPTY_SHIFT) 119 #define I2CIP_INT_STATUS_TX_OVER_SHIFT (3) 120 #define I2CIP_INT_STATUS_TX_OVER_MASK ((0x1)<<I2CIP_INT_STATUS_TX_OVER_SHIFT) 121 #define I2CIP_INT_STATUS_RX_FULL_SHIFT (2) 122 #define I2CIP_INT_STATUS_RX_FULL_MASK ((0x1)<<I2CIP_INT_STATUS_RX_FULL_SHIFT) 123 #define I2CIP_INT_STATUS_RX_OVER_SHIFT (1) 124 #define I2CIP_INT_STATUS_RX_OVER_MASK ((0x1)<<I2CIP_INT_STATUS_RX_OVER_SHIFT) 125 #define I2CIP_INT_STATUS_RX_UNDER_SHIFT (0) 126 #define I2CIP_INT_STATUS_RX_UNDER_MASK ((0x1)<<I2CIP_INT_STATUS_RX_UNDER_SHIFT) 127 128 /* i2c raw interrupt status register definitions */ 129 #define I2CIP_RAW_INT_STATUS_REG_OFFSET 0x34 130 #define I2CIP_RAW_INT_STATUS_GEN_CALL_SHIFT (11) 131 #define I2CIP_RAW_INT_STATUS_GEN_CALL_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_GEN_CALL_SHIFT) 132 #define I2CIP_RAW_INT_STATUS_START_DET_SHIFT (10) 133 #define I2CIP_RAW_INT_STATUS_START_DET_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_START_DET_SHIFT) 134 #define I2CIP_RAW_INT_STATUS_STOP_DET_SHIFT (9) 135 #define I2CIP_RAW_INT_STATUS_STOP_DET_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_STOP_DET_SHIFT) 136 #define I2CIP_RAW_INT_STATUS_ACTIVITY_SHIFT (8) 137 #define I2CIP_RAW_INT_STATUS_ACTIVITY_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_ACTIVITY_SHIFT) 138 #define I2CIP_RAW_INT_STATUS_RX_DONE_SHIFT (7) 139 #define I2CIP_RAW_INT_STATUS_RX_DONE_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_RX_DONE_SHIFT) 140 #define I2CIP_RAW_INT_STATUS_TX_ABRT_SHIFT (6) 141 #define I2CIP_RAW_INT_STATUS_TX_ABRT_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_TX_ABRT_SHIFT) 142 #define I2CIP_RAW_INT_STATUS_RD_REQ_SHIFT (5) 143 #define I2CIP_RAW_INT_STATUS_RD_REQ_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_RD_REQ_SHIFT) 144 #define I2CIP_RAW_INT_STATUS_TX_EMPTY_SHIFT (4) 145 #define I2CIP_RAW_INT_STATUS_TX_EMPTY_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_TX_EMPTY_SHIFT) 146 #define I2CIP_RAW_INT_STATUS_TX_OVER_SHIFT (3) 147 #define I2CIP_RAW_INT_STATUS_TX_OVER_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_TX_OVER_SHIFT) 148 #define I2CIP_RAW_INT_STATUS_RX_FULL_SHIFT (2) 149 #define I2CIP_RAW_INT_STATUS_RX_FULL_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_RX_FULL_SHIFT) 150 #define I2CIP_RAW_INT_STATUS_RX_OVER_SHIFT (1) 151 #define I2CIP_RAW_INT_STATUS_RX_OVER_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_RX_OVER_SHIFT) 152 #define I2CIP_RAW_INT_STATUS_RX_UNDER_SHIFT (0) 153 #define I2CIP_RAW_INT_STATUS_RX_UNDER_MASK ((0x1)<<I2CIP_RAW_INT_STATUS_RX_UNDER_SHIFT) 154 155 /* fifo threshold register definitions */ 156 #define I2CIP_RX_THRESHOLD_REG_OFFSET 0x38 157 #define I2CIP_RX_TL_DEPTH (I2CIP_RX_FIFO_DEPTH - 1) 158 #define I2CIP_RX_TL_QUARTER (I2CIP_RX_FIFO_DEPTH/4 - 1) 159 #define I2CIP_RX_TL_HALF (I2CIP_RX_FIFO_DEPTH/2 - 1) 160 #define I2CIP_RX_TL_THREE_QUARTER (I2CIP_RX_FIFO_DEPTH*3/4 - 1) 161 #define I2CIP_RX_TL_1_BYTE (0) 162 #define I2CIP_TX_THRESHOLD_REG_OFFSET 0x3C 163 #define I2CIP_TX_TL_DEPTH ((I2CIP_TX_FIFO_DEPTH)) 164 #define I2CIP_TX_TL_QUARTER (I2CIP_TX_FIFO_DEPTH/4) 165 #define I2CIP_TX_TL_HALF (I2CIP_TX_FIFO_DEPTH/2) 166 #define I2CIP_TX_TL_THREE_QUARTER (I2CIP_TX_FIFO_DEPTH*3/4) 167 #define I2CIP_TX_TL_1_BYTE (1) 168 #define I2CIP_TX_TL_ZERO (0) 169 170 /* i2c enable register definitions */ 171 #define I2CIP_ENABLE_REG_OFFSET 0x6c 172 #define I2CIP_ENABLE_SHIFT 0 173 #define I2CIP_ENABLE_MASK ((0x1)<<I2CIP_ENABLE_SHIFT) 174 175 /* i2c status register definitions */ 176 #define I2CIP_STATUS_REG_OFFSET 0x70 177 #define I2CIP_STATUS_SA_SHIFT (6) 178 #define I2CIP_STATUS_SA_MASK ((0x1)<<I2CIP_STATUS_SA_SHIFT) 179 #define I2CIP_STATUS_SHIFT (5) 180 #define I2CIP_STATUS_MASK ((0x1)<<I2CIP_STATUS_SHIFT) 181 #define I2CIP_STATUS_RFF_SHIFT (4) 182 #define I2CIP_STATUS_RFF_MASK ((0x1)<<I2CIP_STATUS_RFF_SHIFT) 183 #define I2CIP_STATUS_RFNE_SHIFT (3) 184 #define I2CIP_STATUS_RFNE_MASK ((0x1)<<I2CIP_STATUS_RFNE_SHIFT) 185 #define I2CIP_STATUS_TFE_SHIFT (2) 186 #define I2CIP_STATUS_TFE_MASK ((0x1)<<I2CIP_STATUS_TFE_SHIFT) 187 #define I2CIP_STATUS_TFNF_SHIFT (1) 188 #define I2CIP_STATUS_TFNF_MASK ((0x1)<<I2CIP_STATUS_TFNF_SHIFT) 189 #define I2CIP_STATUS_ACT_SHIFT (0) 190 #define I2CIP_STATUS_ACT_MASK ((0x1)<<I2CIP_STATUS_ACT_SHIFT) 191 192 /* i2c interrupt mask register */ 193 #define I2CIP_INT_MASK_REG_OFFSET 0x30 194 #define I2CIP_INT_MASK_GEN_CALL_SHIFT (11) 195 #define I2CIP_INT_MASK_GEN_CALL_MASK ((0x1)<<I2CIP_INT_MASK_GEN_CALL_SHIFT) 196 #define I2CIP_INT_MASK_START_DET_SHIFT (10) 197 #define I2CIP_INT_MASK_START_DET_MASK ((0x1)<<I2CIP_INT_MASK_START_DET_SHIFT) 198 #define I2CIP_INT_MASK_STOP_DET_SHIFT (9) 199 #define I2CIP_INT_MASK_STOP_DET_MASK ((0x1)<<I2CIP_INT_MASK_STOP_DET_SHIFT) 200 #define I2CIP_INT_MASK_ACTIVITY_SHIFT (8) 201 #define I2CIP_INT_MASK_ACTIVITY_MASK ((0x1)<<I2CIP_INT_MASK_ACTIVITY_SHIFT) 202 #define I2CIP_INT_MASK_RX_DONE_SHIFT (7) 203 #define I2CIP_INT_MASK_RX_DONE_MASK ((0x1)<<I2CIP_INT_MASK_RX_DONE_SHIFT) 204 #define I2CIP_INT_MASK_TX_ABRT_SHIFT (6) 205 #define I2CIP_INT_MASK_TX_ABRT_MASK ((0x1)<<I2CIP_INT_MASK_TX_ABRT_SHIFT) 206 #define I2CIP_INT_MASK_RD_REQ_SHIFT (5) 207 #define I2CIP_INT_MASK_RD_REQ_MASK ((0x1)<<I2CIP_INT_MASK_RD_REQ_SHIFT) 208 #define I2CIP_INT_MASK_TX_EMPTY_SHIFT (4) 209 #define I2CIP_INT_MASK_TX_EMPTY_MASK ((0x1)<<I2CIP_INT_MASK_TX_EMPTY_SHIFT) 210 #define I2CIP_INT_MASK_TX_OVER_SHIFT (3) 211 #define I2CIP_INT_MASK_TX_OVER_MASK ((0x1)<<I2CIP_INT_MASK_TX_OVER_SHIFT) 212 #define I2CIP_INT_MASK_RX_FULL_SHIFT (2) 213 #define I2CIP_INT_MASK_RX_FULL_MASK ((0x1)<<I2CIP_INT_MASK_RX_FULL_SHIFT) 214 #define I2CIP_INT_MASK_RX_OVER_SHIFT (1) 215 #define I2CIP_INT_MASK_RX_OVER_MASK ((0x1)<<I2CIP_INT_MASK_RX_OVER_SHIFT) 216 #define I2CIP_INT_MASK_RX_UNDER_SHIFT (0) 217 #define I2CIP_INT_MASK_RX_UNDER_MASK ((0x1)<<I2CIP_INT_MASK_RX_UNDER_SHIFT) 218 #define I2CIP_INT_UNMASK_ALL (0) 219 #define I2CIP_INT_MASK_ALL \ 220 (I2CIP_INT_MASK_GEN_CALL_MASK | \ 221 I2CIP_INT_MASK_START_DET_MASK | \ 222 I2CIP_INT_MASK_STOP_DET_MASK | \ 223 I2CIP_INT_MASK_ACTIVITY_MASK | \ 224 I2CIP_INT_MASK_RX_DONE_MASK | \ 225 I2CIP_INT_MASK_TX_ABRT_MASK | \ 226 I2CIP_INT_MASK_RD_REQ_MASK | \ 227 I2CIP_INT_MASK_TX_EMPTY_MASK | \ 228 I2CIP_INT_MASK_TX_OVER_MASK | \ 229 I2CIP_INT_MASK_RX_FULL_MASK | \ 230 I2CIP_INT_MASK_RX_OVER_MASK | \ 231 I2CIP_INT_MASK_RX_UNDER_MASK) 232 #define I2CIP_INT_MASK_ERROR_MASK \ 233 (I2CIP_INT_MASK_TX_ABRT_MASK | \ 234 I2CIP_INT_MASK_TX_OVER_MASK | \ 235 I2CIP_INT_MASK_RX_OVER_MASK | \ 236 I2CIP_INT_MASK_RX_UNDER_MASK) 237 238 /* i2c enable status register definitions */ 239 #define I2CIP_ENABLE_STATUS_REG_OFFSET 0x9c 240 #define I2CIP_ENABLE_STATUS_ENABLE_SHIFT 0 241 #define I2CIP_ENABLE_STATUS_ENABLE_MASK ((0x1)<<I2CIP_ENABLE_STATUS_ENABLE_SHIFT) 242 243 /* i2c tx fifo level register definitions */ 244 #define I2CIP_TX_FIFO_LEVEL_REG_OFFSET 0x74 245 246 /* i2c rx fifo level register definitions */ 247 #define I2CIP_RX_FIFO_LEVEL_REG_OFFSET 0x78 248 /* i2c sda hold time register */ 249 #define I2CIP_SDA_HOLD_REG_OFFSET 0x7c 250 251 /* i2c clear all intr register */ 252 #define I2CIP_CLR_ALL_INTR_REG_OFFSET 0x40 253 /* i2c clear rx under register */ 254 #define I2CIP_CLR_RX_UNDER_REG_OFFSET 0x44 255 /* i2c clear rx over register */ 256 #define I2CIP_CLR_RX_OVER_REG_OFFSET 0x48 257 /* i2c clear tx over register */ 258 #define I2CIP_CLR_TX_OVER_REG_OFFSET 0x4c 259 /* i2c clear rd req register */ 260 #define I2CIP_CLR_RD_REQ_REG_OFFSET 0x50 261 /* i2c clear tx abrt register */ 262 #define I2CIP_CLR_TX_ABRT_REG_OFFSET 0x54 263 /* i2c clear rx done register */ 264 #define I2CIP_CLR_RX_DONE_REG_OFFSET 0x58 265 /* i2c clear activity register */ 266 #define I2CIP_CLR_ACTIVITY_REG_OFFSET 0x5c 267 /* i2c clear stop det register */ 268 #define I2CIP_CLR_STOP_DET_REG_OFFSET 0x60 269 /* i2c clear start det register */ 270 #define I2CIP_CLR_START_DET_REG_OFFSET 0x64 271 /* i2c clear gen call register */ 272 #define I2CIP_CLR_GEN_CALL_REG_OFFSET 0x68 273 274 /* i2c tx abrt source register */ 275 #define I2CIP_TX_ABRT_SOURCE_REG_OFFSET 0x80 276 #define I2CIP_TX_ABRT_SOURCE_ABRT_SLVRD_INTX_SHIFT (15) 277 #define I2CIP_TX_ABRT_SOURCE_ABRT_SLVRD_INTX_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_SLVRD_INTX_SHIFT) 278 #define I2CIP_TX_ABRT_SOURCE_ABRT_SLV_ARBLOST_SHIFT (14) 279 #define I2CIP_TX_ABRT_SOURCE_ABRT_SLV_ARBLOST_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_SLV_ARBLOST_SHIFT) 280 #define I2CIP_TX_ABRT_SOURCE_ABRT_SLVFLUSH_TXFIFO_SHIFT (13) 281 #define I2CIP_TX_ABRT_SOURCE_ABRT_SLVFLUSH_TXFIFO_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_SLVFLUSH_TXFIFO_SHIFT) 282 #define I2CIP_TX_ABRT_SOURCE_ARB_LOST_SHIFT (12) 283 #define I2CIP_TX_ABRT_SOURCE_ARB_LOST_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ARB_LOST_SHIFT) 284 #define I2CIP_TX_ABRT_SOURCE_ABRT_MASTER_DIS_SHIFT (11) 285 #define I2CIP_TX_ABRT_SOURCE_ABRT_MASTER_DIS_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_MASTER_DIS_SHIFT) 286 #define I2CIP_TX_ABRT_SOURCE_ABRT_10B_RD_NORSTRT_SHIFT (10) 287 #define I2CIP_TX_ABRT_SOURCE_ABRT_10B_RD_NORSTRT_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_10B_RD_NORSTRT_SHIFT) 288 #define I2CIP_TX_ABRT_SOURCE_ABRT_SBYTE_NORSTRT_SHIFT (9) 289 #define I2CIP_TX_ABRT_SOURCE_ABRT_SBYTE_NORSTRT_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_SBYTE_NORSTRT_SHIFT) 290 #define I2CIP_TX_ABRT_SOURCE_ABRT_HS_NORSTRT_SHIFT (8) 291 #define I2CIP_TX_ABRT_SOURCE_ABRT_HS_NORSTRT_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_HS_NORSTRT_SHIFT) 292 #define I2CIP_TX_ABRT_SOURCE_ABRT_SBYTE_ACKDET_SHIFT (7) 293 #define I2CIP_TX_ABRT_SOURCE_ABRT_SBYTE_ACKDET_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_SBYTE_ACKDET_SHIFT) 294 #define I2CIP_TX_ABRT_SOURCE_ABRT_HS_ACKDET_SHIFT (6) 295 #define I2CIP_TX_ABRT_SOURCE_ABRT_HS_ACKDET_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_HS_ACKDET_SHIFT) 296 #define I2CIP_TX_ABRT_SOURCE_ABRT_GCALL_READ_SHIFT (5) 297 #define I2CIP_TX_ABRT_SOURCE_ABRT_GCALL_READ_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_GCALL_READ_SHIFT) 298 #define I2CIP_TX_ABRT_SOURCE_ABRT_GCALL_NOACK_SHIFT (4) 299 #define I2CIP_TX_ABRT_SOURCE_ABRT_GCALL_NOACK_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_GCALL_NOACK_SHIFT) 300 #define I2CIP_TX_ABRT_SOURCE_ABRT_TXDATA_NOACK_SHIFT (3) 301 #define I2CIP_TX_ABRT_SOURCE_ABRT_TXDATA_NOACK_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_TXDATA_NOACK_SHIFT) 302 #define I2CIP_TX_ABRT_SOURCE_ABRT_10ADDR2_NOACK_SHIFT (2) 303 #define I2CIP_TX_ABRT_SOURCE_ABRT_10ADDR2_NOACK_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_10ADDR2_NOACK_SHIFT) 304 #define I2CIP_TX_ABRT_SOURCE_ABRT_10ADDR1_NOACK_SHIFT (1) 305 #define I2CIP_TX_ABRT_SOURCE_ABRT_10ADDR1_NOACK_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_10ADDR1_NOACK_SHIFT) 306 #define I2CIP_TX_ABRT_SOURCE_ABRT_7B_ADDR_NOACK_SHIFT (0) 307 #define I2CIP_TX_ABRT_SOURCE_ABRT_7B_ADDR_NOACK_MASK ((0x1)<<I2CIP_TX_ABRT_SOURCE_ABRT_7B_ADDR_NOACK_SHIFT) 308 309 /* i2c dma control register */ 310 #define I2CIP_DMA_CR_REG_OFFSET 0x88 311 #define I2CIP_DMA_CR_TDMAE_SHIFT (1) 312 #define I2CIP_DMA_CR_TDMAE_MASK ((0x1)<<I2CIP_DMA_CR_TDMAE_SHIFT) 313 #define I2CIP_DMA_CR_RDMAE_SHIFT (0) 314 #define I2CIP_DMA_CR_RDMAE_MASK ((0x1)<<I2CIP_DMA_CR_RDMAE_SHIFT) 315 316 /* i2c tx dma transfer threshold register */ 317 #define I2CIP_DMA_TX_TL_REG_OFFSET 0x8c 318 #define I2CIP_DMA_TX_TL_DEPTH (I2CIP_TX_FIFO_DEPTH) 319 #define I2CIP_DMA_TX_TL_HALF (I2CIP_DMA_TX_TL_DEPTH/2) 320 #define I2CIP_DMA_TX_TL_1_BYTE (1) 321 322 /* i2c rx dma transfer threshold register */ 323 #define I2CIP_DMA_RX_TL_REG_OFFSET 0x90 324 #define I2CIP_DMA_RX_TL_DEPTH (I2CIP_RX_FIFO_DEPTH) 325 #define I2CIP_DMA_RX_TL_HALF (I2CIP_DMA_RX_TL_DEPTH/2) 326 #define I2CIP_DMA_RX_TL_1_BYTE (1) 327 328 #define I2CIP_IC_ENABLE_STATUS_REG_OFFSET 0x9C 329 #define I2CIP_STATUS_IC_EN (1 << 0) 330 #define I2CIP_STATUS_SLV_RX_ABORTED (1 << 1) 331 #define I2CIP_STATUS_SLV_FIFO_FILLED_AND_FLUSHED (1 << 2) 332 333 #define I2CIP_IC_FS_SPKLEN_REG_OFFSET 0xA0 334 #define I2CIP_IC_FS_SPKLEN_SHIFT 0 335 #define I2CIP_IC_FS_SPKLEN_MASK (0xFF << I2CIP_IC_FS_SPKLEN_SHIFT) 336 #define I2CIP_IC_FS_SPKLEN(n) BITFIELD_VAL(I2CIP_IC_FS_SPKLEN, n) 337 338 #define I2CIP_IC_HS_SPKLEN_REG_OFFSET 0xA4 339 #define I2CIP_IC_HS_SPKLEN_SHIFT 0 340 #define I2CIP_IC_HS_SPKLEN_MASK (0xFF << I2CIP_IC_FS_SPKLEN_SHIFT) 341 #define I2CIP_IC_HS_SPKLEN(n) BITFIELD_VAL(I2CIP_IC_FS_SPKLEN, n) 342 343 #define I2CIP_IC_VAD_PATH_REG_OFFSET 0xA8 344 #define I2CIP_IC_PUSH_DATA_BYPASS (1 << 0) 345 346 /* Speed Selection */ 347 #define IC_SPEED_MODE_STANDARD 1 348 #define IC_SPEED_MODE_FAST 2 349 #define IC_SPEED_MODE_MAX 3 350 351 #define I2C_MAX_SPEED 3400000 352 #define I2C_FSP_SPEED 1000000 353 #define I2C_FAST_SPEED 400000 354 #define I2C_STANDARD_SPEED 100000 355 356 #endif /* __REG_I2CIP_H_ */ 357