Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Microchip KSZ9477 register definitions
0004  *
0005  * Copyright (C) 2017-2018 Microchip Technology Inc.
0006  */
0007 
0008 #ifndef __KSZ9477_REGS_H
0009 #define __KSZ9477_REGS_H
0010 
0011 #define KS_PRIO_M           0x7
0012 #define KS_PRIO_S           4
0013 
0014 /* 0 - Operation */
0015 #define REG_CHIP_ID0__1         0x0000
0016 
0017 #define REG_CHIP_ID1__1         0x0001
0018 
0019 #define FAMILY_ID           0x95
0020 #define FAMILY_ID_94            0x94
0021 #define FAMILY_ID_95            0x95
0022 #define FAMILY_ID_85            0x85
0023 #define FAMILY_ID_98            0x98
0024 #define FAMILY_ID_88            0x88
0025 
0026 #define REG_CHIP_ID2__1         0x0002
0027 
0028 #define CHIP_ID_66          0x66
0029 #define CHIP_ID_67          0x67
0030 #define CHIP_ID_77          0x77
0031 #define CHIP_ID_93          0x93
0032 #define CHIP_ID_96          0x96
0033 #define CHIP_ID_97          0x97
0034 
0035 #define REG_CHIP_ID3__1         0x0003
0036 
0037 #define SWITCH_REVISION_M       0x0F
0038 #define SWITCH_REVISION_S       4
0039 #define SWITCH_RESET            0x01
0040 
0041 #define REG_SW_PME_CTRL         0x0006
0042 
0043 #define PME_ENABLE          BIT(1)
0044 #define PME_POLARITY            BIT(0)
0045 
0046 #define REG_GLOBAL_OPTIONS      0x000F
0047 
0048 #define SW_GIGABIT_ABLE         BIT(6)
0049 #define SW_REDUNDANCY_ABLE      BIT(5)
0050 #define SW_AVB_ABLE         BIT(4)
0051 #define SW_9567_RL_5_2          0xC
0052 #define SW_9477_SL_5_2          0xD
0053 
0054 #define SW_9896_GL_5_1          0xB
0055 #define SW_9896_RL_5_1          0x8
0056 #define SW_9896_SL_5_1          0x9
0057 
0058 #define SW_9895_GL_4_1          0x7
0059 #define SW_9895_RL_4_1          0x4
0060 #define SW_9895_SL_4_1          0x5
0061 
0062 #define SW_9896_RL_4_2          0x6
0063 
0064 #define SW_9893_RL_2_1          0x0
0065 #define SW_9893_SL_2_1          0x1
0066 #define SW_9893_GL_2_1          0x3
0067 
0068 #define SW_QW_ABLE          BIT(5)
0069 #define SW_9893_RN_2_1          0xC
0070 
0071 #define REG_SW_INT_STATUS__4        0x0010
0072 #define REG_SW_INT_MASK__4      0x0014
0073 
0074 #define LUE_INT             BIT(31)
0075 #define TRIG_TS_INT         BIT(30)
0076 #define APB_TIMEOUT_INT         BIT(29)
0077 
0078 #define SWITCH_INT_MASK         (TRIG_TS_INT | APB_TIMEOUT_INT)
0079 
0080 #define REG_SW_PORT_INT_STATUS__4   0x0018
0081 #define REG_SW_PORT_INT_MASK__4     0x001C
0082 #define REG_SW_PHY_INT_STATUS       0x0020
0083 #define REG_SW_PHY_INT_ENABLE       0x0024
0084 
0085 /* 1 - Global */
0086 #define REG_SW_GLOBAL_SERIAL_CTRL_0 0x0100
0087 #define SW_SPARE_REG_2          BIT(7)
0088 #define SW_SPARE_REG_1          BIT(6)
0089 #define SW_SPARE_REG_0          BIT(5)
0090 #define SW_BIG_ENDIAN           BIT(4)
0091 #define SPI_AUTO_EDGE_DETECTION     BIT(1)
0092 #define SPI_CLOCK_OUT_RISING_EDGE   BIT(0)
0093 
0094 #define REG_SW_GLOBAL_OUTPUT_CTRL__1    0x0103
0095 #define SW_ENABLE_REFCLKO       BIT(1)
0096 #define SW_REFCLKO_IS_125MHZ        BIT(0)
0097 
0098 #define REG_SW_IBA__4           0x0104
0099 
0100 #define SW_IBA_ENABLE           BIT(31)
0101 #define SW_IBA_DA_MATCH         BIT(30)
0102 #define SW_IBA_INIT         BIT(29)
0103 #define SW_IBA_QID_M            0xF
0104 #define SW_IBA_QID_S            22
0105 #define SW_IBA_PORT_M           0x2F
0106 #define SW_IBA_PORT_S           16
0107 #define SW_IBA_FRAME_TPID_M     0xFFFF
0108 
0109 #define REG_SW_APB_TIMEOUT_ADDR__4  0x0108
0110 
0111 #define APB_TIMEOUT_ACKNOWLEDGE     BIT(31)
0112 
0113 #define REG_SW_IBA_SYNC__1      0x010C
0114 
0115 #define REG_SW_IO_STRENGTH__1       0x010D
0116 #define SW_DRIVE_STRENGTH_M     0x7
0117 #define SW_DRIVE_STRENGTH_2MA       0
0118 #define SW_DRIVE_STRENGTH_4MA       1
0119 #define SW_DRIVE_STRENGTH_8MA       2
0120 #define SW_DRIVE_STRENGTH_12MA      3
0121 #define SW_DRIVE_STRENGTH_16MA      4
0122 #define SW_DRIVE_STRENGTH_20MA      5
0123 #define SW_DRIVE_STRENGTH_24MA      6
0124 #define SW_DRIVE_STRENGTH_28MA      7
0125 #define SW_HI_SPEED_DRIVE_STRENGTH_S    4
0126 #define SW_LO_SPEED_DRIVE_STRENGTH_S    0
0127 
0128 #define REG_SW_IBA_STATUS__4        0x0110
0129 
0130 #define SW_IBA_REQ          BIT(31)
0131 #define SW_IBA_RESP         BIT(30)
0132 #define SW_IBA_DA_MISMATCH      BIT(14)
0133 #define SW_IBA_FMT_MISMATCH     BIT(13)
0134 #define SW_IBA_CODE_ERROR       BIT(12)
0135 #define SW_IBA_CMD_ERROR        BIT(11)
0136 #define SW_IBA_CMD_LOC_M        (BIT(6) - 1)
0137 
0138 #define REG_SW_IBA_STATES__4        0x0114
0139 
0140 #define SW_IBA_BUF_STATE_S      30
0141 #define SW_IBA_CMD_STATE_S      28
0142 #define SW_IBA_RESP_STATE_S     26
0143 #define SW_IBA_STATE_M          0x3
0144 #define SW_IBA_PACKET_SIZE_M        0x7F
0145 #define SW_IBA_PACKET_SIZE_S        16
0146 #define SW_IBA_FMT_ID_M         0xFFFF
0147 
0148 #define REG_SW_IBA_RESULT__4        0x0118
0149 
0150 #define SW_IBA_SIZE_S           24
0151 
0152 #define SW_IBA_RETRY_CNT_M      (BIT(5) - 1)
0153 
0154 /* 2 - PHY */
0155 #define REG_SW_POWER_MANAGEMENT_CTRL    0x0201
0156 
0157 #define SW_PLL_POWER_DOWN       BIT(5)
0158 #define SW_POWER_DOWN_MODE      0x3
0159 #define SW_ENERGY_DETECTION     1
0160 #define SW_SOFT_POWER_DOWN      2
0161 #define SW_POWER_SAVING         3
0162 
0163 /* 3 - Operation Control */
0164 #define REG_SW_OPERATION        0x0300
0165 
0166 #define SW_DOUBLE_TAG           BIT(7)
0167 #define SW_RESET            BIT(1)
0168 
0169 #define REG_SW_MAC_ADDR_0       0x0302
0170 #define REG_SW_MAC_ADDR_1       0x0303
0171 #define REG_SW_MAC_ADDR_2       0x0304
0172 #define REG_SW_MAC_ADDR_3       0x0305
0173 #define REG_SW_MAC_ADDR_4       0x0306
0174 #define REG_SW_MAC_ADDR_5       0x0307
0175 
0176 #define REG_SW_MTU__2           0x0308
0177 #define REG_SW_MTU_MASK         GENMASK(13, 0)
0178 
0179 #define REG_SW_ISP_TPID__2      0x030A
0180 
0181 #define REG_SW_HSR_TPID__2      0x030C
0182 
0183 #define REG_AVB_STRATEGY__2     0x030E
0184 
0185 #define SW_SHAPING_CREDIT_ACCT      BIT(1)
0186 #define SW_POLICING_CREDIT_ACCT     BIT(0)
0187 
0188 #define REG_SW_LUE_CTRL_0       0x0310
0189 
0190 #define SW_VLAN_ENABLE          BIT(7)
0191 #define SW_DROP_INVALID_VID     BIT(6)
0192 #define SW_AGE_CNT_M            0x7
0193 #define SW_AGE_CNT_S            3
0194 #define SW_RESV_MCAST_ENABLE        BIT(2)
0195 #define SW_HASH_OPTION_M        0x03
0196 #define SW_HASH_OPTION_CRC      1
0197 #define SW_HASH_OPTION_XOR      2
0198 #define SW_HASH_OPTION_DIRECT       3
0199 
0200 #define REG_SW_LUE_CTRL_1       0x0311
0201 
0202 #define UNICAST_LEARN_DISABLE       BIT(7)
0203 #define SW_SRC_ADDR_FILTER      BIT(6)
0204 #define SW_FLUSH_STP_TABLE      BIT(5)
0205 #define SW_FLUSH_MSTP_TABLE     BIT(4)
0206 #define SW_FWD_MCAST_SRC_ADDR       BIT(3)
0207 #define SW_AGING_ENABLE         BIT(2)
0208 #define SW_FAST_AGING           BIT(1)
0209 #define SW_LINK_AUTO_AGING      BIT(0)
0210 
0211 #define REG_SW_LUE_CTRL_2       0x0312
0212 
0213 #define SW_TRAP_DOUBLE_TAG      BIT(6)
0214 #define SW_EGRESS_VLAN_FILTER_DYN   BIT(5)
0215 #define SW_EGRESS_VLAN_FILTER_STA   BIT(4)
0216 #define SW_FLUSH_OPTION_M       0x3
0217 #define SW_FLUSH_OPTION_S       2
0218 #define SW_FLUSH_OPTION_DYN_MAC     1
0219 #define SW_FLUSH_OPTION_STA_MAC     2
0220 #define SW_FLUSH_OPTION_BOTH        3
0221 #define SW_PRIO_M           0x3
0222 #define SW_PRIO_DA          0
0223 #define SW_PRIO_SA          1
0224 #define SW_PRIO_HIGHEST_DA_SA       2
0225 #define SW_PRIO_LOWEST_DA_SA        3
0226 
0227 #define REG_SW_LUE_CTRL_3       0x0313
0228 
0229 #define REG_SW_LUE_INT_STATUS       0x0314
0230 #define REG_SW_LUE_INT_ENABLE       0x0315
0231 
0232 #define LEARN_FAIL_INT          BIT(2)
0233 #define ALMOST_FULL_INT         BIT(1)
0234 #define WRITE_FAIL_INT          BIT(0)
0235 
0236 #define REG_SW_LUE_INDEX_0__2       0x0316
0237 
0238 #define ENTRY_INDEX_M           0x0FFF
0239 
0240 #define REG_SW_LUE_INDEX_1__2       0x0318
0241 
0242 #define FAIL_INDEX_M            0x03FF
0243 
0244 #define REG_SW_LUE_INDEX_2__2       0x031A
0245 
0246 #define REG_SW_LUE_UNK_UCAST_CTRL__4    0x0320
0247 
0248 #define SW_UNK_UCAST_ENABLE     BIT(31)
0249 
0250 #define REG_SW_LUE_UNK_MCAST_CTRL__4    0x0324
0251 
0252 #define SW_UNK_MCAST_ENABLE     BIT(31)
0253 
0254 #define REG_SW_LUE_UNK_VID_CTRL__4  0x0328
0255 
0256 #define SW_UNK_VID_ENABLE       BIT(31)
0257 
0258 #define REG_SW_MAC_CTRL_0       0x0330
0259 
0260 #define SW_NEW_BACKOFF          BIT(7)
0261 #define SW_CHECK_LENGTH         BIT(3)
0262 #define SW_PAUSE_UNH_MODE       BIT(1)
0263 #define SW_AGGR_BACKOFF         BIT(0)
0264 
0265 #define REG_SW_MAC_CTRL_1       0x0331
0266 
0267 #define SW_BACK_PRESSURE        BIT(5)
0268 #define FAIR_FLOW_CTRL          BIT(4)
0269 #define NO_EXC_COLLISION_DROP       BIT(3)
0270 #define SW_JUMBO_PACKET         BIT(2)
0271 #define SW_LEGAL_PACKET_DISABLE     BIT(1)
0272 #define SW_PASS_SHORT_FRAME     BIT(0)
0273 
0274 #define REG_SW_MAC_CTRL_2       0x0332
0275 
0276 #define SW_REPLACE_VID          BIT(3)
0277 
0278 #define REG_SW_MAC_CTRL_3       0x0333
0279 
0280 #define REG_SW_MAC_CTRL_4       0x0334
0281 
0282 #define SW_PASS_PAUSE           BIT(3)
0283 
0284 #define REG_SW_MAC_CTRL_5       0x0335
0285 
0286 #define SW_OUT_RATE_LIMIT_QUEUE_BASED   BIT(3)
0287 
0288 #define REG_SW_MAC_CTRL_6       0x0336
0289 
0290 #define SW_MIB_COUNTER_FLUSH        BIT(7)
0291 #define SW_MIB_COUNTER_FREEZE       BIT(6)
0292 
0293 #define REG_SW_MAC_802_1P_MAP_0     0x0338
0294 #define REG_SW_MAC_802_1P_MAP_1     0x0339
0295 #define REG_SW_MAC_802_1P_MAP_2     0x033A
0296 #define REG_SW_MAC_802_1P_MAP_3     0x033B
0297 
0298 #define SW_802_1P_MAP_M         KS_PRIO_M
0299 #define SW_802_1P_MAP_S         KS_PRIO_S
0300 
0301 #define REG_SW_MAC_ISP_CTRL     0x033C
0302 
0303 #define REG_SW_MAC_TOS_CTRL     0x033E
0304 
0305 #define SW_TOS_DSCP_REMARK      BIT(1)
0306 #define SW_TOS_DSCP_REMAP       BIT(0)
0307 
0308 #define REG_SW_MAC_TOS_PRIO_0       0x0340
0309 #define REG_SW_MAC_TOS_PRIO_1       0x0341
0310 #define REG_SW_MAC_TOS_PRIO_2       0x0342
0311 #define REG_SW_MAC_TOS_PRIO_3       0x0343
0312 #define REG_SW_MAC_TOS_PRIO_4       0x0344
0313 #define REG_SW_MAC_TOS_PRIO_5       0x0345
0314 #define REG_SW_MAC_TOS_PRIO_6       0x0346
0315 #define REG_SW_MAC_TOS_PRIO_7       0x0347
0316 #define REG_SW_MAC_TOS_PRIO_8       0x0348
0317 #define REG_SW_MAC_TOS_PRIO_9       0x0349
0318 #define REG_SW_MAC_TOS_PRIO_10      0x034A
0319 #define REG_SW_MAC_TOS_PRIO_11      0x034B
0320 #define REG_SW_MAC_TOS_PRIO_12      0x034C
0321 #define REG_SW_MAC_TOS_PRIO_13      0x034D
0322 #define REG_SW_MAC_TOS_PRIO_14      0x034E
0323 #define REG_SW_MAC_TOS_PRIO_15      0x034F
0324 #define REG_SW_MAC_TOS_PRIO_16      0x0350
0325 #define REG_SW_MAC_TOS_PRIO_17      0x0351
0326 #define REG_SW_MAC_TOS_PRIO_18      0x0352
0327 #define REG_SW_MAC_TOS_PRIO_19      0x0353
0328 #define REG_SW_MAC_TOS_PRIO_20      0x0354
0329 #define REG_SW_MAC_TOS_PRIO_21      0x0355
0330 #define REG_SW_MAC_TOS_PRIO_22      0x0356
0331 #define REG_SW_MAC_TOS_PRIO_23      0x0357
0332 #define REG_SW_MAC_TOS_PRIO_24      0x0358
0333 #define REG_SW_MAC_TOS_PRIO_25      0x0359
0334 #define REG_SW_MAC_TOS_PRIO_26      0x035A
0335 #define REG_SW_MAC_TOS_PRIO_27      0x035B
0336 #define REG_SW_MAC_TOS_PRIO_28      0x035C
0337 #define REG_SW_MAC_TOS_PRIO_29      0x035D
0338 #define REG_SW_MAC_TOS_PRIO_30      0x035E
0339 #define REG_SW_MAC_TOS_PRIO_31      0x035F
0340 
0341 #define REG_SW_MRI_CTRL_0       0x0370
0342 
0343 #define SW_IGMP_SNOOP           BIT(6)
0344 #define SW_IPV6_MLD_OPTION      BIT(3)
0345 #define SW_IPV6_MLD_SNOOP       BIT(2)
0346 #define SW_MIRROR_RX_TX         BIT(0)
0347 
0348 #define REG_SW_CLASS_D_IP_CTRL__4   0x0374
0349 
0350 #define SW_CLASS_D_IP_ENABLE        BIT(31)
0351 
0352 #define REG_SW_MRI_CTRL_8       0x0378
0353 
0354 #define SW_NO_COLOR_S           6
0355 #define SW_RED_COLOR_S          4
0356 #define SW_YELLOW_COLOR_S       2
0357 #define SW_GREEN_COLOR_S        0
0358 #define SW_COLOR_M          0x3
0359 
0360 #define REG_SW_QM_CTRL__4       0x0390
0361 
0362 #define PRIO_SCHEME_SELECT_M        KS_PRIO_M
0363 #define PRIO_SCHEME_SELECT_S        6
0364 #define PRIO_MAP_3_HI           0
0365 #define PRIO_MAP_2_HI           2
0366 #define PRIO_MAP_0_LO           3
0367 #define UNICAST_VLAN_BOUNDARY       BIT(1)
0368 
0369 #define REG_SW_EEE_QM_CTRL__2       0x03C0
0370 
0371 #define REG_SW_EEE_TXQ_WAIT_TIME__2 0x03C2
0372 
0373 /* 4 - */
0374 #define REG_SW_VLAN_ENTRY__4        0x0400
0375 
0376 #define VLAN_VALID          BIT(31)
0377 #define VLAN_FORWARD_OPTION     BIT(27)
0378 #define VLAN_PRIO_M         KS_PRIO_M
0379 #define VLAN_PRIO_S         24
0380 #define VLAN_MSTP_M         0x7
0381 #define VLAN_MSTP_S         12
0382 #define VLAN_FID_M          0x7F
0383 
0384 #define REG_SW_VLAN_ENTRY_UNTAG__4  0x0404
0385 #define REG_SW_VLAN_ENTRY_PORTS__4  0x0408
0386 
0387 #define REG_SW_VLAN_ENTRY_INDEX__2  0x040C
0388 
0389 #define VLAN_INDEX_M            0x0FFF
0390 
0391 #define REG_SW_VLAN_CTRL        0x040E
0392 
0393 #define VLAN_START          BIT(7)
0394 #define VLAN_ACTION         0x3
0395 #define VLAN_WRITE          1
0396 #define VLAN_READ           2
0397 #define VLAN_CLEAR          3
0398 
0399 #define REG_SW_ALU_INDEX_0      0x0410
0400 
0401 #define ALU_FID_INDEX_S         16
0402 #define ALU_MAC_ADDR_HI         0xFFFF
0403 
0404 #define REG_SW_ALU_INDEX_1      0x0414
0405 
0406 #define ALU_DIRECT_INDEX_M      (BIT(12) - 1)
0407 
0408 #define REG_SW_ALU_CTRL__4      0x0418
0409 
0410 #define ALU_VALID_CNT_M         (BIT(14) - 1)
0411 #define ALU_VALID_CNT_S         16
0412 #define ALU_START           BIT(7)
0413 #define ALU_VALID           BIT(6)
0414 #define ALU_DIRECT          BIT(2)
0415 #define ALU_ACTION          0x3
0416 #define ALU_WRITE           1
0417 #define ALU_READ            2
0418 #define ALU_SEARCH          3
0419 
0420 #define REG_SW_ALU_STAT_CTRL__4     0x041C
0421 
0422 #define ALU_RESV_MCAST_INDEX_M      (BIT(6) - 1)
0423 #define ALU_STAT_START          BIT(7)
0424 #define ALU_RESV_MCAST_ADDR     BIT(1)
0425 
0426 #define REG_SW_ALU_VAL_A        0x0420
0427 
0428 #define ALU_V_STATIC_VALID      BIT(31)
0429 #define ALU_V_SRC_FILTER        BIT(30)
0430 #define ALU_V_DST_FILTER        BIT(29)
0431 #define ALU_V_PRIO_AGE_CNT_M        (BIT(3) - 1)
0432 #define ALU_V_PRIO_AGE_CNT_S        26
0433 #define ALU_V_MSTP_M            0x7
0434 
0435 #define REG_SW_ALU_VAL_B        0x0424
0436 
0437 #define ALU_V_OVERRIDE          BIT(31)
0438 #define ALU_V_USE_FID           BIT(30)
0439 #define ALU_V_PORT_MAP          (BIT(24) - 1)
0440 
0441 #define REG_SW_ALU_VAL_C        0x0428
0442 
0443 #define ALU_V_FID_M         (BIT(16) - 1)
0444 #define ALU_V_FID_S         16
0445 #define ALU_V_MAC_ADDR_HI       0xFFFF
0446 
0447 #define REG_SW_ALU_VAL_D        0x042C
0448 
0449 #define REG_HSR_ALU_INDEX_0     0x0440
0450 
0451 #define REG_HSR_ALU_INDEX_1     0x0444
0452 
0453 #define HSR_DST_MAC_INDEX_LO_S      16
0454 #define HSR_SRC_MAC_INDEX_HI        0xFFFF
0455 
0456 #define REG_HSR_ALU_INDEX_2     0x0448
0457 
0458 #define HSR_INDEX_MAX           BIT(9)
0459 #define HSR_DIRECT_INDEX_M      (HSR_INDEX_MAX - 1)
0460 
0461 #define REG_HSR_ALU_INDEX_3     0x044C
0462 
0463 #define HSR_PATH_INDEX_M        (BIT(4) - 1)
0464 
0465 #define REG_HSR_ALU_CTRL__4     0x0450
0466 
0467 #define HSR_VALID_CNT_M         (BIT(14) - 1)
0468 #define HSR_VALID_CNT_S         16
0469 #define HSR_START           BIT(7)
0470 #define HSR_VALID           BIT(6)
0471 #define HSR_SEARCH_END          BIT(5)
0472 #define HSR_DIRECT          BIT(2)
0473 #define HSR_ACTION          0x3
0474 #define HSR_WRITE           1
0475 #define HSR_READ            2
0476 #define HSR_SEARCH          3
0477 
0478 #define REG_HSR_ALU_VAL_A       0x0454
0479 
0480 #define HSR_V_STATIC_VALID      BIT(31)
0481 #define HSR_V_AGE_CNT_M         (BIT(3) - 1)
0482 #define HSR_V_AGE_CNT_S         26
0483 #define HSR_V_PATH_ID_M         (BIT(4) - 1)
0484 
0485 #define REG_HSR_ALU_VAL_B       0x0458
0486 
0487 #define REG_HSR_ALU_VAL_C       0x045C
0488 
0489 #define HSR_V_DST_MAC_ADDR_LO_S     16
0490 #define HSR_V_SRC_MAC_ADDR_HI       0xFFFF
0491 
0492 #define REG_HSR_ALU_VAL_D       0x0460
0493 
0494 #define REG_HSR_ALU_VAL_E       0x0464
0495 
0496 #define HSR_V_START_SEQ_1_S     16
0497 #define HSR_V_START_SEQ_2_S     0
0498 
0499 #define REG_HSR_ALU_VAL_F       0x0468
0500 
0501 #define HSR_V_EXP_SEQ_1_S       16
0502 #define HSR_V_EXP_SEQ_2_S       0
0503 
0504 #define REG_HSR_ALU_VAL_G       0x046C
0505 
0506 #define HSR_V_SEQ_CNT_1_S       16
0507 #define HSR_V_SEQ_CNT_2_S       0
0508 
0509 #define HSR_V_SEQ_M         (BIT(16) - 1)
0510 
0511 /* 5 - PTP Clock */
0512 #define REG_PTP_CLK_CTRL        0x0500
0513 
0514 #define PTP_STEP_ADJ            BIT(6)
0515 #define PTP_STEP_DIR            BIT(5)
0516 #define PTP_READ_TIME           BIT(4)
0517 #define PTP_LOAD_TIME           BIT(3)
0518 #define PTP_CLK_ADJ_ENABLE      BIT(2)
0519 #define PTP_CLK_ENABLE          BIT(1)
0520 #define PTP_CLK_RESET           BIT(0)
0521 
0522 #define REG_PTP_RTC_SUB_NANOSEC__2  0x0502
0523 
0524 #define PTP_RTC_SUB_NANOSEC_M       0x0007
0525 
0526 #define REG_PTP_RTC_NANOSEC     0x0504
0527 #define REG_PTP_RTC_NANOSEC_H       0x0504
0528 #define REG_PTP_RTC_NANOSEC_L       0x0506
0529 
0530 #define REG_PTP_RTC_SEC         0x0508
0531 #define REG_PTP_RTC_SEC_H       0x0508
0532 #define REG_PTP_RTC_SEC_L       0x050A
0533 
0534 #define REG_PTP_SUBNANOSEC_RATE     0x050C
0535 #define REG_PTP_SUBNANOSEC_RATE_H   0x050C
0536 
0537 #define PTP_RATE_DIR            BIT(31)
0538 #define PTP_TMP_RATE_ENABLE     BIT(30)
0539 
0540 #define REG_PTP_SUBNANOSEC_RATE_L   0x050E
0541 
0542 #define REG_PTP_RATE_DURATION       0x0510
0543 #define REG_PTP_RATE_DURATION_H     0x0510
0544 #define REG_PTP_RATE_DURATION_L     0x0512
0545 
0546 #define REG_PTP_MSG_CONF1       0x0514
0547 
0548 #define PTP_802_1AS         BIT(7)
0549 #define PTP_ENABLE          BIT(6)
0550 #define PTP_ETH_ENABLE          BIT(5)
0551 #define PTP_IPV4_UDP_ENABLE     BIT(4)
0552 #define PTP_IPV6_UDP_ENABLE     BIT(3)
0553 #define PTP_TC_P2P          BIT(2)
0554 #define PTP_MASTER          BIT(1)
0555 #define PTP_1STEP           BIT(0)
0556 
0557 #define REG_PTP_MSG_CONF2       0x0516
0558 
0559 #define PTP_UNICAST_ENABLE      BIT(12)
0560 #define PTP_ALTERNATE_MASTER        BIT(11)
0561 #define PTP_ALL_HIGH_PRIO       BIT(10)
0562 #define PTP_SYNC_CHECK          BIT(9)
0563 #define PTP_DELAY_CHECK         BIT(8)
0564 #define PTP_PDELAY_CHECK        BIT(7)
0565 #define PTP_DROP_SYNC_DELAY_REQ     BIT(5)
0566 #define PTP_DOMAIN_CHECK        BIT(4)
0567 #define PTP_UDP_CHECKSUM        BIT(2)
0568 
0569 #define REG_PTP_DOMAIN_VERSION      0x0518
0570 #define PTP_VERSION_M           0xFF00
0571 #define PTP_DOMAIN_M            0x00FF
0572 
0573 #define REG_PTP_UNIT_INDEX__4       0x0520
0574 
0575 #define PTP_UNIT_M          0xF
0576 
0577 #define PTP_GPIO_INDEX_S        16
0578 #define PTP_TSI_INDEX_S         8
0579 #define PTP_TOU_INDEX_S         0
0580 
0581 #define REG_PTP_TRIG_STATUS__4      0x0524
0582 
0583 #define TRIG_ERROR_S            16
0584 #define TRIG_DONE_S         0
0585 
0586 #define REG_PTP_INT_STATUS__4       0x0528
0587 
0588 #define TRIG_INT_S          16
0589 #define TS_INT_S            0
0590 
0591 #define TRIG_UNIT_M         0x7
0592 #define TS_UNIT_M           0x3
0593 
0594 #define REG_PTP_CTRL_STAT__4        0x052C
0595 
0596 #define GPIO_IN             BIT(7)
0597 #define GPIO_OUT            BIT(6)
0598 #define TS_INT_ENABLE           BIT(5)
0599 #define TRIG_ACTIVE         BIT(4)
0600 #define TRIG_ENABLE         BIT(3)
0601 #define TRIG_RESET          BIT(2)
0602 #define TS_ENABLE           BIT(1)
0603 #define TS_RESET            BIT(0)
0604 
0605 #define GPIO_CTRL_M         (GPIO_IN | GPIO_OUT)
0606 
0607 #define TRIG_CTRL_M         \
0608     (TRIG_ACTIVE | TRIG_ENABLE | TRIG_RESET)
0609 
0610 #define TS_CTRL_M           \
0611     (TS_INT_ENABLE | TS_ENABLE | TS_RESET)
0612 
0613 #define REG_TRIG_TARGET_NANOSEC     0x0530
0614 #define REG_TRIG_TARGET_SEC     0x0534
0615 
0616 #define REG_TRIG_CTRL__4        0x0538
0617 
0618 #define TRIG_CASCADE_ENABLE     BIT(31)
0619 #define TRIG_CASCADE_TAIL       BIT(30)
0620 #define TRIG_CASCADE_UPS_M      0xF
0621 #define TRIG_CASCADE_UPS_S      26
0622 #define TRIG_NOW            BIT(25)
0623 #define TRIG_NOTIFY         BIT(24)
0624 #define TRIG_EDGE           BIT(23)
0625 #define TRIG_PATTERN_S          20
0626 #define TRIG_PATTERN_M          0x7
0627 #define TRIG_NEG_EDGE           0
0628 #define TRIG_POS_EDGE           1
0629 #define TRIG_NEG_PULSE          2
0630 #define TRIG_POS_PULSE          3
0631 #define TRIG_NEG_PERIOD         4
0632 #define TRIG_POS_PERIOD         5
0633 #define TRIG_REG_OUTPUT         6
0634 #define TRIG_GPO_S          16
0635 #define TRIG_GPO_M          0xF
0636 #define TRIG_CASCADE_ITERATE_CNT_M  0xFFFF
0637 
0638 #define REG_TRIG_CYCLE_WIDTH        0x053C
0639 
0640 #define REG_TRIG_CYCLE_CNT      0x0540
0641 
0642 #define TRIG_CYCLE_CNT_M        0xFFFF
0643 #define TRIG_CYCLE_CNT_S        16
0644 #define TRIG_BIT_PATTERN_M      0xFFFF
0645 
0646 #define REG_TRIG_ITERATE_TIME       0x0544
0647 
0648 #define REG_TRIG_PULSE_WIDTH__4     0x0548
0649 
0650 #define TRIG_PULSE_WIDTH_M      0x00FFFFFF
0651 
0652 #define REG_TS_CTRL_STAT__4     0x0550
0653 
0654 #define TS_EVENT_DETECT_M       0xF
0655 #define TS_EVENT_DETECT_S       17
0656 #define TS_EVENT_OVERFLOW       BIT(16)
0657 #define TS_GPI_M            0xF
0658 #define TS_GPI_S            8
0659 #define TS_DETECT_RISE          BIT(7)
0660 #define TS_DETECT_FALL          BIT(6)
0661 #define TS_DETECT_S         6
0662 #define TS_CASCADE_TAIL         BIT(5)
0663 #define TS_CASCADE_UPS_M        0xF
0664 #define TS_CASCADE_UPS_S        1
0665 #define TS_CASCADE_ENABLE       BIT(0)
0666 
0667 #define DETECT_RISE         (TS_DETECT_RISE >> TS_DETECT_S)
0668 #define DETECT_FALL         (TS_DETECT_FALL >> TS_DETECT_S)
0669 
0670 #define REG_TS_EVENT_0_NANOSEC      0x0554
0671 #define REG_TS_EVENT_0_SEC      0x0558
0672 #define REG_TS_EVENT_0_SUB_NANOSEC  0x055C
0673 
0674 #define REG_TS_EVENT_1_NANOSEC      0x0560
0675 #define REG_TS_EVENT_1_SEC      0x0564
0676 #define REG_TS_EVENT_1_SUB_NANOSEC  0x0568
0677 
0678 #define REG_TS_EVENT_2_NANOSEC      0x056C
0679 #define REG_TS_EVENT_2_SEC      0x0570
0680 #define REG_TS_EVENT_2_SUB_NANOSEC  0x0574
0681 
0682 #define REG_TS_EVENT_3_NANOSEC      0x0578
0683 #define REG_TS_EVENT_3_SEC      0x057C
0684 #define REG_TS_EVENT_3_SUB_NANOSEC  0x0580
0685 
0686 #define REG_TS_EVENT_4_NANOSEC      0x0584
0687 #define REG_TS_EVENT_4_SEC      0x0588
0688 #define REG_TS_EVENT_4_SUB_NANOSEC  0x058C
0689 
0690 #define REG_TS_EVENT_5_NANOSEC      0x0590
0691 #define REG_TS_EVENT_5_SEC      0x0594
0692 #define REG_TS_EVENT_5_SUB_NANOSEC  0x0598
0693 
0694 #define REG_TS_EVENT_6_NANOSEC      0x059C
0695 #define REG_TS_EVENT_6_SEC      0x05A0
0696 #define REG_TS_EVENT_6_SUB_NANOSEC  0x05A4
0697 
0698 #define REG_TS_EVENT_7_NANOSEC      0x05A8
0699 #define REG_TS_EVENT_7_SEC      0x05AC
0700 #define REG_TS_EVENT_7_SUB_NANOSEC  0x05B0
0701 
0702 #define TS_EVENT_EDGE_M         0x1
0703 #define TS_EVENT_EDGE_S         30
0704 #define TS_EVENT_NANOSEC_M      (BIT(30) - 1)
0705 
0706 #define TS_EVENT_SUB_NANOSEC_M      0x7
0707 
0708 #define TS_EVENT_SAMPLE         \
0709     (REG_TS_EVENT_1_NANOSEC - REG_TS_EVENT_0_NANOSEC)
0710 
0711 #define PORT_CTRL_ADDR(port, addr)  ((addr) | (((port) + 1) << 12))
0712 
0713 #define REG_GLOBAL_RR_INDEX__1      0x0600
0714 
0715 /* DLR */
0716 #define REG_DLR_SRC_PORT__4     0x0604
0717 
0718 #define DLR_SRC_PORT_UNICAST        BIT(31)
0719 #define DLR_SRC_PORT_M          0x3
0720 #define DLR_SRC_PORT_BOTH       0
0721 #define DLR_SRC_PORT_EACH       1
0722 
0723 #define REG_DLR_IP_ADDR__4      0x0608
0724 
0725 #define REG_DLR_CTRL__1         0x0610
0726 
0727 #define DLR_RESET_SEQ_ID        BIT(3)
0728 #define DLR_BACKUP_AUTO_ON      BIT(2)
0729 #define DLR_BEACON_TX_ENABLE        BIT(1)
0730 #define DLR_ASSIST_ENABLE       BIT(0)
0731 
0732 #define REG_DLR_STATE__1        0x0611
0733 
0734 #define DLR_NODE_STATE_M        0x3
0735 #define DLR_NODE_STATE_S        1
0736 #define DLR_NODE_STATE_IDLE     0
0737 #define DLR_NODE_STATE_FAULT        1
0738 #define DLR_NODE_STATE_NORMAL       2
0739 #define DLR_RING_STATE_FAULT        0
0740 #define DLR_RING_STATE_NORMAL       1
0741 
0742 #define REG_DLR_PRECEDENCE__1       0x0612
0743 
0744 #define REG_DLR_BEACON_INTERVAL__4  0x0614
0745 
0746 #define REG_DLR_BEACON_TIMEOUT__4   0x0618
0747 
0748 #define REG_DLR_TIMEOUT_WINDOW__4   0x061C
0749 
0750 #define DLR_TIMEOUT_WINDOW_M        (BIT(22) - 1)
0751 
0752 #define REG_DLR_VLAN_ID__2      0x0620
0753 
0754 #define DLR_VLAN_ID_M           (BIT(12) - 1)
0755 
0756 #define REG_DLR_DEST_ADDR_0     0x0622
0757 #define REG_DLR_DEST_ADDR_1     0x0623
0758 #define REG_DLR_DEST_ADDR_2     0x0624
0759 #define REG_DLR_DEST_ADDR_3     0x0625
0760 #define REG_DLR_DEST_ADDR_4     0x0626
0761 #define REG_DLR_DEST_ADDR_5     0x0627
0762 
0763 #define REG_DLR_PORT_MAP__4     0x0628
0764 
0765 #define REG_DLR_CLASS__1        0x062C
0766 
0767 #define DLR_FRAME_QID_M         0x3
0768 
0769 /* HSR */
0770 #define REG_HSR_PORT_MAP__4     0x0640
0771 
0772 #define REG_HSR_ALU_CTRL_0__1       0x0644
0773 
0774 #define HSR_DUPLICATE_DISCARD       BIT(7)
0775 #define HSR_NODE_UNICAST        BIT(6)
0776 #define HSR_AGE_CNT_DEFAULT_M       0x7
0777 #define HSR_AGE_CNT_DEFAULT_S       3
0778 #define HSR_LEARN_MCAST_DISABLE     BIT(2)
0779 #define HSR_HASH_OPTION_M       0x3
0780 #define HSR_HASH_DISABLE        0
0781 #define HSR_HASH_UPPER_BITS     1
0782 #define HSR_HASH_LOWER_BITS     2
0783 #define HSR_HASH_XOR_BOTH_BITS      3
0784 
0785 #define REG_HSR_ALU_CTRL_1__1       0x0645
0786 
0787 #define HSR_LEARN_UCAST_DISABLE     BIT(7)
0788 #define HSR_FLUSH_TABLE         BIT(5)
0789 #define HSR_PROC_MCAST_SRC      BIT(3)
0790 #define HSR_AGING_ENABLE        BIT(2)
0791 
0792 #define REG_HSR_ALU_CTRL_2__2       0x0646
0793 
0794 #define REG_HSR_ALU_AGE_PERIOD__4   0x0648
0795 
0796 #define REG_HSR_ALU_INT_STATUS__1   0x064C
0797 #define REG_HSR_ALU_INT_MASK__1     0x064D
0798 
0799 #define HSR_WINDOW_OVERFLOW_INT     BIT(3)
0800 #define HSR_LEARN_FAIL_INT      BIT(2)
0801 #define HSR_ALMOST_FULL_INT     BIT(1)
0802 #define HSR_WRITE_FAIL_INT      BIT(0)
0803 
0804 #define REG_HSR_ALU_ENTRY_0__2      0x0650
0805 
0806 #define HSR_ENTRY_INDEX_M       (BIT(10) - 1)
0807 #define HSR_FAIL_INDEX_M        (BIT(8) - 1)
0808 
0809 #define REG_HSR_ALU_ENTRY_1__2      0x0652
0810 
0811 #define HSR_FAIL_LEARN_INDEX_M      (BIT(8) - 1)
0812 
0813 #define REG_HSR_ALU_ENTRY_3__2      0x0654
0814 
0815 #define HSR_CPU_ACCESS_ENTRY_INDEX_M    (BIT(8) - 1)
0816 
0817 /* 0 - Operation */
0818 #define REG_PORT_DEFAULT_VID        0x0000
0819 
0820 #define REG_PORT_CUSTOM_VID     0x0002
0821 #define REG_PORT_AVB_SR_1_VID       0x0004
0822 #define REG_PORT_AVB_SR_2_VID       0x0006
0823 
0824 #define REG_PORT_AVB_SR_1_TYPE      0x0008
0825 #define REG_PORT_AVB_SR_2_TYPE      0x000A
0826 
0827 #define REG_PORT_PME_STATUS     0x0013
0828 #define REG_PORT_PME_CTRL       0x0017
0829 
0830 #define PME_WOL_MAGICPKT        BIT(2)
0831 #define PME_WOL_LINKUP          BIT(1)
0832 #define PME_WOL_ENERGY          BIT(0)
0833 
0834 #define REG_PORT_INT_STATUS     0x001B
0835 #define REG_PORT_INT_MASK       0x001F
0836 
0837 #define PORT_SGMII_INT          BIT(3)
0838 #define PORT_PTP_INT            BIT(2)
0839 #define PORT_PHY_INT            BIT(1)
0840 #define PORT_ACL_INT            BIT(0)
0841 
0842 #define PORT_INT_MASK           \
0843     (PORT_SGMII_INT | PORT_PTP_INT | PORT_PHY_INT | PORT_ACL_INT)
0844 
0845 #define REG_PORT_CTRL_0         0x0020
0846 
0847 #define PORT_MAC_LOOPBACK       BIT(7)
0848 #define PORT_FORCE_TX_FLOW_CTRL     BIT(4)
0849 #define PORT_FORCE_RX_FLOW_CTRL     BIT(3)
0850 #define PORT_TAIL_TAG_ENABLE        BIT(2)
0851 #define PORT_QUEUE_SPLIT_ENABLE     0x3
0852 
0853 #define REG_PORT_CTRL_1         0x0021
0854 
0855 #define PORT_SRP_ENABLE         0x3
0856 
0857 #define REG_PORT_STATUS_0       0x0030
0858 
0859 #define PORT_INTF_SPEED_M       0x3
0860 #define PORT_INTF_SPEED_S       3
0861 #define PORT_INTF_FULL_DUPLEX       BIT(2)
0862 #define PORT_TX_FLOW_CTRL       BIT(1)
0863 #define PORT_RX_FLOW_CTRL       BIT(0)
0864 
0865 #define REG_PORT_STATUS_1       0x0034
0866 
0867 /* 1 - PHY */
0868 #define REG_PORT_PHY_CTRL       0x0100
0869 
0870 #define PORT_PHY_RESET          BIT(15)
0871 #define PORT_PHY_LOOPBACK       BIT(14)
0872 #define PORT_SPEED_100MBIT      BIT(13)
0873 #define PORT_AUTO_NEG_ENABLE        BIT(12)
0874 #define PORT_POWER_DOWN         BIT(11)
0875 #define PORT_ISOLATE            BIT(10)
0876 #define PORT_AUTO_NEG_RESTART       BIT(9)
0877 #define PORT_FULL_DUPLEX        BIT(8)
0878 #define PORT_COLLISION_TEST     BIT(7)
0879 #define PORT_SPEED_1000MBIT     BIT(6)
0880 
0881 #define REG_PORT_PHY_STATUS     0x0102
0882 
0883 #define PORT_100BT4_CAPABLE     BIT(15)
0884 #define PORT_100BTX_FD_CAPABLE      BIT(14)
0885 #define PORT_100BTX_CAPABLE     BIT(13)
0886 #define PORT_10BT_FD_CAPABLE        BIT(12)
0887 #define PORT_10BT_CAPABLE       BIT(11)
0888 #define PORT_EXTENDED_STATUS        BIT(8)
0889 #define PORT_MII_SUPPRESS_CAPABLE   BIT(6)
0890 #define PORT_AUTO_NEG_ACKNOWLEDGE   BIT(5)
0891 #define PORT_REMOTE_FAULT       BIT(4)
0892 #define PORT_AUTO_NEG_CAPABLE       BIT(3)
0893 #define PORT_LINK_STATUS        BIT(2)
0894 #define PORT_JABBER_DETECT      BIT(1)
0895 #define PORT_EXTENDED_CAPABILITY    BIT(0)
0896 
0897 #define REG_PORT_PHY_ID_HI      0x0104
0898 #define REG_PORT_PHY_ID_LO      0x0106
0899 
0900 #define KSZ9477_ID_HI           0x0022
0901 #define KSZ9477_ID_LO           0x1622
0902 
0903 #define REG_PORT_PHY_AUTO_NEGOTIATION   0x0108
0904 
0905 #define PORT_AUTO_NEG_NEXT_PAGE     BIT(15)
0906 #define PORT_AUTO_NEG_REMOTE_FAULT  BIT(13)
0907 #define PORT_AUTO_NEG_ASYM_PAUSE    BIT(11)
0908 #define PORT_AUTO_NEG_SYM_PAUSE     BIT(10)
0909 #define PORT_AUTO_NEG_100BT4        BIT(9)
0910 #define PORT_AUTO_NEG_100BTX_FD     BIT(8)
0911 #define PORT_AUTO_NEG_100BTX        BIT(7)
0912 #define PORT_AUTO_NEG_10BT_FD       BIT(6)
0913 #define PORT_AUTO_NEG_10BT      BIT(5)
0914 #define PORT_AUTO_NEG_SELECTOR      0x001F
0915 #define PORT_AUTO_NEG_802_3     0x0001
0916 
0917 #define PORT_AUTO_NEG_PAUSE     \
0918     (PORT_AUTO_NEG_ASYM_PAUSE | PORT_AUTO_NEG_SYM_PAUSE)
0919 
0920 #define REG_PORT_PHY_REMOTE_CAPABILITY  0x010A
0921 
0922 #define PORT_REMOTE_NEXT_PAGE       BIT(15)
0923 #define PORT_REMOTE_ACKNOWLEDGE     BIT(14)
0924 #define PORT_REMOTE_REMOTE_FAULT    BIT(13)
0925 #define PORT_REMOTE_ASYM_PAUSE      BIT(11)
0926 #define PORT_REMOTE_SYM_PAUSE       BIT(10)
0927 #define PORT_REMOTE_100BTX_FD       BIT(8)
0928 #define PORT_REMOTE_100BTX      BIT(7)
0929 #define PORT_REMOTE_10BT_FD     BIT(6)
0930 #define PORT_REMOTE_10BT        BIT(5)
0931 
0932 #define REG_PORT_PHY_1000_CTRL      0x0112
0933 
0934 #define PORT_AUTO_NEG_MANUAL        BIT(12)
0935 #define PORT_AUTO_NEG_MASTER        BIT(11)
0936 #define PORT_AUTO_NEG_MASTER_PREFERRED  BIT(10)
0937 #define PORT_AUTO_NEG_1000BT_FD     BIT(9)
0938 #define PORT_AUTO_NEG_1000BT        BIT(8)
0939 
0940 #define REG_PORT_PHY_1000_STATUS    0x0114
0941 
0942 #define PORT_MASTER_FAULT       BIT(15)
0943 #define PORT_LOCAL_MASTER       BIT(14)
0944 #define PORT_LOCAL_RX_OK        BIT(13)
0945 #define PORT_REMOTE_RX_OK       BIT(12)
0946 #define PORT_REMOTE_1000BT_FD       BIT(11)
0947 #define PORT_REMOTE_1000BT      BIT(10)
0948 #define PORT_REMOTE_IDLE_CNT_M      0x0F
0949 
0950 #define PORT_PHY_1000_STATIC_STATUS \
0951     (PORT_LOCAL_RX_OK |     \
0952     PORT_REMOTE_RX_OK |     \
0953     PORT_REMOTE_1000BT_FD |     \
0954     PORT_REMOTE_1000BT)
0955 
0956 #define REG_PORT_PHY_MMD_SETUP      0x011A
0957 
0958 #define PORT_MMD_OP_MODE_M      0x3
0959 #define PORT_MMD_OP_MODE_S      14
0960 #define PORT_MMD_OP_INDEX       0
0961 #define PORT_MMD_OP_DATA_NO_INCR    1
0962 #define PORT_MMD_OP_DATA_INCR_RW    2
0963 #define PORT_MMD_OP_DATA_INCR_W     3
0964 #define PORT_MMD_DEVICE_ID_M        0x1F
0965 
0966 #define MMD_SETUP(mode, dev)        \
0967     (((u16)(mode) << PORT_MMD_OP_MODE_S) | (dev))
0968 
0969 #define REG_PORT_PHY_MMD_INDEX_DATA 0x011C
0970 
0971 #define MMD_DEVICE_ID_DSP       1
0972 
0973 #define MMD_DSP_SQI_CHAN_A      0xAC
0974 #define MMD_DSP_SQI_CHAN_B      0xAD
0975 #define MMD_DSP_SQI_CHAN_C      0xAE
0976 #define MMD_DSP_SQI_CHAN_D      0xAF
0977 
0978 #define DSP_SQI_ERR_DETECTED        BIT(15)
0979 #define DSP_SQI_AVG_ERR         0x7FFF
0980 
0981 #define MMD_DEVICE_ID_COMMON        2
0982 
0983 #define MMD_DEVICE_ID_EEE_ADV       7
0984 
0985 #define MMD_EEE_ADV         0x3C
0986 #define EEE_ADV_100MBIT         BIT(1)
0987 #define EEE_ADV_1GBIT           BIT(2)
0988 
0989 #define MMD_EEE_LP_ADV          0x3D
0990 #define MMD_EEE_MSG_CODE        0x3F
0991 
0992 #define MMD_DEVICE_ID_AFED      0x1C
0993 
0994 #define REG_PORT_PHY_EXTENDED_STATUS    0x011E
0995 
0996 #define PORT_100BTX_FD_ABLE     BIT(15)
0997 #define PORT_100BTX_ABLE        BIT(14)
0998 #define PORT_10BT_FD_ABLE       BIT(13)
0999 #define PORT_10BT_ABLE          BIT(12)
1000 
1001 #define REG_PORT_SGMII_ADDR__4      0x0200
1002 #define PORT_SGMII_AUTO_INCR        BIT(23)
1003 #define PORT_SGMII_DEVICE_ID_M      0x1F
1004 #define PORT_SGMII_DEVICE_ID_S      16
1005 #define PORT_SGMII_ADDR_M       (BIT(21) - 1)
1006 
1007 #define REG_PORT_SGMII_DATA__4      0x0204
1008 #define PORT_SGMII_DATA_M       (BIT(16) - 1)
1009 
1010 #define MMD_DEVICE_ID_PMA       0x01
1011 #define MMD_DEVICE_ID_PCS       0x03
1012 #define MMD_DEVICE_ID_PHY_XS        0x04
1013 #define MMD_DEVICE_ID_DTE_XS        0x05
1014 #define MMD_DEVICE_ID_AN        0x07
1015 #define MMD_DEVICE_ID_VENDOR_CTRL   0x1E
1016 #define MMD_DEVICE_ID_VENDOR_MII    0x1F
1017 
1018 #define SR_MII              MMD_DEVICE_ID_VENDOR_MII
1019 
1020 #define MMD_SR_MII_CTRL         0x0000
1021 
1022 #define SR_MII_RESET            BIT(15)
1023 #define SR_MII_LOOPBACK         BIT(14)
1024 #define SR_MII_SPEED_100MBIT        BIT(13)
1025 #define SR_MII_AUTO_NEG_ENABLE      BIT(12)
1026 #define SR_MII_POWER_DOWN       BIT(11)
1027 #define SR_MII_AUTO_NEG_RESTART     BIT(9)
1028 #define SR_MII_FULL_DUPLEX      BIT(8)
1029 #define SR_MII_SPEED_1000MBIT       BIT(6)
1030 
1031 #define MMD_SR_MII_STATUS       0x0001
1032 #define MMD_SR_MII_ID_1         0x0002
1033 #define MMD_SR_MII_ID_2         0x0003
1034 #define MMD_SR_MII_AUTO_NEGOTIATION 0x0004
1035 
1036 #define SR_MII_AUTO_NEG_NEXT_PAGE   BIT(15)
1037 #define SR_MII_AUTO_NEG_REMOTE_FAULT_M  0x3
1038 #define SR_MII_AUTO_NEG_REMOTE_FAULT_S  12
1039 #define SR_MII_AUTO_NEG_NO_ERROR    0
1040 #define SR_MII_AUTO_NEG_OFFLINE     1
1041 #define SR_MII_AUTO_NEG_LINK_FAILURE    2
1042 #define SR_MII_AUTO_NEG_ERROR       3
1043 #define SR_MII_AUTO_NEG_PAUSE_M     0x3
1044 #define SR_MII_AUTO_NEG_PAUSE_S     7
1045 #define SR_MII_AUTO_NEG_NO_PAUSE    0
1046 #define SR_MII_AUTO_NEG_ASYM_PAUSE_TX   1
1047 #define SR_MII_AUTO_NEG_SYM_PAUSE   2
1048 #define SR_MII_AUTO_NEG_ASYM_PAUSE_RX   3
1049 #define SR_MII_AUTO_NEG_HALF_DUPLEX BIT(6)
1050 #define SR_MII_AUTO_NEG_FULL_DUPLEX BIT(5)
1051 
1052 #define MMD_SR_MII_REMOTE_CAPABILITY    0x0005
1053 #define MMD_SR_MII_AUTO_NEG_EXP     0x0006
1054 #define MMD_SR_MII_AUTO_NEG_EXT     0x000F
1055 
1056 #define MMD_SR_MII_DIGITAL_CTRL_1   0x8000
1057 
1058 #define MMD_SR_MII_AUTO_NEG_CTRL    0x8001
1059 
1060 #define SR_MII_8_BIT            BIT(8)
1061 #define SR_MII_SGMII_LINK_UP        BIT(4)
1062 #define SR_MII_TX_CFG_PHY_MASTER    BIT(3)
1063 #define SR_MII_PCS_MODE_M       0x3
1064 #define SR_MII_PCS_MODE_S       1
1065 #define SR_MII_PCS_SGMII        2
1066 #define SR_MII_AUTO_NEG_COMPLETE_INTR   BIT(0)
1067 
1068 #define MMD_SR_MII_AUTO_NEG_STATUS  0x8002
1069 
1070 #define SR_MII_STAT_LINK_UP     BIT(4)
1071 #define SR_MII_STAT_M           0x3
1072 #define SR_MII_STAT_S           2
1073 #define SR_MII_STAT_10_MBPS     0
1074 #define SR_MII_STAT_100_MBPS        1
1075 #define SR_MII_STAT_1000_MBPS       2
1076 #define SR_MII_STAT_FULL_DUPLEX     BIT(1)
1077 
1078 #define MMD_SR_MII_PHY_CTRL     0x80A0
1079 
1080 #define SR_MII_PHY_LANE_SEL_M       0xF
1081 #define SR_MII_PHY_LANE_SEL_S       8
1082 #define SR_MII_PHY_WRITE        BIT(1)
1083 #define SR_MII_PHY_START_BUSY       BIT(0)
1084 
1085 #define MMD_SR_MII_PHY_ADDR     0x80A1
1086 
1087 #define SR_MII_PHY_ADDR_M       (BIT(16) - 1)
1088 
1089 #define MMD_SR_MII_PHY_DATA     0x80A2
1090 
1091 #define SR_MII_PHY_DATA_M       (BIT(16) - 1)
1092 
1093 #define SR_MII_PHY_JTAG_CHIP_ID_HI  0x000C
1094 #define SR_MII_PHY_JTAG_CHIP_ID_LO  0x000D
1095 
1096 #define REG_PORT_PHY_REMOTE_LB_LED  0x0122
1097 
1098 #define PORT_REMOTE_LOOPBACK        BIT(8)
1099 #define PORT_LED_SELECT         (3 << 6)
1100 #define PORT_LED_CTRL           (3 << 4)
1101 #define PORT_LED_CTRL_TEST      BIT(3)
1102 #define PORT_10BT_PREAMBLE      BIT(2)
1103 #define PORT_LINK_MD_10BT_ENABLE    BIT(1)
1104 #define PORT_LINK_MD_PASS       BIT(0)
1105 
1106 #define REG_PORT_PHY_LINK_MD        0x0124
1107 
1108 #define PORT_START_CABLE_DIAG       BIT(15)
1109 #define PORT_TX_DISABLE         BIT(14)
1110 #define PORT_CABLE_DIAG_PAIR_M      0x3
1111 #define PORT_CABLE_DIAG_PAIR_S      12
1112 #define PORT_CABLE_DIAG_SELECT_M    0x3
1113 #define PORT_CABLE_DIAG_SELECT_S    10
1114 #define PORT_CABLE_DIAG_RESULT_M    0x3
1115 #define PORT_CABLE_DIAG_RESULT_S    8
1116 #define PORT_CABLE_STAT_NORMAL      0
1117 #define PORT_CABLE_STAT_OPEN        1
1118 #define PORT_CABLE_STAT_SHORT       2
1119 #define PORT_CABLE_STAT_FAILED      3
1120 #define PORT_CABLE_FAULT_COUNTER    0x00FF
1121 
1122 #define REG_PORT_PHY_PMA_STATUS     0x0126
1123 
1124 #define PORT_1000_LINK_GOOD     BIT(1)
1125 #define PORT_100_LINK_GOOD      BIT(0)
1126 
1127 #define REG_PORT_PHY_DIGITAL_STATUS 0x0128
1128 
1129 #define PORT_LINK_DETECT        BIT(14)
1130 #define PORT_SIGNAL_DETECT      BIT(13)
1131 #define PORT_PHY_STAT_MDI       BIT(12)
1132 #define PORT_PHY_STAT_MASTER        BIT(11)
1133 
1134 #define REG_PORT_PHY_RXER_COUNTER   0x012A
1135 
1136 #define REG_PORT_PHY_INT_ENABLE     0x0136
1137 #define REG_PORT_PHY_INT_STATUS     0x0137
1138 
1139 #define JABBER_INT          BIT(7)
1140 #define RX_ERR_INT          BIT(6)
1141 #define PAGE_RX_INT         BIT(5)
1142 #define PARALLEL_DETECT_FAULT_INT   BIT(4)
1143 #define LINK_PARTNER_ACK_INT        BIT(3)
1144 #define LINK_DOWN_INT           BIT(2)
1145 #define REMOTE_FAULT_INT        BIT(1)
1146 #define LINK_UP_INT         BIT(0)
1147 
1148 #define REG_PORT_PHY_DIGITAL_DEBUG_1    0x0138
1149 
1150 #define PORT_REG_CLK_SPEED_25_MHZ   BIT(14)
1151 #define PORT_PHY_FORCE_MDI      BIT(7)
1152 #define PORT_PHY_AUTO_MDIX_DISABLE  BIT(6)
1153 
1154 /* Same as PORT_PHY_LOOPBACK */
1155 #define PORT_PHY_PCS_LOOPBACK       BIT(0)
1156 
1157 #define REG_PORT_PHY_DIGITAL_DEBUG_2    0x013A
1158 
1159 #define REG_PORT_PHY_DIGITAL_DEBUG_3    0x013C
1160 
1161 #define PORT_100BT_FIXED_LATENCY    BIT(15)
1162 
1163 #define REG_PORT_PHY_PHY_CTRL       0x013E
1164 
1165 #define PORT_INT_PIN_HIGH       BIT(14)
1166 #define PORT_ENABLE_JABBER      BIT(9)
1167 #define PORT_STAT_SPEED_1000MBIT    BIT(6)
1168 #define PORT_STAT_SPEED_100MBIT     BIT(5)
1169 #define PORT_STAT_SPEED_10MBIT      BIT(4)
1170 #define PORT_STAT_FULL_DUPLEX       BIT(3)
1171 
1172 /* Same as PORT_PHY_STAT_MASTER */
1173 #define PORT_STAT_MASTER        BIT(2)
1174 #define PORT_RESET          BIT(1)
1175 #define PORT_LINK_STATUS_FAIL       BIT(0)
1176 
1177 /* 3 - xMII */
1178 #define PORT_SGMII_SEL          BIT(7)
1179 #define PORT_GRXC_ENABLE        BIT(0)
1180 
1181 #define PORT_RMII_CLK_SEL       BIT(7)
1182 #define PORT_MII_SEL_EDGE       BIT(5)
1183 
1184 /* 4 - MAC */
1185 #define REG_PORT_MAC_CTRL_0     0x0400
1186 
1187 #define PORT_BROADCAST_STORM        BIT(1)
1188 #define PORT_JUMBO_FRAME        BIT(0)
1189 
1190 #define REG_PORT_MAC_CTRL_1     0x0401
1191 
1192 #define PORT_BACK_PRESSURE      BIT(3)
1193 #define PORT_PASS_ALL           BIT(0)
1194 
1195 #define REG_PORT_MAC_CTRL_2     0x0402
1196 
1197 #define PORT_100BT_EEE_DISABLE      BIT(7)
1198 #define PORT_1000BT_EEE_DISABLE     BIT(6)
1199 
1200 #define REG_PORT_MAC_IN_RATE_LIMIT  0x0403
1201 
1202 #define PORT_IN_PORT_BASED_S        6
1203 #define PORT_RATE_PACKET_BASED_S    5
1204 #define PORT_IN_FLOW_CTRL_S     4
1205 #define PORT_COUNT_IFG_S        1
1206 #define PORT_COUNT_PREAMBLE_S       0
1207 #define PORT_IN_PORT_BASED      BIT(6)
1208 #define PORT_IN_PACKET_BASED        BIT(5)
1209 #define PORT_IN_FLOW_CTRL       BIT(4)
1210 #define PORT_IN_LIMIT_MODE_M        0x3
1211 #define PORT_IN_LIMIT_MODE_S        2
1212 #define PORT_IN_ALL         0
1213 #define PORT_IN_UNICAST         1
1214 #define PORT_IN_MULTICAST       2
1215 #define PORT_IN_BROADCAST       3
1216 #define PORT_COUNT_IFG          BIT(1)
1217 #define PORT_COUNT_PREAMBLE     BIT(0)
1218 
1219 #define REG_PORT_IN_RATE_0      0x0410
1220 #define REG_PORT_IN_RATE_1      0x0411
1221 #define REG_PORT_IN_RATE_2      0x0412
1222 #define REG_PORT_IN_RATE_3      0x0413
1223 #define REG_PORT_IN_RATE_4      0x0414
1224 #define REG_PORT_IN_RATE_5      0x0415
1225 #define REG_PORT_IN_RATE_6      0x0416
1226 #define REG_PORT_IN_RATE_7      0x0417
1227 
1228 #define REG_PORT_OUT_RATE_0     0x0420
1229 #define REG_PORT_OUT_RATE_1     0x0421
1230 #define REG_PORT_OUT_RATE_2     0x0422
1231 #define REG_PORT_OUT_RATE_3     0x0423
1232 
1233 #define PORT_RATE_LIMIT_M       (BIT(7) - 1)
1234 
1235 /* 5 - MIB Counters */
1236 #define REG_PORT_MIB_CTRL_STAT__4   0x0500
1237 
1238 #define MIB_COUNTER_READ        BIT(25)
1239 #define MIB_COUNTER_FLUSH_FREEZE    BIT(24)
1240 #define MIB_COUNTER_INDEX_M     (BIT(8) - 1)
1241 #define MIB_COUNTER_INDEX_S     16
1242 #define MIB_COUNTER_DATA_HI_M       0xF
1243 
1244 #define REG_PORT_MIB_DATA       0x0504
1245 
1246 /* 6 - ACL */
1247 #define REG_PORT_ACL_0          0x0600
1248 
1249 #define ACL_FIRST_RULE_M        0xF
1250 
1251 #define REG_PORT_ACL_1          0x0601
1252 
1253 #define ACL_MODE_M          0x3
1254 #define ACL_MODE_S          4
1255 #define ACL_MODE_DISABLE        0
1256 #define ACL_MODE_LAYER_2        1
1257 #define ACL_MODE_LAYER_3        2
1258 #define ACL_MODE_LAYER_4        3
1259 #define ACL_ENABLE_M            0x3
1260 #define ACL_ENABLE_S            2
1261 #define ACL_ENABLE_2_COUNT      0
1262 #define ACL_ENABLE_2_TYPE       1
1263 #define ACL_ENABLE_2_MAC        2
1264 #define ACL_ENABLE_2_BOTH       3
1265 #define ACL_ENABLE_3_IP         1
1266 #define ACL_ENABLE_3_SRC_DST_COMP   2
1267 #define ACL_ENABLE_4_PROTOCOL       0
1268 #define ACL_ENABLE_4_TCP_PORT_COMP  1
1269 #define ACL_ENABLE_4_UDP_PORT_COMP  2
1270 #define ACL_ENABLE_4_TCP_SEQN_COMP  3
1271 #define ACL_SRC             BIT(1)
1272 #define ACL_EQUAL           BIT(0)
1273 
1274 #define REG_PORT_ACL_2          0x0602
1275 #define REG_PORT_ACL_3          0x0603
1276 
1277 #define ACL_MAX_PORT            0xFFFF
1278 
1279 #define REG_PORT_ACL_4          0x0604
1280 #define REG_PORT_ACL_5          0x0605
1281 
1282 #define ACL_MIN_PORT            0xFFFF
1283 #define ACL_IP_ADDR         0xFFFFFFFF
1284 #define ACL_TCP_SEQNUM          0xFFFFFFFF
1285 
1286 #define REG_PORT_ACL_6          0x0606
1287 
1288 #define ACL_RESERVED            0xF8
1289 #define ACL_PORT_MODE_M         0x3
1290 #define ACL_PORT_MODE_S         1
1291 #define ACL_PORT_MODE_DISABLE       0
1292 #define ACL_PORT_MODE_EITHER        1
1293 #define ACL_PORT_MODE_IN_RANGE      2
1294 #define ACL_PORT_MODE_OUT_OF_RANGE  3
1295 
1296 #define REG_PORT_ACL_7          0x0607
1297 
1298 #define ACL_TCP_FLAG_ENABLE     BIT(0)
1299 
1300 #define REG_PORT_ACL_8          0x0608
1301 
1302 #define ACL_TCP_FLAG_M          0xFF
1303 
1304 #define REG_PORT_ACL_9          0x0609
1305 
1306 #define ACL_TCP_FLAG            0xFF
1307 #define ACL_ETH_TYPE            0xFFFF
1308 #define ACL_IP_M            0xFFFFFFFF
1309 
1310 #define REG_PORT_ACL_A          0x060A
1311 
1312 #define ACL_PRIO_MODE_M         0x3
1313 #define ACL_PRIO_MODE_S         6
1314 #define ACL_PRIO_MODE_DISABLE       0
1315 #define ACL_PRIO_MODE_HIGHER        1
1316 #define ACL_PRIO_MODE_LOWER     2
1317 #define ACL_PRIO_MODE_REPLACE       3
1318 #define ACL_PRIO_M          KS_PRIO_M
1319 #define ACL_PRIO_S          3
1320 #define ACL_VLAN_PRIO_REPLACE       BIT(2)
1321 #define ACL_VLAN_PRIO_M         KS_PRIO_M
1322 #define ACL_VLAN_PRIO_HI_M      0x3
1323 
1324 #define REG_PORT_ACL_B          0x060B
1325 
1326 #define ACL_VLAN_PRIO_LO_M      0x8
1327 #define ACL_VLAN_PRIO_S         7
1328 #define ACL_MAP_MODE_M          0x3
1329 #define ACL_MAP_MODE_S          5
1330 #define ACL_MAP_MODE_DISABLE        0
1331 #define ACL_MAP_MODE_OR         1
1332 #define ACL_MAP_MODE_AND        2
1333 #define ACL_MAP_MODE_REPLACE        3
1334 
1335 #define ACL_CNT_M           (BIT(11) - 1)
1336 #define ACL_CNT_S           5
1337 
1338 #define REG_PORT_ACL_C          0x060C
1339 
1340 #define REG_PORT_ACL_D          0x060D
1341 #define ACL_MSEC_UNIT           BIT(6)
1342 #define ACL_INTR_MODE           BIT(5)
1343 #define ACL_PORT_MAP            0x7F
1344 
1345 #define REG_PORT_ACL_E          0x060E
1346 #define REG_PORT_ACL_F          0x060F
1347 
1348 #define REG_PORT_ACL_BYTE_EN_MSB    0x0610
1349 #define REG_PORT_ACL_BYTE_EN_LSB    0x0611
1350 
1351 #define ACL_ACTION_START        0xA
1352 #define ACL_ACTION_LEN          4
1353 #define ACL_INTR_CNT_START      0xD
1354 #define ACL_RULESET_START       0xE
1355 #define ACL_RULESET_LEN         2
1356 #define ACL_TABLE_LEN           16
1357 
1358 #define ACL_ACTION_ENABLE       0x003C
1359 #define ACL_MATCH_ENABLE        0x7FC3
1360 #define ACL_RULESET_ENABLE      0x8003
1361 #define ACL_BYTE_ENABLE         0xFFFF
1362 
1363 #define REG_PORT_ACL_CTRL_0     0x0612
1364 
1365 #define PORT_ACL_WRITE_DONE     BIT(6)
1366 #define PORT_ACL_READ_DONE      BIT(5)
1367 #define PORT_ACL_WRITE          BIT(4)
1368 #define PORT_ACL_INDEX_M        0xF
1369 
1370 #define REG_PORT_ACL_CTRL_1     0x0613
1371 
1372 /* 8 - Classification and Policing */
1373 #define REG_PORT_MRI_MIRROR_CTRL    0x0800
1374 
1375 #define PORT_MIRROR_RX          BIT(6)
1376 #define PORT_MIRROR_TX          BIT(5)
1377 #define PORT_MIRROR_SNIFFER     BIT(1)
1378 
1379 #define REG_PORT_MRI_PRIO_CTRL      0x0801
1380 
1381 #define PORT_HIGHEST_PRIO       BIT(7)
1382 #define PORT_OR_PRIO            BIT(6)
1383 #define PORT_MAC_PRIO_ENABLE        BIT(4)
1384 #define PORT_VLAN_PRIO_ENABLE       BIT(3)
1385 #define PORT_802_1P_PRIO_ENABLE     BIT(2)
1386 #define PORT_DIFFSERV_PRIO_ENABLE   BIT(1)
1387 #define PORT_ACL_PRIO_ENABLE        BIT(0)
1388 
1389 #define REG_PORT_MRI_MAC_CTRL       0x0802
1390 
1391 #define PORT_USER_PRIO_CEILING      BIT(7)
1392 #define PORT_DROP_NON_VLAN      BIT(4)
1393 #define PORT_DROP_TAG           BIT(3)
1394 #define PORT_BASED_PRIO_M       KS_PRIO_M
1395 #define PORT_BASED_PRIO_S       0
1396 
1397 #define REG_PORT_MRI_AUTHEN_CTRL    0x0803
1398 
1399 #define PORT_ACL_ENABLE         BIT(2)
1400 #define PORT_AUTHEN_MODE        0x3
1401 #define PORT_AUTHEN_PASS        0
1402 #define PORT_AUTHEN_BLOCK       1
1403 #define PORT_AUTHEN_TRAP        2
1404 
1405 #define REG_PORT_MRI_INDEX__4       0x0804
1406 
1407 #define MRI_INDEX_P_M           0x7
1408 #define MRI_INDEX_P_S           16
1409 #define MRI_INDEX_Q_M           0x3
1410 #define MRI_INDEX_Q_S           0
1411 
1412 #define REG_PORT_MRI_TC_MAP__4      0x0808
1413 
1414 #define PORT_TC_MAP_M           0xf
1415 #define PORT_TC_MAP_S           4
1416 
1417 #define REG_PORT_MRI_POLICE_CTRL__4 0x080C
1418 
1419 #define POLICE_DROP_ALL         BIT(10)
1420 #define POLICE_PACKET_TYPE_M        0x3
1421 #define POLICE_PACKET_TYPE_S        8
1422 #define POLICE_PACKET_DROPPED       0
1423 #define POLICE_PACKET_GREEN     1
1424 #define POLICE_PACKET_YELLOW        2
1425 #define POLICE_PACKET_RED       3
1426 #define PORT_BASED_POLICING     BIT(7)
1427 #define NON_DSCP_COLOR_M        0x3
1428 #define NON_DSCP_COLOR_S        5
1429 #define COLOR_MARK_ENABLE       BIT(4)
1430 #define COLOR_REMAP_ENABLE      BIT(3)
1431 #define POLICE_DROP_SRP         BIT(2)
1432 #define POLICE_COLOR_NOT_AWARE      BIT(1)
1433 #define POLICE_ENABLE           BIT(0)
1434 
1435 #define REG_PORT_POLICE_COLOR_0__4  0x0810
1436 #define REG_PORT_POLICE_COLOR_1__4  0x0814
1437 #define REG_PORT_POLICE_COLOR_2__4  0x0818
1438 #define REG_PORT_POLICE_COLOR_3__4  0x081C
1439 
1440 #define POLICE_COLOR_MAP_S      2
1441 #define POLICE_COLOR_MAP_M      (BIT(POLICE_COLOR_MAP_S) - 1)
1442 
1443 #define REG_PORT_POLICE_RATE__4     0x0820
1444 
1445 #define POLICE_CIR_S            16
1446 #define POLICE_PIR_S            0
1447 
1448 #define REG_PORT_POLICE_BURST_SIZE__4   0x0824
1449 
1450 #define POLICE_BURST_SIZE_M     0x3FFF
1451 #define POLICE_CBS_S            16
1452 #define POLICE_PBS_S            0
1453 
1454 #define REG_PORT_WRED_PM_CTRL_0__4  0x0830
1455 
1456 #define WRED_PM_CTRL_M          (BIT(11) - 1)
1457 
1458 #define WRED_PM_MAX_THRESHOLD_S     16
1459 #define WRED_PM_MIN_THRESHOLD_S     0
1460 
1461 #define REG_PORT_WRED_PM_CTRL_1__4  0x0834
1462 
1463 #define WRED_PM_MULTIPLIER_S        16
1464 #define WRED_PM_AVG_QUEUE_SIZE_S    0
1465 
1466 #define REG_PORT_WRED_QUEUE_CTRL_0__4   0x0840
1467 #define REG_PORT_WRED_QUEUE_CTRL_1__4   0x0844
1468 
1469 #define REG_PORT_WRED_QUEUE_PMON__4 0x0848
1470 
1471 #define WRED_RANDOM_DROP_ENABLE     BIT(31)
1472 #define WRED_PMON_FLUSH         BIT(30)
1473 #define WRED_DROP_GYR_DISABLE       BIT(29)
1474 #define WRED_DROP_YR_DISABLE        BIT(28)
1475 #define WRED_DROP_R_DISABLE     BIT(27)
1476 #define WRED_DROP_ALL           BIT(26)
1477 #define WRED_PMON_M         (BIT(24) - 1)
1478 
1479 /* 9 - Shaping */
1480 
1481 #define REG_PORT_MTI_QUEUE_INDEX__4 0x0900
1482 
1483 #define REG_PORT_MTI_QUEUE_CTRL_0__4    0x0904
1484 
1485 #define MTI_PVID_REPLACE        BIT(0)
1486 
1487 #define REG_PORT_MTI_QUEUE_CTRL_0   0x0914
1488 
1489 #define MTI_SCHEDULE_MODE_M     0x3
1490 #define MTI_SCHEDULE_MODE_S     6
1491 #define MTI_SCHEDULE_STRICT_PRIO    0
1492 #define MTI_SCHEDULE_WRR        2
1493 #define MTI_SHAPING_M           0x3
1494 #define MTI_SHAPING_S           4
1495 #define MTI_SHAPING_OFF         0
1496 #define MTI_SHAPING_SRP         1
1497 #define MTI_SHAPING_TIME_AWARE      2
1498 
1499 #define REG_PORT_MTI_QUEUE_CTRL_1   0x0915
1500 
1501 #define MTI_TX_RATIO_M          (BIT(7) - 1)
1502 
1503 #define REG_PORT_MTI_QUEUE_CTRL_2__2    0x0916
1504 #define REG_PORT_MTI_HI_WATER_MARK  0x0916
1505 #define REG_PORT_MTI_QUEUE_CTRL_3__2    0x0918
1506 #define REG_PORT_MTI_LO_WATER_MARK  0x0918
1507 #define REG_PORT_MTI_QUEUE_CTRL_4__2    0x091A
1508 #define REG_PORT_MTI_CREDIT_INCREMENT   0x091A
1509 
1510 /* A - QM */
1511 
1512 #define REG_PORT_QM_CTRL__4     0x0A00
1513 
1514 #define PORT_QM_DROP_PRIO_M     0x3
1515 
1516 #define REG_PORT_VLAN_MEMBERSHIP__4 0x0A04
1517 
1518 #define REG_PORT_QM_QUEUE_INDEX__4  0x0A08
1519 
1520 #define PORT_QM_QUEUE_INDEX_S       24
1521 #define PORT_QM_BURST_SIZE_S        16
1522 #define PORT_QM_MIN_RESV_SPACE_M    (BIT(11) - 1)
1523 
1524 #define REG_PORT_QM_WATER_MARK__4   0x0A0C
1525 
1526 #define PORT_QM_HI_WATER_MARK_S     16
1527 #define PORT_QM_LO_WATER_MARK_S     0
1528 #define PORT_QM_WATER_MARK_M        (BIT(11) - 1)
1529 
1530 #define REG_PORT_QM_TX_CNT_0__4     0x0A10
1531 
1532 #define PORT_QM_TX_CNT_USED_S       0
1533 #define PORT_QM_TX_CNT_M        (BIT(11) - 1)
1534 
1535 #define REG_PORT_QM_TX_CNT_1__4     0x0A14
1536 
1537 #define PORT_QM_TX_CNT_CALCULATED_S 16
1538 #define PORT_QM_TX_CNT_AVAIL_S      0
1539 
1540 /* B - LUE */
1541 #define REG_PORT_LUE_CTRL       0x0B00
1542 
1543 #define PORT_VLAN_LOOKUP_VID_0      BIT(7)
1544 #define PORT_INGRESS_FILTER     BIT(6)
1545 #define PORT_DISCARD_NON_VID        BIT(5)
1546 #define PORT_MAC_BASED_802_1X       BIT(4)
1547 #define PORT_SRC_ADDR_FILTER        BIT(3)
1548 
1549 #define REG_PORT_LUE_MSTP_INDEX     0x0B01
1550 
1551 #define REG_PORT_LUE_MSTP_STATE     0x0B04
1552 
1553 /* C - PTP */
1554 
1555 #define REG_PTP_PORT_RX_DELAY__2    0x0C00
1556 #define REG_PTP_PORT_TX_DELAY__2    0x0C02
1557 #define REG_PTP_PORT_ASYM_DELAY__2  0x0C04
1558 
1559 #define REG_PTP_PORT_XDELAY_TS      0x0C08
1560 #define REG_PTP_PORT_XDELAY_TS_H    0x0C08
1561 #define REG_PTP_PORT_XDELAY_TS_L    0x0C0A
1562 
1563 #define REG_PTP_PORT_SYNC_TS        0x0C0C
1564 #define REG_PTP_PORT_SYNC_TS_H      0x0C0C
1565 #define REG_PTP_PORT_SYNC_TS_L      0x0C0E
1566 
1567 #define REG_PTP_PORT_PDRESP_TS      0x0C10
1568 #define REG_PTP_PORT_PDRESP_TS_H    0x0C10
1569 #define REG_PTP_PORT_PDRESP_TS_L    0x0C12
1570 
1571 #define REG_PTP_PORT_TX_INT_STATUS__2   0x0C14
1572 #define REG_PTP_PORT_TX_INT_ENABLE__2   0x0C16
1573 
1574 #define PTP_PORT_SYNC_INT       BIT(15)
1575 #define PTP_PORT_XDELAY_REQ_INT     BIT(14)
1576 #define PTP_PORT_PDELAY_RESP_INT    BIT(13)
1577 
1578 #define REG_PTP_PORT_LINK_DELAY__4  0x0C18
1579 
1580 #define PRIO_QUEUES         4
1581 #define RX_PRIO_QUEUES          8
1582 
1583 #define KS_PRIO_IN_REG          2
1584 
1585 #define TOTAL_PORT_NUM          7
1586 
1587 #define KSZ9477_COUNTER_NUM     0x20
1588 #define TOTAL_KSZ9477_COUNTER_NUM   (KSZ9477_COUNTER_NUM + 2 + 2)
1589 
1590 #define SWITCH_COUNTER_NUM      KSZ9477_COUNTER_NUM
1591 #define TOTAL_SWITCH_COUNTER_NUM    TOTAL_KSZ9477_COUNTER_NUM
1592 
1593 #define P_BCAST_STORM_CTRL      REG_PORT_MAC_CTRL_0
1594 #define P_PRIO_CTRL         REG_PORT_MRI_PRIO_CTRL
1595 #define P_MIRROR_CTRL           REG_PORT_MRI_MIRROR_CTRL
1596 #define P_PHY_CTRL          REG_PORT_PHY_CTRL
1597 #define P_RATE_LIMIT_CTRL       REG_PORT_MAC_IN_RATE_LIMIT
1598 
1599 #define S_LINK_AGING_CTRL       REG_SW_LUE_CTRL_1
1600 #define S_MIRROR_CTRL           REG_SW_MRI_CTRL_0
1601 #define S_REPLACE_VID_CTRL      REG_SW_MAC_CTRL_2
1602 #define S_802_1P_PRIO_CTRL      REG_SW_MAC_802_1P_MAP_0
1603 #define S_TOS_PRIO_CTRL         REG_SW_MAC_TOS_PRIO_0
1604 #define S_FLUSH_TABLE_CTRL      REG_SW_LUE_CTRL_1
1605 
1606 #define SW_FLUSH_DYN_MAC_TABLE      SW_FLUSH_MSTP_TABLE
1607 
1608 #define MAX_TIMESTAMP_UNIT      2
1609 #define MAX_TRIG_UNIT           3
1610 #define MAX_TIMESTAMP_EVENT_UNIT    8
1611 #define MAX_GPIO            4
1612 
1613 #define PTP_TRIG_UNIT_M         (BIT(MAX_TRIG_UNIT) - 1)
1614 #define PTP_TS_UNIT_M           (BIT(MAX_TIMESTAMP_UNIT) - 1)
1615 
1616 #define KSZ9477_MAX_FRAME_SIZE      9000
1617 
1618 #endif /* KSZ9477_REGS_H */