162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Intel Gemini Lake SoC pinctrl/GPIO driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2017 Intel Corporation
662306a36Sopenharmony_ci * Author: Mika Westerberg <mika.westerberg@linux.intel.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/mod_devicetable.h>
1062306a36Sopenharmony_ci#include <linux/module.h>
1162306a36Sopenharmony_ci#include <linux/platform_device.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#include "pinctrl-intel.h"
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define GLK_PAD_OWN	0x020
1862306a36Sopenharmony_ci#define GLK_PADCFGLOCK	0x080
1962306a36Sopenharmony_ci#define GLK_HOSTSW_OWN	0x0b0
2062306a36Sopenharmony_ci#define GLK_GPI_IS	0x100
2162306a36Sopenharmony_ci#define GLK_GPI_IE	0x110
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#define GLK_COMMUNITY(b, s, e)				\
2462306a36Sopenharmony_ci	INTEL_COMMUNITY_SIZE(b, s, e, 32, 4, GLK)
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* GLK */
2762306a36Sopenharmony_cistatic const struct pinctrl_pin_desc glk_northwest_pins[] = {
2862306a36Sopenharmony_ci	PINCTRL_PIN(0, "TCK"),
2962306a36Sopenharmony_ci	PINCTRL_PIN(1, "TRST_B"),
3062306a36Sopenharmony_ci	PINCTRL_PIN(2, "TMS"),
3162306a36Sopenharmony_ci	PINCTRL_PIN(3, "TDI"),
3262306a36Sopenharmony_ci	PINCTRL_PIN(4, "TDO"),
3362306a36Sopenharmony_ci	PINCTRL_PIN(5, "JTAGX"),
3462306a36Sopenharmony_ci	PINCTRL_PIN(6, "CX_PREQ_B"),
3562306a36Sopenharmony_ci	PINCTRL_PIN(7, "CX_PRDY_B"),
3662306a36Sopenharmony_ci	PINCTRL_PIN(8, "GPIO_8"),
3762306a36Sopenharmony_ci	PINCTRL_PIN(9, "GPIO_9"),
3862306a36Sopenharmony_ci	PINCTRL_PIN(10, "GPIO_10"),
3962306a36Sopenharmony_ci	PINCTRL_PIN(11, "GPIO_11"),
4062306a36Sopenharmony_ci	PINCTRL_PIN(12, "GPIO_12"),
4162306a36Sopenharmony_ci	PINCTRL_PIN(13, "GPIO_13"),
4262306a36Sopenharmony_ci	PINCTRL_PIN(14, "GPIO_14"),
4362306a36Sopenharmony_ci	PINCTRL_PIN(15, "GPIO_15"),
4462306a36Sopenharmony_ci	PINCTRL_PIN(16, "GPIO_16"),
4562306a36Sopenharmony_ci	PINCTRL_PIN(17, "GPIO_17"),
4662306a36Sopenharmony_ci	PINCTRL_PIN(18, "GPIO_18"),
4762306a36Sopenharmony_ci	PINCTRL_PIN(19, "GPIO_19"),
4862306a36Sopenharmony_ci	PINCTRL_PIN(20, "GPIO_20"),
4962306a36Sopenharmony_ci	PINCTRL_PIN(21, "GPIO_21"),
5062306a36Sopenharmony_ci	PINCTRL_PIN(22, "GPIO_22"),
5162306a36Sopenharmony_ci	PINCTRL_PIN(23, "GPIO_23"),
5262306a36Sopenharmony_ci	PINCTRL_PIN(24, "GPIO_24"),
5362306a36Sopenharmony_ci	PINCTRL_PIN(25, "GPIO_25"),
5462306a36Sopenharmony_ci	PINCTRL_PIN(26, "ISH_GPIO_0"),
5562306a36Sopenharmony_ci	PINCTRL_PIN(27, "ISH_GPIO_1"),
5662306a36Sopenharmony_ci	PINCTRL_PIN(28, "ISH_GPIO_2"),
5762306a36Sopenharmony_ci	PINCTRL_PIN(29, "ISH_GPIO_3"),
5862306a36Sopenharmony_ci	PINCTRL_PIN(30, "ISH_GPIO_4"),
5962306a36Sopenharmony_ci	PINCTRL_PIN(31, "ISH_GPIO_5"),
6062306a36Sopenharmony_ci	PINCTRL_PIN(32, "ISH_GPIO_6"),
6162306a36Sopenharmony_ci	PINCTRL_PIN(33, "ISH_GPIO_7"),
6262306a36Sopenharmony_ci	PINCTRL_PIN(34, "ISH_GPIO_8"),
6362306a36Sopenharmony_ci	PINCTRL_PIN(35, "ISH_GPIO_9"),
6462306a36Sopenharmony_ci	PINCTRL_PIN(36, "GPIO_36"),
6562306a36Sopenharmony_ci	PINCTRL_PIN(37, "GPIO_37"),
6662306a36Sopenharmony_ci	PINCTRL_PIN(38, "GPIO_38"),
6762306a36Sopenharmony_ci	PINCTRL_PIN(39, "GPIO_39"),
6862306a36Sopenharmony_ci	PINCTRL_PIN(40, "GPIO_40"),
6962306a36Sopenharmony_ci	PINCTRL_PIN(41, "GPIO_41"),
7062306a36Sopenharmony_ci	PINCTRL_PIN(42, "GP_INTD_DSI_TE1"),
7162306a36Sopenharmony_ci	PINCTRL_PIN(43, "GP_INTD_DSI_TE2"),
7262306a36Sopenharmony_ci	PINCTRL_PIN(44, "USB_OC0_B"),
7362306a36Sopenharmony_ci	PINCTRL_PIN(45, "USB_OC1_B"),
7462306a36Sopenharmony_ci	PINCTRL_PIN(46, "DSI_I2C_SDA"),
7562306a36Sopenharmony_ci	PINCTRL_PIN(47, "DSI_I2C_SCL"),
7662306a36Sopenharmony_ci	PINCTRL_PIN(48, "PMC_I2C_SDA"),
7762306a36Sopenharmony_ci	PINCTRL_PIN(49, "PMC_I2C_SCL"),
7862306a36Sopenharmony_ci	PINCTRL_PIN(50, "LPSS_I2C0_SDA"),
7962306a36Sopenharmony_ci	PINCTRL_PIN(51, "LPSS_I2C0_SCL"),
8062306a36Sopenharmony_ci	PINCTRL_PIN(52, "LPSS_I2C1_SDA"),
8162306a36Sopenharmony_ci	PINCTRL_PIN(53, "LPSS_I2C1_SCL"),
8262306a36Sopenharmony_ci	PINCTRL_PIN(54, "LPSS_I2C2_SDA"),
8362306a36Sopenharmony_ci	PINCTRL_PIN(55, "LPSS_I2C2_SCL"),
8462306a36Sopenharmony_ci	PINCTRL_PIN(56, "LPSS_I2C3_SDA"),
8562306a36Sopenharmony_ci	PINCTRL_PIN(57, "LPSS_I2C3_SCL"),
8662306a36Sopenharmony_ci	PINCTRL_PIN(58, "LPSS_I2C4_SDA"),
8762306a36Sopenharmony_ci	PINCTRL_PIN(59, "LPSS_I2C4_SCL"),
8862306a36Sopenharmony_ci	PINCTRL_PIN(60, "LPSS_UART0_RXD"),
8962306a36Sopenharmony_ci	PINCTRL_PIN(61, "LPSS_UART0_TXD"),
9062306a36Sopenharmony_ci	PINCTRL_PIN(62, "LPSS_UART0_RTS_B"),
9162306a36Sopenharmony_ci	PINCTRL_PIN(63, "LPSS_UART0_CTS_B"),
9262306a36Sopenharmony_ci	PINCTRL_PIN(64, "LPSS_UART2_RXD"),
9362306a36Sopenharmony_ci	PINCTRL_PIN(65, "LPSS_UART2_TXD"),
9462306a36Sopenharmony_ci	PINCTRL_PIN(66, "LPSS_UART2_RTS_B"),
9562306a36Sopenharmony_ci	PINCTRL_PIN(67, "LPSS_UART2_CTS_B"),
9662306a36Sopenharmony_ci	PINCTRL_PIN(68, "PMC_SPI_FS0"),
9762306a36Sopenharmony_ci	PINCTRL_PIN(69, "PMC_SPI_FS1"),
9862306a36Sopenharmony_ci	PINCTRL_PIN(70, "PMC_SPI_FS2"),
9962306a36Sopenharmony_ci	PINCTRL_PIN(71, "PMC_SPI_RXD"),
10062306a36Sopenharmony_ci	PINCTRL_PIN(72, "PMC_SPI_TXD"),
10162306a36Sopenharmony_ci	PINCTRL_PIN(73, "PMC_SPI_CLK"),
10262306a36Sopenharmony_ci	PINCTRL_PIN(74, "THERMTRIP_B"),
10362306a36Sopenharmony_ci	PINCTRL_PIN(75, "PROCHOT_B"),
10462306a36Sopenharmony_ci	PINCTRL_PIN(76, "EMMC_RST_B"),
10562306a36Sopenharmony_ci	PINCTRL_PIN(77, "GPIO_212"),
10662306a36Sopenharmony_ci	PINCTRL_PIN(78, "GPIO_213"),
10762306a36Sopenharmony_ci	PINCTRL_PIN(79, "GPIO_214"),
10862306a36Sopenharmony_ci};
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_cistatic const unsigned int glk_northwest_uart1_pins[] = { 26, 27, 28, 29 };
11162306a36Sopenharmony_cistatic const unsigned int glk_northwest_pwm0_pins[] = { 42 };
11262306a36Sopenharmony_cistatic const unsigned int glk_northwest_pwm1_pins[] = { 43 };
11362306a36Sopenharmony_cistatic const unsigned int glk_northwest_pwm2_pins[] = { 44 };
11462306a36Sopenharmony_cistatic const unsigned int glk_northwest_pwm3_pins[] = { 45 };
11562306a36Sopenharmony_cistatic const unsigned int glk_northwest_i2c0_pins[] = { 50, 51 };
11662306a36Sopenharmony_cistatic const unsigned int glk_northwest_i2c1_pins[] = { 52, 53 };
11762306a36Sopenharmony_cistatic const unsigned int glk_northwest_i2c2_pins[] = { 54, 55 };
11862306a36Sopenharmony_cistatic const unsigned int glk_northwest_i2c3_pins[] = { 56, 57 };
11962306a36Sopenharmony_cistatic const unsigned int glk_northwest_i2c4_pins[] = { 58, 59 };
12062306a36Sopenharmony_cistatic const unsigned int glk_northwest_uart0_pins[] = { 60, 61, 62, 63 };
12162306a36Sopenharmony_cistatic const unsigned int glk_northwest_uart2_pins[] = { 64, 65, 66, 67 };
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_cistatic const struct intel_pingroup glk_northwest_groups[] = {
12462306a36Sopenharmony_ci	PIN_GROUP("uart1_grp", glk_northwest_uart1_pins, 2),
12562306a36Sopenharmony_ci	PIN_GROUP("pwm0_grp", glk_northwest_pwm0_pins, 2),
12662306a36Sopenharmony_ci	PIN_GROUP("pwm1_grp", glk_northwest_pwm1_pins, 2),
12762306a36Sopenharmony_ci	PIN_GROUP("pwm2_grp", glk_northwest_pwm2_pins, 2),
12862306a36Sopenharmony_ci	PIN_GROUP("pwm3_grp", glk_northwest_pwm3_pins, 2),
12962306a36Sopenharmony_ci	PIN_GROUP("i2c0_grp", glk_northwest_i2c0_pins, 1),
13062306a36Sopenharmony_ci	PIN_GROUP("i2c1_grp", glk_northwest_i2c1_pins, 1),
13162306a36Sopenharmony_ci	PIN_GROUP("i2c2_grp", glk_northwest_i2c2_pins, 1),
13262306a36Sopenharmony_ci	PIN_GROUP("i2c3_grp", glk_northwest_i2c3_pins, 1),
13362306a36Sopenharmony_ci	PIN_GROUP("i2c4_grp", glk_northwest_i2c4_pins, 1),
13462306a36Sopenharmony_ci	PIN_GROUP("uart0_grp", glk_northwest_uart0_pins, 1),
13562306a36Sopenharmony_ci	PIN_GROUP("uart2_grp", glk_northwest_uart2_pins, 1),
13662306a36Sopenharmony_ci};
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_cistatic const char * const glk_northwest_uart1_groups[] = { "uart1_grp" };
13962306a36Sopenharmony_cistatic const char * const glk_northwest_pwm0_groups[] = { "pwm0_grp" };
14062306a36Sopenharmony_cistatic const char * const glk_northwest_pwm1_groups[] = { "pwm1_grp" };
14162306a36Sopenharmony_cistatic const char * const glk_northwest_pwm2_groups[] = { "pwm2_grp" };
14262306a36Sopenharmony_cistatic const char * const glk_northwest_pwm3_groups[] = { "pwm3_grp" };
14362306a36Sopenharmony_cistatic const char * const glk_northwest_i2c0_groups[] = { "i2c0_grp" };
14462306a36Sopenharmony_cistatic const char * const glk_northwest_i2c1_groups[] = { "i2c1_grp" };
14562306a36Sopenharmony_cistatic const char * const glk_northwest_i2c2_groups[] = { "i2c2_grp" };
14662306a36Sopenharmony_cistatic const char * const glk_northwest_i2c3_groups[] = { "i2c3_grp" };
14762306a36Sopenharmony_cistatic const char * const glk_northwest_i2c4_groups[] = { "i2c4_grp" };
14862306a36Sopenharmony_cistatic const char * const glk_northwest_uart0_groups[] = { "uart0_grp" };
14962306a36Sopenharmony_cistatic const char * const glk_northwest_uart2_groups[] = { "uart2_grp" };
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_cistatic const struct intel_function glk_northwest_functions[] = {
15262306a36Sopenharmony_ci	FUNCTION("uart1", glk_northwest_uart1_groups),
15362306a36Sopenharmony_ci	FUNCTION("pmw0", glk_northwest_pwm0_groups),
15462306a36Sopenharmony_ci	FUNCTION("pmw1", glk_northwest_pwm1_groups),
15562306a36Sopenharmony_ci	FUNCTION("pmw2", glk_northwest_pwm2_groups),
15662306a36Sopenharmony_ci	FUNCTION("pmw3", glk_northwest_pwm3_groups),
15762306a36Sopenharmony_ci	FUNCTION("i2c0", glk_northwest_i2c0_groups),
15862306a36Sopenharmony_ci	FUNCTION("i2c1", glk_northwest_i2c1_groups),
15962306a36Sopenharmony_ci	FUNCTION("i2c2", glk_northwest_i2c2_groups),
16062306a36Sopenharmony_ci	FUNCTION("i2c3", glk_northwest_i2c3_groups),
16162306a36Sopenharmony_ci	FUNCTION("i2c4", glk_northwest_i2c4_groups),
16262306a36Sopenharmony_ci	FUNCTION("uart0", glk_northwest_uart0_groups),
16362306a36Sopenharmony_ci	FUNCTION("uart2", glk_northwest_uart2_groups),
16462306a36Sopenharmony_ci};
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_cistatic const struct intel_community glk_northwest_communities[] = {
16762306a36Sopenharmony_ci	GLK_COMMUNITY(0, 0, 79),
16862306a36Sopenharmony_ci};
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_cistatic const struct intel_pinctrl_soc_data glk_northwest_soc_data = {
17162306a36Sopenharmony_ci	.uid = "1",
17262306a36Sopenharmony_ci	.pins = glk_northwest_pins,
17362306a36Sopenharmony_ci	.npins = ARRAY_SIZE(glk_northwest_pins),
17462306a36Sopenharmony_ci	.groups = glk_northwest_groups,
17562306a36Sopenharmony_ci	.ngroups = ARRAY_SIZE(glk_northwest_groups),
17662306a36Sopenharmony_ci	.functions = glk_northwest_functions,
17762306a36Sopenharmony_ci	.nfunctions = ARRAY_SIZE(glk_northwest_functions),
17862306a36Sopenharmony_ci	.communities = glk_northwest_communities,
17962306a36Sopenharmony_ci	.ncommunities = ARRAY_SIZE(glk_northwest_communities),
18062306a36Sopenharmony_ci};
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_cistatic const struct pinctrl_pin_desc glk_north_pins[] = {
18362306a36Sopenharmony_ci	PINCTRL_PIN(0, "SVID0_ALERT_B"),
18462306a36Sopenharmony_ci	PINCTRL_PIN(1, "SVID0_DATA"),
18562306a36Sopenharmony_ci	PINCTRL_PIN(2, "SVID0_CLK"),
18662306a36Sopenharmony_ci	PINCTRL_PIN(3, "LPSS_SPI_0_CLK"),
18762306a36Sopenharmony_ci	PINCTRL_PIN(4, "LPSS_SPI_0_FS0"),
18862306a36Sopenharmony_ci	PINCTRL_PIN(5, "LPSS_SPI_0_FS1"),
18962306a36Sopenharmony_ci	PINCTRL_PIN(6, "LPSS_SPI_0_RXD"),
19062306a36Sopenharmony_ci	PINCTRL_PIN(7, "LPSS_SPI_0_TXD"),
19162306a36Sopenharmony_ci	PINCTRL_PIN(8, "LPSS_SPI_2_CLK"),
19262306a36Sopenharmony_ci	PINCTRL_PIN(9, "LPSS_SPI_2_FS0"),
19362306a36Sopenharmony_ci	PINCTRL_PIN(10, "LPSS_SPI_2_FS1"),
19462306a36Sopenharmony_ci	PINCTRL_PIN(11, "LPSS_SPI_2_FS2"),
19562306a36Sopenharmony_ci	PINCTRL_PIN(12, "LPSS_SPI_2_RXD"),
19662306a36Sopenharmony_ci	PINCTRL_PIN(13, "LPSS_SPI_2_TXD"),
19762306a36Sopenharmony_ci	PINCTRL_PIN(14, "FST_SPI_CS0_B"),
19862306a36Sopenharmony_ci	PINCTRL_PIN(15, "FST_SPI_CS1_B"),
19962306a36Sopenharmony_ci	PINCTRL_PIN(16, "FST_SPI_MOSI_IO0"),
20062306a36Sopenharmony_ci	PINCTRL_PIN(17, "FST_SPI_MISO_IO1"),
20162306a36Sopenharmony_ci	PINCTRL_PIN(18, "FST_SPI_IO2"),
20262306a36Sopenharmony_ci	PINCTRL_PIN(19, "FST_SPI_IO3"),
20362306a36Sopenharmony_ci	PINCTRL_PIN(20, "FST_SPI_CLK"),
20462306a36Sopenharmony_ci	PINCTRL_PIN(21, "FST_SPI_CLK_FB"),
20562306a36Sopenharmony_ci	PINCTRL_PIN(22, "PMU_PLTRST_B"),
20662306a36Sopenharmony_ci	PINCTRL_PIN(23, "PMU_PWRBTN_B"),
20762306a36Sopenharmony_ci	PINCTRL_PIN(24, "PMU_SLP_S0_B"),
20862306a36Sopenharmony_ci	PINCTRL_PIN(25, "PMU_SLP_S3_B"),
20962306a36Sopenharmony_ci	PINCTRL_PIN(26, "PMU_SLP_S4_B"),
21062306a36Sopenharmony_ci	PINCTRL_PIN(27, "SUSPWRDNACK"),
21162306a36Sopenharmony_ci	PINCTRL_PIN(28, "EMMC_DNX_PWR_EN_B"),
21262306a36Sopenharmony_ci	PINCTRL_PIN(29, "GPIO_105"),
21362306a36Sopenharmony_ci	PINCTRL_PIN(30, "PMU_BATLOW_B"),
21462306a36Sopenharmony_ci	PINCTRL_PIN(31, "PMU_RESETBUTTON_B"),
21562306a36Sopenharmony_ci	PINCTRL_PIN(32, "PMU_SUSCLK"),
21662306a36Sopenharmony_ci	PINCTRL_PIN(33, "SUS_STAT_B"),
21762306a36Sopenharmony_ci	PINCTRL_PIN(34, "LPSS_I2C5_SDA"),
21862306a36Sopenharmony_ci	PINCTRL_PIN(35, "LPSS_I2C5_SCL"),
21962306a36Sopenharmony_ci	PINCTRL_PIN(36, "LPSS_I2C6_SDA"),
22062306a36Sopenharmony_ci	PINCTRL_PIN(37, "LPSS_I2C6_SCL"),
22162306a36Sopenharmony_ci	PINCTRL_PIN(38, "LPSS_I2C7_SDA"),
22262306a36Sopenharmony_ci	PINCTRL_PIN(39, "LPSS_I2C7_SCL"),
22362306a36Sopenharmony_ci	PINCTRL_PIN(40, "PCIE_WAKE0_B"),
22462306a36Sopenharmony_ci	PINCTRL_PIN(41, "PCIE_WAKE1_B"),
22562306a36Sopenharmony_ci	PINCTRL_PIN(42, "PCIE_WAKE2_B"),
22662306a36Sopenharmony_ci	PINCTRL_PIN(43, "PCIE_WAKE3_B"),
22762306a36Sopenharmony_ci	PINCTRL_PIN(44, "PCIE_CLKREQ0_B"),
22862306a36Sopenharmony_ci	PINCTRL_PIN(45, "PCIE_CLKREQ1_B"),
22962306a36Sopenharmony_ci	PINCTRL_PIN(46, "PCIE_CLKREQ2_B"),
23062306a36Sopenharmony_ci	PINCTRL_PIN(47, "PCIE_CLKREQ3_B"),
23162306a36Sopenharmony_ci	PINCTRL_PIN(48, "HV_DDI0_DDC_SDA"),
23262306a36Sopenharmony_ci	PINCTRL_PIN(49, "HV_DDI0_DDC_SCL"),
23362306a36Sopenharmony_ci	PINCTRL_PIN(50, "HV_DDI1_DDC_SDA"),
23462306a36Sopenharmony_ci	PINCTRL_PIN(51, "HV_DDI1_DDC_SCL"),
23562306a36Sopenharmony_ci	PINCTRL_PIN(52, "PANEL0_VDDEN"),
23662306a36Sopenharmony_ci	PINCTRL_PIN(53, "PANEL0_BKLTEN"),
23762306a36Sopenharmony_ci	PINCTRL_PIN(54, "PANEL0_BKLTCTL"),
23862306a36Sopenharmony_ci	PINCTRL_PIN(55, "HV_DDI0_HPD"),
23962306a36Sopenharmony_ci	PINCTRL_PIN(56, "HV_DDI1_HPD"),
24062306a36Sopenharmony_ci	PINCTRL_PIN(57, "HV_EDP_HPD"),
24162306a36Sopenharmony_ci	PINCTRL_PIN(58, "GPIO_134"),
24262306a36Sopenharmony_ci	PINCTRL_PIN(59, "GPIO_135"),
24362306a36Sopenharmony_ci	PINCTRL_PIN(60, "GPIO_136"),
24462306a36Sopenharmony_ci	PINCTRL_PIN(61, "GPIO_137"),
24562306a36Sopenharmony_ci	PINCTRL_PIN(62, "GPIO_138"),
24662306a36Sopenharmony_ci	PINCTRL_PIN(63, "GPIO_139"),
24762306a36Sopenharmony_ci	PINCTRL_PIN(64, "GPIO_140"),
24862306a36Sopenharmony_ci	PINCTRL_PIN(65, "GPIO_141"),
24962306a36Sopenharmony_ci	PINCTRL_PIN(66, "GPIO_142"),
25062306a36Sopenharmony_ci	PINCTRL_PIN(67, "GPIO_143"),
25162306a36Sopenharmony_ci	PINCTRL_PIN(68, "GPIO_144"),
25262306a36Sopenharmony_ci	PINCTRL_PIN(69, "GPIO_145"),
25362306a36Sopenharmony_ci	PINCTRL_PIN(70, "GPIO_146"),
25462306a36Sopenharmony_ci	PINCTRL_PIN(71, "LPC_ILB_SERIRQ"),
25562306a36Sopenharmony_ci	PINCTRL_PIN(72, "LPC_CLKOUT0"),
25662306a36Sopenharmony_ci	PINCTRL_PIN(73, "LPC_CLKOUT1"),
25762306a36Sopenharmony_ci	PINCTRL_PIN(74, "LPC_AD0"),
25862306a36Sopenharmony_ci	PINCTRL_PIN(75, "LPC_AD1"),
25962306a36Sopenharmony_ci	PINCTRL_PIN(76, "LPC_AD2"),
26062306a36Sopenharmony_ci	PINCTRL_PIN(77, "LPC_AD3"),
26162306a36Sopenharmony_ci	PINCTRL_PIN(78, "LPC_CLKRUNB"),
26262306a36Sopenharmony_ci	PINCTRL_PIN(79, "LPC_FRAMEB"),
26362306a36Sopenharmony_ci};
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_cistatic const unsigned int glk_north_spi0_pins[] = { 3, 4, 5, 6, 7 };
26662306a36Sopenharmony_cistatic const unsigned int glk_north_spi1_pins[] = { 8, 9, 10, 11, 12, 13 };
26762306a36Sopenharmony_cistatic const unsigned int glk_north_i2c5_pins[] = { 34, 35 };
26862306a36Sopenharmony_cistatic const unsigned int glk_north_i2c6_pins[] = { 36, 37 };
26962306a36Sopenharmony_cistatic const unsigned int glk_north_i2c7_pins[] = { 38, 39 };
27062306a36Sopenharmony_cistatic const unsigned int glk_north_uart0_pins[] = { 62, 63, 64, 65 };
27162306a36Sopenharmony_cistatic const unsigned int glk_north_spi0b_pins[] = { 66, 67, 68, 69, 70 };
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_cistatic const struct intel_pingroup glk_north_groups[] = {
27462306a36Sopenharmony_ci	PIN_GROUP("spi0_grp", glk_north_spi0_pins, 1),
27562306a36Sopenharmony_ci	PIN_GROUP("spi1_grp", glk_north_spi1_pins, 1),
27662306a36Sopenharmony_ci	PIN_GROUP("i2c5_grp", glk_north_i2c5_pins, 1),
27762306a36Sopenharmony_ci	PIN_GROUP("i2c6_grp", glk_north_i2c6_pins, 1),
27862306a36Sopenharmony_ci	PIN_GROUP("i2c7_grp", glk_north_i2c7_pins, 1),
27962306a36Sopenharmony_ci	PIN_GROUP("uart0_grp", glk_north_uart0_pins, 2),
28062306a36Sopenharmony_ci	PIN_GROUP("spi0b_grp", glk_north_spi0b_pins, 2),
28162306a36Sopenharmony_ci};
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_cistatic const char * const glk_north_spi0_groups[] = { "spi0_grp", "spi0b_grp" };
28462306a36Sopenharmony_cistatic const char * const glk_north_spi1_groups[] = { "spi1_grp" };
28562306a36Sopenharmony_cistatic const char * const glk_north_i2c5_groups[] = { "i2c5_grp" };
28662306a36Sopenharmony_cistatic const char * const glk_north_i2c6_groups[] = { "i2c6_grp" };
28762306a36Sopenharmony_cistatic const char * const glk_north_i2c7_groups[] = { "i2c7_grp" };
28862306a36Sopenharmony_cistatic const char * const glk_north_uart0_groups[] = { "uart0_grp" };
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_cistatic const struct intel_function glk_north_functions[] = {
29162306a36Sopenharmony_ci	FUNCTION("spi0", glk_north_spi0_groups),
29262306a36Sopenharmony_ci	FUNCTION("spi1", glk_north_spi1_groups),
29362306a36Sopenharmony_ci	FUNCTION("i2c5", glk_north_i2c5_groups),
29462306a36Sopenharmony_ci	FUNCTION("i2c6", glk_north_i2c6_groups),
29562306a36Sopenharmony_ci	FUNCTION("i2c7", glk_north_i2c7_groups),
29662306a36Sopenharmony_ci	FUNCTION("uart0", glk_north_uart0_groups),
29762306a36Sopenharmony_ci};
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_cistatic const struct intel_community glk_north_communities[] = {
30062306a36Sopenharmony_ci	GLK_COMMUNITY(0, 0, 79),
30162306a36Sopenharmony_ci};
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_cistatic const struct intel_pinctrl_soc_data glk_north_soc_data = {
30462306a36Sopenharmony_ci	.uid = "2",
30562306a36Sopenharmony_ci	.pins = glk_north_pins,
30662306a36Sopenharmony_ci	.npins = ARRAY_SIZE(glk_north_pins),
30762306a36Sopenharmony_ci	.groups = glk_north_groups,
30862306a36Sopenharmony_ci	.ngroups = ARRAY_SIZE(glk_north_groups),
30962306a36Sopenharmony_ci	.functions = glk_north_functions,
31062306a36Sopenharmony_ci	.nfunctions = ARRAY_SIZE(glk_north_functions),
31162306a36Sopenharmony_ci	.communities = glk_north_communities,
31262306a36Sopenharmony_ci	.ncommunities = ARRAY_SIZE(glk_north_communities),
31362306a36Sopenharmony_ci};
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_cistatic const struct pinctrl_pin_desc glk_audio_pins[] = {
31662306a36Sopenharmony_ci	PINCTRL_PIN(0, "AVS_I2S0_MCLK"),
31762306a36Sopenharmony_ci	PINCTRL_PIN(1, "AVS_I2S0_BCLK"),
31862306a36Sopenharmony_ci	PINCTRL_PIN(2, "AVS_I2S0_WS_SYNC"),
31962306a36Sopenharmony_ci	PINCTRL_PIN(3, "AVS_I2S0_SDI"),
32062306a36Sopenharmony_ci	PINCTRL_PIN(4, "AVS_I2S0_SDO"),
32162306a36Sopenharmony_ci	PINCTRL_PIN(5, "AVS_I2S1_MCLK"),
32262306a36Sopenharmony_ci	PINCTRL_PIN(6, "AVS_I2S1_BCLK"),
32362306a36Sopenharmony_ci	PINCTRL_PIN(7, "AVS_I2S1_WS_SYNC"),
32462306a36Sopenharmony_ci	PINCTRL_PIN(8, "AVS_I2S1_SDI"),
32562306a36Sopenharmony_ci	PINCTRL_PIN(9, "AVS_I2S1_SDO"),
32662306a36Sopenharmony_ci	PINCTRL_PIN(10, "AVS_HDA_BCLK"),
32762306a36Sopenharmony_ci	PINCTRL_PIN(11, "AVS_HDA_WS_SYNC"),
32862306a36Sopenharmony_ci	PINCTRL_PIN(12, "AVS_HDA_SDI"),
32962306a36Sopenharmony_ci	PINCTRL_PIN(13, "AVS_HDA_SDO"),
33062306a36Sopenharmony_ci	PINCTRL_PIN(14, "AVS_HDA_RSTB"),
33162306a36Sopenharmony_ci	PINCTRL_PIN(15, "AVS_M_CLK_A1"),
33262306a36Sopenharmony_ci	PINCTRL_PIN(16, "AVS_M_CLK_B1"),
33362306a36Sopenharmony_ci	PINCTRL_PIN(17, "AVS_M_DATA_1"),
33462306a36Sopenharmony_ci	PINCTRL_PIN(18, "AVS_M_CLK_AB2"),
33562306a36Sopenharmony_ci	PINCTRL_PIN(19, "AVS_M_DATA_2"),
33662306a36Sopenharmony_ci};
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_cistatic const struct intel_community glk_audio_communities[] = {
33962306a36Sopenharmony_ci	GLK_COMMUNITY(0, 0, 19),
34062306a36Sopenharmony_ci};
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_cistatic const struct intel_pinctrl_soc_data glk_audio_soc_data = {
34362306a36Sopenharmony_ci	.uid = "3",
34462306a36Sopenharmony_ci	.pins = glk_audio_pins,
34562306a36Sopenharmony_ci	.npins = ARRAY_SIZE(glk_audio_pins),
34662306a36Sopenharmony_ci	.communities = glk_audio_communities,
34762306a36Sopenharmony_ci	.ncommunities = ARRAY_SIZE(glk_audio_communities),
34862306a36Sopenharmony_ci};
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_cistatic const struct pinctrl_pin_desc glk_scc_pins[] = {
35162306a36Sopenharmony_ci	PINCTRL_PIN(0, "SMB_ALERTB"),
35262306a36Sopenharmony_ci	PINCTRL_PIN(1, "SMB_CLK"),
35362306a36Sopenharmony_ci	PINCTRL_PIN(2, "SMB_DATA"),
35462306a36Sopenharmony_ci	PINCTRL_PIN(3, "SDCARD_LVL_WP"),
35562306a36Sopenharmony_ci	PINCTRL_PIN(4, "SDCARD_CLK"),
35662306a36Sopenharmony_ci	PINCTRL_PIN(5, "SDCARD_CLK_FB"),
35762306a36Sopenharmony_ci	PINCTRL_PIN(6, "SDCARD_D0"),
35862306a36Sopenharmony_ci	PINCTRL_PIN(7, "SDCARD_D1"),
35962306a36Sopenharmony_ci	PINCTRL_PIN(8, "SDCARD_D2"),
36062306a36Sopenharmony_ci	PINCTRL_PIN(9, "SDCARD_D3"),
36162306a36Sopenharmony_ci	PINCTRL_PIN(10, "SDCARD_CMD"),
36262306a36Sopenharmony_ci	PINCTRL_PIN(11, "SDCARD_CD_B"),
36362306a36Sopenharmony_ci	PINCTRL_PIN(12, "SDCARD_PWR_DOWN_B"),
36462306a36Sopenharmony_ci	PINCTRL_PIN(13, "GPIO_210"),
36562306a36Sopenharmony_ci	PINCTRL_PIN(14, "OSC_CLK_OUT_0"),
36662306a36Sopenharmony_ci	PINCTRL_PIN(15, "OSC_CLK_OUT_1"),
36762306a36Sopenharmony_ci	PINCTRL_PIN(16, "CNV_BRI_DT"),
36862306a36Sopenharmony_ci	PINCTRL_PIN(17, "CNV_BRI_RSP"),
36962306a36Sopenharmony_ci	PINCTRL_PIN(18, "CNV_RGI_DT"),
37062306a36Sopenharmony_ci	PINCTRL_PIN(19, "CNV_RGI_RSP"),
37162306a36Sopenharmony_ci	PINCTRL_PIN(20, "CNV_RF_RESET_B"),
37262306a36Sopenharmony_ci	PINCTRL_PIN(21, "XTAL_CLKREQ"),
37362306a36Sopenharmony_ci	PINCTRL_PIN(22, "SDIO_CLK_FB"),
37462306a36Sopenharmony_ci	PINCTRL_PIN(23, "EMMC0_CLK"),
37562306a36Sopenharmony_ci	PINCTRL_PIN(24, "EMMC0_CLK_FB"),
37662306a36Sopenharmony_ci	PINCTRL_PIN(25, "EMMC0_D0"),
37762306a36Sopenharmony_ci	PINCTRL_PIN(26, "EMMC0_D1"),
37862306a36Sopenharmony_ci	PINCTRL_PIN(27, "EMMC0_D2"),
37962306a36Sopenharmony_ci	PINCTRL_PIN(28, "EMMC0_D3"),
38062306a36Sopenharmony_ci	PINCTRL_PIN(29, "EMMC0_D4"),
38162306a36Sopenharmony_ci	PINCTRL_PIN(30, "EMMC0_D5"),
38262306a36Sopenharmony_ci	PINCTRL_PIN(31, "EMMC0_D6"),
38362306a36Sopenharmony_ci	PINCTRL_PIN(32, "EMMC0_D7"),
38462306a36Sopenharmony_ci	PINCTRL_PIN(33, "EMMC0_CMD"),
38562306a36Sopenharmony_ci	PINCTRL_PIN(34, "EMMC0_STROBE"),
38662306a36Sopenharmony_ci};
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_cistatic const unsigned int glk_scc_i2c7_pins[] = { 1, 2 };
38962306a36Sopenharmony_cistatic const unsigned int glk_scc_sdcard_pins[] = {
39062306a36Sopenharmony_ci	3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
39162306a36Sopenharmony_ci};
39262306a36Sopenharmony_cistatic const unsigned int glk_scc_sdio_pins[] = { 16, 17, 18, 19, 20, 21, 22 };
39362306a36Sopenharmony_cistatic const unsigned int glk_scc_uart1_pins[] = { 16, 17, 18, 19 };
39462306a36Sopenharmony_cistatic const unsigned int glk_scc_emmc_pins[] = {
39562306a36Sopenharmony_ci	23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
39662306a36Sopenharmony_ci};
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_cistatic const struct intel_pingroup glk_scc_groups[] = {
39962306a36Sopenharmony_ci	PIN_GROUP("i2c7_grp", glk_scc_i2c7_pins, 2),
40062306a36Sopenharmony_ci	PIN_GROUP("sdcard_grp", glk_scc_sdcard_pins, 1),
40162306a36Sopenharmony_ci	PIN_GROUP("sdio_grp", glk_scc_sdio_pins, 2),
40262306a36Sopenharmony_ci	PIN_GROUP("uart1_grp", glk_scc_uart1_pins, 3),
40362306a36Sopenharmony_ci	PIN_GROUP("emmc_grp", glk_scc_emmc_pins, 1),
40462306a36Sopenharmony_ci};
40562306a36Sopenharmony_ci
40662306a36Sopenharmony_cistatic const char * const glk_scc_i2c7_groups[] = { "i2c7_grp" };
40762306a36Sopenharmony_cistatic const char * const glk_scc_sdcard_groups[] = { "sdcard_grp" };
40862306a36Sopenharmony_cistatic const char * const glk_scc_sdio_groups[] = { "sdio_grp" };
40962306a36Sopenharmony_cistatic const char * const glk_scc_uart1_groups[] = { "uart1_grp" };
41062306a36Sopenharmony_cistatic const char * const glk_scc_emmc_groups[] = { "emmc_grp" };
41162306a36Sopenharmony_ci
41262306a36Sopenharmony_cistatic const struct intel_function glk_scc_functions[] = {
41362306a36Sopenharmony_ci	FUNCTION("i2c7", glk_scc_i2c7_groups),
41462306a36Sopenharmony_ci	FUNCTION("sdcard", glk_scc_sdcard_groups),
41562306a36Sopenharmony_ci	FUNCTION("sdio", glk_scc_sdio_groups),
41662306a36Sopenharmony_ci	FUNCTION("uart1", glk_scc_uart1_groups),
41762306a36Sopenharmony_ci	FUNCTION("emmc", glk_scc_emmc_groups),
41862306a36Sopenharmony_ci};
41962306a36Sopenharmony_ci
42062306a36Sopenharmony_cistatic const struct intel_community glk_scc_communities[] = {
42162306a36Sopenharmony_ci	GLK_COMMUNITY(0, 0, 34),
42262306a36Sopenharmony_ci};
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_cistatic const struct intel_pinctrl_soc_data glk_scc_soc_data = {
42562306a36Sopenharmony_ci	.uid = "4",
42662306a36Sopenharmony_ci	.pins = glk_scc_pins,
42762306a36Sopenharmony_ci	.npins = ARRAY_SIZE(glk_scc_pins),
42862306a36Sopenharmony_ci	.groups = glk_scc_groups,
42962306a36Sopenharmony_ci	.ngroups = ARRAY_SIZE(glk_scc_groups),
43062306a36Sopenharmony_ci	.functions = glk_scc_functions,
43162306a36Sopenharmony_ci	.nfunctions = ARRAY_SIZE(glk_scc_functions),
43262306a36Sopenharmony_ci	.communities = glk_scc_communities,
43362306a36Sopenharmony_ci	.ncommunities = ARRAY_SIZE(glk_scc_communities),
43462306a36Sopenharmony_ci};
43562306a36Sopenharmony_ci
43662306a36Sopenharmony_cistatic const struct intel_pinctrl_soc_data *glk_pinctrl_soc_data[] = {
43762306a36Sopenharmony_ci	&glk_northwest_soc_data,
43862306a36Sopenharmony_ci	&glk_north_soc_data,
43962306a36Sopenharmony_ci	&glk_audio_soc_data,
44062306a36Sopenharmony_ci	&glk_scc_soc_data,
44162306a36Sopenharmony_ci	NULL
44262306a36Sopenharmony_ci};
44362306a36Sopenharmony_ci
44462306a36Sopenharmony_cistatic const struct acpi_device_id glk_pinctrl_acpi_match[] = {
44562306a36Sopenharmony_ci	{ "INT3453", (kernel_ulong_t)glk_pinctrl_soc_data },
44662306a36Sopenharmony_ci	{ }
44762306a36Sopenharmony_ci};
44862306a36Sopenharmony_ciMODULE_DEVICE_TABLE(acpi, glk_pinctrl_acpi_match);
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_cistatic INTEL_PINCTRL_PM_OPS(glk_pinctrl_pm_ops);
45162306a36Sopenharmony_ci
45262306a36Sopenharmony_cistatic struct platform_driver glk_pinctrl_driver = {
45362306a36Sopenharmony_ci	.probe = intel_pinctrl_probe_by_uid,
45462306a36Sopenharmony_ci	.driver = {
45562306a36Sopenharmony_ci		.name = "geminilake-pinctrl",
45662306a36Sopenharmony_ci		.acpi_match_table = glk_pinctrl_acpi_match,
45762306a36Sopenharmony_ci		.pm = &glk_pinctrl_pm_ops,
45862306a36Sopenharmony_ci	},
45962306a36Sopenharmony_ci};
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_cistatic int __init glk_pinctrl_init(void)
46262306a36Sopenharmony_ci{
46362306a36Sopenharmony_ci	return platform_driver_register(&glk_pinctrl_driver);
46462306a36Sopenharmony_ci}
46562306a36Sopenharmony_cisubsys_initcall(glk_pinctrl_init);
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_cistatic void __exit glk_pinctrl_exit(void)
46862306a36Sopenharmony_ci{
46962306a36Sopenharmony_ci	platform_driver_unregister(&glk_pinctrl_driver);
47062306a36Sopenharmony_ci}
47162306a36Sopenharmony_cimodule_exit(glk_pinctrl_exit);
47262306a36Sopenharmony_ci
47362306a36Sopenharmony_ciMODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
47462306a36Sopenharmony_ciMODULE_DESCRIPTION("Intel Gemini Lake SoC pinctrl/GPIO driver");
47562306a36Sopenharmony_ciMODULE_LICENSE("GPL v2");
47662306a36Sopenharmony_ciMODULE_IMPORT_NS(PINCTRL_INTEL);
477