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-only */
2 
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
5 #include <commonlib/helpers.h>
6 
7 static const struct pad_config gpio_table[] = {
8  /* A16 : SD_OC_ODL */
9  PAD_CFG_GPI(GPP_A16, NONE, DEEP),
10  /* A18 : LAN_PE_ISOLATE_ODL */
11  PAD_CFG_GPO(GPP_A18, 1, DEEP),
12  /* A19 : PCH_PCON0_PDB_ODL */
13  PAD_CFG_GPO(GPP_A19, 1, DEEP),
14  /* A20 : LAN_I350_WAKE# */
15  PAD_CFG_GPI_IRQ_WAKE(GPP_A20, NONE, DEEP, LEVEL, INVERT),
16  /* A23 : M2_WLAN_INT_ODL */
17  PAD_CFG_GPI_APIC(GPP_A23, NONE, PLTRST, LEVEL, INVERT),
18 
19  /* B5 : LAN_CLKREQ_ODL */
20  PAD_CFG_NF(GPP_B5, NONE, DEEP, NF1),
21  /* B6 : M2_SSD_CLKREQ_ODL */
22  PAD_CFG_NF(GPP_B6, NONE, DEEP, NF1),
23  /* B7 : M2_TPU0_CLKREQ_ODL */
24  PAD_CFG_NF(GPP_B7, NONE, DEEP, NF1),
25  /* B8 : CLK_PCIE_REQ3 (not connected) */
26  PAD_NC(GPP_B8, NONE),
27  /* B9 : M2_TPU1_CLKREQ_ODL */
28  PAD_CFG_NF(GPP_B9, NONE, DEEP, NF1),
29  /* B10 : M2_WLAN_CLKREQ_ODL */
30  PAD_CFG_NF(GPP_B10, NONE, DEEP, NF1),
31 
32  /* C0 : SMBCLK */
33  PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1),
34  /* C1 : SMBDATA */
35  PAD_CFG_NF(GPP_C1, NONE, DEEP, NF1),
36  /* C3 : PCH_MBCLK1_R (i350) */
37  PAD_CFG_NF(GPP_C3, NONE, DEEP, NF1),
38  /* C4 : PCH_MBDAT1_R (i350) */
39  PAD_CFG_NF(GPP_C4, NONE, DEEP, NF1),
40  /* C6 : M2_WLAN_WAKE_ODL */
41  PAD_CFG_GPI_SCI_LOW(GPP_C6, NONE, DEEP, EDGE_SINGLE),
42  /* C7 : LAN_WAKE_ODL */
43  PAD_CFG_GPI_SCI_LOW(GPP_C7, NONE, DEEP, EDGE_SINGLE),
44  /* C10 : PCH_PCON_RST_ODL */
45  PAD_CFG_GPO(GPP_C10, 1, DEEP),
46  /* C11 : PCH_PCON1_PDB_ODL */
47  PAD_CFG_GPO(GPP_C11, 1, DEEP),
48  /* C12 : PCH_UART1_RX_ADB_TX */
49  PAD_CFG_NF(GPP_C12, NONE, DEEP, NF1),
50  /* C13 : PCH_UART1_TX_ADB_RX */
51  PAD_CFG_NF(GPP_C13, NONE, DEEP, NF1),
52  /* C15 : WLAN_OFF_L */
53  PAD_CFG_GPO(GPP_C15, 1, DEEP),
54  /* C16 : PCH_I2C_RFU_SDA (NC) */
56  /* C17 : PCH_I2C_RFU_SCL (NC) */
58  /* C18 : EC_I2C_HDMI_RE_SCL */
59  PAD_CFG_NF(GPP_C18, NONE, DEEP, NF1),
60  /* C19 : EC_12C_HDMI_RE_SDA */
61  PAD_CFG_NF(GPP_C19, NONE, DEEP, NF1),
62 
63  /* D1 : REC_MODE */
64  PAD_CFG_GPO(GPP_D1, 1, DEEP),
65  /* D2 : DEV_MODE_CTRL */
66  PAD_CFG_GPO(GPP_D2, 1, DEEP),
67  /* D3 : BOOT_IND */
68  PAD_CFG_GPI(GPP_D3, NONE, DEEP),
69  /* D14 : EC_PCH_INT_L */
70  PAD_CFG_GPI_APIC(GPP_D14, NONE, PLTRST, LEVEL, INVERT),
71  /* D21 : BOOT_SEL_N */
72  PAD_CFG_GPO(GPP_D21, 1, DEEP),
73  /* D22 : QSPI_MR_N */
74  PAD_CFG_GPO(GPP_D22, 1, DEEP),
75  /* D23 : Not connected */
77 
78  /* E2 : Not connected */
79  PAD_NC(GPP_E2, NONE),
80  /* E3 : TPU_BOOT_DELAY_PIN40 */
81  PAD_CFG_GPO(GPP_E3, 1, DEEP),
82  /* E7 : TPU_BOOT_DELAY_PIN42 */
83  PAD_CFG_GPO(GPP_E7, 1, DEEP),
84  /* E9 : PU 10K to PP3300_SOC_A */
85  PAD_NC(GPP_E9, NONE),
86  /* E10 : USB_A1_OC_ODL */
87  PAD_CFG_NF(GPP_E10, NONE, DEEP, NF1),
88  /* E11 : PU 10K to PP3300_SOC_A */
90  /* E12 : PU 10K to PP3300_SOC_A */
92  /* E15 : PCH_TYPEC_UPFB */
93  PAD_CFG_GPI(GPP_E15, NONE, DEEP),
94 
95  /* H0 : Not connected */
96  PAD_NC(GPP_H0, NONE),
97  /* H4 : PCH_I2C_PCON_SDA */
98  PAD_CFG_NF(GPP_H4, NONE, DEEP, NF1),
99  /* H5 : PCH_I2C_PCON_SCL */
100  PAD_CFG_NF(GPP_H5, NONE, DEEP, NF1),
101  /* H6 : PCH_I2C_TPU_SDA */
102  PAD_CFG_NF(GPP_H6, NONE, DEEP, NF1),
103  /* H7 : PCH_I2C_TPU_SCL */
104  PAD_CFG_NF(GPP_H7, NONE, DEEP, NF1),
105  /* H8 : Not connected */
106  PAD_NC(GPP_H8, NONE),
107  /* H9 : Not connected */
108  PAD_NC(GPP_H9, NONE),
109  /* H22 : PWM_PP3300_BIOZZER */
110  PAD_CFG_GPO(GPP_H22, 0, DEEP),
111 };
112 
113 const struct pad_config *override_gpio_table(size_t *num)
114 {
115  *num = ARRAY_SIZE(gpio_table);
116  return gpio_table;
117 }
118 
119 /* Early pad configuration in bootblock */
120 static const struct pad_config early_gpio_table[] = {
121  /* B14 : GPP_B14_STRAP */
122  PAD_NC(GPP_B14, NONE),
123  /* B22 : GPP_B22_STRAP */
124  PAD_NC(GPP_B22, NONE),
125  /* E19 : GPP_E19_STRAP */
126  PAD_NC(GPP_E19, NONE),
127  /* E21 : GPP_E21_STRAP */
128  PAD_NC(GPP_E21, NONE),
129  /* B15 : H1_SLAVE_SPI_CS_L */
130  PAD_CFG_NF(GPP_B15, NONE, DEEP, NF1),
131  /* B16 : H1_SLAVE_SPI_CLK */
132  PAD_CFG_NF(GPP_B16, NONE, DEEP, NF1),
133  /* B17 : H1_SLAVE_SPI_MISO_R */
134  PAD_CFG_NF(GPP_B17, NONE, DEEP, NF1),
135  /* B18 : H1_SLAVE_SPI_MOSI_R */
136  PAD_CFG_NF(GPP_B18, NONE, DEEP, NF1),
137  /* C14 : BT_DISABLE_L */
138  PAD_CFG_GPO(GPP_C14, 0, DEEP),
139  /* C20 : PCH_WP_OD */
140  PAD_CFG_GPI(GPP_C20, NONE, DEEP),
141  /* C21 : H1_PCH_INT_ODL */
142  PAD_CFG_GPI_APIC(GPP_C21, NONE, PLTRST, LEVEL, INVERT),
143  /* C22 : EC_IN_RW_OD */
144  PAD_CFG_GPI(GPP_C22, NONE, DEEP),
145  /* C23 : WLAN_PE_RST# */
146  PAD_CFG_GPO(GPP_C23, 1, DEEP),
147  /* E1 : M2_SSD_PEDET */
148  PAD_CFG_NF(GPP_E1, NONE, DEEP, NF1),
149  /* E5 : SATA_DEVSLP1 */
150  PAD_CFG_NF(GPP_E5, NONE, PLTRST, NF1),
151 };
152 
153 const struct pad_config *variant_early_gpio_table(size_t *num)
154 {
156  return early_gpio_table;
157 }
#define GPP_H22
#define GPP_C15
#define GPP_B6
Definition: gpio_soc_defs.h:59
#define GPP_D1
#define GPP_E3
#define GPP_A18
#define GPP_C12
#define GPP_D14
#define GPP_B16
Definition: gpio_soc_defs.h:69
#define GPP_A19
#define GPP_D2
#define GPP_H6
#define GPP_C22
#define GPP_H9
#define GPP_B15
Definition: gpio_soc_defs.h:68
#define GPP_C23
#define GPP_H7
#define GPP_C11
#define GPP_B22
Definition: gpio_soc_defs.h:75
#define GPP_A23
#define GPP_C18
#define GPP_C13
#define GPP_E9
#define GPP_C17
#define GPP_E5
#define GPP_B8
Definition: gpio_soc_defs.h:61
#define GPP_C20
#define GPP_A20
#define GPP_A16
#define GPP_C10
#define GPP_C6
#define GPP_E7
#define GPP_C16
#define GPP_C4
#define GPP_E2
#define GPP_E19
#define GPP_H0
#define GPP_H5
#define GPP_C21
#define GPP_B9
Definition: gpio_soc_defs.h:62
#define GPP_B14
Definition: gpio_soc_defs.h:67
#define GPP_B18
Definition: gpio_soc_defs.h:71
#define GPP_B5
Definition: gpio_soc_defs.h:58
#define GPP_C14
#define GPP_E10
#define GPP_C19
#define GPP_E15
#define GPP_B10
Definition: gpio_soc_defs.h:63
#define GPP_C1
#define GPP_E11
#define GPP_E21
#define GPP_C3
#define GPP_E12
#define GPP_B17
Definition: gpio_soc_defs.h:70
#define GPP_C0
#define GPP_E1
#define GPP_H8
#define GPP_H4
#define GPP_B7
Definition: gpio_soc_defs.h:60
#define GPP_C7
#define GPP_D3
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define GPP_D23
#define GPP_D22
#define GPP_D21
const struct pad_config * variant_early_gpio_table(size_t *num)
Definition: gpio.c:204
const struct pad_config * override_gpio_table(size_t *num)
Definition: gpio.c:124
static const struct pad_config gpio_table[]
Definition: gpio.c:7
static const struct pad_config early_gpio_table[]
Definition: gpio.c:120
#define PAD_NC(pin)
Definition: gpio_defs.h:263
#define PAD_CFG_GPI(pad, pull, rst)
Definition: gpio_defs.h:284
#define PAD_CFG_GPI_SCI_LOW(pad, pull, rst, trig)
Definition: gpio_defs.h:452
#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