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 <types.h>
6 #include <vendorcode/google/chromeos/chromeos.h>
7 
8 /* Pad configuration in ramstage */
9 static const struct pad_config gpio_table[] = {
10 /* I2S2_SCLK */
11 PAD_CFG_GPI(GPP_A7, NONE, PLTRST),
12 /* I2S2_RXD */
13 PAD_CFG_GPI(GPP_A10, NONE, PLTRST),
14 /* TCH_PNL2_RST_N */
15 PAD_CFG_GPO(GPP_A13, 1, DEEP),
16 /* ONBOARD_X4_PCIE_SLOT1_PWREN_N */
17 PAD_CFG_GPO(GPP_A14, 0, DEEP),
18 /* TCH_PNL2_INT_N */
20 /* TC_RETIMER_FORCE_PWR */
21 PAD_CFG_GPO(GPP_B4, 0, DEEP),
22 /* FPS_RST_N */
23 PAD_CFG_GPO(GPP_B14, 1, DEEP),
24 /* WIFI_RF_KILL_N */
25 PAD_CFG_GPO(GPP_B15, 1, PLTRST),
26 /* M2_SSD_PWREN_N */
27 PAD_CFG_GPO(GPP_B16, 1, DEEP),
28 /* WWAN_PERST_N */
29 PAD_CFG_GPO(GPP_B17, 1, DEEP),
30 /* BT_RF_KILL_N */
31 PAD_CFG_GPO(GPP_B18, 1, PLTRST),
32 /* CRD_CAM_PWREN_1 */
33 PAD_CFG_GPO(GPP_B23, 1, PLTRST),
34 /* WF_CAM_CLK_EN */
35 PAD_CFG_GPO(GPP_C2, 1, PLTRST),
36 /* ONBOARD_X4_PCIE_SLOT1_RESET_N */
37 PAD_CFG_GPO(GPP_C5, 1, DEEP),
38 /* TCH_PAD_INT_N */
40 /* WWAN_RST_N */
41 PAD_CFG_GPO(GPP_C10, 1, DEEP),
42 /* WWAN_FCP_OFF_N */
43 PAD_CFG_GPO(GPP_C11, 1, DEEP),
44 /* CODEC_INT_N */
46 /* SPKR_PD_N */
47 PAD_CFG_GPO(GPP_C13, 1, PLTRST),
48 /* WF_CAM_RST_N */
49 PAD_CFG_GPO(GPP_C15, 1, PLTRST),
50 /* CRD_CAM_STROBE_1 */
51 PAD_CFG_GPO(GPP_C22, 0, PLTRST),
52 /* CRD_CAM_PRIVACY_LED_1 */
53 PAD_CFG_GPO(GPP_C23, 0, PLTRST),
54 /* FLASH_DES_SEC_OVERRIDEs */
55 PAD_CFG_GPO(GPP_D13, 0, DEEP),
56 /* TCH_PAD_LS_EN */
57 PAD_CFG_GPO(GPP_D14, 1, PLTRST),
58 /* ONBOARD_X4_PCIE_SLOT1_DGPU_SEL */
59 PAD_CFG_GPO(GPP_D15, 0, DEEP),
60 /* MFR_MODE_DET_STRAP */
61 PAD_CFG_GPI(GPP_D16, NONE, PLTRST),
62 /* TBT_CIO_PWR_EN */
63 PAD_CFG_GPO(GPP_E0, 1, DEEP),
64 /* FPS_INT */
65 PAD_CFG_GPI_APIC(GPP_E3, NONE, PLTRST, LEVEL, NONE),
66 /* EC_SLP_S0_CS_N */
67 PAD_CFG_GPO(GPP_E6, 1, DEEP),
68 /* EC_SMI_N */
69 PAD_CFG_GPI_SMI(GPP_E7, NONE, DEEP, LEVEL, NONE),
70 /* TBT_CIO_PLUG_EVENT_N */
71 PAD_CFG_GPI_SCI(GPP_E17, NONE, DEEP, EDGE_SINGLE, NONE),
72 /* DISP_AUX_P_BIAS_GPIO */
73 PAD_CFG_GPO(GPP_E22, 0, PLTRST),
74 /* DISP_AUX_N_BIAS_GPIO */
75 PAD_CFG_GPO(GPP_E23, 1, DEEP),
76 /* SATA_HDD_PWREN */
77 PAD_CFG_GPO(GPP_F4, 1, PLTRST),
78 /* BIOS_REC */
79 PAD_CFG_GPI(GPP_F5, NONE, PLTRST),
80 /* SD_CD# */
81 PAD_CFG_NF(GPP_G5, UP_20K, PWROK, NF1),
82 /* SD_WP */
83 PAD_CFG_NF(GPP_G7, DN_20K, PWROK, NF1),
84 /* M2_SSD_RST_N */
85 PAD_CFG_GPO(GPP_H0, 1, DEEP),
86 };
87 
88 /* Early pad configuration in bootblock */
89 static const struct pad_config early_gpio_table[] = {
90  /* UART2 RX */
91  PAD_CFG_NF(GPP_C20, NONE, DEEP, NF1),
92  /* UART2 TX */
93  PAD_CFG_NF(GPP_C21, NONE, DEEP, NF1),
94 };
95 
96 const struct pad_config *variant_gpio_table(size_t *num)
97 {
98  *num = ARRAY_SIZE(gpio_table);
99  return gpio_table;
100 }
101 
102 const struct pad_config *variant_early_gpio_table(size_t *num)
103 {
105  return early_gpio_table;
106 }
107 
108 static const struct cros_gpio cros_gpios[] = {
109  CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE_NAME),
110 };
111 
#define GPP_C15
#define GPP_C2
#define GPP_E3
#define GPP_C12
#define GPP_E0
#define GPP_D14
#define GPP_C5
#define GPP_A14
#define GPP_B16
Definition: gpio_soc_defs.h:69
#define GPP_E6
#define GPP_C22
#define GPP_F5
#define GPP_B15
Definition: gpio_soc_defs.h:68
#define GPP_C23
#define GPP_C8
#define GPP_C11
#define GPP_C13
#define GPP_E23
#define GPP_A7
#define GPP_C20
#define GPP_C10
#define GPP_E7
#define GPP_E17
#define GPP_H0
#define GPP_C21
#define GPP_F4
#define GPP_A10
#define GPP_B14
Definition: gpio_soc_defs.h:67
#define GPP_D13
#define GPP_B18
Definition: gpio_soc_defs.h:71
#define GPP_A13
#define GPP_B23
Definition: gpio_soc_defs.h:76
#define GPP_B3
Definition: gpio_soc_defs.h:56
#define GPP_D15
#define GPP_B4
Definition: gpio_soc_defs.h:57
#define GPP_D16
#define GPP_E22
#define GPP_B17
Definition: gpio_soc_defs.h:70
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define GPP_G7
Definition: gpio_soc_defs.h:95
#define GPP_G5
Definition: gpio_soc_defs.h:93
const struct pad_config * variant_early_gpio_table(size_t *num)
Definition: gpio.c:204
const struct pad_config *__weak variant_gpio_table(size_t *num)
Definition: gpio.c:406
DECLARE_CROS_GPIOS(cros_gpios)
static const struct pad_config gpio_table[]
Definition: gpio.c:9
static const struct pad_config early_gpio_table[]
Definition: gpio.c:89
static const struct cros_gpio cros_gpios[]
Definition: gpio.c:108
#define CROS_GPIO_DEVICE_NAME
Definition: gpio.h:14
#define PAD_CFG_GPI(pad, pull, rst)
Definition: gpio_defs.h:284
#define PAD_CFG_GPI_SMI(pad, pull, rst, trig, inv)
Definition: gpio_defs.h:412
#define PAD_CFG_NF(pad, pull, rst, func)
Definition: gpio_defs.h:197
#define PAD_CFG_GPI_APIC_EDGE_LOW(pad, pull, rst)
Definition: gpio_defs.h:408
#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
#define PAD_CFG_GPI_APIC_LOW(pad, pull, rst)
Definition: gpio_defs.h:402