net: enetc: add definition for offset between eMAC and pMAC regs
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 19 Jan 2023 16:04:28 +0000 (18:04 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 23 Jan 2023 13:13:09 +0000 (13:13 +0000)
This is a preliminary patch which replaces the hardcoded 0x1000 present
in other PM1 (port MAC 1, aka pMAC) register definitions, which is an
offset to the PM0 (port MAC 0, aka eMAC) equivalent register.
This definition will be used in more places by future code.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/enetc/enetc_hw.h

index cc8f1afdc3bc71beb3c1c1bb0a2e44a3ab12ec5a..5c88b3f2a095789eb26511964a6d64eafda2da27 100644 (file)
@@ -226,6 +226,8 @@ enum enetc_bdr_type {TX, RX};
 #define ENETC_MMCSR_ME         BIT(16)
 #define ENETC_PTCMSDUR(n)      (0x2020 + (n) * 4) /* n = TC index [0..7] */
 
+#define ENETC_PMAC_OFFSET      0x1000
+
 #define ENETC_PM0_CMD_CFG      0x8008
 #define ENETC_PM1_CMD_CFG      0x9008
 #define ENETC_PM0_TX_EN                BIT(0)
@@ -280,57 +282,57 @@ enum enetc_bdr_type {TX, RX};
 /* Port MAC counters: Port MAC 0 corresponds to the eMAC and
  * Port MAC 1 to the pMAC.
  */
-#define ENETC_PM_REOCT(mac)    (0x8100 + 0x1000 * (mac))
-#define ENETC_PM_RALN(mac)     (0x8110 + 0x1000 * (mac))
-#define ENETC_PM_RXPF(mac)     (0x8118 + 0x1000 * (mac))
-#define ENETC_PM_RFRM(mac)     (0x8120 + 0x1000 * (mac))
-#define ENETC_PM_RFCS(mac)     (0x8128 + 0x1000 * (mac))
-#define ENETC_PM_RVLAN(mac)    (0x8130 + 0x1000 * (mac))
-#define ENETC_PM_RERR(mac)     (0x8138 + 0x1000 * (mac))
-#define ENETC_PM_RUCA(mac)     (0x8140 + 0x1000 * (mac))
-#define ENETC_PM_RMCA(mac)     (0x8148 + 0x1000 * (mac))
-#define ENETC_PM_RBCA(mac)     (0x8150 + 0x1000 * (mac))
-#define ENETC_PM_RDRP(mac)     (0x8158 + 0x1000 * (mac))
-#define ENETC_PM_RPKT(mac)     (0x8160 + 0x1000 * (mac))
-#define ENETC_PM_RUND(mac)     (0x8168 + 0x1000 * (mac))
-#define ENETC_PM_R64(mac)      (0x8170 + 0x1000 * (mac))
-#define ENETC_PM_R127(mac)     (0x8178 + 0x1000 * (mac))
-#define ENETC_PM_R255(mac)     (0x8180 + 0x1000 * (mac))
-#define ENETC_PM_R511(mac)     (0x8188 + 0x1000 * (mac))
-#define ENETC_PM_R1023(mac)    (0x8190 + 0x1000 * (mac))
-#define ENETC_PM_R1522(mac)    (0x8198 + 0x1000 * (mac))
-#define ENETC_PM_R1523X(mac)   (0x81A0 + 0x1000 * (mac))
-#define ENETC_PM_ROVR(mac)     (0x81A8 + 0x1000 * (mac))
-#define ENETC_PM_RJBR(mac)     (0x81B0 + 0x1000 * (mac))
-#define ENETC_PM_RFRG(mac)     (0x81B8 + 0x1000 * (mac))
-#define ENETC_PM_RCNP(mac)     (0x81C0 + 0x1000 * (mac))
-#define ENETC_PM_RDRNTP(mac)   (0x81C8 + 0x1000 * (mac))
-#define ENETC_PM_TEOCT(mac)    (0x8200 + 0x1000 * (mac))
-#define ENETC_PM_TOCT(mac)     (0x8208 + 0x1000 * (mac))
-#define ENETC_PM_TCRSE(mac)    (0x8210 + 0x1000 * (mac))
-#define ENETC_PM_TXPF(mac)     (0x8218 + 0x1000 * (mac))
-#define ENETC_PM_TFRM(mac)     (0x8220 + 0x1000 * (mac))
-#define ENETC_PM_TFCS(mac)     (0x8228 + 0x1000 * (mac))
-#define ENETC_PM_TVLAN(mac)    (0x8230 + 0x1000 * (mac))
-#define ENETC_PM_TERR(mac)     (0x8238 + 0x1000 * (mac))
-#define ENETC_PM_TUCA(mac)     (0x8240 + 0x1000 * (mac))
-#define ENETC_PM_TMCA(mac)     (0x8248 + 0x1000 * (mac))
-#define ENETC_PM_TBCA(mac)     (0x8250 + 0x1000 * (mac))
-#define ENETC_PM_TPKT(mac)     (0x8260 + 0x1000 * (mac))
-#define ENETC_PM_TUND(mac)     (0x8268 + 0x1000 * (mac))
-#define ENETC_PM_T64(mac)      (0x8270 + 0x1000 * (mac))
-#define ENETC_PM_T127(mac)     (0x8278 + 0x1000 * (mac))
-#define ENETC_PM_T255(mac)     (0x8280 + 0x1000 * (mac))
-#define ENETC_PM_T511(mac)     (0x8288 + 0x1000 * (mac))
-#define ENETC_PM_T1023(mac)    (0x8290 + 0x1000 * (mac))
-#define ENETC_PM_T1522(mac)    (0x8298 + 0x1000 * (mac))
-#define ENETC_PM_T1523X(mac)   (0x82A0 + 0x1000 * (mac))
-#define ENETC_PM_TCNP(mac)     (0x82C0 + 0x1000 * (mac))
-#define ENETC_PM_TDFR(mac)     (0x82D0 + 0x1000 * (mac))
-#define ENETC_PM_TMCOL(mac)    (0x82D8 + 0x1000 * (mac))
-#define ENETC_PM_TSCOL(mac)    (0x82E0 + 0x1000 * (mac))
-#define ENETC_PM_TLCOL(mac)    (0x82E8 + 0x1000 * (mac))
-#define ENETC_PM_TECOL(mac)    (0x82F0 + 0x1000 * (mac))
+#define ENETC_PM_REOCT(mac)    (0x8100 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RALN(mac)     (0x8110 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RXPF(mac)     (0x8118 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RFRM(mac)     (0x8120 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RFCS(mac)     (0x8128 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RVLAN(mac)    (0x8130 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RERR(mac)     (0x8138 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RUCA(mac)     (0x8140 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RMCA(mac)     (0x8148 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RBCA(mac)     (0x8150 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RDRP(mac)     (0x8158 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RPKT(mac)     (0x8160 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RUND(mac)     (0x8168 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_R64(mac)      (0x8170 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_R127(mac)     (0x8178 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_R255(mac)     (0x8180 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_R511(mac)     (0x8188 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_R1023(mac)    (0x8190 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_R1522(mac)    (0x8198 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_R1523X(mac)   (0x81A0 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_ROVR(mac)     (0x81A8 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RJBR(mac)     (0x81B0 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RFRG(mac)     (0x81B8 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RCNP(mac)     (0x81C0 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_RDRNTP(mac)   (0x81C8 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TEOCT(mac)    (0x8200 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TOCT(mac)     (0x8208 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TCRSE(mac)    (0x8210 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TXPF(mac)     (0x8218 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TFRM(mac)     (0x8220 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TFCS(mac)     (0x8228 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TVLAN(mac)    (0x8230 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TERR(mac)     (0x8238 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TUCA(mac)     (0x8240 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TMCA(mac)     (0x8248 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TBCA(mac)     (0x8250 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TPKT(mac)     (0x8260 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TUND(mac)     (0x8268 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_T64(mac)      (0x8270 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_T127(mac)     (0x8278 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_T255(mac)     (0x8280 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_T511(mac)     (0x8288 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_T1023(mac)    (0x8290 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_T1522(mac)    (0x8298 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_T1523X(mac)   (0x82A0 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TCNP(mac)     (0x82C0 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TDFR(mac)     (0x82D0 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TMCOL(mac)    (0x82D8 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TSCOL(mac)    (0x82E0 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TLCOL(mac)    (0x82E8 + ENETC_PMAC_OFFSET * (mac))
+#define ENETC_PM_TECOL(mac)    (0x82F0 + ENETC_PMAC_OFFSET * (mac))
 
 /* Port counters */
 #define ENETC_PICDR(n)         (0x0700 + (n) * 8) /* n = [0..3] */