• Florian Fainelli's avatar
    net: phy: re-apply PHY fixups during phy_register_device · d92f5dec
    Florian Fainelli authored
    Commit 87aa9f9c ("net: phy: consolidate PHY reset in phy_init_hw()")
    moved the call to phy_scan_fixups() in phy_init_hw() after a software
    reset is performed.
    
    By the time phy_init_hw() is called in phy_device_register(), no driver
    has been bound to this PHY yet, so all the checks in phy_init_hw()
    against the PHY driver and the PHY driver's config_init function will
    return 0. We will therefore never call phy_scan_fixups() as we should.
    
    Fix this by calling phy_scan_fixups() and check for its return value to
    restore the intended functionality.
    
    This broke PHY drivers which do register an early PHY fixup callback to
    intercept the PHY probing and do things like changing the 32-bits unique
    PHY identifier when a pseudo-PHY address has been used, as well as
    board-specific PHY fixups that need to be applied during driver probe
    time.
    Reported-by: default avatarHauke Merthens <hauke-m@hauke-m.de>
    Reported-by: default avatarJonas Gorski <jogo@openwrt.org>
    Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d92f5dec
phy_device.c 34 KB