From: Jon Mason <jonmason@broadcom.com>
To: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>
Cc: devicetree@vger.kernel.org,
Florian Fainelli <f.fainelli@gmail.com>,
Scott Branden <sbranden@broadcom.com>,
Hauke Mehrtens <hauke@hauke-m.de>,
linux-kernel@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
Ray Jui <rjui@broadcom.com>,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/10] clk: iproc: Add PWRCTRL support
Date: Fri, 2 Oct 2015 18:57:36 -0400 [thread overview]
Message-ID: <1443826665-17570-2-git-send-email-jonmason@broadcom.com> (raw)
In-Reply-To: <1443826665-17570-1-git-send-email-jonmason@broadcom.com>
Some iProc SoC clocks use a different way to control clock power, via
the PWRDWN bit in the PLL control register. Since the PLL control
register is used to access the PWRDWN bit, there is no need for the
pwr_base when this is being used. A new flag, IPROC_CLK_EMBED_PWRCTRL,
has been added to identify this usage. We can use the AON interface to
write the values to enable/disable PWRDOWN.
Signed-off-by: Jon Mason <jonmason@broadcom.com>
---
drivers/clk/bcm/clk-iproc-pll.c | 55 ++++++++++++++++++++++++++++-------------
drivers/clk/bcm/clk-iproc.h | 6 +++++
2 files changed, 44 insertions(+), 17 deletions(-)
diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c
index 2dda4e8..e029ab3 100644
--- a/drivers/clk/bcm/clk-iproc-pll.c
+++ b/drivers/clk/bcm/clk-iproc-pll.c
@@ -148,14 +148,25 @@ static void __pll_disable(struct iproc_pll *pll)
writel(val, pll->asiu_base + ctrl->asiu.offset);
}
- /* latch input value so core power can be shut down */
- val = readl(pll->pwr_base + ctrl->aon.offset);
- val |= (1 << ctrl->aon.iso_shift);
- writel(val, pll->pwr_base + ctrl->aon.offset);
-
- /* power down the core */
- val &= ~(bit_mask(ctrl->aon.pwr_width) << ctrl->aon.pwr_shift);
- writel(val, pll->pwr_base + ctrl->aon.offset);
+ if (ctrl->flags & IPROC_CLK_EMBED_PWRCTRL) {
+ val = readl(pll->pll_base + ctrl->aon.offset);
+ val |= (bit_mask(ctrl->aon.pwr_width) << ctrl->aon.pwr_shift);
+ writel(val, pll->pll_base + ctrl->aon.offset);
+
+ if (unlikely(ctrl->flags & IPROC_CLK_NEEDS_READ_BACK))
+ readl(pll->pll_base + ctrl->aon.offset);
+ }
+
+ if (pll->pwr_base) {
+ /* latch input value so core power can be shut down */
+ val = readl(pll->pwr_base + ctrl->aon.offset);
+ val |= (1 << ctrl->aon.iso_shift);
+ writel(val, pll->pwr_base + ctrl->aon.offset);
+
+ /* power down the core */
+ val &= ~(bit_mask(ctrl->aon.pwr_width) << ctrl->aon.pwr_shift);
+ writel(val, pll->pwr_base + ctrl->aon.offset);
+ }
}
static int __pll_enable(struct iproc_pll *pll)
@@ -163,11 +174,22 @@ static int __pll_enable(struct iproc_pll *pll)
const struct iproc_pll_ctrl *ctrl = pll->ctrl;
u32 val;
- /* power up the PLL and make sure it's not latched */
- val = readl(pll->pwr_base + ctrl->aon.offset);
- val |= bit_mask(ctrl->aon.pwr_width) << ctrl->aon.pwr_shift;
- val &= ~(1 << ctrl->aon.iso_shift);
- writel(val, pll->pwr_base + ctrl->aon.offset);
+ if (ctrl->flags & IPROC_CLK_EMBED_PWRCTRL) {
+ val = readl(pll->pll_base + ctrl->aon.offset);
+ val &= ~(bit_mask(ctrl->aon.pwr_width) << ctrl->aon.pwr_shift);
+ writel(val, pll->pll_base + ctrl->aon.offset);
+
+ if (unlikely(ctrl->flags & IPROC_CLK_NEEDS_READ_BACK))
+ readl(pll->pll_base + ctrl->aon.offset);
+ }
+
+ if (pll->pwr_base) {
+ /* power up the PLL and make sure it's not latched */
+ val = readl(pll->pwr_base + ctrl->aon.offset);
+ val |= bit_mask(ctrl->aon.pwr_width) << ctrl->aon.pwr_shift;
+ val &= ~(1 << ctrl->aon.iso_shift);
+ writel(val, pll->pwr_base + ctrl->aon.offset);
+ }
/* certain PLLs also need to be ungated from the ASIU top level */
if (ctrl->flags & IPROC_CLK_PLL_ASIU) {
@@ -610,9 +632,8 @@ void __init iproc_pll_clk_setup(struct device_node *node,
if (WARN_ON(!pll->pll_base))
goto err_pll_iomap;
+ /* Some SoCs do not require the pwr_base, thus failing is not fatal */
pll->pwr_base = of_iomap(node, 1);
- if (WARN_ON(!pll->pwr_base))
- goto err_pwr_iomap;
/* some PLLs require gating control at the top ASIU level */
if (pll_ctrl->flags & IPROC_CLK_PLL_ASIU) {
@@ -695,9 +716,9 @@ err_pll_register:
iounmap(pll->asiu_base);
err_asiu_iomap:
- iounmap(pll->pwr_base);
+ if (pll->pwr_base)
+ iounmap(pll->pwr_base);
-err_pwr_iomap:
iounmap(pll->pll_base);
err_pll_iomap:
diff --git a/drivers/clk/bcm/clk-iproc.h b/drivers/clk/bcm/clk-iproc.h
index d834b7a..ff7bfad 100644
--- a/drivers/clk/bcm/clk-iproc.h
+++ b/drivers/clk/bcm/clk-iproc.h
@@ -49,6 +49,12 @@
#define IPROC_CLK_PLL_NEEDS_SW_CFG BIT(4)
/*
+ * Some PLLs use a different way to control clock power, via the PWRDWN bit in
+ * the PLL control register
+ */
+#define IPROC_CLK_EMBED_PWRCTRL BIT(5)
+
+/*
* Parameters for VCO frequency configuration
*
* VCO frequency =
--
1.9.1
next prev parent reply other threads:[~2015-10-02 22:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 22:57 [PATCH 0/10] clk: iproc: add support for BCM NS, NSP, and NS2 Jon Mason
2015-10-02 22:57 ` Jon Mason [this message]
2015-10-02 22:57 ` [PATCH 02/10] clk: nsp: add clock support for Broadcom Northstar Plus SoC Jon Mason
2015-10-09 7:37 ` Stephen Boyd
2015-10-09 17:59 ` Jon Mason
2015-10-02 22:57 ` [PATCH 03/10] clk: iproc: define Broadcom NSP iProc clock binding Jon Mason
2015-10-02 22:57 ` [PATCH 04/10] ARM: dts: enable clock support for BCM5301X Jon Mason
2015-10-09 7:35 ` Stephen Boyd
[not found] ` <20151009073540.GO26883-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-10-09 18:27 ` Jon Mason
2015-10-10 0:14 ` Stephen Boyd
2015-10-12 17:57 ` Jon Mason
2015-10-02 22:57 ` [PATCH 05/10] clk: iproc: Add PLL base write function Jon Mason
2015-10-09 7:03 ` Stephen Boyd
2015-10-09 18:01 ` Jon Mason
2015-10-10 0:21 ` Stephen Boyd
[not found] ` <20151010002106.GZ26883-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-10-12 17:48 ` Jon Mason
2015-10-02 22:57 ` [PATCH 06/10] clk: iproc: Split off dig_filter Jon Mason
2015-10-02 22:57 ` [PATCH 07/10] clk: iproc: Separate status and control variables Jon Mason
2015-10-02 22:57 ` [PATCH 08/10] clk: iproc: define Broadcom NS2 iProc clock binding Jon Mason
2015-10-02 22:57 ` [PATCH 09/10] clk: ns2: add clock support for Broadcom Northstar 2 SoC Jon Mason
2015-10-10 0:19 ` Stephen Boyd
2015-10-12 17:52 ` Jon Mason
[not found] ` <1443826665-17570-10-git-send-email-jonmason-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-10-10 0:33 ` Stephen Boyd
2015-10-12 18:19 ` Jon Mason
2015-10-13 16:51 ` Scott Branden
2015-10-13 18:39 ` Stephen Boyd
2015-10-02 22:57 ` [PATCH 10/10] ARM: dts: enable clock support for Broadcom NS2 Jon Mason
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=1443826665-17570-2-git-send-email-jonmason@broadcom.com \
--to=jonmason@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=hauke@hauke-m.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=rjui@broadcom.com \
--cc=sboyd@codeaurora.org \
--cc=sbranden@broadcom.com \
/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;
as well as URLs for NNTP newsgroup(s).