On Wed, Dec 12, 2018 at 09:35:27AM -0500, rpj...@crashcourse.ca wrote: > (totally willing to embarrass myself further, this time with respect to > inconsistency in basic terminology in the kernel files.) > > from include/linux/mod_devicetable.h: > > /** > * struct mdio_device_id - identifies PHY devices on an MDIO/MII bus > * @phy_id: The result of > * (mdio_read(&MII_PHYSID1) << 16 | mdio_read(&PHYSID2)) & @phy_id_mask > * for this PHY type > * @phy_id_mask: Defines the significant bits of @phy_id. A value of 0 > * is used to terminate an array of struct mdio_device_id. > */ > struct mdio_device_id { > __u32 phy_id; > __u32 phy_id_mask; > }; > > stop right there ... ignoring the obvious typo in "&PHYSID2" (should > of course be "&MII_PHYSID2"),
Yes, patch welcome. the definition of "phy_id" is puzzling, as > it's defined as the full 32-bit value with the mask applied to it. > is that right? is the technical definition of phy_id the value *after* > the phy_id_mask is applied to the register contents? because that > certainly seems inconsistent with most explanations i've seen. What might be the source of this confusion is that the lower nibble mostly means the PHY silicon revision. So: #define PHY_ID_ASIX_AX88796B 0x003b1841 This is the second revision of the silicon, but the mask .phy_id_mask = 0xfffffff0, indicates this driver is happy to work with any revision of the silicon. The driver writer probably had the second revision of the silicon, which is why they set the #define to that value. But some vendors don't use the lower nibble as silicon revision, e.g. ACME Corp. Andrew