From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2 11/18] clk: zynq: improve PLL enable handling
Date: Sat, 9 Nov 2019 15:28:30 +0100 [thread overview]
Message-ID: <20191109142837.82409-11-dev@lynxeye.de> (raw)
In-Reply-To: <20191109142837.82409-1-dev@lynxeye.de>
Ensure that both the powerdown and reset bits are cleared when the PLL
gets enabled, as any of those set would prevent the PLL from working.
Also add a status readback function, so the real status of the PLL is
reflected in the Barebox clock state.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
drivers/clk/zynq/clkc.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
index ba441740c585..07152e2ada3f 100644
--- a/drivers/clk/zynq/clkc.c
+++ b/drivers/clk/zynq/clkc.c
@@ -48,6 +48,8 @@ enum zynq_pll_type {
#define PLL_STATUS_DDR_PLL_STABLE (1 << 1)
#define PLL_STATUS_IO_PLL_STABLE (1 << 2)
#define PLL_CTRL_BYPASS_FORCE (1 << 4)
+#define PLL_CTRL_PWRDOWN (1 << 1)
+#define PLL_CTRL_RESET (1 << 0)
static struct clk *clks[clks_max];
@@ -75,7 +77,7 @@ static int zynq_pll_enable(struct clk *clk)
int timeout = 10000;
val = readl(pll->pll_ctrl);
- val &= ~PLL_CTRL_BYPASS_FORCE;
+ val &= ~(PLL_CTRL_BYPASS_FORCE | PLL_CTRL_PWRDOWN | PLL_CTRL_RESET);
writel(val, pll->pll_ctrl);
while (timeout--) {
@@ -89,9 +91,18 @@ static int zynq_pll_enable(struct clk *clk)
return 0;
}
+static int zynq_pll_is_enabled(struct clk *clk)
+{
+ struct zynq_pll_clk *pll = to_zynq_pll_clk(clk);
+ u32 val = readl(pll->pll_ctrl);
+
+ return !(val & (PLL_CTRL_PWRDOWN | PLL_CTRL_RESET));
+}
+
static struct clk_ops zynq_pll_clk_ops = {
.recalc_rate = zynq_pll_recalc_rate,
.enable = zynq_pll_enable,
+ .is_enabled = zynq_pll_is_enabled,
};
static inline struct clk *zynq_pll_clk(enum zynq_pll_type type,
--
2.23.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-11-09 14:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-09 14:28 [PATCH v2 01/18] ARM: zynq: zedboard: enable MACB driver in defconfig Lucas Stach
2019-11-09 14:28 ` [PATCH v2 02/18] ARM: zynq: add trivial image build mechanism Lucas Stach
2019-11-09 14:28 ` [PATCH v2 03/18] ARM: zynq: use getopt in zynq_mkimage Lucas Stach
2019-11-09 14:28 ` [PATCH v2 04/18] ARM: zynq: move header generation to zynq_mkimage Lucas Stach
2019-11-09 14:28 ` [PATCH v2 05/18] ARM: zynq: add size check in zynq_mkimage Lucas Stach
2019-11-09 14:28 ` [PATCH v2 06/18] ARM: zynq: zedboard: provide DTB Lucas Stach
2019-11-09 14:28 ` [PATCH v2 07/18] net: macb: handle more clocks Lucas Stach
2019-11-09 14:28 ` [PATCH v2 08/18] net: macb: add Zynq compatible Lucas Stach
2019-11-09 14:28 ` [PATCH v2 09/18] ARM: zynq: move clock controller driver to drivers/clk Lucas Stach
2019-11-09 14:28 ` [PATCH v2 10/18] clk: zynq: use base address of clock controller Lucas Stach
2019-11-09 14:28 ` Lucas Stach [this message]
2019-11-09 14:28 ` [PATCH v2 12/18] clk: zynq: fix up address from DT Lucas Stach
2019-11-09 14:28 ` [PATCH v2 13/18] clk: zynq: partially sync with Linux Lucas Stach
2019-11-09 14:28 ` [PATCH v2 14/18] ARM: zynq: switch to DT based probing Lucas Stach
2019-11-09 14:28 ` [PATCH v2 15/18] clk: zynq: remove clkdevs Lucas Stach
2019-11-09 14:28 ` [PATCH v2 16/18] ARM: zynq: switch to multi-image build Lucas Stach
2019-11-09 14:28 ` [PATCH v2 17/18] bootsource: add JTAG bootsource Lucas Stach
2019-11-09 14:28 ` [PATCH v2 18/18] ARM: zynq: add bootsource detection Lucas Stach
2019-11-11 8:16 ` [PATCH v2 01/18] ARM: zynq: zedboard: enable MACB driver in defconfig Sascha Hauer
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=20191109142837.82409-11-dev@lynxeye.de \
--to=dev@lynxeye.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