From 7746b32e17571b0e0cbdcbd101787b742d35c825 Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Mon, 14 Jul 2014 15:33:29 -0700 Subject: 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 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 Tested-by: Anton Staaf Commit-Queue: Anton Staaf --- board/bds/board.c | 9 --------- board/bds/gpio.inc | 5 +++++ 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'board/bds') diff --git a/board/bds/board.c b/board/bds/board.c index 8f2142df09..e1ff649a6f 100644 --- a/board/bds/board.c +++ b/board/bds/board.c @@ -39,12 +39,3 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); #include "gpio_list.h" - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_A, 0x03, 1, MODULE_UART}, /* UART0 */ - {GPIO_G, 0x40, 3, MODULE_I2C}, /* I2C5 SCL */ - {GPIO_G, 0x80, 3, GPIO_OPEN_DRAIN}, /* I2C5 SDA */ - {GPIO_B, 0x03, 1, MODULE_UART}, /* UART1 */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); diff --git a/board/bds/gpio.inc b/board/bds/gpio.inc index f22d0d0d7a..06f290e53c 100644 --- a/board/bds/gpio.inc +++ b/board/bds/gpio.inc @@ -15,3 +15,8 @@ GPIO(DEBUG_LED, A, 7, GPIO_OUT_LOW, NULL) */ UNIMPLEMENTED(WP) /* Write protect input */ UNIMPLEMENTED(ENTERING_RW) /* EC entering RW code */ + +ALTERNATE(A, 0x03, 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(G, 0x40, 3, MODULE_I2C, 0) /* I2C5 SCL */ +ALTERNATE(G, 0x80, 3, GPIO_OPEN_DRAIN, 0) /* I2C5 SDA */ +ALTERNATE(B, 0x03, 1, MODULE_UART, 0) /* UART1 */ -- cgit v1.2.1