summaryrefslogtreecommitdiff
path: root/board/spring
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-08-02 14:28:43 -0700
committerDave Parker <dparker@chromium.org>2013-08-09 23:36:37 -0700
commit1a04e7da1106752ba2244beaf07da910472b46c8 (patch)
treeeda19872a28cbb00673e54a852abfe3adfd73bf6 /board/spring
parenteb9380fad112e793393b11b0d4fa2a78b950b8d7 (diff)
downloadchrome-ec-1a04e7da1106752ba2244beaf07da910472b46c8.tar.gz
CHERRY-PICK: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 Original-Change-Id: I40f47025d8f767e0723c6b40c80413af9ba8deba Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/64400 Conflicts: board/kirby/board.c board/kirby/board.h board/pit/board.c chip/stm32/gpio-stm32f.c Change-Id: I7518eb447b58500e3146fee44cb770567bc15ed3 Reviewed-on: https://gerrit.chromium.org/gerrit/65446 Commit-Queue: Dave Parker <dparker@chromium.org> Reviewed-by: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
Diffstat (limited to 'board/spring')
-rw-r--r--board/spring/board.c9
-rw-r--r--board/spring/board.h7
2 files changed, 16 insertions, 0 deletions
diff --git a/board/spring/board.c b/board/spring/board.c
index 40b6610113..39f5fcbf72 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -95,6 +95,15 @@ const struct gpio_info gpio_list[] = {
};
BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+/* Pins with alternate functions */
+const struct gpio_alt_func gpio_alt_funcs[] = {
+ /*
+ * TODO(rspangler): use this instead of hard-coded register writes in
+ * board_config_pre_init().
+ */
+};
+const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs);
+
/* Battery temperature ranges in degrees C */
const struct battery_temperature_ranges bat_temp_ranges = {
.start_charging_min_c = 5,
diff --git a/board/spring/board.h b/board/spring/board.h
index 2990a316a4..5a2f31c166 100644
--- a/board/spring/board.h
+++ b/board/spring/board.h
@@ -39,6 +39,13 @@
#ifndef __ASSEMBLER__
+/* Module IDs */
+/* TODO(rspangler): use this in place of enum console_channel as well */
+enum module_id {
+ MODULE_I2C,
+ MODULE_UART,
+};
+
/* By default, enable all console messages except keyboard */
#define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_KEYSCAN))