Skip to content

Commit 931c9dc

Browse files
FRASTMnashif
authored andcommitted
soc: arm: stm32g4 with USB-C PD cannot use CC1 and CC2 pins by default
With this patch, the UCPD1 _CC1 and _CC2 pins are disabling the USB Type-C and Power Delivery Dead Battery. Signed-off-by: Francois Ramu <[email protected]>
1 parent 222e82a commit 931c9dc

File tree

1 file changed

+10
-0
lines changed
  • soc/arm/st_stm32/stm32g4

1 file changed

+10
-0
lines changed

soc/arm/st_stm32/stm32g4/soc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
#include <arch/cpu.h>
1616
#include <arch/arm/aarch32/cortex_m/cmsis.h>
1717

18+
#if defined(PWR_CR3_UCPD_DBDIS)
19+
#include <stm32_ll_bus.h>
20+
#include <stm32_ll_pwr.h>
21+
#endif /* PWR_CR3_UCPD_DBDIS */
22+
1823
/**
1924
* @brief Perform basic hardware initialization at boot.
2025
*
@@ -45,6 +50,11 @@ static int stm32g4_init(const struct device *arg)
4550
/* allow reflashing board */
4651
LL_DBGMCU_EnableDBGSleepMode();
4752

53+
#if defined(PWR_CR3_UCPD_DBDIS)
54+
/* Disable USB Type-C dead battery pull-down behavior */
55+
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
56+
LL_PWR_DisableUCPDDeadBattery();
57+
#endif /* PWR_CR3_UCPD_DBDIS */
4858
return 0;
4959
}
5060

0 commit comments

Comments
 (0)