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_RANGELEY_GPIO_H
18 #define INTEL_RANGELEY_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_LEVEL_LOW 0
30 #define GPIO_LEVEL_HIGH 1
32 #define GPIO_TPE_DISABLE 0
33 #define GPIO_TPE_ENABLE 1
35 #define GPIO_TNE_DISABLE 0
36 #define GPIO_TNE_ENABLE 1
38 #define GPIO_TS_DISABLE 0
39 #define GPIO_TS_ENABLE 1
41 #define GPIO_WE_DISABLE 0
42 #define GPIO_WE_ENABLE 1
89 const struct soc_gpio
*mode
;
90 const struct soc_gpio
*direction
;
91 const struct soc_gpio
*level
;
92 const struct soc_gpio
*tpe
;
93 const struct soc_gpio
*tne
;
94 const struct soc_gpio
*ts
;
95 const struct soc_cfio
*cfio_init
;
96 const u32 cfio_entrynum
;
101 const struct soc_gpio
*mode
;
102 const struct soc_gpio
*direction
;
103 const struct soc_gpio
*level
;
104 const struct soc_gpio
*tpe
;
105 const struct soc_gpio
*tne
;
106 const struct soc_gpio
*ts
;
107 const struct soc_gpio
*we
;
108 const struct soc_cfio
*cfio_init
;
109 const u32 cfio_entrynum
;
115 /* Configure GPIOs with mainboard provided settings */
116 void setup_soc_gpios(const struct soc_gpio_map
*gpio
);
118 /* Get GPIO pin value */
119 int get_gpio(int gpio_num
);
121 * Get a number comprised of multiple GPIO values. gpio_num_array points to
122 * the array of GPIO pin numbers to scan, terminated by -1.
124 unsigned get_gpios(const int *gpio_num_array
);