diff options
-rw-r--r-- | board/fruitpie/board.c | 4 | ||||
-rw-r--r-- | board/fruitpie/board.h | 2 | ||||
-rw-r--r-- | board/fruitpie/usb_pd_config.h | 9 |
3 files changed, 12 insertions, 3 deletions
diff --git a/board/fruitpie/board.c b/board/fruitpie/board.c index c715b86c0e..c0121208de 100644 --- a/board/fruitpie/board.c +++ b/board/fruitpie/board.c @@ -42,9 +42,9 @@ const struct gpio_info gpio_list[] = { {"USB_CC2_PD", GPIO_A, (1<<4), GPIO_ANALOG, NULL}, {"PD_CLK_OUT", GPIO_B, (1<<9), GPIO_OUT_LOW, NULL}, {"PD_TX_EN", GPIO_B, (1<<12), GPIO_OUT_LOW, NULL}, + {"PD_TX_DATA", GPIO_B, (1<<14), GPIO_OUT_LOW, NULL}, #if 0 {"PD_CLK_IN", GPIO_B, (1<<13), GPIO_OUT_LOW, NULL}, - {"PD_TX_DATA", GPIO_B, (1<<14), GPIO_OUT_LOW, NULL}, #endif /* Power and muxes control */ @@ -104,7 +104,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); /* Pins with alternate functions */ const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_B, 0x6000, 0, MODULE_USB_PD},/* SPI2: MISO(PB14) SCK(PB13) */ + {GPIO_B, 0x2000, 0, MODULE_USB_PD},/* SPI2: SCK(PB13) */ {GPIO_B, 0x0200, 2, MODULE_USB_PD},/* TIM17_CH1: PB9) */ {GPIO_A, 0xC000, 1, MODULE_UART}, /* USART2: PA14/PA15 */ {GPIO_B, 0x0cc0, 1, MODULE_I2C}, /* I2C SLAVE:PB6/7 MASTER:PB10/11 */ diff --git a/board/fruitpie/board.h b/board/fruitpie/board.h index 8ab7345c56..9b5692f5f4 100644 --- a/board/fruitpie/board.h +++ b/board/fruitpie/board.h @@ -69,9 +69,9 @@ enum gpio_signal { GPIO_USB_CC2_PD, GPIO_PD_CLK_OUT, GPIO_PD_TX_EN, + GPIO_PD_TX_DATA, #if 0 GPIO_PD_CLK_IN, - GPIO_PD_TX_DATA, #endif /* Power and muxes control */ diff --git a/board/fruitpie/usb_pd_config.h b/board/fruitpie/usb_pd_config.h index 75d3b112c3..efd702a284 100644 --- a/board/fruitpie/usb_pd_config.h +++ b/board/fruitpie/usb_pd_config.h @@ -47,11 +47,20 @@ static inline void pd_set_pins_speed(void) static inline void pd_tx_enable(int polarity) { gpio_set_level(GPIO_PD_TX_EN, 1); + /* TX_DATA on PB14 is now connected to SPI2 */ + gpio_set_alternate_function(GPIO_B, 0x4000, 0); } /* Put the TX driver in Hi-Z state */ static inline void pd_tx_disable(int polarity) { + /* TX_DATA on PB14 is an output low GPIO to disable the FET */ + STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B) & ~(3 << (2*14))) + | (1 << (2*14)); + /* + * Tri-state the low side after the high side + * to ensure we are not going above Vnc + */ gpio_set_level(GPIO_PD_TX_EN, 0); } |