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 
5 #include <soc/gpio.h>
6 #include <soc/southbridge.h>
7 #include "gpio.h"
8 
9 /*
10  * As a rule of thumb, GPIO pins used by coreboot should be initialized at
11  * bootblock while GPIO pins used only by the OS should be initialized at
12  * ramstage.
13  */
14 static const struct soc_amd_gpio gpio_set_stage_reset[] = {
15  /* GFX presence detect */
17  /* VDDP_VCTRL */
18  PAD_GPO(GPIO_40, HIGH),
19  /* PC SPKR */
20  PAD_NF(GPIO_91, SPKR, PULL_NONE),
21 };
22 
23 static const struct soc_amd_gpio gpio_set_stage_ram[] = {
24 #if CONFIG(HAVE_ACPI_RESUME)
25  /* PCIE_WAKE - default, do not program */
26 
27  /* DEVSLP1 */
28  PAD_NF(GPIO_70, DEVSLP1, PULL_UP),
29  /* WLAND */
30  PAD_WAKE(GPIO_137, PULL_UP, LEVEL_LOW, S3),
31 #else
32  /* PCIE_WAKE, SCI */
33  PAD_NF_SCI(GPIO_2, WAKE_L, PULL_UP, EDGE_LOW),
34  /* DEVSLP1 - default as GPIO, do not program */
35 
36  /* WLAND - default as GPIO, do not program */
37 
38 #endif /* HAVE_ACPI_RESUME */
39  /* BLINK - reselect GPIO OUTPUT HIGH to force BLINK */
40  PAD_GPO(GPIO_11, HIGH),
41 };
42 
43 const struct soc_amd_gpio *early_gpio_table(size_t *size)
44 {
46  return gpio_set_stage_reset;
47 }
48 
49 const struct soc_amd_gpio *gpio_table(size_t *size)
50 {
52  return gpio_set_stage_ram;
53 }
#define GPIO_11
Definition: gpio_ftns.h:13
#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:14
static const struct soc_amd_gpio gpio_set_stage_ram[]
Definition: gpio.c:23
@ S3
Definition: smihandler.c:21
const struct pad_config early_gpio_table[]
Definition: gpio.c:373
const struct pad_config gpio_table[]
Definition: gpio.c:33
#define GPIO_91
Definition: gpio.h:67
#define GPIO_70
Definition: gpio.h:56
#define GPIO_9
Definition: gpio.h:30
#define GPIO_2
Definition: gpio.h:23
#define GPIO_40
Definition: gpio.h:49
#define PAD_WAKE(pin, pull, trigger, type)
Definition: gpio_defs.h:247
#define PAD_NF_SCI(pin, func, pull, trigger)
Definition: gpio_defs.h:241
#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_137
Definition: gpio.h:92