xref: /netbsd-src/sys/arch/mips/cavium/dev/octeon_gpioreg.h (revision b83ebeba7f767758d2778bb0f9d7a76534253621)
1 /*	$NetBSD: octeon_gpioreg.h,v 1.1 2015/04/29 08:32:01 hikaru Exp $	*/
2 
3 /*
4  * Copyright (c) 2007 Internet Initiative Japan, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 /*
30  * GPIO Registers
31  */
32 
33 #ifndef _OCTEON_GPIOREG_H_
34 #define _OCTEON_GPIOREG_H_
35 
36 #define	GPIO_BIT_CFG0				0x0001070000000800ULL
37 #define	GPIO_BIT_CFG1				0x0001070000000808ULL
38 #define	GPIO_BIT_CFG2				0x0001070000000810ULL
39 #define	GPIO_BIT_CFG3				0x0001070000000818ULL
40 #define	GPIO_BIT_CFG4				0x0001070000000820ULL
41 #define	GPIO_BIT_CFG5				0x0001070000000828ULL
42 #define	GPIO_BIT_CFG6				0x0001070000000830ULL
43 #define	GPIO_BIT_CFG7				0x0001070000000838ULL
44 #define	GPIO_BIT_CFG8				0x0001070000000840ULL
45 #define	GPIO_BIT_CFG9				0x0001070000000848ULL
46 #define	GPIO_BIT_CFG10				0x0001070000000850ULL
47 #define	GPIO_BIT_CFG11				0x0001070000000858ULL
48 #define	GPIO_BIT_CFG12				0x0001070000000860ULL
49 #define	GPIO_BIT_CFG13				0x0001070000000868ULL
50 #define	GPIO_BIT_CFG14				0x0001070000000870ULL
51 #define	GPIO_BIT_CFG15				0x0001070000000878ULL
52 #define	GPIO_RX_DAT				0x0001070000000880ULL
53 #define	GPIO_TX_SET				0x0001070000000888ULL
54 #define	GPIO_TX_CLR				0x0001070000000890ULL
55 #define	GPIO_INT_CLR				0x0001070000000898ULL
56 #define	GPIO_DBG_ENA				0x00010700000008a0ULL
57 #define	GPIO_BOOT_ENA				0x00010700000008a8ULL
58 #define	GPIO_XBIT_CFG16				0x0001070000000900ULL
59 #define	GPIO_XBIT_CFG17				0x0001070000000908ULL
60 #define	GPIO_XBIT_CFG18				0x0001070000000910ULL
61 #define	GPIO_XBIT_CFG19				0x0001070000000918ULL
62 #define	GPIO_XBIT_CFG20				0x0001070000000920ULL
63 #define	GPIO_XBIT_CFG21				0x0001070000000928ULL
64 #define	GPIO_XBIT_CFG22				0x0001070000000930ULL
65 #define	GPIO_XBIT_CFG23				0x0001070000000938ULL
66 
67 #define	GPIO_BIT_CFG_XXX_63_12			UINT64_C(0xfffffffffffff000)
68 #define	GPIO_BIT_CFG_FIL_SEL			UINT64_C(0x0000000000000f00)
69 #define	GPIO_BIT_CFG_FIL_CNT			UINT64_C(0x00000000000000f0)
70 #define	GPIO_BIT_CFG_INT_TYPE			UINT64_C(0x0000000000000008)
71 #define	GPIO_BIT_CFG_INT_EN			UINT64_C(0x0000000000000004)
72 #define	GPIO_BIT_CFG_RX_XOR			UINT64_C(0x0000000000000002)
73 #define	GPIO_BIT_CFG_TX_OE			UINT64_C(0x0000000000000001)
74 
75 /* XXX */
76 
77 /* ---- snprintb */
78 
79 #define	GPIO_BIT_CFG_BITS \
80 	"\177"		/* new format */ \
81 	"\020"		/* hex display */ \
82 	"\020"		/* %016x format */ \
83 	"f\x08\x04"	"FIL_SEL\0" \
84 	"f\x04\x04"	"FIL_CNT\0" \
85 	"b\x03"		"INT_TYPE\0" \
86 	"b\x02"		"INT_EN\0" \
87 	"b\x01"		"RX_XOR\0" \
88 	"b\x00"		"TX_OE\0"
89 
90 /* ---- bus_space */
91 
92 #define	GPIO_BASE				0x0001070000000800ULL
93 #define	GPIO_SIZE				0x0200
94 
95 #define	GPIO_BIT_CFG0_OFFSET			0x0000
96 #define	GPIO_BIT_CFG1_OFFSET			0x0008
97 #define	GPIO_BIT_CFG2_OFFSET			0x0010
98 #define	GPIO_BIT_CFG3_OFFSET			0x0018
99 #define	GPIO_BIT_CFG4_OFFSET			0x0020
100 #define	GPIO_BIT_CFG5_OFFSET			0x0028
101 #define	GPIO_BIT_CFG6_OFFSET			0x0030
102 #define	GPIO_BIT_CFG7_OFFSET			0x0038
103 #define	GPIO_BIT_CFG8_OFFSET			0x0040
104 #define	GPIO_BIT_CFG9_OFFSET			0x0048
105 #define	GPIO_BIT_CFG10_OFFSET			0x0050
106 #define	GPIO_BIT_CFG11_OFFSET			0x0058
107 #define	GPIO_BIT_CFG12_OFFSET			0x0060
108 #define	GPIO_BIT_CFG13_OFFSET			0x0068
109 #define	GPIO_BIT_CFG14_OFFSET			0x0070
110 #define	GPIO_BIT_CFG15_OFFSET			0x0078
111 #define	GPIO_RX_DAT_OFFSET			0x0080
112 #define	GPIO_TX_SET_OFFSET			0x0088
113 #define	GPIO_TX_CLR_OFFSET			0x0090
114 #define	GPIO_INT_CLR_OFFSET			0x0098
115 #define	GPIO_DBG_ENA_OFFSET			0x00a0
116 #define	GPIO_BOOT_ENA_OFFSET			0x00a8
117 #define	GPIO_XBIT_CFG16_OFFSET			0x0100
118 #define	GPIO_XBIT_CFG17_OFFSET			0x0108
119 #define	GPIO_XBIT_CFG18_OFFSET			0x0110
120 #define	GPIO_XBIT_CFG19_OFFSET			0x0118
121 #define	GPIO_XBIT_CFG20_OFFSET			0x0120
122 #define	GPIO_XBIT_CFG21_OFFSET			0x0128
123 #define	GPIO_XBIT_CFG22_OFFSET			0x0130
124 #define	GPIO_XBIT_CFG23_OFFSET			0x0138
125 
126 #endif /* _OCTEON_GPIOREG_H_ */
127