From f2b56fcb9fe078d5a29f1c3744e47e77240cd4e7 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Fri, 2 Aug 2013 14:28:43 -0700 Subject: Clean up configuring GPIO alternate functions GPIO alternate functions used to be configured throughout the code, which made it hard to tell which ones you needed to configure yourself in board.c. It also sometimes (chip/lm4/i2c.c) led to GPIOs being configured as alternate functions even if they weren't used on a given board. With this change, every board has a table in board.c which lists ALL GPIOs which have alternate functions. This is now the only place where alternate functions are configured. Each module then calls gpio_init_module() to set up its GPIOs. This also fixes a bug where gpio_set_flags() ignored most of the flags passed to it (only direction and level were actually used). On stm32f, gpio_set_alternate() does not exist, and pins are configured via direct register writes from board.c. Rather than attempt to change that in the same CL, I've stubbed out gpio_set_alternate() for stm32f, and will fix the register writes in a follow-up CL. BUG=chrome-os-partner:21618 BRANCH=peppy (fixes I2C1 being initialized even though those pins are used for other things) TEST=boot link, falco, pit, spring Change-Id: I40f47025d8f767e0723c6b40c80413af9ba8deba Signed-off-by: Randall Spangler Reviewed-on: https://gerrit.chromium.org/gerrit/64400 --- board/puppy/board.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'board/puppy/board.h') diff --git a/board/puppy/board.h b/board/puppy/board.h index 024d3ec6d4..8a17472d8c 100644 --- a/board/puppy/board.h +++ b/board/puppy/board.h @@ -11,7 +11,6 @@ /* Optional features */ #define CONFIG_BATTERY_BQ20Z453 #define CONFIG_BATTERY_SMART -#define CONFIG_BOARD_POST_GPIO_INIT #ifdef HAS_TASK_CHARGER #define CONFIG_CHARGER_TPS65090 #endif @@ -29,6 +28,15 @@ #ifndef __ASSEMBLER__ +/* Module IDs */ +/* TODO(rspangler): use this in place of enum console_channel as well */ +enum module_id { + MODULE_I2C, + MODULE_POWER_LED, + MODULE_SPI, + MODULE_UART, +}; + /* By default, enable all console messages except keyboard */ #define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_KEYSCAN)) -- cgit v1.2.1