drivers/gpio: stm32: Review code for Port G clock on L4/L5
On L4/L5 device, GPIO port G benefits from a dedicated supply rail that should be enabled independently. Review the code around this: -Compile only when port G is enabled -Assume that PWR clock is ON, as it is enabled as part of clock init Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
2a4ac9ac02
commit
888a24f76d
1 changed files with 3 additions and 9 deletions
|
@ -538,18 +538,12 @@ static int gpio_stm32_init(const struct device *device)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
#ifdef PWR_CR2_IOSV
|
||||
#if defined(PWR_CR2_IOSV) && DT_NODE_HAS_STATUS(DT_NODELABEL(gpiog), okay)
|
||||
if (cfg->port == STM32_PORTG) {
|
||||
/* Port G[15:2] requires external power supply */
|
||||
/* Cf: L4XX RM, §5.1 Power supplies */
|
||||
/* Cf: L4/L5 RM, Chapter "Independent I/O supply rail" */
|
||||
z_stm32_hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY);
|
||||
if (LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_PWR)) {
|
||||
LL_PWR_EnableVddIO2();
|
||||
} else {
|
||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
|
||||
LL_PWR_EnableVddIO2();
|
||||
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_PWR);
|
||||
}
|
||||
LL_PWR_EnableVddIO2();
|
||||
z_stm32_hsem_unlock(CFG_HW_RCC_SEMID);
|
||||
}
|
||||
#endif /* PWR_CR2_IOSV */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue