diff options
author | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2017-05-05 17:49:18 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-05-08 13:53:31 +0200 |
commit | fa8a8ec88668a43874220cad21a2fa95bac054e5 (patch) | |
tree | f41c1b5f8d247edaec2f22c8b1550fde2d7ea1d6 /drivers | |
parent | e5f2191e7b6920e67dd45b34d9b1c86d04456ffa (diff) | |
download | barebox-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')
-rw-r--r-- | drivers/net/fec_imx.c | 29 | ||||
-rw-r--r-- | drivers/net/fec_imx.h | 8 |
2 files changed, 37 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; } diff --git a/drivers/net/fec_imx.h b/drivers/net/fec_imx.h index 85d51bad60..561de0890b 100644 --- a/drivers/net/fec_imx.h +++ b/drivers/net/fec_imx.h @@ -137,6 +137,13 @@ enum fec_clock { FEC_CLK_NUM }; +enum fec_opt_clock { + FEC_OPT_CLK_REF, + FEC_OPT_CLK_OUT, + + FEC_OPT_CLK_NUM +}; + /** * @brief i.MX27-FEC private structure */ @@ -153,6 +160,7 @@ struct fec_priv { struct mii_bus miibus; void (*phy_init)(struct phy_device *dev); struct clk *clk[FEC_CLK_NUM]; + struct clk *opt_clk[FEC_OPT_CLK_NUM]; enum fec_type type; }; |