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  /* A14 : USB_OC1# ==> NC */
12  /* A19 : DDSP_HPD1 ==> NC */
14  /* A20 : DDSP_HPD2 ==> DDIC_DP_HPD4 */
15  PAD_CFG_NF(GPP_A20, NONE, DEEP, NF1),
16  /* A21 : DDPC_CTRCLK ==> DDIC_DP_CTRCLK */
17  PAD_CFG_NF(GPP_A21, NONE, DEEP, NF1),
18  /* A22 : DDPC_CTRLDATA ==> DDIC_DP_CTRLDATA */
19  PAD_CFG_NF(GPP_A22, NONE, DEEP, NF1),
20 
21  /* B2 : VRALERT# ==> NC */
22  PAD_NC(GPP_B2, NONE),
23  /* B3 : PROC_GP2 ==> EMMC_PERST_L */
24  PAD_CFG_GPO(GPP_B3, 1, DEEP),
25 
26  /* D6 : SRCCLKREQ1# ==> EMMC_CLKREQ_ODL */
27  PAD_CFG_NF(GPP_D6, NONE, DEEP, NF1),
28  /* D14 : ISH_UART0_TXD ==> USB_A1_RT_RST_ODL */
29  PAD_CFG_GPO(GPP_D14, 1, DEEP),
30 
31  /* E1 : THC0_SPI1_IO2 ==> B2B_HDMICARD_DETN */
32  PAD_CFG_GPI(GPP_E1, NONE, DEEP),
33  /* E2 : THC0_SPI1_IO3 ==> B2B_DPCARD_DETN */
34  PAD_CFG_GPI(GPP_E2, NONE, DEEP),
35  /* E14 : DDSP_HPDA ==> HDMI2_HPD */
36  PAD_CFG_GPI(GPP_E14, NONE, DEEP),
37  /* E20 : DDP2_CTRLCLK ==> EN_PP3300_EMMC */
38  PAD_CFG_GPO(GPP_E20, 1, DEEP),
39  /* E21 : DDP2_CTRLDATA ==> NC */
41 
42  /* H19 : SRCCLKREQ4# ==> LAN_I225V_CLKREQ_ODL */
43  PAD_CFG_NF(GPP_H19, NONE, DEEP, NF1),
44 
45  /* R6 : I2S2_TXD ==> NC */
46  PAD_NC(GPP_R6, NONE),
47  /* R7 : I2S2_RXD ==> NC */
48  PAD_NC(GPP_R7, NONE),
49 
50  /* GPD11: LANPHYC ==> LAN_DISABLE_N */
51  PAD_CFG_GPO(GPD11, 0, DEEP),
52 };
53 
54 
55 /* Early pad configuration in bootblock */
56 static const struct pad_config early_gpio_table[] = {
57  /* A13 : PMC_I2C_SCL ==> GSC_PCH_INT_ODL */
58  PAD_CFG_GPI_APIC(GPP_A13, NONE, PLTRST, LEVEL, INVERT),
59  /* B3 : PROC_GP2 ==> EMMC_PERST_L */
60  PAD_CFG_GPO(GPP_B3, 0, DEEP),
61  /* B4 : PROC_GP3 ==> SSD_PERST_L */
62  PAD_CFG_GPO(GPP_B4, 0, DEEP),
63  /*
64  * D1 : ISH_GP1 ==> FP_RST_ODL
65  * FP_RST_ODL comes out of reset as hi-z and does not have an external pull-down.
66  * To ensure proper power sequencing for the FPMCU device, reset signal is driven low
67  * early on in bootblock, followed by enabling of power. Reset signal is deasserted
68  * later on in ramstage. Since reset signal is asserted in bootblock, it results in
69  * FPMCU not working after a S3 resume. This is a known issue.
70  */
71  PAD_CFG_GPO(GPP_D1, 0, DEEP),
72  /* D2 : ISH_GP2 ==> EN_FP_PWR */
73  PAD_CFG_GPO(GPP_D2, 1, DEEP),
74  /* D18 : UART1_TXD ==> SD_PE_RST_L */
75  PAD_CFG_GPO(GPP_D18, 0, PLTRST),
76  /* E15 : RSVD_TP ==> PCH_WP_OD */
78  /* E20 : DDP2_CTRLCLK ==> EN_PP3300_EMMC */
79  PAD_CFG_GPO(GPP_E20, 1, DEEP),
80  /* F14 : GSXDIN ==> EN_PP3300_SSD */
81  PAD_CFG_GPO(GPP_F14, 1, DEEP),
82  /* F18 : THC1_SPI2_INT# ==> EC_IN_RW_OD */
83  PAD_CFG_GPI(GPP_F18, NONE, DEEP),
84  /* H6 : I2C1_SDA ==> PCH_I2C_TPM_SDA */
85  PAD_CFG_NF(GPP_H6, NONE, DEEP, NF1),
86  /* H7 : I2C1_SCL ==> PCH_I2C_TPM_SCL */
87  PAD_CFG_NF(GPP_H7, NONE, DEEP, NF1),
88  /* H10 : UART0_RXD ==> UART_PCH_RX_DBG_TX */
89  PAD_CFG_NF(GPP_H10, NONE, DEEP, NF2),
90  /* H11 : UART0_TXD ==> UART_PCH_TX_DBG_RX */
91  PAD_CFG_NF(GPP_H11, NONE, DEEP, NF2),
92  /* H13 : I2C7_SCL ==> EN_PP3300_SD */
93  PAD_CFG_GPO(GPP_H13, 1, DEEP),
94 
95  /* CPU PCIe VGPIO for PEG60 */
96  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_48, NONE, PLTRST, NF1),
97  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_49, NONE, PLTRST, NF1),
98  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_50, NONE, PLTRST, NF1),
99  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_51, NONE, PLTRST, NF1),
100  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_52, NONE, PLTRST, NF1),
101  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_53, NONE, PLTRST, NF1),
102  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_54, NONE, PLTRST, NF1),
103  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_55, NONE, PLTRST, NF1),
104  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_56, NONE, PLTRST, NF1),
105  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_57, NONE, PLTRST, NF1),
106  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_58, NONE, PLTRST, NF1),
107  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_59, NONE, PLTRST, NF1),
108  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_60, NONE, PLTRST, NF1),
109  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_61, NONE, PLTRST, NF1),
110  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_62, NONE, PLTRST, NF1),
111  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_63, NONE, PLTRST, NF1),
112  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_76, NONE, PLTRST, NF1),
113  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_77, NONE, PLTRST, NF1),
114  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_78, NONE, PLTRST, NF1),
115  PAD_CFG_NF_VWEN(GPP_vGPIO_PCIE_79, NONE, PLTRST, NF1),
116 };
117 
118 static const struct pad_config romstage_gpio_table[] = {
119  /* B4 : PROC_GP3 ==> SSD_PERST_L */
120  PAD_CFG_GPO(GPP_B4, 1, DEEP),
121  /* D18 : UART1_TXD ==> SD_PE_RST_L */
122  PAD_CFG_GPO(GPP_D18, 1, DEEP),
123 };
124 
125 const struct pad_config *variant_gpio_override_table(size_t *num)
126 {
128  return override_gpio_table;
129 }
130 
131 const struct pad_config *variant_early_gpio_table(size_t *num)
132 {
134  return early_gpio_table;
135 }
136 
137 const struct pad_config *variant_romstage_gpio_table(size_t *num)
138 {
140  return romstage_gpio_table;
141 }
#define GPD11
#define GPP_vGPIO_PCIE_57
#define GPP_H19
#define GPP_D1
#define GPP_vGPIO_PCIE_48
#define GPP_vGPIO_PCIE_55
#define GPP_vGPIO_PCIE_78
#define GPP_R7
#define GPP_vGPIO_PCIE_76
#define GPP_D14
#define GPP_H11
#define GPP_vGPIO_PCIE_53
#define GPP_vGPIO_PCIE_62
#define GPP_A14
#define GPP_B2
Definition: gpio_soc_defs.h:55
#define GPP_vGPIO_PCIE_49
#define GPP_vGPIO_PCIE_50
#define GPP_vGPIO_PCIE_77
#define GPP_D6
#define GPP_A19
#define GPP_D2
#define GPP_H6
#define GPP_R6
#define GPP_H13
#define GPP_H7
#define GPP_E14
#define GPP_vGPIO_PCIE_60
#define GPP_vGPIO_PCIE_54
#define GPP_A20
#define GPP_D18
#define GPP_E2
#define GPP_F14
#define GPP_vGPIO_PCIE_52
#define GPP_E20
#define GPP_A13
#define GPP_vGPIO_PCIE_59
#define GPP_A21
#define GPP_E15
#define GPP_vGPIO_PCIE_61
#define GPP_vGPIO_PCIE_63
#define GPP_vGPIO_PCIE_58
#define GPP_F18
#define GPP_B3
Definition: gpio_soc_defs.h:56
#define GPP_A22
#define GPP_vGPIO_PCIE_51
#define GPP_vGPIO_PCIE_79
#define GPP_B4
Definition: gpio_soc_defs.h:57
#define GPP_H10
#define GPP_E21
#define GPP_vGPIO_PCIE_56
#define GPP_E1
#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:118
static const struct pad_config early_gpio_table[]
Definition: gpio.c:56
#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_NF_VWEN(pad, pull, rst, func)
Definition: gpio_defs.h:241
#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