xref: /netbsd-src/sys/arch/mips/cavium/dev/octeon_ciureg.h (revision 8bf8eed88c08f8ce2ae46c8b91812a12e1531428)
1*8bf8eed8Sjmcneill /*	$NetBSD: octeon_ciureg.h,v 1.11 2020/07/20 17:56:13 jmcneill Exp $	*/
2f693c922Shikaru 
3f693c922Shikaru /*
4f693c922Shikaru  * Copyright (c) 2007 Internet Initiative Japan, Inc.
5f693c922Shikaru  * All rights reserved.
6f693c922Shikaru  *
7f693c922Shikaru  * Redistribution and use in source and binary forms, with or without
8f693c922Shikaru  * modification, are permitted provided that the following conditions
9f693c922Shikaru  * are met:
10f693c922Shikaru  * 1. Redistributions of source code must retain the above copyright
11f693c922Shikaru  *    notice, this list of conditions and the following disclaimer.
12f693c922Shikaru  * 2. Redistributions in binary form must reproduce the above copyright
13f693c922Shikaru  *    notice, this list of conditions and the following disclaimer in the
14f693c922Shikaru  *    documentation and/or other materials provided with the distribution.
15f693c922Shikaru  *
16f693c922Shikaru  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17f693c922Shikaru  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18f693c922Shikaru  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19f693c922Shikaru  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20f693c922Shikaru  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21f693c922Shikaru  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22f693c922Shikaru  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23f693c922Shikaru  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24f693c922Shikaru  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25f693c922Shikaru  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26f693c922Shikaru  * SUCH DAMAGE.
27f693c922Shikaru  */
28f693c922Shikaru 
29f693c922Shikaru /*
30f693c922Shikaru  * CIU Registers
31f693c922Shikaru  */
32f693c922Shikaru 
33f693c922Shikaru #ifndef _OCTEON_CIUREG_H_
34f693c922Shikaru #define _OCTEON_CIUREG_H_
35f693c922Shikaru 
36f693c922Shikaru /* ---- register addresses */
37f693c922Shikaru 
38f693c922Shikaru #define	CIU_INT0_SUM0				UINT64_C(0x0001070000000000)
39f693c922Shikaru #define	CIU_INT1_SUM0				UINT64_C(0x0001070000000008)
40f693c922Shikaru #define	CIU_INT2_SUM0				UINT64_C(0x0001070000000010)
41f693c922Shikaru #define	CIU_INT3_SUM0				UINT64_C(0x0001070000000018)
42793877b0Sjmcneill #define	CIU_IP2_SUM0(n)				(CIU_INT0_SUM0 + 0x10 * (n))
43793877b0Sjmcneill #define	CIU_IP3_SUM0(n)				(CIU_INT1_SUM0 + 0x10 * (n))
44f693c922Shikaru #define	CIU_INT32_SUM0				UINT64_C(0x0001070000000100)
45d12c93e8Sskrll #define	CIU_INT_SUM1				UINT64_C(0x0001070000000108)
46f693c922Shikaru #define	CIU_INT0_EN0				UINT64_C(0x0001070000000200)
47f693c922Shikaru #define	CIU_INT1_EN0				UINT64_C(0x0001070000000210)
48f693c922Shikaru #define	CIU_INT2_EN0				UINT64_C(0x0001070000000220)
49f693c922Shikaru #define	CIU_INT3_EN0				UINT64_C(0x0001070000000230)
50793877b0Sjmcneill #define	CIU_IP2_EN0(n)				(CIU_INT0_EN0 + 0x20 * (n))
51793877b0Sjmcneill #define	CIU_IP3_EN0(n)				(CIU_INT1_EN0 + 0x20 * (n))
52f693c922Shikaru #define	CIU_INT32_EN0				UINT64_C(0x0001070000000400)
53f693c922Shikaru #define	CIU_INT0_EN1				UINT64_C(0x0001070000000208)
54f693c922Shikaru #define	CIU_INT1_EN1				UINT64_C(0x0001070000000218)
55f693c922Shikaru #define	CIU_INT2_EN1				UINT64_C(0x0001070000000228)
56f693c922Shikaru #define	CIU_INT3_EN1				UINT64_C(0x0001070000000238)
57793877b0Sjmcneill #define	CIU_IP2_EN1(n)				(CIU_INT0_EN1 + 0x20 * (n))
58793877b0Sjmcneill #define	CIU_IP3_EN1(n)				(CIU_INT1_EN1 + 0x20 * (n))
59f693c922Shikaru #define	CIU_INT32_EN1				UINT64_C(0x0001070000000408)
60f693c922Shikaru #define	CIU_TIM0				UINT64_C(0x0001070000000480)
61f693c922Shikaru #define	CIU_TIM1				UINT64_C(0x0001070000000488)
62f693c922Shikaru #define	CIU_TIM2				UINT64_C(0x0001070000000490)
63f693c922Shikaru #define	CIU_TIM3				UINT64_C(0x0001070000000498)
64f693c922Shikaru #define	CIU_WDOG0				UINT64_C(0x0001070000000500)
6582a25ec3Ssimonb #define	CIU_WDOG(n)				(CIU_WDOG0 + (n) * 8)
66f693c922Shikaru #define	CIU_PP_POKE0				UINT64_C(0x0001070000000580)
67f693c922Shikaru #define	CIU_PP_POKE1				UINT64_C(0x0001070000000588)
68793877b0Sjmcneill #define	CIU_PP_POKE(n)				(CIU_PP_POKE0 + (n) * 8)
69f693c922Shikaru #define	CIU_MBOX_SET0				UINT64_C(0x0001070000000600)
70bfd74ed9Smatt #define	CIU_MBOX_SET1				UINT64_C(0x0001070000000608)
71793877b0Sjmcneill #define	CIU_MBOX_SET(n)				(CIU_MBOX_SET0 + (n) * 8)
72f693c922Shikaru #define	CIU_MBOX_CLR0				UINT64_C(0x0001070000000680)
73bfd74ed9Smatt #define	CIU_MBOX_CLR1				UINT64_C(0x0001070000000688)
74793877b0Sjmcneill #define	CIU_MBOX_CLR(n)				(CIU_MBOX_CLR0 + (n) * 8)
75f693c922Shikaru #define	CIU_PP_RST				UINT64_C(0x0001070000000700)
76f693c922Shikaru #define	CIU_PP_DBG				UINT64_C(0x0001070000000708)
77f693c922Shikaru #define	CIU_GSTOP				UINT64_C(0x0001070000000710)
78f693c922Shikaru #define	CIU_NMI					UINT64_C(0x0001070000000718)
79f693c922Shikaru #define	CIU_DINT				UINT64_C(0x0001070000000720)
80f693c922Shikaru #define	CIU_FUSE				UINT64_C(0x0001070000000728)
81f693c922Shikaru #define	CIU_BIST				UINT64_C(0x0001070000000730)
82f693c922Shikaru #define	CIU_SOFT_BIST				UINT64_C(0x0001070000000738)
83f693c922Shikaru #define	CIU_SOFT_RST				UINT64_C(0x0001070000000740)
84f693c922Shikaru #define	CIU_SOFT_PRST				UINT64_C(0x0001070000000748)
85f693c922Shikaru #define	CIU_PCI_INTA				UINT64_C(0x0001070000000750)
862d299731Smatt #define	CIU_INT4_SUM0				UINT64_C(0x0001070000000c00)
872d299731Smatt #define	CIU_INT4_SUM1				UINT64_C(0x0001070000000c08)
88*8bf8eed8Sjmcneill #define	CIU_IP4_SUM0(n)				(CIU_INT4_SUM0 + 0x8 * (n))
892d299731Smatt #define	CIU_INT4_EN00				UINT64_C(0x0001070000000c80)
902d299731Smatt #define	CIU_INT4_EN01				UINT64_C(0x0001070000000c88)
912d299731Smatt #define	CIU_INT4_EN10				UINT64_C(0x0001070000000c90)
922d299731Smatt #define	CIU_INT4_EN11				UINT64_C(0x0001070000000c98)
93793877b0Sjmcneill #define	CIU_IP4_EN0(n)				(CIU_INT4_EN00 + 0x10 * (n))
94793877b0Sjmcneill #define	CIU_IP4_EN1(n)				(CIU_INT4_EN01 + 0x10 * (n))
95f693c922Shikaru 
9629ebd0baSmatt #define	CIU_BASE				UINT64_C(0x0001070000000000)
9729ebd0baSmatt 
98f693c922Shikaru #define	CIU_INT0_SUM0_OFFSET			0x0000
99f693c922Shikaru #define	CIU_INT1_SUM0_OFFSET			0x0008
100f693c922Shikaru #define	CIU_INT2_SUM0_OFFSET			0x0010
101f693c922Shikaru #define	CIU_INT3_SUM0_OFFSET			0x0018
102f693c922Shikaru #define	CIU_INT32_SUM0_OFFSET			0x0100
103d12c93e8Sskrll #define	CIU_INT_SUM1_OFFSET			0x0108
104f693c922Shikaru #define	CIU_INT0_EN0_OFFSET			0x0200
105f693c922Shikaru #define	CIU_INT1_EN0_OFFSET			0x0210
106f693c922Shikaru #define	CIU_INT2_EN0_OFFSET			0x0220
107f693c922Shikaru #define	CIU_INT3_EN0_OFFSET			0x0230
108f693c922Shikaru #define	CIU_INT32_EN0_OFFSET			0x0400
109f693c922Shikaru #define	CIU_INT0_EN1_OFFSET			0x0208
110f693c922Shikaru #define	CIU_INT1_EN1_OFFSET			0x0218
111f693c922Shikaru #define	CIU_INT2_EN1_OFFSET			0x0228
112f693c922Shikaru #define	CIU_INT3_EN1_OFFSET			0x0238
113f693c922Shikaru #define	CIU_INT32_EN1_OFFSET			0x0408
114f693c922Shikaru #define	CIU_TIM0_OFFSET				0x0480
115f693c922Shikaru #define	CIU_TIM1_OFFSET				0x0488
116f693c922Shikaru #define	CIU_TIM2_OFFSET				0x0490
117f693c922Shikaru #define	CIU_TIM3_OFFSET				0x0498
118f693c922Shikaru #define	CIU_WDOG0_OFFSET			0x0500
119f693c922Shikaru #define	CIU_WDOG1_OFFSET			0x0508
120f693c922Shikaru #define	CIU_PP_POKE0_OFFSET			0x0580
121f693c922Shikaru #define	CIU_PP_POKE1_OFFSET			0x0588
122f693c922Shikaru #define	CIU_MBOX_SET0_OFFSET			0x0600
123f693c922Shikaru #define	CIU_MBOX_SET1_OFFSET			0x0608
124f693c922Shikaru #define	CIU_MBOX_CLR0_OFFSET			0x0680
125f693c922Shikaru #define	CIU_MBOX_CLR1_OFFSET			0x0688
126f693c922Shikaru #define	CIU_PP_RST_OFFSET			0x0700
127f693c922Shikaru #define	CIU_PP_DBG_OFFSET			0x0708
128f693c922Shikaru #define	CIU_GSTOP_OFFSET			0x0710
129f693c922Shikaru #define	CIU_NMI_OFFSET				0x0718
130f693c922Shikaru #define	CIU_DINT_OFFSET				0x0720
131f693c922Shikaru #define	CIU_FUSE_OFFSET				0x0728
132f693c922Shikaru #define	CIU_BIST_OFFSET				0x0730
133f693c922Shikaru #define	CIU_SOFT_BIST_OFFSET			0x0738
134f693c922Shikaru #define	CIU_SOFT_RST_OFFSET			0x0740
135f693c922Shikaru #define	CIU_SOFT_PRST_OFFSET			0x0748
136f693c922Shikaru #define	CIU_PCI_INTA_OFFSET			0x0750
137f693c922Shikaru 
138f693c922Shikaru /* ---- register bits */
139f693c922Shikaru 
14082a25ec3Ssimonb /* interrupt numbers */
141f693c922Shikaru 
14282a25ec3Ssimonb #define	CIU_INT_BOOTDMA				63
14382a25ec3Ssimonb #define	CIU_INT_MII				62
14482a25ec3Ssimonb #define	CIU_INT_IPDPPTHR			61
14582a25ec3Ssimonb #define	CIU_INT_POWIQ				60
14682a25ec3Ssimonb #define	CIU_INT_TWSI2				59
14782a25ec3Ssimonb #define	CIU_INT_MPI				58
14882a25ec3Ssimonb #define	CIU_INT_PCM				57
14982a25ec3Ssimonb #define	CIU_INT_USB				56
15082a25ec3Ssimonb #define	CIU_INT_TIMER_3				55
15182a25ec3Ssimonb #define	CIU_INT_TIMER_2				54
15282a25ec3Ssimonb #define	CIU_INT_TIMER_1				53
15382a25ec3Ssimonb #define	CIU_INT_TIMER_0				52
15482a25ec3Ssimonb #define	CIU_INT_KEY_ZERO			51
15582a25ec3Ssimonb #define	CIU_INT_IPD_DRP				50
15682a25ec3Ssimonb #define	CIU_INT_GMX_DRP2			49
15782a25ec3Ssimonb #define	CIU_INT_GMX_DRP				48
15882a25ec3Ssimonb #define	CIU_INT_TRACE				47
15982a25ec3Ssimonb #define	CIU_INT_RML				46
16082a25ec3Ssimonb #define	CIU_INT_TWSI				45
16182a25ec3Ssimonb #define	CIU_INT_WDOG_SUM			44
16282a25ec3Ssimonb #define	CIU_INT_PCI_MSI_63_48			43
16382a25ec3Ssimonb #define	CIU_INT_PCI_MSI_47_32			42
16482a25ec3Ssimonb #define	CIU_INT_PCI_MSI_31_16			41
16582a25ec3Ssimonb #define	CIU_INT_PCI_MSI_15_0			40
16682a25ec3Ssimonb #define	CIU_INT_PCI_INT_D			39
16782a25ec3Ssimonb #define	CIU_INT_PCI_INT_C			38
16882a25ec3Ssimonb #define	CIU_INT_PCI_INT_B			37
16982a25ec3Ssimonb #define	CIU_INT_PCI_INT_A			36
17082a25ec3Ssimonb #define	CIU_INT_UART_1				35
17182a25ec3Ssimonb #define	CIU_INT_UART_0				34
17282a25ec3Ssimonb #define	CIU_INT_MBOX_31_16			33
17382a25ec3Ssimonb #define	CIU_INT_MBOX_15_0			32
17482a25ec3Ssimonb #define	CIU_INT_GPIO_15				31
17582a25ec3Ssimonb #define	CIU_INT_GPIO_14				30
17682a25ec3Ssimonb #define	CIU_INT_GPIO_13				29
17782a25ec3Ssimonb #define	CIU_INT_GPIO_12				28
17882a25ec3Ssimonb #define	CIU_INT_GPIO_11				27
17982a25ec3Ssimonb #define	CIU_INT_GPIO_10				26
18082a25ec3Ssimonb #define	CIU_INT_GPIO_9				25
18182a25ec3Ssimonb #define	CIU_INT_GPIO_8				24
18282a25ec3Ssimonb #define	CIU_INT_GPIO_7				23
18382a25ec3Ssimonb #define	CIU_INT_GPIO_6				22
18482a25ec3Ssimonb #define	CIU_INT_GPIO_5				21
18582a25ec3Ssimonb #define	CIU_INT_GPIO_4				20
18682a25ec3Ssimonb #define	CIU_INT_GPIO_3				19
18782a25ec3Ssimonb #define	CIU_INT_GPIO_2				18
18882a25ec3Ssimonb #define	CIU_INT_GPIO_1				17
18982a25ec3Ssimonb #define	CIU_INT_GPIO_0				16
19082a25ec3Ssimonb #define	CIU_INT_WORKQ_15			15
19182a25ec3Ssimonb #define	CIU_INT_WORKQ_14			14
19282a25ec3Ssimonb #define	CIU_INT_WORKQ_13			13
19382a25ec3Ssimonb #define	CIU_INT_WORKQ_12			12
19482a25ec3Ssimonb #define	CIU_INT_WORKQ_11			11
19582a25ec3Ssimonb #define	CIU_INT_WORKQ_10			10
19682a25ec3Ssimonb #define	CIU_INT_WORKQ_9				 9
19782a25ec3Ssimonb #define	CIU_INT_WORKQ_8				 8
19882a25ec3Ssimonb #define	CIU_INT_WORKQ_7				 7
19982a25ec3Ssimonb #define	CIU_INT_WORKQ_6				 6
20082a25ec3Ssimonb #define	CIU_INT_WORKQ_5				 5
20182a25ec3Ssimonb #define	CIU_INT_WORKQ_4				 4
20282a25ec3Ssimonb #define	CIU_INT_WORKQ_3				 3
20382a25ec3Ssimonb #define	CIU_INT_WORKQ_2				 2
20482a25ec3Ssimonb #define	CIU_INT_WORKQ_1				 1
20582a25ec3Ssimonb #define	CIU_INT_WORKQ_0				 0
206f693c922Shikaru 
20782a25ec3Ssimonb #define	CUI_INT_WDOG_15				 15
20882a25ec3Ssimonb #define	CUI_INT_WDOG_14				 14
20982a25ec3Ssimonb #define	CUI_INT_WDOG_13				 13
21082a25ec3Ssimonb #define	CUI_INT_WDOG_12				 12
21182a25ec3Ssimonb #define	CUI_INT_WDOG_11				 11
21282a25ec3Ssimonb #define	CUI_INT_WDOG_10				 10
21382a25ec3Ssimonb #define	CUI_INT_WDOG_9				  9
21482a25ec3Ssimonb #define	CUI_INT_WDOG_8				  8
21582a25ec3Ssimonb #define	CUI_INT_WDOG_7				  7
21682a25ec3Ssimonb #define	CUI_INT_WDOG_6				  6
21782a25ec3Ssimonb #define	CUI_INT_WDOG_5				  5
21882a25ec3Ssimonb #define	CUI_INT_WDOG_4				  4
21982a25ec3Ssimonb #define	CUI_INT_WDOG_3				  3
22082a25ec3Ssimonb #define	CUI_INT_WDOG_2				  2
22182a25ec3Ssimonb #define	CUI_INT_WDOG_1				  1
22282a25ec3Ssimonb #define	CUI_INT_WDOG_0				  0
223f693c922Shikaru 
224f693c922Shikaru #define	CIU_TIMX_XXX_63_37			UINT64_C(0xffffffe000000000)
225f693c922Shikaru #define	CIU_TIMX_ONE_SHOT			UINT64_C(0x0000001000000000)
226f693c922Shikaru #define	CIU_TIMX_LEN				UINT64_C(0x0000000fffffffff)
227f693c922Shikaru 
228f693c922Shikaru #define	CIU_WDOGX_XXX_63_46			UINT64_C(0xffffc00000000000)
229f693c922Shikaru #define	CIU_WDOGX_GSTOPEN			UINT64_C(0x0000200000000000)
230f693c922Shikaru #define	CIU_WDOGX_DSTOP				UINT64_C(0x0000100000000000)
231f693c922Shikaru #define	CIU_WDOGX_CNT				UINT64_C(0x00000ffffff00000)
232f693c922Shikaru #define	CIU_WDOGX_LEN				UINT64_C(0x00000000000ffff0)
233f693c922Shikaru #define	CIU_WDOGX_STATE				UINT64_C(0x000000000000000c)
234f693c922Shikaru #define	CIU_WDOGX_MODE				UINT64_C(0x0000000000000003)
23582a25ec3Ssimonb #define	  CIU_WDOGX_MODE_OFF			  0
23682a25ec3Ssimonb #define	  CIU_WDOGX_MODE_INTR			  1
23782a25ec3Ssimonb #define	  CIU_WDOGX_MODE_INTR_NMI		  2
23882a25ec3Ssimonb #define	  CIU_WDOGX_MODE_INTR_NMI_SOFT		  3
239f693c922Shikaru 
240f693c922Shikaru #define	CIU_PP_POKEX_XXX_63_0			UINT64_C(0xffffffffffffffff)
241f693c922Shikaru 
242f693c922Shikaru #define	CIU_MBOX_SETX_XXX_63_32			UINT64_C(0xffffffff00000000)
243f693c922Shikaru #define	CIU_MBOX_SETX_SET			UINT64_C(0x00000000ffffffff)
244f693c922Shikaru 
245f693c922Shikaru #define	CIU_MBOX_CLRX_XXX_63_32			UINT64_C(0xffffffff00000000)
246f693c922Shikaru #define	CIU_MBOX_CLRX_CLR			UINT64_C(0x00000000ffffffff)
247f693c922Shikaru 
24882a25ec3Ssimonb #define	CIU_PP_RST_RST				UINT64_C(0x0000ffffffffffff)
249f693c922Shikaru #define	CIU_PP_RST_RST0				UINT64_C(0x0000000000000001)
250f693c922Shikaru 
25182a25ec3Ssimonb #define	CIU_PP_DBG_PPDBG			UINT64_C(0x0000ffffffffffff)
252f693c922Shikaru 
253f693c922Shikaru #define	CIU_GSTOP_XXX_63_1			UINT64_C(0xfffffffffffffffe)
254f693c922Shikaru #define	CIU_GSTOP_GSTOP				UINT64_C(0x0000000000000001)
255f693c922Shikaru 
25682a25ec3Ssimonb #define	CIU_NMI_NMI				UINT64_C(0x0000ffffffffffff)
257f693c922Shikaru 
25882a25ec3Ssimonb #define	CIU_DINT_DINT				UINT64_C(0x0000ffffffffffff)
259f693c922Shikaru 
26082a25ec3Ssimonb #define	CIU_FUSE_FUSE				UINT64_C(0x0000ffffffffffff)
261f693c922Shikaru 
26282a25ec3Ssimonb #define	CIU_BIST_BIST				UINT64_C(0x0000ffffffffffff)
263f693c922Shikaru 
264f693c922Shikaru #define	CIU_SOFT_BIST_XXX_63_1			UINT64_C(0xfffffffffffffffe)
265f693c922Shikaru #define	CIU_SOFT_BIST_SOFT_BIST			UINT64_C(0x0000000000000001)
266f693c922Shikaru 
267f693c922Shikaru #define	CIU_SOFT_RST_XXX_63_1			UINT64_C(0xfffffffffffffffe)
268f693c922Shikaru #define	CIU_SOFT_RST_SOFT_RST			UINT64_C(0x0000000000000001)
269f693c922Shikaru 
270cab251b7Ssimonb #define	CIU_SOFT_PRST_XXX_63_4			UINT64_C(0xfffffffffffffff8)
271f693c922Shikaru #define	CIU_SOFT_PRST_HOST64			UINT64_C(0x0000000000000004)
272f693c922Shikaru #define	CIU_SOFT_PRST_NPI			UINT64_C(0x0000000000000002)
273f693c922Shikaru #define	CIU_SOFT_PRST_SOFT_PRST			UINT64_C(0x0000000000000001)
274f693c922Shikaru 
275f693c922Shikaru #define	CIU_PCI_INTA_XXX_63_2			UINT64_C(0xfffffffffffffffc)
276f693c922Shikaru #define	CIU_PCI_INTA_INT			UINT64_C(0x0000000000000003)
277f693c922Shikaru 
278f693c922Shikaru #endif /* _OCTEON_CIUREG_H_ */
279