0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef __B53_REGS_H
0021 #define __B53_REGS_H
0022
0023
0024 #define B53_CTRL_PAGE 0x00
0025 #define B53_STAT_PAGE 0x01
0026 #define B53_MGMT_PAGE 0x02
0027 #define B53_MIB_AC_PAGE 0x03
0028 #define B53_ARLCTRL_PAGE 0x04
0029 #define B53_ARLIO_PAGE 0x05
0030 #define B53_FRAMEBUF_PAGE 0x06
0031 #define B53_MEM_ACCESS_PAGE 0x08
0032
0033
0034 #define B53_PORT_MII_PAGE(i) (0x10 + (i))
0035 #define B53_IM_PORT_PAGE 0x18
0036 #define B53_ALL_PORT_PAGE 0x19
0037
0038
0039 #define B53_MIB_PAGE(i) (0x20 + (i))
0040
0041
0042 #define B53_QOS_PAGE 0x30
0043
0044
0045 #define B53_PVLAN_PAGE 0x31
0046
0047
0048 #define B53_VLAN_PAGE 0x34
0049
0050
0051 #define B53_JUMBO_PAGE 0x40
0052
0053
0054 #define B53_EEE_PAGE 0x92
0055
0056
0057 #define B53_CFP_PAGE 0xa1
0058
0059
0060
0061
0062
0063
0064 #define B53_PORT_CTRL(i) (0x00 + (i))
0065 #define PORT_CTRL_RX_DISABLE BIT(0)
0066 #define PORT_CTRL_TX_DISABLE BIT(1)
0067 #define PORT_CTRL_RX_BCST_EN BIT(2)
0068 #define PORT_CTRL_RX_MCST_EN BIT(3)
0069 #define PORT_CTRL_RX_UCST_EN BIT(4)
0070 #define PORT_CTRL_STP_STATE_S 5
0071 #define PORT_CTRL_NO_STP (0 << PORT_CTRL_STP_STATE_S)
0072 #define PORT_CTRL_DIS_STATE (1 << PORT_CTRL_STP_STATE_S)
0073 #define PORT_CTRL_BLOCK_STATE (2 << PORT_CTRL_STP_STATE_S)
0074 #define PORT_CTRL_LISTEN_STATE (3 << PORT_CTRL_STP_STATE_S)
0075 #define PORT_CTRL_LEARN_STATE (4 << PORT_CTRL_STP_STATE_S)
0076 #define PORT_CTRL_FWD_STATE (5 << PORT_CTRL_STP_STATE_S)
0077 #define PORT_CTRL_STP_STATE_MASK (0x7 << PORT_CTRL_STP_STATE_S)
0078
0079
0080 #define B53_SMP_CTRL 0x0a
0081
0082
0083 #define B53_SWITCH_MODE 0x0b
0084 #define SM_SW_FWD_MODE BIT(0)
0085 #define SM_SW_FWD_EN BIT(1)
0086
0087
0088 #define B53_PORT_OVERRIDE_CTRL 0x0e
0089 #define PORT_OVERRIDE_LINK BIT(0)
0090 #define PORT_OVERRIDE_FULL_DUPLEX BIT(1)
0091 #define PORT_OVERRIDE_SPEED_S 2
0092 #define PORT_OVERRIDE_SPEED_10M (0 << PORT_OVERRIDE_SPEED_S)
0093 #define PORT_OVERRIDE_SPEED_100M (1 << PORT_OVERRIDE_SPEED_S)
0094 #define PORT_OVERRIDE_SPEED_1000M (2 << PORT_OVERRIDE_SPEED_S)
0095 #define PORT_OVERRIDE_RV_MII_25 BIT(4)
0096 #define PORT_OVERRIDE_RX_FLOW BIT(4)
0097 #define PORT_OVERRIDE_TX_FLOW BIT(5)
0098 #define PORT_OVERRIDE_SPEED_2000M BIT(6)
0099 #define PORT_OVERRIDE_EN BIT(7)
0100
0101
0102 #define B53_PD_MODE_CTRL_25 0x0f
0103
0104
0105 #define B53_IP_MULTICAST_CTRL 0x21
0106 #define B53_IPMC_FWD_EN BIT(1)
0107 #define B53_UC_FWD_EN BIT(6)
0108 #define B53_MC_FWD_EN BIT(7)
0109
0110
0111 #define B53_SWITCH_CTRL 0x22
0112 #define B53_MII_DUMB_FWDG_EN BIT(6)
0113
0114
0115 #define B53_UC_FLOOD_MASK 0x32
0116 #define B53_MC_FLOOD_MASK 0x34
0117 #define B53_IPMC_FLOOD_MASK 0x36
0118 #define B53_DIS_LEARNING 0x3c
0119
0120
0121
0122
0123
0124
0125
0126
0127 #define B53_GMII_PORT_OVERRIDE_CTRL(i) (0x58 + (i))
0128 #define GMII_PO_LINK BIT(0)
0129 #define GMII_PO_FULL_DUPLEX BIT(1)
0130 #define GMII_PO_SPEED_S 2
0131 #define GMII_PO_SPEED_10M (0 << GMII_PO_SPEED_S)
0132 #define GMII_PO_SPEED_100M (1 << GMII_PO_SPEED_S)
0133 #define GMII_PO_SPEED_1000M (2 << GMII_PO_SPEED_S)
0134 #define GMII_PO_RX_FLOW BIT(4)
0135 #define GMII_PO_TX_FLOW BIT(5)
0136 #define GMII_PO_EN BIT(6)
0137 #define GMII_PO_SPEED_2000M BIT(7)
0138
0139 #define B53_RGMII_CTRL_IMP 0x60
0140 #define RGMII_CTRL_ENABLE_GMII BIT(7)
0141 #define RGMII_CTRL_TIMING_SEL BIT(2)
0142 #define RGMII_CTRL_DLL_RXC BIT(1)
0143 #define RGMII_CTRL_DLL_TXC BIT(0)
0144
0145 #define B53_RGMII_CTRL_P(i) (B53_RGMII_CTRL_IMP + (i))
0146
0147
0148 #define B53_SOFTRESET 0x79
0149 #define SW_RST BIT(7)
0150 #define EN_CH_RST BIT(6)
0151 #define EN_SW_RST BIT(4)
0152
0153
0154 #define B53_FAST_AGE_CTRL 0x88
0155 #define FAST_AGE_STATIC BIT(0)
0156 #define FAST_AGE_DYNAMIC BIT(1)
0157 #define FAST_AGE_PORT BIT(2)
0158 #define FAST_AGE_VLAN BIT(3)
0159 #define FAST_AGE_STP BIT(4)
0160 #define FAST_AGE_MC BIT(5)
0161 #define FAST_AGE_DONE BIT(7)
0162
0163
0164 #define B53_FAST_AGE_PORT_CTRL 0x89
0165
0166
0167 #define B53_FAST_AGE_VID_CTRL 0x8a
0168
0169
0170
0171
0172
0173
0174 #define B53_LINK_STAT 0x00
0175
0176
0177 #define B53_LINK_STAT_CHANGE 0x02
0178
0179
0180 #define B53_SPEED_STAT 0x04
0181 #define SPEED_PORT_FE(reg, port) (((reg) >> (port)) & 1)
0182 #define SPEED_PORT_GE(reg, port) (((reg) >> 2 * (port)) & 3)
0183 #define SPEED_STAT_10M 0
0184 #define SPEED_STAT_100M 1
0185 #define SPEED_STAT_1000M 2
0186
0187
0188 #define B53_DUPLEX_STAT_FE 0x06
0189 #define B53_DUPLEX_STAT_GE 0x08
0190 #define B53_DUPLEX_STAT_63XX 0x0c
0191
0192
0193 #define B53_REV_ID_25 0x50
0194
0195
0196 #define B53_STRAP_VALUE 0x70
0197 #define SV_GMII_CTRL_115 BIT(27)
0198
0199
0200
0201
0202
0203
0204 #define B53_GLOBAL_CONFIG 0x00
0205 #define GC_RESET_MIB 0x01
0206 #define GC_RX_BPDU_EN 0x02
0207 #define GC_MIB_AC_HDR_EN 0x10
0208 #define GC_MIB_AC_EN 0x20
0209 #define GC_FRM_MGMT_PORT_M 0xC0
0210 #define GC_FRM_MGMT_PORT_04 0x00
0211 #define GC_FRM_MGMT_PORT_MII 0x80
0212
0213
0214 #define B53_BRCM_HDR 0x03
0215 #define BRCM_HDR_P8_EN BIT(0)
0216 #define BRCM_HDR_P5_EN BIT(1)
0217 #define BRCM_HDR_P7_EN BIT(2)
0218
0219
0220 #define B53_MIR_CAP_CTL 0x10
0221 #define CAP_PORT_MASK 0xf
0222 #define BLK_NOT_MIR BIT(14)
0223 #define MIRROR_EN BIT(15)
0224
0225
0226 #define B53_IG_MIR_CTL 0x12
0227 #define MIRROR_MASK 0x1ff
0228 #define DIV_EN BIT(13)
0229 #define MIRROR_FILTER_MASK 0x3
0230 #define MIRROR_FILTER_SHIFT 14
0231 #define MIRROR_ALL 0
0232 #define MIRROR_DA 1
0233 #define MIRROR_SA 2
0234
0235
0236 #define B53_IG_MIR_DIV 0x14
0237 #define IN_MIRROR_DIV_MASK 0x3ff
0238
0239
0240 #define B53_IG_MIR_MAC 0x16
0241
0242
0243 #define B53_EG_MIR_CTL 0x1C
0244
0245
0246 #define B53_EG_MIR_DIV 0x1E
0247
0248
0249 #define B53_EG_MIR_MAC 0x20
0250
0251
0252 #define B53_DEVICE_ID 0x30
0253
0254
0255 #define B53_REV_ID 0x40
0256
0257
0258 #define B53_BRCM_HDR_RX_DIS 0x60
0259
0260
0261 #define B53_BRCM_HDR_TX_DIS 0x62
0262
0263
0264
0265
0266
0267
0268 #define B53_VT_ACCESS 0x80
0269 #define B53_VT_ACCESS_9798 0x60
0270 #define B53_VT_ACCESS_63XX 0x60
0271 #define VTA_CMD_WRITE 0
0272 #define VTA_CMD_READ 1
0273 #define VTA_CMD_CLEAR 2
0274 #define VTA_START_CMD BIT(7)
0275
0276
0277 #define B53_VT_INDEX 0x81
0278 #define B53_VT_INDEX_9798 0x61
0279 #define B53_VT_INDEX_63XX 0x62
0280
0281
0282 #define B53_VT_ENTRY 0x83
0283 #define B53_VT_ENTRY_9798 0x63
0284 #define B53_VT_ENTRY_63XX 0x64
0285 #define VTE_MEMBERS 0x1ff
0286 #define VTE_UNTAG_S 9
0287 #define VTE_UNTAG (0x1ff << 9)
0288
0289
0290
0291
0292
0293
0294 #define B53_ARLTBL_RW_CTRL 0x00
0295 #define ARLTBL_RW BIT(0)
0296 #define ARLTBL_IVL_SVL_SELECT BIT(6)
0297 #define ARLTBL_START_DONE BIT(7)
0298
0299
0300 #define B53_MAC_ADDR_IDX 0x02
0301
0302
0303 #define B53_VLAN_ID_IDX 0x08
0304
0305
0306
0307
0308
0309 #define B53_ARLTBL_MAC_VID_ENTRY(n) ((0x10 * (n)) + 0x10)
0310 #define ARLTBL_MAC_MASK 0xffffffffffffULL
0311 #define ARLTBL_VID_S 48
0312 #define ARLTBL_VID_MASK_25 0xff
0313 #define ARLTBL_VID_MASK 0xfff
0314 #define ARLTBL_DATA_PORT_ID_S_25 48
0315 #define ARLTBL_DATA_PORT_ID_MASK_25 0xf
0316 #define ARLTBL_AGE_25 BIT(61)
0317 #define ARLTBL_STATIC_25 BIT(62)
0318 #define ARLTBL_VALID_25 BIT(63)
0319
0320
0321 #define B53_ARLTBL_DATA_ENTRY(n) ((0x10 * (n)) + 0x18)
0322 #define ARLTBL_DATA_PORT_ID_MASK 0x1ff
0323 #define ARLTBL_TC(tc) ((3 & tc) << 11)
0324 #define ARLTBL_AGE BIT(14)
0325 #define ARLTBL_STATIC BIT(15)
0326 #define ARLTBL_VALID BIT(16)
0327
0328
0329 #define B53_ARLTBL_MAX_BIN_ENTRIES 4
0330
0331
0332 #define B53_ARL_SRCH_CTL 0x50
0333 #define B53_ARL_SRCH_CTL_25 0x20
0334 #define ARL_SRCH_VLID BIT(0)
0335 #define ARL_SRCH_STDN BIT(7)
0336
0337
0338 #define B53_ARL_SRCH_ADDR 0x51
0339 #define B53_ARL_SRCH_ADDR_25 0x22
0340 #define B53_ARL_SRCH_ADDR_65 0x24
0341 #define ARL_ADDR_MASK GENMASK(14, 0)
0342
0343
0344 #define B53_ARL_SRCH_RSTL_0_MACVID 0x60
0345
0346
0347 #define B53_ARL_SRCH_RSTL_0_MACVID_25 0x24
0348
0349 #define B53_ARL_SRCH_RSTL_0_MACVID_65 0x30
0350
0351
0352 #define B53_ARL_SRCH_RSTL_0 0x68
0353
0354 #define B53_ARL_SRCH_RSTL_MACVID(x) (B53_ARL_SRCH_RSTL_0_MACVID + ((x) * 0x10))
0355 #define B53_ARL_SRCH_RSTL(x) (B53_ARL_SRCH_RSTL_0 + ((x) * 0x10))
0356
0357
0358
0359
0360
0361
0362 #define B53_PVLAN_PORT_MASK(i) ((i) * 2)
0363
0364
0365 #define B53_JOIN_ALL_VLAN_EN 0x50
0366
0367
0368
0369
0370
0371
0372 #define B53_QOS_GLOBAL_CTL 0x00
0373
0374
0375 #define B53_802_1P_EN 0x04
0376
0377
0378
0379
0380
0381
0382 #define B53_VLAN_CTRL0 0x00
0383 #define VC0_8021PF_CTRL_MASK 0x3
0384 #define VC0_8021PF_CTRL_NONE 0x0
0385 #define VC0_8021PF_CTRL_CHANGE_PRI 0x1
0386 #define VC0_8021PF_CTRL_CHANGE_VID 0x2
0387 #define VC0_8021PF_CTRL_CHANGE_BOTH 0x3
0388 #define VC0_8021QF_CTRL_MASK 0xc
0389 #define VC0_8021QF_CTRL_CHANGE_PRI 0x1
0390 #define VC0_8021QF_CTRL_CHANGE_VID 0x2
0391 #define VC0_8021QF_CTRL_CHANGE_BOTH 0x3
0392 #define VC0_RESERVED_1 BIT(1)
0393 #define VC0_DROP_VID_MISS BIT(4)
0394 #define VC0_VID_HASH_VID BIT(5)
0395 #define VC0_VID_CHK_EN BIT(6)
0396 #define VC0_VLAN_EN BIT(7)
0397
0398
0399 #define B53_VLAN_CTRL1 0x01
0400 #define VC1_RX_MCST_TAG_EN BIT(1)
0401 #define VC1_RX_MCST_FWD_EN BIT(2)
0402 #define VC1_RX_MCST_UNTAG_EN BIT(3)
0403
0404
0405 #define B53_VLAN_CTRL2 0x02
0406
0407
0408 #define B53_VLAN_CTRL3 0x03
0409 #define B53_VLAN_CTRL3_63XX 0x04
0410 #define VC3_MAXSIZE_1532 BIT(6)
0411 #define VC3_HIGH_8BIT_EN BIT(7)
0412
0413
0414 #define B53_VLAN_CTRL4 0x05
0415 #define B53_VLAN_CTRL4_25 0x04
0416 #define B53_VLAN_CTRL4_63XX 0x06
0417 #define VC4_ING_VID_CHECK_S 6
0418 #define VC4_ING_VID_CHECK_MASK (0x3 << VC4_ING_VID_CHECK_S)
0419 #define VC4_ING_VID_VIO_FWD 0
0420 #define VC4_ING_VID_VIO_DROP 1
0421 #define VC4_NO_ING_VID_CHK 2
0422 #define VC4_ING_VID_VIO_TO_IMP 3
0423
0424
0425 #define B53_VLAN_CTRL5 0x06
0426 #define B53_VLAN_CTRL5_25 0x05
0427 #define B53_VLAN_CTRL5_63XX 0x07
0428 #define VC5_VID_FFF_EN BIT(2)
0429 #define VC5_DROP_VTABLE_MISS BIT(3)
0430
0431
0432 #define B53_VLAN_CTRL6 0x07
0433 #define B53_VLAN_CTRL6_63XX 0x08
0434
0435
0436 #define B53_VLAN_TABLE_ACCESS_25 0x06
0437 #define B53_VLAN_TABLE_ACCESS_65 0x08
0438 #define VTA_VID_LOW_MASK_25 0xf
0439 #define VTA_VID_LOW_MASK_65 0xff
0440 #define VTA_VID_HIGH_S_25 4
0441 #define VTA_VID_HIGH_S_65 8
0442 #define VTA_VID_HIGH_MASK_25 (0xff << VTA_VID_HIGH_S_25E)
0443 #define VTA_VID_HIGH_MASK_65 (0xf << VTA_VID_HIGH_S_65)
0444 #define VTA_RW_STATE BIT(12)
0445 #define VTA_RW_STATE_RD 0
0446 #define VTA_RW_STATE_WR BIT(12)
0447 #define VTA_RW_OP_EN BIT(13)
0448
0449
0450 #define B53_VLAN_WRITE_25 0x08
0451 #define B53_VLAN_WRITE_65 0x0a
0452 #define B53_VLAN_READ 0x0c
0453 #define VA_MEMBER_MASK 0x3f
0454 #define VA_UNTAG_S_25 6
0455 #define VA_UNTAG_MASK_25 0x3f
0456 #define VA_UNTAG_S_65 7
0457 #define VA_UNTAG_MASK_65 0x1f
0458 #define VA_VID_HIGH_S 12
0459 #define VA_VID_HIGH_MASK (0xffff << VA_VID_HIGH_S)
0460 #define VA_VALID_25 BIT(20)
0461 #define VA_VALID_25_R4 BIT(24)
0462 #define VA_VALID_65 BIT(14)
0463
0464
0465 #define B53_VLAN_PORT_DEF_TAG(i) (0x10 + 2 * (i))
0466
0467
0468
0469
0470
0471
0472 #define B53_JUMBO_PORT_MASK 0x01
0473 #define B53_JUMBO_PORT_MASK_63XX 0x04
0474 #define JPM_10_100_JUMBO_EN BIT(24)
0475
0476
0477 #define B53_JUMBO_MAX_SIZE 0x05
0478 #define B53_JUMBO_MAX_SIZE_63XX 0x08
0479 #define JMS_MIN_SIZE 1518
0480 #define JMS_MAX_SIZE 9724
0481
0482
0483
0484
0485
0486
0487 #define B53_EEE_EN_CTRL 0x00
0488
0489
0490 #define B53_EEE_LPI_ASSERT_STS 0x02
0491
0492
0493 #define B53_EEE_LPI_INDICATE 0x4
0494
0495
0496 #define B53_EEE_RX_IDLE_SYM_STS 0x6
0497
0498
0499 #define B53_EEE_PIP_TIMER 0xC
0500
0501
0502 #define B53_EEE_SLEEP_TIMER_GIG(i) (0x10 + 4 * (i))
0503
0504
0505 #define B53_EEE_SLEEP_TIMER_FE(i) (0x34 + 4 * (i))
0506
0507
0508 #define B53_EEE_MIN_LP_TIMER_GIG(i) (0x58 + 4 * (i))
0509
0510
0511 #define B53_EEE_MIN_LP_TIMER_FE(i) (0x7c + 4 * (i))
0512
0513
0514 #define B53_EEE_WAKE_TIMER_GIG(i) (0xa0 + 2 * (i))
0515
0516
0517 #define B53_EEE_WAKE_TIMER_FE(i) (0xb2 + 2 * (i))
0518
0519
0520
0521
0522
0523
0524
0525 #define B53_CFP_CTRL 0x00
0526
0527 #endif