• Doug Berger's avatar
    net: bcmgenet: use RGMII loopback for MAC reset · 3a55402c
    Doug Berger authored
    As noted in commit 28c2d1a7 ("net: bcmgenet: enable loopback
    during UniMAC sw_reset") the UniMAC must be clocked while sw_reset
    is asserted for its state machines to reset cleanly.
    
    The transmit and receive clocks used by the UniMAC are derived from
    the signals used on its PHY interface. The bcmgenet MAC can be
    configured to work with different PHY interfaces including MII,
    GMII, RGMII, and Reverse MII on internal and external interfaces.
    Unfortunately for the UniMAC, when configured for MII the Tx clock
    is always driven from the PHY which places it outside of the direct
    control of the MAC.
    
    The earlier commit enabled a local loopback mode within the UniMAC
    so that the receive clock would be derived from the transmit clock
    which addressed the observed issue with an external GPHY disabling
    it's Rx clock. However, when a Tx clock is not available this
    loopback is insufficient.
    
    This commit implements a workaround that leverages the fact that
    the MAC can reliably generate all of its necessary clocking by
    enterring the external GPHY RGMII interface mode with the UniMAC in
    local loopback during the sw_reset interval. Unfortunately, this
    has the undesirable side efect of the RGMII GTXCLK signal being
    driven during the same window.
    
    In most configurations this is a benign side effect as the signal
    is either not routed to a pin or is already expected to drive the
    pin. The one exception is when an external MII PHY is expected to
    drive the same pin with its TX_CLK output creating output driver
    contention.
    
    This commit exploits the IEEE 802.3 clause 22 standard defined
    isolate mode to force an external MII PHY to present a high
    impedance on its TX_CLK output during the window to prevent any
    contention at the pin.
    
    The MII interface is used internally with the 40nm internal EPHY
    which agressively disables its clocks for power savings leading to
    incomplete resets of the UniMAC and many instabilities observed
    over the years. The workaround of this commit is expected to put
    an end to those problems.
    
    Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
    Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
    Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    3a55402c
bcmgenet.c 98 KB