[U-Boot] [PATCH v4 3/3] cmd: mdio: Add new parameter to access MMD PHY registers

Vladimir Oltean vladimir.oltean at nxp.com
Thu Feb 7 00:10:52 UTC 2019


On 2/6/19 11:35 AM, Carlo Caione wrote:
> On 06/02/2019 03:31, Joe Hershberger wrote:
> 
> /cut
>> Perhaps the default can be to attempt to auto select, but if it is
>> ambiguous, require the explicit specification. It could follow a
>> similar approach to the "md" command.  We can add the ability to add
>> ".22" and ".45" to the mdio command to explicitly select.
> 
> What about we go back to have a generic phy_{r|w}_mmd() and (in this order):
> 
> 1) If the PHY driver is defining a generic {r|w}_mmd() hook we use that.
> 2) We do direct C45 access if (phy_driver->features & PHY_10G_FEATURES)
> 3) We do direct C22 access if (devad == MDIO_DEVAD_NONE)
> 4) We do indirect C22 access to C45 in all the other cases
> 
> Se we can have one single "mdio" command for all the cases.
> 

This approximation sounds like it could actually work. And especially if 
you could make sure that even if the approximation is wrong, it is 
possible to correct it by implementing a driver-level override without 
duplicating too much code, then I think there's no practical issue.
I think I do have a few boards with various C45 PHYs that I can 
volunteer to test your v5 patchset on, and report back if I see any 
glaring problems.

> --
> Carlo Caione
> 

On 2/6/19 5:31 AM, Joe Hershberger wrote:
 > On Tue, Feb 5, 2019 at 7:37 PM Vladimir Oltean wrote:
 >> Just my 2c. Either way, exposing an explicit command for indirect access
 >> means that U-boot commits long-term to not trying to implicitly know
 >> about, and populate, phydev->is_c45.
 >
 > While using either mdio rindirect or mii / mdio.22 read they are
 > effectively explicit commands to select "indirect", so I'm not sure
 > what point you are making here.
 >
 > -Joe
 >

I mean that if U-boot were ever able to imply PHY compatibility with 
clause 45 (aka the API can be made to only expose phy_read_mmd and 
phy_write_mmd), then there shouldn't be a command exposed to the user 
for requesting an MMD access that is explicitly direct or indirect.
What should the PHY driver do if it knows it's C22 but an explicit C45 
MMD access is requested, or the other way around?

Carlo's proposal sounds good and also solves the problem of "mdio read" 
semantics without over-engineering things.

-Vladimir


More information about the U-Boot mailing list