xref: /freebsd/sys/dev/gpio/chvgpio_reg.h (revision 734e82fe33aa764367791a7d603b383996c6b40b)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2017 Tom Jones <tj@enoti.me>
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 AUTHOR 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 AUTHOR 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  * Copyright (c) 2016 Mark Kettenis
31  *
32  * Permission to use, copy, modify, and distribute this software for any
33  * purpose with or without fee is hereby granted, provided that the above
34  * copyright notice and this permission notice appear in all copies.
35  *
36  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
37  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
38  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
39  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
40  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
41  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
42  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
43  *
44  */
45 
46 
47 #define CHVGPIO_INTERRUPT_STATUS		0x0300
48 #define CHVGPIO_INTERRUPT_MASK			0x0380
49 #define CHVGPIO_PAD_CFG0			0x4400
50 #define CHVGPIO_PAD_CFG1			0x4404
51 
52 #define CHVGPIO_PAD_CFG0_GPIORXSTATE		0x00000001
53 #define CHVGPIO_PAD_CFG0_GPIOTXSTATE		0x00000002
54 #define CHVGPIO_PAD_CFG0_INTSEL_MASK		0xf0000000
55 #define CHVGPIO_PAD_CFG0_INTSEL_SHIFT		28
56 
57 #define CHVGPIO_PAD_CFG0_GPIOCFG_SHIFT		8
58 #define CHVGPIO_PAD_CFG0_GPIOCFG_MASK		(7 << CHVGPIO_PAD_CFG0_GPIOCFG_SHIFT)
59 #define CHVGPIO_PAD_CFG0_GPIOCFG_GPIO		0
60 #define CHVGPIO_PAD_CFG0_GPIOCFG_GPO		1
61 #define CHVGPIO_PAD_CFG0_GPIOCFG_GPI		2
62 #define CHVGPIO_PAD_CFG0_GPIOCFG_HIZ		3
63 
64 #define CHVGPIO_PAD_CFG1_INTWAKECFG_MASK	0x00000007
65 #define CHVGPIO_PAD_CFG1_INTWAKECFG_FALLING	0x00000001
66 #define CHVGPIO_PAD_CFG1_INTWAKECFG_RISING	0x00000002
67 #define CHVGPIO_PAD_CFG1_INTWAKECFG_BOTH	0x00000003
68 #define CHVGPIO_PAD_CFG1_INTWAKECFG_LEVEL	0x00000004
69 #define CHVGPIO_PAD_CFG1_INVRXTX_MASK		0x000000f0
70 #define CHVGPIO_PAD_CFG1_INVRXTX_RXDATA		0x00000040
71 
72 /*
73  * The pads for the pins are arranged in groups of maximal 15 pins.
74  * The arrays below give the number of pins per group, such that we
75  * can validate the (untrusted) pin numbers from ACPI.
76  */
77 #define	E_UID		3
78 #define	E_BANK_PREFIX	"eastbank"
79 
80 const int chv_east_pins[] = {
81 	12, 12, -1
82 };
83 
84 const char *chv_east_pin_names[] = {
85 		"PMU_SLP_S3_B",
86 		"PMU_BATLOW_B",
87 		"SUS_STAT_B",
88 		"PMU_SLP_S0IX_B",
89 		"PMU_AC_PRESENT",
90 		"PMU_PLTRST_B",
91 		"PMU_SUSCLK",
92 		"PMU_SLP_LAN_B",
93 		"PMU_PWRBTN_B",
94 		"PMU_SLP_S4_B",
95 		"PMU_WAKE_B",
96 		"PMU_WAKE_LAN_B"
97 
98 		"MF_ISH_GPIO_3",
99 		"MF_ISH_GPIO_7",
100 		"MF_ISH_I2C1_SCL",
101 		"MF_ISH_GPIO_1",
102 		"MF_ISH_GPIO_5",
103 		"MF_ISH_GPIO_9",
104 		"MF_ISH_GPIO_0",
105 		"MF_ISH_GPIO_4",
106 		"MF_ISH_GPIO_8",
107 		"MF_ISH_GPIO_2",
108 		"MF_ISH_GPIO_6",
109 		"MF_ISH_I2C1_SDA"
110 };
111 
112 #define	N_UID		2
113 #define	N_BANK_PREFIX	"northbank"
114 
115 const int chv_north_pins[] = {
116 	9, 13, 12, 12, 13, -1
117 };
118 
119 const char *chv_north_pin_names[] = {
120 	"GPIO_DFX0_PAD",
121 	"GPIO_DFX3_PAD",
122 	"GPIO_DFX7_PAD",
123 	"GPIO_DFX1_PAD",
124 	"GPIO_DFX5_PAD",
125 	"GPIO_DFX4_PAD",
126 	"GPIO_DFX8_PAD",
127 	"GPIO_DFX2_PAD",
128 	"GPIO_DFX6_PAD",
129 
130 	"GPIO_SUS0_PAD",
131 	"SEC_GPIO_SUS10_PAD",
132 	"GPIO_SUS3_PAD",
133 	"GPIO_SUS7_PAD",
134 	"GPIO_SUS1_PAD",
135 	"GPIO_SUS5_PAD",
136 	"SEC_GPIO_SUS11_PAD",
137 	"GPIO_SUS4_PAD",
138 	"SEC_GPIO_SUS8_PAD",
139 	"GPIO_SUS2_PAD",
140 	"GPIO_SUS6_PAD",
141 	"CX_PREQ_B_PAD",
142 	"SEC_GPIO_SUS9_PAD",
143 
144 	"TRST_B_PAD",
145 	"TCK_PAD",
146 	"PROCHOT_B_PAD",
147 	"SVID0_DATA_PAD",
148 	"TMS_PAD",
149 	"CX_PRDY_B_2_PAD",
150 	"TDO_2_PAD",
151 	"CX_PRDY_B_PAD",
152 	"SVID0_ALERT_B_PAD",
153 	"TDO_PAD",
154 	"SVID0_CLK_PAD",
155 	"TDI_PAD",
156 
157 	"GP_CAMERASB05_PAD",
158 	"GP_CAMERASB02_PAD",
159 	"GP_CAMERASB08_PAD",
160 	"GP_CAMERASB00_PAD",
161 	"GP_CAMERASB06_PAD",
162 	"GP_CAMERASB10_PAD",
163 	"GP_CAMERASB03_PAD",
164 	"GP_CAMERASB09_PAD",
165 	"GP_CAMERASB01_PAD",
166 	"GP_CAMERASB07_PAD",
167 	"GP_CAMERASB11_PAD",
168 	"GP_CAMERASB04_PAD",
169 
170 	"PANEL0_BKLTEN_PAD",
171 	"HV_DDI0_HPD_PAD",
172 	"HV_DDI2_DDC_SDA_PAD",
173 	"PANEL1_BKLTCTL_PAD",
174 	"HV_DDI1_HPD_PAD",
175 	"PANEL0_BKLTCTL_PAD",
176 	"HV_DDI0_DDC_SDA_PAD",
177 	"HV_DDI2_DDC_SCL_PAD",
178 	"HV_DDI2_HPD_PAD",
179 	"PANEL1_VDDEN_PAD",
180 	"PANEL1_BKLTEN_PAD",
181 	"HV_DDI0_DDC_SCL_PAD",
182 	"PANEL0_VDDEN_PAD",
183 };
184 
185 
186 #define	SE_UID		4
187 #define	SE_BANK_PREFIX	"southeastbank"
188 
189 const int chv_southeast_pins[] = {
190 	8, 12, 6, 8, 10, 11, -1
191 };
192 
193 const char *chv_southeast_pin_names[] = {
194 	"MF_PLT_CLK0_PAD",
195 	"PWM1_PAD",
196 	"MF_PLT_CLK1_PAD",
197 	"MF_PLT_CLK4_PAD",
198 	"MF_PLT_CLK3_PAD",
199 	"PWM0_PAD",
200 	"MF_PLT_CLK5_PAD",
201 	"MF_PLT_CLK2_PAD",
202 
203 	"SDMMC2_D3_CD_B_PAD",
204 	"SDMMC1_CLK_PAD",
205 	"SDMMC1_D0_PAD",
206 	"SDMMC2_D1_PAD",
207 	"SDMMC2_CLK_PAD",
208 	"SDMMC1_D2_PAD",
209 	"SDMMC2_D2_PAD",
210 	"SDMMC2_CMD_PAD",
211 	"SDMMC1_CMD_PAD",
212 	"SDMMC1_D1_PAD",
213 	"SDMMC2_D0_PAD",
214 	"SDMMC1_D3_CD_B_PAD",
215 
216 	"SDMMC3_D1_PAD",
217 	"SDMMC3_CLK_PAD",
218 	"SDMMC3_D3_PAD",
219 	"SDMMC3_D2_PAD",
220 	"SDMMC3_CMD_PAD",
221 	"SDMMC3_D0_PAD",
222 
223 	"MF_LPC_AD2_PAD",
224 	"LPC_CLKRUNB_PAD",
225 	"MF_LPC_AD0_PAD",
226 	"LPC_FRAMEB_PAD",
227 	"MF_LPC_CLKOUT1_PAD",
228 	"MF_LPC_AD3_PAD",
229 	"MF_LPC_CLKOUT0_PAD",
230 	"MF_LPC_AD1_PAD",
231 
232 	"SPI1_MISO_PAD",
233 	"SPI1_CS0_B_PAD",
234 	"SPI1_CLK_PAD",
235 	"MMC1_D6_PAD",
236 	"SPI1_MOSI_PAD",
237 	"MMC1_D5_PAD",
238 	"SPI1_CS1_B_PAD",
239 	"MMC1_D4_SD_WE_PAD",
240 	"MMC1_D7_PAD",
241 	"MMC1_RCLK_PAD",
242 
243 	"USB_OC1_B_PAD",
244 	"PMU_RESETBUTTON_B_PAD",
245 	"GPIO_ALERT_PAD",
246 	"SDMMC3_PWR_EN_B_PAD",
247 	"ILB_SERIRQ_PAD",
248 	"USB_OC0_B_PAD",
249 	"SDMMC3_CD_B_PAD",
250 	"SPKR_PAD",
251 	"SUSPWRDNACK_PAD",
252 	"SPARE_PIN_PAD",
253 	"SDMMC3_1P8_EN_PAD",
254 };
255 
256 #define	SW_UID		1
257 #define	SW_BANK_PREFIX	"southwestbank"
258 
259 const int chv_southwest_pins[] = {
260 	8, 8, 8, 8, 8, 8, 8, -1
261 };
262 
263 const char *chv_southwest_pin_names[] = {
264 	"FST_SPI_D2_PAD",
265 	"FST_SPI_D0_PAD",
266 	"FST_SPI_CLK_PAD",
267 	"FST_SPI_D3_PAD",
268 	"FST_SPI_CS1_B_PAD",
269 	"FST_SPI_D1_PAD",
270 	"FST_SPI_CS0_B_PAD",
271 	"FST_SPI_CS2_B_PAD",
272 
273 	"UART1_RTS_B_PAD",
274 	"UART1_RXD_PAD",
275 	"UART2_RXD_PAD",
276 	"UART1_CTS_B_PAD",
277 	"UART2_RTS_B_PAD",
278 	"UART1_TXD_PAD",
279 	"UART2_TXD_PAD",
280 	"UART2_CTS_B_PAD",
281 
282 	"MF_HDA_CLK"
283 	"MF_HDA_RSTB",
284 	"MF_HDA_SDIO",
285 	"MF_HDA_SDO",
286 	"MF_HDA_DOCKRSTB",
287 	"MF_HDA_SYNC",
288 	"MF_HDA_SDI1",
289 	"MF_HDA_DOCKENB",
290 
291 	"I2C5_SDA_PAD",
292 	"I2C4_SDA_PAD",
293 	"I2C6_SDA_PAD",
294 	"I2C5_SCL_PAD",
295 	"I2C_NFC_SDA_PAD",
296 	"I2C4_SCL_PAD",
297 	"I2C6_SCL_PAD",
298 	"I2C_NFC_SCL_PAD",
299 
300 	"I2C1_SDA_PAD",
301 	"I2C0_SDA_PAD",
302 	"I2C2_SDA_PAD",
303 	"I2C1_SCL_PAD",
304 	"I2C3_SDA_PAD",
305 	"I2C0_SCL_PAD",
306 	"I2C2_SCL_PAD",
307 	"I2C3_SCL_PAD",
308 
309 	"SATA_GP0",
310 	"SATA_GP1",
311 	"SATA_LEDN",
312 	"SATA_GP2",
313 	"MF_SMB_ALERTB",
314 	"SATA_GP3",
315 	"MF_SMB_CLK",
316 	"MF_SMB_DATA",
317 
318 	"PCIE_CLKREQ0B_PAD",
319 	"PCIE_CLKREQ1B_PAD",
320 	"GP_SSP_2_CLK_PAD",
321 	"PCIE_CLKREQ2B_PAD",
322 	"GP_SSP_2_RXD_PAD",
323 	"PCIE_CLKREQ3B_PAD",
324 	"GP_SSP_2_FS_PAD",
325 	"GP_SSP_2_TXD_PAD",
326 };
327 
328 const char *virtualgpio[] = {
329 	"VIRTUAL0_PAD",
330 	"VIRTUAL1_PAD",
331 	"VIRTUAL2_PAD",
332 	"VIRTUAL3_PAD",
333 	"VIRTUAL4_PAD",
334 	"VIRTUAL5_PAD",
335 	"VIRTUAL6_PAD",
336 	"VIRTUAL7_PAD",
337 };
338