diff options
author | Louis Yung-Chieh Lo <yjlou@chromium.org> | 2013-12-26 11:38:01 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-01-03 23:04:23 +0000 |
commit | 3f00af41c41d35fec50090a48796db5c24d0a6d3 (patch) | |
tree | c9da15d14260d6d1ad2af575426debf014782f2d /common/gpio.c | |
parent | 5e50259c2252ac7b2f65e7cd75bf219f6c4293bf (diff) | |
download | chrome-ec-3f00af41c41d35fec50090a48796db5c24d0a6d3.tar.gz |
nyan: don't touch GPIO setting while init alternate functions.
Old code reset some GPIO configurations with af->flags = 0 while
gpio_config_module(). This is bad because it could lead unexpected
behavior on the bus.
New code accepts GPIO_DEFAULT flag so that it doesn't touch the
GPIO setting while configuring alternate functions. This should not
effect other boards unless the GPIO_DEFAULT is set on that board.
BUG=chrome-os-partner:24607
BRANCH=nyan
TEST=run on nyan rev 3.12. No "SPI rx bad data" at boot. UART and i2c good.
Change-Id: Id451cfae21e1d764452429dc5adfe1317ff5b140
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181135
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/gpio.c')
-rw-r--r-- | common/gpio.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/gpio.c b/common/gpio.c index 43abdad0d4..13775ea449 100644 --- a/common/gpio.c +++ b/common/gpio.c @@ -73,11 +73,15 @@ void gpio_config_module(enum module_id id, int enable) continue; /* Pins for some other module */ if (enable) { - gpio_set_flags_by_mask(af->port, af->mask, af->flags); + if (!(af->flags & GPIO_DEFAULT)) + gpio_set_flags_by_mask(af->port, + af->mask, af->flags); gpio_set_alternate_function(af->port, af->mask, af->func); } else { - gpio_set_flags_by_mask(af->port, af->mask, GPIO_INPUT); + if (!(af->flags & GPIO_DEFAULT)) + gpio_set_flags_by_mask(af->port, + af->mask, GPIO_INPUT); gpio_set_alternate_function(af->port, af->mask, -1); } } |