aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Cross <xobs@kosagi.com>2014-10-01 18:41:05 +0800
committerSean Cross <xobs@kosagi.com>2014-10-15 21:01:14 +0800
commitce32b55cd7055e6a21f9d01153a23c8027fb6c3e (patch)
tree09361855bc69eb544002324cfdfc8841b6fc49e6
parent1d0d3cd462dc40b6c3be5bff20fac0ad0fb35856 (diff)
downloadnovena-linux-ce32b55cd7055e6a21f9d01153a23c8027fb6c3e.tar.gz
novena-linux-ce32b55cd7055e6a21f9d01153a23c8027fb6c3e.tar.bz2
novena-linux-ce32b55cd7055e6a21f9d01153a23c8027fb6c3e.zip
drivers: net: fec: Only disable clocks if they're enabled
There is a bug that we encounter when suspending the device when Ethernet is plugged in, where a WARNING is generated because the clocks are disabled twice. As a workaround, check to see if the clocks are enabled before disabling them. This is a hack and should be investigated later on. Signed-off-by: Sean Cross <xobs@kosagi.com>
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 89355a71962..17ccca558dd 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -46,6 +46,7 @@
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/clk.h>
+#include <linux/clk-provider.h>
#include <linux/platform_device.h>
#include <linux/phy.h>
#include <linux/fec.h>
@@ -1622,11 +1623,13 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
mutex_unlock(&fep->ptp_clk_mutex);
}
} else {
- clk_disable_unprepare(fep->clk_ahb);
- clk_disable_unprepare(fep->clk_ipg);
- if (fep->clk_enet_out)
+ if (__clk_is_enabled(fep->clk_ahb))
+ clk_disable_unprepare(fep->clk_ahb);
+ if (__clk_is_enabled(fep->clk_ipg))
+ clk_disable_unprepare(fep->clk_ipg);
+ if (fep->clk_enet_out && __clk_is_enabled(fep->clk_enet_out))
clk_disable_unprepare(fep->clk_enet_out);
- if (fep->clk_ptp) {
+ if (fep->clk_ptp && __clk_is_enabled(fep->clk_ptp)) {
mutex_lock(&fep->ptp_clk_mutex);
clk_disable_unprepare(fep->clk_ptp);
fep->ptp_clk_on = false;