xref: /OK3568_Linux_fs/external/rkwifibt/drivers/infineon/include/sbconfig.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Broadcom SiliconBackplane hardware register definitions.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Portions of this code are copyright (c) 2021 Cypress Semiconductor Corporation
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Copyright (C) 1999-2017, Broadcom Corporation
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  *      Unless you and Broadcom execute a separate written software license
9*4882a593Smuzhiyun  * agreement governing use of this software, this software is licensed to you
10*4882a593Smuzhiyun  * under the terms of the GNU General Public License version 2 (the "GPL"),
11*4882a593Smuzhiyun  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
12*4882a593Smuzhiyun  * following added to such license:
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  *      As a special exception, the copyright holders of this software give you
15*4882a593Smuzhiyun  * permission to link this software with independent modules, and to copy and
16*4882a593Smuzhiyun  * distribute the resulting executable under terms of your choice, provided that
17*4882a593Smuzhiyun  * you also meet, for each linked independent module, the terms and conditions of
18*4882a593Smuzhiyun  * the license of that module.  An independent module is a module which is not
19*4882a593Smuzhiyun  * derived from this software.  The special exception does not apply to any
20*4882a593Smuzhiyun  * modifications of the software.
21*4882a593Smuzhiyun  *
22*4882a593Smuzhiyun  *      Notwithstanding the above, under no circumstances may you combine this
23*4882a593Smuzhiyun  * software in any way with any other Broadcom software provided under a license
24*4882a593Smuzhiyun  * other than the GPL, without Broadcom's express prior written consent.
25*4882a593Smuzhiyun  *
26*4882a593Smuzhiyun  *
27*4882a593Smuzhiyun  * <<Broadcom-WL-IPTag/Open:>>
28*4882a593Smuzhiyun  *
29*4882a593Smuzhiyun  * $Id: sbconfig.h 654158 2016-08-11 09:30:01Z $
30*4882a593Smuzhiyun  */
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #ifndef	_SBCONFIG_H
33*4882a593Smuzhiyun #define	_SBCONFIG_H
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun /* cpp contortions to concatenate w/arg prescan */
36*4882a593Smuzhiyun #ifndef PAD
37*4882a593Smuzhiyun #define	_PADLINE(line)	pad ## line
38*4882a593Smuzhiyun #define	_XSTR(line)	_PADLINE(line)
39*4882a593Smuzhiyun #define	PAD		_XSTR(__LINE__)
40*4882a593Smuzhiyun #endif // endif
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun /* enumeration in SB is based on the premise that cores are contiguous in the
43*4882a593Smuzhiyun  * enumeration space.
44*4882a593Smuzhiyun  */
45*4882a593Smuzhiyun #define SB_BUS_SIZE		0x10000		/**< Each bus gets 64Kbytes for cores */
46*4882a593Smuzhiyun #define SB_BUS_BASE(sih, b)		(SI_ENUM_BASE(sih) + (b) * SB_BUS_SIZE)
47*4882a593Smuzhiyun #define	SB_BUS_MAXCORES		(SB_BUS_SIZE / SI_CORE_SIZE)	/**< Max cores per bus */
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun /*
50*4882a593Smuzhiyun  * Sonics Configuration Space Registers.
51*4882a593Smuzhiyun  */
52*4882a593Smuzhiyun #define	SBCONFIGOFF		0xf00		/**< core sbconfig regs are top 256bytes of regs */
53*4882a593Smuzhiyun #define	SBCONFIGSIZE		256		/**< sizeof (sbconfig_t) */
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun #define SBIPSFLAG		0x08
56*4882a593Smuzhiyun #define SBTPSFLAG		0x18
57*4882a593Smuzhiyun #define	SBTMERRLOGA		0x48		/**< sonics >= 2.3 */
58*4882a593Smuzhiyun #define	SBTMERRLOG		0x50		/**< sonics >= 2.3 */
59*4882a593Smuzhiyun #define SBADMATCH3		0x60
60*4882a593Smuzhiyun #define SBADMATCH2		0x68
61*4882a593Smuzhiyun #define SBADMATCH1		0x70
62*4882a593Smuzhiyun #define SBIMSTATE		0x90
63*4882a593Smuzhiyun #define SBINTVEC		0x94
64*4882a593Smuzhiyun #define SBTMSTATELOW		0x98
65*4882a593Smuzhiyun #define SBTMSTATEHIGH		0x9c
66*4882a593Smuzhiyun #define SBBWA0			0xa0
67*4882a593Smuzhiyun #define SBIMCONFIGLOW		0xa8
68*4882a593Smuzhiyun #define SBIMCONFIGHIGH		0xac
69*4882a593Smuzhiyun #define SBADMATCH0		0xb0
70*4882a593Smuzhiyun #define SBTMCONFIGLOW		0xb8
71*4882a593Smuzhiyun #define SBTMCONFIGHIGH		0xbc
72*4882a593Smuzhiyun #define SBBCONFIG		0xc0
73*4882a593Smuzhiyun #define SBBSTATE		0xc8
74*4882a593Smuzhiyun #define SBACTCNFG		0xd8
75*4882a593Smuzhiyun #define	SBFLAGST		0xe8
76*4882a593Smuzhiyun #define SBIDLOW			0xf8
77*4882a593Smuzhiyun #define SBIDHIGH		0xfc
78*4882a593Smuzhiyun 
79*4882a593Smuzhiyun /* All the previous registers are above SBCONFIGOFF, but with Sonics 2.3, we have
80*4882a593Smuzhiyun  * a few registers *below* that line. I think it would be very confusing to try
81*4882a593Smuzhiyun  * and change the value of SBCONFIGOFF, so I'm definig them as absolute offsets here,
82*4882a593Smuzhiyun  */
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun #define SBIMERRLOGA		0xea8
85*4882a593Smuzhiyun #define SBIMERRLOG		0xeb0
86*4882a593Smuzhiyun #define SBTMPORTCONNID0		0xed8
87*4882a593Smuzhiyun #define SBTMPORTLOCK0		0xef8
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun #if !defined(_LANGUAGE_ASSEMBLY) && !defined(__ASSEMBLY__)
90*4882a593Smuzhiyun 
91*4882a593Smuzhiyun typedef volatile struct _sbconfig {
92*4882a593Smuzhiyun 	uint32	PAD[2];
93*4882a593Smuzhiyun 	uint32	sbipsflag;		/**< initiator port ocp slave flag */
94*4882a593Smuzhiyun 	uint32	PAD[3];
95*4882a593Smuzhiyun 	uint32	sbtpsflag;		/**< target port ocp slave flag */
96*4882a593Smuzhiyun 	uint32	PAD[11];
97*4882a593Smuzhiyun 	uint32	sbtmerrloga;		/**< (sonics >= 2.3) */
98*4882a593Smuzhiyun 	uint32	PAD;
99*4882a593Smuzhiyun 	uint32	sbtmerrlog;		/**< (sonics >= 2.3) */
100*4882a593Smuzhiyun 	uint32	PAD[3];
101*4882a593Smuzhiyun 	uint32	sbadmatch3;		/**< address match3 */
102*4882a593Smuzhiyun 	uint32	PAD;
103*4882a593Smuzhiyun 	uint32	sbadmatch2;		/**< address match2 */
104*4882a593Smuzhiyun 	uint32	PAD;
105*4882a593Smuzhiyun 	uint32	sbadmatch1;		/**< address match1 */
106*4882a593Smuzhiyun 	uint32	PAD[7];
107*4882a593Smuzhiyun 	uint32	sbimstate;		/**< initiator agent state */
108*4882a593Smuzhiyun 	uint32	sbintvec;		/**< interrupt mask */
109*4882a593Smuzhiyun 	uint32	sbtmstatelow;		/**< target state */
110*4882a593Smuzhiyun 	uint32	sbtmstatehigh;		/**< target state */
111*4882a593Smuzhiyun 	uint32	sbbwa0;			/**< bandwidth allocation table0 */
112*4882a593Smuzhiyun 	uint32	PAD;
113*4882a593Smuzhiyun 	uint32	sbimconfiglow;		/**< initiator configuration */
114*4882a593Smuzhiyun 	uint32	sbimconfighigh;		/**< initiator configuration */
115*4882a593Smuzhiyun 	uint32	sbadmatch0;		/**< address match0 */
116*4882a593Smuzhiyun 	uint32	PAD;
117*4882a593Smuzhiyun 	uint32	sbtmconfiglow;		/**< target configuration */
118*4882a593Smuzhiyun 	uint32	sbtmconfighigh;		/**< target configuration */
119*4882a593Smuzhiyun 	uint32	sbbconfig;		/**< broadcast configuration */
120*4882a593Smuzhiyun 	uint32	PAD;
121*4882a593Smuzhiyun 	uint32	sbbstate;		/**< broadcast state */
122*4882a593Smuzhiyun 	uint32	PAD[3];
123*4882a593Smuzhiyun 	uint32	sbactcnfg;		/**< activate configuration */
124*4882a593Smuzhiyun 	uint32	PAD[3];
125*4882a593Smuzhiyun 	uint32	sbflagst;		/**< current sbflags */
126*4882a593Smuzhiyun 	uint32	PAD[3];
127*4882a593Smuzhiyun 	uint32	sbidlow;		/**< identification */
128*4882a593Smuzhiyun 	uint32	sbidhigh;		/**< identification */
129*4882a593Smuzhiyun } sbconfig_t;
130*4882a593Smuzhiyun 
131*4882a593Smuzhiyun #endif /* !_LANGUAGE_ASSEMBLY && !__ASSEMBLY__ */
132*4882a593Smuzhiyun 
133*4882a593Smuzhiyun /* sbipsflag */
134*4882a593Smuzhiyun #define	SBIPS_INT1_MASK		0x3f		/**< which sbflags get routed to mips interrupt 1 */
135*4882a593Smuzhiyun #define	SBIPS_INT1_SHIFT	0
136*4882a593Smuzhiyun #define	SBIPS_INT2_MASK		0x3f00		/**< which sbflags get routed to mips interrupt 2 */
137*4882a593Smuzhiyun #define	SBIPS_INT2_SHIFT	8
138*4882a593Smuzhiyun #define	SBIPS_INT3_MASK		0x3f0000	/**< which sbflags get routed to mips interrupt 3 */
139*4882a593Smuzhiyun #define	SBIPS_INT3_SHIFT	16
140*4882a593Smuzhiyun #define	SBIPS_INT4_MASK		0x3f000000	/**< which sbflags get routed to mips interrupt 4 */
141*4882a593Smuzhiyun #define	SBIPS_INT4_SHIFT	24
142*4882a593Smuzhiyun 
143*4882a593Smuzhiyun /* sbtpsflag */
144*4882a593Smuzhiyun #define	SBTPS_NUM0_MASK		0x3f		/**< interrupt sbFlag # generated by this core */
145*4882a593Smuzhiyun #define	SBTPS_F0EN0		0x40		/**< interrupt is always sent on the backplane */
146*4882a593Smuzhiyun 
147*4882a593Smuzhiyun /* sbtmerrlog */
148*4882a593Smuzhiyun #define	SBTMEL_CM		0x00000007	/**< command */
149*4882a593Smuzhiyun #define	SBTMEL_CI		0x0000ff00	/**< connection id */
150*4882a593Smuzhiyun #define	SBTMEL_EC		0x0f000000	/**< error code */
151*4882a593Smuzhiyun #define	SBTMEL_ME		0x80000000	/**< multiple error */
152*4882a593Smuzhiyun 
153*4882a593Smuzhiyun /* sbimstate */
154*4882a593Smuzhiyun #define	SBIM_PC			0xf		/**< pipecount */
155*4882a593Smuzhiyun #define	SBIM_AP_MASK		0x30		/**< arbitration policy */
156*4882a593Smuzhiyun #define	SBIM_AP_BOTH		0x00		/**< use both timeslaces and token */
157*4882a593Smuzhiyun #define	SBIM_AP_TS		0x10		/**< use timesliaces only */
158*4882a593Smuzhiyun #define	SBIM_AP_TK		0x20		/**< use token only */
159*4882a593Smuzhiyun #define	SBIM_AP_RSV		0x30		/**< reserved */
160*4882a593Smuzhiyun #define	SBIM_IBE		0x20000		/**< inbanderror */
161*4882a593Smuzhiyun #define	SBIM_TO			0x40000		/**< timeout */
162*4882a593Smuzhiyun #define	SBIM_BY			0x01800000	/**< busy (sonics >= 2.3) */
163*4882a593Smuzhiyun #define	SBIM_RJ			0x02000000	/**< reject (sonics >= 2.3) */
164*4882a593Smuzhiyun 
165*4882a593Smuzhiyun /* sbtmstatelow */
166*4882a593Smuzhiyun #define	SBTML_RESET		0x0001		/**< reset */
167*4882a593Smuzhiyun #define	SBTML_REJ_MASK		0x0006		/**< reject field */
168*4882a593Smuzhiyun #define	SBTML_REJ		0x0002		/**< reject */
169*4882a593Smuzhiyun #define	SBTML_TMPREJ		0x0004		/**< temporary reject, for error recovery */
170*4882a593Smuzhiyun 
171*4882a593Smuzhiyun #define	SBTML_SICF_SHIFT	16	/**< Shift to locate the SI control flags in sbtml */
172*4882a593Smuzhiyun 
173*4882a593Smuzhiyun /* sbtmstatehigh */
174*4882a593Smuzhiyun #define	SBTMH_SERR		0x0001		/**< serror */
175*4882a593Smuzhiyun #define	SBTMH_INT		0x0002		/**< interrupt */
176*4882a593Smuzhiyun #define	SBTMH_BUSY		0x0004		/**< busy */
177*4882a593Smuzhiyun #define	SBTMH_TO		0x0020		/**< timeout (sonics >= 2.3) */
178*4882a593Smuzhiyun 
179*4882a593Smuzhiyun #define	SBTMH_SISF_SHIFT	16		/**< Shift to locate the SI status flags in sbtmh */
180*4882a593Smuzhiyun 
181*4882a593Smuzhiyun /* sbbwa0 */
182*4882a593Smuzhiyun #define	SBBWA_TAB0_MASK		0xffff		/**< lookup table 0 */
183*4882a593Smuzhiyun #define	SBBWA_TAB1_MASK		0xffff		/**< lookup table 1 */
184*4882a593Smuzhiyun #define	SBBWA_TAB1_SHIFT	16
185*4882a593Smuzhiyun 
186*4882a593Smuzhiyun /* sbimconfiglow */
187*4882a593Smuzhiyun #define	SBIMCL_STO_MASK		0x7		/**< service timeout */
188*4882a593Smuzhiyun #define	SBIMCL_RTO_MASK		0x70		/**< request timeout */
189*4882a593Smuzhiyun #define	SBIMCL_RTO_SHIFT	4
190*4882a593Smuzhiyun #define	SBIMCL_CID_MASK		0xff0000	/**< connection id */
191*4882a593Smuzhiyun #define	SBIMCL_CID_SHIFT	16
192*4882a593Smuzhiyun 
193*4882a593Smuzhiyun /* sbimconfighigh */
194*4882a593Smuzhiyun #define	SBIMCH_IEM_MASK		0xc		/**< inband error mode */
195*4882a593Smuzhiyun #define	SBIMCH_TEM_MASK		0x30		/**< timeout error mode */
196*4882a593Smuzhiyun #define	SBIMCH_TEM_SHIFT	4
197*4882a593Smuzhiyun #define	SBIMCH_BEM_MASK		0xc0		/**< bus error mode */
198*4882a593Smuzhiyun #define	SBIMCH_BEM_SHIFT	6
199*4882a593Smuzhiyun 
200*4882a593Smuzhiyun /* sbadmatch0 */
201*4882a593Smuzhiyun #define	SBAM_TYPE_MASK		0x3		/**< address type */
202*4882a593Smuzhiyun #define	SBAM_AD64		0x4		/**< reserved */
203*4882a593Smuzhiyun #define	SBAM_ADINT0_MASK	0xf8		/**< type0 size */
204*4882a593Smuzhiyun #define	SBAM_ADINT0_SHIFT	3
205*4882a593Smuzhiyun #define	SBAM_ADINT1_MASK	0x1f8		/**< type1 size */
206*4882a593Smuzhiyun #define	SBAM_ADINT1_SHIFT	3
207*4882a593Smuzhiyun #define	SBAM_ADINT2_MASK	0x1f8		/**< type2 size */
208*4882a593Smuzhiyun #define	SBAM_ADINT2_SHIFT	3
209*4882a593Smuzhiyun #define	SBAM_ADEN		0x400		/**< enable */
210*4882a593Smuzhiyun #define	SBAM_ADNEG		0x800		/**< negative decode */
211*4882a593Smuzhiyun #define	SBAM_BASE0_MASK		0xffffff00	/**< type0 base address */
212*4882a593Smuzhiyun #define	SBAM_BASE0_SHIFT	8
213*4882a593Smuzhiyun #define	SBAM_BASE1_MASK		0xfffff000	/**< type1 base address for the core */
214*4882a593Smuzhiyun #define	SBAM_BASE1_SHIFT	12
215*4882a593Smuzhiyun #define	SBAM_BASE2_MASK		0xffff0000	/**< type2 base address for the core */
216*4882a593Smuzhiyun #define	SBAM_BASE2_SHIFT	16
217*4882a593Smuzhiyun 
218*4882a593Smuzhiyun /* sbtmconfiglow */
219*4882a593Smuzhiyun #define	SBTMCL_CD_MASK		0xff		/**< clock divide */
220*4882a593Smuzhiyun #define	SBTMCL_CO_MASK		0xf800		/**< clock offset */
221*4882a593Smuzhiyun #define	SBTMCL_CO_SHIFT		11
222*4882a593Smuzhiyun #define	SBTMCL_IF_MASK		0xfc0000	/**< interrupt flags */
223*4882a593Smuzhiyun #define	SBTMCL_IF_SHIFT		18
224*4882a593Smuzhiyun #define	SBTMCL_IM_MASK		0x3000000	/**< interrupt mode */
225*4882a593Smuzhiyun #define	SBTMCL_IM_SHIFT		24
226*4882a593Smuzhiyun 
227*4882a593Smuzhiyun /* sbtmconfighigh */
228*4882a593Smuzhiyun #define	SBTMCH_BM_MASK		0x3		/**< busy mode */
229*4882a593Smuzhiyun #define	SBTMCH_RM_MASK		0x3		/**< retry mode */
230*4882a593Smuzhiyun #define	SBTMCH_RM_SHIFT		2
231*4882a593Smuzhiyun #define	SBTMCH_SM_MASK		0x30		/**< stop mode */
232*4882a593Smuzhiyun #define	SBTMCH_SM_SHIFT		4
233*4882a593Smuzhiyun #define	SBTMCH_EM_MASK		0x300		/**< sb error mode */
234*4882a593Smuzhiyun #define	SBTMCH_EM_SHIFT		8
235*4882a593Smuzhiyun #define	SBTMCH_IM_MASK		0xc00		/**< int mode */
236*4882a593Smuzhiyun #define	SBTMCH_IM_SHIFT		10
237*4882a593Smuzhiyun 
238*4882a593Smuzhiyun /* sbbconfig */
239*4882a593Smuzhiyun #define	SBBC_LAT_MASK		0x3		/**< sb latency */
240*4882a593Smuzhiyun #define	SBBC_MAX0_MASK		0xf0000		/**< maxccntr0 */
241*4882a593Smuzhiyun #define	SBBC_MAX0_SHIFT		16
242*4882a593Smuzhiyun #define	SBBC_MAX1_MASK		0xf00000	/**< maxccntr1 */
243*4882a593Smuzhiyun #define	SBBC_MAX1_SHIFT		20
244*4882a593Smuzhiyun 
245*4882a593Smuzhiyun /* sbbstate */
246*4882a593Smuzhiyun #define	SBBS_SRD		0x1		/**< st reg disable */
247*4882a593Smuzhiyun #define	SBBS_HRD		0x2		/**< hold reg disable */
248*4882a593Smuzhiyun 
249*4882a593Smuzhiyun /* sbidlow */
250*4882a593Smuzhiyun #define	SBIDL_CS_MASK		0x3		/**< config space */
251*4882a593Smuzhiyun #define	SBIDL_AR_MASK		0x38		/**< # address ranges supported */
252*4882a593Smuzhiyun #define	SBIDL_AR_SHIFT		3
253*4882a593Smuzhiyun #define	SBIDL_SYNCH		0x40		/**< sync */
254*4882a593Smuzhiyun #define	SBIDL_INIT		0x80		/**< initiator */
255*4882a593Smuzhiyun #define	SBIDL_MINLAT_MASK	0xf00		/**< minimum backplane latency */
256*4882a593Smuzhiyun #define	SBIDL_MINLAT_SHIFT	8
257*4882a593Smuzhiyun #define	SBIDL_MAXLAT		0xf000		/**< maximum backplane latency */
258*4882a593Smuzhiyun #define	SBIDL_MAXLAT_SHIFT	12
259*4882a593Smuzhiyun #define	SBIDL_FIRST		0x10000		/**< this initiator is first */
260*4882a593Smuzhiyun #define	SBIDL_CW_MASK		0xc0000		/**< cycle counter width */
261*4882a593Smuzhiyun #define	SBIDL_CW_SHIFT		18
262*4882a593Smuzhiyun #define	SBIDL_TP_MASK		0xf00000	/**< target ports */
263*4882a593Smuzhiyun #define	SBIDL_TP_SHIFT		20
264*4882a593Smuzhiyun #define	SBIDL_IP_MASK		0xf000000	/**< initiator ports */
265*4882a593Smuzhiyun #define	SBIDL_IP_SHIFT		24
266*4882a593Smuzhiyun #define	SBIDL_RV_MASK		0xf0000000	/**< sonics backplane revision code */
267*4882a593Smuzhiyun #define	SBIDL_RV_SHIFT		28
268*4882a593Smuzhiyun #define	SBIDL_RV_2_2		0x00000000	/**< version 2.2 or earlier */
269*4882a593Smuzhiyun #define	SBIDL_RV_2_3		0x10000000	/**< version 2.3 */
270*4882a593Smuzhiyun 
271*4882a593Smuzhiyun /* sbidhigh */
272*4882a593Smuzhiyun #define	SBIDH_RC_MASK		0x000f		/**< revision code */
273*4882a593Smuzhiyun #define	SBIDH_RCE_MASK		0x7000		/**< revision code extension field */
274*4882a593Smuzhiyun #define	SBIDH_RCE_SHIFT		8
275*4882a593Smuzhiyun #define	SBCOREREV(sbidh) \
276*4882a593Smuzhiyun 	((((sbidh) & SBIDH_RCE_MASK) >> SBIDH_RCE_SHIFT) | ((sbidh) & SBIDH_RC_MASK))
277*4882a593Smuzhiyun #define	SBIDH_CC_MASK		0x8ff0		/**< core code */
278*4882a593Smuzhiyun #define	SBIDH_CC_SHIFT		4
279*4882a593Smuzhiyun #define	SBIDH_VC_MASK		0xffff0000	/**< vendor code */
280*4882a593Smuzhiyun #define	SBIDH_VC_SHIFT		16
281*4882a593Smuzhiyun 
282*4882a593Smuzhiyun #define	SB_COMMIT		0xfd8		/**< update buffered registers value */
283*4882a593Smuzhiyun 
284*4882a593Smuzhiyun /* vendor codes */
285*4882a593Smuzhiyun #define	SB_VEND_BCM		0x4243		/**< Broadcom's SB vendor code */
286*4882a593Smuzhiyun 
287*4882a593Smuzhiyun #endif	/* _SBCONFIG_H */
288