drivers: ethernet: Update Ethernet PHY mode and speed configuration
- Added macros `STM32_ETH_PHY_MODE` to determine the PHY mode and speed from the `phy_connection_type` property in the device tree. - Updated the `eth0_data` structure to use `STM32_ETH_PHY_MODE` for setting the media interface. Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
This commit is contained in:
parent
4283a3f79e
commit
c8672fa649
1 changed files with 11 additions and 2 deletions
|
@ -88,6 +88,12 @@ static const struct device *eth_stm32_phy_dev = DEVICE_PHY_BY_NAME(0);
|
||||||
|
|
||||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */
|
#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */
|
||||||
|
|
||||||
|
#define MAC_NODE DT_NODELABEL(mac)
|
||||||
|
|
||||||
|
#define STM32_ETH_PHY_MODE(node_id) \
|
||||||
|
(DT_ENUM_HAS_VALUE(node_id, phy_connection_type, mii) ? \
|
||||||
|
ETH_MEDIA_INTERFACE_MII : ETH_MEDIA_INTERFACE_RMII)
|
||||||
|
|
||||||
#define ETH_DMA_TX_TIMEOUT_MS 20U /* transmit timeout in milliseconds */
|
#define ETH_DMA_TX_TIMEOUT_MS 20U /* transmit timeout in milliseconds */
|
||||||
|
|
||||||
#if defined(CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER) && \
|
#if defined(CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER) && \
|
||||||
|
@ -1322,6 +1328,10 @@ static const struct eth_stm32_hal_dev_cfg eth0_config = {
|
||||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0),
|
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BUILD_ASSERT(DT_ENUM_HAS_VALUE(MAC_NODE, phy_connection_type, mii) ||
|
||||||
|
DT_ENUM_HAS_VALUE(MAC_NODE, phy_connection_type, rmii),
|
||||||
|
"Unsupported PHY connection type selected");
|
||||||
|
|
||||||
static struct eth_stm32_hal_dev_data eth0_data = {
|
static struct eth_stm32_hal_dev_data eth0_data = {
|
||||||
.heth = {
|
.heth = {
|
||||||
.Instance = (ETH_TypeDef *)DT_INST_REG_ADDR(0),
|
.Instance = (ETH_TypeDef *)DT_INST_REG_ADDR(0),
|
||||||
|
@ -1341,8 +1351,7 @@ static struct eth_stm32_hal_dev_data eth0_data = {
|
||||||
.ChecksumMode = IS_ENABLED(CONFIG_ETH_STM32_HW_CHECKSUM) ?
|
.ChecksumMode = IS_ENABLED(CONFIG_ETH_STM32_HW_CHECKSUM) ?
|
||||||
ETH_CHECKSUM_BY_HARDWARE : ETH_CHECKSUM_BY_SOFTWARE,
|
ETH_CHECKSUM_BY_HARDWARE : ETH_CHECKSUM_BY_SOFTWARE,
|
||||||
#endif /* !CONFIG_SOC_SERIES_STM32H7X */
|
#endif /* !CONFIG_SOC_SERIES_STM32H7X */
|
||||||
.MediaInterface = IS_ENABLED(CONFIG_ETH_STM32_HAL_MII) ?
|
.MediaInterface = STM32_ETH_PHY_MODE(MAC_NODE),
|
||||||
ETH_MEDIA_INTERFACE_MII : ETH_MEDIA_INTERFACE_RMII,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue