2 * This file is part of the coreboot project.
4 * Copyright (C) 2011 The Chromium OS Authors. All rights reserved.
5 * Copyright (C) 2013 Sage Electronic Engineering, LLC.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #ifndef INTEL_I89XX_GPIO_H
18 #define INTEL_I89XX_GPIO_H
22 #define GPIO_MODE_NATIVE 0
23 #define GPIO_MODE_GPIO 1
24 #define GPIO_MODE_NONE 1
26 #define GPIO_DIR_OUTPUT 0
27 #define GPIO_DIR_INPUT 1
29 #define GPIO_NO_INVERT 0
32 #define GPIO_LEVEL_LOW 0
33 #define GPIO_LEVEL_HIGH 1
35 #define GPIO_NO_BLINK 0
38 #define GPIO_RESET_PWROK 0
39 #define GPIO_RESET_RSMRST 1
41 struct pch_gpio_set1
{
76 struct pch_gpio_set2
{
111 struct pch_gpio_set3
{
124 u32 fill_bitfield
: 20;
127 struct pch_gpio_map
{
130 const struct pch_gpio_set1
*mode
;
131 const struct pch_gpio_set1
*direction
;
132 const struct pch_gpio_set1
*level
;
133 const struct pch_gpio_set1
*reset
;
134 const struct pch_gpio_set1
*invert
;
135 const struct pch_gpio_set1
*blink
;
139 const u32
*direction
;
149 const struct pch_gpio_set2
*mode
;
150 const struct pch_gpio_set2
*direction
;
151 const struct pch_gpio_set2
*level
;
152 const struct pch_gpio_set2
*reset
;
156 const u32
*direction
;
164 const struct pch_gpio_set3
*mode
;
165 const struct pch_gpio_set3
*direction
;
166 const struct pch_gpio_set3
*level
;
167 const struct pch_gpio_set3
*reset
;
171 const u32
*direction
;
178 /* Configure GPIOs with mainboard provided settings */
179 void setup_pch_gpios(const struct pch_gpio_map
*gpio
);
181 /* get GPIO and set pin values */
182 int get_gpio(int gpio_num
);
183 void set_gpio(int gpio_num
);
184 void clear_gpio(int gpio_num
);
187 * get a number comprised of multiple GPIO values. gpio_num_array points to
188 * the array of gpio pin numbers to scan, terminated by -1.
190 unsigned get_gpios(const int *gpio_num_array
);