summaryrefslogtreecommitdiff
path: root/board/pit
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-07-14 15:33:29 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-17 00:39:52 +0000
commit7746b32e17571b0e0cbdcbd101787b742d35c825 (patch)
tree5b4374d93630dda800996687239aac5cec681dc7 /board/pit
parent1e73a1ba06b7879de3b03c7cefec9135bf73fcf5 (diff)
downloadchrome-ec-7746b32e17571b0e0cbdcbd101787b742d35c825.tar.gz
GPIO: Move definition of alternate functions to gpio.inc
This is a straightforward conversion of existing tables into X-Macro style definitions for the GPIO alternate functions. This change in itself, is not particularly powerful, but having all GPIO settings in a single file makes a board easier to understand. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=none TEST=make buildall -j Followed by manual testing of interrupt on change and UART functionality on STM32F0 based discovery board. Change-Id: Ib7f1f014f4bd289d7c0ac3100470ba2dc71ca579 Reviewed-on: https://chromium-review.googlesource.com/207987 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'board/pit')
-rw-r--r--board/pit/board.c8
-rw-r--r--board/pit/gpio.inc4
2 files changed, 4 insertions, 8 deletions
diff --git a/board/pit/board.c b/board/pit/board.c
index 08f5697cfc..7015a96d4f 100644
--- a/board/pit/board.c
+++ b/board/pit/board.c
@@ -26,14 +26,6 @@
#include "gpio_list.h"
-/* Pins with alternate functions */
-const struct gpio_alt_func gpio_alt_funcs[] = {
- {GPIO_A, 0x00f0, GPIO_ALT_SPI, MODULE_SPI},
- {GPIO_A, 0x0600, GPIO_ALT_USART, MODULE_UART},
- {GPIO_B, 0x0cc0, GPIO_ALT_I2C, MODULE_I2C},
-};
-const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs);
-
/* Battery temperature ranges in degrees C */
static const struct battery_info info = {
.start_charging_min_c = 0,
diff --git a/board/pit/gpio.inc b/board/pit/gpio.inc
index 2f64bf01e3..8c00cab0bd 100644
--- a/board/pit/gpio.inc
+++ b/board/pit/gpio.inc
@@ -56,3 +56,7 @@ 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)
+
+ALTERNATE(A, 0x00f0, GPIO_ALT_SPI, MODULE_SPI, 0)
+ALTERNATE(A, 0x0600, GPIO_ALT_USART, MODULE_UART, 0)
+ALTERNATE(B, 0x0cc0, GPIO_ALT_I2C, MODULE_I2C, 0)