diff --git a/drivers/gpio/gpio_stm32.c b/drivers/gpio/gpio_stm32.c index 8c1cd8d2ee7..e5d9810bb2a 100644 --- a/drivers/gpio/gpio_stm32.c +++ b/drivers/gpio/gpio_stm32.c @@ -267,6 +267,11 @@ static int gpio_stm32_config(struct device *dev, int access_op, return -ENOTSUP; } +#if defined(CONFIG_STM32H7_DUAL_CORE) + while (LL_HSEM_1StepLock(HSEM, LL_HSEM_ID_1)) { + } +#endif /* CONFIG_STM32H7_DUAL_CORE */ + /* figure out if we can map the requested GPIO * configuration */ @@ -312,6 +317,10 @@ static int gpio_stm32_config(struct device *dev, int access_op, } +#if defined(CONFIG_STM32H7_DUAL_CORE) + LL_HSEM_ReleaseLock(HSEM, LL_HSEM_ID_1, HSEM_CR_COREID_CURRENT); +#endif /* CONFIG_STM32H7_DUAL_CORE */ + return 0; } diff --git a/soc/arm/st_stm32/stm32h7/soc.h b/soc/arm/st_stm32/stm32h7/soc.h index 505c6d1c088..e8407df0f3b 100644 --- a/soc/arm/st_stm32/stm32h7/soc.h +++ b/soc/arm/st_stm32/stm32h7/soc.h @@ -21,6 +21,8 @@ #define LL_HSEM_ID_0 (0U) /* HW semaphore 0 */ #define LL_HSEM_MASK_0 (1 << LL_HSEM_ID_0) +#define LL_HSEM_ID_1 (1U) /* HW semaphore 1 */ +#define LL_HSEM_MASK_1 (1 << LL_HSEM_ID_1) #include