xref: /dpdk/drivers/bus/fslmc/qbman/qbman_sys.h (revision b3bd7a50d100f2328d349277745d012563f0ac93)
1131a75b6SHemant Agrawal /* SPDX-License-Identifier: BSD-3-Clause
2531b17a7SHemant Agrawal  *
3531b17a7SHemant Agrawal  * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
4*b3bd7a50SNipun Gupta  * Copyright 2019-2020 NXP
5531b17a7SHemant Agrawal  */
6531b17a7SHemant Agrawal /* qbman_sys_decl.h and qbman_sys.h are the two platform-specific files in the
7531b17a7SHemant Agrawal  * driver. They are only included via qbman_private.h, which is itself a
8531b17a7SHemant Agrawal  * platform-independent file and is included by all the other driver source.
9531b17a7SHemant Agrawal  *
10531b17a7SHemant Agrawal  * qbman_sys_decl.h is included prior to all other declarations and logic, and
11531b17a7SHemant Agrawal  * it exists to provide compatibility with any linux interfaces our
12531b17a7SHemant Agrawal  * single-source driver code is dependent on (eg. kmalloc). Ie. this file
13531b17a7SHemant Agrawal  * provides linux compatibility.
14531b17a7SHemant Agrawal  *
15531b17a7SHemant Agrawal  * This qbman_sys.h header, on the other hand, is included *after* any common
16531b17a7SHemant Agrawal  * and platform-neutral declarations and logic in qbman_private.h, and exists to
17531b17a7SHemant Agrawal  * implement any platform-specific logic of the qbman driver itself. Ie. it is
18531b17a7SHemant Agrawal  * *not* to provide linux compatibility.
19531b17a7SHemant Agrawal  */
20531b17a7SHemant Agrawal 
21293c0ca9SNipun Gupta #ifndef _QBMAN_SYS_H_
22293c0ca9SNipun Gupta #define _QBMAN_SYS_H_
23293c0ca9SNipun Gupta 
24d95bdc09SHemant Agrawal #include "qbman_sys_decl.h"
25d95bdc09SHemant Agrawal 
26171c8504SHemant Agrawal #define CENA_WRITE_ENABLE 0
27171c8504SHemant Agrawal #define CINH_WRITE_ENABLE 1
28171c8504SHemant Agrawal 
29293c0ca9SNipun Gupta /* CINH register offsets */
30293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_EQCR_PI      0x800
31293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_EQCR_CI      0x840
32293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_EQAR         0x8c0
33293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_CR_RT        0x900
34293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_VDQCR_RT     0x940
35293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_EQCR_AM_RT   0x980
36293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_RCR_AM_RT    0x9c0
37293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_DQPI         0xa00
38293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_DQRR_ITR     0xa80
39293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_DCAP         0xac0
40293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_SDQCR        0xb00
41293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_EQCR_AM_RT2  0xb40
42293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_RCR_PI       0xc00
43293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_RAR          0xcc0
44293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_ISR          0xe00
45293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_IER          0xe40
46293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_ISDR         0xe80
47293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_IIR          0xec0
48293c0ca9SNipun Gupta #define QBMAN_CINH_SWP_ITPR         0xf40
49293c0ca9SNipun Gupta 
50293c0ca9SNipun Gupta /* CENA register offsets */
51293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_EQCR(n) (0x000 + ((uint32_t)(n) << 6))
52293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_DQRR(n) (0x200 + ((uint32_t)(n) << 6))
53293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_RCR(n)  (0x400 + ((uint32_t)(n) << 6))
54293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_CR      0x600
55293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_RR(vb)  (0x700 + ((uint32_t)(vb) >> 1))
56293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_VDQCR   0x780
57293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_EQCR_CI 0x840
582557cf8fSYouri Querry #define QBMAN_CENA_SWP_EQCR_CI_MEMBACK 0x1840
59293c0ca9SNipun Gupta 
60293c0ca9SNipun Gupta /* CENA register offsets in memory-backed mode */
61293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_DQRR_MEM(n)  (0x800 + ((uint32_t)(n) << 6))
62293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_RCR_MEM(n)   (0x1400 + ((uint32_t)(n) << 6))
63293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_CR_MEM       0x1600
64293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_RR_MEM       0x1680
65293c0ca9SNipun Gupta #define QBMAN_CENA_SWP_VDQCR_MEM    0x1780
66293c0ca9SNipun Gupta 
67d95bdc09SHemant Agrawal /* Debugging assists */
__hexdump(unsigned long start,unsigned long end,unsigned long p,size_t sz,const unsigned char * c)68d95bdc09SHemant Agrawal static inline void __hexdump(unsigned long start, unsigned long end,
69d95bdc09SHemant Agrawal 			     unsigned long p, size_t sz, const unsigned char *c)
70d95bdc09SHemant Agrawal {
71d95bdc09SHemant Agrawal 	while (start < end) {
72d95bdc09SHemant Agrawal 		unsigned int pos = 0;
73d95bdc09SHemant Agrawal 		char buf[64];
74d95bdc09SHemant Agrawal 		int nl = 0;
75d95bdc09SHemant Agrawal 
76d95bdc09SHemant Agrawal 		pos += sprintf(buf + pos, "%08lx: ", start);
77d95bdc09SHemant Agrawal 		do {
78d95bdc09SHemant Agrawal 			if ((start < p) || (start >= (p + sz)))
79d95bdc09SHemant Agrawal 				pos += sprintf(buf + pos, "..");
80d95bdc09SHemant Agrawal 			else
81d95bdc09SHemant Agrawal 				pos += sprintf(buf + pos, "%02x", *(c++));
82d95bdc09SHemant Agrawal 			if (!(++start & 15)) {
83d95bdc09SHemant Agrawal 				buf[pos++] = '\n';
84d95bdc09SHemant Agrawal 				nl = 1;
85d95bdc09SHemant Agrawal 			} else {
86d95bdc09SHemant Agrawal 				nl = 0;
87d95bdc09SHemant Agrawal 				if (!(start & 1))
88d95bdc09SHemant Agrawal 					buf[pos++] = ' ';
89d95bdc09SHemant Agrawal 				if (!(start & 3))
90d95bdc09SHemant Agrawal 					buf[pos++] = ' ';
91d95bdc09SHemant Agrawal 			}
92d95bdc09SHemant Agrawal 		} while (start & 15);
93d95bdc09SHemant Agrawal 		if (!nl)
94d95bdc09SHemant Agrawal 			buf[pos++] = '\n';
95d95bdc09SHemant Agrawal 		buf[pos] = '\0';
96d95bdc09SHemant Agrawal 		pr_info("%s", buf);
97d95bdc09SHemant Agrawal 	}
98d95bdc09SHemant Agrawal }
99d95bdc09SHemant Agrawal 
hexdump(const void * ptr,size_t sz)100d95bdc09SHemant Agrawal static inline void hexdump(const void *ptr, size_t sz)
101d95bdc09SHemant Agrawal {
102d95bdc09SHemant Agrawal 	unsigned long p = (unsigned long)ptr;
103d95bdc09SHemant Agrawal 	unsigned long start = p & ~15;
104d95bdc09SHemant Agrawal 	unsigned long end = (p + sz + 15) & ~15;
105d95bdc09SHemant Agrawal 	const unsigned char *c = ptr;
106d95bdc09SHemant Agrawal 
107d95bdc09SHemant Agrawal 	__hexdump(start, end, p, sz, c);
108d95bdc09SHemant Agrawal }
109531b17a7SHemant Agrawal 
110531b17a7SHemant Agrawal /* Currently, the CENA support code expects each 32-bit word to be written in
111531b17a7SHemant Agrawal  * host order, and these are converted to hardware (little-endian) order on
112531b17a7SHemant Agrawal  * command submission. However, 64-bit quantities are must be written (and read)
113531b17a7SHemant Agrawal  * as two 32-bit words with the least-significant word first, irrespective of
114531b17a7SHemant Agrawal  * host endianness.
115531b17a7SHemant Agrawal  */
u64_to_le32_copy(void * d,const uint64_t * s,unsigned int cnt)116531b17a7SHemant Agrawal static inline void u64_to_le32_copy(void *d, const uint64_t *s,
117531b17a7SHemant Agrawal 				    unsigned int cnt)
118531b17a7SHemant Agrawal {
119531b17a7SHemant Agrawal 	uint32_t *dd = d;
120531b17a7SHemant Agrawal 	const uint32_t *ss = (const uint32_t *)s;
121531b17a7SHemant Agrawal 
122531b17a7SHemant Agrawal 	while (cnt--) {
123531b17a7SHemant Agrawal 		/* TBD: the toolchain was choking on the use of 64-bit types up
124531b17a7SHemant Agrawal 		 * until recently so this works entirely with 32-bit variables.
125531b17a7SHemant Agrawal 		 * When 64-bit types become usable again, investigate better
126531b17a7SHemant Agrawal 		 * ways of doing this.
127531b17a7SHemant Agrawal 		 */
128531b17a7SHemant Agrawal #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
129531b17a7SHemant Agrawal 		*(dd++) = ss[1];
130531b17a7SHemant Agrawal 		*(dd++) = ss[0];
131531b17a7SHemant Agrawal 		ss += 2;
132531b17a7SHemant Agrawal #else
133531b17a7SHemant Agrawal 		*(dd++) = *(ss++);
134531b17a7SHemant Agrawal 		*(dd++) = *(ss++);
135531b17a7SHemant Agrawal #endif
136531b17a7SHemant Agrawal 	}
137531b17a7SHemant Agrawal }
138531b17a7SHemant Agrawal 
u64_from_le32_copy(uint64_t * d,const void * s,unsigned int cnt)139531b17a7SHemant Agrawal static inline void u64_from_le32_copy(uint64_t *d, const void *s,
140531b17a7SHemant Agrawal 				      unsigned int cnt)
141531b17a7SHemant Agrawal {
142531b17a7SHemant Agrawal 	const uint32_t *ss = s;
143531b17a7SHemant Agrawal 	uint32_t *dd = (uint32_t *)d;
144531b17a7SHemant Agrawal 
145531b17a7SHemant Agrawal 	while (cnt--) {
146531b17a7SHemant Agrawal #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
147531b17a7SHemant Agrawal 		dd[1] = *(ss++);
148531b17a7SHemant Agrawal 		dd[0] = *(ss++);
149531b17a7SHemant Agrawal 		dd += 2;
150531b17a7SHemant Agrawal #else
151531b17a7SHemant Agrawal 		*(dd++) = *(ss++);
152531b17a7SHemant Agrawal 		*(dd++) = *(ss++);
153531b17a7SHemant Agrawal #endif
154531b17a7SHemant Agrawal 	}
155531b17a7SHemant Agrawal }
156531b17a7SHemant Agrawal 
157531b17a7SHemant Agrawal 	/******************/
158531b17a7SHemant Agrawal 	/* Portal access  */
159531b17a7SHemant Agrawal 	/******************/
160531b17a7SHemant Agrawal struct qbman_swp_sys {
161531b17a7SHemant Agrawal 	/* On GPP, the sys support for qbman_swp is here. The CENA region isi
162531b17a7SHemant Agrawal 	 * not an mmap() of the real portal registers, but an allocated
163531b17a7SHemant Agrawal 	 * place-holder, because the actual writes/reads to/from the portal are
164531b17a7SHemant Agrawal 	 * marshalled from these allocated areas using QBMan's "MC access
165531b17a7SHemant Agrawal 	 * registers". CINH accesses are atomic so there's no need for a
166531b17a7SHemant Agrawal 	 * place-holder.
167531b17a7SHemant Agrawal 	 */
168531b17a7SHemant Agrawal 	uint8_t *cena;
169293c0ca9SNipun Gupta 	uint8_t *addr_cena;
170293c0ca9SNipun Gupta 	uint8_t *addr_cinh;
171531b17a7SHemant Agrawal 	uint32_t idx;
172531b17a7SHemant Agrawal 	enum qbman_eqcr_mode eqcr_mode;
173531b17a7SHemant Agrawal };
174531b17a7SHemant Agrawal 
175531b17a7SHemant Agrawal /* P_OFFSET is (ACCESS_CMD,0,12) - offset within the portal
176531b17a7SHemant Agrawal  * C is (ACCESS_CMD,12,1) - is inhibited? (0==CENA, 1==CINH)
177531b17a7SHemant Agrawal  * SWP_IDX is (ACCESS_CMD,16,10) - Software portal index
178531b17a7SHemant Agrawal  * P is (ACCESS_CMD,28,1) - (0==special portal, 1==any portal)
179531b17a7SHemant Agrawal  * T is (ACCESS_CMD,29,1) - Command type (0==READ, 1==WRITE)
180531b17a7SHemant Agrawal  * E is (ACCESS_CMD,31,1) - Command execute (1 to issue, poll for 0==complete)
181531b17a7SHemant Agrawal  */
182531b17a7SHemant Agrawal 
qbman_cinh_write(struct qbman_swp_sys * s,uint32_t offset,uint32_t val)183531b17a7SHemant Agrawal static inline void qbman_cinh_write(struct qbman_swp_sys *s, uint32_t offset,
184531b17a7SHemant Agrawal 				    uint32_t val)
185531b17a7SHemant Agrawal {
186531b17a7SHemant Agrawal 	__raw_writel(val, s->addr_cinh + offset);
187531b17a7SHemant Agrawal #ifdef QBMAN_CINH_TRACE
188531b17a7SHemant Agrawal 	pr_info("qbman_cinh_write(%p:%d:0x%03x) 0x%08x\n",
189531b17a7SHemant Agrawal 		s->addr_cinh, s->idx, offset, val);
190531b17a7SHemant Agrawal #endif
191531b17a7SHemant Agrawal }
192531b17a7SHemant Agrawal 
qbman_cinh_write_start_wo_shadow(struct qbman_swp_sys * s,uint32_t offset)193*b3bd7a50SNipun Gupta static inline void *qbman_cinh_write_start_wo_shadow(struct qbman_swp_sys *s,
194*b3bd7a50SNipun Gupta 						     uint32_t offset)
195*b3bd7a50SNipun Gupta {
196*b3bd7a50SNipun Gupta #ifdef QBMAN_CINH_TRACE
197*b3bd7a50SNipun Gupta 	pr_info("qbman_cinh_write_start(%p:%d:0x%03x)\n",
198*b3bd7a50SNipun Gupta 		s->addr_cinh, s->idx, offset);
199*b3bd7a50SNipun Gupta #endif
200*b3bd7a50SNipun Gupta 	QBMAN_BUG_ON(offset & 63);
201*b3bd7a50SNipun Gupta 	return (s->addr_cinh + offset);
202*b3bd7a50SNipun Gupta }
203*b3bd7a50SNipun Gupta 
qbman_cinh_write_complete(struct qbman_swp_sys * s,uint32_t offset,void * cmd)204*b3bd7a50SNipun Gupta static inline void qbman_cinh_write_complete(struct qbman_swp_sys *s,
205*b3bd7a50SNipun Gupta 					     uint32_t offset, void *cmd)
206*b3bd7a50SNipun Gupta {
207*b3bd7a50SNipun Gupta 	const uint32_t *shadow = cmd;
208*b3bd7a50SNipun Gupta 	int loop;
209*b3bd7a50SNipun Gupta #ifdef QBMAN_CINH_TRACE
210*b3bd7a50SNipun Gupta 	pr_info("qbman_cinh_write_complete(%p:%d:0x%03x) %p\n",
211*b3bd7a50SNipun Gupta 		s->addr_cinh, s->idx, offset, shadow);
212*b3bd7a50SNipun Gupta 	hexdump(cmd, 64);
213*b3bd7a50SNipun Gupta #endif
214*b3bd7a50SNipun Gupta 	for (loop = 15; loop >= 1; loop--)
215*b3bd7a50SNipun Gupta 		__raw_writel(shadow[loop], s->addr_cinh +
216*b3bd7a50SNipun Gupta 					 offset + loop * 4);
217*b3bd7a50SNipun Gupta 	lwsync();
218*b3bd7a50SNipun Gupta 	__raw_writel(shadow[0], s->addr_cinh + offset);
219*b3bd7a50SNipun Gupta }
220*b3bd7a50SNipun Gupta 
qbman_cinh_read(struct qbman_swp_sys * s,uint32_t offset)221531b17a7SHemant Agrawal static inline uint32_t qbman_cinh_read(struct qbman_swp_sys *s, uint32_t offset)
222531b17a7SHemant Agrawal {
223531b17a7SHemant Agrawal 	uint32_t reg = __raw_readl(s->addr_cinh + offset);
224531b17a7SHemant Agrawal #ifdef QBMAN_CINH_TRACE
225531b17a7SHemant Agrawal 	pr_info("qbman_cinh_read(%p:%d:0x%03x) 0x%08x\n",
226531b17a7SHemant Agrawal 		s->addr_cinh, s->idx, offset, reg);
227531b17a7SHemant Agrawal #endif
228531b17a7SHemant Agrawal 	return reg;
229531b17a7SHemant Agrawal }
230531b17a7SHemant Agrawal 
qbman_cinh_read_shadow(struct qbman_swp_sys * s,uint32_t offset)231*b3bd7a50SNipun Gupta static inline void *qbman_cinh_read_shadow(struct qbman_swp_sys *s,
232*b3bd7a50SNipun Gupta 					   uint32_t offset)
233*b3bd7a50SNipun Gupta {
234*b3bd7a50SNipun Gupta 	uint32_t *shadow = (uint32_t *)(s->cena + offset);
235*b3bd7a50SNipun Gupta 	unsigned int loop;
236*b3bd7a50SNipun Gupta #ifdef QBMAN_CINH_TRACE
237*b3bd7a50SNipun Gupta 	pr_info(" %s (%p:%d:0x%03x) %p\n", __func__,
238*b3bd7a50SNipun Gupta 		s->addr_cinh, s->idx, offset, shadow);
239*b3bd7a50SNipun Gupta #endif
240*b3bd7a50SNipun Gupta 
241*b3bd7a50SNipun Gupta 	for (loop = 0; loop < 16; loop++)
242*b3bd7a50SNipun Gupta 		shadow[loop] = __raw_readl(s->addr_cinh + offset
243*b3bd7a50SNipun Gupta 					+ loop * 4);
244*b3bd7a50SNipun Gupta #ifdef QBMAN_CINH_TRACE
245*b3bd7a50SNipun Gupta 	hexdump(shadow, 64);
246*b3bd7a50SNipun Gupta #endif
247*b3bd7a50SNipun Gupta 	return shadow;
248*b3bd7a50SNipun Gupta }
249*b3bd7a50SNipun Gupta 
qbman_cinh_read_wo_shadow(struct qbman_swp_sys * s,uint32_t offset)250*b3bd7a50SNipun Gupta static inline void *qbman_cinh_read_wo_shadow(struct qbman_swp_sys *s,
251*b3bd7a50SNipun Gupta 					      uint32_t offset)
252*b3bd7a50SNipun Gupta {
253*b3bd7a50SNipun Gupta #ifdef QBMAN_CINH_TRACE
254*b3bd7a50SNipun Gupta 	pr_info("qbman_cinh_read(%p:%d:0x%03x)\n",
255*b3bd7a50SNipun Gupta 		s->addr_cinh, s->idx, offset);
256*b3bd7a50SNipun Gupta #endif
257*b3bd7a50SNipun Gupta 	return s->addr_cinh + offset;
258*b3bd7a50SNipun Gupta }
259*b3bd7a50SNipun Gupta 
qbman_cena_write_start(struct qbman_swp_sys * s,uint32_t offset)260531b17a7SHemant Agrawal static inline void *qbman_cena_write_start(struct qbman_swp_sys *s,
261531b17a7SHemant Agrawal 					   uint32_t offset)
262531b17a7SHemant Agrawal {
263531b17a7SHemant Agrawal 	void *shadow = s->cena + offset;
264531b17a7SHemant Agrawal 
265531b17a7SHemant Agrawal #ifdef QBMAN_CENA_TRACE
266531b17a7SHemant Agrawal 	pr_info("qbman_cena_write_start(%p:%d:0x%03x) %p\n",
267531b17a7SHemant Agrawal 		s->addr_cena, s->idx, offset, shadow);
268531b17a7SHemant Agrawal #endif
269531b17a7SHemant Agrawal 	QBMAN_BUG_ON(offset & 63);
270531b17a7SHemant Agrawal 	dcbz(shadow);
271531b17a7SHemant Agrawal 	return shadow;
272531b17a7SHemant Agrawal }
273531b17a7SHemant Agrawal 
qbman_cena_write_start_wo_shadow(struct qbman_swp_sys * s,uint32_t offset)274531b17a7SHemant Agrawal static inline void *qbman_cena_write_start_wo_shadow(struct qbman_swp_sys *s,
275531b17a7SHemant Agrawal 						     uint32_t offset)
276531b17a7SHemant Agrawal {
277531b17a7SHemant Agrawal #ifdef QBMAN_CENA_TRACE
278531b17a7SHemant Agrawal 	pr_info("qbman_cena_write_start(%p:%d:0x%03x)\n",
279531b17a7SHemant Agrawal 		s->addr_cena, s->idx, offset);
280531b17a7SHemant Agrawal #endif
281531b17a7SHemant Agrawal 	QBMAN_BUG_ON(offset & 63);
282171c8504SHemant Agrawal #ifdef RTE_ARCH_64
283531b17a7SHemant Agrawal 	return (s->addr_cena + offset);
284171c8504SHemant Agrawal #else
285171c8504SHemant Agrawal 	return (s->addr_cinh + offset);
286171c8504SHemant Agrawal #endif
287531b17a7SHemant Agrawal }
288531b17a7SHemant Agrawal 
qbman_cena_write_complete(struct qbman_swp_sys * s,uint32_t offset,void * cmd)289531b17a7SHemant Agrawal static inline void qbman_cena_write_complete(struct qbman_swp_sys *s,
290531b17a7SHemant Agrawal 					     uint32_t offset, void *cmd)
291531b17a7SHemant Agrawal {
292531b17a7SHemant Agrawal 	const uint32_t *shadow = cmd;
293531b17a7SHemant Agrawal 	int loop;
294531b17a7SHemant Agrawal #ifdef QBMAN_CENA_TRACE
295531b17a7SHemant Agrawal 	pr_info("qbman_cena_write_complete(%p:%d:0x%03x) %p\n",
296531b17a7SHemant Agrawal 		s->addr_cena, s->idx, offset, shadow);
297531b17a7SHemant Agrawal 	hexdump(cmd, 64);
298531b17a7SHemant Agrawal #endif
299171c8504SHemant Agrawal #ifdef RTE_ARCH_64
300531b17a7SHemant Agrawal 	for (loop = 15; loop >= 1; loop--)
301531b17a7SHemant Agrawal 		__raw_writel(shadow[loop], s->addr_cena +
302531b17a7SHemant Agrawal 					 offset + loop * 4);
303531b17a7SHemant Agrawal 	lwsync();
304531b17a7SHemant Agrawal 		__raw_writel(shadow[0], s->addr_cena + offset);
305171c8504SHemant Agrawal #else
306171c8504SHemant Agrawal 	for (loop = 15; loop >= 1; loop--)
307171c8504SHemant Agrawal 		__raw_writel(shadow[loop], s->addr_cinh +
308171c8504SHemant Agrawal 					 offset + loop * 4);
309171c8504SHemant Agrawal 	lwsync();
310171c8504SHemant Agrawal 	__raw_writel(shadow[0], s->addr_cinh + offset);
311171c8504SHemant Agrawal #endif
312531b17a7SHemant Agrawal 	dcbf(s->addr_cena + offset);
313531b17a7SHemant Agrawal }
314531b17a7SHemant Agrawal 
qbman_cena_write_complete_wo_shadow(struct qbman_swp_sys * s,uint32_t offset)315531b17a7SHemant Agrawal static inline void qbman_cena_write_complete_wo_shadow(struct qbman_swp_sys *s,
316531b17a7SHemant Agrawal 						       uint32_t offset)
317531b17a7SHemant Agrawal {
318531b17a7SHemant Agrawal #ifdef QBMAN_CENA_TRACE
319531b17a7SHemant Agrawal 	pr_info("qbman_cena_write_complete(%p:%d:0x%03x)\n",
320531b17a7SHemant Agrawal 		s->addr_cena, s->idx, offset);
321531b17a7SHemant Agrawal #endif
322531b17a7SHemant Agrawal 	dcbf(s->addr_cena + offset);
323531b17a7SHemant Agrawal }
324531b17a7SHemant Agrawal 
qbman_cena_read_reg(struct qbman_swp_sys * s,uint32_t offset)325531b17a7SHemant Agrawal static inline uint32_t qbman_cena_read_reg(struct qbman_swp_sys *s,
326531b17a7SHemant Agrawal 					   uint32_t offset)
327531b17a7SHemant Agrawal {
328531b17a7SHemant Agrawal 	return __raw_readl(s->addr_cena + offset);
329531b17a7SHemant Agrawal }
330531b17a7SHemant Agrawal 
qbman_cena_read(struct qbman_swp_sys * s,uint32_t offset)331531b17a7SHemant Agrawal static inline void *qbman_cena_read(struct qbman_swp_sys *s, uint32_t offset)
332531b17a7SHemant Agrawal {
333531b17a7SHemant Agrawal 	uint32_t *shadow = (uint32_t *)(s->cena + offset);
334531b17a7SHemant Agrawal 	unsigned int loop;
335531b17a7SHemant Agrawal #ifdef QBMAN_CENA_TRACE
336531b17a7SHemant Agrawal 	pr_info("qbman_cena_read(%p:%d:0x%03x) %p\n",
337531b17a7SHemant Agrawal 		s->addr_cena, s->idx, offset, shadow);
338531b17a7SHemant Agrawal #endif
339531b17a7SHemant Agrawal 
340171c8504SHemant Agrawal #ifdef RTE_ARCH_64
341531b17a7SHemant Agrawal 	for (loop = 0; loop < 16; loop++)
342531b17a7SHemant Agrawal 		shadow[loop] = __raw_readl(s->addr_cena + offset
343531b17a7SHemant Agrawal 					+ loop * 4);
344171c8504SHemant Agrawal #else
345171c8504SHemant Agrawal 	for (loop = 0; loop < 16; loop++)
346171c8504SHemant Agrawal 		shadow[loop] = __raw_readl(s->addr_cinh + offset
347171c8504SHemant Agrawal 					+ loop * 4);
348171c8504SHemant Agrawal #endif
349531b17a7SHemant Agrawal #ifdef QBMAN_CENA_TRACE
350531b17a7SHemant Agrawal 	hexdump(shadow, 64);
351531b17a7SHemant Agrawal #endif
352531b17a7SHemant Agrawal 	return shadow;
353531b17a7SHemant Agrawal }
354531b17a7SHemant Agrawal 
qbman_cena_read_wo_shadow(struct qbman_swp_sys * s,uint32_t offset)355531b17a7SHemant Agrawal static inline void *qbman_cena_read_wo_shadow(struct qbman_swp_sys *s,
356531b17a7SHemant Agrawal 					      uint32_t offset)
357531b17a7SHemant Agrawal {
358531b17a7SHemant Agrawal #ifdef QBMAN_CENA_TRACE
359d95bdc09SHemant Agrawal 	pr_info("qbman_cena_read(%p:%d:0x%03x)\n",
360f739d6f8SHaiying Wang 		s->addr_cena, s->idx, offset);
361531b17a7SHemant Agrawal #endif
362531b17a7SHemant Agrawal 	return s->addr_cena + offset;
363531b17a7SHemant Agrawal }
364531b17a7SHemant Agrawal 
qbman_cena_invalidate(struct qbman_swp_sys * s,uint32_t offset)365531b17a7SHemant Agrawal static inline void qbman_cena_invalidate(struct qbman_swp_sys *s,
366531b17a7SHemant Agrawal 					 uint32_t offset)
367531b17a7SHemant Agrawal {
368531b17a7SHemant Agrawal 	dccivac(s->addr_cena + offset);
369531b17a7SHemant Agrawal }
370531b17a7SHemant Agrawal 
qbman_cena_invalidate_prefetch(struct qbman_swp_sys * s,uint32_t offset)371531b17a7SHemant Agrawal static inline void qbman_cena_invalidate_prefetch(struct qbman_swp_sys *s,
372531b17a7SHemant Agrawal 						  uint32_t offset)
373531b17a7SHemant Agrawal {
374531b17a7SHemant Agrawal 	dccivac(s->addr_cena + offset);
375531b17a7SHemant Agrawal 	prefetch_for_load(s->addr_cena + offset);
376531b17a7SHemant Agrawal }
377531b17a7SHemant Agrawal 
qbman_cena_prefetch(struct qbman_swp_sys * s,uint32_t offset)378531b17a7SHemant Agrawal static inline void qbman_cena_prefetch(struct qbman_swp_sys *s,
379531b17a7SHemant Agrawal 				       uint32_t offset)
380531b17a7SHemant Agrawal {
381531b17a7SHemant Agrawal 	prefetch_for_load(s->addr_cena + offset);
382531b17a7SHemant Agrawal }
383531b17a7SHemant Agrawal 
384531b17a7SHemant Agrawal 	/******************/
385531b17a7SHemant Agrawal 	/* Portal support */
386531b17a7SHemant Agrawal 	/******************/
387531b17a7SHemant Agrawal 
388531b17a7SHemant Agrawal /* The SWP_CFG portal register is special, in that it is used by the
389531b17a7SHemant Agrawal  * platform-specific code rather than the platform-independent code in
390531b17a7SHemant Agrawal  * qbman_portal.c. So use of it is declared locally here.
391531b17a7SHemant Agrawal  */
392531b17a7SHemant Agrawal #define QBMAN_CINH_SWP_CFG   0xd00
393293c0ca9SNipun Gupta 
394d95bdc09SHemant Agrawal #define SWP_CFG_DQRR_MF_SHIFT 20
395d95bdc09SHemant Agrawal #define SWP_CFG_EST_SHIFT     16
396293c0ca9SNipun Gupta #define SWP_CFG_CPBS_SHIFT    15
397d95bdc09SHemant Agrawal #define SWP_CFG_WN_SHIFT      14
398d95bdc09SHemant Agrawal #define SWP_CFG_RPM_SHIFT     12
399d95bdc09SHemant Agrawal #define SWP_CFG_DCM_SHIFT     10
400d95bdc09SHemant Agrawal #define SWP_CFG_EPM_SHIFT     8
401293c0ca9SNipun Gupta #define SWP_CFG_VPM_SHIFT     7
402293c0ca9SNipun Gupta #define SWP_CFG_CPM_SHIFT     6
403d95bdc09SHemant Agrawal #define SWP_CFG_SD_SHIFT      5
404d95bdc09SHemant Agrawal #define SWP_CFG_SP_SHIFT      4
405d95bdc09SHemant Agrawal #define SWP_CFG_SE_SHIFT      3
406d95bdc09SHemant Agrawal #define SWP_CFG_DP_SHIFT      2
407d95bdc09SHemant Agrawal #define SWP_CFG_DE_SHIFT      1
408d95bdc09SHemant Agrawal #define SWP_CFG_EP_SHIFT      0
409531b17a7SHemant Agrawal 
qbman_set_swp_cfg(uint8_t max_fill,uint8_t wn,uint8_t est,uint8_t rpm,uint8_t dcm,uint8_t epm,int sd,int sp,int se,int dp,int de,int ep)410531b17a7SHemant Agrawal static inline uint32_t qbman_set_swp_cfg(uint8_t max_fill, uint8_t wn,
411531b17a7SHemant Agrawal 					 uint8_t est, uint8_t rpm, uint8_t dcm,
412531b17a7SHemant Agrawal 					uint8_t epm, int sd, int sp, int se,
413531b17a7SHemant Agrawal 					int dp, int de, int ep)
414531b17a7SHemant Agrawal {
415531b17a7SHemant Agrawal 	uint32_t reg;
416531b17a7SHemant Agrawal 
417d95bdc09SHemant Agrawal 	reg = (max_fill << SWP_CFG_DQRR_MF_SHIFT |
418d95bdc09SHemant Agrawal 		est << SWP_CFG_EST_SHIFT |
419d95bdc09SHemant Agrawal 		wn << SWP_CFG_WN_SHIFT |
420d95bdc09SHemant Agrawal 		rpm << SWP_CFG_RPM_SHIFT |
421d95bdc09SHemant Agrawal 		dcm << SWP_CFG_DCM_SHIFT |
422d95bdc09SHemant Agrawal 		epm << SWP_CFG_EPM_SHIFT |
423d95bdc09SHemant Agrawal 		sd << SWP_CFG_SD_SHIFT |
424d95bdc09SHemant Agrawal 		sp << SWP_CFG_SP_SHIFT |
425d95bdc09SHemant Agrawal 		se << SWP_CFG_SE_SHIFT |
426d95bdc09SHemant Agrawal 		dp << SWP_CFG_DP_SHIFT |
427d95bdc09SHemant Agrawal 		de << SWP_CFG_DE_SHIFT |
428d95bdc09SHemant Agrawal 		ep << SWP_CFG_EP_SHIFT);
429d95bdc09SHemant Agrawal 
430531b17a7SHemant Agrawal 	return reg;
431531b17a7SHemant Agrawal }
432531b17a7SHemant Agrawal 
433293c0ca9SNipun Gupta #define QMAN_RT_MODE	0x00000100
434293c0ca9SNipun Gupta 
435293c0ca9SNipun Gupta #define QMAN_REV_4000	0x04000000
436293c0ca9SNipun Gupta #define QMAN_REV_4100	0x04010000
437293c0ca9SNipun Gupta #define QMAN_REV_4101	0x04010001
438293c0ca9SNipun Gupta #define QMAN_REV_5000	0x05000000
439293c0ca9SNipun Gupta #define QMAN_REV_MASK	0xffff0000
440293c0ca9SNipun Gupta 
44163d5d0afSNipun Gupta #define SVR_LS1080A	0x87030000
44263d5d0afSNipun Gupta #define SVR_LS2080A	0x87010000
44363d5d0afSNipun Gupta #define SVR_LS2088A	0x87090000
44463d5d0afSNipun Gupta #define SVR_LX2160A	0x87360000
44563d5d0afSNipun Gupta 
44663d5d0afSNipun Gupta /* Variable to store DPAA2 platform type */
44763d5d0afSNipun Gupta extern uint32_t dpaa2_svr_family;
44863d5d0afSNipun Gupta 
qbman_swp_sys_init(struct qbman_swp_sys * s,const struct qbman_swp_desc * d,uint8_t dqrr_size)449531b17a7SHemant Agrawal static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
450531b17a7SHemant Agrawal 				     const struct qbman_swp_desc *d,
451531b17a7SHemant Agrawal 				     uint8_t dqrr_size)
452531b17a7SHemant Agrawal {
453531b17a7SHemant Agrawal 	uint32_t reg;
454293c0ca9SNipun Gupta 	int i;
455ff8e5f10SHemant Agrawal 	int cena_region_size = 4*1024;
45663d5d0afSNipun Gupta 	uint8_t est = 1;
457171c8504SHemant Agrawal #ifdef RTE_ARCH_64
458171c8504SHemant Agrawal 	uint8_t wn = CENA_WRITE_ENABLE;
459171c8504SHemant Agrawal #else
460171c8504SHemant Agrawal 	uint8_t wn = CINH_WRITE_ENABLE;
461171c8504SHemant Agrawal #endif
462531b17a7SHemant Agrawal 
46363d5d0afSNipun Gupta 
46463d5d0afSNipun Gupta 	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
46563d5d0afSNipun Gupta 			&& (d->cena_access_mode == qman_cena_fastest_access))
46663d5d0afSNipun Gupta 		cena_region_size = 64*1024;
467531b17a7SHemant Agrawal 	s->addr_cena = d->cena_bar;
468531b17a7SHemant Agrawal 	s->addr_cinh = d->cinh_bar;
469531b17a7SHemant Agrawal 	s->idx = (uint32_t)d->idx;
470ff8e5f10SHemant Agrawal 	s->cena = malloc(cena_region_size);
471ff8e5f10SHemant Agrawal 
472531b17a7SHemant Agrawal 	if (!s->cena) {
473531b17a7SHemant Agrawal 		pr_err("Could not allocate page for cena shadow\n");
474531b17a7SHemant Agrawal 		return -1;
475531b17a7SHemant Agrawal 	}
476531b17a7SHemant Agrawal 	s->eqcr_mode = d->eqcr_mode;
477531b17a7SHemant Agrawal 	QBMAN_BUG_ON(d->idx < 0);
478531b17a7SHemant Agrawal #ifdef QBMAN_CHECKING
479531b17a7SHemant Agrawal 	/* We should never be asked to initialise for a portal that isn't in
480531b17a7SHemant Agrawal 	 * the power-on state. (Ie. don't forget to reset portals when they are
481531b17a7SHemant Agrawal 	 * decommissioned!)
482531b17a7SHemant Agrawal 	 */
483531b17a7SHemant Agrawal 	reg = qbman_cinh_read(s, QBMAN_CINH_SWP_CFG);
484531b17a7SHemant Agrawal 	QBMAN_BUG_ON(reg);
485531b17a7SHemant Agrawal #endif
4863f28677aSHemant Agrawal 	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
4873f28677aSHemant Agrawal 			&& (d->cena_access_mode == qman_cena_fastest_access))
488ff8e5f10SHemant Agrawal 		memset(s->addr_cena, 0, cena_region_size);
489293c0ca9SNipun Gupta 	else {
490293c0ca9SNipun Gupta 		/* Invalidate the portal memory.
491293c0ca9SNipun Gupta 		 * This ensures no stale cache lines
492293c0ca9SNipun Gupta 		 */
493ff8e5f10SHemant Agrawal 		for (i = 0; i < cena_region_size; i += 64)
494293c0ca9SNipun Gupta 			dccivac(s->addr_cena + i);
495293c0ca9SNipun Gupta 	}
496293c0ca9SNipun Gupta 
49763d5d0afSNipun Gupta 	if (dpaa2_svr_family == SVR_LS1080A)
49863d5d0afSNipun Gupta 		est = 0;
49963d5d0afSNipun Gupta 
5003f28677aSHemant Agrawal 	if (s->eqcr_mode == qman_eqcr_vb_array) {
501293c0ca9SNipun Gupta 		reg = qbman_set_swp_cfg(dqrr_size, wn,
502293c0ca9SNipun Gupta 					0, 3, 2, 3, 1, 1, 1, 1, 1, 1);
5033f28677aSHemant Agrawal 	} else {
5043f28677aSHemant Agrawal 		if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 &&
5053f28677aSHemant Agrawal 			    (d->cena_access_mode == qman_cena_fastest_access))
506293c0ca9SNipun Gupta 			reg = qbman_set_swp_cfg(dqrr_size, wn,
507293c0ca9SNipun Gupta 						1, 3, 2, 0, 1, 1, 1, 1, 1, 1);
508ff8e5f10SHemant Agrawal 		else
509ff8e5f10SHemant Agrawal 			reg = qbman_set_swp_cfg(dqrr_size, wn,
51063d5d0afSNipun Gupta 						est, 3, 2, 2, 1, 1, 1, 1, 1, 1);
511293c0ca9SNipun Gupta 	}
512293c0ca9SNipun Gupta 
5133f28677aSHemant Agrawal 	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
5143f28677aSHemant Agrawal 			&& (d->cena_access_mode == qman_cena_fastest_access))
515293c0ca9SNipun Gupta 		reg |= 1 << SWP_CFG_CPBS_SHIFT | /* memory-backed mode */
516293c0ca9SNipun Gupta 		       1 << SWP_CFG_VPM_SHIFT |  /* VDQCR read triggered mode */
517293c0ca9SNipun Gupta 		       1 << SWP_CFG_CPM_SHIFT;   /* CR read triggered mode */
518293c0ca9SNipun Gupta 
519531b17a7SHemant Agrawal 	qbman_cinh_write(s, QBMAN_CINH_SWP_CFG, reg);
520531b17a7SHemant Agrawal 	reg = qbman_cinh_read(s, QBMAN_CINH_SWP_CFG);
521531b17a7SHemant Agrawal 	if (!reg) {
522531b17a7SHemant Agrawal 		pr_err("The portal %d is not enabled!\n", s->idx);
523d95bdc09SHemant Agrawal 		free(s->cena);
524531b17a7SHemant Agrawal 		return -1;
525531b17a7SHemant Agrawal 	}
526293c0ca9SNipun Gupta 
5273f28677aSHemant Agrawal 	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
5283f28677aSHemant Agrawal 			&& (d->cena_access_mode == qman_cena_fastest_access)) {
529293c0ca9SNipun Gupta 		qbman_cinh_write(s, QBMAN_CINH_SWP_EQCR_PI, QMAN_RT_MODE);
530293c0ca9SNipun Gupta 		qbman_cinh_write(s, QBMAN_CINH_SWP_RCR_PI, QMAN_RT_MODE);
531293c0ca9SNipun Gupta 	}
532293c0ca9SNipun Gupta 
533531b17a7SHemant Agrawal 	return 0;
534531b17a7SHemant Agrawal }
535531b17a7SHemant Agrawal 
qbman_swp_sys_update(struct qbman_swp_sys * s,const struct qbman_swp_desc * d,uint8_t dqrr_size,int stash_off)536*b3bd7a50SNipun Gupta static inline int qbman_swp_sys_update(struct qbman_swp_sys *s,
537*b3bd7a50SNipun Gupta 				     const struct qbman_swp_desc *d,
538*b3bd7a50SNipun Gupta 				     uint8_t dqrr_size,
539*b3bd7a50SNipun Gupta 				     int stash_off)
540*b3bd7a50SNipun Gupta {
541*b3bd7a50SNipun Gupta 	uint32_t reg;
542*b3bd7a50SNipun Gupta 	int i;
543*b3bd7a50SNipun Gupta 	int cena_region_size = 4*1024;
544*b3bd7a50SNipun Gupta 	uint8_t est = 1;
545*b3bd7a50SNipun Gupta #ifdef RTE_ARCH_64
546*b3bd7a50SNipun Gupta 	uint8_t wn = CENA_WRITE_ENABLE;
547*b3bd7a50SNipun Gupta #else
548*b3bd7a50SNipun Gupta 	uint8_t wn = CINH_WRITE_ENABLE;
549*b3bd7a50SNipun Gupta #endif
550*b3bd7a50SNipun Gupta 
551*b3bd7a50SNipun Gupta 	if (stash_off)
552*b3bd7a50SNipun Gupta 		wn = CINH_WRITE_ENABLE;
553*b3bd7a50SNipun Gupta 
554*b3bd7a50SNipun Gupta 	QBMAN_BUG_ON(d->idx < 0);
555*b3bd7a50SNipun Gupta #ifdef QBMAN_CHECKING
556*b3bd7a50SNipun Gupta 	/* We should never be asked to initialise for a portal that isn't in
557*b3bd7a50SNipun Gupta 	 * the power-on state. (Ie. don't forget to reset portals when they are
558*b3bd7a50SNipun Gupta 	 * decommissioned!)
559*b3bd7a50SNipun Gupta 	 */
560*b3bd7a50SNipun Gupta 	reg = qbman_cinh_read(s, QBMAN_CINH_SWP_CFG);
561*b3bd7a50SNipun Gupta 	QBMAN_BUG_ON(reg);
562*b3bd7a50SNipun Gupta #endif
563*b3bd7a50SNipun Gupta 	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
564*b3bd7a50SNipun Gupta 			&& (d->cena_access_mode == qman_cena_fastest_access))
565*b3bd7a50SNipun Gupta 		memset(s->addr_cena, 0, cena_region_size);
566*b3bd7a50SNipun Gupta 	else {
567*b3bd7a50SNipun Gupta 		/* Invalidate the portal memory.
568*b3bd7a50SNipun Gupta 		 * This ensures no stale cache lines
569*b3bd7a50SNipun Gupta 		 */
570*b3bd7a50SNipun Gupta 		for (i = 0; i < cena_region_size; i += 64)
571*b3bd7a50SNipun Gupta 			dccivac(s->addr_cena + i);
572*b3bd7a50SNipun Gupta 	}
573*b3bd7a50SNipun Gupta 
574*b3bd7a50SNipun Gupta 	if (dpaa2_svr_family == SVR_LS1080A)
575*b3bd7a50SNipun Gupta 		est = 0;
576*b3bd7a50SNipun Gupta 
577*b3bd7a50SNipun Gupta 	if (s->eqcr_mode == qman_eqcr_vb_array) {
578*b3bd7a50SNipun Gupta 		reg = qbman_set_swp_cfg(dqrr_size, wn,
579*b3bd7a50SNipun Gupta 					0, 3, 2, 3, 1, 1, 1, 1, 1, 1);
580*b3bd7a50SNipun Gupta 	} else {
581*b3bd7a50SNipun Gupta 		if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 &&
582*b3bd7a50SNipun Gupta 			    (d->cena_access_mode == qman_cena_fastest_access))
583*b3bd7a50SNipun Gupta 			reg = qbman_set_swp_cfg(dqrr_size, wn,
584*b3bd7a50SNipun Gupta 						1, 3, 2, 0, 1, 1, 1, 1, 1, 1);
585*b3bd7a50SNipun Gupta 		else
586*b3bd7a50SNipun Gupta 			reg = qbman_set_swp_cfg(dqrr_size, wn,
587*b3bd7a50SNipun Gupta 						est, 3, 2, 2, 1, 1, 1, 1, 1, 1);
588*b3bd7a50SNipun Gupta 	}
589*b3bd7a50SNipun Gupta 
590*b3bd7a50SNipun Gupta 	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
591*b3bd7a50SNipun Gupta 			&& (d->cena_access_mode == qman_cena_fastest_access))
592*b3bd7a50SNipun Gupta 		reg |= 1 << SWP_CFG_CPBS_SHIFT | /* memory-backed mode */
593*b3bd7a50SNipun Gupta 		       1 << SWP_CFG_VPM_SHIFT |  /* VDQCR read triggered mode */
594*b3bd7a50SNipun Gupta 		       1 << SWP_CFG_CPM_SHIFT;   /* CR read triggered mode */
595*b3bd7a50SNipun Gupta 
596*b3bd7a50SNipun Gupta 	qbman_cinh_write(s, QBMAN_CINH_SWP_CFG, reg);
597*b3bd7a50SNipun Gupta 	reg = qbman_cinh_read(s, QBMAN_CINH_SWP_CFG);
598*b3bd7a50SNipun Gupta 	if (!reg) {
599*b3bd7a50SNipun Gupta 		pr_err("The portal %d is not enabled!\n", s->idx);
600*b3bd7a50SNipun Gupta 		return -1;
601*b3bd7a50SNipun Gupta 	}
602*b3bd7a50SNipun Gupta 
603*b3bd7a50SNipun Gupta 	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
604*b3bd7a50SNipun Gupta 			&& (d->cena_access_mode == qman_cena_fastest_access)) {
605*b3bd7a50SNipun Gupta 		qbman_cinh_write(s, QBMAN_CINH_SWP_EQCR_PI, QMAN_RT_MODE);
606*b3bd7a50SNipun Gupta 		qbman_cinh_write(s, QBMAN_CINH_SWP_RCR_PI, QMAN_RT_MODE);
607*b3bd7a50SNipun Gupta 	}
608*b3bd7a50SNipun Gupta 
609*b3bd7a50SNipun Gupta 	return 0;
610*b3bd7a50SNipun Gupta }
611*b3bd7a50SNipun Gupta 
qbman_swp_sys_finish(struct qbman_swp_sys * s)612531b17a7SHemant Agrawal static inline void qbman_swp_sys_finish(struct qbman_swp_sys *s)
613531b17a7SHemant Agrawal {
614d95bdc09SHemant Agrawal 	free(s->cena);
615531b17a7SHemant Agrawal }
616293c0ca9SNipun Gupta 
617293c0ca9SNipun Gupta #endif /* _QBMAN_SYS_H_ */
618