stm32_eth: Fix excessively long critical section in ifdown handler

stm32_ifdown() holds critical section when calling stm32_ethreset().
That function used to call up_mdelay(10) while waiting for the ethernet
peripheral reset to complete. This resulted in excessively long
critical section time with interrupts disabled.

The actual expected delay is a few clock ticks of the 50 MHz clock domain.
This commit changes polling interval to 1us and maximum to 10us.
This commit is contained in:
Petteri Aimonen 2023-09-26 13:48:58 +03:00 committed by Xiang Xiao
parent e09aa5b7f9
commit d68c8ec560
1 changed files with 2 additions and 1 deletions

View File

@ -3542,6 +3542,7 @@ static int stm32_ethreset(struct stm32_ethmac_s *priv)
/* Wait for software reset to complete. The SR bit is cleared automatically
* after the reset operation has completed in all core clock domains.
* Should take at most a few clock ticks of the 50 MHz domain.
*/
retries = 10;
@ -3549,7 +3550,7 @@ static int stm32_ethreset(struct stm32_ethmac_s *priv)
retries > 0)
{
retries--;
up_mdelay(10);
up_udelay(1);
}
if (retries == 0)