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  /* A0 : SAR0_INT_ODL */
9  PAD_CFG_GPI_INT(GPP_A0, NONE, PLTRST, LEVEL),
10  /* A6 : SAR1_INT_ODL */
11  PAD_CFG_GPI_INT(GPP_A6, NONE, PLTRST, LEVEL),
12  /* A8 : PEN_GARAGE_DET_L (wake) */
13  PAD_CFG_GPI_SCI(GPP_A8, NONE, DEEP, EDGE_SINGLE, NONE),
14  /* A10 : FPMCU_PCH_BOOT1 */
15  PAD_CFG_GPO(GPP_A10, 0, DEEP),
16  /* A11 : PCH_SPI_FPMCU_CS_L */
17  PAD_CFG_NF(GPP_A11, NONE, DEEP, NF2),
18  /* A12 : FPMCU_RST_ODL */
19  PAD_CFG_GPO(GPP_A12, 0, DEEP),
20  /* C13 : EC_PCH_INT_L */
21  PAD_CFG_GPI_APIC(GPP_C13, UP_20K, PLTRST, LEVEL, INVERT),
22  /* C15 : WWAN_DPR_SAR_ODL
23  *
24  * TODO: Driver doesn't use this pin as of now. In case driver starts
25  * using this pin, expose this pin to driver.
26  */
27  PAD_CFG_GPO(GPP_C15, 1, DEEP),
28 };
29 
30 const struct pad_config *override_gpio_table(size_t *num)
31 {
32  *num = ARRAY_SIZE(gpio_table);
33  return gpio_table;
34 }
35 
36 /*
37  * GPIOs configured before ramstage
38  * Note: the Hatch platform's romstage will configure
39  * the MEM_STRAP_* (a.k.a GPIO_MEM_CONFIG_*) pins
40  * as inputs before it reads them, so they are not
41  * needed in this table.
42  */
43 static const struct pad_config early_gpio_table[] = {
44  /* B15 : H1_SLAVE_SPI_CS_L */
45  PAD_CFG_NF(GPP_B15, NONE, DEEP, NF1),
46  /* B16 : H1_SLAVE_SPI_CLK */
47  PAD_CFG_NF(GPP_B16, NONE, DEEP, NF1),
48  /* B17 : H1_SLAVE_SPI_MISO_R */
49  PAD_CFG_NF(GPP_B17, NONE, DEEP, NF1),
50  /* B18 : H1_SLAVE_SPI_MOSI_R */
51  PAD_CFG_NF(GPP_B18, NONE, DEEP, NF1),
52  /* C8 : UART_PCH_RX_DEBUG_TX */
53  PAD_CFG_NF(GPP_C8, NONE, DEEP, NF1),
54  /* C9 : UART_PCH_TX_DEBUG_RX */
55  PAD_CFG_NF(GPP_C9, NONE, DEEP, NF1),
56  /* C14 : BT_DISABLE_L */
57  PAD_CFG_GPO(GPP_C14, 0, DEEP),
58  /* PCH_WP_OD */
59  PAD_CFG_GPI(GPP_C20, NONE, DEEP),
60  /* C21 : H1_PCH_INT_ODL */
61  PAD_CFG_GPI_APIC(GPP_C21, NONE, PLTRST, LEVEL, INVERT),
62  /* C22 : EC_IN_RW_OD */
63  PAD_CFG_GPI(GPP_C22, NONE, DEEP),
64  /* C23 : WLAN_PE_RST# */
65  PAD_CFG_GPO(GPP_C23, 1, DEEP),
66  /* E1 : M2_SSD_PEDET */
67  PAD_CFG_NF(GPP_E1, NONE, DEEP, NF1),
68  /* E5 : SATA_DEVSLP1 */
69  PAD_CFG_NF(GPP_E5, NONE, PLTRST, NF1),
70  /* F2 : MEM_CH_SEL */
71  PAD_CFG_GPI(GPP_F2, NONE, PLTRST),
72 };
73 
74 const struct pad_config *variant_early_gpio_table(size_t *num)
75 {
77  return early_gpio_table;
78 }
#define GPP_C15
#define GPP_B16
Definition: gpio_soc_defs.h:69
#define GPP_C9
#define GPP_C22
#define GPP_B15
Definition: gpio_soc_defs.h:68
#define GPP_C23
#define GPP_C8
#define GPP_A6
#define GPP_C13
#define GPP_E5
#define GPP_A0
#define GPP_C20
#define GPP_A12
#define GPP_C21
#define GPP_A10
#define GPP_A8
#define GPP_B18
Definition: gpio_soc_defs.h:71
#define GPP_A11
#define GPP_C14
#define GPP_F2
#define GPP_B17
Definition: gpio_soc_defs.h:70
#define GPP_E1
#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:43
#define PAD_CFG_GPI(pad, pull, rst)
Definition: gpio_defs.h:284
#define PAD_CFG_NF(pad, pull, rst, func)
Definition: gpio_defs.h:197
#define PAD_CFG_GPI_INT(pad, pull, rst, trig)
Definition: gpio_defs.h:348
#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(pad, pull, rst, trig, inv)
Definition: gpio_defs.h:432