1b4f2fcb5SAndy Shevchenko // SPDX-License-Identifier: GPL-2.0
2b4f2fcb5SAndy Shevchenko /*
3b4f2fcb5SAndy Shevchenko  * Intel Emmitsburg PCH pinctrl/GPIO driver
4b4f2fcb5SAndy Shevchenko  *
5b4f2fcb5SAndy Shevchenko  * Copyright (C) 2020, Intel Corporation
6b4f2fcb5SAndy Shevchenko  * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7b4f2fcb5SAndy Shevchenko  */
8b4f2fcb5SAndy Shevchenko 
9b4f2fcb5SAndy Shevchenko #include <linux/mod_devicetable.h>
10b4f2fcb5SAndy Shevchenko #include <linux/module.h>
11b4f2fcb5SAndy Shevchenko #include <linux/platform_device.h>
12b4f2fcb5SAndy Shevchenko 
13b4f2fcb5SAndy Shevchenko #include <linux/pinctrl/pinctrl.h>
14b4f2fcb5SAndy Shevchenko 
15b4f2fcb5SAndy Shevchenko #include "pinctrl-intel.h"
16b4f2fcb5SAndy Shevchenko 
17b4f2fcb5SAndy Shevchenko #define EBG_PAD_OWN	0x0a0
18b4f2fcb5SAndy Shevchenko #define EBG_PADCFGLOCK	0x100
19b4f2fcb5SAndy Shevchenko #define EBG_HOSTSW_OWN	0x130
20b4f2fcb5SAndy Shevchenko #define EBG_GPI_IS	0x200
21b4f2fcb5SAndy Shevchenko #define EBG_GPI_IE	0x210
22b4f2fcb5SAndy Shevchenko 
23b4f2fcb5SAndy Shevchenko #define EBG_GPP(r, s, e)				\
24b4f2fcb5SAndy Shevchenko 	{						\
25b4f2fcb5SAndy Shevchenko 		.reg_num = (r),				\
26b4f2fcb5SAndy Shevchenko 		.base = (s),				\
27b4f2fcb5SAndy Shevchenko 		.size = ((e) - (s) + 1),		\
28b4f2fcb5SAndy Shevchenko 	}
29b4f2fcb5SAndy Shevchenko 
30b4f2fcb5SAndy Shevchenko #define EBG_COMMUNITY(b, s, e, g)			\
31b4f2fcb5SAndy Shevchenko 	{						\
32b4f2fcb5SAndy Shevchenko 		.barno = (b),				\
33b4f2fcb5SAndy Shevchenko 		.padown_offset = EBG_PAD_OWN,		\
34b4f2fcb5SAndy Shevchenko 		.padcfglock_offset = EBG_PADCFGLOCK,	\
35b4f2fcb5SAndy Shevchenko 		.hostown_offset = EBG_HOSTSW_OWN,	\
36b4f2fcb5SAndy Shevchenko 		.is_offset = EBG_GPI_IS,		\
37b4f2fcb5SAndy Shevchenko 		.ie_offset = EBG_GPI_IE,		\
38b4f2fcb5SAndy Shevchenko 		.pin_base = (s),			\
39b4f2fcb5SAndy Shevchenko 		.npins = ((e) - (s) + 1),		\
40b4f2fcb5SAndy Shevchenko 		.gpps = (g),				\
41b4f2fcb5SAndy Shevchenko 		.ngpps = ARRAY_SIZE(g),			\
42b4f2fcb5SAndy Shevchenko 	}
43b4f2fcb5SAndy Shevchenko 
44b4f2fcb5SAndy Shevchenko /* Emmitsburg */
45b4f2fcb5SAndy Shevchenko static const struct pinctrl_pin_desc ebg_pins[] = {
46b4f2fcb5SAndy Shevchenko 	/* GPP_A */
47b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(0, "ESPI_ALERT0B"),
48b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(1, "ESPI_ALERT1B"),
49b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(2, "ESPI_IO_0"),
50b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(3, "ESPI_IO_1"),
51b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(4, "ESPI_IO_2"),
52b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(5, "ESPI_IO_3"),
53b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(6, "ESPI_CS0B"),
54b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(7, "ESPI_CS1B"),
55b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(8, "ESPI_RESETB"),
56b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(9, "ESPI_CLK"),
57b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(10, "SRCCLKREQB_0"),
58b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(11, "SRCCLKREQB_1"),
59b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(12, "SRCCLKREQB_2"),
60b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(13, "SRCCLKREQB_3"),
61b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(14, "SRCCLKREQB_4"),
62b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(15, "SRCCLKREQB_5"),
63b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(16, "SRCCLKREQB_6"),
64b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(17, "SRCCLKREQB_7"),
65b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(18, "SRCCLKREQB_8"),
66b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(19, "SRCCLKREQB_9"),
67b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(20, "ESPI_CLK_LOOPBK"),
68b4f2fcb5SAndy Shevchenko 	/* GPP_B */
69b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(21, "GSXDOUT"),
70b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(22, "GSXSLOAD"),
71b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(23, "GSXDIN"),
72b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(24, "GSXSRESETB"),
73b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(25, "GSXCLK"),
74b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(26, "USB2_OCB_0"),
75b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(27, "USB2_OCB_1"),
76b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(28, "USB2_OCB_2"),
77b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(29, "USB2_OCB_3"),
78b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(30, "USB2_OCB_4"),
79b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(31, "USB2_OCB_5"),
80b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(32, "USB2_OCB_6"),
81b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(33, "HS_UART0_RXD"),
82b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(34, "HS_UART0_TXD"),
83b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(35, "HS_UART0_RTSB"),
84b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(36, "HS_UART0_CTSB"),
85b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(37, "HS_UART1_RXD"),
86b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(38, "HS_UART1_TXD"),
87b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(39, "HS_UART1_RTSB"),
88b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(40, "HS_UART1_CTSB"),
89b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(41, "GPPC_B_20"),
90b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(42, "GPPC_B_21"),
91b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(43, "GPPC_B_22"),
92b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(44, "PS_ONB"),
93b4f2fcb5SAndy Shevchenko 	/* SPI */
94b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(45, "SPI0_IO_2"),
95b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(46, "SPI0_IO_3"),
96b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(47, "SPI0_MOSI_IO_0"),
97b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(48, "SPI0_MISO_IO_1"),
98b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(49, "SPI0_TPM_CSB"),
99b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(50, "SPI0_FLASH_0_CSB"),
100b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(51, "SPI0_FLASH_1_CSB"),
101b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(52, "SPI0_CLK"),
102b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(53, "TIME_SYNC_0"),
103b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(54, "SPKR"),
104b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(55, "CPU_GP_0"),
105b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(56, "CPU_GP_1"),
106b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(57, "CPU_GP_2"),
107b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(58, "CPU_GP_3"),
108b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(59, "SUSWARNB_SUSPWRDNACK"),
109b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(60, "SUSACKB"),
110b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(61, "NMIB"),
111b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(62, "SMIB"),
112b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(63, "GPPC_S_10"),
113b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(64, "GPPC_S_11"),
114b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(65, "SPI_CLK_LOOPBK"),
115b4f2fcb5SAndy Shevchenko 	/* GPP_C */
116b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(66, "ME_SML0CLK"),
117b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(67, "ME_SML0DATA"),
118b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(68, "ME_SML0ALERTB"),
119b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(69, "ME_SML0BDATA"),
120b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(70, "ME_SML0BCLK"),
121b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(71, "ME_SML0BALERTB"),
122b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(72, "ME_SML1CLK"),
123b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(73, "ME_SML1DATA"),
124b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(74, "ME_SML1ALERTB"),
125b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(75, "ME_SML2CLK"),
126b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(76, "ME_SML2DATA"),
127b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(77, "ME_SML2ALERTB"),
128b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(78, "ME_SML3CLK"),
129b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(79, "ME_SML3DATA"),
130b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(80, "ME_SML3ALERTB"),
131b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(81, "ME_SML4CLK"),
132b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(82, "ME_SML4DATA"),
133b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(83, "ME_SML4ALERTB"),
134b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(84, "GPPC_C_18"),
135b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(85, "MC_SMBCLK"),
136b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(86, "MC_SMBDATA"),
137b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(87, "MC_SMBALERTB"),
138b4f2fcb5SAndy Shevchenko 	/* GPP_D */
139b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(88, "HS_SMBCLK"),
140b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(89, "HS_SMBDATA"),
141b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(90, "HS_SMBALERTB"),
142b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(91, "GBE_SMB_ALRT_N"),
143b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(92, "GBE_SMB_CLK"),
144b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(93, "GBE_SMB_DATA"),
145b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(94, "GBE_GPIO10"),
146b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(95, "GBE_GPIO11"),
147b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(96, "CRASHLOG_TRIG_N"),
148b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(97, "PMEB"),
149b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(98, "BM_BUSYB"),
150b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(99, "PLTRSTB"),
151b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(100, "PCHHOTB"),
152b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(101, "ADR_COMPLETE"),
153b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(102, "ADR_TRIGGER_N"),
154b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(103, "VRALERTB"),
155b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(104, "ADR_ACK"),
156b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(105, "THERMTRIP_N"),
157b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(106, "MEMTRIP_N"),
158b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(107, "MSMI_N"),
159b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(108, "CATERR_N"),
160b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(109, "GLB_RST_WARN_B"),
161b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(110, "USB2_OCB_7"),
162b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(111, "GPP_D_23"),
163b4f2fcb5SAndy Shevchenko 	/* GPP_E */
164b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(112, "SATA1_XPCIE_0"),
165b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(113, "SATA1_XPCIE_1"),
166b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(114, "SATA1_XPCIE_2"),
167b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(115, "SATA1_XPCIE_3"),
168b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(116, "SATA0_XPCIE_2"),
169b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(117, "SATA0_XPCIE_3"),
170b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(118, "SATA0_USB3_XPCIE_0"),
171b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(119, "SATA0_USB3_XPCIE_1"),
172b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(120, "SATA0_SCLOCK"),
173b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(121, "SATA0_SLOAD"),
174b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(122, "SATA0_SDATAOUT"),
175b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(123, "SATA1_SCLOCK"),
176b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(124, "SATA1_SLOAD"),
177b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(125, "SATA1_SDATAOUT"),
178b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(126, "SATA2_SCLOCK"),
179b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(127, "SATA2_SLOAD"),
180b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(128, "SATA2_SDATAOUT"),
181b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(129, "ERR0_N"),
182b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(130, "ERR1_N"),
183b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(131, "ERR2_N"),
184b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(132, "GBE_UART_RXD"),
185b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(133, "GBE_UART_TXD"),
186b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(134, "GBE_UART_RTSB"),
187b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(135, "GBE_UART_CTSB"),
188b4f2fcb5SAndy Shevchenko 	/* JTAG */
189b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(136, "JTAG_TDO"),
190b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(137, "JTAG_TDI"),
191b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(138, "JTAG_TCK"),
192b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(139, "JTAG_TMS"),
193b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(140, "JTAGX"),
194b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(141, "PRDYB"),
195b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(142, "PREQB"),
196b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(143, "GLB_PC_DISABLE"),
197b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(144, "DBG_PMODE"),
198b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(145, "GLB_EXT_ACC_DISABLE"),
199b4f2fcb5SAndy Shevchenko 	/* GPP_H */
200b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(146, "GBE_GPIO12"),
201b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(147, "GBE_GPIO13"),
202b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(148, "GBE_SDP_TIMESYNC0_S2N"),
203b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(149, "GBE_SDP_TIMESYNC1_S2N"),
204b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(150, "GBE_SDP_TIMESYNC2_S2N"),
205b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(151, "GBE_SDP_TIMESYNC3_S2N"),
206b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(152, "GPPC_H_6"),
207b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(153, "GPPC_H_7"),
208b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(154, "NCSI_CLK_IN"),
209b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(155, "NCSI_CRS_DV"),
210b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(156, "NCSI_RXD0"),
211b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(157, "NCSI_RXD1"),
212b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(158, "NCSI_TX_EN"),
213b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(159, "NCSI_TXD0"),
214b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(160, "NCSI_TXD1"),
215b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(161, "NAC_NCSI_CLK_OUT_0"),
216b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(162, "NAC_NCSI_CLK_OUT_1"),
217b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(163, "NAC_NCSI_CLK_OUT_2"),
218b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(164, "PMCALERTB"),
219b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(165, "GPPC_H_19"),
220b4f2fcb5SAndy Shevchenko 	/* GPP_J */
221b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(166, "CPUPWRGD"),
222b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(167, "CPU_THRMTRIP_N"),
223b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(168, "PLTRST_CPUB"),
224b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(169, "TRIGGER0_N"),
225b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(170, "TRIGGER1_N"),
226b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(171, "CPU_PWR_DEBUG_N"),
227b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(172, "CPU_MEMTRIP_N"),
228b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(173, "CPU_MSMI_N"),
229b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(174, "ME_PECI"),
230b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(175, "NAC_SPARE0"),
231b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(176, "NAC_SPARE1"),
232b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(177, "NAC_SPARE2"),
233b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(178, "CPU_ERR0_N"),
234b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(179, "CPU_CATERR_N"),
235b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(180, "CPU_ERR1_N"),
236b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(181, "CPU_ERR2_N"),
237b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(182, "GPP_J_16"),
238b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(183, "GPP_J_17"),
239b4f2fcb5SAndy Shevchenko 	/* GPP_I */
240b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(184, "GBE_GPIO4"),
241b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(185, "GBE_GPIO5"),
242b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(186, "GBE_GPIO6"),
243b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(187, "GBE_GPIO7"),
244b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(188, "GBE1_LED1"),
245b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(189, "GBE1_LED2"),
246b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(190, "GBE2_LED0"),
247b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(191, "GBE2_LED1"),
248b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(192, "GBE2_LED2"),
249b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(193, "GBE3_LED0"),
250b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(194, "GBE3_LED1"),
251b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(195, "GBE3_LED2"),
252b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(196, "GBE0_I2C_CLK"),
253b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(197, "GBE0_I2C_DATA"),
254b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(198, "GBE1_I2C_CLK"),
255b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(199, "GBE1_I2C_DATA"),
256b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(200, "GBE2_I2C_CLK"),
257b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(201, "GBE2_I2C_DATA"),
258b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(202, "GBE3_I2C_CLK"),
259b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(203, "GBE3_I2C_DATA"),
260b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(204, "GBE4_I2C_CLK"),
261b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(205, "GBE4_I2C_DATA"),
262b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(206, "GBE_GPIO8"),
263b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(207, "GBE_GPIO9"),
264b4f2fcb5SAndy Shevchenko 	/* GPP_L */
265b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(208, "PM_SYNC_0"),
266b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(209, "PM_DOWN_0"),
267b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(210, "PM_SYNC_CLK_0"),
268b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(211, "GPP_L_3"),
269b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(212, "GPP_L_4"),
270b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(213, "GPP_L_5"),
271b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(214, "GPP_L_6"),
272b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(215, "GPP_L_7"),
273b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(216, "GPP_L_8"),
274b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(217, "NAC_GBE_GPIO0_S2N"),
275b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(218, "NAC_GBE_GPIO1_S2N"),
276b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(219, "NAC_GBE_GPIO2_S2N"),
277b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(220, "NAC_GBE_GPIO3_S2N"),
278b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(221, "NAC_GBE_SMB_DATA_IN"),
279b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(222, "NAC_GBE_SMB_DATA_OUT"),
280b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(223, "NAC_GBE_SMB_ALRT_N"),
281b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(224, "NAC_GBE_SMB_CLK_IN"),
282b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(225, "NAC_GBE_SMB_CLK_OUT"),
283b4f2fcb5SAndy Shevchenko 	/* GPP_M */
284b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(226, "GPP_M_0"),
285b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(227, "GPP_M_1"),
286b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(228, "GPP_M_2"),
287b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(229, "GPP_M_3"),
288b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(230, "NAC_WAKE_N"),
289b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(231, "GPP_M_5"),
290b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(232, "GPP_M_6"),
291b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(233, "GPP_M_7"),
292b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(234, "GPP_M_8"),
293b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(235, "NAC_SBLINK_S2N"),
294b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(236, "NAC_SBLINK_N2S"),
295b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(237, "NAC_SBLINK_CLK_N2S"),
296b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(238, "NAC_SBLINK_CLK_S2N"),
297b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(239, "NAC_XTAL_VALID"),
298b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(240, "NAC_RESET_NAC_N"),
299b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(241, "GPP_M_15"),
300b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(242, "GPP_M_16"),
301b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(243, "GPP_M_17"),
302b4f2fcb5SAndy Shevchenko 	/* GPP_N */
303b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(244, "GPP_N_0"),
304b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(245, "NAC_NCSI_TXD0"),
305b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(246, "GPP_N_2"),
306b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(247, "GPP_N_3"),
307b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(248, "NAC_NCSI_REFCLK_IN"),
308b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(249, "GPP_N_5"),
309b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(250, "GPP_N_6"),
310b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(251, "GPP_N_7"),
311b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(252, "NAC_NCSI_RXD0"),
312b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(253, "NAC_NCSI_RXD1"),
313b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(254, "NAC_NCSI_CRS_DV"),
314b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(255, "NAC_NCSI_CLK_IN"),
315b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(256, "NAC_NCSI_REFCLK_OUT"),
316b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(257, "NAC_NCSI_TX_EN"),
317b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(258, "NAC_NCSI_TXD1"),
318b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(259, "NAC_NCSI_OE_N"),
319b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(260, "NAC_GR_N"),
320b4f2fcb5SAndy Shevchenko 	PINCTRL_PIN(261, "NAC_INIT_SX_WAKE_N"),
321b4f2fcb5SAndy Shevchenko };
322b4f2fcb5SAndy Shevchenko 
323b4f2fcb5SAndy Shevchenko static const struct intel_padgroup ebg_community0_gpps[] = {
324b4f2fcb5SAndy Shevchenko 	EBG_GPP(0, 0, 20),	/* GPP_A */
325b4f2fcb5SAndy Shevchenko 	EBG_GPP(1, 21, 44),	/* GPP_B */
326b4f2fcb5SAndy Shevchenko 	EBG_GPP(2, 45, 65),	/* SPI */
327b4f2fcb5SAndy Shevchenko };
328b4f2fcb5SAndy Shevchenko 
329b4f2fcb5SAndy Shevchenko static const struct intel_padgroup ebg_community1_gpps[] = {
330b4f2fcb5SAndy Shevchenko 	EBG_GPP(0, 66, 87),	/* GPP_C */
331b4f2fcb5SAndy Shevchenko 	EBG_GPP(1, 88, 111),	/* GPP_D */
332b4f2fcb5SAndy Shevchenko };
333b4f2fcb5SAndy Shevchenko 
334b4f2fcb5SAndy Shevchenko static const struct intel_padgroup ebg_community3_gpps[] = {
335b4f2fcb5SAndy Shevchenko 	EBG_GPP(0, 112, 135),	/* GPP_E */
336b4f2fcb5SAndy Shevchenko 	EBG_GPP(1, 136, 145),	/* JTAG */
337b4f2fcb5SAndy Shevchenko };
338b4f2fcb5SAndy Shevchenko 
339b4f2fcb5SAndy Shevchenko static const struct intel_padgroup ebg_community4_gpps[] = {
340b4f2fcb5SAndy Shevchenko 	EBG_GPP(0, 146, 165),	/* GPP_H */
341b4f2fcb5SAndy Shevchenko 	EBG_GPP(1, 166, 183),	/* GPP_J */
342b4f2fcb5SAndy Shevchenko };
343b4f2fcb5SAndy Shevchenko 
344b4f2fcb5SAndy Shevchenko static const struct intel_padgroup ebg_community5_gpps[] = {
345b4f2fcb5SAndy Shevchenko 	EBG_GPP(0, 184, 207),	/* GPP_I */
346b4f2fcb5SAndy Shevchenko 	EBG_GPP(1, 208, 225),	/* GPP_L */
347b4f2fcb5SAndy Shevchenko 	EBG_GPP(2, 226, 243),	/* GPP_M */
348b4f2fcb5SAndy Shevchenko 	EBG_GPP(3, 244, 261),	/* GPP_N */
349b4f2fcb5SAndy Shevchenko };
350b4f2fcb5SAndy Shevchenko 
351b4f2fcb5SAndy Shevchenko static const struct intel_community ebg_communities[] = {
352b4f2fcb5SAndy Shevchenko 	EBG_COMMUNITY(0, 0, 65, ebg_community0_gpps),
353b4f2fcb5SAndy Shevchenko 	EBG_COMMUNITY(1, 66, 111, ebg_community1_gpps),
354b4f2fcb5SAndy Shevchenko 	EBG_COMMUNITY(2, 112, 145, ebg_community3_gpps),
355b4f2fcb5SAndy Shevchenko 	EBG_COMMUNITY(3, 146, 183, ebg_community4_gpps),
356b4f2fcb5SAndy Shevchenko 	EBG_COMMUNITY(4, 184, 261, ebg_community5_gpps),
357b4f2fcb5SAndy Shevchenko };
358b4f2fcb5SAndy Shevchenko 
359b4f2fcb5SAndy Shevchenko static const struct intel_pinctrl_soc_data ebg_soc_data = {
360b4f2fcb5SAndy Shevchenko 	.pins = ebg_pins,
361b4f2fcb5SAndy Shevchenko 	.npins = ARRAY_SIZE(ebg_pins),
362b4f2fcb5SAndy Shevchenko 	.communities = ebg_communities,
363b4f2fcb5SAndy Shevchenko 	.ncommunities = ARRAY_SIZE(ebg_communities),
364b4f2fcb5SAndy Shevchenko };
365b4f2fcb5SAndy Shevchenko 
366b4f2fcb5SAndy Shevchenko static const struct acpi_device_id ebg_pinctrl_acpi_match[] = {
367b4f2fcb5SAndy Shevchenko 	{ "INTC1071", (kernel_ulong_t)&ebg_soc_data },
368b4f2fcb5SAndy Shevchenko 	{ }
369b4f2fcb5SAndy Shevchenko };
370b4f2fcb5SAndy Shevchenko MODULE_DEVICE_TABLE(acpi, ebg_pinctrl_acpi_match);
371b4f2fcb5SAndy Shevchenko 
372b4f2fcb5SAndy Shevchenko static INTEL_PINCTRL_PM_OPS(ebg_pinctrl_pm_ops);
373b4f2fcb5SAndy Shevchenko 
374b4f2fcb5SAndy Shevchenko static struct platform_driver ebg_pinctrl_driver = {
375b4f2fcb5SAndy Shevchenko 	.probe = intel_pinctrl_probe_by_hid,
376b4f2fcb5SAndy Shevchenko 	.driver = {
377b4f2fcb5SAndy Shevchenko 		.name = "emmitsburg-pinctrl",
378b4f2fcb5SAndy Shevchenko 		.acpi_match_table = ebg_pinctrl_acpi_match,
379b4f2fcb5SAndy Shevchenko 		.pm = &ebg_pinctrl_pm_ops,
380b4f2fcb5SAndy Shevchenko 	},
381b4f2fcb5SAndy Shevchenko };
382b4f2fcb5SAndy Shevchenko 
383b4f2fcb5SAndy Shevchenko module_platform_driver(ebg_pinctrl_driver);
384b4f2fcb5SAndy Shevchenko 
385b4f2fcb5SAndy Shevchenko MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>");
386b4f2fcb5SAndy Shevchenko MODULE_DESCRIPTION("Intel Emmitsburg PCH pinctrl/GPIO driver");
387b4f2fcb5SAndy Shevchenko MODULE_LICENSE("GPL v2");
388