drivers/gpio: stm32: Add semaphore on gpio_configure
Protect gpio_configure function in dual core context. This operation is not needed for other fuctions of the api: * init * read * write Protecting gpio_configure also protects access to interrupt_controller IP. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
edd2b44a0f
commit
0914f1031d
2 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 <stm32h7xx_ll_hsem.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue