Skip to content

Commit 6c41368

Browse files
rahul-arasikerefabiobaltieri
authored andcommitted
drivers: ethernet: Update STM32 Ethernet driver to support MDIO if enabled.
Moved the definition of the phy device from depending on stm32hx series SOC to its own #if...#else...#endif. This way mdio support can be enabled on any stm32 soc that supports it by defining the mdio node in the devicetree. I have tested this in a custom board. Signed-off-by: Rahul Arasikere <[email protected]>
1 parent 8b01f83 commit 6c41368

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/ethernet/eth_stm32_hal.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,17 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
5656

5757
#define PHY_ADDR CONFIG_ETH_STM32_HAL_PHY_ADDRESS
5858

59-
#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X)
59+
#if defined(CONFIG_MDIO)
6060

6161
#define DEVICE_PHY_BY_NAME(n) \
6262
DEVICE_DT_GET(DT_CHILD(DT_INST_CHILD(n, mdio), ethernet_phy_0))
6363

6464
static const struct device *eth_stm32_phy_dev = DEVICE_PHY_BY_NAME(0);
6565

66+
#endif
67+
68+
#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X)
69+
6670
#define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */
6771
#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */
6872

0 commit comments

Comments
 (0)