This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/12.3
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/releases/12.3 by this push:
     new 473f8b271f stm32_eth: Fix excessively long critical section in ifdown 
handler
473f8b271f is described below

commit 473f8b271f1693402e3caa10b956b6c549f058f7
Author: Petteri Aimonen <j...@git.mail.kapsi.fi>
AuthorDate: Tue Sep 26 13:48:58 2023 +0300

    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.
---
 arch/arm/src/stm32/stm32_eth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c
index ae75009d79..ff4bc8ecb7 100644
--- a/arch/arm/src/stm32/stm32_eth.c
+++ b/arch/arm/src/stm32/stm32_eth.c
@@ -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)

Reply via email to