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 <bootstate.h>
7 #include <fw_config.h>
9 
10 /* Pad configuration in ramstage */
11 static const struct pad_config not_board6or8_gpio_table[] = {
12 
13  /* C12 : AP_PEN_DET_ODL */
14  PAD_CFG_GPI_GPIO_DRIVER(GPP_C12, UP_20K, DEEP),
15 };
16 
17 /* bid6: Pad configuration for board version 6 or 8 in ramstage */
18 static const struct pad_config board6or8_gpio_table[] = {
19 
20  /* A10 : WWAN_EN */
21  PAD_CFG_GPO(GPP_A10, 1, PWROK),
22 
23  /* B7 : PCIE_CLKREQ2_N ==> WWAN_SAR_DETECT_ODL*/
24  PAD_CFG_GPO(GPP_B7, 1, DEEP),
25 
26  /* C12 : AP_PEN_DET_ODL has an external pull-up and hence no pad termination.*/
28 
29  /* D0 : WWAN_HOST_WAKE ==> WWAN_WDISABLE_L */
30  PAD_CFG_GPO(GPP_D0, 1, DEEP),
31 
32  /* H0 : WWAN_PERST */
33  PAD_CFG_GPO(GPP_H0, 0, PLTRST),
34  PAD_CFG_GPO(GPP_H17, 0, PLTRST),
35 };
36 
37 static const struct pad_config lte_disable_pads[] = {
39  PAD_NC(GPP_B7, NONE),
40  PAD_NC(GPP_D0, NONE),
41  PAD_NC(GPP_H0, NONE),
43 };
44 
45 const struct pad_config *variant_override_gpio_table(size_t *num)
46 {
47  uint32_t board_version = board_id();
49 
50  if (board_version == 6 || board_version >= 8) {
52  return board6or8_gpio_table;
53  }
54 
56 }
57 
58 static void fw_config_handle(void *unused)
59 {
60  if (!fw_config_probe(FW_CONFIG(DB_PORTS, DB_PORTS_1A_HDMI_LTE)))
62 }
#define GPP_C12
#define GPP_H17
#define GPP_H0
#define GPP_A10
#define GPP_D0
#define GPP_B7
Definition: gpio_soc_defs.h:60
@ BS_DEV_ENABLE
Definition: bootstate.h:82
@ BS_ON_ENTRY
Definition: bootstate.h:95
#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 FW_CONFIG(__field, __option)
Definition: fw_config.h:28
bool fw_config_probe(const struct fw_config *match)
Definition: fw_config.c:62
const struct pad_config *__weak variant_override_gpio_table(size_t *num)
Definition: gpio.c:450
BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL)
static const struct pad_config lte_disable_pads[]
Definition: gpio.c:37
static const struct pad_config board6or8_gpio_table[]
Definition: gpio.c:18
static const struct pad_config not_board6or8_gpio_table[]
Definition: gpio.c:11
static void fw_config_handle(void *unused)
Definition: gpio.c:58
void gpio_configure_pads(const struct soc_amd_gpio *gpio_list_ptr, size_t size)
program a particular set of GPIO
Definition: gpio.c:307
#define PAD_NC(pin)
Definition: gpio_defs.h:263
#define PAD_CFG_GPO(pad, val, rst)
Definition: gpio_defs.h:247
#define PAD_CFG_GPI_GPIO_DRIVER(pad, pull, rst)
Definition: gpio_defs.h:323
#define NULL
Definition: stddef.h:19
unsigned int uint32_t
Definition: stdint.h:14
uint16_t unused
Definition: padconfig.h:13