Re: [PATCH v3 04/10] clk: nsp: add clock support for Broadcom Northstar Plus SoC

2015-10-21 Thread Stephen Boyd
On 10/15, Jon Mason wrote:
> The Broadcom Northstar Plus SoC is architected under the iProc
> architecture. It has the following PLLs: ARMPLL, GENPLL, LCPLL0, all
> derived from an onboard crystal.
> 
> Signed-off-by: Jon Mason 
> ---

Applied to clk-iproc

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 04/10] clk: nsp: add clock support for Broadcom Northstar Plus SoC

2015-10-15 Thread Jon Mason
On Thu, Oct 15, 2015 at 01:41:57PM -0700, Scott Branden wrote:
> Jon,
> 
> Review below.
> 
> On 15-10-15 12:48 PM, Jon Mason wrote:
> >The Broadcom Northstar Plus SoC is architected under the iProc
> 
> Based on changes in Makefile below - should this be for Northstar
> and Northstar Plus?

Yes, that would be more accurate (or the 5301x/4708 verbage we are
using now in Linux for that SoC family).  If there is the need for
another version of this patch, I'll fix it up.

Thanks,
Jon

> 
> >architecture. It has the following PLLs: ARMPLL, GENPLL, LCPLL0, all
> >derived from an onboard crystal.
> >
> >Signed-off-by: Jon Mason 
> >---
> >  drivers/clk/bcm/Makefile|   2 +
> >  drivers/clk/bcm/clk-nsp.c   | 135 
> > 
> >  include/dt-bindings/clock/bcm-nsp.h |  51 ++
> >  3 files changed, 188 insertions(+)
> >  create mode 100644 drivers/clk/bcm/clk-nsp.c
> >  create mode 100644 include/dt-bindings/clock/bcm-nsp.h
> >
> >diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile
> >index 8a7a477..e258b28 100644
> >--- a/drivers/clk/bcm/Makefile
> >+++ b/drivers/clk/bcm/Makefile
> >@@ -4,3 +4,5 @@ obj-$(CONFIG_CLK_BCM_KONA)   += clk-bcm281xx.o
> >  obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o
> >  obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o 
> > clk-iproc-asiu.o
> >  obj-$(CONFIG_ARCH_BCM_CYGNUS)  += clk-cygnus.o
> >+obj-$(CONFIG_ARCH_BCM_NSP)  += clk-nsp.o
> >+obj-$(CONFIG_ARCH_BCM_5301X)+= clk-nsp.o
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 04/10] clk: nsp: add clock support for Broadcom Northstar Plus SoC

2015-10-15 Thread Scott Branden

Jon,

Review below.

On 15-10-15 12:48 PM, Jon Mason wrote:

The Broadcom Northstar Plus SoC is architected under the iProc


Based on changes in Makefile below - should this be for Northstar and 
Northstar Plus?



architecture. It has the following PLLs: ARMPLL, GENPLL, LCPLL0, all
derived from an onboard crystal.

Signed-off-by: Jon Mason 
---
  drivers/clk/bcm/Makefile|   2 +
  drivers/clk/bcm/clk-nsp.c   | 135 
  include/dt-bindings/clock/bcm-nsp.h |  51 ++
  3 files changed, 188 insertions(+)
  create mode 100644 drivers/clk/bcm/clk-nsp.c
  create mode 100644 include/dt-bindings/clock/bcm-nsp.h

diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile
index 8a7a477..e258b28 100644
--- a/drivers/clk/bcm/Makefile
+++ b/drivers/clk/bcm/Makefile
@@ -4,3 +4,5 @@ obj-$(CONFIG_CLK_BCM_KONA)  += clk-bcm281xx.o
  obj-$(CONFIG_CLK_BCM_KONA)+= clk-bcm21664.o
  obj-$(CONFIG_COMMON_CLK_IPROC)+= clk-iproc-armpll.o clk-iproc-pll.o 
clk-iproc-asiu.o
  obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o
+obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o
+obj-$(CONFIG_ARCH_BCM_5301X)   += clk-nsp.o


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 04/10] clk: nsp: add clock support for Broadcom Northstar Plus SoC

2015-10-15 Thread Jon Mason
The Broadcom Northstar Plus SoC is architected under the iProc
architecture. It has the following PLLs: ARMPLL, GENPLL, LCPLL0, all
derived from an onboard crystal.

Signed-off-by: Jon Mason 
---
 drivers/clk/bcm/Makefile|   2 +
 drivers/clk/bcm/clk-nsp.c   | 135 
 include/dt-bindings/clock/bcm-nsp.h |  51 ++
 3 files changed, 188 insertions(+)
 create mode 100644 drivers/clk/bcm/clk-nsp.c
 create mode 100644 include/dt-bindings/clock/bcm-nsp.h

diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile
index 8a7a477..e258b28 100644
--- a/drivers/clk/bcm/Makefile
+++ b/drivers/clk/bcm/Makefile
@@ -4,3 +4,5 @@ obj-$(CONFIG_CLK_BCM_KONA)  += clk-bcm281xx.o
 obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o
 obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o 
clk-iproc-asiu.o
 obj-$(CONFIG_ARCH_BCM_CYGNUS)  += clk-cygnus.o
+obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o
+obj-$(CONFIG_ARCH_BCM_5301X)   += clk-nsp.o
diff --git a/drivers/clk/bcm/clk-nsp.c b/drivers/clk/bcm/clk-nsp.c
new file mode 100644
index 000..bc8ebdcd
--- /dev/null
+++ b/drivers/clk/bcm/clk-nsp.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2015 Broadcom Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include "clk-iproc.h"
+
+#define REG_VAL(o, s, w) { .offset = o, .shift = s, .width = w, }
+
+#define AON_VAL(o, pw, ps, is) { .offset = o, .pwr_width = pw, \
+   .pwr_shift = ps, .iso_shift = is }
+
+#define RESET_VAL(o, rs, prs, kis, kiw, kps, kpw, kas, kaw) { .offset = o, \
+   .reset_shift = rs, .p_reset_shift = prs, .ki_shift = kis, \
+   .ki_width = kiw, .kp_shift = kps, .kp_width = kpw, .ka_shift = kas, \
+   .ka_width = kaw }
+
+#define ENABLE_VAL(o, es, hs, bs) { .offset = o, .enable_shift = es, \
+   .hold_shift = hs, .bypass_shift = bs }
+
+static void __init nsp_armpll_init(struct device_node *node)
+{
+   iproc_armpll_setup(node);
+}
+CLK_OF_DECLARE(nsp_armpll, "brcm,nsp-armpll", nsp_armpll_init);
+
+static const struct iproc_pll_ctrl genpll = {
+   .flags = IPROC_CLK_PLL_HAS_NDIV_FRAC | IPROC_CLK_EMBED_PWRCTRL,
+   .aon = AON_VAL(0x0, 1, 12, 0),
+   .reset = RESET_VAL(0x0, 11, 10, 4, 3, 0, 4, 7, 3),
+   .ndiv_int = REG_VAL(0x14, 20, 10),
+   .ndiv_frac = REG_VAL(0x14, 0, 20),
+   .pdiv = REG_VAL(0x18, 24, 3),
+   .status = REG_VAL(0x20, 12, 1),
+};
+
+static const struct iproc_clk_ctrl genpll_clk[] = {
+   [BCM_NSP_GENPLL_PHY_CLK] = {
+   .channel = BCM_NSP_GENPLL_PHY_CLK,
+   .flags = IPROC_CLK_AON,
+   .enable = ENABLE_VAL(0x4, 12, 6, 18),
+   .mdiv = REG_VAL(0x18, 16, 8),
+   },
+   [BCM_NSP_GENPLL_ENET_SW_CLK] = {
+   .channel = BCM_NSP_GENPLL_ENET_SW_CLK,
+   .flags = IPROC_CLK_AON,
+   .enable = ENABLE_VAL(0x4, 13, 7, 19),
+   .mdiv = REG_VAL(0x18, 8, 8),
+   },
+   [BCM_NSP_GENPLL_USB_PHY_REF_CLK] = {
+   .channel = BCM_NSP_GENPLL_USB_PHY_REF_CLK,
+   .flags = IPROC_CLK_AON,
+   .enable = ENABLE_VAL(0x4, 14, 8, 20),
+   .mdiv = REG_VAL(0x18, 0, 8),
+   },
+   [BCM_NSP_GENPLL_IPROCFAST_CLK] = {
+   .channel = BCM_NSP_GENPLL_IPROCFAST_CLK,
+   .flags = IPROC_CLK_AON,
+   .enable = ENABLE_VAL(0x4, 15, 9, 21),
+   .mdiv = REG_VAL(0x1c, 16, 8),
+   },
+   [BCM_NSP_GENPLL_SATA1_CLK] = {
+   .channel = BCM_NSP_GENPLL_SATA1_CLK,
+   .flags = IPROC_CLK_AON,
+   .enable = ENABLE_VAL(0x4, 16, 10, 22),
+   .mdiv = REG_VAL(0x1c, 8, 8),
+   },
+   [BCM_NSP_GENPLL_SATA2_CLK] = {
+   .channel = BCM_NSP_GENPLL_SATA2_CLK,
+   .flags = IPROC_CLK_AON,
+   .enable = ENABLE_VAL(0x4, 17, 11, 23),
+   .mdiv = REG_VAL(0x1c, 0, 8),
+   },
+};
+
+static void __init nsp_genpll_clk_init(struct device_node *node)
+{
+   iproc_pll_clk_setup(node, &genpll, NULL, 0, genpll_clk,
+   ARRAY_SIZE(genpll_clk));
+}
+CLK_OF_DECLARE(nsp_genpll_clk, "brcm,nsp-genpll", nsp_genpll_clk_init);
+
+static const struct iproc_pll_ctrl lcpll0 = {
+   .flags = IPROC_CLK_PLL_HAS_NDIV_FRAC | IPROC_CLK_EMBED_PWRCTRL,
+   .aon = AON_VAL(0x0, 1, 24, 0),
+   .reset = RESET_VAL(0x0, 23, 22, 16, 3, 12, 4, 19, 4),
+   .ndiv_int = REG_VAL(0x4, 20, 8),
+   .ndiv_frac =