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 <baseboard/gpio.h>
4 #include <baseboard/variants.h>
5 #include <commonlib/helpers.h>
6 #include <soc/gpio.h>
7 
8 /* Pad configuration in ramstage */
9 static const struct pad_config override_gpio_table[] = {
10  /* A7 : SRCCLK_OE7# ==> PEN_DET_ODL */
12  /* A8 : SRCCLKREQ7# ==> PEN_DET_ODL */
13  PAD_CFG_GPI_SCI_HIGH(GPP_A8, NONE, DEEP, EDGE_SINGLE),
14  /* B3 : PROC_GP2 ==> NC */
15  PAD_NC_LOCK(GPP_B3, NONE, LOCK_CONFIG),
16  /* B5 : ISH_I2C0_SDA ==> NC */
17  PAD_NC_LOCK(GPP_B5, NONE, LOCK_CONFIG),
18  /* B6 : ISH_I2C0_SCL ==> NC */
19  PAD_NC_LOCK(GPP_B6, NONE, LOCK_CONFIG),
20  /* B6 : TIME_SYNC0 ==> NC */
21  PAD_NC_LOCK(GPP_B15, NONE, LOCK_CONFIG),
22  /* C3 : SML0CLK ==> NC */
23  PAD_NC(GPP_C3, NONE),
24  /* C4 : SML0DATA ==> EN_PP5000_PEN */
25  PAD_CFG_GPO(GPP_C4, 1, DEEP),
26  /* D0 : ISH_GP0 ==> NC */
27  PAD_NC_LOCK(GPP_D0, NONE, LOCK_CONFIG),
28  /* D1 : ISH_GP1 ==> NC */
29  PAD_NC_LOCK(GPP_D1, NONE, LOCK_CONFIG),
30  /* D2 : ISH_GP2 ==> NC */
31  PAD_NC_LOCK(GPP_D2, NONE, LOCK_CONFIG),
32  /* D3 : ISH_GP3 ==> NC */
33  PAD_NC_LOCK(GPP_D3, NONE, LOCK_CONFIG),
34  /* D5 : SRCCLKREQ0# ==> NC */
35  PAD_NC(GPP_D5, NONE),
36  /* D15 : ISH_UART0_RTS# ==> NC */
37  PAD_NC_LOCK(GPP_D15, NONE, LOCK_CONFIG),
38  /* D16 : ISH_UART0_CTS# ==> NC */
39  PAD_NC_LOCK(GPP_D16, NONE, LOCK_CONFIG),
40  /* E0 : SATAXPCIE0 ==> NC */
41  PAD_NC(GPP_E0, NONE),
42  /* E3 : PROC_GP0 ==> NC */
43  PAD_NC(GPP_E3, NONE),
44  /* E7 : PROC_GP1 ==> NC */
45  PAD_NC(GPP_E7, NONE),
46  /* E9 : USB_OC0# ==> NC */
47  PAD_NC_LOCK(GPP_E9, NONE, LOCK_CONFIG),
48  /* E10 : THC0_SPI1_CS# ==> NC */
49  PAD_NC_LOCK(GPP_E10, NONE, LOCK_CONFIG),
50  /* E16 : RSVD_TP ==> NC */
52  /* E17 : THC0_SPI1_INT# ==> NC */
53  PAD_NC_LOCK(GPP_E17, NONE, LOCK_CONFIG),
54  /* E18 : DDP1_CTRLCLK ==> NC */
56  /* E19 : DDP1_CTRLDATA ==> GPP_E19_STRAP */
58  /* E22 : DDPA_CTRLCLK ==> NC */
60  /* E23 : DDPA_CTRLDATA ==> NC */
62  /* F6 : CNV_PA_BLANKING ==> NC */
63  PAD_NC(GPP_F6, NONE),
64  /* F11 : THC1_SPI2_CLK ==> NC */
65  PAD_NC_LOCK(GPP_F11, NONE, LOCK_CONFIG),
66  /* F12 : GSXDOUT ==> NC */
67  PAD_NC_LOCK(GPP_F12, NONE, LOCK_CONFIG),
68  /* F13 : GSXDOUT ==> NC */
69  PAD_NC_LOCK(GPP_F13, NONE, LOCK_CONFIG),
70  /* F15 : GSXSRESET# ==> NC */
71  PAD_NC_LOCK(GPP_F15, NONE, LOCK_CONFIG),
72  /* F16 : GSXCLK ==> NC */
73  PAD_NC_LOCK(GPP_F16, NONE, LOCK_CONFIG),
74  /* F20 : EXT_PWR_GATE# ==> NC */
76  /* F21 : EXT_PWR_GATE2# ==> NC */
78  /* H6 : I2C1_SDA ==> PCH_I2C_TPM_SDA */
79  PAD_CFG_NF_LOCK(GPP_H6, NONE, NF1, LOCK_CONFIG),
80  /* H7 : I2C1_SCL ==> PCH_I2C_TPM_SCL */
81  PAD_CFG_NF_LOCK(GPP_H7, NONE, NF1, LOCK_CONFIG),
82  /* H8 : I2C4_SDA ==> NC */
83  PAD_NC(GPP_H8, NONE),
84  /* H9 : I2C4_SCL ==> NC */
85  PAD_NC(GPP_H9, NONE),
86  /* H19 : SRCCLKREQ4# ==> NC */
88  /* H21 : IMGCLKOUT2 ==> NC */
90  /* H22 : IMGCLKOUT3 ==> NC */
92  /* H23 : SRCCLKREQ5# ==> NC */
94  /* R4 : HDA_RST# ==> DMIC_CLK0 */
95  PAD_CFG_NF(GPP_R4, NONE, DEEP, NF3),
96  /* R5 : HDA_SDI1 ==> DMIC_DATA0 */
97  PAD_CFG_NF(GPP_R5, NONE, DEEP, NF3),
98  /* R6 : I2S2_TXD ==> NC */
99  PAD_NC(GPP_R6, NONE),
100  /* R7 : I2S2_RXD ==> NC */
101  PAD_NC(GPP_R7, NONE),
102  /* S0 : SNDW0_CLK ==> I2S_SPKR_SCLK_R */
103  PAD_CFG_NF(GPP_S0, NONE, DEEP, NF4),
104  /* S1 : SNDW0_DATA ==> I2S_SPKR_SFRM_R */
105  PAD_CFG_NF(GPP_S1, NONE, DEEP, NF4),
106  /* S2 : SNDW1_CLK ==> I2S_PCH_TX_SPKR_RX_R */
107  PAD_CFG_NF(GPP_S2, NONE, DEEP, NF4),
108  /* S3 : SNDW1_DATA ==> I2S_PCH_RX_SPKR_TX */
109  PAD_CFG_NF(GPP_S3, NONE, DEEP, NF4),
110  /* S4 : SNDW2_CLK ==> NC */
111  PAD_NC(GPP_S4, NONE),
112  /* S5 : SNDW2_DATA ==> NC */
113  PAD_NC(GPP_S5, NONE),
114 
115 };
116 
117 /* Early pad configuration in bootblock */
118 static const struct pad_config early_gpio_table[] = {
119  /* A13 : PMC_I2C_SCL ==> GSC_PCH_INT_ODL */
120  PAD_CFG_GPI_APIC(GPP_A13, NONE, PLTRST, LEVEL, INVERT),
121  /* B4 : PROC_GP3 ==> SSD_PERST_L */
122  PAD_CFG_GPO(GPP_B4, 0, DEEP),
123  /* H6 : I2C1_SDA ==> PCH_I2C_TPM_SDA */
124  PAD_CFG_NF(GPP_H6, NONE, DEEP, NF1),
125  /* H7 : I2C1_SCL ==> PCH_I2C_TPM_SCL */
126  PAD_CFG_NF(GPP_H7, NONE, DEEP, NF1),
127  /* D11 : ISH_SPI_MISO ==> EN_PP3300_SSD */
128  PAD_CFG_GPO(GPP_D11, 1, DEEP),
129  /* D18 : UART1_TXD ==> SD_PE_RST_L */
130  PAD_CFG_GPO(GPP_D18, 0, PLTRST),
131  /* E13 : THC0_SPI1_IO2 ==> MEM_CH_SEL */
132  PAD_CFG_GPI(GPP_E13, NONE, DEEP),
133  /* E15 : RSVD_TP ==> PCH_WP_OD */
135  /* F18 : THC1_SPI2_INT# ==> EC_IN_RW_OD */
136  PAD_CFG_GPI(GPP_F18, NONE, DEEP),
137  /* H10 : UART0_RXD ==> UART_PCH_RX_DBG_TX */
138  PAD_CFG_NF(GPP_H10, NONE, DEEP, NF2),
139  /* H11 : UART0_TXD ==> UART_PCH_TX_DBG_RX */
140  PAD_CFG_NF(GPP_H11, NONE, DEEP, NF2),
141  /* H13 : I2C7_SCL ==> EN_PP3300_SD */
142  PAD_CFG_GPO(GPP_H13, 1, PLTRST),
143 };
144 
145 static const struct pad_config romstage_gpio_table[] = {
146  /* B4 : PROC_GP3 ==> SSD_PERST_L */
147  PAD_CFG_GPO(GPP_B4, 1, DEEP),
148 };
149 
150 const struct pad_config *variant_gpio_override_table(size_t *num)
151 {
153  return override_gpio_table;
154 }
155 
156 const struct pad_config *variant_early_gpio_table(size_t *num)
157 {
159  return early_gpio_table;
160 }
161 
162 const struct pad_config *variant_romstage_gpio_table(size_t *num)
163 {
165  return romstage_gpio_table;
166 }
#define GPP_H22
#define GPP_B6
Definition: gpio_soc_defs.h:59
#define GPP_H19
#define GPP_D1
#define GPP_E3
#define GPP_F21
#define GPP_F12
#define GPP_F16
#define GPP_S4
#define GPP_R4
#define GPP_E0
#define GPP_R7
#define GPP_F6
#define GPP_F20
#define GPP_S0
#define GPP_H11
#define GPP_S5
#define GPP_D2
#define GPP_H6
#define GPP_R6
#define GPP_H9
#define GPP_B15
Definition: gpio_soc_defs.h:68
#define GPP_E13
#define GPP_H21
#define GPP_H13
#define GPP_D11
#define GPP_H7
#define GPP_D5
#define GPP_S3
#define GPP_E23
#define GPP_E9
#define GPP_A7
#define GPP_S1
#define GPP_F15
#define GPP_E7
#define GPP_F13
#define GPP_C4
#define GPP_D18
#define GPP_E17
#define GPP_E19
#define GPP_E18
#define GPP_A8
#define GPP_D0
#define GPP_B5
Definition: gpio_soc_defs.h:58
#define GPP_R5
#define GPP_E10
#define GPP_A13
#define GPP_S2
#define GPP_E15
#define GPP_E16
#define GPP_F18
#define GPP_B3
Definition: gpio_soc_defs.h:56
#define GPP_D15
#define GPP_F11
#define GPP_B4
Definition: gpio_soc_defs.h:57
#define GPP_D16
#define GPP_E22
#define GPP_H10
#define GPP_C3
#define GPP_H8
#define GPP_H23
#define GPP_D3
#define ARRAY_SIZE(a)
Definition: helpers.h:12
const struct pad_config * variant_gpio_override_table(size_t *num)
Definition: gpio.c:198
const struct pad_config * variant_romstage_gpio_table(size_t *num)
Definition: gpio.c:210
const struct pad_config * variant_early_gpio_table(size_t *num)
Definition: gpio.c:204
static const struct pad_config override_gpio_table[]
Definition: gpio.c:9
static const struct pad_config romstage_gpio_table[]
Definition: gpio.c:145
static const struct pad_config early_gpio_table[]
Definition: gpio.c:118
#define PAD_NC(pin)
Definition: gpio_defs.h:263
#define PAD_CFG_NF_LOCK(pad, pull, func, lock_action)
Definition: gpio_defs.h:203
#define PAD_CFG_GPI(pad, pull, rst)
Definition: gpio_defs.h:284
#define PAD_NC_LOCK(pad, pull, lock_action)
Definition: gpio_defs.h:368
#define PAD_CFG_NF(pad, pull, rst, func)
Definition: gpio_defs.h:197
#define PAD_CFG_GPI_APIC(pad, pull, rst, trig, inv)
Definition: gpio_defs.h:376
#define PAD_CFG_GPO(pad, val, rst)
Definition: gpio_defs.h:247
#define PAD_CFG_GPI_SCI_HIGH(pad, pull, rst, trig)
Definition: gpio_defs.h:458
#define PAD_CFG_GPI_GPIO_DRIVER(pad, pull, rst)
Definition: gpio_defs.h:323