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 <soc/southbridge.h>
4 #include <soc/gpio.h>
5 
6 #include "gpio.h"
7 
8 /*
9  * As a rule of thumb, GPIO pins used by coreboot should be initialized at
10  * bootblock while GPIO pins used only by the OS should be initialized at
11  * ramstage.
12  */
13 static const struct soc_amd_gpio gpio_set_stage_reset[] = {
14  /* NFC PU */
15  PAD_GPO(GPIO_64, HIGH),
16  /* PCIe presence detect */
18  /* MUX for Power Express Eval */
20  /* SD power */
21  PAD_GPO(GPIO_119, HIGH),
22  /* GPIO_136 - UART0_FCH_RX_DEBUG_RX */
23  PAD_NF(GPIO_136, UART0_RXD, PULL_NONE),
24  /* GPIO_137 - UART0_FCH_DEBUG_RTS */
25  PAD_NF(GPIO_137, UART0_RTS_L, PULL_NONE),
26  /* GPIO_138 - UART0_FCH_TX_DEBUG_RX */
27  PAD_NF(GPIO_138, UART0_TXD, PULL_NONE),
28  /* GPIO_142 - UART1_FCH_RTS */
29  PAD_NF(GPIO_142, UART1_RTS_L, PULL_NONE),
30  /* GPIO_143 - UART1_FCH_TX */
31  PAD_NF(GPIO_143, UART1_TXD, PULL_NONE),
32 };
33 
34 static const struct soc_amd_gpio gpio_set_stage_ram[] = {
35  /* BT radio disable */
36  PAD_GPO(GPIO_14, HIGH),
37  /* NFC wake */
38  PAD_GPO(GPIO_65, HIGH),
39  /* Webcam */
40  PAD_GPO(GPIO_66, HIGH),
41  /* GPS sleep */
42  PAD_GPO(GPIO_70, HIGH),
43 };
44 
45 const struct soc_amd_gpio *early_gpio_table(size_t *size)
46 {
48  return gpio_set_stage_reset;
49 }
50 
51 const struct soc_amd_gpio *gpio_table(size_t *size)
52 {
54  return gpio_set_stage_ram;
55 }
#define GPIO_66
Definition: gpio_ftns.h:25
#define GPIO_64
Definition: gpio_ftns.h:24
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define PULL_DOWN
Definition: buildOpts.c:71
#define PULL_UP
Definition: buildOpts.c:70
#define PULL_NONE
Definition: buildOpts.c:72
static const struct soc_amd_gpio gpio_set_stage_reset[]
Definition: gpio.c:13
static const struct soc_amd_gpio gpio_set_stage_ram[]
Definition: gpio.c:34
const struct pad_config early_gpio_table[]
Definition: gpio.c:373
const struct pad_config gpio_table[]
Definition: gpio.c:33
#define GPIO_143
Definition: gpio.h:90
#define GPIO_69
Definition: gpio.h:55
#define GPIO_70
Definition: gpio.h:56
#define GPIO_116
Definition: gpio.h:78
#define GPIO_142
Definition: gpio.h:89
#define PAD_GPO(pin, direction)
Definition: gpio_defs.h:220
#define PAD_NF(pin, func, pull)
Definition: gpio_defs.h:208
#define PAD_GPI(pin, pull)
Definition: gpio_defs.h:216
#define GPIO_14
Definition: gpio.h:35
#define GPIO_136
Definition: gpio.h:91
#define GPIO_137
Definition: gpio.h:92
#define GPIO_138
Definition: gpio.h:93
#define GPIO_65
Definition: gpio.h:51
#define GPIO_119
Definition: gpio.h:86