Configuring KSZ8081 PHY drivers at run time #93112
Unanswered
DCoffey-CLN
asked this question in
Q&A
Replies: 1 comment
-
Hi @DCoffey-CLN , |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have a custom board with an NXP IMXRT1176 mcu and a Microchip KSZ8081RNB ethernet phy. This board has been through a revision: in the first revision the reference clock for the phy was a 50MHz clock generated by the microcontroller, and in the later revision an external 25MHz crystal is used instead. A group of pullup/pulldown resistors connected to gpio pins allow for the checking of the board revision at run time. The goal is to have a single firmware image which supports both revisions, but there is some complication involved in making this work with the KSZ8081 phy driver included in zephyr.
When the phy is initialized, the driver resets it via the reset pin on the phy, before writing settings based on the device tree node for the phy to the registers using the MDIO interface. Specifically, the PHY Control 2 register "RMII reference clock select" bit is written based on whether the phy is configured to use RMII mode. In my use case it would be necessary to write or clear this bit based on whether the board is using a 25MHz or 50MHz clock.
I already have a sys init call to check the board rev and generate the 50MHz clock from the mcu if it is needed. The problem with setting the phy bit here is that the phy will subsequently be reset by its own driver. The issue with changing the bit after the phy setup (the method that we were using for this board in zephyr 3.6 using the eth_mcux driver from NXP) is that the KSZ8081 driver takes a long time to time out on autonegotiation failure (which it inevitably will when the clock is incorrect).
Is there an elegant solution to handle this setup which doesn't involve modifying the phy drivers for just this specific board?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions