summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-06-05 11:19:53 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-06-07 01:33:24 +0000
commit6da31fd404b2f815d189fa0db4a5e88a6a7f152d (patch)
tree7465a73d0dab21c79ee5bc8336bf1f16d1c10c00
parent49cc3902b06b10c03bb139fda864ca9b591f958a (diff)
downloadchrome-ec-6da31fd404b2f815d189fa0db4a5e88a6a7f152d.tar.gz
samus_pd: fix pd tx should output low when not transmitting
fixed pd tx so that it really outputs low when not transmitting. BUG=none BRANCH=none TEST=tested on samus by making sure we can still talk PD to charger and charge. Change-Id: If04eb3d0e6620985906c49df0429a92832cffd8d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/202668 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/samus_pd/usb_pd_config.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/board/samus_pd/usb_pd_config.h b/board/samus_pd/usb_pd_config.h
index d425984357..4381e81791 100644
--- a/board/samus_pd/usb_pd_config.h
+++ b/board/samus_pd/usb_pd_config.h
@@ -59,14 +59,15 @@ static inline void pd_tx_enable(int polarity)
/* Put the TX driver in Hi-Z state */
static inline void pd_tx_disable(int polarity)
{
- /*
- * output low on SPI TX by removing alternate function mode which
- * restores to the initial configuration in board.c
- */
+ /* output low on SPI TX to disable the FET */
if (polarity) /* PE14 is SPI1 MISO */
- gpio_set_alternate_function(GPIO_E, 0x4000, -1);
+ STM32_GPIO_MODER(GPIO_E) = (STM32_GPIO_MODER(GPIO_E)
+ & ~(3 << (2*14)))
+ | (1 << (2*14));
else /* PB4 is SPI1 MISO */
- gpio_set_alternate_function(GPIO_B, 0x0010, -1);
+ STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B)
+ & ~(3 << (2*4)))
+ | (1 << (2*4));
/* put the low level reference in Hi-Z */
gpio_set_level(polarity ? GPIO_USB_C0_CC2_TX_EN :