OSDN Git Service

net: axienet: Handle deferred probe on clock properly
authorRobert Hancock <robert.hancock@calian.com>
Sat, 13 Feb 2021 00:17:48 +0000 (18:17 -0600)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Feb 2021 01:36:31 +0000 (17:36 -0800)
commit57baf8cc70ea4cf5503c9d42f31f6a86d7f5ff1a
tree78aa73b3f02e9775124df3e2ba1454fb35b92a8b
parenta6f2fe5f108c11ff8023d07f9c00cc3c9c3203b8
net: axienet: Handle deferred probe on clock properly

This driver is set up to use a clock mapping in the device tree if it is
present, but still work without one for backward compatibility. However,
if getting the clock returns -EPROBE_DEFER, then we need to abort and
return that error from our driver initialization so that the probe can
be retried later after the clock is set up.

Move clock initialization to earlier in the process so we do not waste as
much effort if the clock is not yet available. Switch to use
devm_clk_get_optional and abort initialization on any error reported.
Also enable the clock regardless of whether the controller is using an MDIO
bus, as the clock is required in any case.

Fixes: 09a0354cadec267be7f ("net: axienet: Use clock framework to get device clock rate")
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/xilinx/xilinx_axienet_main.c