net: sni_netsec: Add workaround for timeout error
authorRyosuke Saito <ryosuke.saito@linaro.org>
Thu, 3 Aug 2023 14:56:48 +0000 (23:56 +0900)
committerTom Rini <trini@konsulko.com>
Fri, 22 Sep 2023 19:54:35 +0000 (15:54 -0400)
commitc5b42e3e9e757ab44da3006e713d8d02b65aa9fe
tree17fe87556484c5c9f1dbe5bd0acd18a17e4f8bd0
parent65adf86f1ac1712a794cbe8251cf8ab74e146302
net: sni_netsec: Add workaround for timeout error

The NETSEC GMAC occasionally falls into a weird state where
MAC_REG_DESC_SOFT_RST has never been cleared and shows errors like the
below when networking commands are issued:

    => ping 192.168.1.1
    ethernet@522d0000 Waiting for PHY auto negotiation to complete... done
    netsec_wait_while_busy: timeout
    Using ethernet@522d0000 device

    ARP Retry count exceeded; starting again
    ping failed; host 192.168.1.1 is not alive

It happens on not only 'ping' but also 'dhcp', 'tftp' and so on.

Luckily, restarting the NETSEC GMAC and trying again seems to fix the
problematic state. So first ensure that we haven't entered the state by
checking MAC_REG_DESC_SOFT_RST to be cleared; otherwise, restarting
NETSEC/PHY and trying again would work as a workaround.

Signed-off-by: Ryosuke Saito <ryosuke.saito@linaro.org>
Tested-by: Masahisa Kojima <masahisa.kojima@linaro.org>
drivers/net/sni_netsec.c