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  /* C15 : WLAN_OFF_L */
49  PAD_CFG_GPO(GPP_C15, 1, DEEP),
50 
51  /* E2 : Not connected */
52  PAD_NC(GPP_E2, NONE),
53  /* E3 : TPU_RST_PIN40 */
54  PAD_CFG_GPO(GPP_E3, 1, DEEP),
55  /* E7 : TPU_RST_PIN42 */
56  PAD_CFG_GPO(GPP_E7, 1, DEEP),
57  /* E9 : PU 10K to PP3300_SOC_A */
58  PAD_NC(GPP_E9, NONE),
59  /* E10 : USB_A1_OC_ODL */
60  PAD_CFG_NF(GPP_E10, NONE, DEEP, NF1),
61  /* E15 : PCH_TYPEC_UPFB */
62  PAD_CFG_GPI(GPP_E15, NONE, DEEP),
63 
64  /* F11 : EMMC_CMD */
65  PAD_CFG_NF(GPP_F11, NONE, DEEP, NF1),
66  /* F12 : EMMC_DATA0 */
67  PAD_CFG_NF(GPP_F12, NONE, DEEP, NF1),
68  /* F13 : EMMC_DATA1 */
69  PAD_CFG_NF(GPP_F13, NONE, DEEP, NF1),
70  /* F14 : EMMC_DATA2 */
71  PAD_CFG_NF(GPP_F14, NONE, DEEP, NF1),
72  /* F15 : EMMC_DATA3 */
73  PAD_CFG_NF(GPP_F15, NONE, DEEP, NF1),
74  /* F16 : EMMC_DATA4 */
75  PAD_CFG_NF(GPP_F16, NONE, DEEP, NF1),
76  /* F17 : EMMC_DATA5 */
77  PAD_CFG_NF(GPP_F17, NONE, DEEP, NF1),
78  /* F18 : EMMC_DATA6 */
79  PAD_CFG_NF(GPP_F18, NONE, DEEP, NF1),
80  /* F19 : EMMC_DATA7 */
81  PAD_CFG_NF(GPP_F19, NONE, DEEP, NF1),
82  /* F20 : EMMC_RCLK */
83  PAD_CFG_NF(GPP_F20, NONE, DEEP, NF1),
84  /* F21 : EMMC_CLK */
85  PAD_CFG_NF(GPP_F21, NONE, DEEP, NF1),
86  /* F22 : EMMC_RST_L */
87  PAD_CFG_NF(GPP_F22, NONE, DEEP, NF1),
88 
89  /* H4: PCH_I2C_PCON_SDA */
90  PAD_CFG_NF(GPP_H4, NONE, DEEP, NF1),
91  /* H5: PCH_I2C_PCON_SCL */
92  PAD_CFG_NF(GPP_H5, NONE, DEEP, NF1),
93  /* H6 : PCH_I2C_TPU_SDA */
94  PAD_CFG_NF(GPP_H6, NONE, DEEP, NF1),
95  /* H7 : PCH_I2C_TPU_SCL */
96  PAD_CFG_NF(GPP_H7, NONE, DEEP, NF1),
97  /* H22 : PWM_PP3300_BIOZZER */
98  PAD_CFG_GPO(GPP_H22, 0, DEEP),
99 };
100 
101 const struct pad_config *override_gpio_table(size_t *num)
102 {
103  *num = ARRAY_SIZE(gpio_table);
104  return gpio_table;
105 }
106 
107 /* Early pad configuration in bootblock */
108 static const struct pad_config early_gpio_table[] = {
109  /* B14 : GPP_B14_STRAP */
110  PAD_NC(GPP_B14, NONE),
111  /* B22 : GPP_B22_STRAP */
112  PAD_NC(GPP_B22, NONE),
113  /* E19 : GPP_E19_STRAP */
114  PAD_NC(GPP_E19, NONE),
115  /* E21 : GPP_E21_STRAP */
116  PAD_NC(GPP_E21, NONE),
117  /* B15 : H1_SLAVE_SPI_CS_L */
118  PAD_CFG_NF(GPP_B15, NONE, DEEP, NF1),
119  /* B16 : H1_SLAVE_SPI_CLK */
120  PAD_CFG_NF(GPP_B16, NONE, DEEP, NF1),
121  /* B17 : H1_SLAVE_SPI_MISO_R */
122  PAD_CFG_NF(GPP_B17, NONE, DEEP, NF1),
123  /* B18 : H1_SLAVE_SPI_MOSI_R */
124  PAD_CFG_NF(GPP_B18, NONE, DEEP, NF1),
125  /* C14 : BT_DISABLE_L */
126  PAD_CFG_GPO(GPP_C14, 0, DEEP),
127  /* PCH_WP_OD */
128  PAD_CFG_GPI(GPP_C20, NONE, DEEP),
129  /* C21 : H1_PCH_INT_ODL */
130  PAD_CFG_GPI_APIC(GPP_C21, NONE, PLTRST, LEVEL, INVERT),
131  /* C22 : EC_IN_RW_OD */
132  PAD_CFG_GPI(GPP_C22, NONE, DEEP),
133  /* C23 : WLAN_PE_RST# */
134  PAD_CFG_GPO(GPP_C23, 1, DEEP),
135  /* E1 : M2_SSD_PEDET */
136  PAD_CFG_NF(GPP_E1, NONE, DEEP, NF1),
137  /* E5 : SATA_DEVSLP1 */
138  PAD_CFG_NF(GPP_E5, NONE, PLTRST, NF1),
139 };
140 
141 const struct pad_config *variant_early_gpio_table(size_t *num)
142 {
144  return early_gpio_table;
145 }
#define GPP_H22
#define GPP_C15
#define GPP_B6
Definition: gpio_soc_defs.h:59
#define GPP_E3
#define GPP_A18
#define GPP_F21
#define GPP_F12
#define GPP_F16
#define GPP_F20
#define GPP_B16
Definition: gpio_soc_defs.h:69
#define GPP_A19
#define GPP_H6
#define GPP_C22
#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_E9
#define GPP_E5
#define GPP_B8
Definition: gpio_soc_defs.h:61
#define GPP_C20
#define GPP_A20
#define GPP_A16
#define GPP_F17
#define GPP_F15
#define GPP_C10
#define GPP_C6
#define GPP_E7
#define GPP_F13
#define GPP_C4
#define GPP_E2
#define GPP_E19
#define GPP_H5
#define GPP_C21
#define GPP_B9
Definition: gpio_soc_defs.h:62
#define GPP_F14
#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_E15
#define GPP_B10
Definition: gpio_soc_defs.h:63
#define GPP_C1
#define GPP_F18
#define GPP_F22
#define GPP_F11
#define GPP_E21
#define GPP_C3
#define GPP_B17
Definition: gpio_soc_defs.h:70
#define GPP_C0
#define GPP_E1
#define GPP_F19
#define GPP_H4
#define GPP_B7
Definition: gpio_soc_defs.h:60
#define GPP_C7
#define ARRAY_SIZE(a)
Definition: helpers.h:12
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:108
#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