OSDN Git Service

mlxsw: pci: Only issue reset when system is ready
authorIdo Schimmel <idosch@mellanox.com>
Thu, 19 Mar 2020 11:25:39 +0000 (13:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Mar 2020 03:23:27 +0000 (20:23 -0700)
commit6002059d7882c3512e6ac52fa82424272ddfcd5c
treee5a3c271bf93d11e5d2528db9cbc47e0054c74ba
parent3c025b6317272ee8493ee20fa5035c087626af48
mlxsw: pci: Only issue reset when system is ready

During initialization the driver issues a software reset command and
then waits for the system status to change back to "ready" state.

However, before issuing the reset command the driver does not check that
the system is actually in "ready" state. On Spectrum-{1,2} systems this
was always the case as the hardware initialization time is very short.
On Spectrum-3 systems this is no longer the case. This results in the
software reset command timing-out and the driver failing to load:

[ 6.347591] mlxsw_spectrum3 0000:06:00.0: Cmd exec timed-out (opcode=40(ACCESS_REG),opcode_mod=0,in_mod=0)
[ 6.358382] mlxsw_spectrum3 0000:06:00.0: Reg cmd access failed (reg_id=9023(mrsr),type=write)
[ 6.368028] mlxsw_spectrum3 0000:06:00.0: cannot register bus device
[ 6.375274] mlxsw_spectrum3: probe of 0000:06:00.0 failed with error -110

Fix this by waiting for the system to become ready both before issuing
the reset command and afterwards. In case of failure, print the last
system status to aid in debugging.

Fixes: da382875c616 ("mlxsw: spectrum: Extend to support Spectrum-3 ASIC")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/pci.c