stm32_eth: Busy bit is cleared before accessing the MACMIIAR register.

This commit is contained in:
Fotis Panagiotopoulos 2023-02-16 21:33:01 +02:00 committed by Xiang Xiao
parent de01550e7e
commit f78bdd3978
1 changed files with 17 additions and 5 deletions

View File

@ -2853,14 +2853,20 @@ static int stm32_phyread(uint16_t phydevaddr,
volatile uint32_t timeout;
uint32_t regval;
regval = stm32_getreg(STM32_ETH_MACMIIAR);
/* Clear the busy bit before accessing the MACMIIAR register. */
regval &= ~ETH_MACMIIAR_MB;
stm32_putreg(regval, STM32_ETH_MACMIIAR);
/* Configure the MACMIIAR register,
* preserving CSR Clock Range CR[2:0] bits
*/
regval = stm32_getreg(STM32_ETH_MACMIIAR);
regval &= ETH_MACMIIAR_CR_MASK;
/* Set the PHY device address, PHY register address, and set the buy bit.
/* Set the PHY device address, PHY register address, and set the busy bit.
* the ETH_MACMIIAR_MW is clear, indicating a read operation.
*/
@ -2912,11 +2918,17 @@ static int stm32_phywrite(uint16_t phydevaddr,
volatile uint32_t timeout;
uint32_t regval;
regval = stm32_getreg(STM32_ETH_MACMIIAR);
/* Clear the busy bit before accessing the MACMIIAR register. */
regval &= ~ETH_MACMIIAR_MB;
stm32_putreg(regval, STM32_ETH_MACMIIAR);
/* Configure the MACMIIAR register,
* preserving CSR Clock Range CR[2:0] bits
*/
regval = stm32_getreg(STM32_ETH_MACMIIAR);
regval &= ETH_MACMIIAR_CR_MASK;
/* Set the PHY device address, PHY register address, and set the busy bit.