Skip to content
  • Vladimir Oltean's avatar
    net: phy: fixed: Be compatible with live OF tree · f27bc8af
    Vladimir Oltean authored and Priyanka Jain's avatar Priyanka Jain committed
    On systems that use CONFIG_OF_LIVE, the "ofnode" type is defined
    as const struct device_node *np, while on the flat DT systems it
    is defined as a long of_offset into gd->fdt_blob.
    
    It is desirable that the fixed PHY driver uses the higher-level
    ofnode abstraction instead of parsing gd->fdt_blob directly,
    because that enables it to work on live OF systems.
    
    The fixed PHY driver has used a nasty hack since its introduction in
    commit db40c1aa ("drivers/net/phy: add fixed-phy /
    fixed-link support"),
    which is to pass the long gd->fdt_blob offset inside int phydev->addr
    (a value that normally holds the MDIO bus address at which the PHY
    responds). Even ignoring the fact that the types were already
    mismatched leading to a potential truncation (flat OF offset was
    supposed to be a long and not an int), we really cannot extend this
    hack any longer, because there's no way an int will hold the other
    representation of ofnode, the struct device_node *np.
    
    So we unfort...
    f27bc8af