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 <commonlib/helpers.h>
6 
7 static const struct pad_config gpio_table[] = {
8  /* A8 : PEN_GARAGE_DET_L (wake) */
9  PAD_CFG_GPI_SCI(GPP_A8, NONE, DEEP, EDGE_SINGLE, NONE),
10  /* A10 : FPMCU_PCH_BOOT1 */
11  PAD_CFG_GPO(GPP_A10, 0, DEEP),
12  /* A18 : ISH_GP0 ==> NC */
14  /* A19 : ISH_GP1 ==> NC */
16  /* A20 : ISH_GP2 ==> NC */
18  /* A22 : ISH_GP4 ==> NC */
20  /* A23 : ISH_GP5 ==> NC */
22 
23  /* B19 : GSPI1_CS0# ==> NC */
25  /* B20 : GSPI1_CLK ==> NC */
27  /* B21 : GSPI1_MISO ==> NC */
29  /* B22 : GSPI1_MOSI ==> NC */
31 
32  /* C1 : SMBDATA ==> NC */
33  PAD_NC(GPP_C1, NONE),
34  /* C4 : TOUCHSCREEN_DIS_L */
35  PAD_CFG_GPO(GPP_C4, 0, DEEP),
36  /* C7 : GPP_C7 ==> Touchscreen_INT_L */
37  PAD_CFG_GPI_APIC(GPP_C7, NONE, PLTRST, LEVEL, INVERT),
38  /* C11 : UART0_CTS# ==> NC */
40  /* C23 : UART2_CTS# ==> NC */
42 
43  /* D4 : USI_BASE_REPORT_EN */
44  PAD_CFG_GPO(GPP_D4, 0, DEEP),
45  /* D10 : GPP_D10 ==> EN_PP3300_DX_BASE_TOUCHSCREEN */
46  PAD_CFG_GPO(GPP_D10, 0, DEEP),
47  /* D16 : USI_INT_L */
48  PAD_CFG_GPI_APIC(GPP_D16, NONE, PLTRST, LEVEL, INVERT),
49 
50  /* F0 : GPP_F0 ==> NC */
51  PAD_NC(GPP_F0, NONE),
52  /* F1 : GPP_F1 ==> NC */
53  PAD_NC(GPP_F1, NONE),
54  /* F3 : GPP_F3 ==> MEM_STRAP_3 */
55  PAD_CFG_GPI(GPP_F3, NONE, PLTRST),
56  /* F10 : GPP_F10 ==> MEM_STRAP_2 */
57  PAD_CFG_GPI(GPP_F10, NONE, PLTRST),
58  /* F11 : EMMC_CMD ==> NC */
60  /* F20 : EMMC_RCLK ==> NC */
62  /* F21 : EMMC_CLK ==> NC */
64  /* F22 : EMMC_RESET# ==> NC */
66 
67  /* G0 : GPP_G0 ==> NC */
68  PAD_NC(GPP_G0, NONE),
69  /* G1 : GPP_G1 ==> NC */
70  PAD_NC(GPP_G1, NONE),
71  /* G2 : GPP_G2 ==> NC */
72  PAD_NC(GPP_G2, NONE),
73  /* G3 : GPP_G3 ==> NC */
74  PAD_NC(GPP_G3, NONE),
75  /* G4 : GPP_G4 ==> NC */
76  PAD_NC(GPP_G4, NONE),
77  /* G5 : GPP_G5 ==> NC */
78  PAD_NC(GPP_G5, NONE),
79  /* G6 : GPP_G6 ==> NC */
80  PAD_NC(GPP_G6, NONE),
81 
82  /* H3 : SPKR_PA_EN */
83  PAD_CFG_GPO(GPP_H3, 1, DEEP),
84  /* H4 : Touchscreen I2C2_SDA */
85  PAD_CFG_NF(GPP_H4, NONE, DEEP, NF1),
86  /* H5 : Touchscreen I2C2_SCL */
87  PAD_CFG_NF(GPP_H5, NONE, DEEP, NF1),
88  /* H13 : M2_SKT2_CFG1 ==> SPKR_RST_L */
89  PAD_CFG_GPO(GPP_H13, 1, DEEP),
90  /* H14 : M2_SKT2_CFG2 ==> TOUCHSCREEN_STOP_L */
91  PAD_CFG_GPO(GPP_H14, 1, PLTRST),
92  /* H19 : TIMESYNC[0] ==> MEM_STRAP_0 */
93  PAD_CFG_GPI(GPP_H19, NONE, PLTRST),
94  /* H22 : MEM_STRAP_1 */
95  PAD_CFG_GPI(GPP_H22, NONE, PLTRST),
96 };
97 
98 const struct pad_config *override_gpio_table(size_t *num)
99 {
100  *num = ARRAY_SIZE(gpio_table);
101  return gpio_table;
102 }
103 
104 /*
105  * GPIOs configured before ramstage
106  * Note: the Hatch platform's romstage will configure
107  * the MEM_STRAP_* (a.k.a GPIO_MEM_CONFIG_*) pins
108  * as inputs before it reads them, so they are not
109  * needed in this table.
110  */
111 static const struct pad_config early_gpio_table[] = {
112  /* B15 : H1_SLAVE_SPI_CS_L */
113  PAD_CFG_NF(GPP_B15, NONE, DEEP, NF1),
114  /* B16 : H1_SLAVE_SPI_CLK */
115  PAD_CFG_NF(GPP_B16, NONE, DEEP, NF1),
116  /* B17 : H1_SLAVE_SPI_MISO_R */
117  PAD_CFG_NF(GPP_B17, NONE, DEEP, NF1),
118  /* B18 : H1_SLAVE_SPI_MOSI_R */
119  PAD_CFG_NF(GPP_B18, NONE, DEEP, NF1),
120  /* C8 : UART_PCH_RX_DEBUG_TX */
121  PAD_CFG_NF(GPP_C8, NONE, DEEP, NF1),
122  /* C9 : UART_PCH_TX_DEBUG_RX */
123  PAD_CFG_NF(GPP_C9, NONE, DEEP, NF1),
124  /* C14 : BT_DISABLE_L */
125  PAD_CFG_GPO(GPP_C14, 0, DEEP),
126  /* PCH_WP_OD */
127  PAD_CFG_GPI(GPP_C20, NONE, DEEP),
128  /* C21 : H1_PCH_INT_ODL */
129  PAD_CFG_GPI_APIC(GPP_C21, NONE, PLTRST, LEVEL, INVERT),
130  /* C22 : EC_IN_RW_OD */
131  PAD_CFG_GPI(GPP_C22, NONE, DEEP),
132  /* E1 : M2_SSD_PEDET */
133  PAD_CFG_NF(GPP_E1, NONE, DEEP, NF1),
134  /* E5 : SATA_DEVSLP1 */
135  PAD_CFG_NF(GPP_E5, NONE, PLTRST, NF1),
136  /* F2 : MEM_CH_SEL */
137  PAD_CFG_GPI(GPP_F2, NONE, PLTRST),
138 };
139 
140 const struct pad_config *variant_early_gpio_table(size_t *num)
141 {
143  return early_gpio_table;
144 }
#define GPP_H22
#define GPP_H19
#define GPP_D10
#define GPP_A18
#define GPP_F21
#define GPP_F20
#define GPP_B16
Definition: gpio_soc_defs.h:69
#define GPP_F0
#define GPP_A19
#define GPP_C9
#define GPP_C22
#define GPP_B15
Definition: gpio_soc_defs.h:68
#define GPP_C23
#define GPP_H13
#define GPP_C8
#define GPP_C11
#define GPP_H14
#define GPP_B22
Definition: gpio_soc_defs.h:75
#define GPP_A23
#define GPP_E5
#define GPP_C20
#define GPP_B20
Definition: gpio_soc_defs.h:73
#define GPP_A20
#define GPP_F1
#define GPP_D4
#define GPP_F10
#define GPP_C4
#define GPP_B19
Definition: gpio_soc_defs.h:72
#define GPP_H5
#define GPP_C21
#define GPP_H3
#define GPP_A10
#define GPP_A8
#define GPP_B18
Definition: gpio_soc_defs.h:71
#define GPP_C14
#define GPP_C1
#define GPP_F2
#define GPP_A22
#define GPP_F22
#define GPP_F11
#define GPP_B21
Definition: gpio_soc_defs.h:74
#define GPP_D16
#define GPP_F3
#define GPP_B17
Definition: gpio_soc_defs.h:70
#define GPP_E1
#define GPP_H4
#define GPP_C7
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define GPP_G1
Definition: gpio_soc_defs.h:89
#define GPP_G4
Definition: gpio_soc_defs.h:92
#define GPP_G2
Definition: gpio_soc_defs.h:90
#define GPP_G6
Definition: gpio_soc_defs.h:94
#define GPP_G0
Definition: gpio_soc_defs.h:88
#define GPP_G3
Definition: gpio_soc_defs.h:91
#define GPP_G5
Definition: gpio_soc_defs.h:93
const struct pad_config * variant_early_gpio_table(size_t *num)
Definition: gpio.c:204
const struct pad_config * override_gpio_table(size_t *num)
Definition: gpio.c:124
static const struct pad_config gpio_table[]
Definition: gpio.c:7
static const struct pad_config early_gpio_table[]
Definition: gpio.c:111
#define PAD_NC(pin)
Definition: gpio_defs.h:263
#define PAD_CFG_GPI(pad, pull, rst)
Definition: gpio_defs.h:284
#define PAD_CFG_NF(pad, pull, rst, func)
Definition: gpio_defs.h:197
#define PAD_CFG_GPI_APIC(pad, pull, rst, trig, inv)
Definition: gpio_defs.h:376
#define PAD_CFG_GPO(pad, val, rst)
Definition: gpio_defs.h:247
#define PAD_CFG_GPI_SCI(pad, pull, rst, trig, inv)
Definition: gpio_defs.h:432