Skip to content

Commit

Permalink
drivers: stm32_gpio: take RIF semaphore only when GPIO/pinctrl are used
Browse files Browse the repository at this point in the history
Release RIF semaphore taken at GPIO bank initialization since they
are to be taken only when the GPIO or pinctrl is used or when a
firewall configuration is requsted.

Signed-off-by: Etienne Carriere <[email protected]>
  • Loading branch information
etienne-lms committed Nov 28, 2024
1 parent 5ebc769 commit 68cc90a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/drivers/stm32_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,7 @@ static TEE_Result apply_sec_cfg(void)
{
TEE_Result res = TEE_ERROR_GENERIC;
struct stm32_gpio_bank *bank = NULL;
unsigned int pin = 0;

STAILQ_FOREACH(bank, &bank_list, link) {
if (bank->ready)
Expand All @@ -1644,6 +1645,17 @@ static TEE_Result apply_sec_cfg(void)
free(bank);
return res;
}

/*
* Semaphores for pinctrl and GPIO are taken when
* these are used (pinctrl state applied, GPIO
* consumed) or when an explicit firewall configuration
* is requested through the firewall framework.
* Therefore release here the taken semaphores.
*/
for (pin = 0; pin < bank->ngpios; pin++)
release_rif_semaphore_if_acquired(bank, pin);

} else {
stm32_gpio_set_conf_sec(bank);
}
Expand Down

0 comments on commit 68cc90a

Please sign in to comment.