stm32 ethernet driver does not handle carrier correctly #84464
Unanswered
morten-lave
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have never filed an official Zephyr bug before so i will start here before actually filing a bug against the repository.
Abstract:
In my example the EMAC is not connected to a PHY but to a captive device over RMII. This device is not producing any traffic until requested. (It is a bridge which will be configured over a Remote Management Interface before actually producing traffic).
The current eth_stm32_hal.c driver talks directly to a PHY instead of using the PHY interface. It assumes that there is a PHY connected with a status register PHY_BSR and a PHY_LINKED_STATUS bit. THat is not the case in my example.
I have defined my device to use a no-phy configuration:
ethernet-phy@0 {
compatible = "ethernet-phy";
reg = <0x00>;
fixed-link = "100BASE-T Full-Duplex";
status = "okay";
};
The result is that initially the driver will not call net_eth_carrier_on. They have implemented a back door so that if any traffic is received they will call net_eth_carrier_on as they assume that if there is traffic the link is up.
In my case there will never be any traffic as i cant send any (AF_PACKET, SOCK_RAW) until the carrier is up and so goes the proverbial chicken and egg situation.
The driver should install a callback into the phy driver as other ethernet drivers do and it should initially poll the phy driver.
There are several ways to fix this:
The first solution would work for but would not solve the general issue of talking to the phy directly.
The second solution would be the correct one but it might result in lack of backwards compatibility in cases where it is assumed that the mac talks directly to a 'plain phy'.
Beta Was this translation helpful? Give feedback.
All reactions