xref: /openbmc/linux/drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h (revision d6b6592ac6d11eab91e6758d224eac35f4122aca)
116547577SSunil Goutham /* SPDX-License-Identifier: GPL-2.0 */
2cb0e3ec4SSunil Goutham /* Marvell RVU Ethernet driver
316547577SSunil Goutham  *
4cb0e3ec4SSunil Goutham  * Copyright (C) 2020 Marvell.
516547577SSunil Goutham  *
616547577SSunil Goutham  */
716547577SSunil Goutham 
816547577SSunil Goutham #ifndef OTX2_REG_H
916547577SSunil Goutham #define OTX2_REG_H
1016547577SSunil Goutham 
1116547577SSunil Goutham #include <rvu_struct.h>
1216547577SSunil Goutham 
1316547577SSunil Goutham /* RVU PF registers */
1416547577SSunil Goutham #define	RVU_PF_VFX_PFVF_MBOX0		    (0x00000)
1516547577SSunil Goutham #define	RVU_PF_VFX_PFVF_MBOX1		    (0x00008)
1616547577SSunil Goutham #define RVU_PF_VFX_PFVF_MBOXX(a, b)         (0x0 | (a) << 12 | (b) << 3)
1716547577SSunil Goutham #define RVU_PF_VF_BAR4_ADDR                 (0x10)
1816547577SSunil Goutham #define RVU_PF_BLOCK_ADDRX_DISC(a)          (0x200 | (a) << 3)
1916547577SSunil Goutham #define RVU_PF_VFME_STATUSX(a)              (0x800 | (a) << 3)
2016547577SSunil Goutham #define RVU_PF_VFTRPENDX(a)                 (0x820 | (a) << 3)
2116547577SSunil Goutham #define RVU_PF_VFTRPEND_W1SX(a)             (0x840 | (a) << 3)
2216547577SSunil Goutham #define RVU_PF_VFPF_MBOX_INTX(a)            (0x880 | (a) << 3)
2316547577SSunil Goutham #define RVU_PF_VFPF_MBOX_INT_W1SX(a)        (0x8A0 | (a) << 3)
2416547577SSunil Goutham #define RVU_PF_VFPF_MBOX_INT_ENA_W1SX(a)    (0x8C0 | (a) << 3)
2516547577SSunil Goutham #define RVU_PF_VFPF_MBOX_INT_ENA_W1CX(a)    (0x8E0 | (a) << 3)
2616547577SSunil Goutham #define RVU_PF_VFFLR_INTX(a)                (0x900 | (a) << 3)
2716547577SSunil Goutham #define RVU_PF_VFFLR_INT_W1SX(a)            (0x920 | (a) << 3)
2816547577SSunil Goutham #define RVU_PF_VFFLR_INT_ENA_W1SX(a)        (0x940 | (a) << 3)
2916547577SSunil Goutham #define RVU_PF_VFFLR_INT_ENA_W1CX(a)        (0x960 | (a) << 3)
3016547577SSunil Goutham #define RVU_PF_VFME_INTX(a)                 (0x980 | (a) << 3)
3116547577SSunil Goutham #define RVU_PF_VFME_INT_W1SX(a)             (0x9A0 | (a) << 3)
3216547577SSunil Goutham #define RVU_PF_VFME_INT_ENA_W1SX(a)         (0x9C0 | (a) << 3)
3316547577SSunil Goutham #define RVU_PF_VFME_INT_ENA_W1CX(a)         (0x9E0 | (a) << 3)
3416547577SSunil Goutham #define RVU_PF_PFAF_MBOX0                   (0xC00)
3516547577SSunil Goutham #define RVU_PF_PFAF_MBOX1                   (0xC08)
3616547577SSunil Goutham #define RVU_PF_PFAF_MBOXX(a)                (0xC00 | (a) << 3)
3716547577SSunil Goutham #define RVU_PF_INT                          (0xc20)
3816547577SSunil Goutham #define RVU_PF_INT_W1S                      (0xc28)
3916547577SSunil Goutham #define RVU_PF_INT_ENA_W1S                  (0xc30)
4016547577SSunil Goutham #define RVU_PF_INT_ENA_W1C                  (0xc38)
4116547577SSunil Goutham #define RVU_PF_MSIX_VECX_ADDR(a)            (0x000 | (a) << 4)
4216547577SSunil Goutham #define RVU_PF_MSIX_VECX_CTL(a)             (0x008 | (a) << 4)
4316547577SSunil Goutham #define RVU_PF_MSIX_PBAX(a)                 (0xF0000 | (a) << 3)
44facede82SSubbaraya Sundeep #define RVU_PF_VF_MBOX_ADDR                 (0xC40)
45facede82SSubbaraya Sundeep #define RVU_PF_LMTLINE_ADDR                 (0xC48)
4616547577SSunil Goutham 
473184fb5bSTomasz Duszynski /* RVU VF registers */
483184fb5bSTomasz Duszynski #define	RVU_VF_VFPF_MBOX0		    (0x00000)
493184fb5bSTomasz Duszynski #define	RVU_VF_VFPF_MBOX1		    (0x00008)
503184fb5bSTomasz Duszynski #define	RVU_VF_VFPF_MBOXX(a)		    (0x00 | (a) << 3)
513184fb5bSTomasz Duszynski #define	RVU_VF_INT			    (0x20)
523184fb5bSTomasz Duszynski #define	RVU_VF_INT_W1S			    (0x28)
533184fb5bSTomasz Duszynski #define	RVU_VF_INT_ENA_W1S		    (0x30)
543184fb5bSTomasz Duszynski #define	RVU_VF_INT_ENA_W1C		    (0x38)
553184fb5bSTomasz Duszynski #define	RVU_VF_BLOCK_ADDRX_DISC(a)	    (0x200 | (a) << 3)
563184fb5bSTomasz Duszynski #define	RVU_VF_MSIX_VECX_ADDR(a)	    (0x000 | (a) << 4)
573184fb5bSTomasz Duszynski #define	RVU_VF_MSIX_VECX_CTL(a)		    (0x008 | (a) << 4)
583184fb5bSTomasz Duszynski #define	RVU_VF_MSIX_PBAX(a)		    (0xF0000 | (a) << 3)
59facede82SSubbaraya Sundeep #define RVU_VF_MBOX_REGION                  (0xC0000)
603184fb5bSTomasz Duszynski 
6116547577SSunil Goutham #define RVU_FUNC_BLKADDR_SHIFT		20
6216547577SSunil Goutham #define RVU_FUNC_BLKADDR_MASK		0x1FULL
6316547577SSunil Goutham 
64caa2da34SSunil Goutham /* NPA LF registers */
65caa2da34SSunil Goutham #define NPA_LFBASE			(BLKTYPE_NPA << RVU_FUNC_BLKADDR_SHIFT)
66caa2da34SSunil Goutham #define NPA_LF_AURA_OP_ALLOCX(a)	(NPA_LFBASE | 0x10 | (a) << 3)
67caa2da34SSunil Goutham #define NPA_LF_AURA_OP_FREE0            (NPA_LFBASE | 0x20)
68caa2da34SSunil Goutham #define NPA_LF_AURA_OP_FREE1            (NPA_LFBASE | 0x28)
69caa2da34SSunil Goutham #define NPA_LF_AURA_OP_CNT              (NPA_LFBASE | 0x30)
70caa2da34SSunil Goutham #define NPA_LF_AURA_OP_LIMIT            (NPA_LFBASE | 0x50)
71caa2da34SSunil Goutham #define NPA_LF_AURA_OP_INT              (NPA_LFBASE | 0x60)
72caa2da34SSunil Goutham #define NPA_LF_AURA_OP_THRESH           (NPA_LFBASE | 0x70)
73caa2da34SSunil Goutham #define NPA_LF_POOL_OP_PC               (NPA_LFBASE | 0x100)
74caa2da34SSunil Goutham #define NPA_LF_POOL_OP_AVAILABLE        (NPA_LFBASE | 0x110)
75caa2da34SSunil Goutham #define NPA_LF_POOL_OP_PTR_START0       (NPA_LFBASE | 0x120)
76caa2da34SSunil Goutham #define NPA_LF_POOL_OP_PTR_START1       (NPA_LFBASE | 0x128)
77caa2da34SSunil Goutham #define NPA_LF_POOL_OP_PTR_END0         (NPA_LFBASE | 0x130)
78caa2da34SSunil Goutham #define NPA_LF_POOL_OP_PTR_END1         (NPA_LFBASE | 0x138)
79caa2da34SSunil Goutham #define NPA_LF_POOL_OP_INT              (NPA_LFBASE | 0x160)
80caa2da34SSunil Goutham #define NPA_LF_POOL_OP_THRESH           (NPA_LFBASE | 0x170)
81caa2da34SSunil Goutham #define NPA_LF_ERR_INT                  (NPA_LFBASE | 0x200)
82caa2da34SSunil Goutham #define NPA_LF_ERR_INT_W1S              (NPA_LFBASE | 0x208)
83caa2da34SSunil Goutham #define NPA_LF_ERR_INT_ENA_W1C          (NPA_LFBASE | 0x210)
84caa2da34SSunil Goutham #define NPA_LF_ERR_INT_ENA_W1S          (NPA_LFBASE | 0x218)
85caa2da34SSunil Goutham #define NPA_LF_RAS                      (NPA_LFBASE | 0x220)
86caa2da34SSunil Goutham #define NPA_LF_RAS_W1S                  (NPA_LFBASE | 0x228)
87caa2da34SSunil Goutham #define NPA_LF_RAS_ENA_W1C              (NPA_LFBASE | 0x230)
88caa2da34SSunil Goutham #define NPA_LF_RAS_ENA_W1S              (NPA_LFBASE | 0x238)
89caa2da34SSunil Goutham #define NPA_LF_QINTX_CNT(a)             (NPA_LFBASE | 0x300 | (a) << 12)
90caa2da34SSunil Goutham #define NPA_LF_QINTX_INT(a)             (NPA_LFBASE | 0x310 | (a) << 12)
91caa2da34SSunil Goutham #define NPA_LF_QINTX_INT_W1S(a)         (NPA_LFBASE | 0x318 | (a) << 12)
92caa2da34SSunil Goutham #define NPA_LF_QINTX_ENA_W1S(a)         (NPA_LFBASE | 0x320 | (a) << 12)
93caa2da34SSunil Goutham #define NPA_LF_QINTX_ENA_W1C(a)         (NPA_LFBASE | 0x330 | (a) << 12)
944c236d5dSGeetha sowjanya #define NPA_LF_AURA_BATCH_FREE0         (NPA_LFBASE | 0x400)
95caa2da34SSunil Goutham 
96caa2da34SSunil Goutham /* NIX LF registers */
97caa2da34SSunil Goutham #define	NIX_LFBASE			(BLKTYPE_NIX << RVU_FUNC_BLKADDR_SHIFT)
98caa2da34SSunil Goutham #define	NIX_LF_RX_SECRETX(a)		(NIX_LFBASE | 0x0 | (a) << 3)
99caa2da34SSunil Goutham #define	NIX_LF_CFG			(NIX_LFBASE | 0x100)
100caa2da34SSunil Goutham #define	NIX_LF_GINT			(NIX_LFBASE | 0x200)
101caa2da34SSunil Goutham #define	NIX_LF_GINT_W1S			(NIX_LFBASE | 0x208)
102caa2da34SSunil Goutham #define	NIX_LF_GINT_ENA_W1C		(NIX_LFBASE | 0x210)
103caa2da34SSunil Goutham #define	NIX_LF_GINT_ENA_W1S		(NIX_LFBASE | 0x218)
104caa2da34SSunil Goutham #define	NIX_LF_ERR_INT			(NIX_LFBASE | 0x220)
105caa2da34SSunil Goutham #define	NIX_LF_ERR_INT_W1S		(NIX_LFBASE | 0x228)
106caa2da34SSunil Goutham #define	NIX_LF_ERR_INT_ENA_W1C		(NIX_LFBASE | 0x230)
107caa2da34SSunil Goutham #define	NIX_LF_ERR_INT_ENA_W1S		(NIX_LFBASE | 0x238)
108caa2da34SSunil Goutham #define	NIX_LF_RAS			(NIX_LFBASE | 0x240)
109caa2da34SSunil Goutham #define	NIX_LF_RAS_W1S			(NIX_LFBASE | 0x248)
110caa2da34SSunil Goutham #define	NIX_LF_RAS_ENA_W1C		(NIX_LFBASE | 0x250)
111caa2da34SSunil Goutham #define	NIX_LF_RAS_ENA_W1S		(NIX_LFBASE | 0x258)
112caa2da34SSunil Goutham #define	NIX_LF_SQ_OP_ERR_DBG		(NIX_LFBASE | 0x260)
113caa2da34SSunil Goutham #define	NIX_LF_MNQ_ERR_DBG		(NIX_LFBASE | 0x270)
114caa2da34SSunil Goutham #define	NIX_LF_SEND_ERR_DBG		(NIX_LFBASE | 0x280)
115caa2da34SSunil Goutham #define	NIX_LF_TX_STATX(a)		(NIX_LFBASE | 0x300 | (a) << 3)
116caa2da34SSunil Goutham #define	NIX_LF_RX_STATX(a)		(NIX_LFBASE | 0x400 | (a) << 3)
117caa2da34SSunil Goutham #define	NIX_LF_OP_SENDX(a)		(NIX_LFBASE | 0x800 | (a) << 3)
118caa2da34SSunil Goutham #define	NIX_LF_RQ_OP_INT		(NIX_LFBASE | 0x900)
119caa2da34SSunil Goutham #define	NIX_LF_RQ_OP_OCTS		(NIX_LFBASE | 0x910)
120caa2da34SSunil Goutham #define	NIX_LF_RQ_OP_PKTS		(NIX_LFBASE | 0x920)
121caa2da34SSunil Goutham #define	NIX_LF_OP_IPSEC_DYNO_CN		(NIX_LFBASE | 0x980)
122caa2da34SSunil Goutham #define	NIX_LF_SQ_OP_INT		(NIX_LFBASE | 0xa00)
123caa2da34SSunil Goutham #define	NIX_LF_SQ_OP_OCTS		(NIX_LFBASE | 0xa10)
124caa2da34SSunil Goutham #define	NIX_LF_SQ_OP_PKTS		(NIX_LFBASE | 0xa20)
125caa2da34SSunil Goutham #define	NIX_LF_SQ_OP_STATUS		(NIX_LFBASE | 0xa30)
126caa2da34SSunil Goutham #define	NIX_LF_CQ_OP_INT		(NIX_LFBASE | 0xb00)
127caa2da34SSunil Goutham #define	NIX_LF_CQ_OP_DOOR		(NIX_LFBASE | 0xb30)
128caa2da34SSunil Goutham #define	NIX_LF_CQ_OP_STATUS		(NIX_LFBASE | 0xb40)
129caa2da34SSunil Goutham #define	NIX_LF_QINTX_CNT(a)		(NIX_LFBASE | 0xC00 | (a) << 12)
130caa2da34SSunil Goutham #define	NIX_LF_QINTX_INT(a)		(NIX_LFBASE | 0xC10 | (a) << 12)
131caa2da34SSunil Goutham #define	NIX_LF_QINTX_INT_W1S(a)		(NIX_LFBASE | 0xC18 | (a) << 12)
132caa2da34SSunil Goutham #define	NIX_LF_QINTX_ENA_W1S(a)		(NIX_LFBASE | 0xC20 | (a) << 12)
133caa2da34SSunil Goutham #define	NIX_LF_QINTX_ENA_W1C(a)		(NIX_LFBASE | 0xC30 | (a) << 12)
134caa2da34SSunil Goutham #define	NIX_LF_CINTX_CNT(a)		(NIX_LFBASE | 0xD00 | (a) << 12)
135caa2da34SSunil Goutham #define	NIX_LF_CINTX_WAIT(a)		(NIX_LFBASE | 0xD10 | (a) << 12)
136caa2da34SSunil Goutham #define	NIX_LF_CINTX_INT(a)		(NIX_LFBASE | 0xD20 | (a) << 12)
137caa2da34SSunil Goutham #define	NIX_LF_CINTX_INT_W1S(a)		(NIX_LFBASE | 0xD30 | (a) << 12)
138caa2da34SSunil Goutham #define	NIX_LF_CINTX_ENA_W1S(a)		(NIX_LFBASE | 0xD40 | (a) << 12)
139caa2da34SSunil Goutham #define	NIX_LF_CINTX_ENA_W1C(a)		(NIX_LFBASE | 0xD50 | (a) << 12)
140caa2da34SSunil Goutham 
141caa2da34SSunil Goutham /* NIX AF transmit scheduler registers */
142*38608d07SRatheesh Kannoth #define NIX_AF_SMQX_CFG(a)		(0x700 | (u64)(a) << 16)
143*38608d07SRatheesh Kannoth #define NIX_AF_TL4X_SDP_LINK_CFG(a)	(0xB10 | (u64)(a) << 16)
144*38608d07SRatheesh Kannoth #define NIX_AF_TL1X_SCHEDULE(a)		(0xC00 | (u64)(a) << 16)
145*38608d07SRatheesh Kannoth #define NIX_AF_TL1X_CIR(a)		(0xC20 | (u64)(a) << 16)
146*38608d07SRatheesh Kannoth #define NIX_AF_TL1X_TOPOLOGY(a)		(0xC80 | (u64)(a) << 16)
147*38608d07SRatheesh Kannoth #define NIX_AF_TL2X_PARENT(a)		(0xE88 | (u64)(a) << 16)
148*38608d07SRatheesh Kannoth #define NIX_AF_TL2X_SCHEDULE(a)		(0xE00 | (u64)(a) << 16)
149*38608d07SRatheesh Kannoth #define NIX_AF_TL2X_TOPOLOGY(a)		(0xE80 | (u64)(a) << 16)
150*38608d07SRatheesh Kannoth #define NIX_AF_TL2X_CIR(a)		(0xE20 | (u64)(a) << 16)
151*38608d07SRatheesh Kannoth #define NIX_AF_TL2X_PIR(a)		(0xE30 | (u64)(a) << 16)
152*38608d07SRatheesh Kannoth #define NIX_AF_TL3X_PARENT(a)		(0x1088 | (u64)(a) << 16)
153*38608d07SRatheesh Kannoth #define NIX_AF_TL3X_SCHEDULE(a)		(0x1000 | (u64)(a) << 16)
154*38608d07SRatheesh Kannoth #define NIX_AF_TL3X_SHAPE(a)		(0x1010 | (u64)(a) << 16)
155*38608d07SRatheesh Kannoth #define NIX_AF_TL3X_CIR(a)		(0x1020 | (u64)(a) << 16)
156*38608d07SRatheesh Kannoth #define NIX_AF_TL3X_PIR(a)		(0x1030 | (u64)(a) << 16)
157*38608d07SRatheesh Kannoth #define NIX_AF_TL3X_TOPOLOGY(a)		(0x1080 | (u64)(a) << 16)
158*38608d07SRatheesh Kannoth #define NIX_AF_TL4X_PARENT(a)		(0x1288 | (u64)(a) << 16)
159*38608d07SRatheesh Kannoth #define NIX_AF_TL4X_SCHEDULE(a)		(0x1200 | (u64)(a) << 16)
160*38608d07SRatheesh Kannoth #define NIX_AF_TL4X_SHAPE(a)		(0x1210 | (u64)(a) << 16)
161*38608d07SRatheesh Kannoth #define NIX_AF_TL4X_CIR(a)		(0x1220 | (u64)(a) << 16)
162*38608d07SRatheesh Kannoth #define NIX_AF_TL4X_PIR(a)		(0x1230 | (u64)(a) << 16)
163*38608d07SRatheesh Kannoth #define NIX_AF_TL4X_TOPOLOGY(a)		(0x1280 | (u64)(a) << 16)
164*38608d07SRatheesh Kannoth #define NIX_AF_MDQX_SCHEDULE(a)		(0x1400 | (u64)(a) << 16)
165*38608d07SRatheesh Kannoth #define NIX_AF_MDQX_SHAPE(a)		(0x1410 | (u64)(a) << 16)
166*38608d07SRatheesh Kannoth #define NIX_AF_MDQX_CIR(a)		(0x1420 | (u64)(a) << 16)
167*38608d07SRatheesh Kannoth #define NIX_AF_MDQX_PIR(a)		(0x1430 | (u64)(a) << 16)
168*38608d07SRatheesh Kannoth #define NIX_AF_MDQX_PARENT(a)		(0x1480 | (u64)(a) << 16)
169*38608d07SRatheesh Kannoth #define NIX_AF_TL3_TL2X_LINKX_CFG(a, b)	(0x1700 | (u64)(a) << 16 | (b) << 3)
170caa2da34SSunil Goutham 
171caa2da34SSunil Goutham /* LMT LF registers */
172caa2da34SSunil Goutham #define LMT_LFBASE			BIT_ULL(RVU_FUNC_BLKADDR_SHIFT)
173caa2da34SSunil Goutham #define LMT_LF_LMTLINEX(a)		(LMT_LFBASE | 0x000 | (a) << 12)
174caa2da34SSunil Goutham #define LMT_LF_LMTCANCEL		(LMT_LFBASE | 0x400)
175caa2da34SSunil Goutham 
17616547577SSunil Goutham #endif /* OTX2_REG_H */
177