coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gpio.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <soc/gpio.h>
4 
5 /* South East Community */
6 static const struct soc_gpio_map gpse_gpio_map[] = {
7  GPIO_NC, /* 00 MF_PLT_CLK0 */
8  GPIO_NC, /* 01 PWM1 */
9  GPIO_NC, /* 02 MF_PLT_CLK1 */
10  GPIO_NC, /* 03 MF_PLT_CLK4 */
11  GPIO_NC, /* 04 MF_PLT_CLK3 */
12  GPIO_NC, /* 05 PWM0*/
13  GPIO_NC, /* 06 MF_PLT_CLK5 */
14  GPIO_NC, /* 07 MF_PLT_CLK2 */
15  GPIO_NC, /* 15 SDMMC2_D3_CD_B */
16  GPIO_NC, /* 16 SDMMC1_CLK */
17  GPIO_NC, /* 17 SDMMC1_D0 */
18  GPIO_NC, /* 18 SDMMC2_D1 */
19  GPIO_NC, /* 19 SDMMC2_CLK */
20  GPIO_NC, /* 20 SDMMC1_D2 */
21  GPIO_NC, /* 21 SDMMC2_D2 */
22  GPIO_NC, /* 22 SDMMC2_CMD */
23  GPIO_NC, /* 23 SDMMC1_CMD */
24  GPIO_NC, /* 24 SDMMC1_D1 */
25  GPIO_NC, /* 25 SDMMC2_D0 */
26  GPIO_NC, /* 26 SDMMC1_D3_CD_B */
27  GPIO_NC, /* 30 SDMMC3_D1 */
28  GPIO_NC, /* 31 SDMMC3_CLK */
29  GPIO_NC, /* 32 SDMMC3_D3 */
30  GPIO_NC, /* 33 SDMMC3_D2 */
31  GPIO_NC, /* 34 SDMMC3_CMD */
32  GPIO_NC, /* 35 SDMMC3_D0 */
33  NATIVE_PU20K(1), /* 45 MF_LPC_AD2 */
34  NATIVE_PU20K(1), /* 46 LPC_CLKRUNB */
35  NATIVE_PU20K(1), /* 47 MF_LPC_AD0 */
36  Native_M1, /* 48 LPC_FRAMEB */
37  Native_M1, /* 49 MF_LPC_CLKOUT1 */
38  NATIVE_PU20K(1), /* 50 MF_LPC_AD3 */
39  Native_M1, /* 51 MF_LPC_CLKOUT0 */
40  NATIVE_PU20K(1), /* 52 MF_LPC_AD1 */
41  GPIO_NC, /* 60 SPI1_MISO */
42  GPIO_NC, /* 61 SPI1_CS0_B */
43  GPIO_NC, /* 62 SPI1_CLK */
44  GPIO_NC, /* 63 MMC1_D6 */
45  GPIO_NC, /* 64 SPI1_MOSI */
46  GPIO_NC, /* 65 MMC1_D5 */
47  GPIO_NC, /* 66 SPI1_CS1_B */
48  GPIO_NC, /* 67 MMC1_D4_SD_WE */
49  GPIO_NC, /* 68 MMC1_D7 */
50  GPIO_NC, /* 69 MMC1_RCLK */
51  Native_M1, /* 75 USB_OC1_B */
52  Native_M1, /* 76 PMU_RESETBUTTON_B */
54  /* 77 GPIO_ALERT */
55  GPIO_NC, /* 78 SDMMC3_PWR_EN_B */
56  NATIVE_PU20K(1), /* 79 ILB_SERIRQ */
57  NATIVE_PU20K(1), /* 80 USB_OC0_B */
58  GPIO_NC, /* 81 SDMMC3_CD_B */
59  Native_M1, /* 82 SPKR */
60  Native_M1, /* 83 SUSPWRDNACK */
61  SPARE_PIN, /* 84 SDMMC1_RCLK */
62  GPIO_NC, /* 85 SDMMC3_1P8_EN */
63  GPIO_END
64 };
65 
66 /* South West Community */
67 static const struct soc_gpio_map gpsw_gpio_map[] = {
68  NATIVE_PU20K(1), /* 00 FST_SPI_D2 */
69  NATIVE_PU20K(1), /* 01 FST_SPI_D0 */
70  NATIVE_PU20K(1), /* 02 FST_SPI_CLK */
71  NATIVE_PU20K(1), /* 03 FST_SPI_D3 */
72  GPO_FUNC(P_20K_H, 1), /* 04 FST_SPI_CS1_B */
73  NATIVE_PU20K(1), /* 05 FST_SPI_D1 */
74  NATIVE_PU20K(1), /* 06 FST_SPI_CS0_B */
75  GPO_FUNC(P_20K_H, 1), /* 07 FST_SPI_CS2_B */
76  GPIO_NC, /* 15 UART1_RTS_B */
77  GPIO_NC, /* 16 UART1_RXD */
78  GPIO_NC, /* 17 UART2_RXD */
79  GPIO_NC, /* 18 UART1_CTS_B */
80  GPIO_NC, /* 19 UART2_RTS_B */
81  GPIO_NC, /* 20 UART1_TXD */
82  GPIO_NC, /* 21 UART2_TXD */
83  GPIO_NC, /* 22 UART2_CTS_B */
84  NATIVE_PD20K(2), /* 30 MF_HDA_CLK */
85  NATIVE_PD20K(2), /* 31 GPIO_SW31/MF_HDA_RSTB */
86  NATIVE_PD20K(2), /* 32 GPIO_SW32/MF_HDA_SDI0 */
87  NATIVE_PD20K(2), /* 33 MF_HDA_SDO */
88  GPO_FUNC(P_20K_L, 1), /* 34 MF_HDA_DOCKRSTB */
89  NATIVE_PD20K(2), /* 35 MF_HDA_SYNC */
90  NATIVE_PD20K(2), /* 36 GPIO_SW36/MF_HDA_SDI1 */
91  GPIO_INPUT_PD_20K, /* 37 MF_HDA_DOCKENB */
92  GPIO_NC, /* 45 I2C5_SDA */
93  GPIO_NC, /* 46 I2C4_SDA */
94  GPIO_NC, /* 47 I2C6_SDA */
95  GPIO_NC, /* 48 I2C5_SCL */
96  GPIO_NC, /* 49 I2C_NFC_SDA */
97  GPIO_NC, /* 50 I2C4_SCL */
98  GPIO_NC, /* 51 I2C6_SCL */
99  GPIO_NC, /* 52 I2C_NFC_SCL */
100  GPIO_NC, /* 60 I2C1_SDA */
101  GPIO_NC, /* 61 I2C0_SDA */
102  GPIO_NC, /* 62 I2C2_SDA */
103  GPIO_NC, /* 63 I2C1_SCL */
104  GPIO_NC, /* 64 I2C3_SDA */
105  GPIO_NC, /* 65 I2C0_SCL */
106  GPIO_NC, /* 66 I2C2_SCL */
107  GPIO_NC, /* 67 I2C3_SCL */
108  GPIO_NC, /* 75 SATA_GP0 */
109  GPIO_NC, /* 76 SATA_GP1 */
110  Native_M1, /* 77 SATA_LEDN */
111  GPIO_NC, /* 78 SATA_GP2 */
112  NATIVE_PU20K(1), /* 79 MF_SMB_ALERTB */
113  GPIO_NC, /* 80 SATA_GP3 */
114  NATIVE_PU20K(1), /* 81 MF_SMB_CLK */
115  NATIVE_PU20K(1), /* 82 MF_SMB_DATA */
116  GPIO_NC, /* 90 PCIE_CLKREQ0B */
117  GPIO_NC, /* 91 PCIE_CLKREQ1B */
118  GPIO_NC, /* 92 GP_SSP_2_CLK */
119  GPIO_NC, /* 93 PCIE_CLKREQ2B */
120  GPIO_NC, /* 94 GP_SSP_2_RXD */
121  GPIO_NC, /* 95 PCIE_CLKREQ3B */
122  GPIO_NC, /* 96 GP_SSP_2_FS */
123  GPIO_NC, /* 97 GP_SSP_2_TXD */
124  GPIO_END
125 };
126 
127 /* North Community */
128 static const struct soc_gpio_map gpn_gpio_map[] = {
129  GPIO_NC, /* 00 GPIO_DFX0 */
130  GPIO_NC, /* 01 GPIO_DFX3 */
131  GPIO_NC, /* 02 GPIO_DFX7 */
132  GPIO_NC, /* 03 GPIO_DFX1 */
133  GPIO_NC, /* 04 GPIO_DFX5 */
134  GPIO_NC, /* 05 GPIO_DFX4 */
135  GPIO_NC, /* 06 GPIO_DFX8 */
136  GPIO_NC, /* 07 GPIO_DFX2 */
137  GPIO_NC, /* 08 GPIO_DFX6 */
139  UNMASK_WAKE, SCI), /* 15 GPIO_SUS0 */
140  GPO_FUNC(P_20K_L, 1), /* 16 SEC_GPIO_SUS10 */
141  NATIVE_PD20K(1), /* 17 GPIO_SUS3 */
143  SMI), /* 18 GPIO_SUS7 */
144  NATIVE_PD20K(1), /* 19 GPIO_SUS1 */
145  GPIO_INPUT_PU_20K, /* 20 GPIO_SUS5 */
147  NA), /* 21 SEC_GPIO_SUS11 */
148  NATIVE_PU20K(1), /* 22 GPIO_SUS4 */
150  /* 23 SEC_GPIO_SUS8 */
151  NATIVE_PU20K(1), /* 24 GPIO_SUS2 */
153  SCI), /* 25 GPIO_SUS6 */
154  Native_M1, /* 26 CX_PREQ_B */
155  GPIO_INPUT_PD_20K, /* 27 SEC_GPIO_SUS9 */
156  Native_M1, /* 30 TRST_B */
157  Native_M1, /* 31 TCK */
158  GPIO_SKIP, /* 32 PROCHOT_B */
159  GPIO_SKIP, /* 33 SVID0_DATA */
160  Native_M1, /* 34 TMS */
161  GPIO_NC, /* 35 CX_PRDY_B_2 */
162  GPIO_NC, /* 36 TDO_2 */
163  Native_M1, /* 37 CX_PRDY_B */
164  GPIO_SKIP, /* 38 SVID0_ALERT_B */
165  Native_M1, /* 39 TDO */
166  GPIO_SKIP, /* 40 SVID0_CLK */
167  Native_M1, /* 41 TDI */
168  GPIO_NC, /* 45 GP_CAMERASB05 */
169  GPIO_NC, /* 46 GP_CAMERASB02 */
170  GPIO_NC, /* 47 GP_CAMERASB08 */
171  GPIO_NC, /* 48 GP_CAMERASB00 */
172  GPIO_NC, /* 49 GP_CAMERASBO6 */
173  GPIO_NC, /* 50 GP_CAMERASB10 */
174  GPIO_NC, /* 51 GP_CAMERASB03 */
175  GPIO_NC, /* 52 GP_CAMERASB09 */
176  GPIO_NC, /* 53 GP_CAMERASB01 */
177  GPIO_NC, /* 54 GP_CAMERASB07 */
178  GPIO_NC, /* 55 GP_CAMERASB11 */
179  GPIO_NC, /* 56 GP_CAMERASB04 */
180  GPIO_NC, /* 60 PANEL0_BKLTEN */
181  NATIVE_TX_RX_EN, /* 61 HV_DDI0_HPD */
182  NATIVE_PU1K_M1, /* 62 HV_DDI2_DDC_SDA */
183  GPIO_NC, /* 63 PANEL1_BKLTCTL */
184  GPIO_NC, /* 64 HV_DDI1_HPD */
185  GPIO_NC, /* 65 PANEL0_BKLTCTL */
186  NATIVE_PU1K_M1, /* 66 HV_DDI0_DDC_SDA */
187  NATIVE_PU1K_M1, /* 67 HV_DDI2_DDC_SCL */
188  NATIVE_TX_RX_EN, /* 68 HV_DDI2_HPD */
189  GPIO_NC, /* 69 PANEL1_VDDEN */
190  GPIO_NC, /* 70 PANEL1_BKLTEN */
191  NATIVE_PU1K_M1, /* 71 HV_DDI0_DDC_SCL */
192  GPIO_NC, /* 72 PANEL0_VDDEN */
193  GPIO_END
194 };
195 
196 /* East Community */
197 static const struct soc_gpio_map gpe_gpio_map[] = {
198  NATIVE_PU20K(1), /* 00 PMU_SLP_S3_B */
199  NATIVE_PU20K(1), /* 01 PMU_BATLOW_B */
200  NATIVE_PU20K(1), /* 02 SUS_STAT_B */
201  NATIVE_PU20K(1), /* 03 PMU_SLP_S0IX_B */
202  NATIVE_PD20K(1), /* 04 PMU_AC_PRESENT */
203  NATIVE_PU20K(1), /* 05 PMU_PLTRST_B */
204  NATIVE_PD20K(1), /* 06 PMU_SUSCLK */
205  NATIVE_PU20K(1), /* 07 PMU_SLP_LAN_B */
206  NATIVE_PU20K(1), /* 08 PMU_PWRBTN_B */
207  NATIVE_PU20K(1), /* 09 PMU_SLP_S4_B */
208  NATIVE_FUNC_TX_RX(en_rx_data << 2, 1, P_1K_H, NA), /* 10 PMU_WAKE_B */
209  GPIO_NC, /* 11 PMU_WAKE_LAN_B */
210  GPIO_NC, /* 15 MF_GPIO_3 */
211  GPIO_NC, /* 16 MF_GPIO_7 */
212  GPIO_NC, /* 17 MF_I2C1_SCL */
213  GPIO_NC, /* 18 MF_GPIO_1 */
214  GPIO_NC, /* 19 MF_GPIO_5 */
215  GPIO_NC, /* 20 MF_GPIO_9 */
216  GPIO_NC, /* 21 MF_GPIO_0 */
217  GPIO_NC, /* 22 MF_GPIO_4 */
218  GPIO_NC, /* 23 MF_GPIO_8 */
219  GPIO_NC, /* 24 MF_GPIO_2 */
220  GPIO_NC, /* 25 MF_GPIO_6 */
221  GPIO_NC, /* 26 MF_I2C1_SDA */
222  GPIO_END
223 };
224 
225 static struct soc_gpio_config gpio_config = {
226  /* BSW */
227  .north = gpn_gpio_map,
228  .southeast = gpse_gpio_map,
229  .southwest = gpsw_gpio_map,
230  .east = gpe_gpio_map
231 };
232 
234 {
235 
236  return &gpio_config;
237 }
@ NA
Definition: azalia_device.h:96
struct soc_gpio_config * mainboard_get_gpios(void)
Definition: gpio.c:207
static const struct soc_gpio_map gpsw_gpio_map[]
Definition: gpio.c:67
static const struct soc_gpio_map gpse_gpio_map[]
Definition: gpio.c:6
static const struct soc_gpio_map gpe_gpio_map[]
Definition: gpio.c:197
static const struct soc_gpio_map gpn_gpio_map[]
Definition: gpio.c:128
static struct soc_gpio_config gpio_config
Definition: gpio.c:225
#define GPIO_END
Definition: gpio.h:302
#define GPIO_INPUT_PD_20K
Definition: gpio.h:165
#define GPIO_INPUT_PU_20K
Definition: gpio.h:151
#define GPIO_NC
Definition: gpio.h:310
#define GPIO_SKIP
Definition: gpio.h:292
#define NATIVE_TX_RX_EN
Definition: gpio.h:308
#define GPO_FUNC(term, tx_state)
Definition: gpio.h:228
#define NATIVE_PU20K(mode)
Definition: gpio.h:296
@ L2
Definition: gpio.h:401
@ L0
Definition: gpio.h:399
@ L3
Definition: gpio.h:402
@ L8
Definition: gpio.h:407
@ L15
Definition: gpio.h:414
@ L14
Definition: gpio.h:413
#define SPARE_PIN
Definition: gpio.h:263
@ non_maskable
Definition: gpio.h:435
@ P_20K_L
Definition: gpio.h:373
@ P_20K_H
Definition: gpio.h:376
@ P_1K_H
Definition: gpio.h:378
#define GPI(int_type, int_sel, term, int_msk, glitch_cfg, wake_msk, gpe_val)
Definition: gpio.h:220
@ en_edge_rx_data
Definition: gpio.h:430
@ en_rx_data
Definition: gpio.h:429
@ en_edge_detect
Definition: gpio.h:428
#define NATIVE_PD20K(mode)
Definition: gpio.h:303
#define Native_M1
Definition: gpio.h:315
@ SCI
Definition: gpio.h:441
@ SMI
Definition: gpio.h:440
#define UNMASK_WAKE
Definition: gpio.h:129
#define NATIVE_PU1K_M1
Definition: gpio.h:311
#define NATIVE_FUNC_TX_RX(tx_rx_enable, mode, term, inv_rx_tx)
Definition: gpio.h:238
@ trig_edge_high
Definition: gpio.h:420
@ trig_edge_low
Definition: gpio.h:419
@ trig_edge_both
Definition: gpio.h:421
@ trig_level_high
Definition: gpio.h:422