cpu/x86/smm/pci_resource_store: Store DEV/VEN ID
[coreboot2.git] / src / mainboard / google / brya / variants / skolas / gpio.c
blob444adc4fa9afd0bd1125f1405dab81b86ef035c7
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <baseboard/variants.h>
4 #include <boardid.h>
5 #include <soc/gpio.h>
7 static const struct pad_config board_id0_1_overrides[] = {
8 /* B2 : VRALERT# ==> NC */
9 PAD_NC(GPP_B2, NONE),
10 /* B7 : ISH_12C1_SDA ==> PCH_I2C_TPM_SDA */
11 PAD_CFG_NF_LOCK(GPP_B7, NONE, NF2, LOCK_CONFIG),
12 /* B8 : ISH_12C1_SCL ==> PCH_I2C_TPM_SCL */
13 PAD_CFG_NF_LOCK(GPP_B8, NONE, NF2, LOCK_CONFIG),
14 /* B15 : TIME_SYNC0 ==> NC */
15 PAD_NC(GPP_B15, NONE),
16 /* C3 : SML0CLK ==> NC */
17 PAD_NC(GPP_C3, NONE),
18 /* C4 : SML0DATA ==> NC */
19 PAD_NC(GPP_C4, NONE),
20 /* D13 : ISH_UART0_RXD ==> PCH_I2C_CAM_SDA */
21 PAD_CFG_NF(GPP_D13, NONE, DEEP, NF3),
22 /* D14 : ISH_UART0_TXD ==> PCH_I2C_CAM_SCL */
23 PAD_CFG_NF(GPP_D14, NONE, DEEP, NF3),
24 /* F19 : SRCCLKREQ6# ==> WWAN_SIM1_DET_OD */
25 PAD_CFG_GPI(GPP_F19, UP_20K, DEEP),
26 /* F20 : EXT_PWR_GATE# ==> HPS_RST_R */
27 PAD_CFG_GPO(GPP_F20, 0, DEEP),
28 /* F21 : EXT_PWR_GATE2# ==> WAKE_ON_WWAN_ODL */
29 PAD_NC(GPP_F21, NONE),
30 /* H13 : I2C7_SCL ==> EN_PP3300_SD */
31 PAD_CFG_GPO(GPP_H13, 1, DEEP),
32 /* H21 : IMGCLKOUT2 ==> WLAN_INT_L */
33 PAD_CFG_GPI_APIC(GPP_H21, NONE, DEEP, EDGE_SINGLE, NONE),
34 /* GPD2: LAN_WAKE# ==> NC */
35 PAD_NC(GPD2, NONE),
38 /* Early pad configuration in bootblock for board id < 2 */
39 static const struct pad_config early_gpio_table[] = {
40 /* A13 : PMC_I2C_SCL ==> GSC_PCH_INT_ODL */
41 PAD_CFG_GPI_APIC(GPP_A13, NONE, PLTRST, LEVEL, INVERT),
42 /* B7 : ISH_12C1_SDA ==> PCH_I2C_TPM_SDA */
43 PAD_CFG_NF(GPP_B7, NONE, DEEP, NF2),
44 /* B8 : ISH_12C1_SCL ==> PCH_I2C_TPM_SCL */
45 PAD_CFG_NF(GPP_B8, NONE, DEEP, NF2),
47 * D1 : ISH_GP1 ==> FP_RST_ODL
48 * FP_RST_ODL comes out of reset as hi-z and does not have an external pull-down.
49 * To ensure proper power sequencing for the FPMCU device, reset signal is driven low
50 * early on in bootblock, followed by enabling of power. Reset signal is deasserted
51 * later on in ramstage. Since reset signal is asserted in bootblock, it results in
52 * FPMCU not working after a S3 resume. This is a known issue.
54 PAD_CFG_GPO(GPP_D1, 0, DEEP),
55 /* D2 : ISH_GP2 ==> EN_FP_PWR */
56 PAD_CFG_GPO(GPP_D2, 1, DEEP),
57 /* E0 : SATAXPCIE0 ==> WWAN_PERST_L (updated in ramstage) */
58 PAD_CFG_GPO(GPP_E0, 0, DEEP),
59 /* E13 : THC0_SPI1_IO2 ==> MEM_CH_SEL */
60 PAD_CFG_GPI(GPP_E13, NONE, DEEP),
61 /* E16 : RSVD_TP ==> WWAN_RST_L (updated in ramstage) */
62 PAD_CFG_GPO(GPP_E16, 0, DEEP),
63 /* E15 : RSVD_TP ==> PCH_WP_OD */
64 PAD_CFG_GPI_GPIO_DRIVER(GPP_E15, NONE, DEEP),
65 /* F18 : THC1_SPI2_INT# ==> EC_IN_RW_OD */
66 PAD_CFG_GPI(GPP_F18, NONE, DEEP),
67 /* F21 : EXT_PWR_GATE2# ==> NC */
68 PAD_NC(GPP_F21, NONE),
69 /* H10 : UART0_RXD ==> UART_PCH_RX_DBG_TX */
70 PAD_CFG_NF(GPP_H10, NONE, DEEP, NF2),
71 /* H11 : UART0_TXD ==> UART_PCH_TX_DBG_RX */
72 PAD_CFG_NF(GPP_H11, NONE, DEEP, NF2),
73 /* H13 : I2C7_SCL ==> EN_PP3300_SD */
74 PAD_CFG_GPO(GPP_H13, 1, DEEP),
77 /* Early pad configuration in bootblock for board id 2 */
78 static const struct pad_config early_gpio_table_id2[] = {
79 /* A12 : SATAXPCIE1 ==> EN_PP3300_WWAN */
80 PAD_CFG_GPO(GPP_A12, 1, DEEP),
81 /* A13 : PMC_I2C_SCL ==> GSC_PCH_INT_ODL */
82 PAD_CFG_GPI_APIC(GPP_A13, NONE, PLTRST, LEVEL, INVERT),
83 /* B4 : PROC_GP3 ==> SSD_PERST_L */
84 PAD_CFG_GPO(GPP_B4, 0, DEEP),
85 /* B7 : ISH_12C1_SDA ==> PCH_I2C_TPM_SDA */
86 PAD_CFG_NF(GPP_B7, NONE, DEEP, NF2),
87 /* B8 : ISH_12C1_SCL ==> PCH_I2C_TPM_SCL */
88 PAD_CFG_NF(GPP_B8, NONE, DEEP, NF2),
90 * D1 : ISH_GP1 ==> FP_RST_ODL
91 * FP_RST_ODL comes out of reset as hi-z and does not have an external pull-down.
92 * To ensure proper power sequencing for the FPMCU device, reset signal is driven low
93 * early on in bootblock, followed by enabling of power. Reset signal is deasserted
94 * later on in ramstage. Since reset signal is asserted in bootblock, it results in
95 * FPMCU not working after a S3 resume. This is a known issue.
97 PAD_CFG_GPO(GPP_D1, 0, DEEP),
98 /* D2 : ISH_GP2 ==> EN_FP_PWR */
99 PAD_CFG_GPO(GPP_D2, 1, DEEP),
100 /* D11 : ISH_SPI_MISO ==> EN_PP3300_SSD */
101 PAD_CFG_GPO(GPP_D11, 1, DEEP),
102 /* E0 : SATAXPCIE0 ==> WWAN_PERST_L (updated in ramstage) */
103 PAD_CFG_GPO(GPP_E0, 0, DEEP),
104 /* E13 : THC0_SPI1_IO2 ==> MEM_CH_SEL */
105 PAD_CFG_GPI(GPP_E13, NONE, DEEP),
106 /* E16 : RSVD_TP ==> WWAN_RST_L (updated in ramstage) */
107 PAD_CFG_GPO(GPP_E16, 0, DEEP),
108 /* E15 : RSVD_TP ==> PCH_WP_OD */
109 PAD_CFG_GPI_GPIO_DRIVER(GPP_E15, NONE, DEEP),
110 /* F18 : THC1_SPI2_INT# ==> EC_IN_RW_OD */
111 PAD_CFG_GPI(GPP_F18, NONE, DEEP),
112 /* F21 : EXT_PWR_GATE2# ==> WWAN_FCPO_L (updated in romstage) */
113 PAD_CFG_GPO(GPP_F21, 0, DEEP),
114 /* H10 : UART0_RXD ==> UART_PCH_RX_DBG_TX */
115 PAD_CFG_NF(GPP_H10, NONE, DEEP, NF2),
116 /* H11 : UART0_TXD ==> UART_PCH_TX_DBG_RX */
117 PAD_CFG_NF(GPP_H11, NONE, DEEP, NF2),
118 /* H13 : I2C7_SCL ==> EN_PP3300_SD */
119 PAD_NC(GPP_H13, UP_20K),
122 /* Early pad configuration in bootblock for board id 4 */
123 static const struct pad_config early_gpio_table_id4[] = {
124 /* A12 : SATAXPCIE1 ==> EN_PP3300_WWAN */
125 PAD_CFG_GPO(GPP_A12, 1, DEEP),
126 /* A13 : PMC_I2C_SCL ==> GSC_PCH_INT_ODL */
127 PAD_CFG_GPI_APIC(GPP_A13, NONE, PLTRST, LEVEL, INVERT),
128 /* B4 : PROC_GP3 ==> SSD_PERST_L */
129 PAD_CFG_GPO(GPP_B4, 0, DEEP),
130 /* H6 : ISH_12C1_SDA ==> PCH_I2C_TPM_SDA */
131 PAD_CFG_NF(GPP_H6, NONE, DEEP, NF1),
132 /* H7 : ISH_12C1_SCL ==> PCH_I2C_TPM_SCL */
133 PAD_CFG_NF(GPP_H7, NONE, DEEP, NF1),
135 * D1 : ISH_GP1 ==> FP_RST_ODL
136 * FP_RST_ODL comes out of reset as hi-z and does not have an external
137 * pull-down. To ensure proper power sequencing for the FPMCU device,
138 * reset signal is driven low early on in bootblock, followed by
139 * enabling of power. Reset signal is deasserted later on in ramstage.
140 * Since reset signal is asserted in bootblock, it results in FPMCU not
141 * working after a S3 resume. This is a known issue.
143 PAD_CFG_GPO(GPP_D1, 0, DEEP),
144 /* D2 : ISH_GP2 ==> EN_FP_PWR */
145 PAD_CFG_GPO(GPP_D2, 1, DEEP),
146 /* D11 : ISH_SPI_MISO ==> EN_PP3300_SSD */
147 PAD_CFG_GPO(GPP_D11, 1, DEEP),
148 /* E0 : SATAXPCIE0 ==> WWAN_PERST_L (updated in ramstage) */
149 PAD_CFG_GPO(GPP_E0, 0, DEEP),
150 /* E13 : THC0_SPI1_IO2 ==> MEM_CH_SEL */
151 PAD_CFG_GPI(GPP_E13, NONE, DEEP),
152 /* E16 : RSVD_TP ==> WWAN_RST_L (updated in ramstage) */
153 PAD_CFG_GPO(GPP_E16, 0, DEEP),
154 /* E15 : RSVD_TP ==> PCH_WP_OD */
155 PAD_CFG_GPI_GPIO_DRIVER(GPP_E15, NONE, DEEP),
156 /* F18 : THC1_SPI2_INT# ==> EC_IN_RW_OD */
157 PAD_CFG_GPI(GPP_F18, NONE, DEEP),
158 /* F21 : EXT_PWR_GATE2# ==> WWAN_FCPO_L (updated in romstage) */
159 PAD_CFG_GPO(GPP_F21, 0, DEEP),
160 /* H10 : UART0_RXD ==> UART_PCH_RX_DBG_TX */
161 PAD_CFG_NF(GPP_H10, NONE, DEEP, NF2),
162 /* H11 : UART0_TXD ==> UART_PCH_TX_DBG_RX */
163 PAD_CFG_NF(GPP_H11, NONE, DEEP, NF2),
164 /* H13 : I2C7_SCL ==> EN_PP3300_SD */
165 PAD_NC(GPP_H13, UP_20K),
168 static const struct pad_config romstage_gpio_table[] = {
169 /* B4 : PROC_GP3 ==> SSD_PERST_L */
170 PAD_CFG_GPO(GPP_B4, 1, DEEP),
172 /* Enable touchscreen, hold in reset */
173 /* C0 : SMBCLK ==> EN_PP3300_TCHSCR */
174 PAD_CFG_GPO(GPP_C0, 1, DEEP),
175 /* C1 : SMBDATA ==> USI_RST_L */
176 PAD_CFG_GPO(GPP_C1, 0, DEEP),
178 /* D1 : ISH_GP1 ==> FP_RST_ODL */
179 PAD_CFG_GPO(GPP_D1, 0, DEEP),
180 /* D2 : ISH_GP2 ==> EN_FP_PWR */
181 PAD_CFG_GPO(GPP_D2, 0, DEEP),
183 /* F21 : EXT_PWR_GATE2# ==> WWAN_FCPO_L (set here for correct power sequencing) */
184 PAD_CFG_GPO(GPP_F21, 1, DEEP),
187 const struct pad_config *variant_gpio_override_table(size_t *num)
189 const uint32_t id = board_id();
190 if (id == BOARD_ID_UNKNOWN || id < 2) {
191 *num = ARRAY_SIZE(board_id0_1_overrides);
192 return board_id0_1_overrides;
195 *num = 0;
196 return NULL;
199 const struct pad_config *variant_early_gpio_table(size_t *num)
201 const uint32_t id = board_id();
202 if (id == BOARD_ID_UNKNOWN || id < 2) {
203 *num = ARRAY_SIZE(early_gpio_table);
204 return early_gpio_table;
205 } else if (id >= 4) {
206 *num = ARRAY_SIZE(early_gpio_table_id4);
207 return early_gpio_table_id4;
210 *num = ARRAY_SIZE(early_gpio_table_id2);
211 return early_gpio_table_id2;
214 const struct pad_config *variant_romstage_gpio_table(size_t *num)
216 *num = ARRAY_SIZE(romstage_gpio_table);
217 return romstage_gpio_table;