hal_stm32 icon indicating copy to clipboard operation
hal_stm32 copied to clipboard

Add clause 45 MDIO read/write

Open spectrum70 opened this issue 10 months ago • 5 comments

Hi,

working on adding some stm32 PHY chip drivers into Zephyr, i.e. adin1100, (patch in progress) and MDIO Clause 45 is a "nice to have" feature.

From some checks, h7 family (and h5, or likely f7 too) supports HW Clause 45 implementation (inside ETH IP module). Not clear why it has never been added to stm32cube HAL. This patch adds the c45 support.

spectrum70 avatar Mar 28 '24 12:03 spectrum70

I can eventually add the same for h5 and f, but i can't test on those mcus since i only have a h723 nucleo board actually.

spectrum70 avatar Mar 28 '24 12:03 spectrum70

Below a brief unit test i did

[00:00:00.001,000] <inf> phy_mii: PHY (0) ID 283BC81

[00:00:00.002,000] <inf> phy_mii: PHY (0) 2.4V mode supported
[00:00:00.002,000] <inf> phy_mii: PHY (0) 2.4V mode disabled
[00:00:00.002,000] <inf> phy_mii: PHY (0) Link is up
[00:00:00.002,000] <inf> phy_mii: PHY (0) Link speed 10 Mb, full duplex

*** Booting Zephyr OS build v3.6.0-1839-gfe345be83640 ***
[00:00:00.003,000] <dbg> net_stats_sample: main: C22 MDIO read ...
[00:00:00.003,000] <dbg> net_stats_sample: main: C22 MDIO read -ok-
[00:00:00.003,000] <dbg> net_stats_sample: main: C22 MDIO write ...
[00:00:00.003,000] <dbg> net_stats_sample: main: C22 MDIO write -ok-
[00:00:00.003,000] <dbg> net_stats_sample: main: C45 MDIO read ...
[00:00:00.003,000] <dbg> net_stats_sample: main: C45 MDIO read -ok-
[00:00:00.003,000] <dbg> net_stats_sample: main: C45 MDIO write ...
[00:00:00.003,000] <dbg> net_stats_sample: main: C45 MDIO write -ok-
[00:00:00.003,000] <dbg> net_stats_sample: main: C22 PHY read ...
[00:00:00.003,000] <dbg> net_stats_sample: main: C22 PHY read -ok-
[00:00:00.003,000] <dbg> net_stats_sample: main: C22 PHY write ...
[00:00:00.003,000] <dbg> net_stats_sample: main: C22 PHY write -ok-
[00:00:01.003,000] <dbg> net_stats_sample: main: Getting link state, should be up now ...
[00:00:01.003,000] <dbg> net_stats_sample: main: Link state ... UP
[00:00:01.003,000] <dbg> net_stats_sample: main: Test completed \o/

spectrum70 avatar Mar 28 '24 12:03 spectrum70

@spectrum70 Thanks for this change but we don't merge new features in this fork. However, you can submit them in https://github.com/STMicroelectronics/STM32CubeH7. If approved, we can merge them here.

erwango avatar Apr 02 '24 07:04 erwango

@erwango thanks, i will try. AFAYK, if i cannot have ST to accept such change, can i implement the feature by direct register access in our driver ?

spectrum70 avatar Apr 02 '24 10:04 spectrum70

AFAYK, if i cannot have ST to accept such change, can i implement the feature by direct register access in our driver ?

Well, indeed, if HAL support is not possible, we'll need to find a way to integrate it in Zephyr driver.

erwango avatar Apr 02 '24 11:04 erwango

@spectrum70 Is this PR still active ?

erwango avatar Jul 30 '24 15:07 erwango

@spectrum70 Is this PR still relevant ? (I'm setting DNM until I hear back from you to avoid any mistake)

erwango avatar Sep 02 '24 14:09 erwango