Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: ethernet: phy_mii: Return -ENOTSUP for fixed-link config #87238

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

ofirshe
Copy link
Contributor

@ofirshe ofirshe commented Mar 17, 2025

Return -ENOTSUP in phy_mii_cfg_link when a fixed-link configuration is set,
indicating that MDIO read/write operations are not supported.

@decsny
Copy link
Member

decsny commented Mar 17, 2025

shouldn't it return -ENOTSUP ? The API contract for this specifically says to return -ENOTSUP if not supported with the phy, and sounds like a fixed link does not support configuration

@ofirshe
Copy link
Contributor Author

ofirshe commented Mar 17, 2025

@decsny Currently, the fixed-link check is implemented at the PHY driver level rather than in the NXP ENET driver. Given this structure, I don’t see any viable alternative for resolving the issue elsewhere. Moreover, your suggestion to return an error at the PHY level would still prevent the NXP ENET driver from initializing and functioning. Maybe the PHY driver should propagate the fixed-link status to the parent Ethernet driver, preventing it from calling phy_configure_link in such cases. However, this seems like a significant change at the moment.

@decsny
Copy link
Member

decsny commented Mar 17, 2025

@decsny Currently, the fixed-link check is implemented at the PHY driver level rather than in the NXP ENET driver. Given this structure, I don’t see any viable alternative for resolving the issue elsewhere. Moreover, your suggestion to return an error at the PHY level would still prevent the NXP ENET driver from initializing and functioning. Maybe the PHY driver should propagate the fixed-link status to the parent Ethernet driver, preventing it from calling phy_configure_link in such cases. However, this seems like a significant change at the moment.

I mean you're saying you're making this ticket because right now the fixed-link phy_mii returns errors due to trying to call mdio functions , so returning -ENOTSUP would be an improvement and not break anything, right?

If the nxp_enet driver does not handle the case where the phy API returns -ENOTSUP (which is specifically distinct in the API as a potentially expected code), then that should be changed in the ethernet driver, probably by considering it to be unexpected and logging a warning (LOG_WRN) but should not cause the ethernet mac device init to error

@ofirshe
Copy link
Contributor Author

ofirshe commented Mar 17, 2025

@decsny, Okay, I'll split this into two separate PRs as you suggested.

@ofirshe ofirshe force-pushed the phy-mii-cfg-link-fix branch 2 times, most recently from f4f83d9 to 2f44521 Compare March 17, 2025 21:49
@ofirshe ofirshe changed the title drivers: ethernet: phy_mii: Skip MDIO ops for fixed-link config drivers: ethernet: phy_mii: Return -ENOTSUP for fixed-link config Mar 17, 2025
@ofirshe
Copy link
Contributor Author

ofirshe commented Mar 17, 2025

Done.

@ofirshe ofirshe force-pushed the phy-mii-cfg-link-fix branch from 2f44521 to 54299af Compare March 17, 2025 23:04
@ofirshe ofirshe requested a review from decsny March 18, 2025 05:42
@ofirshe ofirshe force-pushed the phy-mii-cfg-link-fix branch from 54299af to 044351e Compare March 18, 2025 09:27
Return -ENOTSUP in phy_mii_cfg_link when a fixed-link configuration is set,
indicating that MDIO read/write operations are not supported.

Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
@ofirshe ofirshe force-pushed the phy-mii-cfg-link-fix branch from 044351e to 42c9486 Compare March 18, 2025 09:51
@nashif nashif merged commit 1be0d07 into zephyrproject-rtos:main Mar 19, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants