• Christian Lamparter's avatar
    net: emac: fix reset timeout with AR8035 phy · 46ef3065
    Christian Lamparter authored
    commit 19d90ece upstream.
    
    This patch fixes a problem where the AR8035 PHY can't be
    detected on an Cisco Meraki MR24, if the ethernet cable is
    not connected on boot.
    
    Russell Senior provided steps to reproduce the issue:
    |Disconnect ethernet cable, apply power, wait until device has booted,
    |plug in ethernet, check for interfaces, no eth0 is listed.
    |
    |This appears to be a problem during probing of the AR8035 Phy chip.
    |When ethernet has no link, the phy detection fails, and eth0 is not
    |created. Plugging ethernet later has no effect, because there is no
    |interface as far as the kernel is concerned. The relevant part of
    |the boot log looks like this:
    |this is the failing case:
    |
    |[    0.876611] /plb/opb/emac-rgmii@ef601500: input 0 in RGMII mode
    |[    0.882532] /plb/opb/ethernet@ef600c00: reset timeout
    |[    0.888546] /plb/opb/ethernet@ef600c00: can't find PHY!
    |and the succeeding case:
    |
    |[    0.876672] /plb/opb/emac-rgmii@ef601500: input 0 in RGMII mode
    |[    0.883952] eth0: EMAC-0 /plb/opb/ethernet@ef600c00, MAC 00:01:..
    |[    0.890822] eth0: found Atheros 8035 Gigabit Ethernet PHY (0x01)
    
    Based on the comment and the commit message of
    commit 23fbb5a8 ("emac: Fix EMAC soft reset on 460EX/GT").
    This is because the AR8035 PHY doesn't provide the TX Clock,
    if the ethernet cable is not attached. This causes the reset
    to timeout and the PHY detection code in emac_init_phy() is
    unable to detect the AR8035 PHY. As a result, the emac driver
    bails out early and the user left with no ethernet.
    
    In order to stay compatible with existing configurations, the driver
    tries the current reset approach at first. Only if the first attempt
    timed out, it does perform one more retry with the clock temporarily
    switched to the internal source for just the duration of the reset.
    
    LEDE-Bug: #687 <https://bugs.lede-project.org/index.php?do=details&task_id=687>
    
    Cc: Chris Blake <chrisrblake93@gmail.com>
    Reported-by: default avatarRussell Senior <russell@personaltelco.net>
    Fixes: 23fbb5a8 ("emac: Fix EMAC soft reset on 460EX/GT")
    Signed-off-by: default avatarChristian Lamparter <chunkeey@googlemail.com>
    Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    46ef3065
core.c 82.7 KB