mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 16/23] clk: i.MX: pllv3: Add support for the i.MX7 enet pll
Date: Mon, 16 Jan 2017 11:51:01 +0100	[thread overview]
Message-ID: <20170116105108.13617-17-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20170116105108.13617-1-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/clk/imx/clk-pllv3.c | 23 ++++++++++++++++++-----
 drivers/clk/imx/clk.h       |  1 +
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c
index 29c0f1c70..2a08996a6 100644
--- a/drivers/clk/imx/clk-pllv3.c
+++ b/drivers/clk/imx/clk-pllv3.c
@@ -30,6 +30,7 @@
 #define BM_PLL_ENABLE		(0x1 << 13)
 #define BM_PLL_BYPASS		(0x1 << 16)
 #define BM_PLL_LOCK		(0x1 << 31)
+#define IMX7_ENET_PLL_POWER	(0x1 << 5)
 
 struct clk_pllv3 {
 	struct clk	clk;
@@ -38,6 +39,8 @@ struct clk_pllv3 {
 	u32		div_mask;
 	u32		div_shift;
 	const char	*parent;
+	u32		ref_clock;
+	u32		power_bit;
 };
 
 #define to_clk_pllv3(_clk) container_of(_clk, struct clk_pllv3, clk)
@@ -51,9 +54,9 @@ static int clk_pllv3_enable(struct clk *clk)
 	val = readl(pll->base);
 	val &= ~BM_PLL_BYPASS;
 	if (pll->powerup_set)
-		val |= BM_PLL_POWER;
+		val |= pll->power_bit;
 	else
-		val &= ~BM_PLL_POWER;
+		val &= ~pll->power_bit;
 	writel(val, pll->base);
 
 	/* Wait for PLL to lock */
@@ -83,9 +86,9 @@ static void clk_pllv3_disable(struct clk *clk)
 
 	val |= BM_PLL_BYPASS;
 	if (pll->powerup_set)
-		val &= ~BM_PLL_POWER;
+		val &= ~pll->power_bit;
 	else
-		val |= BM_PLL_POWER;
+		val |= pll->power_bit;
 	writel(val, pll->base);
 }
 
@@ -265,7 +268,9 @@ static const struct clk_ops clk_pllv3_av_ops = {
 static unsigned long clk_pllv3_enet_recalc_rate(struct clk *clk,
 						unsigned long parent_rate)
 {
-	return 500000000;
+	struct clk_pllv3 *pll = to_clk_pllv3(clk);
+
+	return pll->ref_clock;
 }
 
 static const struct clk_ops clk_pllv3_enet_ops = {
@@ -289,6 +294,8 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
 
 	pll = xzalloc(sizeof(*pll));
 
+	pll->power_bit = BM_PLL_POWER;
+
 	switch (type) {
 	case IMX_PLLV3_SYS:
 		ops = &clk_pllv3_sys_ops;
@@ -302,7 +309,13 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
 	case IMX_PLLV3_AV:
 		ops = &clk_pllv3_av_ops;
 		break;
+	case IMX_PLLV3_ENET_IMX7:
+		pll->power_bit = IMX7_ENET_PLL_POWER;
+		pll->ref_clock = 1000000000;
+		ops = &clk_pllv3_enet_ops;
+		break;
 	case IMX_PLLV3_ENET:
+		pll->ref_clock = 500000000;
 		ops = &clk_pllv3_enet_ops;
 		break;
 	case IMX_PLLV3_MLB:
diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
index 970f65c7d..7ecb14654 100644
--- a/drivers/clk/imx/clk.h
+++ b/drivers/clk/imx/clk.h
@@ -82,6 +82,7 @@ enum imx_pllv3_type {
 	IMX_PLLV3_USB_VF610,
 	IMX_PLLV3_AV,
 	IMX_PLLV3_ENET,
+	IMX_PLLV3_ENET_IMX7,
 	IMX_PLLV3_MLB,
 };
 
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2017-01-16 10:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 10:50 i.MX7 support Sascha Hauer
2017-01-16 10:50 ` [PATCH 01/23] imx-usb-loader: let constant data be const Sascha Hauer
2017-01-16 10:50 ` [PATCH 02/23] imx-usb-loader: this table is used internally only, so keep it static Sascha Hauer
2017-01-16 11:29   ` Juergen Borleis
2017-01-16 10:50 ` [PATCH 03/23] imx-usb-loader: add i.MX7S support Sascha Hauer
2017-01-16 10:50 ` [PATCH 04/23] ARM: Makefile: format fix Sascha Hauer
2017-01-16 10:50 ` [PATCH 05/23] i2c: i.MX: Enable clock Sascha Hauer
2017-01-16 10:50 ` [PATCH 06/23] mci: imx-esdhc: " Sascha Hauer
2017-01-16 10:50 ` [PATCH 07/23] serial: i.MX: " Sascha Hauer
2017-01-16 10:50 ` [PATCH 08/23] usb: imx: Make usb-misc multi instance safe Sascha Hauer
2017-01-16 10:50 ` [PATCH 09/23] usb: imx: Add usbmisc support for i.MX7 Sascha Hauer
2017-01-16 10:50 ` [PATCH 10/23] usb: imx: Add clock support Sascha Hauer
2017-01-16 10:50 ` [PATCH 11/23] phy: usb-nop-xceiv: " Sascha Hauer
2017-01-16 10:50 ` [PATCH 12/23] of: partitions: force "partitions" subnode Sascha Hauer
2017-01-16 10:50 ` [PATCH 13/23] mci: Allow to partition eMMC boot partitions Sascha Hauer
2017-01-16 10:50 ` [PATCH 14/23] mci: imx-esdhci: remove wrong write protection test Sascha Hauer
2017-01-16 10:51 ` [PATCH 15/23] ARM: i.MX: Add i.MX7 base architecture support Sascha Hauer
2017-01-16 10:51 ` Sascha Hauer [this message]
2017-01-16 10:51 ` [PATCH 17/23] clk: imx: Add clk-cpu support Sascha Hauer
2017-01-16 10:51 ` [PATCH 18/23] clk: i.MX: Add clock support for i.MX7 Sascha Hauer
2017-01-16 10:51 ` [PATCH 19/23] clk: i.MX7: Add missing USB clocks Sascha Hauer
2017-01-16 10:51 ` [PATCH 20/23] ARM: i.MX: gpt: Add i.MX7 support Sascha Hauer
2017-01-16 11:35   ` Juergen Borleis
2017-01-16 10:51 ` [PATCH 21/23] pinmmux: i.MX: add pin mux support for i.MX7 Sascha Hauer
2017-01-16 10:51 ` [PATCH 22/23] serial: i.MX: add i.MX7 support Sascha Hauer
2017-01-16 10:51 ` [PATCH 23/23] ARM: i.MX: Add WaRP7 board support Sascha Hauer
2017-01-16 10:58 ` i.MX7 support Fabio Estevam
2017-01-16 12:58   ` Sascha Hauer
2017-01-17 12:07     ` Fabio Estevam
2017-01-18  7:07       ` Sascha Hauer
2017-01-18  9:36         ` Fabio Estevam
2017-01-19  9:14           ` Sascha Hauer
2017-01-19 11:54             ` Fabio Estevam
2017-01-19 12:38               ` Sascha Hauer
2017-01-19 17:32                 ` Fabio Estevam
2017-01-16 11:02 ` Belisko Marek
2017-01-16 11:38   ` Robert Schwebel
2017-01-16 11:51     ` Belisko Marek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170116105108.13617-17-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox