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  /* A8 : WWAN_RF_DISABLE_ODL */
11  PAD_NC(GPP_A8, NONE),
12  /* A21 : GPP_A21 ==> USB_C1_AUX_DC_P */
13  PAD_CFG_GPO(GPP_A21, 0, DEEP),
14  /* A22 : GPP_A22 ==> USB_C1_AUX_DC_N */
15  PAD_CFG_GPO(GPP_A22, 1, DEEP),
16 
17  /* B5 : SOC_I2C_SUB_SDA */
18  PAD_NC(GPP_B5, NONE),
19  /* B6 : SOC_I2C_SUB_SCL */
20  PAD_NC(GPP_B6, NONE),
21 
22  /* D3 : WCAM_RST_L */
23  PAD_NC(GPP_D3, NONE),
24  /* D6 : WWAN_EN */
25  PAD_NC(GPP_D6, NONE),
26  /* D15 : EN_PP2800_WCAM_X */
28  /* D16 : EN_PP1800_PP1200_WCAM_X */
30 
31  /* F12 : WWAN_RST_L */
33 
34  /* H19 : SOC_I2C_SUB_INT_ODL */
36  /* H22 : WCAM_MCLK_R */
38  /* H23 : WWAN_SAR_DETECT_ODL */
40 };
41 
42 /* Early pad configuration in bootblock */
43 static const struct pad_config early_gpio_table[] = {
44  /* B11 : PMCALERT# ==> EN_PP3300_WLAN_X */
45  PAD_CFG_GPO(GPP_B11, 0, DEEP),
46  /* H12 : UART0_RTS# ==> SD_PERST_L */
47  PAD_CFG_GPO(GPP_H12, 0, DEEP),
48  /* H20 : IMGCLKOUT1 ==> WLAN_PERST_L */
49  PAD_CFG_GPO(GPP_H20, 0, DEEP),
50  /* A13 : GPP_A13 ==> GSC_SOC_INT_ODL */
51  PAD_CFG_GPI_APIC(GPP_A13, NONE, PLTRST, LEVEL, INVERT),
52  /* E12 : THC0_SPI1_IO1 ==> SOC_WP_OD */
54  /* F18 : THC1_SPI2_INT# ==> EC_IN_RW_OD */
55  PAD_CFG_GPI(GPP_F18, NONE, DEEP),
56  /* H4 : I2C0_SDA ==> SOC_I2C_GSC_SDA */
57  PAD_CFG_NF(GPP_H4, NONE, DEEP, NF1),
58  /* H5 : I2C0_SCL ==> SOC_I2C_GSC_SCL */
59  PAD_CFG_NF(GPP_H5, NONE, DEEP, NF1),
60  /* H10 : UART0_RXD ==> UART_SOC_RX_DBG_TX */
61  PAD_CFG_NF(GPP_H10, NONE, DEEP, NF2),
62  /* H11 : UART0_TXD ==> UART_SOC_TX_DBG_RX */
63  PAD_CFG_NF(GPP_H11, NONE, DEEP, NF2),
64  /* H13 : UART0_CTS# ==> EN_PP3300_SD_X */
65  PAD_CFG_GPO(GPP_H13, 1, DEEP),
66 };
67 
68 static const struct pad_config romstage_gpio_table[] = {
69  /* B11 : PMCALERT# ==> EN_PP3300_WLAN_X */
70  PAD_CFG_GPO(GPP_B11, 1, DEEP),
71  /* H12 : UART0_RTS# ==> SD_PERST_L */
72  PAD_CFG_GPO(GPP_H12, 1, DEEP),
73 };
74 
75 const struct pad_config *variant_gpio_override_table(size_t *num)
76 {
78  return override_gpio_table;
79 }
80 
81 const struct pad_config *variant_early_gpio_table(size_t *num)
82 {
84  return early_gpio_table;
85 }
86 
87 const struct pad_config *variant_romstage_gpio_table(size_t *num)
88 {
90  return romstage_gpio_table;
91 }
#define GPP_H22
#define GPP_H20
#define GPP_B6
Definition: gpio_soc_defs.h:59
#define GPP_H19
#define GPP_F12
#define GPP_H11
#define GPP_D6
#define GPP_H12
#define GPP_H13
#define GPP_H5
#define GPP_A8
#define GPP_B11
Definition: gpio_soc_defs.h:64
#define GPP_B5
Definition: gpio_soc_defs.h:58
#define GPP_A13
#define GPP_A21
#define GPP_F18
#define GPP_A22
#define GPP_D15
#define GPP_D16
#define GPP_H10
#define GPP_E12
#define GPP_H4
#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:68
static const struct pad_config early_gpio_table[]
Definition: gpio.c:43
#define PAD_NC(pin)
Definition: gpio_defs.h:263
#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_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_GPIO_DRIVER(pad, pull, rst)
Definition: gpio_defs.h:323