summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-04-12 15:07:58 -0700
committerChromeBot <chrome-bot@google.com>2013-04-15 14:27:45 -0700
commit108235225d2536f75a3100cd535f44f732b486c3 (patch)
tree3f111879d86eddbc6979af513ed466dc20faf13d /board
parent27459f8600d76d5a7ccc4cc1c396ef59cb26ff19 (diff)
downloadchrome-ec-108235225d2536f75a3100cd535f44f732b486c3.tar.gz
Refactor gpio_set_level() and gpio_pre_init()
gpio_set_level() now allows setting the pin level if GPIO_LOW or GPIO_HIGH is specified. Previously, stm32 platforms did this even though the definition of gpio_set_level() said it wouldn't work. Fixed gpio_set_level() not setting level after warm reboot on stm32 because it was checking the GPIO_DEFAULT flag in the wrong place. Fixed LM4 still mucking with alternate function settings and levels even if GPIO_DEFAULT was specified. And checked gpio_list[] and all of the calls to gpio_set_flags() to make sure everything still behaves the same way it did before (or better, in the case of actual bugs). BUG=chrome-os-partner:18718 BRANCH=none TEST=build all platforms; boot spring and link Change-Id: I4b84815f76060252df235ff9a37da52c54a8eac5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48058 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/mccroskey/board.c9
-rw-r--r--board/pit/board.c2
-rw-r--r--board/snow/board.c2
-rw-r--r--board/spring/board.c6
4 files changed, 9 insertions, 10 deletions
diff --git a/board/mccroskey/board.c b/board/mccroskey/board.c
index fbfac0fb7a..0f56b2ebae 100644
--- a/board/mccroskey/board.c
+++ b/board/mccroskey/board.c
@@ -17,9 +17,8 @@
#include "timer.h"
#include "util.h"
-#define GPIO_OUTPUT_OD (GPIO_OUTPUT | GPIO_OPEN_DRAIN)
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
-#define GPIO_KB_OUTPUT GPIO_OUTPUT_OD
+#define GPIO_KB_OUTPUT (GPIO_OUTPUT | GPIO_OPEN_DRAIN | GPIO_OUT_LOW)
#define HARD_RESET_TIMEOUT_MS 5
@@ -47,7 +46,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"KBD_PWR_BUTTON", GPIO_B, (1<<2), GPIO_INPUT, kbd_power_on},
{"OMZO_RDY_L", GPIO_A, (1<<0), GPIO_INPUT, NULL}, /* PA0_WKUP */
- {"OZMO_RST_L", GPIO_A, (1<<2), GPIO_OUTPUT_OD, NULL},
+ {"OZMO_RST_L", GPIO_A, (1<<2), GPIO_HI_Z, 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},
@@ -74,8 +73,8 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"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_OUTPUT, NULL},
- {"HUB_RESET", GPIO_C, (1<<14), GPIO_OUTPUT_OD, NULL},
+ {"USB_VBUS_CTRL", GPIO_C, (1<<13), GPIO_OUT_LOW, NULL},
+ {"HUB_RESET", GPIO_C, (1<<14), GPIO_HI_Z, NULL},
{"WP_L", GPIO_D, (1<<2), GPIO_INPUT, NULL},
/* FIXME: make this alt. function */
diff --git a/board/pit/board.c b/board/pit/board.c
index 0ee1ac8bc7..cccd61c6f0 100644
--- a/board/pit/board.c
+++ b/board/pit/board.c
@@ -16,7 +16,7 @@
#include "util.h"
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
-#define GPIO_KB_OUTPUT (GPIO_OUTPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN)
+#define GPIO_KB_OUTPUT GPIO_HI_Z
/* GPIO signal list. Must match order from enum gpio_signal. */
const struct gpio_info gpio_list[GPIO_COUNT] = {
diff --git a/board/snow/board.c b/board/snow/board.c
index aaca03f7fd..4df97cd617 100644
--- a/board/snow/board.c
+++ b/board/snow/board.c
@@ -22,7 +22,7 @@
#include "util.h"
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
-#define GPIO_KB_OUTPUT (GPIO_OUTPUT | GPIO_OPEN_DRAIN)
+#define GPIO_KB_OUTPUT GPIO_HI_Z
#define INT_BOTH_FLOATING (GPIO_INPUT | GPIO_INT_BOTH)
#define INT_BOTH_PULL_UP (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
diff --git a/board/spring/board.c b/board/spring/board.c
index 4a10237cd3..9326e2e92e 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -23,7 +23,7 @@
#include "util.h"
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
-#define GPIO_KB_OUTPUT (GPIO_OUTPUT | GPIO_OPEN_DRAIN)
+#define GPIO_KB_OUTPUT GPIO_HI_Z
#define INT_BOTH_FLOATING (GPIO_INPUT | GPIO_INT_BOTH)
#define INT_BOTH_PULL_UP (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
@@ -56,7 +56,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
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},
+ {"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.
@@ -67,7 +67,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"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_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},