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 
4 
5 static const struct pch_gpio_set1 pch_gpio_set1_mode = {
7  .gpio1 = GPIO_MODE_GPIO,
8  .gpio2 = GPIO_MODE_GPIO,
9  .gpio3 = GPIO_MODE_GPIO,
10  .gpio4 = GPIO_MODE_GPIO,
11  .gpio5 = GPIO_MODE_NATIVE,
12  .gpio6 = GPIO_MODE_GPIO,
13  .gpio7 = GPIO_MODE_GPIO,
14  .gpio8 = GPIO_MODE_GPIO,
15  .gpio9 = GPIO_MODE_NATIVE,
16  .gpio10 = GPIO_MODE_GPIO,
17  .gpio11 = GPIO_MODE_GPIO,
18  .gpio12 = GPIO_MODE_NATIVE,
19  .gpio13 = GPIO_MODE_GPIO,
20  .gpio14 = GPIO_MODE_GPIO,
21  .gpio15 = GPIO_MODE_GPIO,
22  .gpio16 = GPIO_MODE_GPIO,
23  .gpio17 = GPIO_MODE_GPIO,
24  .gpio18 = GPIO_MODE_NATIVE,
25  .gpio19 = GPIO_MODE_NATIVE,
26  .gpio20 = GPIO_MODE_NATIVE,
27  .gpio21 = GPIO_MODE_GPIO,
28  .gpio22 = GPIO_MODE_GPIO,
29  .gpio23 = GPIO_MODE_GPIO,
30  .gpio24 = GPIO_MODE_GPIO,
31  .gpio25 = GPIO_MODE_NATIVE,
32  .gpio26 = GPIO_MODE_NATIVE,
33  .gpio27 = GPIO_MODE_GPIO,
34  .gpio28 = GPIO_MODE_GPIO,
35  .gpio29 = GPIO_MODE_GPIO,
36  .gpio30 = GPIO_MODE_NATIVE,
37  .gpio31 = GPIO_MODE_NATIVE,
38 };
39 
40 static const struct pch_gpio_set1 pch_gpio_set1_direction = {
42  .gpio1 = GPIO_DIR_INPUT,
43  .gpio2 = GPIO_DIR_INPUT,
44  .gpio3 = GPIO_DIR_INPUT,
45  .gpio4 = GPIO_DIR_INPUT,
46  .gpio6 = GPIO_DIR_INPUT,
47  .gpio7 = GPIO_DIR_INPUT,
48  .gpio8 = GPIO_DIR_INPUT,
49  .gpio10 = GPIO_DIR_INPUT,
50  .gpio11 = GPIO_DIR_OUTPUT,
51  .gpio13 = GPIO_DIR_INPUT,
52  .gpio14 = GPIO_DIR_INPUT,
53  .gpio15 = GPIO_DIR_INPUT,
54  .gpio16 = GPIO_DIR_INPUT,
55  .gpio17 = GPIO_DIR_OUTPUT,
56  .gpio21 = GPIO_DIR_INPUT,
57  .gpio22 = GPIO_DIR_OUTPUT,
58  .gpio23 = GPIO_DIR_INPUT,
59  .gpio24 = GPIO_DIR_OUTPUT,
60  .gpio27 = GPIO_DIR_OUTPUT,
61  .gpio28 = GPIO_DIR_OUTPUT,
62  .gpio29 = GPIO_DIR_OUTPUT,
63 };
64 
65 static const struct pch_gpio_set1 pch_gpio_set1_level = {
67  .gpio11 = GPIO_LEVEL_LOW,
68  .gpio17 = GPIO_LEVEL_HIGH,
69  .gpio22 = GPIO_LEVEL_HIGH,
70  .gpio24 = GPIO_LEVEL_HIGH,
71  .gpio27 = GPIO_LEVEL_LOW,
72  .gpio28 = GPIO_LEVEL_LOW,
73  .gpio29 = GPIO_LEVEL_HIGH,
74 };
75 
76 static const struct pch_gpio_set1 pch_gpio_set1_reset = {
78  .gpio30 = GPIO_RESET_RSMRST,
79 };
80 
81 static const struct pch_gpio_set1 pch_gpio_set1_invert = {
82  .gpio1 = GPIO_INVERT,
83  .gpio2 = GPIO_NO_INVERT,
84  .gpio3 = GPIO_INVERT,
85  .gpio4 = GPIO_NO_INVERT,
86  .gpio6 = GPIO_INVERT,
87  .gpio7 = GPIO_INVERT,
88  .gpio8 = GPIO_NO_INVERT,
89  .gpio10 = GPIO_INVERT,
90  .gpio13 = GPIO_INVERT,
91  .gpio14 = GPIO_INVERT,
92  .gpio15 = GPIO_NO_INVERT,
93  .gpio16 = GPIO_NO_INVERT,
94  .gpio21 = GPIO_NO_INVERT,
95  .gpio23 = GPIO_NO_INVERT,
96 };
97 
98 static const struct pch_gpio_set1 pch_gpio_set1_blink = {
99 };
100 
101 static const struct pch_gpio_set2 pch_gpio_set2_mode = {
103  .gpio33 = GPIO_MODE_GPIO,
104  .gpio34 = GPIO_MODE_GPIO,
105  .gpio35 = GPIO_MODE_GPIO,
106  .gpio36 = GPIO_MODE_GPIO,
107  .gpio37 = GPIO_MODE_GPIO,
108  .gpio38 = GPIO_MODE_GPIO,
109  .gpio39 = GPIO_MODE_GPIO,
110  .gpio40 = GPIO_MODE_NATIVE,
111  .gpio41 = GPIO_MODE_NATIVE,
112  .gpio42 = GPIO_MODE_NATIVE,
113  .gpio43 = GPIO_MODE_NATIVE,
114  .gpio44 = GPIO_MODE_GPIO,
115  .gpio45 = GPIO_MODE_NATIVE,
116  .gpio46 = GPIO_MODE_GPIO,
117  .gpio47 = GPIO_MODE_NATIVE,
118  .gpio48 = GPIO_MODE_GPIO,
119  .gpio49 = GPIO_MODE_GPIO,
120  .gpio50 = GPIO_MODE_GPIO,
121  .gpio51 = GPIO_MODE_GPIO,
122  .gpio52 = GPIO_MODE_GPIO,
123  .gpio53 = GPIO_MODE_GPIO,
124  .gpio54 = GPIO_MODE_GPIO,
125  .gpio55 = GPIO_MODE_GPIO,
126  .gpio56 = GPIO_MODE_NATIVE,
127  .gpio57 = GPIO_MODE_GPIO,
128  .gpio58 = GPIO_MODE_NATIVE,
129  .gpio59 = GPIO_MODE_NATIVE,
130  .gpio60 = GPIO_MODE_GPIO,
131  .gpio61 = GPIO_MODE_GPIO,
132  .gpio62 = GPIO_MODE_NATIVE,
133  .gpio63 = GPIO_MODE_NATIVE,
134 };
135 
136 static const struct pch_gpio_set2 pch_gpio_set2_direction = {
138  .gpio34 = GPIO_DIR_INPUT,
139  .gpio35 = GPIO_DIR_OUTPUT,
140  .gpio36 = GPIO_DIR_OUTPUT,
141  .gpio37 = GPIO_DIR_OUTPUT,
142  .gpio38 = GPIO_DIR_INPUT,
143  .gpio39 = GPIO_DIR_INPUT,
144  .gpio44 = GPIO_DIR_INPUT,
145  .gpio46 = GPIO_DIR_INPUT,
146  .gpio48 = GPIO_DIR_INPUT,
147  .gpio49 = GPIO_DIR_OUTPUT,
148  .gpio50 = GPIO_DIR_INPUT,
149  .gpio51 = GPIO_DIR_INPUT,
150  .gpio52 = GPIO_DIR_INPUT,
151  .gpio53 = GPIO_DIR_OUTPUT,
152  .gpio54 = GPIO_DIR_OUTPUT,
153  .gpio55 = GPIO_DIR_OUTPUT,
154  .gpio57 = GPIO_DIR_OUTPUT,
155  .gpio60 = GPIO_DIR_OUTPUT,
156  .gpio61 = GPIO_DIR_OUTPUT,
157 };
158 
159 static const struct pch_gpio_set2 pch_gpio_set2_level = {
161  .gpio35 = GPIO_LEVEL_LOW,
162  .gpio36 = GPIO_LEVEL_LOW,
163  .gpio37 = GPIO_LEVEL_LOW,
164  .gpio49 = GPIO_LEVEL_LOW,
165  .gpio53 = GPIO_LEVEL_HIGH,
166  .gpio54 = GPIO_LEVEL_HIGH,
167  .gpio55 = GPIO_LEVEL_LOW,
168  .gpio57 = GPIO_LEVEL_HIGH,
169  .gpio60 = GPIO_LEVEL_HIGH,
170  .gpio61 = GPIO_LEVEL_HIGH,
171 };
172 
173 static const struct pch_gpio_set2 pch_gpio_set2_reset = {
174 };
175 
176 static const struct pch_gpio_set3 pch_gpio_set3_mode = {
178  .gpio65 = GPIO_MODE_NATIVE,
179  .gpio66 = GPIO_MODE_NATIVE,
180  .gpio67 = GPIO_MODE_NATIVE,
181  .gpio68 = GPIO_MODE_GPIO,
182  .gpio69 = GPIO_MODE_GPIO,
183  .gpio70 = GPIO_MODE_GPIO,
184  .gpio71 = GPIO_MODE_NATIVE,
185  .gpio72 = GPIO_MODE_GPIO,
186  .gpio73 = GPIO_MODE_GPIO,
187  .gpio74 = GPIO_MODE_GPIO,
188  .gpio75 = GPIO_MODE_NATIVE,
189 };
190 
191 static const struct pch_gpio_set3 pch_gpio_set3_direction = {
193  .gpio69 = GPIO_DIR_INPUT,
194  .gpio70 = GPIO_DIR_OUTPUT,
195  .gpio72 = GPIO_DIR_OUTPUT,
196  .gpio73 = GPIO_DIR_OUTPUT,
197  .gpio74 = GPIO_DIR_OUTPUT,
198 };
199 
200 static const struct pch_gpio_set3 pch_gpio_set3_level = {
202  .gpio70 = GPIO_LEVEL_HIGH,
203  .gpio72 = GPIO_LEVEL_HIGH,
204  .gpio73 = GPIO_LEVEL_HIGH,
205  .gpio74 = GPIO_LEVEL_HIGH,
206 };
207 
208 static const struct pch_gpio_set3 pch_gpio_set3_reset = {
209 };
210 
211 const struct pch_gpio_map mainboard_gpio_map = {
212  .set1 = {
214  .direction = &pch_gpio_set1_direction,
215  .level = &pch_gpio_set1_level,
216  .blink = &pch_gpio_set1_blink,
217  .invert = &pch_gpio_set1_invert,
218  .reset = &pch_gpio_set1_reset,
219  },
220  .set2 = {
221  .mode = &pch_gpio_set2_mode,
222  .direction = &pch_gpio_set2_direction,
223  .level = &pch_gpio_set2_level,
224  .reset = &pch_gpio_set2_reset,
225  },
226  .set3 = {
227  .mode = &pch_gpio_set3_mode,
228  .direction = &pch_gpio_set3_direction,
229  .level = &pch_gpio_set3_level,
230  .reset = &pch_gpio_set3_reset,
231  },
232 };
const struct pch_gpio_map mainboard_gpio_map
Definition: gpio.c:87
static const struct pch_gpio_set1 pch_gpio_set1_direction
Definition: gpio.c:40
static const struct pch_gpio_set1 pch_gpio_set1_reset
Definition: gpio.c:76
static const struct pch_gpio_set2 pch_gpio_set2_reset
Definition: gpio.c:173
static const struct pch_gpio_set2 pch_gpio_set2_level
Definition: gpio.c:159
static const struct pch_gpio_set1 pch_gpio_set1_level
Definition: gpio.c:65
static const struct pch_gpio_set3 pch_gpio_set3_direction
Definition: gpio.c:191
static const struct pch_gpio_set2 pch_gpio_set2_mode
Definition: gpio.c:101
static const struct pch_gpio_set1 pch_gpio_set1_invert
Definition: gpio.c:81
static const struct pch_gpio_set3 pch_gpio_set3_reset
Definition: gpio.c:208
static const struct pch_gpio_set1 pch_gpio_set1_blink
Definition: gpio.c:98
static const struct pch_gpio_set1 pch_gpio_set1_mode
Definition: gpio.c:5
static const struct pch_gpio_set3 pch_gpio_set3_mode
Definition: gpio.c:176
static const struct pch_gpio_set3 pch_gpio_set3_level
Definition: gpio.c:200
static const struct pch_gpio_set2 pch_gpio_set2_direction
Definition: gpio.c:136
#define GPIO_LEVEL_HIGH
Definition: gpio.h:54
#define GPIO_LEVEL_LOW
Definition: gpio.h:53
#define GPIO_DIR_INPUT
Definition: gpio.h:51
#define GPIO_DIR_OUTPUT
Definition: gpio.h:50
@ GPIO_MODE_GPIO
Definition: gpio.h:20
#define GPIO_INVERT
Definition: gpio.h:32
#define GPIO_NO_INVERT
Definition: gpio.h:31
#define GPIO_MODE_NATIVE
Definition: gpio.h:24
#define GPIO_RESET_RSMRST
Definition: gpio.h:41
const struct pch_gpio_set1 * mode
Definition: gpio.h:130
struct pch_gpio_map::@1669 set1
u32 gpio0
Definition: gpio.h:44
u32 gpio24
Definition: gpio.h:68
u32 gpio1
Definition: gpio.h:45
u32 gpio33
Definition: gpio.h:80
u32 gpio32
Definition: gpio.h:79
u32 gpio64
Definition: gpio.h:114
u32 gpio68
Definition: gpio.h:118