summaryrefslogtreecommitdiff
path: root/chip/stm32/gpio-f0-l.c
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-11-20 14:13:51 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-21 02:45:06 +0000
commit1c86fa9f6dff9eaff5be29de434252daa063d4eb (patch)
tree1546dc257ba9a3aa54335f1471e354395bd530a6 /chip/stm32/gpio-f0-l.c
parent911e21ccc12617c36caa1bb0a5c35ee7902f38c4 (diff)
downloadchrome-ec-1c86fa9f6dff9eaff5be29de434252daa063d4eb.tar.gz
stm32f0: fix setting GPIO in push-pull mode
When using gpio_set_flags_by_mask() to modify a GPIO pin setting, the former code was not able to revert an open-drain GPIO into push-pull mode (the other way round was working). Fix it to be able to transition in each direction. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=all BUG=none TEST=on Twinkie, run "tw res none RP3A0" then "adc" and see the RP3A0 GPIO set to 1 and pulling the CC to 3.3V. Change-Id: Ic2d8ed95ea21b21d261a12ba298931d8bd5e6919 Reviewed-on: https://chromium-review.googlesource.com/231150 Reviewed-by: Vic Yang <victoryang@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'chip/stm32/gpio-f0-l.c')
-rw-r--r--chip/stm32/gpio-f0-l.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/chip/stm32/gpio-f0-l.c b/chip/stm32/gpio-f0-l.c
index d3369d9d89..826cb7c591 100644
--- a/chip/stm32/gpio-f0-l.c
+++ b/chip/stm32/gpio-f0-l.c
@@ -44,6 +44,8 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags)
*/
if (flags & GPIO_OPEN_DRAIN)
STM32_GPIO_OTYPER(port) |= mask;
+ else
+ STM32_GPIO_OTYPER(port) &= ~mask;
val = STM32_GPIO_MODER(port) & ~mask2;
if (flags & GPIO_OUTPUT) {