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 <boardid.h>
6 #include <gpio.h>
7 #include <soc/gpio.h>
8 
9 /* This table is used by nipperkin variant with board version < 2. */
10 static const struct soc_amd_gpio bid1_override_gpio_table[] = {
11  /* Unused TP1056 */
12  PAD_NC(GPIO_4),
13  /* Unused TP1063 */
14  PAD_NC(GPIO_17),
15  PAD_NC(GPIO_18),
16  /* LCD_PRIVACY_PCH */
17  PAD_GPO(GPIO_5, HIGH),
18  /* GSC_SOC_INT_L */
19  PAD_INT(GPIO_3, PULL_NONE, EDGE_LOW, STATUS_DELIVERY),
20  /* Unused */
21  PAD_NC(GPIO_85),
22  /* EN_PWR_FP */
23  PAD_GPO(GPIO_32, LOW),
24  /* EN_SPKR */
25  PAD_GPO(GPIO_31, HIGH),
26  /* Unused TP27 */
27  PAD_NC(GPIO_70),
28 };
29 
30 /* This table is used by nipperkin variant with board version >= 2. */
31 static const struct soc_amd_gpio bid2_override_gpio_table[] = {
32  /* Unused TP1056 */
33  PAD_NC(GPIO_4),
34  /* Unused TP1063 */
35  PAD_NC(GPIO_17),
36  /* LCD_PRIVACY_PCH */
37  PAD_GPO(GPIO_18, HIGH),
38  /* SOC_SC_PWRSV */
39  PAD_GPO(GPIO_31, HIGH),
40  /* WWAN_DPR_SAR_ODL */
41  PAD_GPO(GPIO_42, HIGH),
42 };
43 
44 static const struct soc_amd_gpio override_early_gpio_table[] = {
45  PAD_NC(GPIO_18),
46  /* BID==1: EN_SPKR to select RAM_ID input, BID >= 1: Unused in later stages */
47  PAD_GPO(GPIO_31, LOW),
48 };
49 
50 static const struct soc_amd_gpio override_pcie_gpio_table[] = {
51  PAD_NC(GPIO_18),
52 };
53 
54 
55 /* This table is used by nipperkin variant with board version < 2. */
56 static const struct soc_amd_gpio bid1_tpm_gpio_table[] = {
57  /* I2C3_SCL */
58  PAD_NF(GPIO_19, I2C3_SCL, PULL_NONE),
59  /* I2C3_SDA */
60  PAD_NF(GPIO_20, I2C3_SDA, PULL_NONE),
61  /* GSC_SOC_INT_L */
62  PAD_INT(GPIO_3, PULL_NONE, EDGE_LOW, STATUS_DELIVERY),
63 };
64 
65 /* This table is used by nipperkin variant with board version >= 2. */
66 static const struct soc_amd_gpio bid2_tpm_gpio_table[] = {
67  /* I2C3_SCL */
68  PAD_NF(GPIO_19, I2C3_SCL, PULL_NONE),
69  /* I2C3_SDA */
70  PAD_NF(GPIO_20, I2C3_SDA, PULL_NONE),
71  /* GSC_SOC_INT_L */
72  PAD_INT(GPIO_85, PULL_NONE, EDGE_LOW, STATUS_DELIVERY),
73 };
74 
75 const struct soc_amd_gpio *variant_override_gpio_table(size_t *size)
76 {
77  uint32_t board_version = board_id();
78 
79  if (board_version < 2) {
82  }
83 
86 }
87 
89 {
92 }
93 
95 {
98 }
99 
100 const struct soc_amd_gpio *variant_tpm_gpio_table(size_t *size)
101 {
102  uint32_t board_version = board_id();
103 
104  if (board_version < 2) {
106  return bid1_tpm_gpio_table;
107  }
108 
110  return bid2_tpm_gpio_table;
111 }
#define GPIO_18
Definition: gpio_ftns.h:17
#define GPIO_17
Definition: gpio_ftns.h:16
#define GPIO_32
Definition: gpio_ftns.h:15
#define ARRAY_SIZE(a)
Definition: helpers.h:12
uint32_t board_id(void)
board_id() - Get the board version
Definition: ec_boardid.c:6
#define PULL_NONE
Definition: buildOpts.c:72
const struct pad_config *__weak variant_override_gpio_table(size_t *num)
Definition: gpio.c:450
const struct soc_amd_gpio *__weak variant_early_override_gpio_table(size_t *size)
Definition: gpio.c:317
const __weak struct soc_amd_gpio * variant_tpm_gpio_table(size_t *size)
Definition: gpio.c:354
const struct soc_amd_gpio *__weak variant_pcie_override_gpio_table(size_t *size)
Definition: gpio.c:330
static const struct soc_amd_gpio bid2_override_gpio_table[]
Definition: gpio.c:31
static const struct soc_amd_gpio bid1_override_gpio_table[]
Definition: gpio.c:10
static const struct soc_amd_gpio bid1_tpm_gpio_table[]
Definition: gpio.c:56
static const struct soc_amd_gpio override_pcie_gpio_table[]
Definition: gpio.c:50
static const struct soc_amd_gpio bid2_tpm_gpio_table[]
Definition: gpio.c:66
static const struct soc_amd_gpio override_early_gpio_table[]
Definition: gpio.c:44
#define GPIO_5
Definition: gpio.h:26
#define GPIO_4
Definition: gpio.h:25
#define GPIO_20
Definition: gpio.h:38
#define GPIO_19
Definition: gpio.h:37
#define GPIO_70
Definition: gpio.h:56
#define GPIO_31
Definition: gpio.h:47
#define GPIO_3
Definition: gpio.h:24
#define GPIO_85
Definition: gpio.h:61
#define GPIO_42
Definition: gpio.h:50
#define PAD_NC(pin)
Definition: gpio_defs.h:263
#define PAD_GPO(pin, direction)
Definition: gpio_defs.h:220
#define PAD_NF(pin, func, pull)
Definition: gpio_defs.h:208
#define PAD_INT(pin, pull, trigger, action)
Definition: gpio_defs.h:224
unsigned int uint32_t
Definition: stdint.h:14