summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-06-24 07:52:49 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-06-26 02:43:01 +0000
commit9ccfd4553e708a5df4be3aa18b97c75da3f6c1b9 (patch)
treebd10678c7ee25901de97260967b8bee4a849baa5 /board
parent88c0ffd692b4e6d5fadc75bb15255e0684d6a1c9 (diff)
downloadchrome-ec-9ccfd4553e708a5df4be3aa18b97c75da3f6c1b9.tar.gz
gpio: Replace duplication in gpio declarations with X-macro file
Previously each board.h and board.c contained an enum and an array for gpio definitons that had to be manually kept in sync, with no compiler assistance other than that their lengths matched. This change adds a single gpio.inc file that declares all gpio's that a board uses and is used as an X-macro include file to generate both the gpio_signal enum and the gpio_list array. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=none TEST=make buildall -j Change-Id: If9c9feca968619a59ff9f20701359bcb9374e4da Reviewed-on: https://chromium-review.googlesource.com/205354 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/bds/board.c11
-rw-r--r--board/bds/board.h15
-rw-r--r--board/bds/gpio.inc17
-rw-r--r--board/big/board.c64
-rw-r--r--board/big/board.h54
-rw-r--r--board/big/gpio.inc58
-rw-r--r--board/discovery/board.c14
-rw-r--r--board/discovery/board.h14
-rw-r--r--board/discovery/gpio.inc17
-rw-r--r--board/falco/board.c102
-rw-r--r--board/falco/board.h79
-rw-r--r--board/falco/gpio.inc148
-rw-r--r--board/firefly/board.c57
-rw-r--r--board/firefly/board.h54
-rw-r--r--board/firefly/gpio.inc61
-rw-r--r--board/fruitpie/board.c66
-rw-r--r--board/fruitpie/board.h58
-rw-r--r--board/fruitpie/gpio.inc68
-rw-r--r--board/host/board.c22
-rw-r--r--board/host/board.h15
-rw-r--r--board/host/gpio.inc17
-rw-r--r--board/it8380dev/board.c29
-rw-r--r--board/it8380dev/board.h30
-rw-r--r--board/it8380dev/gpio.inc32
-rw-r--r--board/link/board.c98
-rw-r--r--board/link/board.h76
-rw-r--r--board/link/gpio.inc146
-rw-r--r--board/mccroskey/board.c75
-rw-r--r--board/mccroskey/board.h60
-rw-r--r--board/mccroskey/gpio.inc73
-rw-r--r--board/mec1322_evb/board.c15
-rw-r--r--board/mec1322_evb/board.h20
-rw-r--r--board/mec1322_evb/gpio.inc23
-rw-r--r--board/nyan/board.c64
-rw-r--r--board/nyan/board.h54
-rw-r--r--board/nyan/gpio.inc58
-rw-r--r--board/peppy/board.c103
-rw-r--r--board/peppy/board.h80
-rw-r--r--board/peppy/gpio.inc147
-rw-r--r--board/pit/board.c65
-rw-r--r--board/pit/board.h55
-rw-r--r--board/pit/gpio.inc58
-rw-r--r--board/rambi/board.c82
-rw-r--r--board/rambi/board.h66
-rw-r--r--board/rambi/gpio.inc119
-rw-r--r--board/samus/board.c112
-rw-r--r--board/samus/board.h85
-rw-r--r--board/samus/gpio.inc167
-rw-r--r--board/samus_pd/board.c121
-rw-r--r--board/samus_pd/board.h119
-rw-r--r--board/samus_pd/gpio.inc123
-rw-r--r--board/snow/board.c70
-rw-r--r--board/snow/board.h56
-rw-r--r--board/snow/gpio.inc75
-rw-r--r--board/spring/board.c69
-rw-r--r--board/spring/board.h55
-rw-r--r--board/spring/gpio.inc72
-rw-r--r--board/squawks/board.c82
-rw-r--r--board/squawks/board.h66
-rw-r--r--board/squawks/gpio.inc116
-rw-r--r--board/twinkie/board.c40
-rw-r--r--board/twinkie/board.h41
-rw-r--r--board/twinkie/gpio.inc41
63 files changed, 1685 insertions, 2464 deletions
diff --git a/board/bds/board.c b/board/bds/board.c
index 7dc4985f9a..8f2142df09 100644
--- a/board/bds/board.c
+++ b/board/bds/board.c
@@ -38,16 +38,7 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- {"RECOVERY_L", GPIO_D, (1<<1), GPIO_PULL_UP, NULL},
- {"DEBUG_LED", GPIO_A, (1<<7), GPIO_OUT_LOW, NULL},
- /* Unimplemented signals which we need to emulate for now */
- GPIO_SIGNAL_NOT_IMPLEMENTED("WP"),
- GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/bds/board.h b/board/bds/board.h
index 45ed2f9b72..96171e0f57 100644
--- a/board/bds/board.h
+++ b/board/bds/board.h
@@ -43,20 +43,7 @@ enum pwm_channel {
/* Second UART port */
#define CONFIG_UART_HOST 1
-/* GPIO signal list */
-enum gpio_signal {
- GPIO_RECOVERY_L = 0, /* Recovery signal from DOWN button */
- GPIO_DEBUG_LED, /* Debug LED */
- /*
- * Signals which aren't implemented on BDS but we'll emulate anyway, to
- * make it more convenient to debug other code.
- */
- GPIO_WP, /* Write protect input */
- GPIO_ENTERING_RW, /* EC entering RW code */
-
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* EEPROM blocks */
#define EEPROM_BLOCK_EOPTION 1 /* EC persistent options */
diff --git a/board/bds/gpio.inc b/board/bds/gpio.inc
new file mode 100644
index 0000000000..f22d0d0d7a
--- /dev/null
+++ b/board/bds/gpio.inc
@@ -0,0 +1,17 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Recovery signal from DOWN button */
+GPIO(RECOVERY_L, D, 1, GPIO_PULL_UP, NULL)
+GPIO(DEBUG_LED, A, 7, GPIO_OUT_LOW, NULL)
+
+/*
+ * Signals which aren't implemented on BDS but we'll emulate anyway, to
+ * make it more convenient to debug other code.
+ */
+UNIMPLEMENTED(WP) /* Write protect input */
+UNIMPLEMENTED(ENTERING_RW) /* EC entering RW code */
diff --git a/board/big/board.c b/board/big/board.c
index aae31dd5cb..e970a80aa2 100644
--- a/board/big/board.c
+++ b/board/big/board.c
@@ -27,69 +27,7 @@
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
#define GPIO_KB_OUTPUT GPIO_ODR_HIGH
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"POWER_BUTTON_L", GPIO_B, (1<<5), GPIO_INT_BOTH,
- power_button_interrupt},
- {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, lid_interrupt},
- {"SUSPEND_L", GPIO_C, (1<<7), GPIO_KB_INPUT,
- power_signal_interrupt},
- {"SPI1_NSS", GPIO_A, (1<<4), GPIO_INT_BOTH | GPIO_PULL_UP,
- spi_event},
- {"AC_PRESENT", GPIO_A, (1<<0), GPIO_INT_BOTH, extpower_interrupt},
- {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- /* Other inputs */
- {"WP_L", GPIO_B, (1<<4), GPIO_INPUT, NULL},
- /* Outputs */
- {"AP_RESET_L", GPIO_B, (1<<3), GPIO_ODR_HIGH, NULL},
- {"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL},
- {"EC_INT", GPIO_B, (1<<9), GPIO_ODR_HIGH, NULL},
- {"ENTERING_RW", GPIO_H, (1<<0), GPIO_OUT_LOW, NULL},
- {"I2C1_SCL", GPIO_B, (1<<6), GPIO_ODR_HIGH, NULL},
- {"I2C1_SDA", GPIO_B, (1<<7), GPIO_ODR_HIGH, NULL},
- {"LED_POWER_L", GPIO_A, (1<<2), GPIO_OUT_HIGH, NULL}, /* PWR_LED1 */
- {"PMIC_PWRON_L", GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL},
- {"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
- {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT04", GPIO_B, (1<<14), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT05", GPIO_B, (1<<15), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT06", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT07", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT08", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT09", GPIO_B, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT10", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT11", GPIO_C, (1<<4), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT12", GPIO_A, (1<<13), GPIO_KB_OUTPUT, NULL},
- {"PWR_LED0", GPIO_B, (1<<10), GPIO_OUT_LOW, NULL},
- {"BAT_LED0", GPIO_B, (1<<11), GPIO_OUT_LOW, NULL},
- {"BAT_LED1", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL},
- {"CHARGING", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL},
- {"EC_BL_OVERRIDE", GPIO_H, (1<<1), GPIO_ODR_HIGH, NULL},
- {"PMIC_THERM_L", GPIO_A, (1<<1), GPIO_ODR_HIGH, NULL},
- {"PMIC_WARM_RESET_L", GPIO_C, (1<<3), GPIO_ODR_HIGH, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/big/board.h b/board/big/board.h
index fefd31cd6f..2b72dffb48 100644
--- a/board/big/board.h
+++ b/board/big/board.h
@@ -45,59 +45,7 @@
#define TIM_POWER_LED 2
#define TIM_WATCHDOG 4
-/* GPIO signal list */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_POWER_BUTTON_L = 0,
- GPIO_SOC1V8_XPSHOLD,
- GPIO_LID_OPEN,
- GPIO_SUSPEND_L,
- GPIO_SPI1_NSS,
- GPIO_AC_PRESENT,
- /* Keyboard inputs */
- GPIO_KB_IN00,
- GPIO_KB_IN01,
- GPIO_KB_IN02,
- GPIO_KB_IN03,
- GPIO_KB_IN04,
- GPIO_KB_IN05,
- GPIO_KB_IN06,
- GPIO_KB_IN07,
- /* Other inputs */
- GPIO_WP_L,
- /* Outputs */
- GPIO_AP_RESET_L,
- GPIO_CHARGER_EN,
- GPIO_EC_INT,
- GPIO_ENTERING_RW,
- GPIO_I2C1_SCL,
- GPIO_I2C1_SDA,
- GPIO_LED_POWER_L, /* alias to GPIO_PWR_LED1 */
- GPIO_PMIC_PWRON_L,
- GPIO_PMIC_RESET,
- GPIO_KB_OUT00,
- GPIO_KB_OUT01,
- GPIO_KB_OUT02,
- GPIO_KB_OUT03,
- GPIO_KB_OUT04,
- GPIO_KB_OUT05,
- GPIO_KB_OUT06,
- GPIO_KB_OUT07,
- GPIO_KB_OUT08,
- GPIO_KB_OUT09,
- GPIO_KB_OUT10,
- GPIO_KB_OUT11,
- GPIO_KB_OUT12,
- GPIO_PWR_LED0,
- GPIO_BAT_LED0,
- GPIO_BAT_LED1,
- GPIO_CHARGING,
- GPIO_EC_BL_OVERRIDE,
- GPIO_PMIC_THERM_L,
- GPIO_PMIC_WARM_RESET_L,
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
enum power_signal {
TEGRA_XPSHOLD = 0,
diff --git a/board/big/gpio.inc b/board/big/gpio.inc
new file mode 100644
index 0000000000..f8cd6720a3
--- /dev/null
+++ b/board/big/gpio.inc
@@ -0,0 +1,58 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+GPIO(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH, power_button_interrupt)
+GPIO(SOC1V8_XPSHOLD, A, 3, GPIO_INT_BOTH, power_signal_interrupt)
+GPIO(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt)
+GPIO(SUSPEND_L, C, 7, GPIO_KB_INPUT, power_signal_interrupt)
+GPIO(SPI1_NSS, A, 4, GPIO_INT_BOTH | GPIO_PULL_UP, spi_event)
+GPIO(AC_PRESENT, A, 0, GPIO_INT_BOTH, extpower_interrupt)
+
+/* Keyboard inputs */
+GPIO(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+
+/* Other inputs */
+GPIO(WP_L, B, 4, GPIO_INPUT, NULL)
+
+/* Outputs */
+GPIO(AP_RESET_L, B, 3, GPIO_ODR_HIGH, NULL)
+GPIO(CHARGER_EN, B, 2, GPIO_OUT_LOW, NULL)
+GPIO(EC_INT, B, 9, GPIO_ODR_HIGH, NULL)
+GPIO(ENTERING_RW, H, 0, GPIO_OUT_LOW, NULL)
+GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH, NULL)
+GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH, NULL)
+GPIO(LED_POWER_L, A, 2, GPIO_OUT_HIGH, NULL) /* PWR_LED1 */
+GPIO(PMIC_PWRON_L, A, 12, GPIO_OUT_HIGH, NULL)
+GPIO(PMIC_RESET, A, 15, GPIO_OUT_LOW, NULL)
+GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT, NULL)
+GPIO(PWR_LED0, B, 10, GPIO_OUT_LOW, NULL)
+GPIO(BAT_LED0, B, 11, GPIO_OUT_LOW, NULL)
+GPIO(BAT_LED1, A, 8, GPIO_OUT_LOW, NULL)
+GPIO(CHARGING, A, 11, GPIO_OUT_LOW, NULL)
+GPIO(EC_BL_OVERRIDE, H, 1, GPIO_ODR_HIGH, NULL)
+GPIO(PMIC_THERM_L, A, 1, GPIO_ODR_HIGH, NULL)
+GPIO(PMIC_WARM_RESET_L, C, 3, GPIO_ODR_HIGH, NULL)
diff --git a/board/discovery/board.c b/board/discovery/board.c
index f900acf015..5548577943 100644
--- a/board/discovery/board.c
+++ b/board/discovery/board.c
@@ -15,19 +15,7 @@ void button_event(enum gpio_signal signal)
{
}
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"USER_BUTTON", GPIO_A, (1<<0), GPIO_INT_BOTH, button_event},
- /* Outputs */
- {"LED_BLUE", GPIO_B, (1<<6), GPIO_OUT_LOW, NULL},
- {"LED_GREEN", GPIO_B, (1<<7), GPIO_OUT_LOW, NULL},
-
- /* Unimplemented signals which we need to emulate for now */
- GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
- GPIO_SIGNAL_NOT_IMPLEMENTED("WP_L"),
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Initialize board. */
static void board_init(void)
diff --git a/board/discovery/board.h b/board/discovery/board.h
index 0ef0ff18a7..a4716ebe6e 100644
--- a/board/discovery/board.h
+++ b/board/discovery/board.h
@@ -24,19 +24,7 @@
#define TIM_CLOCK_MSB 3
#define TIM_CLOCK_LSB 4
-/* GPIO signal list */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_USER_BUTTON = 0,
- /* Outputs */
- GPIO_LED_BLUE,
- GPIO_LED_GREEN,
- /* Unimplemented signals we emulate */
- GPIO_ENTERING_RW,
- GPIO_WP_L,
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
#endif /* !__ASSEMBLER__ */
diff --git a/board/discovery/gpio.inc b/board/discovery/gpio.inc
new file mode 100644
index 0000000000..4f09cc3ab3
--- /dev/null
+++ b/board/discovery/gpio.inc
@@ -0,0 +1,17 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+GPIO(USER_BUTTON, A, 0, GPIO_INT_BOTH, button_event)
+
+/* Outputs */
+GPIO(LED_BLUE, B, 6, GPIO_OUT_LOW, NULL)
+GPIO(LED_GREEN, B, 7, GPIO_OUT_LOW, NULL)
+
+/* Unimplemented signals which we need to emulate for now */
+UNIMPLEMENTED(ENTERING_RW)
+UNIMPLEMENTED(WP_L)
diff --git a/board/falco/board.c b/board/falco/board.c
index 97a7fccc53..a9eeee7723 100644
--- a/board/falco/board.c
+++ b/board/falco/board.c
@@ -31,107 +31,7 @@
#include "uart.h"
#include "util.h"
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"POWER_BUTTON_L", LM4_GPIO_A, (1<<2), GPIO_INT_BOTH_DSLEEP,
- power_button_interrupt},
- {"LID_OPEN", LM4_GPIO_A, (1<<3), GPIO_INT_BOTH_DSLEEP,
- lid_interrupt},
- {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH_DSLEEP,
- extpower_interrupt},
- {"PCH_BKLTEN", LM4_GPIO_M, (1<<3), GPIO_INT_BOTH,
- backlight_interrupt},
- {"PCH_SLP_S0_L", LM4_GPIO_G, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SLP_S3_L", LM4_GPIO_G, (1<<7), GPIO_INT_BOTH_DSLEEP,
- power_signal_interrupt},
- {"PCH_SLP_S5_L", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH_DSLEEP,
- power_signal_interrupt},
- {"PCH_SLP_SUS_L", LM4_GPIO_G, (1<<3), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP1050_PGOOD", LM4_GPIO_H, (1<<4), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP1350_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP5000_PGOOD", LM4_GPIO_N, (1<<0), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_EDP_VDD_EN", LM4_GPIO_J, (1<<1), GPIO_INT_BOTH,
- lcdvcc_interrupt},
- {"RECOVERY_L", LM4_GPIO_A, (1<<5), GPIO_PULL_UP|GPIO_INT_BOTH,
- switch_interrupt},
- {"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH,
- switch_interrupt},
- {"JTAG_TCK", LM4_GPIO_C, (1<<0), GPIO_DEFAULT,
- jtag_interrupt},
- {"UART0_RX", LM4_GPIO_A, (1<<0), GPIO_PULL_UP|
- GPIO_INT_BOTH_DSLEEP,
- uart_deepsleep_interrupt},
-
- /* Other inputs */
- {"FAN_ALERT_L", LM4_GPIO_B, (1<<0), GPIO_INPUT, NULL},
- {"PCH_SUSWARN_L", LM4_GPIO_G, (1<<2), GPIO_INT_BOTH, NULL},
- {"USB1_OC_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL},
- {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL},
- {"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL},
- {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL},
- {"BOARD_VERSION3", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL},
- {"CPU_PGOOD", LM4_GPIO_C, (1<<4), GPIO_INPUT, NULL},
-
- /* Outputs; all unasserted by default except for reset signals */
- {"CPU_PROCHOT", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL},
- {"PP1350_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL},
- {"PP3300_DSW_GATED_EN", LM4_GPIO_J, (1<<3), GPIO_OUT_LOW, NULL},
- {"PP3300_DX_EN", LM4_GPIO_J, (1<<2), GPIO_OUT_LOW, NULL},
- {"PP3300_LTE_EN", LM4_GPIO_D, (1<<2), GPIO_OUT_LOW, NULL},
- {"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL},
- {"SUSP_VR_EN", LM4_GPIO_C, (1<<7), GPIO_OUT_LOW, NULL},
- {"VCORE_EN", LM4_GPIO_C, (1<<5), GPIO_OUT_LOW, NULL},
- {"PP5000_EN", LM4_GPIO_H, (1<<7), GPIO_OUT_LOW, NULL},
- {"SYS_PWROK", LM4_GPIO_H, (1<<2), GPIO_OUT_LOW, NULL},
- {"WLAN_OFF_L", LM4_GPIO_J, (1<<4), GPIO_OUT_LOW, NULL},
- {"CHARGE_L", LM4_GPIO_E, (1<<6), GPIO_OUT_LOW, NULL},
-
- {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_OUT_LOW, NULL},
- {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL},
- {"ENTERING_RW", LM4_GPIO_D, (1<<3), GPIO_OUT_LOW, NULL},
- {"PCH_DPWROK", LM4_GPIO_G, (1<<0), GPIO_OUT_LOW, NULL},
- /*
- * HDA_SDO is technically an output, but we need to leave it as an
- * input until we drive it high. So can't use open-drain (HI_Z).
- */
- {"PCH_HDA_SDO", LM4_GPIO_G, (1<<1), GPIO_INPUT, NULL},
- {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_OUT_HIGH, NULL},
- {"PCH_NMI_L", LM4_GPIO_F, (1<<2), GPIO_OUT_HIGH, NULL},
- {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_OUT_HIGH, NULL},
- {"PCH_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL},
- /*
- * PL6 is one of 4 pins on the EC which can't be used in open-drain
- * mode. To work around this PCH_RCIN_L is set to an input. It will
- * only be set to an output when it needs to be driven to 0.
- */
- {"PCH_RCIN_L", LM4_GPIO_L, (1<<6), GPIO_INPUT, NULL},
- {"PCH_RSMRST_L", LM4_GPIO_F, (1<<1), GPIO_OUT_LOW, NULL},
- {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL},
- {"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_OUT_LOW, NULL},
- {"EC_EDP_VDD_EN", LM4_GPIO_J, (1<<5), GPIO_OUT_LOW, NULL},
-
- {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL},
- {"USB1_ENABLE", LM4_GPIO_E, (1<<4), GPIO_OUT_LOW, NULL},
- {"USB2_ENABLE", LM4_GPIO_D, (1<<5), GPIO_OUT_LOW, NULL},
-
- {"PCH_SUSACK_L", LM4_GPIO_F, (1<<3), GPIO_OUT_HIGH, NULL},
- {"PCH_RTCRST_L", LM4_GPIO_F, (1<<6), GPIO_ODR_HIGH, NULL},
- {"PCH_SRTCRST_L", LM4_GPIO_F, (1<<7), GPIO_ODR_HIGH, NULL},
-
- {"PWR_LED_L", LM4_GPIO_N, (1<<6), GPIO_OUT_HIGH, NULL},
- {"KB_LED_EN", LM4_GPIO_D, (1<<4), GPIO_OUT_LOW, NULL},
- {"BAT_LED0", LM4_GPIO_D, (1<<0), GPIO_OUT_LOW, NULL},
- {"BAT_LED1", LM4_GPIO_D, (1<<1), GPIO_OUT_LOW, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/falco/board.h b/board/falco/board.h
index 9cd5ec0c13..8b79534384 100644
--- a/board/falco/board.h
+++ b/board/falco/board.h
@@ -56,84 +56,7 @@
/* USB ports */
#define USB_PORT_COUNT 2
-/* GPIO signal definitions. */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_POWER_BUTTON_L = 0, /* Power button */
- GPIO_LID_OPEN, /* Lid switch */
- GPIO_AC_PRESENT, /* AC power present */
- GPIO_PCH_BKLTEN, /* Backlight enable signal from PCH */
- GPIO_PCH_SLP_S0_L, /* SLP_S0# signal from PCH */
- GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */
- GPIO_PCH_SLP_S5_L, /* SLP_S5# signal from PCH */
- GPIO_PCH_SLP_SUS_L, /* SLP_SUS# signal from PCH */
- GPIO_PP1050_PGOOD, /* Power good on 1.05V */
- GPIO_PP1350_PGOOD, /* Power good on 1.35V (DRAM) */
- GPIO_PP5000_PGOOD, /* Power good on 5V */
- GPIO_VCORE_PGOOD, /* Power good on core VR */
- GPIO_PCH_EDP_VDD_EN, /* PCH wants EDP enabled */
- GPIO_RECOVERY_L, /* Recovery signal from servo */
- GPIO_WP_L, /* Write protect input */
- GPIO_JTAG_TCK, /* JTAG clock input */
- GPIO_UART0_RX, /* UART0 RX input */
-
- /* Other inputs */
- GPIO_FAN_ALERT_L, /* From thermal sensor */
- GPIO_PCH_SUSWARN_L, /* SUSWARN# signal from PCH */
- GPIO_USB1_OC_L, /* USB port overcurrent warning */
- GPIO_USB2_OC_L, /* USB port overcurrent warning */
- GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */
- GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */
- GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */
- GPIO_CPU_PGOOD, /* Power good to the CPU */
-
- /* Outputs */
- GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */
- GPIO_PP1350_EN, /* Enable 1.35V supply */
- GPIO_PP3300_DSW_GATED_EN, /* Enable DSW rails */
- GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */
- GPIO_PP3300_LTE_EN, /* Enable LTE radio */
- GPIO_PP3300_WLAN_EN, /* Enable WiFi power */
- GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */
- GPIO_VCORE_EN, /* Stuffing option - not connected */
- GPIO_PP5000_EN, /* Enable 5V supply */
- GPIO_SYS_PWROK, /* EC thinks everything is up and ready */
- GPIO_WLAN_OFF_L, /* Disable WiFi radio */
- GPIO_CHARGE_L, /* Allow battery to charge when on AC */
-
- GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */
- GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */
- GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */
- GPIO_PCH_DPWROK, /* Indicate when VccDSW is good */
-
- GPIO_PCH_HDA_SDO, /* HDA_SDO signal to PCH; when high, ME
- * ignores security descriptor */
- GPIO_PCH_WAKE_L, /* Wake signal from EC to PCH */
- GPIO_PCH_NMI_L, /* Non-maskable interrupt pin to PCH */
- GPIO_PCH_PWRBTN_L, /* Power button output to PCH */
- GPIO_PCH_PWROK, /* PWROK / APWROK signals to PCH */
- GPIO_PCH_RCIN_L, /* RCIN# line to PCH (for 8042 emulation) */
- GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */
- GPIO_PCH_SMI_L, /* System management interrupt to PCH */
- GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */
- GPIO_EC_EDP_VDD_EN, /* Enable EDP (passthru from PCH) */
- GPIO_LPC_CLKRUN_L, /* Dunno. Probably important, though. */
-
- GPIO_USB1_ENABLE, /* USB port 1 output power enable */
- GPIO_USB2_ENABLE, /* USB port 2 output power enable */
-
- GPIO_PCH_SUSACK_L, /* Acknowledge PCH SUSWARN# signal */
- GPIO_PCH_RTCRST_L, /* Not supposed to be here */
- GPIO_PCH_SRTCRST_L, /* Not supposed to be here */
-
- GPIO_PWR_LED_L, /* Power LED */
- GPIO_KB_LED_EN, /* Keyboard LED */
- GPIO_BAT_LED0, /* Battery charger status */
- GPIO_BAT_LED1, /* Battery charger status */
-
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* power signal definitions */
enum power_signal {
diff --git a/board/falco/gpio.inc b/board/falco/gpio.inc
new file mode 100644
index 0000000000..9d405d6f12
--- /dev/null
+++ b/board/falco/gpio.inc
@@ -0,0 +1,148 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+/* Power button */
+GPIO(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH_DSLEEP, power_button_interrupt)
+/* Lid switch */
+GPIO(LID_OPEN, A, 3, GPIO_INT_BOTH_DSLEEP, lid_interrupt)
+/* AC power present */
+GPIO(AC_PRESENT, H, 3, GPIO_INT_BOTH_DSLEEP, extpower_interrupt)
+/* Backlight enable signal from PCH */
+GPIO(PCH_BKLTEN, M, 3, GPIO_INT_BOTH, backlight_interrupt)
+/* SLP_S0# signal from PCH */
+GPIO(PCH_SLP_S0_L, G, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* SLP_S3# signal from PCH */
+GPIO(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt)
+/* SLP_S5# signal from PCH */
+GPIO(PCH_SLP_S5_L, H, 1, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt)
+/* SLP_SUS# signal from PCH */
+GPIO(PCH_SLP_SUS_L, G, 3, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 1.05V */
+GPIO(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 1.35V (DRAM) */
+GPIO(PP1350_PGOOD, H, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 5V */
+GPIO(PP5000_PGOOD, N, 0, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on core VR */
+GPIO(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* PCH wants EDP enabled */
+GPIO(PCH_EDP_VDD_EN, J, 1, GPIO_INT_BOTH, lcdvcc_interrupt)
+/* Recovery signal from servo */
+GPIO(RECOVERY_L, A, 5, GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt)
+/* Write protect input */
+GPIO(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt)
+/* JTAG clock input */
+GPIO(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt)
+/* UART0 RX input */
+GPIO(UART0_RX, A, 0, GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP,
+ uart_deepsleep_interrupt)
+
+/* Other inputs */
+/* From thermal sensor */
+GPIO(FAN_ALERT_L, B, 0, GPIO_INPUT, NULL)
+/* SUSWARN# signal from PCH */
+GPIO(PCH_SUSWARN_L, G, 2, GPIO_INT_BOTH, NULL)
+/* USB port overcurrent warning */
+GPIO(USB1_OC_L, E, 7, GPIO_INPUT, NULL)
+/* USB port overcurrent warning */
+GPIO(USB2_OC_L, E, 0, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 1 */
+GPIO(BOARD_VERSION1, Q, 5, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 2 */
+GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 3 */
+GPIO(BOARD_VERSION3, Q, 7, GPIO_INPUT, NULL)
+/* Power good to the CPU */
+GPIO(CPU_PGOOD, C, 4, GPIO_INPUT, NULL)
+
+/* Outputs; all unasserted by default except for reset signals */
+/* Force CPU to think it's overheated */
+GPIO(CPU_PROCHOT, B, 1, GPIO_OUT_LOW, NULL)
+/* Enable 1.35V supply */
+GPIO(PP1350_EN, H, 5, GPIO_OUT_LOW, NULL)
+/* Enable DSW rails */
+GPIO(PP3300_DSW_GATED_EN, J, 3, GPIO_OUT_LOW, NULL)
+/* Enable power to lots of peripherals */
+GPIO(PP3300_DX_EN, J, 2, GPIO_OUT_LOW, NULL)
+/* Enable LTE radio */
+GPIO(PP3300_LTE_EN, D, 2, GPIO_OUT_LOW, NULL)
+/* Enable WiFi power */
+GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW, NULL)
+/* Enable 1.05V regulator */
+GPIO(SUSP_VR_EN, C, 7, GPIO_OUT_LOW, NULL)
+/* Stuffing option - not connected */
+GPIO(VCORE_EN, C, 5, GPIO_OUT_LOW, NULL)
+/* Enable 5V supply */
+GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW, NULL)
+/* EC thinks everything is up and ready */
+GPIO(SYS_PWROK, H, 2, GPIO_OUT_LOW, NULL)
+/* Disable WiFi radio */
+GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW, NULL)
+/* Allow battery to charge when on AC */
+GPIO(CHARGE_L, E, 6, GPIO_OUT_LOW, NULL)
+
+/* Enable backlight power */
+GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_OUT_LOW, NULL)
+/* Enable touchpad power */
+GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW, NULL)
+/* Indicate when EC is entering RW code */
+GPIO(ENTERING_RW, D, 3, GPIO_OUT_LOW, NULL)
+/* Indicate when VccDSW is good */
+GPIO(PCH_DPWROK, G, 0, GPIO_OUT_LOW, NULL)
+/*
+ * HDA_SDO is technically an output, but we need to leave it as an
+ * input until we drive it high. So can't use open-drain (HI_Z).
+ */
+/* HDA_SDO signal to PCH; when high, ME ignores security descriptor */
+GPIO(PCH_HDA_SDO, G, 1, GPIO_INPUT, NULL)
+/* Wake signal from EC to PCH */
+GPIO(PCH_WAKE_L, F, 0, GPIO_OUT_HIGH, NULL)
+/* Non-maskable interrupt pin to PCH */
+GPIO(PCH_NMI_L, F, 2, GPIO_OUT_HIGH, NULL)
+/* Power button output to PCH */
+GPIO(PCH_PWRBTN_L, H, 0, GPIO_OUT_HIGH, NULL)
+/* PWROK / APWROK signals to PCH */
+GPIO(PCH_PWROK, F, 5, GPIO_OUT_LOW, NULL)
+/*
+ * PL6 is one of 4 pins on the EC which can't be used in open-drain
+ * mode. To work around this PCH_RCIN_L is set to an input. It will
+ * only be set to an output when it needs to be driven to 0.
+ */
+/* RCIN# line to PCH (for 8042 emulation) */
+GPIO(PCH_RCIN_L, L, 6, GPIO_INPUT, NULL)
+/* Reset PCH resume power plane logic */
+GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW, NULL)
+/* System management interrupt to PCH */
+GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH, NULL)
+/* Reset touch screen */
+GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_OUT_LOW, NULL)
+/* Enable EDP (passthru from PCH) */
+GPIO(EC_EDP_VDD_EN, J, 5, GPIO_OUT_LOW, NULL)
+
+/* Dunno. Probably important, though. */
+GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH, NULL)
+/* USB port 1 output power enable */
+GPIO(USB1_ENABLE, E, 4, GPIO_OUT_LOW, NULL)
+/* USB port 2 output power enable */
+GPIO(USB2_ENABLE, D, 5, GPIO_OUT_LOW, NULL)
+
+/* Acknowledge PCH SUSWARN# signal */
+GPIO(PCH_SUSACK_L, F, 3, GPIO_OUT_HIGH, NULL)
+/* Not supposed to be here */
+GPIO(PCH_RTCRST_L, F, 6, GPIO_ODR_HIGH, NULL)
+/* Not supposed to be here */
+GPIO(PCH_SRTCRST_L, F, 7, GPIO_ODR_HIGH, NULL)
+
+/* Power LED */
+GPIO(PWR_LED_L, N, 6, GPIO_OUT_HIGH, NULL)
+/* Keyboard LED */
+GPIO(KB_LED_EN, D, 4, GPIO_OUT_LOW, NULL)
+/* Battery charger status */
+GPIO(BAT_LED0, D, 0, GPIO_OUT_LOW, NULL)
+/* Battery charger status */
+GPIO(BAT_LED1, D, 1, GPIO_OUT_LOW, NULL)
diff --git a/board/firefly/board.c b/board/firefly/board.c
index 3364abf14f..a61069d75b 100644
--- a/board/firefly/board.c
+++ b/board/firefly/board.c
@@ -77,62 +77,7 @@ void board_config_pre_init(void)
STM32_SYSCFG_CFGR1 |= (1 << 9) | (1 << 10);/* Remap USART1 RX/TX DMA */
}
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- {"VBUS_WAKE", GPIO_C, (1<<13), GPIO_INT_BOTH, vbus_event},
- /* Buttons */
- {"SW_PP20000", GPIO_B, (1<<10), GPIO_INT_FALLING, button_event},
- {"SW_PP12000", GPIO_B, (1<<11), GPIO_INT_FALLING, button_event},
- {"SW_PP5000", GPIO_B, (1<<12), GPIO_INT_FALLING, button_event},
-
- /* PD RX/TX */
- {"USB_CC1_PD", GPIO_A, (1<<0), GPIO_ANALOG, NULL},
- {"PD_REF1", GPIO_A, (1<<1), GPIO_ANALOG, NULL},
- {"USB_CC2_PD", GPIO_A, (1<<2), GPIO_ANALOG, NULL},
- {"PD_REF2", GPIO_A, (1<<3), GPIO_ANALOG, NULL},
- {"PD_CC1_TX_EN", GPIO_A, (1<<4), GPIO_ODR_HIGH, NULL},
- {"PD_CC2_TX_EN", GPIO_A, (1<<15), GPIO_ODR_HIGH, NULL},
- {"PD_CLK_OUT", GPIO_B, (1<<9), GPIO_OUT_LOW, NULL},
- {"PD_CC1_TX_DATA", GPIO_A, (1<<6), GPIO_INPUT, NULL},
- {"PD_CC2_TX_DATA", GPIO_B, (1<<4), GPIO_INPUT, NULL},
- {"PD_CLK_IN", GPIO_B, (1<<3), GPIO_INPUT, NULL},
-
- /* CCx device pull-downs */
- {"PD_CC1_DEVICE", GPIO_B, (1<<13), GPIO_ODR_LOW, NULL},
- {"PD_CC2_DEVICE", GPIO_B, (1<<14), GPIO_ODR_LOW, NULL},
-
- /* ADC */
- {"VBUS_SENSE", GPIO_A, (1<<5), GPIO_ANALOG, NULL},
-
- /* LEDs control */
- {"LED_PP20000", GPIO_B, (1<<0), GPIO_OUT_LOW, NULL},
- {"LED_PP12000", GPIO_B, (1<<1), GPIO_OUT_LOW, NULL},
- {"LED_PP5000", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL},
-
- /* Slave I2C port */
- {"I2C_INT_L", GPIO_B, (1<<8), GPIO_ODR_HIGH, NULL},
- /*
- * I2C pins should be configured as inputs until I2C module is
- * initialized. This will avoid driving the lines unintentionally.
- */
- {"I2C_SCL", GPIO_B, (1<<6), GPIO_INPUT, NULL},
- {"I2C_SDA", GPIO_B, (1<<7), GPIO_INPUT, NULL},
-
- /* Test points */
- {"TP_A8", GPIO_A, (1<<8), GPIO_ODR_HIGH, NULL},
- {"TP_A13", GPIO_A, (1<<13), GPIO_ODR_HIGH, NULL},
- {"TP_A14", GPIO_A, (1<<14), GPIO_ODR_HIGH, NULL},
- {"TP_B15", GPIO_B, (1<<15), GPIO_ODR_HIGH, NULL},
- {"TP_C14", GPIO_C, (1<<14), GPIO_ODR_HIGH, NULL},
- {"TP_C15", GPIO_C, (1<<15), GPIO_ODR_HIGH, NULL},
- {"TP_F0", GPIO_F, (1<<0), GPIO_ODR_HIGH, NULL},
- {"TP_F1", GPIO_F, (1<<1), GPIO_ODR_HIGH, NULL},
-
- /* Unimplemented signals which we need to emulate for now */
- GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
- GPIO_SIGNAL_NOT_IMPLEMENTED("WP_L"),
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/firefly/board.h b/board/firefly/board.h
index 5388ac411b..a9bd7b47ee 100644
--- a/board/firefly/board.h
+++ b/board/firefly/board.h
@@ -42,59 +42,7 @@
#define TIM_CLOCK32 2
#define TIM_ADC 3
-/* GPIO signal list */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_VBUS_WAKE = 0,
- GPIO_SW_PP20000,
- GPIO_SW_PP12000,
- GPIO_SW_PP5000,
-
- /* PD RX/TX */
- GPIO_USB_CC1_PD,
- GPIO_PD_REF1,
- GPIO_USB_CC2_PD,
- GPIO_PD_REF2,
- GPIO_PD_CC1_TX_EN,
- GPIO_PD_CC2_TX_EN,
- GPIO_PD_CLK_OUT,
- GPIO_PD_CC1_TX_DATA,
- GPIO_PD_CC2_TX_DATA,
- GPIO_PD_CLK_IN,
-
- /* CCx device pull-downs */
- GPIO_PD_CC1_DEVICE,
- GPIO_PD_CC2_DEVICE,
-
- /* ADCs */
- GPIO_VBUS_SENSE,
-
- /* LEDs control */
- GPIO_LED_PP20000,
- GPIO_LED_PP12000,
- GPIO_LED_PP5000,
-
- /* Slave I2C */
- GPIO_I2C_INT_L,
- GPIO_I2C_SCL,
- GPIO_I2C_SDA,
-
- /* Test points */
- GPIO_TP_A8,
- GPIO_TP_A13,
- GPIO_TP_A14,
- GPIO_TP_B15,
- GPIO_TP_C14,
- GPIO_TP_C15,
- GPIO_TP_F0,
- GPIO_TP_F1,
-
- /* Unimplemented signals we emulate */
- GPIO_ENTERING_RW,
- GPIO_WP_L,
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* ADC signal */
enum adc_channel {
diff --git a/board/firefly/gpio.inc b/board/firefly/gpio.inc
new file mode 100644
index 0000000000..bf4a70851a
--- /dev/null
+++ b/board/firefly/gpio.inc
@@ -0,0 +1,61 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+GPIO(VBUS_WAKE, C, 13, GPIO_INT_BOTH, vbus_event)
+
+/* Buttons */
+GPIO(SW_PP20000, B, 10, GPIO_INT_FALLING, button_event)
+GPIO(SW_PP12000, B, 11, GPIO_INT_FALLING, button_event)
+GPIO(SW_PP5000, B, 12, GPIO_INT_FALLING, button_event)
+
+/* PD RX/TX */
+GPIO(USB_CC1_PD, A, 0, GPIO_ANALOG, NULL)
+GPIO(PD_REF1, A, 1, GPIO_ANALOG, NULL)
+GPIO(USB_CC2_PD, A, 2, GPIO_ANALOG, NULL)
+GPIO(PD_REF2, A, 3, GPIO_ANALOG, NULL)
+GPIO(PD_CC1_TX_EN, A, 4, GPIO_ODR_HIGH, NULL)
+GPIO(PD_CC2_TX_EN, A, 15, GPIO_ODR_HIGH, NULL)
+GPIO(PD_CLK_OUT, B, 9, GPIO_OUT_LOW, NULL)
+GPIO(PD_CC1_TX_DATA, A, 6, GPIO_INPUT, NULL)
+GPIO(PD_CC2_TX_DATA, B, 4, GPIO_INPUT, NULL)
+GPIO(PD_CLK_IN, B, 3, GPIO_INPUT, NULL)
+
+/* CCx device pull-downs */
+GPIO(PD_CC1_DEVICE, B, 13, GPIO_ODR_LOW, NULL)
+GPIO(PD_CC2_DEVICE, B, 14, GPIO_ODR_LOW, NULL)
+
+/* ADC */
+GPIO(VBUS_SENSE, A, 5, GPIO_ANALOG, NULL)
+
+/* LEDs control */
+GPIO(LED_PP20000, B, 0, GPIO_OUT_LOW, NULL)
+GPIO(LED_PP12000, B, 1, GPIO_OUT_LOW, NULL)
+GPIO(LED_PP5000, B, 2, GPIO_OUT_LOW, NULL)
+
+/* Slave I2C port */
+GPIO(I2C_INT_L, B, 8, GPIO_ODR_HIGH, NULL)
+/*
+ * I2C pins should be configured as inputs until I2C module is
+ * initialized. This will avoid driving the lines unintentionally.
+ */
+GPIO(I2C_SCL, B, 6, GPIO_INPUT, NULL)
+GPIO(I2C_SDA, B, 7, GPIO_INPUT, NULL)
+
+/* Test points */
+GPIO(TP_A8, A, 8, GPIO_ODR_HIGH, NULL)
+GPIO(TP_A13, A, 13, GPIO_ODR_HIGH, NULL)
+GPIO(TP_A14, A, 14, GPIO_ODR_HIGH, NULL)
+GPIO(TP_B15, B, 15, GPIO_ODR_HIGH, NULL)
+GPIO(TP_C14, C, 14, GPIO_ODR_HIGH, NULL)
+GPIO(TP_C15, C, 15, GPIO_ODR_HIGH, NULL)
+GPIO(TP_F0, F, 0, GPIO_ODR_HIGH, NULL)
+GPIO(TP_F1, F, 1, GPIO_ODR_HIGH, NULL)
+
+/* Unimplemented signals which we need to emulate for now */
+UNIMPLEMENTED(ENTERING_RW)
+UNIMPLEMENTED(WP_L)
diff --git a/board/fruitpie/board.c b/board/fruitpie/board.c
index c0121208de..17a01934a5 100644
--- a/board/fruitpie/board.c
+++ b/board/fruitpie/board.c
@@ -30,71 +30,7 @@ void tsu_event(enum gpio_signal signal)
ccprintf("TSU!\n");
}
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- {"VBUS_WAKE", GPIO_B, (1<<5), GPIO_INT_BOTH, vbus_event},
- {"MASTER_I2C_INT_L", GPIO_C, (1<<13), GPIO_INT_FALLING, tsu_event},
-
- /* PD RX/TX */
- {"USB_CC1_PD", GPIO_A, (1<<0), GPIO_ANALOG, NULL},
- {"PD_REF1", GPIO_A, (1<<1), GPIO_ANALOG, NULL},
- {"PD_REF2", GPIO_A, (1<<3), GPIO_ANALOG, NULL},
- {"USB_CC2_PD", GPIO_A, (1<<4), GPIO_ANALOG, NULL},
- {"PD_CLK_OUT", GPIO_B, (1<<9), GPIO_OUT_LOW, NULL},
- {"PD_TX_EN", GPIO_B, (1<<12), GPIO_OUT_LOW, NULL},
- {"PD_TX_DATA", GPIO_B, (1<<14), GPIO_OUT_LOW, NULL},
-#if 0
- {"PD_CLK_IN", GPIO_B, (1<<13), GPIO_OUT_LOW, NULL},
-#endif
-
- /* Power and muxes control */
- {"PP5000_EN", GPIO_A, (1<<5), GPIO_OUT_HIGH, NULL},
- {"CC_HOST", GPIO_A, (1<<6), GPIO_OUT_LOW, NULL},
- {"CHARGE_EN_L", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL},
- {"USB_C_5V_EN", GPIO_A, (1<<10), GPIO_OUT_LOW, NULL},
- {"VCONN1_EN", GPIO_B, (1<<15), GPIO_OUT_LOW, NULL},
- {"VCONN2_EN", GPIO_C, (1<<14), GPIO_OUT_LOW, NULL},
- {"SS1_EN_L", GPIO_A, (1<<9), GPIO_OUT_HIGH, NULL},
- {"SS2_EN_L", GPIO_B, (1<<4), GPIO_OUT_HIGH, NULL},
- {"SS2_USB_MODE_L", GPIO_B, (1<<3), GPIO_OUT_HIGH, NULL},
- {"SS1_USB_MODE_L", GPIO_B, (1<<8), GPIO_OUT_HIGH, NULL},
- {"DP_MODE", GPIO_C, (1<<15), GPIO_OUT_LOW, NULL},
- {"DP_POLARITY_L", GPIO_A, (1<<7), GPIO_OUT_HIGH, NULL},
-
- /* Not used : no host on that bus */
- {"SLAVE_I2C_INT_L", GPIO_B, (1<<2), GPIO_ODR_HIGH, NULL},
-
- /* Alternate functions */
-#if 0
- {"USB_DM", GPIO_A, (1<<11), GPIO_ANALOG, NULL},
- {"USB_DP", GPIO_A, (1<<12), GPIO_ANALOG, NULL},
- {"UART_TX", GPIO_A, (1<<14), GPIO_OUT_LOW, NULL},
- {"UART_RX", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
-#endif
- /*
- * I2C pins should be configured as inputs until I2C module is
- * initialized. This will avoid driving the lines unintentionally.
- */
- {"SLAVE_I2C_SCL", GPIO_B, (1<<6), GPIO_INPUT, NULL},
- {"SLAVE_I2C_SDA", GPIO_B, (1<<7), GPIO_INPUT, NULL},
- {"MASTER_I2C_SCL", GPIO_B, (1<<10), GPIO_INPUT, NULL},
- {"MASTER_I2C_SDA", GPIO_B, (1<<11), GPIO_INPUT, NULL},
-
- /* Rohm BD92104 connections */
- {"ALERT_L", GPIO_A, (1<<2), GPIO_INT_FALLING, rohm_event},
- {"USBPD_RST", GPIO_B, (1<<0), GPIO_OUT_LOW, NULL},
- {"USBPD_FORCE_OTG", GPIO_B, (1<<1), GPIO_OUT_LOW, NULL},
- {"USBPD_VIN_EN_L", GPIO_F, (1<<0), GPIO_OUT_HIGH, NULL},
-
- /* Test points */
- {"TP9", GPIO_A, (1<<13), GPIO_ODR_HIGH, NULL},
- {"TP11", GPIO_F, (1<<1), GPIO_ODR_HIGH, NULL},
-
- /* Unimplemented signals which we need to emulate for now */
- GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
- GPIO_SIGNAL_NOT_IMPLEMENTED("WP_L"),
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Initialize board. */
static void board_init(void)
diff --git a/board/fruitpie/board.h b/board/fruitpie/board.h
index 9b5692f5f4..aec3faf648 100644
--- a/board/fruitpie/board.h
+++ b/board/fruitpie/board.h
@@ -56,63 +56,7 @@
#define TIM_CLOCK32 2
#define TIM_ADC 3
-/* GPIO signal list */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_VBUS_WAKE = 0,
- GPIO_MASTER_I2C_INT_L,
-
- /* PD RX/TX */
- GPIO_USB_CC1_PD,
- GPIO_PD_REF1,
- GPIO_PD_REF2,
- GPIO_USB_CC2_PD,
- GPIO_PD_CLK_OUT,
- GPIO_PD_TX_EN,
- GPIO_PD_TX_DATA,
-#if 0
- GPIO_PD_CLK_IN,
-#endif
-
- /* Power and muxes control */
- GPIO_PP5000_EN,
- GPIO_CC_HOST,
- GPIO_CHARGE_EN_L,
- GPIO_USB_C_5V_EN,
- GPIO_VCONN1_EN,
- GPIO_VCONN2_EN,
- GPIO_SS1_EN_L,
- GPIO_SS2_EN_L,
- GPIO_SS2_USB_MODE_L,
- GPIO_SS1_USB_MODE_L,
- GPIO_DP_MODE,
- GPIO_DP_POLARITY_L,
-
- /* Not used : no host on that bus */
- GPIO_SLAVE_I2C_INT_L,
-
- /* I2C busses */
- GPIO_SLAVE_I2C_SCL,
- GPIO_SLAVE_I2C_SDA,
- GPIO_MASTER_I2C_SCL,
- GPIO_MASTER_I2C_SDA,
-
- /* Rohm BD92104 connections */
- GPIO_ALERT_L,
- GPIO_USBPD_RST,
- GPIO_USBPD_FORCE_OTG,
- GPIO_USBPD_VIN_EN_L,
-
- /* Test points */
- GPIO_TP9,
- GPIO_TP11,
-
- /* Unimplemented signals we emulate */
- GPIO_ENTERING_RW,
- GPIO_WP_L,
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* ADC signal */
enum adc_channel {
diff --git a/board/fruitpie/gpio.inc b/board/fruitpie/gpio.inc
new file mode 100644
index 0000000000..cc3b7e3fe0
--- /dev/null
+++ b/board/fruitpie/gpio.inc
@@ -0,0 +1,68 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+GPIO(VBUS_WAKE, B, 5, GPIO_INT_BOTH, vbus_event)
+GPIO(MASTER_I2C_INT_L, C, 13, GPIO_INT_FALLING, tsu_event)
+
+/* PD RX/TX */
+GPIO(USB_CC1_PD, A, 0, GPIO_ANALOG, NULL)
+GPIO(PD_REF1, A, 1, GPIO_ANALOG, NULL)
+GPIO(PD_REF2, A, 3, GPIO_ANALOG, NULL)
+GPIO(USB_CC2_PD, A, 4, GPIO_ANALOG, NULL)
+GPIO(PD_CLK_OUT, B, 9, GPIO_OUT_LOW, NULL)
+GPIO(PD_TX_EN, B, 12, GPIO_OUT_LOW, NULL)
+GPIO(PD_TX_DATA, B, 14, GPIO_OUT_LOW, NULL)
+#if 0
+GPIO(PD_CLK_IN, B, 13, GPIO_OUT_LOW, NULL)
+#endif
+
+/* Power and muxes control */
+GPIO(PP5000_EN, A, 5, GPIO_OUT_HIGH, NULL)
+GPIO(CC_HOST, A, 6, GPIO_OUT_LOW, NULL)
+GPIO(CHARGE_EN_L, A, 8, GPIO_OUT_LOW, NULL)
+GPIO(USB_C_5V_EN, A, 10, GPIO_OUT_LOW, NULL)
+GPIO(VCONN1_EN, B, 15, GPIO_OUT_LOW, NULL)
+GPIO(VCONN2_EN, C, 14, GPIO_OUT_LOW, NULL)
+GPIO(SS1_EN_L, A, 9, GPIO_OUT_HIGH, NULL)
+GPIO(SS2_EN_L, B, 4, GPIO_OUT_HIGH, NULL)
+GPIO(SS2_USB_MODE_L, B, 3, GPIO_OUT_HIGH, NULL)
+GPIO(SS1_USB_MODE_L, B, 8, GPIO_OUT_HIGH, NULL)
+GPIO(DP_MODE, C, 15, GPIO_OUT_LOW, NULL)
+GPIO(DP_POLARITY_L, A, 7, GPIO_OUT_HIGH, NULL)
+
+/* Not used : no host on that bus */
+GPIO(SLAVE_I2C_INT_L, B, 2, GPIO_ODR_HIGH, NULL)
+
+/* Alternate functions */
+#if 0
+GPIO(USB_DM, A, 11, GPIO_ANALOG, NULL)
+GPIO(USB_DP, A, 12, GPIO_ANALOG, NULL)
+GPIO(UART_TX, A, 14, GPIO_OUT_LOW, NULL)
+GPIO(UART_RX, A, 15, GPIO_OUT_LOW, NULL)
+#endif
+/*
+ * I2C pins should be configured as inputs until I2C module is
+ * initialized. This will avoid driving the lines unintentionally.
+ */
+GPIO(SLAVE_I2C_SCL, B, 6, GPIO_INPUT, NULL)
+GPIO(SLAVE_I2C_SDA, B, 7, GPIO_INPUT, NULL)
+GPIO(MASTER_I2C_SCL, B, 10, GPIO_INPUT, NULL)
+GPIO(MASTER_I2C_SDA, B, 11, GPIO_INPUT, NULL)
+
+/* Rohm BD92104 connections */
+GPIO(ALERT_L, A, 2, GPIO_INT_FALLING, rohm_event)
+GPIO(USBPD_RST, B, 0, GPIO_OUT_LOW, NULL)
+GPIO(USBPD_FORCE_OTG, B, 1, GPIO_OUT_LOW, NULL)
+GPIO(USBPD_VIN_EN_L, F, 0, GPIO_OUT_HIGH, NULL)
+
+/* Test points */
+GPIO(TP9, A, 13, GPIO_ODR_HIGH, NULL)
+GPIO(TP11, F, 1, GPIO_ODR_HIGH, NULL)
+
+/* Unimplemented signals which we need to emulate for now */
+UNIMPLEMENTED(ENTERING_RW)
+UNIMPLEMENTED(WP_L)
diff --git a/board/host/board.c b/board/host/board.c
index 1d9ab77c23..407018a573 100644
--- a/board/host/board.c
+++ b/board/host/board.c
@@ -14,22 +14,14 @@
#include "timer.h"
#include "util.h"
-#define MOCK_GPIO(x) {#x, 0, 0, 0, 0}
-#define MOCK_GPIO_INT(x, i, r) {#x, 0, 0, i, r}
+/*
+ * GPIO_0 is the name generated by the gpio.inc GPIO macros for all of the host
+ * GPIO ports. This maps back to 0, which is then ignored by the host GPIO mock
+ * code.
+ */
+#define GPIO_0 0
-const struct gpio_info gpio_list[] = {
- MOCK_GPIO(EC_INT),
- MOCK_GPIO_INT(LID_OPEN, GPIO_INT_BOTH, lid_interrupt),
- MOCK_GPIO_INT(POWER_BUTTON_L, GPIO_INT_BOTH, power_button_interrupt),
- MOCK_GPIO(WP),
- MOCK_GPIO(ENTERING_RW),
- MOCK_GPIO_INT(AC_PRESENT, GPIO_INT_BOTH, extpower_interrupt),
- MOCK_GPIO(PCH_BKLTEN),
- MOCK_GPIO(ENABLE_BACKLIGHT),
- MOCK_GPIO_INT(BUTTON_VOLUME_DOWN_L, GPIO_INT_BOTH, button_interrupt),
- MOCK_GPIO_INT(BUTTON_VOLUME_UP, GPIO_INT_BOTH, button_interrupt),
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions; not on simulated host platform */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/host/board.h b/board/host/board.h
index 5ab078292f..b8ce98513a 100644
--- a/board/host/board.h
+++ b/board/host/board.h
@@ -21,20 +21,7 @@
#define CONFIG_WP_ACTIVE_HIGH
-enum gpio_signal {
- GPIO_EC_INT,
- GPIO_LID_OPEN,
- GPIO_POWER_BUTTON_L,
- GPIO_WP,
- GPIO_ENTERING_RW,
- GPIO_AC_PRESENT,
- GPIO_PCH_BKLTEN,
- GPIO_ENABLE_BACKLIGHT,
- GPIO_BUTTON_VOLUME_DOWN_L,
- GPIO_BUTTON_VOLUME_UP,
-
- GPIO_COUNT
-};
+#include "gpio_signal.h"
enum temp_sensor_id {
TEMP_SENSOR_CPU = 0,
diff --git a/board/host/gpio.inc b/board/host/gpio.inc
new file mode 100644
index 0000000000..578e97c066
--- /dev/null
+++ b/board/host/gpio.inc
@@ -0,0 +1,17 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+GPIO(EC_INT, 0, 0, 0, NULL)
+GPIO(LID_OPEN, 0, 0, GPIO_INT_BOTH, lid_interrupt)
+GPIO(POWER_BUTTON_L, 0, 0, GPIO_INT_BOTH, power_button_interrupt)
+GPIO(WP, 0, 0, 0, NULL)
+GPIO(ENTERING_RW, 0, 0, 0, NULL)
+GPIO(AC_PRESENT, 0, 0, GPIO_INT_BOTH, extpower_interrupt)
+GPIO(PCH_BKLTEN, 0, 0, 0, NULL)
+GPIO(ENABLE_BACKLIGHT, 0, 0, 0, NULL)
+GPIO(BUTTON_VOLUME_DOWN_L, 0, 0, GPIO_INT_BOTH, button_interrupt)
+GPIO(BUTTON_VOLUME_UP, 0, 0, GPIO_INT_BOTH, button_interrupt)
diff --git a/board/it8380dev/board.c b/board/it8380dev/board.c
index adad1d73a8..51799ba46a 100644
--- a/board/it8380dev/board.c
+++ b/board/it8380dev/board.c
@@ -22,34 +22,7 @@ void test_interrupt(enum gpio_signal signal)
gpio_set_level(GPIO_BUSY_LED, busy_state);
}
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- {"H_LED0", GPIO_A, (1<<0), GPIO_ODR_HIGH},
- {"H_LED1", GPIO_A, (1<<1), GPIO_ODR_HIGH},
- {"H_LED2", GPIO_A, (1<<2), GPIO_ODR_HIGH},
- {"H_LED3", GPIO_A, (1<<3), GPIO_ODR_HIGH},
- {"H_LED4", GPIO_A, (1<<4), GPIO_ODR_HIGH},
- {"H_LED5", GPIO_A, (1<<5), GPIO_ODR_HIGH},
- {"H_LED6", GPIO_A, (1<<6), GPIO_ODR_HIGH},
- {"L_LED0", GPIO_I, (1<<0), GPIO_ODR_HIGH},
- {"L_LED1", GPIO_I, (1<<1), GPIO_ODR_HIGH},
- {"L_LED2", GPIO_I, (1<<2), GPIO_ODR_HIGH},
- {"L_LED3", GPIO_I, (1<<3), GPIO_ODR_HIGH},
- {"L_LED4", GPIO_I, (1<<4), GPIO_ODR_HIGH},
- {"L_LED5", GPIO_I, (1<<5), GPIO_ODR_HIGH},
- {"L_LED6", GPIO_I, (1<<6), GPIO_ODR_HIGH},
- {"BUSY_LED", GPIO_J, (1<<0), GPIO_OUT_LOW},
- {"GOOD_LED", GPIO_J, (1<<1), GPIO_OUT_HIGH},
- {"FAIL_LED", GPIO_J, (1<<2), GPIO_OUT_LOW},
- {"SW0", GPIO_E, (1<<0), GPIO_INPUT},
- {"SW1", GPIO_E, (1<<1), GPIO_INPUT | GPIO_PULL_DOWN},
- {"SW2", GPIO_E, (1<<2), GPIO_INPUT | GPIO_PULL_DOWN},
- {"SW3", GPIO_E, (1<<3), GPIO_INPUT | GPIO_PULL_DOWN},
- {"START_SW", GPIO_E, (1<<4), GPIO_INT_FALLING, test_interrupt},
- /* Unimplemented signals which we need to emulate for now */
- GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/it8380dev/board.h b/board/it8380dev/board.h
index dc1fe01187..04d3f1b4c0 100644
--- a/board/it8380dev/board.h
+++ b/board/it8380dev/board.h
@@ -13,35 +13,7 @@
/* stubbed features */
#undef CONFIG_LID_SWITCH
-enum gpio_signal {
- GPIO_H_LED0,
- GPIO_H_LED1,
- GPIO_H_LED2,
- GPIO_H_LED3,
- GPIO_H_LED4,
- GPIO_H_LED5,
- GPIO_H_LED6,
- GPIO_L_LED0,
- GPIO_L_LED1,
- GPIO_L_LED2,
- GPIO_L_LED3,
- GPIO_L_LED4,
- GPIO_L_LED5,
- GPIO_L_LED6,
- GPIO_BUSY_LED,
- GPIO_GOOD_LED,
- GPIO_FAIL_LED,
- GPIO_SW1,
- GPIO_SW2,
- GPIO_SW3,
- GPIO_SW4,
- GPIO_START_SW,
- /* Unimplemented GPIOs */
- GPIO_ENTERING_RW,
-
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */
diff --git a/board/it8380dev/gpio.inc b/board/it8380dev/gpio.inc
new file mode 100644
index 0000000000..dd8ffebde2
--- /dev/null
+++ b/board/it8380dev/gpio.inc
@@ -0,0 +1,32 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+GPIO(H_LED0, A, 0, GPIO_ODR_HIGH)
+GPIO(H_LED1, A, 1, GPIO_ODR_HIGH)
+GPIO(H_LED2, A, 2, GPIO_ODR_HIGH)
+GPIO(H_LED3, A, 3, GPIO_ODR_HIGH)
+GPIO(H_LED4, A, 4, GPIO_ODR_HIGH)
+GPIO(H_LED5, A, 5, GPIO_ODR_HIGH)
+GPIO(H_LED6, A, 6, GPIO_ODR_HIGH)
+GPIO(L_LED0, I, 0, GPIO_ODR_HIGH)
+GPIO(L_LED1, I, 1, GPIO_ODR_HIGH)
+GPIO(L_LED2, I, 2, GPIO_ODR_HIGH)
+GPIO(L_LED3, I, 3, GPIO_ODR_HIGH)
+GPIO(L_LED4, I, 4, GPIO_ODR_HIGH)
+GPIO(L_LED5, I, 5, GPIO_ODR_HIGH)
+GPIO(L_LED6, I, 6, GPIO_ODR_HIGH)
+GPIO(BUSY_LED, J, 0, GPIO_OUT_LOW)
+GPIO(GOOD_LED, J, 1, GPIO_OUT_HIGH)
+GPIO(FAIL_LED, J, 2, GPIO_OUT_LOW)
+GPIO(SW1, E, 0, GPIO_INPUT)
+GPIO(SW2, E, 1, GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(SW3, E, 2, GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(SW4, E, 3, GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(START_SW, E, 4, GPIO_INT_FALLING, test_interrupt)
+
+/* Unimplemented signals which we need to emulate for now */
+UNIMPLEMENTED(ENTERING_RW)
diff --git a/board/link/board.c b/board/link/board.c
index 9faadcbfce..f3e22f720e 100644
--- a/board/link/board.c
+++ b/board/link/board.c
@@ -29,103 +29,7 @@
#include "thermal.h"
#include "util.h"
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"POWER_BUTTON_L", LM4_GPIO_K, (1<<7), GPIO_INT_BOTH,
- power_button_interrupt},
- {"LID_OPEN", LM4_GPIO_K, (1<<5), GPIO_INT_BOTH,
- lid_interrupt},
- /* Other inputs */
- {"THERMAL_DATA_READY_L", LM4_GPIO_B, (1<<4), GPIO_INPUT, NULL},
- {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH,
- extpower_interrupt},
- {"BOARD_VERSION1", LM4_GPIO_H, (1<<6), GPIO_INPUT, NULL},
- {"BOARD_VERSION2", LM4_GPIO_L, (1<<6), GPIO_INPUT, NULL},
- {"BOARD_VERSION3", LM4_GPIO_L, (1<<7), GPIO_INPUT, NULL},
- {"ONEWIRE", LM4_GPIO_H, (1<<2), GPIO_INPUT, NULL},
- {"PCH_BKLTEN", LM4_GPIO_J, (1<<3), GPIO_INT_BOTH,
- backlight_interrupt},
- {"PCH_SLP_A_L", LM4_GPIO_G, (1<<5), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SLP_ME_CSW_DEV_L", LM4_GPIO_G, (1<<4), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SLP_S3_L", LM4_GPIO_J, (1<<0), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SLP_S4_L", LM4_GPIO_J, (1<<1), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SLP_S5_L", LM4_GPIO_J, (1<<2), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SLP_SUS_L", LM4_GPIO_G, (1<<3), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SUSWARN_L", LM4_GPIO_G, (1<<2), GPIO_INT_BOTH,
- power_interrupt},
- {"PGOOD_1_5V_DDR", LM4_GPIO_K, (1<<0), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PGOOD_1_5V_PCH", LM4_GPIO_K, (1<<1), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PGOOD_1_8VS", LM4_GPIO_K, (1<<3), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PGOOD_5VALW", LM4_GPIO_H, (1<<0), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PGOOD_CPU_CORE", LM4_GPIO_M, (1<<3), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PGOOD_VCCP", LM4_GPIO_K, (1<<2), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PGOOD_VCCSA", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PGOOD_VGFX_CORE", LM4_GPIO_D, (1<<2), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"RECOVERY_L", LM4_GPIO_H, (1<<7), GPIO_INT_BOTH,
- switch_interrupt},
- {"USB1_STATUS_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL},
- {"USB2_STATUS_L", LM4_GPIO_E, (1<<1), GPIO_INPUT, NULL},
- {"WP", LM4_GPIO_J, (1<<4), GPIO_INT_BOTH,
- switch_interrupt},
- /* Outputs; all unasserted by default except for reset signals */
- {"CPU_PROCHOT", LM4_GPIO_F, (1<<2), GPIO_OUT_LOW, NULL},
- {"ENABLE_1_5V_DDR", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL},
- {"ENABLE_5VALW", LM4_GPIO_K, (1<<4), GPIO_OUT_HIGH, NULL},
- {"ENABLE_BACKLIGHT", LM4_GPIO_H, (1<<4), GPIO_OUT_LOW, NULL},
- {"ENABLE_TOUCHPAD", LM4_GPIO_C, (1<<6), GPIO_OUT_LOW, NULL},
- {"ENABLE_VCORE", LM4_GPIO_F, (1<<7), GPIO_OUT_LOW, NULL},
- {"ENABLE_VS", LM4_GPIO_G, (1<<6), GPIO_OUT_LOW, NULL},
- {"ENABLE_WLAN", LM4_GPIO_Q, (1<<5), GPIO_OUT_LOW, NULL},
- {"ENTERING_RW", LM4_GPIO_J, (1<<5), GPIO_OUT_LOW, NULL},
- {"LIGHTBAR_RESET_L", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL},
- {"PCH_A20GATE", LM4_GPIO_Q, (1<<6), GPIO_OUT_LOW, NULL},
- {"PCH_DPWROK", LM4_GPIO_G, (1<<0), GPIO_OUT_LOW, NULL},
- /*
- * HDA_SDO is technically an output, but we need to leave it as an
- * input until we drive it high. So can't use open-drain (HI_Z).
- */
- {"PCH_HDA_SDO", LM4_GPIO_G, (1<<1), GPIO_INPUT, NULL},
- {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_OUT_HIGH, NULL},
- {"PCH_NMI_L", LM4_GPIO_M, (1<<2), GPIO_OUT_HIGH, NULL},
- {"PCH_PWRBTN_L", LM4_GPIO_G, (1<<7), GPIO_OUT_HIGH, NULL},
- {"PCH_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL},
- {"PCH_RCIN_L", LM4_GPIO_Q, (1<<7), GPIO_ODR_HIGH, NULL},
- {"PCH_RSMRST_L", LM4_GPIO_F, (1<<1), GPIO_OUT_LOW, NULL},
- {"PCH_RTCRST_L", LM4_GPIO_F, (1<<6), GPIO_ODR_HIGH, NULL},
- {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_OUT_HIGH, NULL},
- {"PCH_SRTCRST_L", LM4_GPIO_C, (1<<7), GPIO_ODR_HIGH, NULL},
- {"PCH_SUSACK_L", LM4_GPIO_F, (1<<3), GPIO_OUT_HIGH, NULL},
- {"RADIO_ENABLE_WLAN", LM4_GPIO_D, (1<<0), GPIO_OUT_LOW, NULL},
- {"RADIO_ENABLE_BT", LM4_GPIO_D, (1<<1), GPIO_OUT_LOW, NULL},
- {"SPI_CS_L", LM4_GPIO_A, (1<<3), GPIO_ODR_HIGH, NULL},
- {"TOUCHSCREEN_RESET_L", LM4_GPIO_B, (1<<0), GPIO_OUT_LOW, NULL},
- {"USB1_CTL1", LM4_GPIO_E, (1<<2), GPIO_OUT_LOW, NULL},
- {"USB1_CTL2", LM4_GPIO_E, (1<<3), GPIO_OUT_LOW, NULL},
- {"USB1_CTL3", LM4_GPIO_E, (1<<4), GPIO_OUT_LOW, NULL},
- {"USB1_ENABLE", LM4_GPIO_E, (1<<5), GPIO_OUT_LOW, NULL},
- {"USB1_ILIM_SEL", LM4_GPIO_E, (1<<6), GPIO_OUT_LOW, NULL},
- {"USB2_CTL1", LM4_GPIO_D, (1<<4), GPIO_OUT_LOW, NULL},
- {"USB2_CTL2", LM4_GPIO_D, (1<<5), GPIO_OUT_LOW, NULL},
- {"USB2_CTL3", LM4_GPIO_D, (1<<6), GPIO_OUT_LOW, NULL},
- {"USB2_ENABLE", LM4_GPIO_D, (1<<7), GPIO_OUT_LOW, NULL},
- {"USB2_ILIM_SEL", LM4_GPIO_E, (1<<0), GPIO_OUT_LOW, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/link/board.h b/board/link/board.h
index 88e363b9a7..f180e138e4 100644
--- a/board/link/board.h
+++ b/board/link/board.h
@@ -82,81 +82,7 @@ enum pwm_channel {
/* Host connects to keyboard controller module via LPC */
#define HOST_KB_BUS_LPC
-/* GPIO signal definitions. */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_POWER_BUTTON_L = 0, /* Power button */
- GPIO_LID_OPEN, /* Lid switch */
- GPIO_THERMAL_DATA_READY_L, /* Data ready from I2C thermal sensor */
- /* Other inputs */
- GPIO_AC_PRESENT, /* AC power present */
- GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */
- GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */
- GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */
- GPIO_ONEWIRE, /* One-wire bus to adapter LED */
- GPIO_PCH_BKLTEN, /* Backlight enable signal from PCH */
- GPIO_PCH_SLP_A_L, /* SLP_A# signal from PCH */
- GPIO_PCH_SLP_ME_CSW_DEV_L, /* SLP_ME_CSW_DEV# signal from PCH */
- GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */
- GPIO_PCH_SLP_S4_L, /* SLP_S4# signal from PCH */
- GPIO_PCH_SLP_S5_L, /* SLP_S5# signal from PCH */
- GPIO_PCH_SLP_SUS_L, /* SLP_SUS# signal from PCH */
- GPIO_PCH_SUSWARN_L, /* SUSWARN# signal from PCH */
- GPIO_PGOOD_1_5V_DDR, /* Power good on +1.5V_DDR */
- GPIO_PGOOD_1_5V_PCH, /* Power good on +1.5V_PCH */
- GPIO_PGOOD_1_8VS, /* Power good on +1.8VS */
- GPIO_PGOOD_5VALW, /* Power good on +5VALW */
- GPIO_PGOOD_CPU_CORE, /* Power good on +CPU_CORE */
- GPIO_PGOOD_VCCP, /* Power good on +VCCP */
- GPIO_PGOOD_VCCSA, /* Power good on +VCCSA */
- GPIO_PGOOD_VGFX_CORE, /* Power good on +VGFX_CORE */
- GPIO_RECOVERY_L, /* Recovery signal from servo */
- GPIO_USB1_STATUS_L, /* USB charger port 1 status output */
- GPIO_USB2_STATUS_L, /* USB charger port 2 status output */
- GPIO_WP, /* Write protect input */
- /* Outputs */
- GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */
- GPIO_ENABLE_1_5V_DDR, /* Enable +1.5V_DDR supply */
- GPIO_ENABLE_5VALW, /* Enable +5V always on rail */
- GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */
- GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */
- GPIO_ENABLE_VCORE, /* Enable +CPU_CORE and +VGFX_CORE */
- GPIO_ENABLE_VS, /* Enable VS power supplies */
- GPIO_ENABLE_WLAN, /* Enable WLAN module power (+3VS_WLAN) */
- GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */
- GPIO_LIGHTBAR_RESET_L, /* Reset lightbar controllers */
- GPIO_PCH_A20GATE, /* A20GATE signal to PCH */
- GPIO_PCH_DPWROK, /* DPWROK signal to PCH */
- GPIO_PCH_HDA_SDO, /* HDA_SDO signal to PCH; when high, ME
- * ignores security descriptor */
- GPIO_PCH_WAKE_L, /* Wake signal output to PCH */
- GPIO_PCH_NMI_L, /* Non-maskable interrupt pin to PCH */
- GPIO_PCH_PWRBTN_L, /* Power button output to PCH */
- GPIO_PCH_PWROK, /* PWROK / APWROK signals to PCH */
- GPIO_PCH_RCIN_L, /* RCIN# signal to PCH */
- GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */
- GPIO_PCH_RTCRST_L, /* Reset PCH RTC well */
- GPIO_PCH_SMI_L, /* System management interrupt to PCH */
- GPIO_PCH_SRTCRST_L, /* Reset PCH ME RTC well */
- GPIO_PCH_SUSACK_L, /* Acknowledge PCH SUSWARN# signal */
- GPIO_RADIO_ENABLE_WLAN, /* Enable WLAN radio */
- GPIO_RADIO_ENABLE_BT, /* Enable bluetooth radio */
- GPIO_SPI_CS_L, /* SPI chip select */
- GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */
- GPIO_USB1_CTL1, /* USB charger port 1 CTL1 output */
- GPIO_USB1_CTL2, /* USB charger port 1 CTL2 output */
- GPIO_USB1_CTL3, /* USB charger port 1 CTL3 output */
- GPIO_USB1_ENABLE, /* USB charger port 1 enable */
- GPIO_USB1_ILIM_SEL, /* USB charger port 1 ILIM_SEL output */
- GPIO_USB2_CTL1, /* USB charger port 2 CTL1 output */
- GPIO_USB2_CTL2, /* USB charger port 2 CTL2 output */
- GPIO_USB2_CTL3, /* USB charger port 2 CTL3 output */
- GPIO_USB2_ENABLE, /* USB charger port 2 enable */
- GPIO_USB2_ILIM_SEL, /* USB charger port 2 ILIM_SEL output */
-
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* x86 signal definitions */
enum x86_signal {
diff --git a/board/link/gpio.inc b/board/link/gpio.inc
new file mode 100644
index 0000000000..315b17db85
--- /dev/null
+++ b/board/link/gpio.inc
@@ -0,0 +1,146 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+/* Power button */
+GPIO(POWER_BUTTON_L, K, 7, GPIO_INT_BOTH, power_button_interrupt)
+/* Lid switch */
+GPIO(LID_OPEN, K, 5, GPIO_INT_BOTH, lid_interrupt)
+
+/* Other inputs */
+/* Data ready from I2C thermal sensor */
+GPIO(THERMAL_DATA_READY_L, B, 4, GPIO_INPUT, NULL)
+/* AC power present */
+GPIO(AC_PRESENT, H, 3, GPIO_INT_BOTH, extpower_interrupt)
+/* Board version stuffing resistor 1 */
+GPIO(BOARD_VERSION1, H, 6, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 2 */
+GPIO(BOARD_VERSION2, L, 6, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 3 */
+GPIO(BOARD_VERSION3, L, 7, GPIO_INPUT, NULL)
+/* One-wire bus to adapter LED */
+GPIO(ONEWIRE, H, 2, GPIO_INPUT, NULL)
+/* Backlight enable signal from PCH */
+GPIO(PCH_BKLTEN, J, 3, GPIO_INT_BOTH, backlight_interrupt)
+/* SLP_A# signal from PCH */
+GPIO(PCH_SLP_A_L, G, 5, GPIO_INT_BOTH, power_signal_interrupt)
+/* SLP_ME_CSW_DEV# signal from PCH */
+GPIO(PCH_SLP_ME_CSW_DEV_L, G, 4, GPIO_INT_BOTH, power_signal_interrupt)
+/* SLP_S3# signal from PCH */
+GPIO(PCH_SLP_S3_L, J, 0, GPIO_INT_BOTH, power_signal_interrupt)
+/* SLP_S4# signal from PCH */
+GPIO(PCH_SLP_S4_L, J, 1, GPIO_INT_BOTH, power_signal_interrupt)
+/* SLP_S5# signal from PCH */
+GPIO(PCH_SLP_S5_L, J, 2, GPIO_INT_BOTH, power_signal_interrupt)
+/* SLP_SUS# signal from PCH */
+GPIO(PCH_SLP_SUS_L, G, 3, GPIO_INT_BOTH, power_signal_interrupt)
+/* SUSWARN# signal from PCH */
+GPIO(PCH_SUSWARN_L, G, 2, GPIO_INT_BOTH, power_interrupt)
+/* Power good on +1.5V_DDR */
+GPIO(PGOOD_1_5V_DDR, K, 0, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on +1.5V_PCH */
+GPIO(PGOOD_1_5V_PCH, K, 1, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on +1.8VS */
+GPIO(PGOOD_1_8VS, K, 3, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on +5VALW */
+GPIO(PGOOD_5VALW, H, 0, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on +CPU_CORE */
+GPIO(PGOOD_CPU_CORE, M, 3, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on +VCCP */
+GPIO(PGOOD_VCCP, K, 2, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on +VCCSA */
+GPIO(PGOOD_VCCSA, H, 1, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on +VGFX_CORE */
+GPIO(PGOOD_VGFX_CORE, D, 2, GPIO_INT_BOTH, power_signal_interrupt)
+/* Recovery signal from servo */
+GPIO(RECOVERY_L, H, 7, GPIO_INT_BOTH, switch_interrupt)
+/* USB charger port 1 status output */
+GPIO(USB1_STATUS_L, E, 7, GPIO_INPUT, NULL)
+/* USB charger port 2 status output */
+GPIO(USB2_STATUS_L, E, 1, GPIO_INPUT, NULL)
+/* Write protect input */
+GPIO(WP, J, 4, GPIO_INT_BOTH, switch_interrupt)
+
+/* Outputs; all unasserted by default except for reset signals */
+/* Force CPU to think it's overheated */
+GPIO(CPU_PROCHOT, F, 2, GPIO_OUT_LOW, NULL)
+/* Enable +1.5V_DDR supply */
+GPIO(ENABLE_1_5V_DDR, H, 5, GPIO_OUT_LOW, NULL)
+/* Enable +5V always on rail */
+GPIO(ENABLE_5VALW, K, 4, GPIO_OUT_HIGH, NULL)
+/* Enable backlight power */
+GPIO(ENABLE_BACKLIGHT, H, 4, GPIO_OUT_LOW, NULL)
+/* Enable touchpad power */
+GPIO(ENABLE_TOUCHPAD, C, 6, GPIO_OUT_LOW, NULL)
+/* Enable +CPU_CORE and +VGFX_CORE */
+GPIO(ENABLE_VCORE, F, 7, GPIO_OUT_LOW, NULL)
+/* Enable VS power supplies */
+GPIO(ENABLE_VS, G, 6, GPIO_OUT_LOW, NULL)
+/* Enable WLAN module power (+3VS_WLAN) */
+GPIO(ENABLE_WLAN, Q, 5, GPIO_OUT_LOW, NULL)
+/* Indicate when EC is entering RW code */
+GPIO(ENTERING_RW, J, 5, GPIO_OUT_LOW, NULL)
+/* Reset lightbar controllers */
+GPIO(LIGHTBAR_RESET_L, B, 1, GPIO_OUT_LOW, NULL)
+/* A20GATE signal to PCH */
+GPIO(PCH_A20GATE, Q, 6, GPIO_OUT_LOW, NULL)
+/* DPWROK signal to PCH */
+GPIO(PCH_DPWROK, G, 0, GPIO_OUT_LOW, NULL)
+/*
+ * HDA_SDO is technically an output, but we need to leave it as an
+ * input until we drive it high. So can't use open-drain (HI_Z).
+ */
+/* HDA_SDO signal to PCH; when high, ME ignores security descriptor */
+GPIO(PCH_HDA_SDO, G, 1, GPIO_INPUT, NULL)
+/* Wake signal output to PCH */
+GPIO(PCH_WAKE_L, F, 0, GPIO_OUT_HIGH, NULL)
+/* Non-maskable interrupt pin to PCH */
+GPIO(PCH_NMI_L, M, 2, GPIO_OUT_HIGH, NULL)
+/* Power button output to PCH */
+GPIO(PCH_PWRBTN_L, G, 7, GPIO_OUT_HIGH, NULL)
+/* PWROK / APWROK signals to PCH */
+GPIO(PCH_PWROK, F, 5, GPIO_OUT_LOW, NULL)
+/* RCIN# signal to PCH */
+GPIO(PCH_RCIN_L, Q, 7, GPIO_ODR_HIGH, NULL)
+/* Reset PCH resume power plane logic */
+GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW, NULL)
+/* Reset PCH RTC well */
+GPIO(PCH_RTCRST_L, F, 6, GPIO_ODR_HIGH, NULL)
+/* System management interrupt to PCH */
+GPIO(PCH_SMI_L, F, 4, GPIO_OUT_HIGH, NULL)
+/* Reset PCH ME RTC well */
+GPIO(PCH_SRTCRST_L, C, 7, GPIO_ODR_HIGH, NULL)
+/* Acknowledge PCH SUSWARN# signal */
+GPIO(PCH_SUSACK_L, F, 3, GPIO_OUT_HIGH, NULL)
+/* Enable WLAN radio */
+GPIO(RADIO_ENABLE_WLAN, D, 0, GPIO_OUT_LOW, NULL)
+/* Enable bluetooth radio */
+GPIO(RADIO_ENABLE_BT, D, 1, GPIO_OUT_LOW, NULL)
+/* SPI chip select */
+GPIO(SPI_CS_L, A, 3, GPIO_ODR_HIGH, NULL)
+/* Reset touch screen */
+GPIO(TOUCHSCREEN_RESET_L, B, 0, GPIO_OUT_LOW, NULL)
+/* USB charger port 1 CTL1 output */
+GPIO(USB1_CTL1, E, 2, GPIO_OUT_LOW, NULL)
+/* USB charger port 1 CTL2 output */
+GPIO(USB1_CTL2, E, 3, GPIO_OUT_LOW, NULL)
+/* USB charger port 1 CTL3 output */
+GPIO(USB1_CTL3, E, 4, GPIO_OUT_LOW, NULL)
+/* USB charger port 1 enable */
+GPIO(USB1_ENABLE, E, 5, GPIO_OUT_LOW, NULL)
+/* USB charger port 1 ILIM_SEL output */
+GPIO(USB1_ILIM_SEL, E, 6, GPIO_OUT_LOW, NULL)
+/* USB charger port 2 CTL1 output */
+GPIO(USB2_CTL1, D, 4, GPIO_OUT_LOW, NULL)
+/* USB charger port 2 CTL2 output */
+GPIO(USB2_CTL2, D, 5, GPIO_OUT_LOW, NULL)
+/* USB charger port 2 CTL3 output */
+GPIO(USB2_CTL3, D, 6, GPIO_OUT_LOW, NULL)
+/* USB charger port 2 enable */
+GPIO(USB2_ENABLE, D, 7, GPIO_OUT_LOW, NULL)
+/* USB charger port 2 ILIM_SEL output */
+GPIO(USB2_ILIM_SEL, E, 0, GPIO_OUT_LOW, NULL)
diff --git a/board/mccroskey/board.c b/board/mccroskey/board.c
index d0d839c57d..20dff4a0b0 100644
--- a/board/mccroskey/board.c
+++ b/board/mccroskey/board.c
@@ -22,80 +22,7 @@
#define HARD_RESET_TIMEOUT_MS 5
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"KB_IN00", GPIO_B, (1<<8), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN01", GPIO_B, (1<<9), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN02", GPIO_B, (1<<10), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN03", GPIO_B, (1<<11), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN04", GPIO_B, (1<<12), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN05", GPIO_B, (1<<13), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN06", GPIO_B, (1<<14), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN07", GPIO_B, (1<<15), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- /* TODO(crosbug.com/p/23494): interrupt handler for power button */
- {"KBD_PWR_BUTTON", GPIO_B, (1<<2), GPIO_INPUT, NULL},
-
- {"OMZO_RDY_L", GPIO_A, (1<<0), GPIO_INPUT, NULL}, /* PA0_WKUP */
- {"OZMO_RST_L", GPIO_A, (1<<2), GPIO_ODR_HIGH, NULL},
- {"VBUS_UP_DET", GPIO_A, (1<<3), GPIO_INPUT, NULL},
- {"OZMO_REQ_L", GPIO_A, (1<<8), GPIO_INPUT, NULL},
- {"CHARGE_ZERO", GPIO_B, (1<<0), GPIO_INPUT, NULL},
- {"CHARGE_SHUNT", GPIO_B, (1<<1), GPIO_INPUT, NULL},
- {"PMIC_INT_L", GPIO_B, (1<<5), GPIO_INPUT, NULL},
-
- /*
- * I2C pins should be configured as inputs until I2C module is
- * initialized. This will avoid driving the lines unintentionally.
- */
- {"I2C1_SCL", GPIO_B, (1<<6), GPIO_INPUT, NULL},
- {"I2C1_SDA", GPIO_B, (1<<7), GPIO_INPUT, NULL},
-
- {"KB_OUT00", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT01", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT02", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT03", GPIO_C, (1<<3), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT04", GPIO_C, (1<<4), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT05", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT06", GPIO_C, (1<<6), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT07", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT08", GPIO_C, (1<<8), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT09", GPIO_C, (1<<9), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT10", GPIO_C, (1<<10), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT11", GPIO_C, (1<<11), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT12", GPIO_C, (1<<12), GPIO_KB_OUTPUT, NULL},
- {"USB_VBUS_CTRL", GPIO_C, (1<<13), GPIO_OUT_LOW, NULL},
- {"HUB_RESET", GPIO_C, (1<<14), GPIO_ODR_HIGH, NULL},
- {"WP_L", GPIO_D, (1<<2), GPIO_INPUT, NULL},
-
- /* TODO(crosbug.com/p/23494): make this an alternate function */
- {"BL_PWM", GPIO_A, (1<<1), GPIO_OUTPUT, NULL},
-
- /* Unimplemented signals which we need to emulate for now */
- GPIO_SIGNAL_NOT_IMPLEMENTED("EC_INT"),
- GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
-
-#if 0
- /* Other GPIOs (probably need to be set up below as alt. function) */
- {"STM_USBDM", GPIO_A, (1<<11), GPIO_DEFAULT, NULL},
- {"STM_USBDP", GPIO_A, (1<<12), GPIO_DEFAULT, NULL},
- {"JTMS_SWDIO", GPIO_A, (1<<13), GPIO_DEFAULT, NULL},
- {"JTCK_SWCLK", GPIO_A, (1<<14), GPIO_DEFAULT, NULL},
- {"JTDI", GPIO_A, (1<<15), GPIO_DEFAULT, NULL},
- {"JTDO", GPIO_B, (1<<3), GPIO_DEFAULT, NULL},
- {"JNTRST", GPIO_B, (1<<4), GPIO_DEFAULT, NULL},
- {"OSC32_OUT", GPIO_C, (1<<15), GPIO_DEFAULT, NULL},
-#endif
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/mccroskey/board.h b/board/mccroskey/board.h
index 7d4eefba2a..f99f50d7ce 100644
--- a/board/mccroskey/board.h
+++ b/board/mccroskey/board.h
@@ -45,65 +45,7 @@
#define TIM_CLOCK_LSB 4
#define TIM_WATCHDOG 1
-/* GPIO signal list */
-enum gpio_signal {
- GPIO_KB_IN00,
- GPIO_KB_IN01,
- GPIO_KB_IN02,
- GPIO_KB_IN03,
- GPIO_KB_IN04,
- GPIO_KB_IN05,
- GPIO_KB_IN06,
- GPIO_KB_IN07,
- GPIO_KBD_PWR_BUTTON,
- GPIO_OMZO_RDY_L,
- GPIO_OZMO_RST_L,
- GPIO_VBUS_UP_DET,
- GPIO_OZMO_REQ_L,
- GPIO_CHARGE_ZERO,
- GPIO_CHARGE_SHUNT,
- GPIO_PMIC_INT_L,
- GPIO_I2C1_SCL,
- GPIO_I2C1_SDA,
- GPIO_KB_OUT00,
- GPIO_KB_OUT01,
- GPIO_KB_OUT02,
- GPIO_KB_OUT03,
- GPIO_KB_OUT04,
- GPIO_KB_OUT05,
- GPIO_KB_OUT06,
- GPIO_KB_OUT07,
- GPIO_KB_OUT08,
- GPIO_KB_OUT09,
- GPIO_KB_OUT10,
- GPIO_KB_OUT11,
- GPIO_KB_OUT12,
- GPIO_USB_VBUS_CTRL,
- GPIO_HUB_RESET,
- GPIO_WP_L,
-
- /*
- * TODO(crosbug.com/p/23494): This will be an alternate function GPIO,
- * so remove it from here.
- */
- GPIO_BL_PWM,
-
- /* Unimplemented GPIOs */
- GPIO_EC_INT,
- GPIO_ENTERING_RW,
-
-#if 0
- GPIO_STM_USBDM,
- GPIO_STM_USBDP,
- GPIO_JTMS_SWDIO,
- GPIO_JTCK_SWCLK,
- GPIO_JTDI,
- GPIO_JTDO,
- GPIO_JNTRST,
- GPIO_OSC32_OUT,
-#endif
- GPIO_COUNT
-};
+#include "gpio_signal.h"
#endif /* !__ASSEMBLER__ */
diff --git a/board/mccroskey/gpio.inc b/board/mccroskey/gpio.inc
new file mode 100644
index 0000000000..e885176c08
--- /dev/null
+++ b/board/mccroskey/gpio.inc
@@ -0,0 +1,73 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+GPIO(KB_IN00, B, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN01, B, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN02, B, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN03, B, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN04, B, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN05, B, 13, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN06, B, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN07, B, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+
+/* TODO(crosbug.com/p/23494): interrupt handler for power button */
+GPIO(KBD_PWR_BUTTON, B, 2, GPIO_INPUT, NULL)
+
+GPIO(OMZO_RDY_L, A, 0, GPIO_INPUT, NULL) /* PA0_WKUP */
+GPIO(OZMO_RST_L, A, 2, GPIO_ODR_HIGH, NULL)
+GPIO(VBUS_UP_DET, A, 3, GPIO_INPUT, NULL)
+GPIO(OZMO_REQ_L, A, 8, GPIO_INPUT, NULL)
+GPIO(CHARGE_ZERO, B, 0, GPIO_INPUT, NULL)
+GPIO(CHARGE_SHUNT, B, 1, GPIO_INPUT, NULL)
+GPIO(PMIC_INT_L, B, 5, GPIO_INPUT, NULL)
+
+/*
+ * I2C pins should be configured as inputs until I2C module is
+ * initialized. This will avoid driving the lines unintentionally.
+ */
+GPIO(I2C1_SCL, B, 6, GPIO_INPUT, NULL)
+GPIO(I2C1_SDA, B, 7, GPIO_INPUT, NULL)
+
+GPIO(KB_OUT00, C, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT01, C, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT02, C, 2, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT03, C, 3, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT04, C, 4, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT05, C, 5, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT06, C, 6, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT07, C, 7, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT08, C, 8, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT09, C, 9, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT10, C, 10, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT11, C, 11, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT12, C, 12, GPIO_KB_OUTPUT, NULL)
+GPIO(USB_VBUS_CTRL, C, 13, GPIO_OUT_LOW, NULL)
+GPIO(HUB_RESET, C, 14, GPIO_ODR_HIGH, NULL)
+GPIO(WP_L, D, 2, GPIO_INPUT, NULL)
+
+/*
+ * TODO(crosbug.com/p/23494): This will be an alternate function GPIO,
+ * so remove it from here.
+ */
+GPIO(BL_PWM, A, 1, GPIO_OUTPUT, NULL)
+
+/* Unimplemented signals which we need to emulate for now */
+UNIMPLEMENTED(EC_INT)
+UNIMPLEMENTED(ENTERING_RW)
+
+#if 0
+/* Other GPIOs (probably need to be set up below as alt. function) */
+GPIO(STM_USBDM, A, 11, GPIO_DEFAULT, NULL)
+GPIO(STM_USBDP, A, 12, GPIO_DEFAULT, NULL)
+GPIO(JTMS_SWDIO, A, 13, GPIO_DEFAULT, NULL)
+GPIO(JTCK_SWCLK, A, 14, GPIO_DEFAULT, NULL)
+GPIO(JTDI, A, 15, GPIO_DEFAULT, NULL)
+GPIO(JTDO, B, 3, GPIO_DEFAULT, NULL)
+GPIO(JNTRST, B, 4, GPIO_DEFAULT, NULL)
+GPIO(OSC32_OUT, C, 15, GPIO_DEFAULT, NULL)
+#endif
diff --git a/board/mec1322_evb/board.c b/board/mec1322_evb/board.c
index ae854af6ae..877743a97b 100644
--- a/board/mec1322_evb/board.c
+++ b/board/mec1322_evb/board.c
@@ -15,20 +15,7 @@
#define GPIO_KB_INPUT GPIO_INPUT
#define GPIO_KB_OUTPUT (GPIO_ODR_HIGH | GPIO_PULL_UP)
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- {"LED1", GPIO_PORT(15), (1 << 4), GPIO_ODR_LOW, NULL},
- {"LED2", GPIO_PORT(15), (1 << 5), GPIO_ODR_HIGH, NULL},
- {"LED3", GPIO_PORT(15), (1 << 6), GPIO_ODR_LOW, NULL},
- {"PCH_SMI_L", GPIO_PORT(4), (1 << 4), GPIO_ODR_HIGH, NULL},
- {"PCH_WAKE_L", GPIO_PORT(20), (1 << 0), GPIO_ODR_HIGH, NULL},
- {"S1", GPIO_PORT(6), (1 << 3), GPIO_INT_FALLING | GPIO_PULL_UP, NULL},
- /* Unimplemented signals which we need to emulate for now */
- GPIO_SIGNAL_NOT_IMPLEMENTED("RECOVERY_L"),
- GPIO_SIGNAL_NOT_IMPLEMENTED("WP"),
- GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/mec1322_evb/board.h b/board/mec1322_evb/board.h
index 57728ca529..7462706cab 100644
--- a/board/mec1322_evb/board.h
+++ b/board/mec1322_evb/board.h
@@ -34,25 +34,7 @@ enum adc_channel {
ADC_CH_COUNT
};
-/* GPIO signal list */
-enum gpio_signal {
- GPIO_LED1 = 0,
- GPIO_LED2,
- GPIO_LED3,
- GPIO_PCH_SMI_L, /* SMI output */
- GPIO_PCH_WAKE_L, /* PCH wake pin */
- GPIO_S1, /* Switch S1 */
- /*
- * Signals which aren't implemented on MEC1322 eval board but we'll
- * emulate anyway, to make it more convenient to debug other code.
- */
- GPIO_RECOVERY_L, /* Recovery signal from DOWN button */
- GPIO_WP, /* Write protect input */
- GPIO_ENTERING_RW, /* EC entering RW code */
-
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
#endif /* !__ASSEMBLER__ */
diff --git a/board/mec1322_evb/gpio.inc b/board/mec1322_evb/gpio.inc
new file mode 100644
index 0000000000..60e2ccf908
--- /dev/null
+++ b/board/mec1322_evb/gpio.inc
@@ -0,0 +1,23 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+GPIO(LED1, PORT(15), 4, GPIO_ODR_LOW, NULL)
+GPIO(LED2, PORT(15), 5, GPIO_ODR_HIGH, NULL)
+GPIO(LED3, PORT(15), 6, GPIO_ODR_LOW, NULL)
+GPIO(PCH_SMI_L, PORT(4), 4, GPIO_ODR_HIGH, NULL) /* SMI output */
+GPIO(PCH_WAKE_L, PORT(20), 0, GPIO_ODR_HIGH, NULL) /* PCH wake pin */
+
+/* Switch S1 */
+GPIO(S1, PORT(6), 3, GPIO_INT_FALLING | GPIO_PULL_UP, NULL)
+
+/*
+ * Signals which aren't implemented on MEC1322 eval board but we'll
+ * emulate anyway, to make it more convenient to debug other code.
+ */
+UNIMPLEMENTED(RECOVERY_L) /* Recovery signal from DOWN button */
+UNIMPLEMENTED(WP) /* Write protect input */
+UNIMPLEMENTED(ENTERING_RW) /* EC entering RW code */
diff --git a/board/nyan/board.c b/board/nyan/board.c
index e4aadfc5a7..89d6a72dd7 100644
--- a/board/nyan/board.c
+++ b/board/nyan/board.c
@@ -26,69 +26,7 @@
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
#define GPIO_KB_OUTPUT GPIO_ODR_HIGH
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"POWER_BUTTON_L", GPIO_B, (1<<5), GPIO_INT_BOTH,
- power_button_interrupt},
- {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, lid_interrupt},
- {"SUSPEND_L", GPIO_C, (1<<7), GPIO_KB_INPUT,
- power_signal_interrupt},
- {"SPI1_NSS", GPIO_A, (1<<4), GPIO_INT_BOTH | GPIO_PULL_UP,
- spi_event},
- {"AC_PRESENT", GPIO_A, (1<<0), GPIO_INT_BOTH, extpower_interrupt},
- {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- /* Other inputs */
- {"WP_L", GPIO_B, (1<<4), GPIO_INPUT, NULL},
- /* Outputs */
- {"AP_RESET_L", GPIO_B, (1<<3), GPIO_ODR_HIGH, NULL},
- {"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL},
- {"EC_INT", GPIO_B, (1<<9), GPIO_ODR_HIGH, NULL},
- {"ENTERING_RW", GPIO_H, (1<<0), GPIO_OUT_LOW, NULL},
- {"I2C1_SCL", GPIO_B, (1<<6), GPIO_ODR_HIGH, NULL},
- {"I2C1_SDA", GPIO_B, (1<<7), GPIO_ODR_HIGH, NULL},
- {"LED_POWER_L", GPIO_A, (1<<2), GPIO_OUT_HIGH, NULL}, /* PWR_LED1 */
- {"PMIC_PWRON_L", GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL},
- {"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
- {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT04", GPIO_B, (1<<14), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT05", GPIO_B, (1<<15), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT06", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT07", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT08", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT09", GPIO_B, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT10", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT11", GPIO_C, (1<<4), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT12", GPIO_A, (1<<13), GPIO_KB_OUTPUT, NULL},
- {"PWR_LED0", GPIO_B, (1<<10), GPIO_OUT_LOW, NULL},
- {"BAT_LED0", GPIO_B, (1<<11), GPIO_OUT_LOW, NULL},
- {"BAT_LED1", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL},
- {"CHARGING", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL},
- {"EC_BL_OVERRIDE", GPIO_H, (1<<1), GPIO_ODR_HIGH, NULL},
- {"PMIC_THERM_L", GPIO_A, (1<<1), GPIO_ODR_HIGH, NULL},
- {"PMIC_WARM_RESET_L", GPIO_C, (1<<3), GPIO_ODR_HIGH, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/nyan/board.h b/board/nyan/board.h
index 5faa31f61f..02daeaabc9 100644
--- a/board/nyan/board.h
+++ b/board/nyan/board.h
@@ -42,59 +42,7 @@
#define TIM_POWER_LED 2
#define TIM_WATCHDOG 4
-/* GPIO signal list */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_POWER_BUTTON_L = 0,
- GPIO_SOC1V8_XPSHOLD,
- GPIO_LID_OPEN,
- GPIO_SUSPEND_L,
- GPIO_SPI1_NSS,
- GPIO_AC_PRESENT,
- /* Keyboard inputs */
- GPIO_KB_IN00,
- GPIO_KB_IN01,
- GPIO_KB_IN02,
- GPIO_KB_IN03,
- GPIO_KB_IN04,
- GPIO_KB_IN05,
- GPIO_KB_IN06,
- GPIO_KB_IN07,
- /* Other inputs */
- GPIO_WP_L,
- /* Outputs */
- GPIO_AP_RESET_L,
- GPIO_CHARGER_EN,
- GPIO_EC_INT,
- GPIO_ENTERING_RW,
- GPIO_I2C1_SCL,
- GPIO_I2C1_SDA,
- GPIO_LED_POWER_L, /* alias to GPIO_PWR_LED1 */
- GPIO_PMIC_PWRON_L,
- GPIO_PMIC_RESET,
- GPIO_KB_OUT00,
- GPIO_KB_OUT01,
- GPIO_KB_OUT02,
- GPIO_KB_OUT03,
- GPIO_KB_OUT04,
- GPIO_KB_OUT05,
- GPIO_KB_OUT06,
- GPIO_KB_OUT07,
- GPIO_KB_OUT08,
- GPIO_KB_OUT09,
- GPIO_KB_OUT10,
- GPIO_KB_OUT11,
- GPIO_KB_OUT12,
- GPIO_PWR_LED0,
- GPIO_BAT_LED0,
- GPIO_BAT_LED1,
- GPIO_CHARGING,
- GPIO_EC_BL_OVERRIDE,
- GPIO_PMIC_THERM_L,
- GPIO_PMIC_WARM_RESET_L,
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
enum power_signal {
TEGRA_XPSHOLD = 0,
diff --git a/board/nyan/gpio.inc b/board/nyan/gpio.inc
new file mode 100644
index 0000000000..63be0df6cf
--- /dev/null
+++ b/board/nyan/gpio.inc
@@ -0,0 +1,58 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+GPIO(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH, power_button_interrupt)
+GPIO(SOC1V8_XPSHOLD, A, 3, GPIO_INT_BOTH, power_signal_interrupt)
+GPIO(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt)
+GPIO(SUSPEND_L, C, 7, GPIO_KB_INPUT, power_signal_interrupt)
+GPIO(SPI1_NSS, A, 4, GPIO_INT_BOTH | GPIO_PULL_UP, spi_event)
+GPIO(AC_PRESENT, A, 0, GPIO_INT_BOTH, extpower_interrupt)
+
+/* Keyboard inputs */
+GPIO(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+
+/* Other inputs */
+GPIO(WP_L, B, 4, GPIO_INPUT, NULL)
+
+/* Outputs */
+GPIO(AP_RESET_L, B, 3, GPIO_ODR_HIGH, NULL)
+GPIO(CHARGER_EN, B, 2, GPIO_OUT_LOW, NULL)
+GPIO(EC_INT, B, 9, GPIO_ODR_HIGH, NULL)
+GPIO(ENTERING_RW, H, 0, GPIO_OUT_LOW, NULL)
+GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH, NULL)
+GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH, NULL)
+GPIO(LED_POWER_L, A, 2, GPIO_OUT_HIGH, NULL) /* PWR_LED1 */
+GPIO(PMIC_PWRON_L, A, 12, GPIO_OUT_HIGH, NULL)
+GPIO(PMIC_RESET, A, 15, GPIO_OUT_LOW, NULL)
+GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT, NULL)
+GPIO(PWR_LED0, B, 10, GPIO_OUT_LOW, NULL)
+GPIO(BAT_LED0, B, 11, GPIO_OUT_LOW, NULL)
+GPIO(BAT_LED1, A, 8, GPIO_OUT_LOW, NULL)
+GPIO(CHARGING, A, 11, GPIO_OUT_LOW, NULL)
+GPIO(EC_BL_OVERRIDE, H, 1, GPIO_ODR_HIGH, NULL)
+GPIO(PMIC_THERM_L, A, 1, GPIO_ODR_HIGH, NULL)
+GPIO(PMIC_WARM_RESET_L, C, 3, GPIO_ODR_HIGH, NULL)
diff --git a/board/peppy/board.c b/board/peppy/board.c
index aee817bbb1..0758daeec6 100644
--- a/board/peppy/board.c
+++ b/board/peppy/board.c
@@ -30,108 +30,7 @@
#include "uart.h"
#include "util.h"
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"POWER_BUTTON_L", LM4_GPIO_A, (1<<2), GPIO_INT_BOTH_DSLEEP,
- power_button_interrupt},
- {"LID_OPEN", LM4_GPIO_A, (1<<3), GPIO_INT_BOTH_DSLEEP,
- lid_interrupt},
- {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH_DSLEEP,
- extpower_interrupt},
- {"PCH_BKLTEN", LM4_GPIO_M, (1<<3), GPIO_INT_BOTH,
- backlight_interrupt},
- {"PCH_SLP_S0_L", LM4_GPIO_G, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SLP_S3_L", LM4_GPIO_G, (1<<7), GPIO_INT_BOTH_DSLEEP,
- power_signal_interrupt},
- {"PCH_SLP_S5_L", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH_DSLEEP,
- power_signal_interrupt},
- {"PCH_SLP_SUS_L", LM4_GPIO_G, (1<<3), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP1050_PGOOD", LM4_GPIO_H, (1<<4), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP1350_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP5000_PGOOD", LM4_GPIO_N, (1<<0), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_EDP_VDD_EN", LM4_GPIO_J, (1<<1), GPIO_INT_BOTH,
- power_interrupt},
- {"RECOVERY_L", LM4_GPIO_A, (1<<5), GPIO_PULL_UP|GPIO_INT_BOTH,
- switch_interrupt},
- {"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH,
- switch_interrupt},
- {"JTAG_TCK", LM4_GPIO_C, (1<<0), GPIO_DEFAULT,
- jtag_interrupt},
- {"UART0_RX", LM4_GPIO_A, (1<<0), GPIO_PULL_UP|
- GPIO_INT_BOTH_DSLEEP,
- uart_deepsleep_interrupt},
-
- /* Other inputs */
- {"FAN_ALERT_L", LM4_GPIO_B, (1<<0), GPIO_INPUT, NULL},
- {"PCH_SUSWARN_L", LM4_GPIO_G, (1<<2), GPIO_INT_BOTH, NULL},
- {"USB1_OC_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL},
- {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL},
- {"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL},
- {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL},
- {"BOARD_VERSION3", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL},
- {"CPU_PGOOD", LM4_GPIO_C, (1<<4), GPIO_INPUT, NULL},
- {"BAT_PRESENT_L", LM4_GPIO_B, (1<<4), GPIO_INPUT, NULL},
-
- /* Outputs; all unasserted by default except for reset signals */
- {"CPU_PROCHOT", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL},
- {"PP1350_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL},
- {"PP3300_DX_EN", LM4_GPIO_J, (1<<2), GPIO_OUT_LOW, NULL},
- {"PP3300_LTE_EN", LM4_GPIO_D, (1<<2), GPIO_OUT_LOW, NULL},
- {"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL},
- {"SUSP_VR_EN", LM4_GPIO_C, (1<<7), GPIO_OUT_LOW, NULL},
- {"VCORE_EN", LM4_GPIO_C, (1<<5), GPIO_OUT_LOW, NULL},
- {"PP5000_EN", LM4_GPIO_H, (1<<7), GPIO_OUT_LOW, NULL},
- {"PP5000_FAN_EN", LM4_GPIO_J, (1<<3), GPIO_OUT_LOW, NULL},
- {"SYS_PWROK", LM4_GPIO_H, (1<<2), GPIO_OUT_LOW, NULL},
- {"WLAN_OFF_L", LM4_GPIO_J, (1<<4), GPIO_OUT_LOW, NULL},
- {"CHARGE_L", LM4_GPIO_E, (1<<6), GPIO_OUT_LOW, NULL},
-
- {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_OUT_LOW, NULL},
- {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL},
- {"ENTERING_RW", LM4_GPIO_D, (1<<3), GPIO_OUT_LOW, NULL},
- {"PCH_DPWROK", LM4_GPIO_G, (1<<0), GPIO_OUT_LOW, NULL},
- /*
- * HDA_SDO is technically an output, but we need to leave it as an
- * input until we drive it high. So can't use open-drain (HI_Z).
- */
- {"PCH_HDA_SDO", LM4_GPIO_G, (1<<1), GPIO_INPUT, NULL},
- {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_OUT_HIGH, NULL},
- {"PCH_NMI_L", LM4_GPIO_F, (1<<2), GPIO_OUT_HIGH, NULL},
- {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_OUT_HIGH, NULL},
- {"PCH_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL},
- /*
- * PL6 is one of 4 pins on the EC which can't be used in open-drain
- * mode. To work around this PCH_RCIN_L is set to an input. It will
- * only be set to an output when it needs to be driven to 0.
- */
- {"PCH_RCIN_L", LM4_GPIO_L, (1<<6), GPIO_INPUT, NULL},
- {"PCH_RSMRST_L", LM4_GPIO_F, (1<<1), GPIO_OUT_LOW, NULL},
- {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL},
- {"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_OUT_LOW, NULL},
- {"EC_EDP_VDD_EN", LM4_GPIO_J, (1<<5), GPIO_OUT_LOW, NULL},
-
- {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL},
- {"USB1_ENABLE", LM4_GPIO_E, (1<<4), GPIO_OUT_LOW, NULL},
- {"USB2_ENABLE", LM4_GPIO_D, (1<<5), GPIO_OUT_LOW, NULL},
-
- {"PCH_SUSACK_L", LM4_GPIO_F, (1<<3), GPIO_OUT_HIGH, NULL},
- {"PCH_RTCRST_L", LM4_GPIO_F, (1<<6), GPIO_ODR_HIGH, NULL},
- {"PCH_SRTCRST_L", LM4_GPIO_F, (1<<7), GPIO_ODR_HIGH, NULL},
-
- {"BAT_LED0_L", LM4_GPIO_D, (1<<0), GPIO_ODR_HIGH, NULL},
- {"BAT_LED1_L", LM4_GPIO_N, (1<<4), GPIO_ODR_HIGH, NULL},
- {"PWR_LED0_L", LM4_GPIO_D, (1<<1), GPIO_ODR_HIGH, NULL},
- {"PWR_LED1_L", LM4_GPIO_N, (1<<6), GPIO_ODR_HIGH, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/peppy/board.h b/board/peppy/board.h
index b586816fc9..e3a85db5bc 100644
--- a/board/peppy/board.h
+++ b/board/peppy/board.h
@@ -57,85 +57,7 @@
/* USB ports */
#define USB_PORT_COUNT 2
-/* GPIO signal definitions. */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_POWER_BUTTON_L = 0, /* Power button */
- GPIO_LID_OPEN, /* Lid switch */
- GPIO_AC_PRESENT, /* AC power present */
- GPIO_PCH_BKLTEN, /* Backlight enable signal from PCH */
- GPIO_PCH_SLP_S0_L, /* SLP_S0# signal from PCH */
- GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */
- GPIO_PCH_SLP_S5_L, /* SLP_S5# signal from PCH */
- GPIO_PCH_SLP_SUS_L, /* SLP_SUS# signal from PCH */
- GPIO_PP1050_PGOOD, /* Power good on 1.05V */
- GPIO_PP1350_PGOOD, /* Power good on 1.35V (DRAM) */
- GPIO_PP5000_PGOOD, /* Power good on 5V */
- GPIO_VCORE_PGOOD, /* Power good on core VR */
- GPIO_PCH_EDP_VDD_EN, /* PCH wants EDP enabled */
- GPIO_RECOVERY_L, /* Recovery signal from servo */
- GPIO_WP_L, /* Write protect input */
- GPIO_JTAG_TCK, /* JTAG clock input */
- GPIO_UART0_RX, /* UART0 RX input */
-
- /* Other inputs */
- GPIO_FAN_ALERT_L, /* From thermal sensor */
- GPIO_PCH_SUSWARN_L, /* SUSWARN# signal from PCH */
- GPIO_USB1_OC_L, /* USB port overcurrent warning */
- GPIO_USB2_OC_L, /* USB port overcurrent warning */
- GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */
- GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */
- GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */
- GPIO_CPU_PGOOD, /* Power good to the CPU */
- GPIO_BAT_PRESENT_L, /* Battery present. Repurposed BAT_TEMP */
-
- /* Outputs */
- GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */
- GPIO_PP1350_EN, /* Enable 1.35V supply */
- GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */
- GPIO_PP3300_LTE_EN, /* Enable LTE radio */
- GPIO_PP3300_WLAN_EN, /* Enable WiFi power */
- GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */
- GPIO_VCORE_EN, /* Stuffing option - not connected */
- GPIO_PP5000_EN, /* Enable 5V supply */
- GPIO_PP5000_FAN_EN, /* Enable fan power rail */
- GPIO_SYS_PWROK, /* EC thinks everything is up and ready */
- GPIO_WLAN_OFF_L, /* Disable WiFi radio */
- GPIO_CHARGE_L, /* Allow battery to charge when on AC */
-
- GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */
- GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */
- GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */
- GPIO_PCH_DPWROK, /* Indicate when VccDSW is good */
-
- GPIO_PCH_HDA_SDO, /* HDA_SDO signal to PCH; when high, ME
- * ignores security descriptor */
- GPIO_PCH_WAKE_L, /* Wake signal from EC to PCH */
- GPIO_PCH_NMI_L, /* Non-maskable interrupt pin to PCH */
- GPIO_PCH_PWRBTN_L, /* Power button output to PCH */
- GPIO_PCH_PWROK, /* PWROK / APWROK signals to PCH */
- GPIO_PCH_RCIN_L, /* RCIN# line to PCH (for 8042 emulation) */
- GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */
- GPIO_PCH_SMI_L, /* System management interrupt to PCH */
- GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */
- GPIO_EC_EDP_VDD_EN, /* Enable EDP (passthru from PCH) */
- GPIO_LPC_CLKRUN_L, /* Dunno. Probably important, though. */
-
- GPIO_USB1_ENABLE, /* USB port 1 output power enable */
- GPIO_USB2_ENABLE, /* USB port 2 output power enable */
-
- GPIO_PCH_SUSACK_L, /* Acknowledge PCH SUSWARN# signal */
- GPIO_PCH_RTCRST_L, /* Not supposed to be here */
- GPIO_PCH_SRTCRST_L, /* Not supposed to be here */
-
- GPIO_BAT_LED0_L, /* Battery charging LED - blue */
- GPIO_BAT_LED1_L, /* Battery charging LED - orange */
- GPIO_PWR_LED0_L, /* Power LED - blue */
- GPIO_PWR_LED1_L, /* Power LED - orange */
-
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* power signal definitions */
enum power_signal {
diff --git a/board/peppy/gpio.inc b/board/peppy/gpio.inc
new file mode 100644
index 0000000000..090c6e26a2
--- /dev/null
+++ b/board/peppy/gpio.inc
@@ -0,0 +1,147 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+/* Inputs with interrupt handlers are first for efficiency */
+/* Power button */
+GPIO(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH_DSLEEP, power_button_interrupt)
+/* Lid switch */
+GPIO(LID_OPEN, A, 3, GPIO_INT_BOTH_DSLEEP, lid_interrupt)
+/* AC power present */
+GPIO(AC_PRESENT, H, 3, GPIO_INT_BOTH_DSLEEP, extpower_interrupt)
+/* Backlight enable signal from PCH */
+GPIO(PCH_BKLTEN, M, 3, GPIO_INT_BOTH, backlight_interrupt)
+/* SLP_S0# signal from PCH */
+GPIO(PCH_SLP_S0_L, G, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* SLP_S3# signal from PCH */
+GPIO(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt)
+/* SLP_S5# signal from PCH */
+GPIO(PCH_SLP_S5_L, H, 1, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt)
+/* SLP_SUS# signal from PCH */
+GPIO(PCH_SLP_SUS_L, G, 3, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 1.05V */
+GPIO(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 1.35V (DRAM) */
+GPIO(PP1350_PGOOD, H, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 5V */
+GPIO(PP5000_PGOOD, N, 0, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on core VR */
+GPIO(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* PCH wants EDP enabled */
+GPIO(PCH_EDP_VDD_EN, J, 1, GPIO_INT_BOTH, power_interrupt)
+/* Recovery signal from servo */
+GPIO(RECOVERY_L, A, 5, GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt)
+/* Write protect input */
+GPIO(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt)
+/* JTAG clock input */
+GPIO(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt)
+/* UART0 RX input */
+GPIO(UART0_RX, A, 0, GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP,
+ uart_deepsleep_interrupt)
+
+/* Other inputs */
+/* From thermal sensor */
+GPIO(FAN_ALERT_L, B, 0, GPIO_INPUT, NULL)
+/* SUSWARN# signal from PCH */
+GPIO(PCH_SUSWARN_L, G, 2, GPIO_INT_BOTH, NULL)
+/* USB port overcurrent warning */
+GPIO(USB1_OC_L, E, 7, GPIO_INPUT, NULL)
+/* USB port overcurrent warning */
+GPIO(USB2_OC_L, E, 0, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 1 */
+GPIO(BOARD_VERSION1, Q, 5, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 2 */
+GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 3 */
+GPIO(BOARD_VERSION3, Q, 7, GPIO_INPUT, NULL)
+/* Power good to the CPU */
+GPIO(CPU_PGOOD, C, 4, GPIO_INPUT, NULL)
+/* Battery present. Repurposed BAT_TEMP */
+GPIO(BAT_PRESENT_L, B, 4, GPIO_INPUT, NULL)
+
+/* Outputs; all unasserted by default except for reset signals */
+/* Force CPU to think it's overheated */
+GPIO(CPU_PROCHOT, B, 1, GPIO_OUT_LOW, NULL)
+/* Enable 1.35V supply */
+GPIO(PP1350_EN, H, 5, GPIO_OUT_LOW, NULL)
+/* Enable power to lots of peripherals */
+GPIO(PP3300_DX_EN, J, 2, GPIO_OUT_LOW, NULL)
+/* Enable LTE radio */
+GPIO(PP3300_LTE_EN, D, 2, GPIO_OUT_LOW, NULL)
+/* Enable WiFi power */
+GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW, NULL)
+/* Enable 1.05V regulator */
+GPIO(SUSP_VR_EN, C, 7, GPIO_OUT_LOW, NULL)
+/* Stuffing option - not connected */
+GPIO(VCORE_EN, C, 5, GPIO_OUT_LOW, NULL)
+/* Enable 5V supply */
+GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW, NULL)
+/* Enable fan power rail */
+GPIO(PP5000_FAN_EN, J, 3, GPIO_OUT_LOW, NULL)
+/* EC thinks everything is up and ready */
+GPIO(SYS_PWROK, H, 2, GPIO_OUT_LOW, NULL)
+/* Disable WiFi radio */
+GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW, NULL)
+/* Allow battery to charge when on AC */
+GPIO(CHARGE_L, E, 6, GPIO_OUT_LOW, NULL)
+
+/* Enable backlight power */
+GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_OUT_LOW, NULL)
+/* Enable touchpad power */
+GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW, NULL)
+/* Indicate when EC is entering RW code */
+GPIO(ENTERING_RW, D, 3, GPIO_OUT_LOW, NULL)
+/* Indicate when VccDSW is good */
+GPIO(PCH_DPWROK, G, 0, GPIO_OUT_LOW, NULL)
+/*
+ * HDA_SDO is technically an output, but we need to leave it as an
+ * input until we drive it high. So can't use open-drain (HI_Z).
+ */
+/* HDA_SDO signal to PCH; when high, ME ignores security descriptor */
+GPIO(PCH_HDA_SDO, G, 1, GPIO_INPUT, NULL)
+/* Wake signal from EC to PCH */
+GPIO(PCH_WAKE_L, F, 0, GPIO_OUT_HIGH, NULL)
+/* Non-maskable interrupt pin to PCH */
+GPIO(PCH_NMI_L, F, 2, GPIO_OUT_HIGH, NULL)
+/* Power button output to PCH */
+GPIO(PCH_PWRBTN_L, H, 0, GPIO_OUT_HIGH, NULL)
+/* PWROK / APWROK signals to PCH */
+GPIO(PCH_PWROK, F, 5, GPIO_OUT_LOW, NULL)
+/*
+ * PL6 is one of 4 pins on the EC which can't be used in open-drain
+ * mode. To work around this PCH_RCIN_L is set to an input. It will
+ * only be set to an output when it needs to be driven to 0.
+ */
+/* RCIN# line to PCH (for 8042 emulation) */
+GPIO(PCH_RCIN_L, L, 6, GPIO_INPUT, NULL)
+/* Reset PCH resume power plane logic */
+GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW, NULL)
+/* System management interrupt to PCH */
+GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH, NULL)
+/* Reset touch screen */
+GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_OUT_LOW, NULL)
+/* Enable EDP (passthru from PCH) */
+GPIO(EC_EDP_VDD_EN, J, 5, GPIO_OUT_LOW, NULL)
+
+/* Dunno. Probably important, though. */
+GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH, NULL)
+/* USB port 1 output power enable */
+GPIO(USB1_ENABLE, E, 4, GPIO_OUT_LOW, NULL)
+/* USB port 2 output power enable */
+GPIO(USB2_ENABLE, D, 5, GPIO_OUT_LOW, NULL)
+
+/* Acknowledge PCH SUSWARN# signal */
+GPIO(PCH_SUSACK_L, F, 3, GPIO_OUT_HIGH, NULL)
+/* Not supposed to be here */
+GPIO(PCH_RTCRST_L, F, 6, GPIO_ODR_HIGH, NULL)
+/* Not supposed to be here */
+GPIO(PCH_SRTCRST_L, F, 7, GPIO_ODR_HIGH, NULL)
+
+GPIO(BAT_LED0_L, D, 0, GPIO_ODR_HIGH, NULL) /* Battery charging LED - blue */
+GPIO(BAT_LED1_L, N, 4, GPIO_ODR_HIGH, NULL) /* Battery charging LED - orange */
+GPIO(PWR_LED0_L, D, 1, GPIO_ODR_HIGH, NULL) /* Power LED - blue */
+GPIO(PWR_LED1_L, N, 6, GPIO_ODR_HIGH, NULL) /* Power LED - orange */
diff --git a/board/pit/board.c b/board/pit/board.c
index 4bd4fa3665..08f5697cfc 100644
--- a/board/pit/board.c
+++ b/board/pit/board.c
@@ -24,70 +24,7 @@
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
#define GPIO_KB_OUTPUT GPIO_ODR_HIGH
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"KB_PWR_ON_L", GPIO_B, (1<<5), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP1800_LDO2", GPIO_A, (1<<1), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_RISING,
- power_signal_interrupt},
- {"CHARGER_INT_L", GPIO_C, (1<<6), GPIO_INT_FALLING, pmu_irq_handler},
- {"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, lid_interrupt},
- {"SUSPEND_L", GPIO_C, (1<<7), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"SPI1_NSS", GPIO_A, (1<<4), GPIO_INT_BOTH | GPIO_PULL_UP,
- spi_event},
- {"AC_PRESENT", GPIO_A, (1<<0), GPIO_INT_BOTH, extpower_interrupt},
- {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- /* Other inputs */
- {"WP_L", GPIO_B, (1<<4), GPIO_INPUT, NULL},
- /* Outputs */
- {"AP_RESET_L", GPIO_B, (1<<3), GPIO_ODR_HIGH, NULL},
- {"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL},
- {"EC_INT", GPIO_B, (1<<9), GPIO_ODR_HIGH, NULL},
- {"EN_PP1350", GPIO_H, (1<<1), GPIO_OUT_LOW, NULL},
- {"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL},
- {"EN_PP5000", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL},
- {"ENTERING_RW", GPIO_H, (1<<0), GPIO_OUT_LOW, NULL},
- {"I2C1_SCL", GPIO_B, (1<<6), GPIO_ODR_HIGH, NULL},
- {"I2C1_SDA", GPIO_B, (1<<7), GPIO_ODR_HIGH, NULL},
- {"I2C2_SCL", GPIO_B, (1<<10), GPIO_ODR_HIGH, NULL},
- {"I2C2_SDA", GPIO_B, (1<<11), GPIO_ODR_HIGH, NULL},
- {"CHARGING_LED",GPIO_A, (1<<2), GPIO_OUT_LOW, NULL},
- {"PMIC_PWRON", GPIO_A, (1<<12), GPIO_OUT_LOW, NULL},
- {"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
- {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT04", GPIO_B, (1<<14), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT05", GPIO_B, (1<<15), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT06", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT07", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT08", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT09", GPIO_B, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT10", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT11", GPIO_C, (1<<4), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT12", GPIO_A, (1<<13), GPIO_KB_OUTPUT, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/pit/board.h b/board/pit/board.h
index 85f20b3895..ac818cf883 100644
--- a/board/pit/board.h
+++ b/board/pit/board.h
@@ -46,59 +46,8 @@
#define TIM_POWER_LED 2
#define TIM_WATCHDOG 4
-/* GPIO signal list */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_KB_PWR_ON_L = 0,
- GPIO_PP1800_LDO2,
- GPIO_SOC1V8_XPSHOLD,
- GPIO_CHARGER_INT_L,
- GPIO_LID_OPEN,
- GPIO_SUSPEND_L,
- GPIO_SPI1_NSS,
- GPIO_AC_PRESENT,
- /* Keyboard inputs */
- GPIO_KB_IN00,
- GPIO_KB_IN01,
- GPIO_KB_IN02,
- GPIO_KB_IN03,
- GPIO_KB_IN04,
- GPIO_KB_IN05,
- GPIO_KB_IN06,
- GPIO_KB_IN07,
- /* Other inputs */
- GPIO_WP_L,
- /* Outputs */
- GPIO_AP_RESET_L,
- GPIO_CHARGER_EN,
- GPIO_EC_INT,
- GPIO_EN_PP1350,
- GPIO_EN_PP3300,
- GPIO_EN_PP5000,
- GPIO_ENTERING_RW,
- GPIO_I2C1_SCL,
- GPIO_I2C1_SDA,
- GPIO_I2C2_SCL,
- GPIO_I2C2_SDA,
- GPIO_CHARGING_LED,
- GPIO_PMIC_PWRON,
- GPIO_PMIC_RESET,
- GPIO_KB_OUT00,
- GPIO_KB_OUT01,
- GPIO_KB_OUT02,
- GPIO_KB_OUT03,
- GPIO_KB_OUT04,
- GPIO_KB_OUT05,
- GPIO_KB_OUT06,
- GPIO_KB_OUT07,
- GPIO_KB_OUT08,
- GPIO_KB_OUT09,
- GPIO_KB_OUT10,
- GPIO_KB_OUT11,
- GPIO_KB_OUT12,
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
+
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */
diff --git a/board/pit/gpio.inc b/board/pit/gpio.inc
new file mode 100644
index 0000000000..7f2e5295fa
--- /dev/null
+++ b/board/pit/gpio.inc
@@ -0,0 +1,58 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+GPIO(KB_PWR_ON_L, B, 5, GPIO_INT_BOTH, power_signal_interrupt)
+GPIO(PP1800_LDO2, A, 1, GPIO_INT_BOTH, power_signal_interrupt)
+GPIO(SOC1V8_XPSHOLD, A, 3, GPIO_INT_RISING, power_signal_interrupt)
+GPIO(CHARGER_INT_L, C, 6, GPIO_INT_FALLING, pmu_irq_handler)
+GPIO(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt)
+GPIO(SUSPEND_L, C, 7, GPIO_INT_BOTH, power_signal_interrupt)
+GPIO(SPI1_NSS, A, 4, GPIO_INT_BOTH | GPIO_PULL_UP, spi_event)
+GPIO(AC_PRESENT, A, 0, GPIO_INT_BOTH, extpower_interrupt)
+
+/* Keyboard inputs */
+GPIO(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+
+/* Other inputs */
+GPIO(WP_L, B, 4, GPIO_INPUT, NULL)
+
+/* Outputs */
+GPIO(AP_RESET_L, B, 3, GPIO_ODR_HIGH, NULL)
+GPIO(CHARGER_EN, B, 2, GPIO_OUT_LOW, NULL)
+GPIO(EC_INT, B, 9, GPIO_ODR_HIGH, NULL)
+GPIO(EN_PP1350, H, 1, GPIO_OUT_LOW, NULL)
+GPIO(EN_PP3300, A, 8, GPIO_OUT_LOW, NULL)
+GPIO(EN_PP5000, A, 11, GPIO_OUT_LOW, NULL)
+GPIO(ENTERING_RW, H, 0, GPIO_OUT_LOW, NULL)
+GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH, NULL)
+GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH, NULL)
+GPIO(I2C2_SCL, B, 10, GPIO_ODR_HIGH, NULL)
+GPIO(I2C2_SDA, B, 11, GPIO_ODR_HIGH, NULL)
+GPIO(CHARGING_LED,A, 2, GPIO_OUT_LOW, NULL)
+GPIO(PMIC_PWRON, A, 12, GPIO_OUT_LOW, NULL)
+GPIO(PMIC_RESET, A, 15, GPIO_OUT_LOW, NULL)
+GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT, NULL)
diff --git a/board/rambi/board.c b/board/rambi/board.c
index d78f31e635..9810f5a0c5 100644
--- a/board/rambi/board.c
+++ b/board/rambi/board.c
@@ -32,87 +32,7 @@
#include "uart.h"
#include "util.h"
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"POWER_BUTTON_L", LM4_GPIO_A, (1<<2), GPIO_INT_BOTH_DSLEEP,
- power_button_interrupt},
- {"LID_OPEN", LM4_GPIO_A, (1<<3), GPIO_INT_BOTH_DSLEEP,
- lid_interrupt},
- {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH_DSLEEP,
- extpower_interrupt},
- {"PCH_SLP_S3_L", LM4_GPIO_G, (1<<7), GPIO_INT_BOTH_DSLEEP |
- GPIO_PULL_UP,
- power_signal_interrupt},
- {"PCH_SLP_S4_L", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH_DSLEEP |
- GPIO_PULL_UP,
- power_signal_interrupt},
- {"PP1050_PGOOD", LM4_GPIO_H, (1<<4), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP3300_PCH_PGOOD", LM4_GPIO_C, (1<<4), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP5000_PGOOD", LM4_GPIO_N, (1<<0), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"S5_PGOOD", LM4_GPIO_G, (1<<0), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH,
- switch_interrupt},
- {"JTAG_TCK", LM4_GPIO_C, (1<<0), GPIO_DEFAULT,
- jtag_interrupt},
- {"UART0_RX", LM4_GPIO_A, (1<<0), GPIO_INT_BOTH_DSLEEP |
- GPIO_PULL_UP,
- uart_deepsleep_interrupt},
-
- /* Other inputs */
- {"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL},
- {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL},
- {"BOARD_VERSION3", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL},
-#ifdef CONFIG_CHIPSET_DEBUG
- {"PCH_SLP_SX_L", LM4_GPIO_G, (1<<3), GPIO_INPUT|GPIO_PULL_UP,
- NULL},
- {"PCH_SUS_STAT_L", LM4_GPIO_G, (1<<6), GPIO_INPUT|GPIO_PULL_UP,
- NULL},
- {"PCH_SUSPWRDNACK", LM4_GPIO_G, (1<<2), GPIO_INPUT|GPIO_PULL_UP,
- NULL},
-#endif
- {"PP1000_S0IX_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INPUT, NULL},
- {"USB1_OC_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL},
- {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL},
-
- /* Outputs; all unasserted by default except for reset signals */
- {"CPU_PROCHOT", LM4_GPIO_B, (1<<5), GPIO_OUT_LOW, NULL},
- {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_ODR_HIGH, NULL},
- {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL},
- {"ENTERING_RW", LM4_GPIO_D, (1<<6), GPIO_OUT_LOW, NULL},
- {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL},
- {"PCH_CORE_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL},
- {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_ODR_HIGH, NULL},
- {"PCH_RCIN_L", LM4_GPIO_F, (1<<3), GPIO_ODR_HIGH, NULL},
- {"PCH_RSMRST_L", LM4_GPIO_F, (1<<1), GPIO_OUT_LOW, NULL},
- {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL},
- {"PCH_SOC_OVERRIDE", LM4_GPIO_G, (1<<1), GPIO_OUT_LOW, NULL},
- {"PCH_SYS_PWROK", LM4_GPIO_J, (1<<1), GPIO_OUT_LOW, NULL},
- {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_ODR_HIGH, NULL},
- {"PP1350_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL},
- {"PP3300_DX_EN", LM4_GPIO_J, (1<<2), GPIO_OUT_LOW, NULL},
- {"PP3300_LTE_EN", LM4_GPIO_D, (1<<4), GPIO_OUT_LOW, NULL},
- {"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL},
- {"PP5000_EN", LM4_GPIO_H, (1<<7), GPIO_OUT_LOW, NULL},
- {"PPSX_EN", LM4_GPIO_L, (1<<6), GPIO_OUT_LOW, NULL},
- {"SUSP_VR_EN", LM4_GPIO_C, (1<<7), GPIO_OUT_LOW, NULL},
- {"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_OUT_LOW, NULL},
- {"USB_CTL1", LM4_GPIO_E, (1<<6), GPIO_OUT_LOW, NULL},
- {"USB_ILIM_SEL", LM4_GPIO_E, (1<<5), GPIO_OUT_LOW, NULL},
- {"USB1_ENABLE", LM4_GPIO_E, (1<<4), GPIO_OUT_LOW, NULL},
- {"USB2_ENABLE", LM4_GPIO_D, (1<<5), GPIO_OUT_LOW, NULL},
- {"VCORE_EN", LM4_GPIO_C, (1<<5), GPIO_OUT_LOW, NULL},
- {"WLAN_OFF_L", LM4_GPIO_J, (1<<4), GPIO_OUT_LOW, NULL},
- {"PCH_SCI_L", LM4_GPIO_M, (1<<1), GPIO_ODR_HIGH, NULL},
- {"KBD_IRQ_L", LM4_GPIO_M, (1<<3), GPIO_ODR_HIGH, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/rambi/board.h b/board/rambi/board.h
index 7c3b1a35c2..f913792b32 100644
--- a/board/rambi/board.h
+++ b/board/rambi/board.h
@@ -68,71 +68,7 @@
#define WIRELESS_GPIO_WWAN GPIO_PP3300_LTE_EN
#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_WLAN_EN
-/* GPIO signal definitions. */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_POWER_BUTTON_L = 0, /* Power button */
- GPIO_LID_OPEN, /* Lid switch */
- GPIO_AC_PRESENT, /* AC power present */
- GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */
- GPIO_PCH_SLP_S4_L, /* SLP_S4# signal from PCH */
- GPIO_PP1050_PGOOD, /* Power good on 1.05V */
- GPIO_PP3300_PCH_PGOOD, /* Power good on 3.3V (PCH supply) */
- GPIO_PP5000_PGOOD, /* Power good on 5V */
- GPIO_S5_PGOOD, /* Power good on S5 supplies */
- GPIO_VCORE_PGOOD, /* Power good on core VR */
- GPIO_WP_L, /* Write protect input */
- GPIO_JTAG_TCK, /* JTAG clock input */
- GPIO_UART0_RX, /* UART0 RX input */
-
- /* Other inputs */
- GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */
- GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */
- GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */
-#ifdef CONFIG_CHIPSET_DEBUG
- GPIO_PCH_SLP_SX_L, /* SLP_S0IX# signal from PCH */
- GPIO_PCH_SUS_STAT_L, /* SUS_STAT# signal from PCH */
- GPIO_PCH_SUSPWRDNACK, /* SUSPWRDNACK signal from PCH */
-#endif
- GPIO_PP1000_S0IX_PGOOD, /* Power good on 1.00V (S0iX supplies) */
- GPIO_USB1_OC_L, /* USB port overcurrent warning */
- GPIO_USB2_OC_L, /* USB port overcurrent warning */
-
- /* Outputs */
- GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */
- GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */
- GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */
- GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */
- GPIO_LPC_CLKRUN_L, /* Request that PCH drive LPC clock */
- GPIO_PCH_CORE_PWROK, /* Indicate core well power is stable */
- GPIO_PCH_PWRBTN_L, /* Power button output to PCH */
- GPIO_PCH_RCIN_L, /* Reset line to PCH (for 8042 emulation) */
- GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */
- GPIO_PCH_SMI_L, /* System management interrupt to PCH */
- GPIO_PCH_SOC_OVERRIDE, /* SOC override signal to PCH; when high, ME
- * ignores security descriptor */
- GPIO_PCH_SYS_PWROK, /* EC thinks everything is up and ready */
- GPIO_PCH_WAKE_L, /* Wake signal from EC to PCH */
- GPIO_PP1350_EN, /* Enable 1.35V supply */
- GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */
- GPIO_PP3300_LTE_EN, /* Enable LTE radio */
- GPIO_PP3300_WLAN_EN, /* Enable WiFi power */
- GPIO_PP5000_EN, /* Enable 5V supply */
- GPIO_PPSX_EN, /* Enable PP1350_PCH_SX, PP1000_PCH_SX */
- GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */
- GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */
- GPIO_USB_CTL1, /* USB control signal 1 to both ports */
- GPIO_USB_ILIM_SEL, /* USB current limit to both ports */
- GPIO_USB1_ENABLE, /* USB port 1 output power enable */
- GPIO_USB2_ENABLE, /* USB port 2 output power enable */
- GPIO_VCORE_EN, /* Enable core power supplies */
- GPIO_WLAN_OFF_L, /* Disable WiFi radio */
- GPIO_PCH_SCI_L, /* Assert SCI to PCH */
- GPIO_KBD_IRQ_L, /* Negative edge triggered irq. */
-
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* power signal definitions */
enum power_signal {
diff --git a/board/rambi/gpio.inc b/board/rambi/gpio.inc
new file mode 100644
index 0000000000..3ac32f5468
--- /dev/null
+++ b/board/rambi/gpio.inc
@@ -0,0 +1,119 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+GPIO(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH_DSLEEP,
+ power_button_interrupt)
+GPIO(LID_OPEN, A, 3, GPIO_INT_BOTH_DSLEEP, lid_interrupt)
+GPIO(AC_PRESENT, H, 3, GPIO_INT_BOTH_DSLEEP, extpower_interrupt)
+/* SLP_S3# signal from PCH */
+GPIO(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP,
+ power_signal_interrupt)
+/* SLP_S4# signal from PCH */
+GPIO(PCH_SLP_S4_L, H, 1, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP,
+ power_signal_interrupt)
+/* Power good on 1.05V */
+GPIO(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 3.3V (PCH supply) */
+GPIO(PP3300_PCH_PGOOD, C, 4, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 5V */
+GPIO(PP5000_PGOOD, N, 0, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on S5 supplies */
+GPIO(S5_PGOOD, G, 0, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on core VR */
+GPIO(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* Write protect input */
+GPIO(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt)
+/* JTAG clock input */
+GPIO(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt)
+/* UART0 RX input */
+GPIO(UART0_RX, A, 0, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP,
+ uart_deepsleep_interrupt)
+
+/* Other inputs */
+GPIO(BOARD_VERSION1, Q, 5, GPIO_INPUT, NULL)
+GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT, NULL)
+GPIO(BOARD_VERSION3, Q, 7, GPIO_INPUT, NULL)
+
+#ifdef CONFIG_CHIPSET_DEBUG
+/* SLP_S0IX# signal from PCH */
+GPIO(PCH_SLP_SX_L, G, 3, GPIO_INPUT | GPIO_PULL_UP, NULL)
+/* SUS_STAT# signal from PCH */
+GPIO(PCH_SUS_STAT_L, G, 6, GPIO_INPUT | GPIO_PULL_UP, NULL)
+/* SUSPWRDNACK signal from PCH */
+GPIO(PCH_SUSPWRDNACK, G, 2, GPIO_INPUT | GPIO_PULL_UP, NULL)
+#endif
+
+/* Power good on 1.00V (S0iX supplies) */
+GPIO(PP1000_S0IX_PGOOD, H, 6, GPIO_INPUT, NULL)
+/* USB port overcurrent warning */
+GPIO(USB1_OC_L, E, 7, GPIO_INPUT, NULL)
+/* USB port overcurrent warning */
+GPIO(USB2_OC_L, E, 0, GPIO_INPUT, NULL)
+
+/* Outputs; all unasserted by default except for reset signals */
+/* Force CPU to think it's overheated */
+GPIO(CPU_PROCHOT, B, 5, GPIO_OUT_LOW, NULL)
+
+
+/* Enable backlight power */
+GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_ODR_HIGH, NULL)
+/* Enable touchpad power */
+GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW, NULL)
+/* Indicate when EC is entering RW code */
+GPIO(ENTERING_RW, D, 6, GPIO_OUT_LOW, NULL)
+/* Request that PCH drive LPC clock */
+GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH, NULL)
+/* Indicate core well power is stable */
+GPIO(PCH_CORE_PWROK, F, 5, GPIO_OUT_LOW, NULL)
+/* Power button output to PCH */
+GPIO(PCH_PWRBTN_L, H, 0, GPIO_ODR_HIGH, NULL)
+/* Reset line to PCH (for 8042 emulation) */
+GPIO(PCH_RCIN_L, F, 3, GPIO_ODR_HIGH, NULL)
+/* Reset PCH resume power plane logic */
+GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW, NULL)
+/* System management interrupt to PCH */
+GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH, NULL)
+/* SOC override signal to PCH; when high, ME
+ * ignores security descriptor */
+GPIO(PCH_SOC_OVERRIDE, G, 1, GPIO_OUT_LOW, NULL)
+/* EC thinks everything is up and ready */
+GPIO(PCH_SYS_PWROK, J, 1, GPIO_OUT_LOW, NULL)
+/* Wake signal from EC to PCH */
+GPIO(PCH_WAKE_L, F, 0, GPIO_ODR_HIGH, NULL)
+/* Enable 1.35V supply */
+GPIO(PP1350_EN, H, 5, GPIO_OUT_LOW, NULL)
+/* Enable power to lots of peripherals */
+GPIO(PP3300_DX_EN, J, 2, GPIO_OUT_LOW, NULL)
+/* Enable LTE radio */
+GPIO(PP3300_LTE_EN, D, 4, GPIO_OUT_LOW, NULL)
+/* Enable WiFi power */
+GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW, NULL)
+/* Enable 5V supply */
+GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW, NULL)
+/* Enable PP1350_PCH_SX, PP1000_PCH_SX */
+GPIO(PPSX_EN, L, 6, GPIO_OUT_LOW, NULL)
+/* Enable 1.05V regulator */
+GPIO(SUSP_VR_EN, C, 7, GPIO_OUT_LOW, NULL)
+/* Reset touch screen */
+GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_OUT_LOW, NULL)
+/* USB control signal 1 to both ports */
+GPIO(USB_CTL1, E, 6, GPIO_OUT_LOW, NULL)
+/* USB current limit to both ports */
+GPIO(USB_ILIM_SEL, E, 5, GPIO_OUT_LOW, NULL)
+/* USB port 1 output power enable */
+GPIO(USB1_ENABLE, E, 4, GPIO_OUT_LOW, NULL)
+/* USB port 2 output power enable */
+GPIO(USB2_ENABLE, D, 5, GPIO_OUT_LOW, NULL)
+/* Enable core power supplies */
+GPIO(VCORE_EN, C, 5, GPIO_OUT_LOW, NULL)
+/* Disable WiFi radio */
+GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW, NULL)
+/* Assert SCI to PCH */
+GPIO(PCH_SCI_L, M, 1, GPIO_ODR_HIGH, NULL)
+/* Negative edge triggered irq. */
+GPIO(KBD_IRQ_L, M, 3, GPIO_ODR_HIGH, NULL)
diff --git a/board/samus/board.c b/board/samus/board.c
index e7af4b6516..046ddfcc5e 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -44,117 +44,7 @@ static void pd_mcu_interrupt(enum gpio_signal signal)
host_command_pd_send_status();
}
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"POWER_BUTTON_L", LM4_GPIO_A, (1<<2), GPIO_INT_BOTH,
- power_button_interrupt},
- {"LID_OPEN", LM4_GPIO_A, (1<<3), GPIO_INT_BOTH,
- lid_interrupt},
- {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH,
- extpower_interrupt},
- {"PCH_SLP_S0_L", LM4_GPIO_G, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SLP_S3_L", LM4_GPIO_G, (1<<7), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SLP_S5_L", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SLP_SUS_L", LM4_GPIO_G, (1<<3), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PCH_SUSWARN_L", LM4_GPIO_G, (1<<2), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP1050_PGOOD", LM4_GPIO_H, (1<<4), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP1200_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP1800_PGOOD", LM4_GPIO_L, (1<<7), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"RECOVERY_L", LM4_GPIO_A, (1<<5), GPIO_PULL_UP|GPIO_INT_BOTH,
- switch_interrupt},
- {"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH,
- switch_interrupt},
- {"PCH_BL_EN", LM4_GPIO_M, (1<<3), GPIO_INT_RISING,
- backlight_interrupt},
- {"JTAG_TCK", LM4_GPIO_C, (1<<0), GPIO_DEFAULT,
- jtag_interrupt},
- {"UART0_RX", LM4_GPIO_A, (1<<0), GPIO_PULL_UP|
- GPIO_INT_BOTH_DSLEEP,
- uart_deepsleep_interrupt},
- /* This will become an interrupt, once we have support for it. */
- {"ACCEL_INT", LM4_GPIO_F, (1<<7), GPIO_INPUT, NULL},
- /* This connection exists but may not be configured */
-#ifdef CONFIG_CAPSENSE
- {"CAPSENSE_INT_L", LM4_GPIO_N, (1<<0), GPIO_INT_FALLING,
- capsense_interrupt},
-#else
- {"CAPSENSE_INT_L", LM4_GPIO_N, (1<<0), GPIO_INPUT, NULL},
-#endif
- {"PD_MCU_INT_L", LM4_GPIO_J, (1<<5), GPIO_PULL_UP|
- GPIO_INT_FALLING|
- GPIO_INT_DSLEEP,
- pd_mcu_interrupt},
-
- /* Other inputs */
- {"BOARD_VERSION1", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL},
- {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL},
- {"BOARD_VERSION3", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL},
- {"USB1_OC_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL},
- {"USB1_STATUS_L", LM4_GPIO_E, (1<<6), GPIO_INPUT, NULL},
- {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL},
- {"USB2_STATUS_L", LM4_GPIO_D, (1<<7), GPIO_INPUT, NULL},
-
- /* Outputs; all unasserted by default except for reset signals */
- {"CPU_PROCHOT", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL},
- {"PP1200_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL},
- {"PP3300_DSW_EN", LM4_GPIO_F, (1<<6), GPIO_OUT_LOW, NULL},
- {"PP3300_DSW_GATED_EN", LM4_GPIO_J, (1<<3), GPIO_OUT_LOW, NULL},
- {"PP3300_LTE_EN", LM4_GPIO_D, (1<<2), GPIO_OUT_LOW, NULL},
- {"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL},
- {"PP3300_ACCEL_EN", LM4_GPIO_J, (1<<1), GPIO_OUT_HIGH, NULL},
- {"PP1050_EN", LM4_GPIO_C, (1<<7), GPIO_OUT_LOW, NULL},
- {"PP5000_USB_EN", LM4_GPIO_C, (1<<5), GPIO_OUT_LOW, NULL},
- {"PP5000_EN", LM4_GPIO_H, (1<<7), GPIO_OUT_LOW, NULL},
- {"PP1800_EN", LM4_GPIO_L, (1<<6), GPIO_OUT_LOW, NULL},
- {"SYS_PWROK", LM4_GPIO_H, (1<<2), GPIO_OUT_LOW, NULL},
- {"WLAN_OFF_L", LM4_GPIO_J, (1<<4), GPIO_OUT_LOW, NULL},
- {"USB_MCU_RST_L", LM4_GPIO_B, (1<<0), GPIO_ODR_HIGH, NULL},
- {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_OUT_LOW, NULL},
- {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL},
- {"ENTERING_RW", LM4_GPIO_D, (1<<3), GPIO_OUT_LOW, NULL},
- {"LIGHTBAR_RESET_L", LM4_GPIO_J, (1<<2), GPIO_ODR_LOW, NULL},
- {"PCH_DPWROK", LM4_GPIO_G, (1<<0), GPIO_OUT_LOW, NULL},
- {"PCH_RSMRST_L", LM4_GPIO_C, (1<<4), GPIO_OUT_LOW, NULL},
- /*
- * HDA_SDO is technically an output, but we need to leave it as an
- * input until we drive it high. So can't use open-drain (HI_Z).
- */
- {"PCH_HDA_SDO", LM4_GPIO_G, (1<<1), GPIO_INPUT, NULL},
- {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_ODR_HIGH, NULL},
- {"PCH_NMI_L", LM4_GPIO_F, (1<<2), GPIO_ODR_HIGH, NULL},
- {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_ODR_HIGH, NULL},
- {"PCH_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL},
- {"PCH_RCIN_L", LM4_GPIO_F, (1<<3), GPIO_ODR_HIGH, NULL},
- {"PCH_SYS_RST_L", LM4_GPIO_F, (1<<1), GPIO_ODR_HIGH, NULL},
- {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL},
- {"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_ODR_LOW, NULL},
- {"PCH_ACOK", LM4_GPIO_M, (1<<6), GPIO_OUT_LOW, NULL},
-#ifndef HEY_USE_BUILTIN_CLKRUN
- {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL},
-#endif
- {"USB1_CTL1", LM4_GPIO_E, (1<<1), GPIO_OUT_LOW, NULL},
- {"USB1_CTL2", LM4_GPIO_E, (1<<2), GPIO_OUT_HIGH, NULL},
- {"USB1_CTL3", LM4_GPIO_E, (1<<3), GPIO_OUT_LOW, NULL},
- {"USB1_ENABLE", LM4_GPIO_E, (1<<4), GPIO_OUT_HIGH, NULL},
- {"USB1_ILIM_SEL", LM4_GPIO_E, (1<<5), GPIO_OUT_LOW, NULL},
- {"USB2_CTL1", LM4_GPIO_D, (1<<0), GPIO_OUT_LOW, NULL},
- {"USB2_CTL2", LM4_GPIO_D, (1<<1), GPIO_OUT_HIGH, NULL},
- {"USB2_CTL3", LM4_GPIO_D, (1<<4), GPIO_OUT_LOW, NULL},
- {"USB2_ENABLE", LM4_GPIO_D, (1<<5), GPIO_OUT_HIGH, NULL},
- {"USB2_ILIM_SEL", LM4_GPIO_D, (1<<6), GPIO_OUT_LOW, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/samus/board.h b/board/samus/board.h
index 7f41904f6a..2755eb3ff1 100644
--- a/board/samus/board.h
+++ b/board/samus/board.h
@@ -81,90 +81,7 @@
/* USB ports managed by the EC */
#define USB_PORT_COUNT 2
-/* GPIO signal definitions. */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_POWER_BUTTON_L = 0, /* Power button */
- GPIO_LID_OPEN, /* Lid switch */
- GPIO_AC_PRESENT, /* AC power present */
- GPIO_PCH_SLP_S0_L, /* SLP_S0# signal from PCH */
- GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */
- GPIO_PCH_SLP_S5_L, /* SLP_S5# signal from PCH */
- GPIO_PCH_SLP_SUS_L, /* SLP_SUS# signal from PCH */
- GPIO_PCH_SUSWARN_L, /* SUSWARN# signal from PCH */
- GPIO_PP1050_PGOOD, /* Power good on 1.05V */
- GPIO_PP1200_PGOOD, /* Power good on 1.2V (DRAM) */
- GPIO_PP1800_PGOOD, /* Power good on 1.8V (DRAM) */
- GPIO_VCORE_PGOOD, /* Power good on core VR */
- GPIO_RECOVERY_L, /* Recovery signal from servo */
- GPIO_WP_L, /* Write protect input */
- GPIO_PCH_BL_EN, /* PCH backlight input */
- GPIO_JTAG_TCK, /* JTAG clock input */
- GPIO_UART0_RX, /* UART0 RX input */
- GPIO_ACCEL_INT, /* Combined accelerometer input */
- GPIO_CAPSENSE_INT_L, /* Capsense interrupt input */
- GPIO_PD_MCU_INT_L, /* Interrupt signal from PD MCU */
-
- /* Other inputs */
- GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */
- GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */
- GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */
- GPIO_USB1_OC_L, /* USB port overcurrent warning */
- GPIO_USB1_STATUS_L, /* USB charger port 1 status output */
- GPIO_USB2_OC_L, /* USB port overcurrent warning */
- GPIO_USB2_STATUS_L, /* USB charger port 2 status output */
-
- /* Outputs */
- GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */
- GPIO_PP1200_EN, /* Enable 1.20V supply */
- GPIO_PP3300_DSW_EN, /* Enable 3.3V DSW rail */
- GPIO_PP3300_DSW_GATED_EN, /* Enable 3.3V Gated DSW and core VDD */
- GPIO_PP3300_LTE_EN, /* Enable LTE radio */
- GPIO_PP3300_WLAN_EN, /* Enable WiFi power */
- GPIO_PP3300_ACCEL_EN, /* Enable Accelerometer power */
- GPIO_PP1050_EN, /* Enable 1.05V regulator */
- GPIO_PP5000_USB_EN, /* Enable USB power */
- GPIO_PP5000_EN, /* Enable 5V supply */
- GPIO_PP1800_EN, /* Enable 1.8V supply */
- GPIO_SYS_PWROK, /* EC thinks everything is up and ready */
- GPIO_WLAN_OFF_L, /* Disable WiFi radio */
-
- GPIO_USB_MCU_RST_L, /* USB PD MCU reset */
- GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */
- GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */
- GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */
- GPIO_LIGHTBAR_RESET_L, /* Reset lightbar controllers */
- GPIO_PCH_DPWROK, /* Indicate when VccDSW is good */
- GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */
-
- GPIO_PCH_HDA_SDO, /* HDA_SDO signal to PCH; when high, ME
- * ignores security descriptor */
- GPIO_PCH_WAKE_L, /* Wake signal from EC to PCH */
- GPIO_PCH_NMI_L, /* Non-maskable interrupt pin to PCH */
- GPIO_PCH_PWRBTN_L, /* Power button output to PCH */
- GPIO_PCH_PWROK, /* PWROK / APWROK signals to PCH */
- GPIO_PCH_RCIN_L, /* RCIN# line to PCH (for 8042 emulation) */
- GPIO_PCH_SYS_RST_L, /* Reset PCH resume power plane logic */
- GPIO_PCH_SMI_L, /* System management interrupt to PCH */
- GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */
- GPIO_PCH_ACOK, /* AC present signal buffered to PCH */
-#ifndef HEY_USE_BUILTIN_CLKRUN
- GPIO_LPC_CLKRUN_L, /* Dunno. Probably important, though. */
-#endif
- GPIO_USB1_CTL1, /* USB charger port 1 CTL1 output */
- GPIO_USB1_CTL2, /* USB charger port 1 CTL2 output */
- GPIO_USB1_CTL3, /* USB charger port 1 CTL3 output */
- GPIO_USB1_ENABLE, /* USB charger port 1 enable */
- GPIO_USB1_ILIM_SEL, /* USB charger port 1 ILIM_SEL output */
- GPIO_USB2_CTL1, /* USB charger port 2 CTL1 output */
- GPIO_USB2_CTL2, /* USB charger port 2 CTL2 output */
- GPIO_USB2_CTL3, /* USB charger port 2 CTL3 output */
- GPIO_USB2_ENABLE, /* USB charger port 2 enable */
- GPIO_USB2_ILIM_SEL, /* USB charger port 2 ILIM_SEL output */
-
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* x86 signal definitions */
enum x86_signal {
diff --git a/board/samus/gpio.inc b/board/samus/gpio.inc
new file mode 100644
index 0000000000..5a20e790cf
--- /dev/null
+++ b/board/samus/gpio.inc
@@ -0,0 +1,167 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+/* Power button */
+GPIO(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH, power_button_interrupt)
+/* Lid switch */
+GPIO(LID_OPEN, A, 3, GPIO_INT_BOTH, lid_interrupt)
+/* AC power present */
+GPIO(AC_PRESENT, H, 3, GPIO_INT_BOTH, extpower_interrupt)
+/* SLP_S0# signal from PCH */
+GPIO(PCH_SLP_S0_L, G, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* SLP_S3# signal from PCH */
+GPIO(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH, power_signal_interrupt)
+/* SLP_S5# signal from PCH */
+GPIO(PCH_SLP_S5_L, H, 1, GPIO_INT_BOTH, power_signal_interrupt)
+/* SLP_SUS# signal from PCH */
+GPIO(PCH_SLP_SUS_L, G, 3, GPIO_INT_BOTH, power_signal_interrupt)
+/* SUSWARN# signal from PCH */
+GPIO(PCH_SUSWARN_L, G, 2, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 1.05V */
+GPIO(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 1.2V (DRAM) */
+GPIO(PP1200_PGOOD, H, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 1.8V (DRAM) */
+GPIO(PP1800_PGOOD, L, 7, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on core VR */
+GPIO(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* Recovery signal from servo */
+GPIO(RECOVERY_L, A, 5, GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt)
+/* Write protect input */
+GPIO(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt)
+/* PCH backlight input */
+GPIO(PCH_BL_EN, M, 3, GPIO_INT_RISING, backlight_interrupt)
+/* JTAG clock input */
+GPIO(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt)
+/* UART0 RX input */
+GPIO(UART0_RX, A, 0, GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP,
+ uart_deepsleep_interrupt)
+
+/*
+ * Combined accelerometer input. This will become an interrupt, once we have
+ * support for it.
+ */
+GPIO(ACCEL_INT, F, 7, GPIO_INPUT, NULL)
+
+/* Capsense interrupt input. This connection exists but may not be configured */
+#ifdef CONFIG_CAPSENSE
+GPIO(CAPSENSE_INT_L, N, 0, GPIO_INT_FALLING, capsense_interrupt)
+#else
+GPIO(CAPSENSE_INT_L, N, 0, GPIO_INPUT, NULL)
+#endif
+
+/* Interrupt signal from PD MCU */
+GPIO(PD_MCU_INT_L, J, 5, GPIO_PULL_UP | GPIO_INT_FALLING | GPIO_INT_DSLEEP,
+ pd_mcu_interrupt)
+
+/* Other inputs */
+/* Board version stuffing resistor 1 */
+GPIO(BOARD_VERSION1, Q, 7, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 2 */
+GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 3 */
+GPIO(BOARD_VERSION3, Q, 5, GPIO_INPUT, NULL)
+/* USB port overcurrent warning */
+GPIO(USB1_OC_L, E, 7, GPIO_INPUT, NULL)
+/* USB charger port 1 status output */
+GPIO(USB1_STATUS_L, E, 6, GPIO_INPUT, NULL)
+/* USB port overcurrent warning */
+GPIO(USB2_OC_L, E, 0, GPIO_INPUT, NULL)
+/* USB charger port 2 status output */
+GPIO(USB2_STATUS_L, D, 7, GPIO_INPUT, NULL)
+
+/* Outputs; all unasserted by default except for reset signals */
+/* Force CPU to think it's overheated */
+GPIO(CPU_PROCHOT, B, 1, GPIO_OUT_LOW, NULL)
+/* Enable 1.20V supply */
+GPIO(PP1200_EN, H, 5, GPIO_OUT_LOW, NULL)
+/* Enable 3.3V DSW rail */
+GPIO(PP3300_DSW_EN, F, 6, GPIO_OUT_LOW, NULL)
+/* Enable 3.3V Gated DSW and core VDD */
+GPIO(PP3300_DSW_GATED_EN, J, 3, GPIO_OUT_LOW, NULL)
+/* Enable LTE radio */
+GPIO(PP3300_LTE_EN, D, 2, GPIO_OUT_LOW, NULL)
+/* Enable WiFi power */
+GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW, NULL)
+/* Enable Accelerometer power */
+GPIO(PP3300_ACCEL_EN, J, 1, GPIO_OUT_HIGH, NULL)
+/* Enable 1.05V regulator */
+GPIO(PP1050_EN, C, 7, GPIO_OUT_LOW, NULL)
+/* Enable USB power */
+GPIO(PP5000_USB_EN, C, 5, GPIO_OUT_LOW, NULL)
+/* Enable 5V supply */
+GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW, NULL)
+/* Enable 1.8V supply */
+GPIO(PP1800_EN, L, 6, GPIO_OUT_LOW, NULL)
+/* EC thinks everything is up and ready */
+GPIO(SYS_PWROK, H, 2, GPIO_OUT_LOW, NULL)
+/* Disable WiFi radio */
+GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW, NULL)
+/* USB PD MCU reset */
+GPIO(USB_MCU_RST_L, B, 0, GPIO_ODR_HIGH, NULL)
+/* Enable backlight power */
+GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_OUT_LOW, NULL)
+/* Enable touchpad power */
+GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW, NULL)
+/* Indicate when EC is entering RW code */
+GPIO(ENTERING_RW, D, 3, GPIO_OUT_LOW, NULL)
+/* Reset lightbar controllers */
+GPIO(LIGHTBAR_RESET_L, J, 2, GPIO_ODR_LOW, NULL)
+/* Indicate when VccDSW is good */
+GPIO(PCH_DPWROK, G, 0, GPIO_OUT_LOW, NULL)
+/* Reset PCH resume power plane logic */
+GPIO(PCH_RSMRST_L, C, 4, GPIO_OUT_LOW, NULL)
+/*
+ * HDA_SDO is technically an output, but we need to leave it as an
+ * input until we drive it high. So can't use open-drain (HI_Z).
+ */
+/* HDA_SDO signal to PCH; when high, ME
+ * ignores security descriptor */
+GPIO(PCH_HDA_SDO, G, 1, GPIO_INPUT, NULL)
+/* Wake signal from EC to PCH */
+GPIO(PCH_WAKE_L, F, 0, GPIO_ODR_HIGH, NULL)
+/* Non-maskable interrupt pin to PCH */
+GPIO(PCH_NMI_L, F, 2, GPIO_ODR_HIGH, NULL)
+/* Power button output to PCH */
+GPIO(PCH_PWRBTN_L, H, 0, GPIO_ODR_HIGH, NULL)
+/* PWROK / APWROK signals to PCH */
+GPIO(PCH_PWROK, F, 5, GPIO_OUT_LOW, NULL)
+/* RCIN# line to PCH (for 8042 emulation) */
+GPIO(PCH_RCIN_L, F, 3, GPIO_ODR_HIGH, NULL)
+/* Reset PCH resume power plane logic */
+GPIO(PCH_SYS_RST_L, F, 1, GPIO_ODR_HIGH, NULL)
+/* System management interrupt to PCH */
+GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH, NULL)
+/* Reset touch screen */
+GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_ODR_LOW, NULL)
+/* AC present signal buffered to PCH */
+GPIO(PCH_ACOK, M, 6, GPIO_OUT_LOW, NULL)
+#ifndef HEY_USE_BUILTIN_CLKRUN
+/* Dunno. Probably important, though. */
+GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH, NULL)
+#endif
+/* USB charger port 1 CTL1 output */
+GPIO(USB1_CTL1, E, 1, GPIO_OUT_LOW, NULL)
+/* USB charger port 1 CTL2 output */
+GPIO(USB1_CTL2, E, 2, GPIO_OUT_HIGH, NULL)
+/* USB charger port 1 CTL3 output */
+GPIO(USB1_CTL3, E, 3, GPIO_OUT_LOW, NULL)
+/* USB charger port 1 enable */
+GPIO(USB1_ENABLE, E, 4, GPIO_OUT_HIGH, NULL)
+/* USB charger port 1 ILIM_SEL output */
+GPIO(USB1_ILIM_SEL, E, 5, GPIO_OUT_LOW, NULL)
+/* USB charger port 2 CTL1 output */
+GPIO(USB2_CTL1, D, 0, GPIO_OUT_LOW, NULL)
+/* USB charger port 2 CTL2 output */
+GPIO(USB2_CTL2, D, 1, GPIO_OUT_HIGH, NULL)
+/* USB charger port 2 CTL3 output */
+GPIO(USB2_CTL3, D, 4, GPIO_OUT_LOW, NULL)
+/* USB charger port 2 enable */
+GPIO(USB2_ENABLE, D, 5, GPIO_OUT_HIGH, NULL)
+/* USB charger port 2 ILIM_SEL output */
+GPIO(USB2_ILIM_SEL, D, 6, GPIO_OUT_LOW, NULL)
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c
index 741a0a5da0..321bf56229 100644
--- a/board/samus_pd/board.c
+++ b/board/samus_pd/board.c
@@ -53,126 +53,7 @@ void board_config_pre_init(void)
STM32_SYSCFG_CFGR1 |= (1 << 9) | (1 << 10) | (1 << 24) | (1 << 30);
}
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Interrupts */
- {"USB_C0_VBUS_WAKE", GPIO_E, (1<<6), GPIO_INT_BOTH, vbus_evt},
- {"USB_C1_VBUS_WAKE", GPIO_F, (1<<2), GPIO_INT_BOTH, vbus_evt},
- {"USB_C0_BC12_INT_L", GPIO_B, (1<<0), GPIO_INT_FALLING, bc12_evt},
- {"USB_C1_BC12_INT_L", GPIO_C, (1<<11), GPIO_INT_FALLING, bc12_evt},
- {"PCH_SLP_S0_L", GPIO_C, (1<<14), GPIO_INT_BOTH, pch_evt},
- {"PCH_SLP_S3_L", GPIO_C, (1<<15), GPIO_INT_BOTH, pch_evt},
- {"PCH_SLP_S5_L", GPIO_D, (1<<7), GPIO_INT_BOTH, pch_evt},
-
- /* PD RX/TX */
- {"USB_C0_CC1_PD", GPIO_A, (1<<0), GPIO_ANALOG, NULL},
- {"USB_C0_REF", GPIO_A, (1<<1), GPIO_ANALOG, NULL},
- {"USB_C1_CC1_PD", GPIO_A, (1<<2), GPIO_ANALOG, NULL},
- {"USB_C1_REF", GPIO_A, (1<<3), GPIO_ANALOG, NULL},
- {"USB_C0_CC2_PD", GPIO_A, (1<<4), GPIO_ANALOG, NULL},
- {"USB_C1_CC2_PD", GPIO_A, (1<<5), GPIO_ANALOG, NULL},
- {"USB_C0_REF_PD_ODL", GPIO_A, (1<<6), GPIO_ODR_LOW, NULL},
- {"USB_C1_REF_PD_ODL", GPIO_A, (1<<7), GPIO_ODR_LOW, NULL},
-
- {"USB_C_CC_EN", GPIO_C, (1<<10), GPIO_OUT_LOW, NULL},
- {"USB_C0_CC1_TX_EN", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
- {"USB_C0_CC2_TX_EN", GPIO_E, (1<<12), GPIO_OUT_LOW, NULL},
- {"USB_C1_CC1_TX_EN", GPIO_B, (1<<9), GPIO_OUT_LOW, NULL},
- {"USB_C1_CC2_TX_EN", GPIO_B, (1<<12), GPIO_OUT_LOW, NULL},
- {"USB_C0_CC1_TX_DATA", GPIO_B, (1<<4), GPIO_OUT_LOW, NULL},
- {"USB_C1_CC1_TX_DATA", GPIO_B, (1<<14), GPIO_OUT_LOW, NULL},
- {"USB_C0_CC2_TX_DATA", GPIO_E, (1<<14), GPIO_OUT_LOW, NULL},
- {"USB_C1_CC2_TX_DATA", GPIO_D, (1<<3), GPIO_OUT_LOW, NULL},
-
-#if 0
- /* Alternate functions */
- {"USB_C0_TX_CLKOUT", GPIO_B, (1<<1), GPIO_OUT_LOW, NULL},
- {"USB_C1_TX_CLKOUT", GPIO_E, (1<<1), GPIO_OUT_LOW, NULL},
- {"USB_C0_TX_CLKIN", GPIO_B, (1<<3), GPIO_OUT_LOW, NULL},
- {"USB_C1_TX_CLKIN", GPIO_B, (1<<13), GPIO_OUT_LOW, NULL},
-#endif
-
- /* Power and muxes control */
- {"PPVAR_BOOSTIN_SENSE", GPIO_C, (1<<1), GPIO_ANALOG, NULL},
- {"PP3300_USB_PD_EN", GPIO_A, (1<<8), GPIO_OUT_HIGH, NULL},
- {"USB_C0_CHARGE_EN_L", GPIO_D, (1<<12), GPIO_OUT_LOW, NULL},
- {"USB_C1_CHARGE_EN_L", GPIO_D, (1<<13), GPIO_OUT_HIGH, NULL},
- {"USB_C0_5V_EN", GPIO_D, (1<<14), GPIO_OUT_LOW, NULL},
- {"USB_C1_5V_EN", GPIO_D, (1<<15), GPIO_OUT_HIGH, NULL},
- {"USB_C0_CC1_VCONN1_EN_L", GPIO_D, (1<<8), GPIO_OUT_HIGH, NULL},
- {"USB_C0_CC2_VCONN1_EN_L", GPIO_D, (1<<9), GPIO_OUT_HIGH, NULL},
- {"USB_C1_CC1_VCONN1_EN_L", GPIO_D, (1<<10), GPIO_OUT_HIGH, NULL},
- {"USB_C1_CC2_VCONN1_EN_L", GPIO_D, (1<<11), GPIO_OUT_HIGH, NULL},
-
- {"USB_C0_CC1_ODL", GPIO_B, (1<<8), GPIO_ODR_LOW, NULL},
- {"USB_C0_CC2_ODL", GPIO_E, (1<<0), GPIO_ODR_LOW, NULL},
- {"USB_C1_CC1_ODL", GPIO_F, (1<<9), GPIO_ODR_LOW, NULL},
- {"USB_C1_CC2_ODL", GPIO_F, (1<<10), GPIO_ODR_LOW, NULL},
-
- {"USB_C_BC12_SEL", GPIO_C, (1<<0), GPIO_OUT_LOW, NULL},
- {"USB_C0_SS1_EN_L", GPIO_E, (1<<2), GPIO_OUT_HIGH, NULL},
- {"USB_C0_SS2_EN_L", GPIO_E, (1<<3), GPIO_OUT_HIGH, NULL},
- {"USB_C1_SS1_EN_L", GPIO_E, (1<<9), GPIO_OUT_HIGH, NULL},
- {"USB_C1_SS2_EN_L", GPIO_E, (1<<10), GPIO_OUT_HIGH, NULL},
- {"USB_C0_SS1_DP_MODE_L", GPIO_E, (1<<4), GPIO_OUT_HIGH, NULL},
- {"USB_C0_SS2_DP_MODE_L", GPIO_E, (1<<5), GPIO_OUT_HIGH, NULL},
- {"USB_C1_SS1_DP_MODE_L", GPIO_E, (1<<11), GPIO_OUT_HIGH, NULL},
- {"USB_C1_SS2_DP_MODE_L", GPIO_E, (1<<13), GPIO_OUT_HIGH, NULL},
- {"USB_C0_DP_MODE_L", GPIO_E, (1<<8), GPIO_OUT_HIGH, NULL},
- {"USB_C1_DP_MODE_L", GPIO_F, (1<<6), GPIO_OUT_LOW, NULL},
- {"USB_C0_DP_POLARITY_L", GPIO_E, (1<<7), GPIO_OUT_HIGH, NULL},
- {"USB_C1_DP_POLARITY_L", GPIO_F, (1<<3), GPIO_OUT_HIGH, NULL},
-
-#if 0
- /* Alternate functions */
- {"USB_DM", GPIO_A, (1<<11), GPIO_ANALOG, NULL},
- {"USB_DP", GPIO_A, (1<<12), GPIO_ANALOG, NULL},
- {"UART_TX", GPIO_A, (1<<9), GPIO_OUT_LOW, NULL},
- {"UART_RX", GPIO_A, (1<<10), GPIO_OUT_LOW, NULL},
- {"TP64_SWDIO", GPIO_A, (1<<13), GPIO_ODR_HIGH, NULL},
- {"TP71_SWCLK", GPIO_A, (1<<14), GPIO_ODR_HIGH, NULL},
-#endif
-
- /*
- * I2C pins should be configured as inputs until I2C module is
- * initialized. This will avoid driving the lines unintentionally.
- */
- {"SLAVE_I2C_SCL", GPIO_B, (1<<6), GPIO_INPUT, NULL},
- {"SLAVE_I2C_SDA", GPIO_B, (1<<7), GPIO_INPUT, NULL},
- {"MASTER_I2C_SCL", GPIO_B, (1<<10), GPIO_INPUT, NULL},
- {"MASTER_I2C_SDA", GPIO_B, (1<<11), GPIO_INPUT, NULL},
-
- /* Case closed debugging. */
- {"SPI_FLASH_WP_L", GPIO_D, (1<<2), GPIO_INPUT, NULL},
- {"EC_INT_L", GPIO_B, (1<<2), GPIO_ODR_HIGH, NULL},
- {"EC_IN_RW", GPIO_C, (1<<12), GPIO_INPUT, NULL},
- {"EC_RST_L", GPIO_C, (1<<13), GPIO_OUT_HIGH, NULL},
- {"SPI_FLASH_CS_L", GPIO_D, (1<<0), GPIO_INPUT, NULL},
- {"SPI_FLASH_CLK", GPIO_D, (1<<1), GPIO_INPUT, NULL},
- {"SPI_FLASH_MOSI", GPIO_C, (1<<3), GPIO_INPUT, NULL},
- {"SPI_FLASH_MISO", GPIO_C, (1<<2), GPIO_INPUT, NULL},
- {"EC_JTAG_TMS", GPIO_C, (1<<6), GPIO_INPUT, NULL},
- {"EC_JTAG_TCK", GPIO_C, (1<<7), GPIO_INPUT, NULL},
- {"EC_JTAG_TDO", GPIO_C, (1<<8), GPIO_INPUT, NULL},
- {"EC_JTAG_TDI", GPIO_C, (1<<9), GPIO_INPUT, NULL},
- {"PD_ENTERING_RW", GPIO_B, (1<<5), GPIO_OUT_LOW, NULL},
- {"PD_IN_RW", GPIO_B, (1<<15), GPIO_INPUT, NULL},
- {"PD_DISABLE_DEBUG", GPIO_E, (1<<15), GPIO_OUT_LOW, NULL},
- {"PD_DEBUG_EN", GPIO_D, (1<<4), GPIO_INPUT, NULL},
-
-#if 0
- /* Alternate functions */
- {"EC_UART_TX", GPIO_C, (1<<4), GPIO_OUT_LOW, NULL},
- {"EC_UART_RX", GPIO_C, (1<<5), GPIO_INPUT, NULL},
- {"AP_UART_TX", GPIO_D, (1<<5), GPIO_OUT_LOW, NULL},
- {"AP_UART_RX", GPIO_D, (1<<6), GPIO_INPUT, NULL},
-#endif
-
- /* Unimplemented signals which we need to emulate for now */
- GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
- GPIO_SIGNAL_NOT_IMPLEMENTED("WP_L"),
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Initialize board. */
static void board_init(void)
diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h
index 6fb772faca..76a4da3eed 100644
--- a/board/samus_pd/board.h
+++ b/board/samus_pd/board.h
@@ -46,124 +46,7 @@
#define TIM_CLOCK32 2
#define TIM_ADC 3
-/* GPIO signal list */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_USB_C0_VBUS_WAKE = 0,
- GPIO_USB_C1_VBUS_WAKE,
- GPIO_USB_C0_BC12_INT_L,
- GPIO_USB_C1_BC12_INT_L,
- GPIO_PCH_SLP_S0_L,
- GPIO_PCH_SLP_S3_L,
- GPIO_PCH_SLP_S5_L,
-
- /* PD RX/TX */
- GPIO_USB_C0_CC1_PD,
- GPIO_USB_C0_REF,
- GPIO_USB_C1_CC1_PD,
- GPIO_USB_C1_REF,
- GPIO_USB_C0_CC2_PD,
- GPIO_USB_C1_CC2_PD,
- GPIO_USB_C0_REF_PD_ODL,
- GPIO_USB_C1_REF_PD_ODL,
-
- GPIO_USB_C_CC_EN,
- GPIO_USB_C0_CC1_TX_EN,
- GPIO_USB_C0_CC2_TX_EN,
- GPIO_USB_C1_CC1_TX_EN,
- GPIO_USB_C1_CC2_TX_EN,
- GPIO_USB_C0_CC1_TX_DATA,
- GPIO_USB_C1_CC1_TX_DATA,
- GPIO_USB_C0_CC2_TX_DATA,
- GPIO_USB_C1_CC2_TX_DATA,
-
-#if 0
- /* Alternate functions */
- GPIO_USB_C0_TX_CLKOUT,
- GPIO_USB_C1_TX_CLKOUT,
- GPIO_USB_C0_TX_CLKIN,
- GPIO_USB_C1_TX_CLKIN,
-#endif
-
- /* Power and muxes control */
- GPIO_PPVAR_BOOSTIN_SENSE,
- GPIO_PP3300_USB_PD_EN,
- GPIO_USB_C0_CHARGE_EN_L,
- GPIO_USB_C1_CHARGE_EN_L,
- GPIO_USB_C0_5V_EN,
- GPIO_USB_C1_5V_EN,
- GPIO_USB_C0_VCONN1_EN,
- GPIO_USB_C0_VCONN2_EN,
- GPIO_USB_C1_VCONN1_EN,
- GPIO_USB_C1_VCONN2_EN,
-
- GPIO_USB_C0_CC1_ODL,
- GPIO_USB_C0_CC2_ODL,
- GPIO_USB_C1_CC1_ODL,
- GPIO_USB_C1_CC2_ODL,
-
- GPIO_USB_C_BC12_SEL,
-
- GPIO_USB_C0_SS1_EN_L,
- GPIO_USB_C0_SS2_EN_L,
- GPIO_USB_C1_SS1_EN_L,
- GPIO_USB_C1_SS2_EN_L,
- GPIO_USB_C0_SS1_DP_MODE_L,
- GPIO_USB_C0_SS2_DP_MODE_L,
- GPIO_USB_C1_SS1_DP_MODE_L,
- GPIO_USB_C1_SS2_DP_MODE_L,
- GPIO_USB_C0_DP_MODE_L,
- GPIO_USB_C1_DP_MODE_L,
- GPIO_USB_C0_DP_POLARITY_L,
- GPIO_USB_C1_DP_POLARITY_L,
-
-#if 0
- /* Alternate functions */
- GPIO_USB_DM,
- GPIO_USB_DP,
- GPIO_UART_TX,
- GPIO_UART_RX,
- GPIO_TP64,
- GPIO_TP71,
-#endif
-
- /* I2C busses */
- GPIO_SLAVE_I2C_SCL,
- GPIO_SLAVE_I2C_SDA,
- GPIO_MASTER_I2C_SCL,
- GPIO_MASTER_I2C_SDA,
-
- /* Case closed debugging */
- GPIO_SPI_FLASH_WP_L,
- GPIO_EC_INT_L,
- GPIO_EC_IN_RW,
- GPIO_EC_RST_L,
- GPIO_SPI_FLASH_CS_L,
- GPIO_SPI_FLASH_CSK,
- GPIO_SPI_FLASH_MOSI,
- GPIO_SPI_FLASH_MISO,
- GPIO_EC_JTAG_TMS,
- GPIO_EC_JTAG_TCK,
- GPIO_EC_JTAG_TDO,
- GPIO_EC_JTAT_TDI,
- GPIO_PD_ENTERING_RW,
- GPIO_PD_IN_RW,
- GPIO_PD_DISABLE_DEBUG,
- GPIO_PD_DEBUG_EN,
-#if 0
- /* Alternate functions */
- GPIO_EC_UART_TX,
- GPIO_EC_UART_RX,
- GPIO_AP_UART_TX,
- GPIO_AP_UART_RX,
-#endif
-
- /* Unimplemented signals we emulate */
- GPIO_ENTERING_RW,
- GPIO_WP_L,
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* ADC signal */
enum adc_channel {
diff --git a/board/samus_pd/gpio.inc b/board/samus_pd/gpio.inc
new file mode 100644
index 0000000000..77851bef7d
--- /dev/null
+++ b/board/samus_pd/gpio.inc
@@ -0,0 +1,123 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Interrupts */
+GPIO(USB_C0_VBUS_WAKE, E, 6, GPIO_INT_BOTH, vbus_evt)
+GPIO(USB_C1_VBUS_WAKE, F, 2, GPIO_INT_BOTH, vbus_evt)
+GPIO(USB_C0_BC12_INT_L, B, 0, GPIO_INT_FALLING, bc12_evt)
+GPIO(USB_C1_BC12_INT_L, C, 11, GPIO_INT_FALLING, bc12_evt)
+GPIO(PCH_SLP_S0_L, C, 14, GPIO_INT_BOTH, pch_evt)
+GPIO(PCH_SLP_S3_L, C, 15, GPIO_INT_BOTH, pch_evt)
+GPIO(PCH_SLP_S5_L, D, 7, GPIO_INT_BOTH, pch_evt)
+
+/* PD RX/TX */
+GPIO(USB_C0_CC1_PD, A, 0, GPIO_ANALOG, NULL)
+GPIO(USB_C0_REF, A, 1, GPIO_ANALOG, NULL)
+GPIO(USB_C1_CC1_PD, A, 2, GPIO_ANALOG, NULL)
+GPIO(USB_C1_REF, A, 3, GPIO_ANALOG, NULL)
+GPIO(USB_C0_CC2_PD, A, 4, GPIO_ANALOG, NULL)
+GPIO(USB_C1_CC2_PD, A, 5, GPIO_ANALOG, NULL)
+GPIO(USB_C0_REF_PD_ODL, A, 6, GPIO_ODR_LOW, NULL)
+GPIO(USB_C1_REF_PD_ODL, A, 7, GPIO_ODR_LOW, NULL)
+
+GPIO(USB_C_CC_EN, C, 10, GPIO_OUT_LOW, NULL)
+GPIO(USB_C0_CC1_TX_EN, A, 15, GPIO_OUT_LOW, NULL)
+GPIO(USB_C0_CC2_TX_EN, E, 12, GPIO_OUT_LOW, NULL)
+GPIO(USB_C1_CC1_TX_EN, B, 9, GPIO_OUT_LOW, NULL)
+GPIO(USB_C1_CC2_TX_EN, B, 12, GPIO_OUT_LOW, NULL)
+GPIO(USB_C0_CC1_TX_DATA, B, 4, GPIO_OUT_LOW, NULL)
+GPIO(USB_C1_CC1_TX_DATA, B, 14, GPIO_OUT_LOW, NULL)
+GPIO(USB_C0_CC2_TX_DATA, E, 14, GPIO_OUT_LOW, NULL)
+GPIO(USB_C1_CC2_TX_DATA, D, 3, GPIO_OUT_LOW, NULL)
+
+#if 0
+/* Alternate functions */
+GPIO(USB_C0_TX_CLKOUT, B, 1, GPIO_OUT_LOW, NULL)
+GPIO(USB_C1_TX_CLKOUT, E, 1, GPIO_OUT_LOW, NULL)
+GPIO(USB_C0_TX_CLKIN, B, 3, GPIO_OUT_LOW, NULL)
+GPIO(USB_C1_TX_CLKIN, B, 13, GPIO_OUT_LOW, NULL)
+#endif
+
+/* Power and muxes control */
+GPIO(PPVAR_BOOSTIN_SENSE, C, 1, GPIO_ANALOG, NULL)
+GPIO(PP3300_USB_PD_EN, A, 8, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C0_CHARGE_EN_L, D, 12, GPIO_OUT_LOW, NULL)
+GPIO(USB_C1_CHARGE_EN_L, D, 13, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C0_5V_EN, D, 14, GPIO_OUT_LOW, NULL)
+GPIO(USB_C1_5V_EN, D, 15, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C0_CC1_VCONN1_EN, D, 8, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C0_CC2_VCONN1_EN, D, 9, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C1_CC1_VCONN1_EN, D, 10, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C1_CC2_VCONN1_EN, D, 11, GPIO_OUT_HIGH, NULL)
+
+GPIO(USB_C0_CC1_ODL, B, 8, GPIO_ODR_LOW, NULL)
+GPIO(USB_C0_CC2_ODL, E, 0, GPIO_ODR_LOW, NULL)
+GPIO(USB_C1_CC1_ODL, F, 9, GPIO_ODR_LOW, NULL)
+GPIO(USB_C1_CC2_ODL, F, 10, GPIO_ODR_LOW, NULL)
+
+GPIO(USB_C_BC12_SEL, C, 0, GPIO_OUT_LOW, NULL)
+GPIO(USB_C0_SS1_EN_L, E, 2, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C0_SS2_EN_L, E, 3, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C1_SS1_EN_L, E, 9, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C1_SS2_EN_L, E, 10, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C0_SS1_DP_MODE_L, E, 4, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C0_SS2_DP_MODE_L, E, 5, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C1_SS1_DP_MODE_L, E, 11, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C1_SS2_DP_MODE_L, E, 13, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C0_DP_MODE_L, E, 8, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C1_DP_MODE_L, F, 6, GPIO_OUT_LOW, NULL)
+GPIO(USB_C0_DP_POLARITY_L, E, 7, GPIO_OUT_HIGH, NULL)
+GPIO(USB_C1_DP_POLARITY_L, F, 3, GPIO_OUT_HIGH, NULL)
+
+#if 0
+/* Alternate functions */
+GPIO(USB_DM, A, 11, GPIO_ANALOG, NULL)
+GPIO(USB_DP, A, 12, GPIO_ANALOG, NULL)
+GPIO(UART_TX, A, 9, GPIO_OUT_LOW, NULL)
+GPIO(UART_RX, A, 10, GPIO_OUT_LOW, NULL)
+GPIO(TP64, A, 13, GPIO_ODR_HIGH, NULL)
+GPIO(TP71, A, 14, GPIO_ODR_HIGH, NULL)
+#endif
+
+/*
+ * I2C pins should be configured as inputs until I2C module is
+ * initialized. This will avoid driving the lines unintentionally.
+ */
+GPIO(SLAVE_I2C_SCL, B, 6, GPIO_INPUT, NULL)
+GPIO(SLAVE_I2C_SDA, B, 7, GPIO_INPUT, NULL)
+GPIO(MASTER_I2C_SCL, B, 10, GPIO_INPUT, NULL)
+GPIO(MASTER_I2C_SDA, B, 11, GPIO_INPUT, NULL)
+
+/* Case closed debugging. */
+GPIO(SPI_FLASH_WP_L, D, 2, GPIO_INPUT, NULL)
+GPIO(EC_INT_L, B, 2, GPIO_ODR_HIGH, NULL)
+GPIO(EC_IN_RW, C, 12, GPIO_INPUT, NULL)
+GPIO(EC_RST_L, C, 13, GPIO_OUT_HIGH, NULL)
+GPIO(SPI_FLASH_CS_L, D, 0, GPIO_INPUT, NULL)
+GPIO(SPI_FLASH_CSK, D, 1, GPIO_INPUT, NULL)
+GPIO(SPI_FLASH_MOSI, C, 3, GPIO_INPUT, NULL)
+GPIO(SPI_FLASH_MISO, C, 2, GPIO_INPUT, NULL)
+GPIO(EC_JTAG_TMS, C, 6, GPIO_INPUT, NULL)
+GPIO(EC_JTAG_TCK, C, 7, GPIO_INPUT, NULL)
+GPIO(EC_JTAG_TDO, C, 8, GPIO_INPUT, NULL)
+GPIO(EC_JTAG_TDI, C, 9, GPIO_INPUT, NULL)
+GPIO(PD_ENTERING_RW, B, 5, GPIO_OUT_LOW, NULL)
+GPIO(PD_IN_RW, B, 15, GPIO_INPUT, NULL)
+GPIO(PD_DISABLE_DEBUG, E, 15, GPIO_OUT_LOW, NULL)
+GPIO(PD_DEBUG_EN, D, 4, GPIO_INPUT, NULL)
+
+#if 0
+/* Alternate functions */
+GPIO(EC_UART_TX, C, 4, GPIO_OUT_LOW, NULL)
+GPIO(EC_UART_RX, C, 5, GPIO_INPUT, NULL)
+GPIO(AP_UART_TX, D, 5, GPIO_OUT_LOW, NULL)
+GPIO(AP_UART_RX, D, 6, GPIO_INPUT, NULL)
+#endif
+
+/* Unimplemented signals which we need to emulate for now */
+UNIMPLEMENTED(ENTERING_RW)
+UNIMPLEMENTED(WP_L)
diff --git a/board/snow/board.c b/board/snow/board.c
index 0be82cbaed..058c95feb2 100644
--- a/board/snow/board.c
+++ b/board/snow/board.c
@@ -31,75 +31,7 @@
#define INT_BOTH_FLOATING (GPIO_INPUT | GPIO_INT_BOTH)
#define INT_BOTH_PULL_UP (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"KB_PWR_ON_L", GPIO_B, (1<<5), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP1800_LDO2", GPIO_A, (1<<1), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"CHARGER_INT_L", GPIO_C, (1<<4), GPIO_INT_FALLING, pmu_irq_handler},
- {"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, lid_interrupt},
- {"SUSPEND_L", GPIO_A, (1<<7), INT_BOTH_FLOATING,
- power_signal_interrupt},
- {"WP_L", GPIO_B, (1<<4), GPIO_INPUT, NULL},
- {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- /* Other inputs */
- {"AC_PWRBTN_L", GPIO_A, (1<<0), GPIO_INT_BOTH, NULL},
- {"SPI1_NSS", GPIO_A, (1<<4), GPIO_DEFAULT, spi_event},
- /*
- * I2C pins should be configured as inputs until I2C module is
- * initialized. This will avoid driving the lines unintentionally.
- */
- {"I2C1_SCL", GPIO_B, (1<<6), GPIO_INPUT, NULL},
- {"I2C1_SDA", GPIO_B, (1<<7), GPIO_INPUT, NULL},
- {"I2C2_SCL", GPIO_B, (1<<10), GPIO_INPUT, NULL},
- {"I2C2_SDA", GPIO_B, (1<<11), GPIO_INPUT, NULL},
- /* Outputs */
- {"AC_STATUS", GPIO_A, (1<<5), GPIO_DEFAULT, NULL},
- {"SPI1_MISO", GPIO_A, (1<<6), GPIO_DEFAULT, NULL},
- {"EN_PP1350", GPIO_A, (1<<2), GPIO_OUT_LOW, NULL},
- {"EN_PP5000", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL},
- {"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL},
- {"PMIC_PWRON_L",GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL},
- {"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
- {"ENTERING_RW", GPIO_D, (1<<0), GPIO_OUT_LOW, NULL},
- {"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL},
- {"EC_INT", GPIO_B, (1<<9), GPIO_ODR_HIGH, NULL},
- {"CODEC_INT", GPIO_D, (1<<1), GPIO_ODR_HIGH, NULL},
- {"LED_POWER_L", GPIO_B, (1<<3), GPIO_INPUT, NULL},
- {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT04", GPIO_B, (1<<14), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT05", GPIO_B, (1<<15), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT06", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT07", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT08", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT09", GPIO_B, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT10", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT11", GPIO_C, (1<<6), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT12", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/snow/board.h b/board/snow/board.h
index aadf10f827..499f4d4d11 100644
--- a/board/snow/board.h
+++ b/board/snow/board.h
@@ -55,61 +55,7 @@
#define TIM_POWER_LED 2
#define TIM_WATCHDOG 1
-/* GPIO signal list */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_KB_PWR_ON_L = 0, /* Keyboard power button */
- GPIO_PP1800_LDO2, /* LDO2 is ON (end of PMIC sequence) */
- GPIO_SOC1V8_XPSHOLD, /* App Processor ON */
- GPIO_CHARGER_INT_L,
- GPIO_LID_OPEN, /* LID switch detection */
- GPIO_SUSPEND_L, /* AP suspend/resume state */
- GPIO_WP_L, /* Write protection pin (low active) */
- /* Keyboard inputs */
- GPIO_KB_IN00,
- GPIO_KB_IN01,
- GPIO_KB_IN02,
- GPIO_KB_IN03,
- GPIO_KB_IN04,
- GPIO_KB_IN05,
- GPIO_KB_IN06,
- GPIO_KB_IN07,
- /* Other inputs */
- GPIO_AC_PWRBTN_L,
- GPIO_SPI1_NSS,
- GPIO_I2C1_SCL,
- GPIO_I2C1_SDA,
- GPIO_I2C2_SCL,
- GPIO_I2C2_SDA,
- /* Outputs */
- GPIO_AC_STATUS,
- GPIO_SPI1_MISO,
- GPIO_EN_PP1350, /* DDR 1.35v rail enable */
- GPIO_EN_PP5000, /* 5.0v rail enable */
- GPIO_EN_PP3300, /* 3.3v rail enable */
- GPIO_PMIC_PWRON_L, /* 5v rail ready */
- GPIO_PMIC_RESET, /* Force hard reset of the pmic */
- GPIO_ENTERING_RW, /* EC is R/W mode for the kbc mux */
- GPIO_CHARGER_EN,
- GPIO_EC_INT,
- GPIO_CODEC_INT, /* To audio codec (KB noise cancellation) */
- GPIO_LED_POWER_L, /* Keyboard power LED */
- GPIO_KB_OUT00,
- GPIO_KB_OUT01,
- GPIO_KB_OUT02,
- GPIO_KB_OUT03,
- GPIO_KB_OUT04,
- GPIO_KB_OUT05,
- GPIO_KB_OUT06,
- GPIO_KB_OUT07,
- GPIO_KB_OUT08,
- GPIO_KB_OUT09,
- GPIO_KB_OUT10,
- GPIO_KB_OUT11,
- GPIO_KB_OUT12,
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
enum pwm_channel {
PWM_CH_POWER_LED = 0,
diff --git a/board/snow/gpio.inc b/board/snow/gpio.inc
new file mode 100644
index 0000000000..77210d1ffc
--- /dev/null
+++ b/board/snow/gpio.inc
@@ -0,0 +1,75 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+/* Keyboard power button */
+GPIO(KB_PWR_ON_L, B, 5, GPIO_INT_BOTH, power_signal_interrupt)
+/* LDO2 is ON (end of PMIC sequence) */
+GPIO(PP1800_LDO2, A, 1, GPIO_INT_BOTH, power_signal_interrupt)
+/* App Processor ON */
+GPIO(SOC1V8_XPSHOLD, A, 3, GPIO_INT_BOTH, power_signal_interrupt)
+GPIO(CHARGER_INT_L, C, 4, GPIO_INT_FALLING, pmu_irq_handler)
+/* LID switch detection */
+GPIO(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt)
+/* AP suspend/resume state */
+GPIO(SUSPEND_L, A, 7, INT_BOTH_FLOATING, power_signal_interrupt)
+/* Write protection pin (low active) */
+GPIO(WP_L, B, 4, GPIO_INPUT, NULL)
+
+/* Keyboard inputs */
+GPIO(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+
+/* Other inputs */
+GPIO(AC_PWRBTN_L, A, 0, GPIO_INT_BOTH, NULL)
+GPIO(SPI1_NSS, A, 4, GPIO_DEFAULT, spi_event)
+
+/*
+ * I2C pins should be configured as inputs until I2C module is
+ * initialized. This will avoid driving the lines unintentionally.
+ */
+GPIO(I2C1_SCL, B, 6, GPIO_INPUT, NULL)
+GPIO(I2C1_SDA, B, 7, GPIO_INPUT, NULL)
+GPIO(I2C2_SCL, B, 10, GPIO_INPUT, NULL)
+GPIO(I2C2_SDA, B, 11, GPIO_INPUT, NULL)
+
+/* Outputs */
+GPIO(AC_STATUS, A, 5, GPIO_DEFAULT, NULL)
+GPIO(SPI1_MISO, A, 6, GPIO_DEFAULT, NULL)
+GPIO(EN_PP1350, A, 2, GPIO_OUT_LOW, NULL) /* DDR 1.35v rail enable */
+GPIO(EN_PP5000, A, 11, GPIO_OUT_LOW, NULL) /* 5.0v rail enable */
+GPIO(EN_PP3300, A, 8, GPIO_OUT_LOW, NULL) /* 3.3v rail enable */
+GPIO(PMIC_PWRON_L,A, 12, GPIO_OUT_HIGH, NULL) /* 5v rail ready */
+GPIO(PMIC_RESET, A, 15, GPIO_OUT_LOW, NULL) /* Force hard reset of the pmic */
+
+/* EC is R/W mode for the kbc mux */
+GPIO(ENTERING_RW, D, 0, GPIO_OUT_LOW, NULL)
+GPIO(CHARGER_EN, B, 2, GPIO_OUT_LOW, NULL)
+GPIO(EC_INT, B, 9, GPIO_ODR_HIGH, NULL)
+
+/* To audio codec (KB noise cancellation) */
+GPIO(CODEC_INT, D, 1, GPIO_ODR_HIGH, NULL)
+GPIO(LED_POWER_L, B, 3, GPIO_INPUT, NULL) /* Keyboard power LED */
+GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT11, C, 6, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT12, C, 7, GPIO_KB_OUTPUT, NULL)
diff --git a/board/spring/board.c b/board/spring/board.c
index 066f188019..fc8879694c 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -31,74 +31,7 @@
#define INT_BOTH_FLOATING (GPIO_INPUT | GPIO_INT_BOTH)
#define INT_BOTH_PULL_UP (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"KB_PWR_ON_L", GPIO_B, (1<<5), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP1800_LDO2", GPIO_A, (1<<1), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"CHARGER_INT_L", GPIO_C, (1<<4), GPIO_INT_FALLING, pmu_irq_handler},
- {"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, lid_interrupt},
- {"SUSPEND_L", GPIO_A, (1<<7), INT_BOTH_FLOATING,
- power_signal_interrupt},
- {"WP_L", GPIO_A, (1<<13), GPIO_INPUT, NULL},
- {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT,
- keyboard_raw_gpio_interrupt},
- {"USB_CHG_INT", GPIO_A, (1<<6), GPIO_INT_FALLING, extpower_interrupt},
- /* Other inputs */
- {"BCHGR_VACG", GPIO_A, (1<<0), GPIO_INT_BOTH, NULL},
- /*
- * I2C pins should be configured as inputs until I2C module is
- * initialized. This will avoid driving the lines unintentionally.
- */
- {"I2C1_SCL", GPIO_B, (1<<6), GPIO_INPUT, NULL},
- {"I2C1_SDA", GPIO_B, (1<<7), GPIO_INPUT, NULL},
- {"I2C2_SCL", GPIO_B, (1<<10), GPIO_INPUT, NULL},
- {"I2C2_SDA", GPIO_B, (1<<11), GPIO_INPUT, NULL},
- /* Outputs */
- {"EN_PP1350", GPIO_A, (1<<14), GPIO_OUT_LOW, NULL},
- {"EN_PP5000", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL},
- {"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL},
- {"PMIC_PWRON_L",GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL},
- {"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
- {"ENTERING_RW", GPIO_D, (1<<0), GPIO_OUT_LOW, NULL},
- {"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL},
- {"EC_INT", GPIO_B, (1<<9), GPIO_ODR_HIGH, NULL},
- {"ID_MUX", GPIO_D, (1<<1), GPIO_OUT_LOW, NULL},
- {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT04", GPIO_B, (1<<14), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT05", GPIO_B, (1<<15), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT06", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT07", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT08", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT09", GPIO_B, (1<<1), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT10", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT11", GPIO_C, (1<<6), GPIO_KB_OUTPUT, NULL},
- {"KB_OUT12", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL},
- {"BOOST_EN", GPIO_B, (1<<3), GPIO_OUT_HIGH, NULL},
- {"ILIM", GPIO_B, (1<<4), GPIO_OUT_LOW, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/spring/board.h b/board/spring/board.h
index 5259ebc1ca..ec31fa3107 100644
--- a/board/spring/board.h
+++ b/board/spring/board.h
@@ -73,60 +73,7 @@ enum pwm_channel {
PWM_CH_COUNT
};
-/* GPIO signal list */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_KB_PWR_ON_L = 0, /* Keyboard power button */
- GPIO_PP1800_LDO2, /* LDO2 is ON (end of PMIC sequence) */
- GPIO_SOC1V8_XPSHOLD, /* App Processor ON */
- GPIO_CHARGER_INT_L,
- GPIO_LID_OPEN, /* LID switch detection */
- GPIO_SUSPEND_L, /* AP suspend/resume state */
- GPIO_WP_L, /* Write protection pin (low active) */
- /* Keyboard inputs */
- GPIO_KB_IN00,
- GPIO_KB_IN01,
- GPIO_KB_IN02,
- GPIO_KB_IN03,
- GPIO_KB_IN04,
- GPIO_KB_IN05,
- GPIO_KB_IN06,
- GPIO_KB_IN07,
- GPIO_USB_CHG_INT,
- /* Other inputs */
- GPIO_BCHGR_VACG, /* AC good on TPSChrome */
- GPIO_I2C1_SCL,
- GPIO_I2C1_SDA,
- GPIO_I2C2_SCL,
- GPIO_I2C2_SDA,
- /* Outputs */
- GPIO_EN_PP1350, /* DDR 1.35v rail enable */
- GPIO_EN_PP5000, /* 5.0v rail enable */
- GPIO_EN_PP3300, /* 3.3v rail enable */
- GPIO_PMIC_PWRON_L, /* 5v rail ready */
- GPIO_PMIC_RESET, /* Force hard reset of the pmic */
- GPIO_ENTERING_RW, /* EC is R/W mode for the kbc mux */
- GPIO_CHARGER_EN,
- GPIO_EC_INT,
- GPIO_ID_MUX,
- GPIO_KB_OUT00,
- GPIO_KB_OUT01,
- GPIO_KB_OUT02,
- GPIO_KB_OUT03,
- GPIO_KB_OUT04,
- GPIO_KB_OUT05,
- GPIO_KB_OUT06,
- GPIO_KB_OUT07,
- GPIO_KB_OUT08,
- GPIO_KB_OUT09,
- GPIO_KB_OUT10,
- GPIO_KB_OUT11,
- GPIO_KB_OUT12,
- GPIO_BOOST_EN,
- GPIO_ILIM,
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
#endif /* !__ASSEMBLER__ */
diff --git a/board/spring/gpio.inc b/board/spring/gpio.inc
new file mode 100644
index 0000000000..02478a5674
--- /dev/null
+++ b/board/spring/gpio.inc
@@ -0,0 +1,72 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+/* Keyboard power button */
+GPIO(KB_PWR_ON_L, B, 5, GPIO_INT_BOTH, power_signal_interrupt)
+/* LDO2 is ON (end of PMIC sequence) */
+GPIO(PP1800_LDO2, A, 1, GPIO_INT_BOTH, power_signal_interrupt)
+/* App Processor ON */
+GPIO(SOC1V8_XPSHOLD, A, 3, GPIO_INT_BOTH, power_signal_interrupt)
+GPIO(CHARGER_INT_L, C, 4, GPIO_INT_FALLING, pmu_irq_handler)
+/* LID switch detection */
+GPIO(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt)
+/* AP suspend/resume state */
+GPIO(SUSPEND_L, A, 7, INT_BOTH_FLOATING, power_signal_interrupt)
+/* Write protection pin (low active) */
+GPIO(WP_L, A, 13, GPIO_INPUT, NULL)
+
+/* Keyboard inputs */
+GPIO(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt)
+GPIO(USB_CHG_INT, A, 6, GPIO_INT_FALLING, extpower_interrupt)
+
+/* Other inputs */
+GPIO(BCHGR_VACG, A, 0, GPIO_INT_BOTH, NULL) /* AC good on TPSChrome */
+
+/*
+ * I2C pins should be configured as inputs until I2C module is
+ * initialized. This will avoid driving the lines unintentionally.
+ */
+GPIO(I2C1_SCL, B, 6, GPIO_INPUT, NULL)
+GPIO(I2C1_SDA, B, 7, GPIO_INPUT, NULL)
+GPIO(I2C2_SCL, B, 10, GPIO_INPUT, NULL)
+GPIO(I2C2_SDA, B, 11, GPIO_INPUT, NULL)
+
+/* Outputs */
+GPIO(EN_PP1350, A, 14, GPIO_OUT_LOW, NULL) /* DDR 1.35v rail enable */
+GPIO(EN_PP5000, A, 11, GPIO_OUT_LOW, NULL) /* 5.0v rail enable */
+GPIO(EN_PP3300, A, 8, GPIO_OUT_LOW, NULL) /* 3.3v rail enable */
+GPIO(PMIC_PWRON_L,A, 12, GPIO_OUT_HIGH, NULL) /* 5v rail ready */
+GPIO(PMIC_RESET, A, 15, GPIO_OUT_LOW, NULL) /* Force hard reset of the pmic */
+
+/* EC is R/W mode for the kbc mux */
+GPIO(ENTERING_RW, D, 0, GPIO_OUT_LOW, NULL)
+GPIO(CHARGER_EN, B, 2, GPIO_OUT_LOW, NULL)
+GPIO(EC_INT, B, 9, GPIO_ODR_HIGH, NULL)
+GPIO(ID_MUX, D, 1, GPIO_OUT_LOW, NULL)
+GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT11, C, 6, GPIO_KB_OUTPUT, NULL)
+GPIO(KB_OUT12, C, 7, GPIO_KB_OUTPUT, NULL)
+GPIO(BOOST_EN, B, 3, GPIO_OUT_HIGH, NULL)
+GPIO(ILIM, B, 4, GPIO_OUT_LOW, NULL)
diff --git a/board/squawks/board.c b/board/squawks/board.c
index a99bbe24a1..f199e99d3e 100644
--- a/board/squawks/board.c
+++ b/board/squawks/board.c
@@ -32,87 +32,7 @@
#include "uart.h"
#include "util.h"
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- /* Inputs with interrupt handlers are first for efficiency */
- {"POWER_BUTTON_L", LM4_GPIO_A, (1<<2), GPIO_INT_BOTH_DSLEEP,
- power_button_interrupt},
- {"LID_OPEN", LM4_GPIO_A, (1<<3), GPIO_INT_BOTH_DSLEEP,
- lid_interrupt},
- {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH_DSLEEP,
- extpower_interrupt},
- {"PCH_SLP_S3_L", LM4_GPIO_G, (1<<7), GPIO_INT_BOTH_DSLEEP |
- GPIO_PULL_UP,
- power_signal_interrupt},
- {"PCH_SLP_S4_L", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH_DSLEEP |
- GPIO_PULL_UP,
- power_signal_interrupt},
- {"PP1050_PGOOD", LM4_GPIO_H, (1<<4), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP3300_PCH_PGOOD", LM4_GPIO_C, (1<<4), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"PP5000_PGOOD", LM4_GPIO_N, (1<<0), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"S5_PGOOD", LM4_GPIO_G, (1<<0), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH,
- power_signal_interrupt},
- {"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH,
- switch_interrupt},
- {"JTAG_TCK", LM4_GPIO_C, (1<<0), GPIO_DEFAULT,
- jtag_interrupt},
- {"UART0_RX", LM4_GPIO_A, (1<<0), GPIO_INT_BOTH_DSLEEP |
- GPIO_PULL_UP,
- uart_deepsleep_interrupt},
-
- /* Other inputs */
- {"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL},
- {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL},
- {"BOARD_VERSION3", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL},
-#ifdef CONFIG_CHIPSET_DEBUG
- {"PCH_SLP_SX_L", LM4_GPIO_G, (1<<3), GPIO_INPUT|GPIO_PULL_UP,
- NULL},
- {"PCH_SUS_STAT_L", LM4_GPIO_G, (1<<6), GPIO_INPUT|GPIO_PULL_UP,
- NULL},
- {"PCH_SUSPWRDNACK", LM4_GPIO_G, (1<<2), GPIO_INPUT|GPIO_PULL_UP,
- NULL},
-#endif
- {"PP1000_S0IX_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INPUT, NULL},
- {"USB1_OC_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL},
- {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL},
-
- /* Outputs; all unasserted by default except for reset signals */
- {"CPU_PROCHOT", LM4_GPIO_B, (1<<5), GPIO_OUT_LOW, NULL},
- {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_ODR_HIGH, NULL},
- {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL},
- {"ENTERING_RW", LM4_GPIO_D, (1<<6), GPIO_OUT_LOW, NULL},
- {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL},
- {"PCH_CORE_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL},
- {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_ODR_HIGH, NULL},
- {"PCH_RCIN_L", LM4_GPIO_F, (1<<3), GPIO_ODR_HIGH, NULL},
- {"PCH_RSMRST_L", LM4_GPIO_F, (1<<1), GPIO_OUT_LOW, NULL},
- {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL},
- {"PCH_SOC_OVERRIDE", LM4_GPIO_G, (1<<1), GPIO_OUT_LOW, NULL},
- {"PCH_SYS_PWROK", LM4_GPIO_J, (1<<1), GPIO_OUT_LOW, NULL},
- {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_ODR_HIGH, NULL},
- {"PP1350_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL},
- {"PP3300_DX_EN", LM4_GPIO_J, (1<<2), GPIO_OUT_LOW, NULL},
- {"PP3300_LTE_EN", LM4_GPIO_D, (1<<4), GPIO_OUT_LOW, NULL},
- {"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL},
- {"PP5000_EN", LM4_GPIO_H, (1<<7), GPIO_OUT_LOW, NULL},
- {"PPSX_EN", LM4_GPIO_L, (1<<6), GPIO_OUT_LOW, NULL},
- {"SUSP_VR_EN", LM4_GPIO_C, (1<<7), GPIO_OUT_LOW, NULL},
- {"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_OUT_LOW, NULL},
- {"USB_CTL1", LM4_GPIO_E, (1<<6), GPIO_OUT_LOW, NULL},
- {"USB_ILIM_SEL", LM4_GPIO_E, (1<<5), GPIO_OUT_LOW, NULL},
- {"USB1_ENABLE", LM4_GPIO_E, (1<<4), GPIO_OUT_LOW, NULL},
- {"USB2_ENABLE", LM4_GPIO_D, (1<<5), GPIO_OUT_LOW, NULL},
- {"VCORE_EN", LM4_GPIO_C, (1<<5), GPIO_OUT_LOW, NULL},
- {"WLAN_OFF_L", LM4_GPIO_J, (1<<4), GPIO_OUT_LOW, NULL},
- {"PCH_SCI_L", LM4_GPIO_M, (1<<1), GPIO_ODR_HIGH, NULL},
- {"KBD_IRQ_L", LM4_GPIO_M, (1<<3), GPIO_ODR_HIGH, NULL},
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
diff --git a/board/squawks/board.h b/board/squawks/board.h
index 4a757e793b..935752fdf3 100644
--- a/board/squawks/board.h
+++ b/board/squawks/board.h
@@ -68,71 +68,7 @@
#define WIRELESS_GPIO_WWAN GPIO_PP3300_LTE_EN
#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_WLAN_EN
-/* GPIO signal definitions. */
-enum gpio_signal {
- /* Inputs with interrupt handlers are first for efficiency */
- GPIO_POWER_BUTTON_L = 0, /* Power button */
- GPIO_LID_OPEN, /* Lid switch */
- GPIO_AC_PRESENT, /* AC power present */
- GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */
- GPIO_PCH_SLP_S4_L, /* SLP_S4# signal from PCH */
- GPIO_PP1050_PGOOD, /* Power good on 1.05V */
- GPIO_PP3300_PCH_PGOOD, /* Power good on 3.3V (PCH supply) */
- GPIO_PP5000_PGOOD, /* Power good on 5V */
- GPIO_S5_PGOOD, /* Power good on S5 supplies */
- GPIO_VCORE_PGOOD, /* Power good on core VR */
- GPIO_WP_L, /* Write protect input */
- GPIO_JTAG_TCK, /* JTAG clock input */
- GPIO_UART0_RX, /* UART0 RX input */
-
- /* Other inputs */
- GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */
- GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */
- GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */
-#ifdef CONFIG_CHIPSET_DEBUG
- GPIO_PCH_SLP_SX_L, /* SLP_S0IX# signal from PCH */
- GPIO_PCH_SUS_STAT_L, /* SUS_STAT# signal from PCH */
- GPIO_PCH_SUSPWRDNACK, /* SUSPWRDNACK signal from PCH */
-#endif
- GPIO_PP1000_S0IX_PGOOD, /* Power good on 1.00V (S0iX supplies) */
- GPIO_USB1_OC_L, /* USB port overcurrent warning */
- GPIO_USB2_OC_L, /* USB port overcurrent warning */
-
- /* Outputs */
- GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */
- GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */
- GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */
- GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */
- GPIO_LPC_CLKRUN_L, /* Request that PCH drive LPC clock */
- GPIO_PCH_CORE_PWROK, /* Indicate core well power is stable */
- GPIO_PCH_PWRBTN_L, /* Power button output to PCH */
- GPIO_PCH_RCIN_L, /* Reset line to PCH (for 8042 emulation) */
- GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */
- GPIO_PCH_SMI_L, /* System management interrupt to PCH */
- GPIO_PCH_SOC_OVERRIDE, /* SOC override signal to PCH; when high, ME
- * ignores security descriptor */
- GPIO_PCH_SYS_PWROK, /* EC thinks everything is up and ready */
- GPIO_PCH_WAKE_L, /* Wake signal from EC to PCH */
- GPIO_PP1350_EN, /* Enable 1.35V supply */
- GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */
- GPIO_PP3300_LTE_EN, /* Enable LTE radio */
- GPIO_PP3300_WLAN_EN, /* Enable WiFi power */
- GPIO_PP5000_EN, /* Enable 5V supply */
- GPIO_PPSX_EN, /* Enable PP1350_PCH_SX, PP1000_PCH_SX */
- GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */
- GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */
- GPIO_USB_CTL1, /* USB control signal 1 to both ports */
- GPIO_USB_ILIM_SEL, /* USB current limit to both ports */
- GPIO_USB1_ENABLE, /* USB port 1 output power enable */
- GPIO_USB2_ENABLE, /* USB port 2 output power enable */
- GPIO_VCORE_EN, /* Enable core power supplies */
- GPIO_WLAN_OFF_L, /* Disable WiFi radio */
- GPIO_PCH_SCI_L, /* Assert SCI to PCH */
- GPIO_KBD_IRQ_L, /* Negative edge triggered irq. */
-
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* power signal definitions */
enum power_signal {
diff --git a/board/squawks/gpio.inc b/board/squawks/gpio.inc
new file mode 100644
index 0000000000..51400c7c8e
--- /dev/null
+++ b/board/squawks/gpio.inc
@@ -0,0 +1,116 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Inputs with interrupt handlers are first for efficiency */
+/* Power button */
+GPIO(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH_DSLEEP, power_button_interrupt)
+/* Lid switch */
+GPIO(LID_OPEN, A, 3, GPIO_INT_BOTH_DSLEEP, lid_interrupt)
+/* AC power present */
+GPIO(AC_PRESENT, H, 3, GPIO_INT_BOTH_DSLEEP, extpower_interrupt)
+/* SLP_S3# signal from PCH */
+GPIO(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt)
+/* SLP_S4# signal from PCH */
+GPIO(PCH_SLP_S4_L, H, 1, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt)
+/* Power good on 1.05V */
+GPIO(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 3.3V (PCH supply) */
+GPIO(PP3300_PCH_PGOOD, C, 4, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on 5V */
+GPIO(PP5000_PGOOD, N, 0, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on S5 supplies */
+GPIO(S5_PGOOD, G, 0, GPIO_INT_BOTH, power_signal_interrupt)
+/* Power good on core VR */
+GPIO(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt)
+/* Write protect input */
+GPIO(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt)
+/* JTAG clock input */
+GPIO(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt)
+/* UART0 RX input */
+GPIO(UART0_RX, A, 0, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, uart_deepsleep_interrupt)
+
+/* Other inputs */
+/* Board version stuffing resistor 1 */
+GPIO(BOARD_VERSION1, Q, 5, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 2 */
+GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT, NULL)
+/* Board version stuffing resistor 3 */
+GPIO(BOARD_VERSION3, Q, 7, GPIO_INPUT, NULL)
+#ifdef CONFIG_CHIPSET_DEBUG
+/* SLP_S0IX# signal from PCH */
+GPIO(PCH_SLP_SX_L, G, 3, GPIO_INPUT | GPIO_PULL_UP, NULL)
+/* SUS_STAT# signal from PCH */
+GPIO(PCH_SUS_STAT_L, G, 6, GPIO_INPUT | GPIO_PULL_UP, NULL)
+/* SUSPWRDNACK signal from PCH */
+GPIO(PCH_SUSPWRDNACK, G, 2, GPIO_INPUT | GPIO_PULL_UP, NULL)
+#endif
+/* Power good on 1.00V (S0iX supplies) */
+GPIO(PP1000_S0IX_PGOOD, H, 6, GPIO_INPUT, NULL)
+/* USB port overcurrent warning */
+GPIO(USB1_OC_L, E, 7, GPIO_INPUT, NULL)
+/* USB port overcurrent warning */
+GPIO(USB2_OC_L, E, 0, GPIO_INPUT, NULL)
+
+/* Outputs; all unasserted by default except for reset signals */
+/* Force CPU to think it's overheated */
+GPIO(CPU_PROCHOT, B, 5, GPIO_OUT_LOW, NULL)
+/* Enable backlight power */
+GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_ODR_HIGH, NULL)
+/* Enable touchpad power */
+GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW, NULL)
+/* Indicate when EC is entering RW code */
+GPIO(ENTERING_RW, D, 6, GPIO_OUT_LOW, NULL)
+/* Request that PCH drive LPC clock */
+GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH, NULL)
+/* Indicate core well power is stable */
+GPIO(PCH_CORE_PWROK, F, 5, GPIO_OUT_LOW, NULL)
+/* Power button output to PCH */
+GPIO(PCH_PWRBTN_L, H, 0, GPIO_ODR_HIGH, NULL)
+/* Reset line to PCH (for 8042 emulation) */
+GPIO(PCH_RCIN_L, F, 3, GPIO_ODR_HIGH, NULL)
+/* Reset PCH resume power plane logic */
+GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW, NULL)
+/* System management interrupt to PCH */
+GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH, NULL)
+/* SOC override signal to PCH; when high, ME ignores security descriptor */
+GPIO(PCH_SOC_OVERRIDE, G, 1, GPIO_OUT_LOW, NULL)
+/* EC thinks everything is up and ready */
+GPIO(PCH_SYS_PWROK, J, 1, GPIO_OUT_LOW, NULL)
+/* Wake signal from EC to PCH */
+GPIO(PCH_WAKE_L, F, 0, GPIO_ODR_HIGH, NULL)
+/* Enable 1.35V supply */
+GPIO(PP1350_EN, H, 5, GPIO_OUT_LOW, NULL)
+/* Enable power to lots of peripherals */
+GPIO(PP3300_DX_EN, J, 2, GPIO_OUT_LOW, NULL)
+/* Enable LTE radio */
+GPIO(PP3300_LTE_EN, D, 4, GPIO_OUT_LOW, NULL)
+/* Enable WiFi power */
+GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW, NULL)
+/* Enable 5V supply */
+GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW, NULL)
+/* Enable PP1350_PCH_SX, PP1000_PCH_SX */
+GPIO(PPSX_EN, L, 6, GPIO_OUT_LOW, NULL)
+/* Enable 1.05V regulator */
+GPIO(SUSP_VR_EN, C, 7, GPIO_OUT_LOW, NULL)
+/* Reset touch screen */
+GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_OUT_LOW, NULL)
+/* USB control signal 1 to both ports */
+GPIO(USB_CTL1, E, 6, GPIO_OUT_LOW, NULL)
+/* USB current limit to both ports */
+GPIO(USB_ILIM_SEL, E, 5, GPIO_OUT_LOW, NULL)
+/* USB port 1 output power enable */
+GPIO(USB1_ENABLE, E, 4, GPIO_OUT_LOW, NULL)
+/* USB port 2 output power enable */
+GPIO(USB2_ENABLE, D, 5, GPIO_OUT_LOW, NULL)
+/* Enable core power supplies */
+GPIO(VCORE_EN, C, 5, GPIO_OUT_LOW, NULL)
+/* Disable WiFi radio */
+GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW, NULL)
+/* Assert SCI to PCH */
+GPIO(PCH_SCI_L, M, 1, GPIO_ODR_HIGH, NULL)
+/* Negative edge triggered irq. */
+GPIO(KBD_IRQ_L, M, 3, GPIO_ODR_HIGH, NULL)
diff --git a/board/twinkie/board.c b/board/twinkie/board.c
index 5a5ad855f3..5e8e2773e0 100644
--- a/board/twinkie/board.c
+++ b/board/twinkie/board.c
@@ -26,45 +26,7 @@ void vbus_event(enum gpio_signal signal)
ccprintf("INA!\n");
}
-/* GPIO signal list. Must match order from enum gpio_signal. */
-const struct gpio_info gpio_list[] = {
- {"CC2_ALERT_L", GPIO_A, (1<<7), GPIO_INT_FALLING, cc2_event},
- {"VBUS_ALERT_L", GPIO_B, (1<<2), GPIO_INT_FALLING, vbus_event},
-
- {"CC1_EN", GPIO_A, (1<<0), GPIO_OUT_HIGH, NULL},
- {"CC1_PD", GPIO_A, (1<<1), GPIO_ANALOG, NULL},
- {"CC2_EN", GPIO_A, (1<<2), GPIO_OUT_HIGH, NULL},
- {"CC2_PD", GPIO_A, (1<<3), GPIO_ANALOG, NULL},
- {"DAC", GPIO_A, (1<<4), GPIO_ANALOG, NULL},
- {"CC2_TX_DATA", GPIO_A, (1<<6), GPIO_OUT_LOW, NULL},
-
- {"CC1_RA", GPIO_A, (1<<8), GPIO_ODR_HIGH, NULL},
- {"USB_DM", GPIO_A, (1<<11), GPIO_ANALOG, NULL},
- {"USB_DP", GPIO_A, (1<<12), GPIO_ANALOG, NULL},
- {"CC1_RPUSB", GPIO_A, (1<<13), GPIO_ODR_HIGH, NULL},
- {"CC1_RP1A5", GPIO_A, (1<<14), GPIO_ODR_HIGH, NULL},
- {"CC1_RP3A0", GPIO_A, (1<<15), GPIO_ODR_HIGH, NULL},
- {"CC2_RPUSB", GPIO_B, (1<<0), GPIO_ODR_HIGH, NULL},
-
- {"CC1_TX_EN", GPIO_B, (1<<1), GPIO_OUT_LOW, NULL},
- {"CC2_TX_EN", GPIO_B, (1<<3), GPIO_OUT_LOW, NULL},
- {"CC1_TX_DATA", GPIO_B, (1<<4), GPIO_OUT_LOW, NULL},
- {"CC1_RD", GPIO_B, (1<<5), GPIO_ODR_HIGH, NULL},
- {"I2C_SCL", GPIO_B, (1<<6), GPIO_INPUT, NULL},
- {"I2C_SDA", GPIO_B, (1<<7), GPIO_INPUT, NULL},
- {"CC2_RD", GPIO_B, (1<<8), GPIO_ODR_HIGH, NULL},
- {"LED_G_L", GPIO_B, (1<<11), GPIO_ODR_HIGH, NULL},
- {"LED_R_L", GPIO_B, (1<<13), GPIO_ODR_HIGH, NULL},
- {"LED_B_L", GPIO_B, (1<<14), GPIO_ODR_HIGH, NULL},
- {"CC2_RA", GPIO_B, (1<<15), GPIO_ODR_HIGH, NULL},
- {"CC2_RP1A5", GPIO_C, (1<<14), GPIO_ODR_HIGH, NULL},
- {"CC2_RP3A0", GPIO_C, (1<<15), GPIO_ODR_HIGH, NULL},
-
- /* Unimplemented signals which we need to emulate for now */
- GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
- GPIO_SIGNAL_NOT_IMPLEMENTED("WP_L"),
-};
-BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+#include "gpio_list.h"
/* Initialize board. */
void board_config_pre_init(void)
diff --git a/board/twinkie/board.h b/board/twinkie/board.h
index 5124180df2..69de431b45 100644
--- a/board/twinkie/board.h
+++ b/board/twinkie/board.h
@@ -40,46 +40,7 @@
#define TIM_CLOCK32 2
#define TIM_ADC 3
-/* GPIO signal list */
-enum gpio_signal {
- GPIO_CC2_ALERT_L,
- GPIO_VBUS_ALERT_L,
-
- GPIO_CC1_EN,
- GPIO_CC1_PD,
- GPIO_CC2_EN,
- GPIO_CC2_PD,
- GPIO_DAC,
- GPIO_CC2_TX_DATA,
-
- GPIO_CC1_RA,
- GPIO_USB_DM,
- GPIO_USB_DP,
- GPIO_CC1_RPUSB,
- GPIO_CC1_RP1A5,
- GPIO_CC1_RP3A0,
- GPIO_CC2_RPUSB,
-
- GPIO_CC1_TX_EN,
- GPIO_CC2_TX_EN,
- GPIO_CC1_TX_DATA,
- GPIO_CC1_RD,
- GPIO_I2C_SCL,
- GPIO_I2C_SDA,
- GPIO_CC2_RD,
- GPIO_LED_G_L,
- GPIO_LED_R_L,
- GPIO_LED_B_L,
- GPIO_CC2_RA,
- GPIO_CC2_RP1A5,
- GPIO_CC2_RP3A0,
-
- /* Unimplemented signals we emulate */
- GPIO_ENTERING_RW,
- GPIO_WP_L,
- /* Number of GPIOs; not an actual GPIO */
- GPIO_COUNT
-};
+#include "gpio_signal.h"
/* ADC signal */
enum adc_channel {
diff --git a/board/twinkie/gpio.inc b/board/twinkie/gpio.inc
new file mode 100644
index 0000000000..405d6f3b6b
--- /dev/null
+++ b/board/twinkie/gpio.inc
@@ -0,0 +1,41 @@
+/* -*- mode:c -*-
+ *
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+GPIO(CC2_ALERT_L, A, 7, GPIO_INT_FALLING, cc2_event)
+GPIO(VBUS_ALERT_L, B, 2, GPIO_INT_FALLING, vbus_event)
+
+GPIO(CC1_EN, A, 0, GPIO_OUT_HIGH, NULL)
+GPIO(CC1_PD, A, 1, GPIO_ANALOG, NULL)
+GPIO(CC2_EN, A, 2, GPIO_OUT_HIGH, NULL)
+GPIO(CC2_PD, A, 3, GPIO_ANALOG, NULL)
+GPIO(DAC, A, 4, GPIO_ANALOG, NULL)
+GPIO(CC2_TX_DATA, A, 6, GPIO_OUT_LOW, NULL)
+
+GPIO(CC1_RA, A, 8, GPIO_ODR_HIGH, NULL)
+GPIO(USB_DM, A, 11, GPIO_ANALOG, NULL)
+GPIO(USB_DP, A, 12, GPIO_ANALOG, NULL)
+GPIO(CC1_RPUSB, A, 13, GPIO_ODR_HIGH, NULL)
+GPIO(CC1_RP1A5, A, 14, GPIO_ODR_HIGH, NULL)
+GPIO(CC1_RP3A0, A, 15, GPIO_ODR_HIGH, NULL)
+GPIO(CC2_RPUSB, B, 0, GPIO_ODR_HIGH, NULL)
+
+GPIO(CC1_TX_EN, B, 1, GPIO_OUT_LOW, NULL)
+GPIO(CC2_TX_EN, B, 3, GPIO_OUT_LOW, NULL)
+GPIO(CC1_TX_DATA, B, 4, GPIO_OUT_LOW, NULL)
+GPIO(CC1_RD, B, 5, GPIO_ODR_HIGH, NULL)
+GPIO(I2C_SCL, B, 6, GPIO_INPUT, NULL)
+GPIO(I2C_SDA, B, 7, GPIO_INPUT, NULL)
+GPIO(CC2_RD, B, 8, GPIO_ODR_HIGH, NULL)
+GPIO(LED_G_L, B, 11, GPIO_ODR_HIGH, NULL)
+GPIO(LED_R_L, B, 13, GPIO_ODR_HIGH, NULL)
+GPIO(LED_B_L, B, 14, GPIO_ODR_HIGH, NULL)
+GPIO(CC2_RA, B, 15, GPIO_ODR_HIGH, NULL)
+GPIO(CC2_RP1A5, C, 14, GPIO_ODR_HIGH, NULL)
+GPIO(CC2_RP3A0, C, 15, GPIO_ODR_HIGH, NULL)
+
+/* Unimplemented signals which we need to emulate for now */
+UNIMPLEMENTED(ENTERING_RW)
+UNIMPLEMENTED(WP_L)