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  /* H3 : SPKR_PA_EN */
29  PAD_CFG_GPO(GPP_H3, 0, DEEP),
30  /* H22 : BOMACO_EN */
31  PAD_CFG_GPO(GPP_H22, 0, DEEP),
32 };
33 
34 const struct pad_config *override_gpio_table(size_t *num)
35 {
36  *num = ARRAY_SIZE(gpio_table);
37  return gpio_table;
38 }
39 
40 /*
41  * GPIOs configured before ramstage
42  * Note: the Hatch platform's romstage will configure
43  * the MEM_STRAP_* (a.k.a GPIO_MEM_CONFIG_*) pins
44  * as inputs before it reads them, so they are not
45  * needed in this table.
46  */
47 static const struct pad_config early_gpio_table[] = {
48  /* B15 : H1_SLAVE_SPI_CS_L */
49  PAD_CFG_NF(GPP_B15, NONE, DEEP, NF1),
50  /* B16 : H1_SLAVE_SPI_CLK */
51  PAD_CFG_NF(GPP_B16, NONE, DEEP, NF1),
52  /* B17 : H1_SLAVE_SPI_MISO_R */
53  PAD_CFG_NF(GPP_B17, NONE, DEEP, NF1),
54  /* B18 : H1_SLAVE_SPI_MOSI_R */
55  PAD_CFG_NF(GPP_B18, NONE, DEEP, NF1),
56  /* C8 : UART_PCH_RX_DEBUG_TX */
57  PAD_CFG_NF(GPP_C8, NONE, DEEP, NF1),
58  /* C9 : UART_PCH_TX_DEBUG_RX */
59  PAD_CFG_NF(GPP_C9, NONE, DEEP, NF1),
60  /* C14 : BT_DISABLE_L */
61  PAD_CFG_GPO(GPP_C14, 0, DEEP),
62  /* PCH_WP_OD */
63  PAD_CFG_GPI(GPP_C20, NONE, DEEP),
64  /* C21 : H1_PCH_INT_ODL */
65  PAD_CFG_GPI_APIC(GPP_C21, NONE, PLTRST, LEVEL, INVERT),
66  /* C22 : EC_IN_RW_OD */
67  PAD_CFG_GPI(GPP_C22, NONE, DEEP),
68  /* C23 : WLAN_PE_RST# */
69  PAD_CFG_GPO(GPP_C23, 1, DEEP),
70  /* E1 : M2_SSD_PEDET */
71  PAD_CFG_NF(GPP_E1, NONE, DEEP, NF1),
72  /* E5 : SATA_DEVSLP1 */
73  PAD_CFG_NF(GPP_E5, NONE, PLTRST, NF1),
74  /* F2 : MEM_CH_SEL */
75  PAD_CFG_GPI(GPP_F2, NONE, PLTRST),
76 };
77 
78 const struct pad_config *variant_early_gpio_table(size_t *num)
79 {
81  return early_gpio_table;
82 }
#define GPP_H22
#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_H3
#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:47
#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