summaryrefslogtreecommitdiffstats
path: root/drivers/net/fec_imx.c
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2017-05-05 17:49:18 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-05-08 13:53:31 +0200
commitfa8a8ec88668a43874220cad21a2fa95bac054e5 (patch)
treef41c1b5f8d247edaec2f22c8b1550fde2d7ea1d6 /drivers/net/fec_imx.c
parente5f2191e7b6920e67dd45b34d9b1c86d04456ffa (diff)
downloadbarebox-fa8a8ec88668a43874220cad21a2fa95bac054e5.tar.gz
barebox-fa8a8ec88668a43874220cad21a2fa95bac054e5.tar.xz
i.MX: fec: also enable optional clocks
This will also enable two more optional clocks. They can be found on mx6ul, mx6sx and mx28. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/fec_imx.c')
-rw-r--r--drivers/net/fec_imx.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index e2b25fe375..8cf7c4fbda 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -662,6 +662,14 @@ static int fec_clk_enable(struct fec_priv *fec)
return err;
}
+ for (i = 0; i < ARRAY_SIZE(fec->opt_clk); i++) {
+ if (!IS_ERR_OR_NULL(fec->opt_clk[i])) {
+ const int err = clk_enable(fec->opt_clk[i]);
+ if (err < 0)
+ return err;
+ }
+ }
+
return 0;
}
@@ -673,6 +681,12 @@ static void fec_clk_disable(struct fec_priv *fec)
if (!IS_ERR_OR_NULL(fec->clk[i]))
clk_disable(fec->clk[i]);
}
+
+ for (i = 0; i < ARRAY_SIZE(fec->opt_clk); i++) {
+ if (!IS_ERR_OR_NULL(fec->opt_clk[i])) {
+ clk_disable(fec->opt_clk[i]);
+ }
+ }
}
static void fec_clk_put(struct fec_priv *fec)
@@ -683,6 +697,11 @@ static void fec_clk_put(struct fec_priv *fec)
if (!IS_ERR_OR_NULL(fec->clk[i]))
clk_put(fec->clk[i]);
}
+
+ for (i = 0; i < ARRAY_SIZE(fec->opt_clk); i++) {
+ if (!IS_ERR_OR_NULL(fec->opt_clk[i]))
+ clk_put(fec->opt_clk[i]);
+ }
}
static int fec_clk_get(struct fec_priv *fec)
@@ -691,6 +710,9 @@ static int fec_clk_get(struct fec_priv *fec)
static const char *clk_names[ARRAY_SIZE(fec->clk)] = {
"ipg", "ahb", "ptp"
};
+ static const char *opt_clk_names[ARRAY_SIZE(fec->opt_clk)] = {
+ "enet_clk_ref", "enet_out",
+ };
for (i = 0; i < ARRAY_SIZE(fec->clk); i++) {
fec->clk[i] = clk_get(fec->edev.parent, clk_names[i]);
@@ -701,6 +723,13 @@ static int fec_clk_get(struct fec_priv *fec)
}
}
+ for (i = 0; i < ARRAY_SIZE(fec->opt_clk); i++) {
+ fec->opt_clk[i] = clk_get(fec->edev.parent, opt_clk_names[i]);
+ if (IS_ERR(fec->opt_clk[i])) {
+ fec->opt_clk[i] = NULL;
+ }
+ }
+
return err;
}