• Doug Berger's avatar
    net: bcmgenet: enable loopback during UniMAC sw_reset · 28c2d1a7
    Doug Berger authored
    It is necessary for the UniMAC to be clocked at least 5 cycles
    while the sw_reset is asserted to ensure a clean reset.
    
    It was discovered that this condition was not being met when
    connected to an external RGMII PHY that disabled the Rx clock in
    the Power Save state.
    
    This commit modifies the reset_umac function to place the (RG)MII
    interface into a local loopback mode where the Rx clock comes
    from the GENET sourced Tx clk during the sw_reset to ensure the
    presence and stability of the clock.
    
    In addition, it turns out that the sw_reset of the UniMAC is not
    self clearing, but this was masked by a bug in the timeout code.
    
    The sw_reset is now explicitly cleared by zeroing the UMAC_CMD
    register before returning from reset_umac which makes it no
    longer necessary to do so in init_umac and makes the clearing of
    CMD_TX_EN and CMD_RX_EN by umac_enable_set redundant. The
    timeout code (and its associated bug) are removed so reset_umac
    no longer needs to return a result, and that means init_umac
    that calls reset_umac does not need to as well.
    
    Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
    Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    28c2d1a7
bcmgenet.c 97.3 KB