1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
8 /* This table is used by nipperkin variant with board version < 2. */
9 static const struct soc_amd_gpio bid1_override_gpio_table
[] = {
16 PAD_GPO(GPIO_5
, HIGH
),
18 PAD_INT(GPIO_3
, PULL_NONE
, EDGE_LOW
, STATUS_DELIVERY
),
22 PAD_GPO(GPIO_32
, LOW
),
24 PAD_GPO(GPIO_31
, HIGH
),
29 /* This table is used by nipperkin variant with board version >= 2. */
30 static const struct soc_amd_gpio bid2_override_gpio_table
[] = {
36 PAD_GPO(GPIO_18
, HIGH
),
38 PAD_GPO(GPIO_31
, HIGH
),
39 /* WWAN_DPR_SAR_ODL */
40 PAD_GPO(GPIO_42
, HIGH
),
43 static const struct soc_amd_gpio override_early_gpio_table
[] = {
45 /* BID==1: EN_SPKR to select RAM_ID input, BID >= 1: Unused in later stages */
46 PAD_GPO(GPIO_31
, LOW
),
49 static const struct soc_amd_gpio override_romstage_gpio_table
[] = {
54 /* This table is used by nipperkin variant with board version < 2. */
55 static const struct soc_amd_gpio bid1_tpm_gpio_table
[] = {
57 PAD_NF(GPIO_19
, I2C3_SCL
, PULL_NONE
),
59 PAD_NF(GPIO_20
, I2C3_SDA
, PULL_NONE
),
61 PAD_INT(GPIO_3
, PULL_NONE
, EDGE_LOW
, STATUS_DELIVERY
),
64 /* This table is used by nipperkin variant with board version >= 2. */
65 static const struct soc_amd_gpio bid2_tpm_gpio_table
[] = {
67 PAD_NF(GPIO_19
, I2C3_SCL
, PULL_NONE
),
69 PAD_NF(GPIO_20
, I2C3_SDA
, PULL_NONE
),
71 PAD_INT(GPIO_85
, PULL_NONE
, EDGE_LOW
, STATUS_DELIVERY
),
74 const struct soc_amd_gpio
*variant_override_gpio_table(size_t *size
)
76 uint32_t board_version
= board_id();
78 if (board_version
< 2) {
79 *size
= ARRAY_SIZE(bid1_override_gpio_table
);
80 return bid1_override_gpio_table
;
83 *size
= ARRAY_SIZE(bid2_override_gpio_table
);
84 return bid2_override_gpio_table
;
87 const struct soc_amd_gpio
*variant_early_override_gpio_table(size_t *size
)
89 *size
= ARRAY_SIZE(override_early_gpio_table
);
90 return override_early_gpio_table
;
93 const struct soc_amd_gpio
*variant_romstage_override_gpio_table(size_t *size
)
95 *size
= ARRAY_SIZE(override_romstage_gpio_table
);
96 return override_romstage_gpio_table
;
99 const struct soc_amd_gpio
*variant_tpm_gpio_table(size_t *size
)
101 uint32_t board_version
= board_id();
103 if (board_version
< 2) {
104 *size
= ARRAY_SIZE(bid1_tpm_gpio_table
);
105 return bid1_tpm_gpio_table
;
108 *size
= ARRAY_SIZE(bid2_tpm_gpio_table
);
109 return bid2_tpm_gpio_table
;