summaryrefslogtreecommitdiff
path: root/chip/lm4/gpio.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-01-26 15:50:15 -0800
committerRandall Spangler <rspangler@chromium.org>2012-01-27 11:18:03 -0800
commit7a5832bcd87c25ed8ed7892b007daae516ff4f32 (patch)
treee8887f8c9dd57eeae7650319754e0cc75559b7c6 /chip/lm4/gpio.c
parent414499778d790c249ebb77dee71704616cc461d9 (diff)
downloadchrome-ec-7a5832bcd87c25ed8ed7892b007daae516ff4f32.tar.gz
Fix setting GPIO outputs and keyboard scanning
Keyboard scanning was not properly configuring GPIOs on link. Among the problems, it was setting GPIO level then direction, when it needs to set direction first. Also fixed this in gpio pre-init. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7761 TEST=1) press keys on keyboard; see keyboard state change on console 2) 'gpioget PCH_PWRBTNn' should report 1 after boot, not 0 Change-Id: I54010aa6eef1de4822574f964de369b459ee6d0f
Diffstat (limited to 'chip/lm4/gpio.c')
-rw-r--r--chip/lm4/gpio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/chip/lm4/gpio.c b/chip/lm4/gpio.c
index 9cc0d30d51..1722105428 100644
--- a/chip/lm4/gpio.c
+++ b/chip/lm4/gpio.c
@@ -93,8 +93,10 @@ int gpio_pre_init(void)
/* Handle GPIO direction */
if (g->flags & GPIO_OUTPUT) {
/* Output with default level */
- gpio_set_level(i, g->flags & GPIO_HIGH);
LM4_GPIO_DIR(g->port) |= g->mask;
+ /* Must set level after direction; writes to GPIO_DATA
+ * before direction is output appear to be ignored. */
+ gpio_set_level(i, g->flags & GPIO_HIGH);
} else {
/* Input */
if (g->flags & GPIO_PULL) {