Skip to content

Commit eb41dd7

Browse files
rogerqdavem330
authored andcommitted
net: ethernet: ti: cpsw_ale: add Policer and Thread control register fields
Adds regfileds for Policer registers and Thread mapping/control registers. Signed-off-by: Roger Quadros <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 11cbcfe commit eb41dd7

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed

drivers/net/ethernet/ti/cpsw_ale.c

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,24 @@
4646
#define ALE_UNKNOWNVLAN_FORCE_UNTAG_EGRESS 0x9C
4747
#define ALE_VLAN_MASK_MUX(reg) (0xc0 + (0x4 * (reg)))
4848

49+
#define ALE_POLICER_PORT_OUI 0x100
50+
#define ALE_POLICER_DA_SA 0x104
51+
#define ALE_POLICER_VLAN 0x108
52+
#define ALE_POLICER_ETHERTYPE_IPSA 0x10c
53+
#define ALE_POLICER_IPDA 0x110
54+
#define ALE_POLICER_PIR 0x118
55+
#define ALE_POLICER_CIR 0x11c
56+
#define ALE_POLICER_TBL_CTL 0x120
57+
#define ALE_POLICER_CTL 0x124
58+
#define ALE_POLICER_TEST_CTL 0x128
59+
#define ALE_POLICER_HIT_STATUS 0x12c
60+
#define ALE_THREAD_DEF 0x134
61+
#define ALE_THREAD_CTL 0x138
62+
#define ALE_THREAD_VAL 0x13c
63+
64+
#define ALE_POLICER_TBL_WRITE_ENABLE BIT(31)
65+
#define ALE_POLICER_TBL_INDEX_MASK GENMASK(4, 0)
66+
4967
#define AM65_CPSW_ALE_THREAD_DEF_REG 0x134
5068

5169
/* ALE_AGING_TIMER */
@@ -1306,6 +1324,74 @@ static const struct reg_field ale_fields_cpsw_nu[] = {
13061324
/* CPSW_ALE_STATUS_REG */
13071325
[ALE_ENTRIES] = REG_FIELD(ALE_STATUS, 0, 7),
13081326
[ALE_POLICERS] = REG_FIELD(ALE_STATUS, 8, 15),
1327+
/* CPSW_ALE_POLICER_PORT_OUI_REG */
1328+
[POL_PORT_MEN] = REG_FIELD(ALE_POLICER_PORT_OUI, 31, 31),
1329+
[POL_TRUNK_ID] = REG_FIELD(ALE_POLICER_PORT_OUI, 30, 30),
1330+
[POL_PORT_NUM] = REG_FIELD(ALE_POLICER_PORT_OUI, 25, 25),
1331+
[POL_PRI_MEN] = REG_FIELD(ALE_POLICER_PORT_OUI, 19, 19),
1332+
[POL_PRI_VAL] = REG_FIELD(ALE_POLICER_PORT_OUI, 16, 18),
1333+
[POL_OUI_MEN] = REG_FIELD(ALE_POLICER_PORT_OUI, 15, 15),
1334+
[POL_OUI_INDEX] = REG_FIELD(ALE_POLICER_PORT_OUI, 0, 5),
1335+
1336+
/* CPSW_ALE_POLICER_DA_SA_REG */
1337+
[POL_DST_MEN] = REG_FIELD(ALE_POLICER_DA_SA, 31, 31),
1338+
[POL_DST_INDEX] = REG_FIELD(ALE_POLICER_DA_SA, 16, 21),
1339+
[POL_SRC_MEN] = REG_FIELD(ALE_POLICER_DA_SA, 15, 15),
1340+
[POL_SRC_INDEX] = REG_FIELD(ALE_POLICER_DA_SA, 0, 5),
1341+
1342+
/* CPSW_ALE_POLICER_VLAN_REG */
1343+
[POL_OVLAN_MEN] = REG_FIELD(ALE_POLICER_VLAN, 31, 31),
1344+
[POL_OVLAN_INDEX] = REG_FIELD(ALE_POLICER_VLAN, 16, 21),
1345+
[POL_IVLAN_MEN] = REG_FIELD(ALE_POLICER_VLAN, 15, 15),
1346+
[POL_IVLAN_INDEX] = REG_FIELD(ALE_POLICER_VLAN, 0, 5),
1347+
1348+
/* CPSW_ALE_POLICER_ETHERTYPE_IPSA_REG */
1349+
[POL_ETHERTYPE_MEN] = REG_FIELD(ALE_POLICER_ETHERTYPE_IPSA, 31, 31),
1350+
[POL_ETHERTYPE_INDEX] = REG_FIELD(ALE_POLICER_ETHERTYPE_IPSA, 16, 21),
1351+
[POL_IPSRC_MEN] = REG_FIELD(ALE_POLICER_ETHERTYPE_IPSA, 15, 15),
1352+
[POL_IPSRC_INDEX] = REG_FIELD(ALE_POLICER_ETHERTYPE_IPSA, 0, 5),
1353+
1354+
/* CPSW_ALE_POLICER_IPDA_REG */
1355+
[POL_IPDST_MEN] = REG_FIELD(ALE_POLICER_IPDA, 31, 31),
1356+
[POL_IPDST_INDEX] = REG_FIELD(ALE_POLICER_IPDA, 16, 21),
1357+
1358+
/* CPSW_ALE_POLICER_TBL_CTL_REG */
1359+
/**
1360+
* REG_FIELDS not defined for this as fields cannot be correctly
1361+
* used independently
1362+
*/
1363+
1364+
/* CPSW_ALE_POLICER_CTL_REG */
1365+
[POL_EN] = REG_FIELD(ALE_POLICER_CTL, 31, 31),
1366+
[POL_RED_DROP_EN] = REG_FIELD(ALE_POLICER_CTL, 29, 29),
1367+
[POL_YELLOW_DROP_EN] = REG_FIELD(ALE_POLICER_CTL, 28, 28),
1368+
[POL_YELLOW_THRESH] = REG_FIELD(ALE_POLICER_CTL, 24, 26),
1369+
[POL_POL_MATCH_MODE] = REG_FIELD(ALE_POLICER_CTL, 22, 23),
1370+
[POL_PRIORITY_THREAD_EN] = REG_FIELD(ALE_POLICER_CTL, 21, 21),
1371+
[POL_MAC_ONLY_DEF_DIS] = REG_FIELD(ALE_POLICER_CTL, 20, 20),
1372+
1373+
/* CPSW_ALE_POLICER_TEST_CTL_REG */
1374+
[POL_TEST_CLR] = REG_FIELD(ALE_POLICER_TEST_CTL, 31, 31),
1375+
[POL_TEST_CLR_RED] = REG_FIELD(ALE_POLICER_TEST_CTL, 30, 30),
1376+
[POL_TEST_CLR_YELLOW] = REG_FIELD(ALE_POLICER_TEST_CTL, 29, 29),
1377+
[POL_TEST_CLR_SELECTED] = REG_FIELD(ALE_POLICER_TEST_CTL, 28, 28),
1378+
[POL_TEST_ENTRY] = REG_FIELD(ALE_POLICER_TEST_CTL, 0, 4),
1379+
1380+
/* CPSW_ALE_POLICER_HIT_STATUS_REG */
1381+
[POL_STATUS_HIT] = REG_FIELD(ALE_POLICER_HIT_STATUS, 31, 31),
1382+
[POL_STATUS_HIT_RED] = REG_FIELD(ALE_POLICER_HIT_STATUS, 30, 30),
1383+
[POL_STATUS_HIT_YELLOW] = REG_FIELD(ALE_POLICER_HIT_STATUS, 29, 29),
1384+
1385+
/* CPSW_ALE_THREAD_DEF_REG */
1386+
[ALE_DEFAULT_THREAD_EN] = REG_FIELD(ALE_THREAD_DEF, 15, 15),
1387+
[ALE_DEFAULT_THREAD_VAL] = REG_FIELD(ALE_THREAD_DEF, 0, 5),
1388+
1389+
/* CPSW_ALE_THREAD_CTL_REG */
1390+
[ALE_THREAD_CLASS_INDEX] = REG_FIELD(ALE_THREAD_CTL, 0, 4),
1391+
1392+
/* CPSW_ALE_THREAD_VAL_REG */
1393+
[ALE_THREAD_ENABLE] = REG_FIELD(ALE_THREAD_VAL, 15, 15),
1394+
[ALE_THREAD_VALUE] = REG_FIELD(ALE_THREAD_VAL, 0, 5),
13091395
};
13101396

13111397
static const struct cpsw_ale_dev_id cpsw_ale_id_match[] = {

drivers/net/ethernet/ti/cpsw_ale.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,47 @@ enum ale_fields {
3636
MAJOR_VER,
3737
ALE_ENTRIES,
3838
ALE_POLICERS,
39+
POL_PORT_MEN,
40+
POL_TRUNK_ID,
41+
POL_PORT_NUM,
42+
POL_PRI_MEN,
43+
POL_PRI_VAL,
44+
POL_OUI_MEN,
45+
POL_OUI_INDEX,
46+
POL_DST_MEN,
47+
POL_DST_INDEX,
48+
POL_SRC_MEN,
49+
POL_SRC_INDEX,
50+
POL_OVLAN_MEN,
51+
POL_OVLAN_INDEX,
52+
POL_IVLAN_MEN,
53+
POL_IVLAN_INDEX,
54+
POL_ETHERTYPE_MEN,
55+
POL_ETHERTYPE_INDEX,
56+
POL_IPSRC_MEN,
57+
POL_IPSRC_INDEX,
58+
POL_IPDST_MEN,
59+
POL_IPDST_INDEX,
60+
POL_EN,
61+
POL_RED_DROP_EN,
62+
POL_YELLOW_DROP_EN,
63+
POL_YELLOW_THRESH,
64+
POL_POL_MATCH_MODE,
65+
POL_PRIORITY_THREAD_EN,
66+
POL_MAC_ONLY_DEF_DIS,
67+
POL_TEST_CLR,
68+
POL_TEST_CLR_RED,
69+
POL_TEST_CLR_YELLOW,
70+
POL_TEST_CLR_SELECTED,
71+
POL_TEST_ENTRY,
72+
POL_STATUS_HIT,
73+
POL_STATUS_HIT_RED,
74+
POL_STATUS_HIT_YELLOW,
75+
ALE_DEFAULT_THREAD_EN,
76+
ALE_DEFAULT_THREAD_VAL,
77+
ALE_THREAD_CLASS_INDEX,
78+
ALE_THREAD_ENABLE,
79+
ALE_THREAD_VALUE,
3980
/* terminator */
4081
ALE_FIELDS_MAX,
4182
};

0 commit comments

Comments
 (0)