2014-04-21 21:26:40

by Alex Elder

[permalink] [raw]
Subject: [PATCH v2 RESEND 0/5] clk: bcm21664: add common clock support

This is series has two parts. The first two patches are changes
to the existing Broadcom Kona family clock code to prepare for the
addition of support for another SoC, bcm21664.

The remaining three define the binding and code for bcm21664, and
replace the use of "fake" clocks in the device tree with the real
ones. This ends up being a fairly straightforward definition of
the clocks on this SoC; the rest of the clock code is shared with
other SoCs that use the Kona style clock system.

This series depends on the following patch, which has been taken
into the clk-fixes tree:
clk: bcm281xx: don't use unnamed structs or unions
https://lkml.org/lkml/2014/4/7/322

In addition, it depends on the version 4 of the following series,
just (re)posted for review:
clk: bcm281xx: updates
https://lkml.org/lkml/2014/4/8/485

The patches in this series--based on the current linus/master branch
plus the patches mentioned above--are available here:
http://git.linaro.org/git/landing-teams/working/broadcom/kernel.git
Branch review/bcm21664-clock-v2

Alex Elder (5):
clk: bcm281xx: move compatible string definitions
ARM: dts: revise kona clock binding document
ARM: dts: define clock binding for bcm21664
clk: bcm21664: use common clock framework
ARM: dts: use real clocks for bcm21664

.../devicetree/bindings/clock/bcm-kona-clock.txt | 116 ++++++---
arch/arm/boot/dts/bcm21664.dtsi | 190 +++++++++-----
drivers/clk/bcm/Kconfig | 2 +-
drivers/clk/bcm/Makefile | 1 +
drivers/clk/bcm/clk-bcm21664.c | 290 +++++++++++++++++++++
drivers/clk/bcm/clk-bcm281xx.c | 12 -
include/dt-bindings/clock/bcm21664.h | 62 +++++
include/dt-bindings/clock/bcm281xx.h | 12 +
8 files changed, 565 insertions(+), 120 deletions(-)
create mode 100644 drivers/clk/bcm/clk-bcm21664.c
create mode 100644 include/dt-bindings/clock/bcm21664.h

--
1.9.1


2014-04-21 21:26:43

by Alex Elder

[permalink] [raw]
Subject: [PATCH v2 RESEND 1/5] clk: bcm281xx: move compatible string definitions

The Broadcom 281xx clock code uses a #define for the compatible
string for it's clock control units (CCUs). Rather than defining
those in the C source file, define them in the header file that's
shared by both the code and the device tree source file (along with
all the clock ids).

Signed-off-by: Alex Elder <[email protected]>
---
drivers/clk/bcm/clk-bcm281xx.c | 12 ------------
include/dt-bindings/clock/bcm281xx.h | 12 ++++++++++++
2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/bcm/clk-bcm281xx.c b/drivers/clk/bcm/clk-bcm281xx.c
index 71a65a4..502a487 100644
--- a/drivers/clk/bcm/clk-bcm281xx.c
+++ b/drivers/clk/bcm/clk-bcm281xx.c
@@ -18,18 +18,6 @@
#define BCM281XX_CCU_COMMON(_name, _ucase_name) \
KONA_CCU_COMMON(BCM281XX, _name, _ucase_name)

-/*
- * These are the bcm281xx CCU device tree "compatible" strings.
- * We're stuck with using "bcm11351" in the string because wild
- * cards aren't allowed, and that name was the first one defined
- * in this family of devices.
- */
-#define BCM281XX_DT_ROOT_CCU_COMPAT "brcm,bcm11351-root-ccu"
-#define BCM281XX_DT_AON_CCU_COMPAT "brcm,bcm11351-aon-ccu"
-#define BCM281XX_DT_HUB_CCU_COMPAT "brcm,bcm11351-hub-ccu"
-#define BCM281XX_DT_MASTER_CCU_COMPAT "brcm,bcm11351-master-ccu"
-#define BCM281XX_DT_SLAVE_CCU_COMPAT "brcm,bcm11351-slave-ccu"
-
/* Root CCU */

static struct peri_clk_data frac_1m_data = {
diff --git a/include/dt-bindings/clock/bcm281xx.h b/include/dt-bindings/clock/bcm281xx.h
index e009694..a763460 100644
--- a/include/dt-bindings/clock/bcm281xx.h
+++ b/include/dt-bindings/clock/bcm281xx.h
@@ -20,6 +20,18 @@
* the clock control units (CCUs) on Broadcom BCM281XX family SoCs.
*/

+/*
+ * These are the bcm281xx CCU device tree "compatible" strings.
+ * We're stuck with using "bcm11351" in the string because wild
+ * cards aren't allowed, and that name was the first one defined
+ * in this family of devices.
+ */
+#define BCM281XX_DT_ROOT_CCU_COMPAT "brcm,bcm11351-root-ccu"
+#define BCM281XX_DT_AON_CCU_COMPAT "brcm,bcm11351-aon-ccu"
+#define BCM281XX_DT_HUB_CCU_COMPAT "brcm,bcm11351-hub-ccu"
+#define BCM281XX_DT_MASTER_CCU_COMPAT "brcm,bcm11351-master-ccu"
+#define BCM281XX_DT_SLAVE_CCU_COMPAT "brcm,bcm11351-slave-ccu"
+
/* root CCU clock ids */

#define BCM281XX_ROOT_CCU_FRAC_1M 0
--
1.9.1

2014-04-21 21:26:53

by Alex Elder

[permalink] [raw]
Subject: [PATCH v2 RESEND 5/5] ARM: dts: use real clocks for bcm21664

Replace the "fake" fixed-rate clocks used previously for the
bcm21664 family with "real" ones.

Signed-off-by: Alex Elder <[email protected]>
---
arch/arm/boot/dts/bcm21664.dtsi | 190 +++++++++++++++++++++++++---------------
1 file changed, 118 insertions(+), 72 deletions(-)

diff --git a/arch/arm/boot/dts/bcm21664.dtsi b/arch/arm/boot/dts/bcm21664.dtsi
index 08a44d4..8b36682 100644
--- a/arch/arm/boot/dts/bcm21664.dtsi
+++ b/arch/arm/boot/dts/bcm21664.dtsi
@@ -14,6 +14,8 @@
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/interrupt-controller/irq.h>

+#include "dt-bindings/clock/bcm21664.h"
+
#include "skeleton.dtsi"

/ {
@@ -43,7 +45,7 @@
compatible = "brcm,bcm21664-dw-apb-uart", "snps,dw-apb-uart";
status = "disabled";
reg = <0x3e000000 0x118>;
- clocks = <&uartb_clk>;
+ clocks = <&slave_ccu BCM21664_SLAVE_CCU_UARTB>;
interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
reg-shift = <2>;
reg-io-width = <4>;
@@ -53,7 +55,7 @@
compatible = "brcm,bcm21664-dw-apb-uart", "snps,dw-apb-uart";
status = "disabled";
reg = <0x3e001000 0x118>;
- clocks = <&uartb2_clk>;
+ clocks = <&slave_ccu BCM21664_SLAVE_CCU_UARTB2>;
interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
reg-shift = <2>;
reg-io-width = <4>;
@@ -63,7 +65,7 @@
compatible = "brcm,bcm21664-dw-apb-uart", "snps,dw-apb-uart";
status = "disabled";
reg = <0x3e002000 0x118>;
- clocks = <&uartb3_clk>;
+ clocks = <&slave_ccu BCM21664_SLAVE_CCU_UARTB3>;
interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
reg-shift = <2>;
reg-io-width = <4>;
@@ -85,7 +87,7 @@
compatible = "brcm,kona-timer";
reg = <0x35006000 0x1c>;
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&hub_timer_clk>;
+ clocks = <&aon_ccu BCM21664_AON_CCU_HUB_TIMER>;
};

gpio: gpio@35003000 {
@@ -106,7 +108,7 @@
compatible = "brcm,kona-sdhci";
reg = <0x3f180000 0x801c>;
interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&sdio1_clk>;
+ clocks = <&master_ccu BCM21664_MASTER_CCU_SDIO1>;
status = "disabled";
};

@@ -114,7 +116,7 @@
compatible = "brcm,kona-sdhci";
reg = <0x3f190000 0x801c>;
interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&sdio2_clk>;
+ clocks = <&master_ccu BCM21664_MASTER_CCU_SDIO2>;
status = "disabled";
};

@@ -122,7 +124,7 @@
compatible = "brcm,kona-sdhci";
reg = <0x3f1a0000 0x801c>;
interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&sdio3_clk>;
+ clocks = <&master_ccu BCM21664_MASTER_CCU_SDIO3>;
status = "disabled";
};

@@ -130,7 +132,7 @@
compatible = "brcm,kona-sdhci";
reg = <0x3f1b0000 0x801c>;
interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&sdio4_clk>;
+ clocks = <&master_ccu BCM21664_MASTER_CCU_SDIO4>;
status = "disabled";
};

@@ -140,7 +142,7 @@
interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
- clocks = <&bsc1_clk>;
+ clocks = <&slave_ccu BCM21664_SLAVE_CCU_BSC1>;
status = "disabled";
};

@@ -150,7 +152,7 @@
interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
- clocks = <&bsc2_clk>;
+ clocks = <&slave_ccu BCM21664_SLAVE_CCU_BSC2>;
status = "disabled";
};

@@ -160,7 +162,7 @@
interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
- clocks = <&bsc3_clk>;
+ clocks = <&slave_ccu BCM21664_SLAVE_CCU_BSC3>;
status = "disabled";
};

@@ -170,105 +172,149 @@
interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
- clocks = <&bsc4_clk>;
+ clocks = <&slave_ccu BCM21664_SLAVE_CCU_BSC4>;
status = "disabled";
};

clocks {
- bsc1_clk: bsc1 {
- compatible = "fixed-clock";
- clock-frequency = <13000000>;
- #clock-cells = <0>;
- };
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;

- bsc2_clk: bsc2 {
- compatible = "fixed-clock";
- clock-frequency = <13000000>;
+ /*
+ * Fixed clocks are defined before CCUs whose
+ * clocks may depend on them.
+ */
+
+ ref_32k_clk: ref_32k {
#clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <32768>;
};

- bsc3_clk: bsc3 {
- compatible = "fixed-clock";
- clock-frequency = <13000000>;
+ bbl_32k_clk: bbl_32k {
#clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <32768>;
};

- bsc4_clk: bsc4 {
+ ref_13m_clk: ref_13m {
+ #clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <13000000>;
- #clock-cells = <0>;
};

- pmu_bsc_clk: pmu_bsc {
+ var_13m_clk: var_13m {
+ #clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <13000000>;
- #clock-cells = <0>;
};

- hub_timer_clk: hub_timer {
- compatible = "fixed-clock";
- clock-frequency = <32768>;
+ dft_19_5m_clk: dft_19_5m {
#clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <19500000>;
};

- pwm_clk: pwm {
+ ref_crystal_clk: ref_crystal {
+ #clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <26000000>;
- #clock-cells = <0>;
};

- sdio1_clk: sdio1 {
- compatible = "fixed-clock";
- clock-frequency = <48000000>;
+ ref_52m_clk: ref_52m {
#clock-cells = <0>;
- };
-
- sdio2_clk: sdio2 {
compatible = "fixed-clock";
- clock-frequency = <48000000>;
- #clock-cells = <0>;
+ clock-frequency = <52000000>;
};

- sdio3_clk: sdio3 {
- compatible = "fixed-clock";
- clock-frequency = <48000000>;
+ var_52m_clk: var_52m {
#clock-cells = <0>;
- };
-
- sdio4_clk: sdio4 {
- compatible = "fixed-clock";
- clock-frequency = <48000000>;
- #clock-cells = <0>;
- };
-
- tmon_1m_clk: tmon_1m {
compatible = "fixed-clock";
- clock-frequency = <1000000>;
- #clock-cells = <0>;
- };
-
- uartb_clk: uartb {
- compatible = "fixed-clock";
- clock-frequency = <13000000>;
- #clock-cells = <0>;
- };
-
- uartb2_clk: uartb2 {
- compatible = "fixed-clock";
- clock-frequency = <13000000>;
- #clock-cells = <0>;
- };
-
- uartb3_clk: uartb3 {
- compatible = "fixed-clock";
- clock-frequency = <13000000>;
- #clock-cells = <0>;
+ clock-frequency = <52000000>;
};

usb_otg_ahb_clk: usb_otg_ahb {
+ #clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <52000000>;
+ };
+
+ ref_96m_clk: ref_96m {
#clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <96000000>;
+ };
+
+ var_96m_clk: var_96m {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <96000000>;
+ };
+
+ ref_104m_clk: ref_104m {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <104000000>;
+ };
+
+ var_104m_clk: var_104m {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <104000000>;
+ };
+
+ ref_156m_clk: ref_156m {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <156000000>;
+ };
+
+ var_156m_clk: var_156m {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <156000000>;
+ };
+
+ root_ccu: root_ccu {
+ compatible = BCM21664_DT_ROOT_CCU_COMPAT;
+ reg = <0x35001000 0x0f00>;
+ #clock-cells = <1>;
+ clock-output-names = "frac_1m";
+ };
+
+ aon_ccu: aon_ccu {
+ compatible = BCM21664_DT_AON_CCU_COMPAT;
+ reg = <0x35002000 0x0f00>;
+ #clock-cells = <1>;
+ clock-output-names = "hub_timer";
+ };
+
+ master_ccu: master_ccu {
+ compatible = BCM21664_DT_MASTER_CCU_COMPAT;
+ reg = <0x3f001000 0x0f00>;
+ #clock-cells = <1>;
+ clock-output-names = "sdio1",
+ "sdio2",
+ "sdio3",
+ "sdio4",
+ "sdio1_sleep",
+ "sdio2_sleep",
+ "sdio3_sleep",
+ "sdio4_sleep";
+ };
+
+ slave_ccu: slave_ccu {
+ compatible = BCM21664_DT_SLAVE_CCU_COMPAT;
+ reg = <0x3e011000 0x0f00>;
+ #clock-cells = <1>;
+ clock-output-names = "uartb",
+ "uartb2",
+ "uartb3",
+ "bsc1",
+ "bsc2",
+ "bsc3",
+ "bsc4";
};
};

--
1.9.1

2014-04-21 21:27:26

by Alex Elder

[permalink] [raw]
Subject: [PATCH v2 RESEND 4/5] clk: bcm21664: use common clock framework

Define the set of CCUs and provided clocks sufficient to satisfy the
needs of all the existing clock references for BCM21664. Replace
the "fake" fixed-rate clocks used previously with "real" ones.

Note that only the minimal set of these clocks and CCUs is defined
here. More clock definitions will need to be added as required by
the addition of additional drivers.

Signed-off-by: Alex Elder <[email protected]>
---
drivers/clk/bcm/Kconfig | 2 +-
drivers/clk/bcm/Makefile | 1 +
drivers/clk/bcm/clk-bcm21664.c | 290 +++++++++++++++++++++++++++++++++++
include/dt-bindings/clock/bcm21664.h | 62 ++++++++
4 files changed, 354 insertions(+), 1 deletion(-)
create mode 100644 drivers/clk/bcm/clk-bcm21664.c
create mode 100644 include/dt-bindings/clock/bcm21664.h

diff --git a/drivers/clk/bcm/Kconfig b/drivers/clk/bcm/Kconfig
index a7262fb..75506e5 100644
--- a/drivers/clk/bcm/Kconfig
+++ b/drivers/clk/bcm/Kconfig
@@ -6,4 +6,4 @@ config CLK_BCM_KONA
help
Enable common clock framework support for Broadcom SoCs
using "Kona" style clock control units, including those
- in the BCM281xx family.
+ in the BCM281xx and BCM21664 families.
diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile
index cf93359..6297d05 100644
--- a/drivers/clk/bcm/Makefile
+++ b/drivers/clk/bcm/Makefile
@@ -1,3 +1,4 @@
obj-$(CONFIG_CLK_BCM_KONA) += clk-kona.o
obj-$(CONFIG_CLK_BCM_KONA) += clk-kona-setup.o
obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o
+obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o
diff --git a/drivers/clk/bcm/clk-bcm21664.c b/drivers/clk/bcm/clk-bcm21664.c
new file mode 100644
index 0000000..eeae4ca
--- /dev/null
+++ b/drivers/clk/bcm/clk-bcm21664.c
@@ -0,0 +1,290 @@
+/*
+ * Copyright (C) 2014 Broadcom Corporation
+ * Copyright 2014 Linaro Limited
+ *
+ * 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 "clk-kona.h"
+#include "dt-bindings/clock/bcm21664.h"
+
+#define BCM21664_CCU_COMMON(_name, _capname) \
+ KONA_CCU_COMMON(BCM21664, _name, _capname)
+
+/* Root CCU */
+
+static struct peri_clk_data frac_1m_data = {
+ .gate = HW_SW_GATE(0x214, 16, 0, 1),
+ .clocks = CLOCKS("ref_crystal"),
+};
+
+static struct ccu_data root_ccu_data = {
+ BCM21664_CCU_COMMON(root, ROOT),
+ /* no policy control */
+ .kona_clks = {
+ [BCM21664_ROOT_CCU_FRAC_1M] =
+ KONA_CLK(root, frac_1m, peri),
+ [BCM21664_ROOT_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
+ },
+};
+
+/* AON CCU */
+
+static struct peri_clk_data hub_timer_data = {
+ .gate = HW_SW_GATE(0x0414, 16, 0, 1),
+ .hyst = HYST(0x0414, 8, 9),
+ .clocks = CLOCKS("bbl_32k",
+ "frac_1m",
+ "dft_19_5m"),
+ .sel = SELECTOR(0x0a10, 0, 2),
+ .trig = TRIGGER(0x0a40, 4),
+};
+
+static struct ccu_data aon_ccu_data = {
+ BCM21664_CCU_COMMON(aon, AON),
+ .policy = {
+ .enable = CCU_LVM_EN(0x0034, 0),
+ .control = CCU_POLICY_CTL(0x000c, 0, 1, 2),
+ },
+ .kona_clks = {
+ [BCM21664_AON_CCU_HUB_TIMER] =
+ KONA_CLK(aon, hub_timer, peri),
+ [BCM21664_AON_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
+ },
+};
+
+/* Master CCU */
+
+static struct peri_clk_data sdio1_data = {
+ .gate = HW_SW_GATE(0x0358, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_52m",
+ "ref_52m",
+ "var_96m",
+ "ref_96m"),
+ .sel = SELECTOR(0x0a28, 0, 3),
+ .div = DIVIDER(0x0a28, 4, 14),
+ .trig = TRIGGER(0x0afc, 9),
+};
+
+static struct peri_clk_data sdio2_data = {
+ .gate = HW_SW_GATE(0x035c, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_52m",
+ "ref_52m",
+ "var_96m",
+ "ref_96m"),
+ .sel = SELECTOR(0x0a2c, 0, 3),
+ .div = DIVIDER(0x0a2c, 4, 14),
+ .trig = TRIGGER(0x0afc, 10),
+};
+
+static struct peri_clk_data sdio3_data = {
+ .gate = HW_SW_GATE(0x0364, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_52m",
+ "ref_52m",
+ "var_96m",
+ "ref_96m"),
+ .sel = SELECTOR(0x0a34, 0, 3),
+ .div = DIVIDER(0x0a34, 4, 14),
+ .trig = TRIGGER(0x0afc, 12),
+};
+
+static struct peri_clk_data sdio4_data = {
+ .gate = HW_SW_GATE(0x0360, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_52m",
+ "ref_52m",
+ "var_96m",
+ "ref_96m"),
+ .sel = SELECTOR(0x0a30, 0, 3),
+ .div = DIVIDER(0x0a30, 4, 14),
+ .trig = TRIGGER(0x0afc, 11),
+};
+
+static struct peri_clk_data sdio1_sleep_data = {
+ .clocks = CLOCKS("ref_32k"), /* Verify */
+ .gate = HW_SW_GATE(0x0358, 18, 2, 3),
+};
+
+static struct peri_clk_data sdio2_sleep_data = {
+ .clocks = CLOCKS("ref_32k"), /* Verify */
+ .gate = HW_SW_GATE(0x035c, 18, 2, 3),
+};
+
+static struct peri_clk_data sdio3_sleep_data = {
+ .clocks = CLOCKS("ref_32k"), /* Verify */
+ .gate = HW_SW_GATE(0x0364, 18, 2, 3),
+};
+
+static struct peri_clk_data sdio4_sleep_data = {
+ .clocks = CLOCKS("ref_32k"), /* Verify */
+ .gate = HW_SW_GATE(0x0360, 18, 2, 3),
+};
+
+static struct ccu_data master_ccu_data = {
+ BCM21664_CCU_COMMON(master, MASTER),
+ .policy = {
+ .enable = CCU_LVM_EN(0x0034, 0),
+ .control = CCU_POLICY_CTL(0x000c, 0, 1, 2),
+ },
+ .kona_clks = {
+ [BCM21664_MASTER_CCU_SDIO1] =
+ KONA_CLK(master, sdio1, peri),
+ [BCM21664_MASTER_CCU_SDIO2] =
+ KONA_CLK(master, sdio2, peri),
+ [BCM21664_MASTER_CCU_SDIO3] =
+ KONA_CLK(master, sdio3, peri),
+ [BCM21664_MASTER_CCU_SDIO4] =
+ KONA_CLK(master, sdio4, peri),
+ [BCM21664_MASTER_CCU_SDIO1_SLEEP] =
+ KONA_CLK(master, sdio1_sleep, peri),
+ [BCM21664_MASTER_CCU_SDIO2_SLEEP] =
+ KONA_CLK(master, sdio2_sleep, peri),
+ [BCM21664_MASTER_CCU_SDIO3_SLEEP] =
+ KONA_CLK(master, sdio3_sleep, peri),
+ [BCM21664_MASTER_CCU_SDIO4_SLEEP] =
+ KONA_CLK(master, sdio4_sleep, peri),
+ [BCM21664_MASTER_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
+ },
+};
+
+/* Slave CCU */
+
+static struct peri_clk_data uartb_data = {
+ .gate = HW_SW_GATE(0x0400, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_156m",
+ "ref_156m"),
+ .sel = SELECTOR(0x0a10, 0, 2),
+ .div = FRAC_DIVIDER(0x0a10, 4, 12, 8),
+ .trig = TRIGGER(0x0afc, 2),
+};
+
+static struct peri_clk_data uartb2_data = {
+ .gate = HW_SW_GATE(0x0404, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_156m",
+ "ref_156m"),
+ .sel = SELECTOR(0x0a14, 0, 2),
+ .div = FRAC_DIVIDER(0x0a14, 4, 12, 8),
+ .trig = TRIGGER(0x0afc, 3),
+};
+
+static struct peri_clk_data uartb3_data = {
+ .gate = HW_SW_GATE(0x0408, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_156m",
+ "ref_156m"),
+ .sel = SELECTOR(0x0a18, 0, 2),
+ .div = FRAC_DIVIDER(0x0a18, 4, 12, 8),
+ .trig = TRIGGER(0x0afc, 4),
+};
+
+static struct peri_clk_data bsc1_data = {
+ .gate = HW_SW_GATE(0x0458, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_104m",
+ "ref_104m",
+ "var_13m",
+ "ref_13m"),
+ .sel = SELECTOR(0x0a64, 0, 3),
+ .trig = TRIGGER(0x0afc, 23),
+};
+
+static struct peri_clk_data bsc2_data = {
+ .gate = HW_SW_GATE(0x045c, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_104m",
+ "ref_104m",
+ "var_13m",
+ "ref_13m"),
+ .sel = SELECTOR(0x0a68, 0, 3),
+ .trig = TRIGGER(0x0afc, 24),
+};
+
+static struct peri_clk_data bsc3_data = {
+ .gate = HW_SW_GATE(0x0470, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_104m",
+ "ref_104m",
+ "var_13m",
+ "ref_13m"),
+ .sel = SELECTOR(0x0a7c, 0, 3),
+ .trig = TRIGGER(0x0afc, 18),
+};
+
+static struct peri_clk_data bsc4_data = {
+ .gate = HW_SW_GATE(0x0474, 18, 2, 3),
+ .clocks = CLOCKS("ref_crystal",
+ "var_104m",
+ "ref_104m",
+ "var_13m",
+ "ref_13m"),
+ .sel = SELECTOR(0x0a80, 0, 3),
+ .trig = TRIGGER(0x0afc, 19),
+};
+
+static struct ccu_data slave_ccu_data = {
+ BCM21664_CCU_COMMON(slave, SLAVE),
+ .policy = {
+ .enable = CCU_LVM_EN(0x0034, 0),
+ .control = CCU_POLICY_CTL(0x000c, 0, 1, 2),
+ },
+ .kona_clks = {
+ [BCM21664_SLAVE_CCU_UARTB] =
+ KONA_CLK(slave, uartb, peri),
+ [BCM21664_SLAVE_CCU_UARTB2] =
+ KONA_CLK(slave, uartb2, peri),
+ [BCM21664_SLAVE_CCU_UARTB3] =
+ KONA_CLK(slave, uartb3, peri),
+ [BCM21664_SLAVE_CCU_BSC1] =
+ KONA_CLK(slave, bsc1, peri),
+ [BCM21664_SLAVE_CCU_BSC2] =
+ KONA_CLK(slave, bsc2, peri),
+ [BCM21664_SLAVE_CCU_BSC3] =
+ KONA_CLK(slave, bsc3, peri),
+ [BCM21664_SLAVE_CCU_BSC4] =
+ KONA_CLK(slave, bsc4, peri),
+ [BCM21664_SLAVE_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
+ },
+};
+
+/* Device tree match table callback functions */
+
+static void __init kona_dt_root_ccu_setup(struct device_node *node)
+{
+ kona_dt_ccu_setup(&root_ccu_data, node);
+}
+
+static void __init kona_dt_aon_ccu_setup(struct device_node *node)
+{
+ kona_dt_ccu_setup(&aon_ccu_data, node);
+}
+
+static void __init kona_dt_master_ccu_setup(struct device_node *node)
+{
+ kona_dt_ccu_setup(&master_ccu_data, node);
+}
+
+static void __init kona_dt_slave_ccu_setup(struct device_node *node)
+{
+ kona_dt_ccu_setup(&slave_ccu_data, node);
+}
+
+CLK_OF_DECLARE(bcm21664_root_ccu, BCM21664_DT_ROOT_CCU_COMPAT,
+ kona_dt_root_ccu_setup);
+CLK_OF_DECLARE(bcm21664_aon_ccu, BCM21664_DT_AON_CCU_COMPAT,
+ kona_dt_aon_ccu_setup);
+CLK_OF_DECLARE(bcm21664_master_ccu, BCM21664_DT_MASTER_CCU_COMPAT,
+ kona_dt_master_ccu_setup);
+CLK_OF_DECLARE(bcm21664_slave_ccu, BCM21664_DT_SLAVE_CCU_COMPAT,
+ kona_dt_slave_ccu_setup);
diff --git a/include/dt-bindings/clock/bcm21664.h b/include/dt-bindings/clock/bcm21664.h
new file mode 100644
index 0000000..5a7f0e4
--- /dev/null
+++ b/include/dt-bindings/clock/bcm21664.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2013 Broadcom Corporation
+ * Copyright 2013 Linaro Limited
+ *
+ * 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.
+ */
+
+#ifndef _CLOCK_BCM21664_H
+#define _CLOCK_BCM21664_H
+
+/*
+ * This file defines the values used to specify clocks provided by
+ * the clock control units (CCUs) on Broadcom BCM21664 family SoCs.
+ */
+
+/* bcm21664 CCU device tree "compatible" strings */
+#define BCM21664_DT_ROOT_CCU_COMPAT "brcm,bcm21664-root-ccu"
+#define BCM21664_DT_AON_CCU_COMPAT "brcm,bcm21664-aon-ccu"
+#define BCM21664_DT_MASTER_CCU_COMPAT "brcm,bcm21664-master-ccu"
+#define BCM21664_DT_SLAVE_CCU_COMPAT "brcm,bcm21664-slave-ccu"
+
+/* root CCU clock ids */
+
+#define BCM21664_ROOT_CCU_FRAC_1M 0
+#define BCM21664_ROOT_CCU_CLOCK_COUNT 1
+
+/* aon CCU clock ids */
+
+#define BCM21664_AON_CCU_HUB_TIMER 0
+#define BCM21664_AON_CCU_CLOCK_COUNT 1
+
+/* master CCU clock ids */
+
+#define BCM21664_MASTER_CCU_SDIO1 0
+#define BCM21664_MASTER_CCU_SDIO2 1
+#define BCM21664_MASTER_CCU_SDIO3 2
+#define BCM21664_MASTER_CCU_SDIO4 3
+#define BCM21664_MASTER_CCU_SDIO1_SLEEP 4
+#define BCM21664_MASTER_CCU_SDIO2_SLEEP 5
+#define BCM21664_MASTER_CCU_SDIO3_SLEEP 6
+#define BCM21664_MASTER_CCU_SDIO4_SLEEP 7
+#define BCM21664_MASTER_CCU_CLOCK_COUNT 8
+
+/* slave CCU clock ids */
+
+#define BCM21664_SLAVE_CCU_UARTB 0
+#define BCM21664_SLAVE_CCU_UARTB2 1
+#define BCM21664_SLAVE_CCU_UARTB3 2
+#define BCM21664_SLAVE_CCU_BSC1 3
+#define BCM21664_SLAVE_CCU_BSC2 4
+#define BCM21664_SLAVE_CCU_BSC3 5
+#define BCM21664_SLAVE_CCU_BSC4 6
+#define BCM21664_SLAVE_CCU_CLOCK_COUNT 7
+
+#endif /* _CLOCK_BCM21664_H */
--
1.9.1

2014-04-21 21:27:49

by Alex Elder

[permalink] [raw]
Subject: [PATCH v2 RESEND 3/5] ARM: dts: define clock binding for bcm21664

Document the device tree binding for Broadcom BCM28164 clock control
units and clocks. This SoC uses Kona CCUs, similar to the BCM281XX
SoC family.

Signed-off-by: Alex Elder <[email protected]>
---
.../devicetree/bindings/clock/bcm-kona-clock.txt | 39 ++++++++++++++++++++++
1 file changed, 39 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/bcm-kona-clock.txt b/Documentation/devicetree/bindings/clock/bcm-kona-clock.txt
index ebe3ab6..5286e26 100644
--- a/Documentation/devicetree/bindings/clock/bcm-kona-clock.txt
+++ b/Documentation/devicetree/bindings/clock/bcm-kona-clock.txt
@@ -98,3 +98,42 @@ be used. These specifiers are defined in:
slave bsc2 peri 7 BCM281XX_SLAVE_CCU_BSC2
slave bsc3 peri 8 BCM281XX_SLAVE_CCU_BSC3
slave pwm peri 9 BCM281XX_SLAVE_CCU_PWM
+
+
+BCM21664 family
+---------------
+CCU compatible string values for SoCs in the BCM21664 family are:
+ "brcm,bcm21664-root-ccu"
+ "brcm,bcm21664-aon-ccu"
+ "brcm,bcm21664-master-ccu"
+ "brcm,bcm21664-slave-ccu"
+
+The following table defines the set of CCUs and clock specifiers for
+BCM21664 family clocks. When a clock consumer references a clocks,
+its symbolic specifier (rather than its numeric index value) should
+be used. These specifiers are defined in:
+ "include/dt-bindings/clock/bcm21664.h"
+
+ CCU Clock Type Index Specifier
+ --- ----- ---- ----- ---------
+ root frac_1m peri 0 BCM21664_ROOT_CCU_FRAC_1M
+
+ aon hub_timer peri 0 BCM21664_AON_CCU_HUB_TIMER
+
+ master sdio1 peri 0 BCM21664_MASTER_CCU_SDIO1
+ master sdio2 peri 1 BCM21664_MASTER_CCU_SDIO2
+ master sdio3 peri 2 BCM21664_MASTER_CCU_SDIO3
+ master sdio4 peri 3 BCM21664_MASTER_CCU_SDIO4
+ master sdio1_sleep peri 4 BCM21664_MASTER_CCU_SDIO1_SLEEP
+ master sdio2_sleep peri 5 BCM21664_MASTER_CCU_SDIO2_SLEEP
+ master sdio3_sleep peri 6 BCM21664_MASTER_CCU_SDIO3_SLEEP
+ master sdio4_sleep peri 7 BCM21664_MASTER_CCU_SDIO4_SLEEP
+
+ slave uartb peri 0 BCM21664_SLAVE_CCU_UARTB
+ slave uartb2 peri 1 BCM21664_SLAVE_CCU_UARTB2
+ slave uartb3 peri 2 BCM21664_SLAVE_CCU_UARTB3
+ slave uartb4 peri 3 BCM21664_SLAVE_CCU_UARTB4
+ slave bsc1 peri 4 BCM21664_SLAVE_CCU_BSC1
+ slave bsc2 peri 5 BCM21664_SLAVE_CCU_BSC2
+ slave bsc3 peri 6 BCM21664_SLAVE_CCU_BSC3
+ slave bsc4 peri 7 BCM21664_SLAVE_CCU_BSC4
--
1.9.1

2014-04-21 21:28:40

by Alex Elder

[permalink] [raw]
Subject: [PATCH v2 RESEND 2/5] ARM: dts: revise kona clock binding document

The next patch defines a binding for a new Broadcom SoC that uses
Kona style CCUs for its clocks. Update the generic Kona clock
binding document so it's more natural to accomodate the definitions
of additional SoC families.

Specifically:
- Define the compatible string values generically, referring
to specific per-model values later in the document.
- Put the device tree example immediately after the required
properties listing, before the tables of SoC-specific values.
- Clearly identify the start of the section defining specific
values related to the BCM281XX family
- Add a list of the specific BCM281XX family compatible strings.
- Reword the description of the table slightly.

Signed-off-by: Alex Elder <[email protected]>
---
.../devicetree/bindings/clock/bcm-kona-clock.txt | 87 ++++++++++++----------
1 file changed, 47 insertions(+), 40 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/bcm-kona-clock.txt b/Documentation/devicetree/bindings/clock/bcm-kona-clock.txt
index 56d1f49..ebe3ab6 100644
--- a/Documentation/devicetree/bindings/clock/bcm-kona-clock.txt
+++ b/Documentation/devicetree/bindings/clock/bcm-kona-clock.txt
@@ -10,12 +10,12 @@ This binding uses the common clock binding:

Required properties:
- compatible
- Shall have one of the following values:
- - "brcm,bcm11351-root-ccu"
- - "brcm,bcm11351-aon-ccu"
- - "brcm,bcm11351-hub-ccu"
- - "brcm,bcm11351-master-ccu"
- - "brcm,bcm11351-slave-ccu"
+ Shall have a value of the form "brcm,<model>-<which>-ccu",
+ where <model> is a Broadcom SoC model number and <which> is
+ the name of a defined CCU. For example:
+ "brcm,bcm11351-root-ccu"
+ The compatible strings used for each supported SoC family
+ are defined below.
- reg
Shall define the base and range of the address space
containing clock control registers
@@ -26,12 +26,48 @@ Required properties:
Shall be an ordered list of strings defining the names of
the clocks provided by the CCU.

+Device tree example:

-BCM281XX family SoCs use Kona CCUs. The following table defines
-the set of CCUs and clock specifiers for BCM281XX clocks. When
-a clock consumer references a clocks, its symbolic specifier
-(rather than its numeric index value) should be used. These
-specifiers are defined in "include/dt-bindings/clock/bcm281xx.h".
+ slave_ccu: slave_ccu {
+ compatible = "brcm,bcm11351-slave-ccu";
+ reg = <0x3e011000 0x0f00>;
+ #clock-cells = <1>;
+ clock-output-names = "uartb",
+ "uartb2",
+ "uartb3",
+ "uartb4";
+ };
+
+ ref_crystal_clk: ref_crystal {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <26000000>;
+ };
+
+ uart@3e002000 {
+ compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
+ status = "disabled";
+ reg = <0x3e002000 0x1000>;
+ clocks = <&slave_ccu BCM281XX_SLAVE_CCU_UARTB3>;
+ interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
+ reg-shift = <2>;
+ reg-io-width = <4>;
+ };
+
+BCM281XX family
+---------------
+CCU compatible string values for SoCs in the BCM281XX family are:
+ "brcm,bcm11351-root-ccu"
+ "brcm,bcm11351-aon-ccu"
+ "brcm,bcm11351-hub-ccu"
+ "brcm,bcm11351-master-ccu"
+ "brcm,bcm11351-slave-ccu"
+
+The following table defines the set of CCUs and clock specifiers for
+BCM281XX family clocks. When a clock consumer references a clocks,
+its symbolic specifier (rather than its numeric index value) should
+be used. These specifiers are defined in:
+ "include/dt-bindings/clock/bcm281xx.h"

CCU Clock Type Index Specifier
--- ----- ---- ----- ---------
@@ -62,32 +98,3 @@ specifiers are defined in "include/dt-bindings/clock/bcm281xx.h".
slave bsc2 peri 7 BCM281XX_SLAVE_CCU_BSC2
slave bsc3 peri 8 BCM281XX_SLAVE_CCU_BSC3
slave pwm peri 9 BCM281XX_SLAVE_CCU_PWM
-
-
-Device tree example:
-
- slave_ccu: slave_ccu {
- compatible = "brcm,bcm11351-slave-ccu";
- reg = <0x3e011000 0x0f00>;
- #clock-cells = <1>;
- clock-output-names = "uartb",
- "uartb2",
- "uartb3",
- "uartb4";
- };
-
- ref_crystal_clk: ref_crystal {
- #clock-cells = <0>;
- compatible = "fixed-clock";
- clock-frequency = <26000000>;
- };
-
- uart@3e002000 {
- compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
- status = "disabled";
- reg = <0x3e002000 0x1000>;
- clocks = <&slave_ccu BCM281XX_SLAVE_CCU_UARTB3>;
- interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
- reg-shift = <2>;
- reg-io-width = <4>;
- };
--
1.9.1

2014-04-26 00:09:20

by Mike Turquette

[permalink] [raw]
Subject: Re: [PATCH v2 RESEND 0/5] clk: bcm21664: add common clock support

Quoting Alex Elder (2014-04-21 14:26:22)
> This is series has two parts. The first two patches are changes
> to the existing Broadcom Kona family clock code to prepare for the
> addition of support for another SoC, bcm21664.
>
> The remaining three define the binding and code for bcm21664, and
> replace the use of "fake" clocks in the device tree with the real
> ones. This ends up being a fairly straightforward definition of
> the clocks on this SoC; the rest of the clock code is shared with
> other SoCs that use the Kona style clock system.

Hi Alex,

I'm happy to take only the clk patches or I can take the DT stuff as
well if it gets some Acks. Let me know how you want it handled.

Regards,
Mike

>
> This series depends on the following patch, which has been taken
> into the clk-fixes tree:
> clk: bcm281xx: don't use unnamed structs or unions
> https://lkml.org/lkml/2014/4/7/322
>
> In addition, it depends on the version 4 of the following series,
> just (re)posted for review:
> clk: bcm281xx: updates
> https://lkml.org/lkml/2014/4/8/485
>
> The patches in this series--based on the current linus/master branch
> plus the patches mentioned above--are available here:
> http://git.linaro.org/git/landing-teams/working/broadcom/kernel.git
> Branch review/bcm21664-clock-v2
>
> Alex Elder (5):
> clk: bcm281xx: move compatible string definitions
> ARM: dts: revise kona clock binding document
> ARM: dts: define clock binding for bcm21664
> clk: bcm21664: use common clock framework
> ARM: dts: use real clocks for bcm21664
>
> .../devicetree/bindings/clock/bcm-kona-clock.txt | 116 ++++++---
> arch/arm/boot/dts/bcm21664.dtsi | 190 +++++++++-----
> drivers/clk/bcm/Kconfig | 2 +-
> drivers/clk/bcm/Makefile | 1 +
> drivers/clk/bcm/clk-bcm21664.c | 290 +++++++++++++++++++++
> drivers/clk/bcm/clk-bcm281xx.c | 12 -
> include/dt-bindings/clock/bcm21664.h | 62 +++++
> include/dt-bindings/clock/bcm281xx.h | 12 +
> 8 files changed, 565 insertions(+), 120 deletions(-)
> create mode 100644 drivers/clk/bcm/clk-bcm21664.c
> create mode 100644 include/dt-bindings/clock/bcm21664.h
>
> --
> 1.9.1

2014-04-26 01:44:02

by Alex Elder

[permalink] [raw]
Subject: Re: [PATCH v2 RESEND 0/5] clk: bcm21664: add common clock support

On 04/25/2014 07:09 PM, Mike Turquette wrote:
> Quoting Alex Elder (2014-04-21 14:26:22)
>> This is series has two parts. The first two patches are changes
>> to the existing Broadcom Kona family clock code to prepare for the
>> addition of support for another SoC, bcm21664.
>>
>> The remaining three define the binding and code for bcm21664, and
>> replace the use of "fake" clocks in the device tree with the real
>> ones. This ends up being a fairly straightforward definition of
>> the clocks on this SoC; the rest of the clock code is shared with
>> other SoCs that use the Kona style clock system.
>
> Hi Alex,
>
> I'm happy to take only the clk patches or I can take the DT stuff as
> well if it gets some Acks. Let me know how you want it handled.

If all you need is an ack from Matt or Christian I'm
sure they'll provide it. I don't care much but if
you'll take it all I can just consider it done, so
that would be my slight preference. The DT stuff has
been out there for way past the requisite few weeks...

Thanks Mike.

-Alex


> Regards,
> Mike
>
>>
>> This series depends on the following patch, which has been taken
>> into the clk-fixes tree:
>> clk: bcm281xx: don't use unnamed structs or unions
>> https://lkml.org/lkml/2014/4/7/322
>>
>> In addition, it depends on the version 4 of the following series,
>> just (re)posted for review:
>> clk: bcm281xx: updates
>> https://lkml.org/lkml/2014/4/8/485
>>
>> The patches in this series--based on the current linus/master branch
>> plus the patches mentioned above--are available here:
>> http://git.linaro.org/git/landing-teams/working/broadcom/kernel.git
>> Branch review/bcm21664-clock-v2
>>
>> Alex Elder (5):
>> clk: bcm281xx: move compatible string definitions
>> ARM: dts: revise kona clock binding document
>> ARM: dts: define clock binding for bcm21664
>> clk: bcm21664: use common clock framework
>> ARM: dts: use real clocks for bcm21664
>>
>> .../devicetree/bindings/clock/bcm-kona-clock.txt | 116 ++++++---
>> arch/arm/boot/dts/bcm21664.dtsi | 190 +++++++++-----
>> drivers/clk/bcm/Kconfig | 2 +-
>> drivers/clk/bcm/Makefile | 1 +
>> drivers/clk/bcm/clk-bcm21664.c | 290 +++++++++++++++++++++
>> drivers/clk/bcm/clk-bcm281xx.c | 12 -
>> include/dt-bindings/clock/bcm21664.h | 62 +++++
>> include/dt-bindings/clock/bcm281xx.h | 12 +
>> 8 files changed, 565 insertions(+), 120 deletions(-)
>> create mode 100644 drivers/clk/bcm/clk-bcm21664.c
>> create mode 100644 include/dt-bindings/clock/bcm21664.h
>>
>> --
>> 1.9.1

2014-04-26 02:59:08

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH v2 RESEND 5/5] ARM: dts: use real clocks for bcm21664

On Mon, Apr 21, 2014 at 04:26:27PM -0500, Alex Elder wrote:
> Replace the "fake" fixed-rate clocks used previously for the
> bcm21664 family with "real" ones.

>
> Signed-off-by: Alex Elder <[email protected]>

Acked-by: Matt Porter <[email protected]>

> ---
> arch/arm/boot/dts/bcm21664.dtsi | 190 +++++++++++++++++++++++++---------------
> 1 file changed, 118 insertions(+), 72 deletions(-)
>
> diff --git a/arch/arm/boot/dts/bcm21664.dtsi b/arch/arm/boot/dts/bcm21664.dtsi
> index 08a44d4..8b36682 100644
> --- a/arch/arm/boot/dts/bcm21664.dtsi
> +++ b/arch/arm/boot/dts/bcm21664.dtsi
> @@ -14,6 +14,8 @@
> #include <dt-bindings/interrupt-controller/arm-gic.h>
> #include <dt-bindings/interrupt-controller/irq.h>
>
> +#include "dt-bindings/clock/bcm21664.h"
> +
> #include "skeleton.dtsi"
>
> / {
> @@ -43,7 +45,7 @@
> compatible = "brcm,bcm21664-dw-apb-uart", "snps,dw-apb-uart";
> status = "disabled";
> reg = <0x3e000000 0x118>;
> - clocks = <&uartb_clk>;
> + clocks = <&slave_ccu BCM21664_SLAVE_CCU_UARTB>;
> interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
> reg-shift = <2>;
> reg-io-width = <4>;
> @@ -53,7 +55,7 @@
> compatible = "brcm,bcm21664-dw-apb-uart", "snps,dw-apb-uart";
> status = "disabled";
> reg = <0x3e001000 0x118>;
> - clocks = <&uartb2_clk>;
> + clocks = <&slave_ccu BCM21664_SLAVE_CCU_UARTB2>;
> interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
> reg-shift = <2>;
> reg-io-width = <4>;
> @@ -63,7 +65,7 @@
> compatible = "brcm,bcm21664-dw-apb-uart", "snps,dw-apb-uart";
> status = "disabled";
> reg = <0x3e002000 0x118>;
> - clocks = <&uartb3_clk>;
> + clocks = <&slave_ccu BCM21664_SLAVE_CCU_UARTB3>;
> interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
> reg-shift = <2>;
> reg-io-width = <4>;
> @@ -85,7 +87,7 @@
> compatible = "brcm,kona-timer";
> reg = <0x35006000 0x1c>;
> interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
> - clocks = <&hub_timer_clk>;
> + clocks = <&aon_ccu BCM21664_AON_CCU_HUB_TIMER>;
> };
>
> gpio: gpio@35003000 {
> @@ -106,7 +108,7 @@
> compatible = "brcm,kona-sdhci";
> reg = <0x3f180000 0x801c>;
> interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
> - clocks = <&sdio1_clk>;
> + clocks = <&master_ccu BCM21664_MASTER_CCU_SDIO1>;
> status = "disabled";
> };
>
> @@ -114,7 +116,7 @@
> compatible = "brcm,kona-sdhci";
> reg = <0x3f190000 0x801c>;
> interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
> - clocks = <&sdio2_clk>;
> + clocks = <&master_ccu BCM21664_MASTER_CCU_SDIO2>;
> status = "disabled";
> };
>
> @@ -122,7 +124,7 @@
> compatible = "brcm,kona-sdhci";
> reg = <0x3f1a0000 0x801c>;
> interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
> - clocks = <&sdio3_clk>;
> + clocks = <&master_ccu BCM21664_MASTER_CCU_SDIO3>;
> status = "disabled";
> };
>
> @@ -130,7 +132,7 @@
> compatible = "brcm,kona-sdhci";
> reg = <0x3f1b0000 0x801c>;
> interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
> - clocks = <&sdio4_clk>;
> + clocks = <&master_ccu BCM21664_MASTER_CCU_SDIO4>;
> status = "disabled";
> };
>
> @@ -140,7 +142,7 @@
> interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
> #address-cells = <1>;
> #size-cells = <0>;
> - clocks = <&bsc1_clk>;
> + clocks = <&slave_ccu BCM21664_SLAVE_CCU_BSC1>;
> status = "disabled";
> };
>
> @@ -150,7 +152,7 @@
> interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
> #address-cells = <1>;
> #size-cells = <0>;
> - clocks = <&bsc2_clk>;
> + clocks = <&slave_ccu BCM21664_SLAVE_CCU_BSC2>;
> status = "disabled";
> };
>
> @@ -160,7 +162,7 @@
> interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
> #address-cells = <1>;
> #size-cells = <0>;
> - clocks = <&bsc3_clk>;
> + clocks = <&slave_ccu BCM21664_SLAVE_CCU_BSC3>;
> status = "disabled";
> };
>
> @@ -170,105 +172,149 @@
> interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>;
> #address-cells = <1>;
> #size-cells = <0>;
> - clocks = <&bsc4_clk>;
> + clocks = <&slave_ccu BCM21664_SLAVE_CCU_BSC4>;
> status = "disabled";
> };
>
> clocks {
> - bsc1_clk: bsc1 {
> - compatible = "fixed-clock";
> - clock-frequency = <13000000>;
> - #clock-cells = <0>;
> - };
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
>
> - bsc2_clk: bsc2 {
> - compatible = "fixed-clock";
> - clock-frequency = <13000000>;
> + /*
> + * Fixed clocks are defined before CCUs whose
> + * clocks may depend on them.
> + */
> +
> + ref_32k_clk: ref_32k {
> #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <32768>;
> };
>
> - bsc3_clk: bsc3 {
> - compatible = "fixed-clock";
> - clock-frequency = <13000000>;
> + bbl_32k_clk: bbl_32k {
> #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <32768>;
> };
>
> - bsc4_clk: bsc4 {
> + ref_13m_clk: ref_13m {
> + #clock-cells = <0>;
> compatible = "fixed-clock";
> clock-frequency = <13000000>;
> - #clock-cells = <0>;
> };
>
> - pmu_bsc_clk: pmu_bsc {
> + var_13m_clk: var_13m {
> + #clock-cells = <0>;
> compatible = "fixed-clock";
> clock-frequency = <13000000>;
> - #clock-cells = <0>;
> };
>
> - hub_timer_clk: hub_timer {
> - compatible = "fixed-clock";
> - clock-frequency = <32768>;
> + dft_19_5m_clk: dft_19_5m {
> #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <19500000>;
> };
>
> - pwm_clk: pwm {
> + ref_crystal_clk: ref_crystal {
> + #clock-cells = <0>;
> compatible = "fixed-clock";
> clock-frequency = <26000000>;
> - #clock-cells = <0>;
> };
>
> - sdio1_clk: sdio1 {
> - compatible = "fixed-clock";
> - clock-frequency = <48000000>;
> + ref_52m_clk: ref_52m {
> #clock-cells = <0>;
> - };
> -
> - sdio2_clk: sdio2 {
> compatible = "fixed-clock";
> - clock-frequency = <48000000>;
> - #clock-cells = <0>;
> + clock-frequency = <52000000>;
> };
>
> - sdio3_clk: sdio3 {
> - compatible = "fixed-clock";
> - clock-frequency = <48000000>;
> + var_52m_clk: var_52m {
> #clock-cells = <0>;
> - };
> -
> - sdio4_clk: sdio4 {
> - compatible = "fixed-clock";
> - clock-frequency = <48000000>;
> - #clock-cells = <0>;
> - };
> -
> - tmon_1m_clk: tmon_1m {
> compatible = "fixed-clock";
> - clock-frequency = <1000000>;
> - #clock-cells = <0>;
> - };
> -
> - uartb_clk: uartb {
> - compatible = "fixed-clock";
> - clock-frequency = <13000000>;
> - #clock-cells = <0>;
> - };
> -
> - uartb2_clk: uartb2 {
> - compatible = "fixed-clock";
> - clock-frequency = <13000000>;
> - #clock-cells = <0>;
> - };
> -
> - uartb3_clk: uartb3 {
> - compatible = "fixed-clock";
> - clock-frequency = <13000000>;
> - #clock-cells = <0>;
> + clock-frequency = <52000000>;
> };
>
> usb_otg_ahb_clk: usb_otg_ahb {
> + #clock-cells = <0>;
> compatible = "fixed-clock";
> clock-frequency = <52000000>;
> + };
> +
> + ref_96m_clk: ref_96m {
> #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <96000000>;
> + };
> +
> + var_96m_clk: var_96m {
> + #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <96000000>;
> + };
> +
> + ref_104m_clk: ref_104m {
> + #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <104000000>;
> + };
> +
> + var_104m_clk: var_104m {
> + #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <104000000>;
> + };
> +
> + ref_156m_clk: ref_156m {
> + #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <156000000>;
> + };
> +
> + var_156m_clk: var_156m {
> + #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <156000000>;
> + };
> +
> + root_ccu: root_ccu {
> + compatible = BCM21664_DT_ROOT_CCU_COMPAT;
> + reg = <0x35001000 0x0f00>;
> + #clock-cells = <1>;
> + clock-output-names = "frac_1m";
> + };
> +
> + aon_ccu: aon_ccu {
> + compatible = BCM21664_DT_AON_CCU_COMPAT;
> + reg = <0x35002000 0x0f00>;
> + #clock-cells = <1>;
> + clock-output-names = "hub_timer";
> + };
> +
> + master_ccu: master_ccu {
> + compatible = BCM21664_DT_MASTER_CCU_COMPAT;
> + reg = <0x3f001000 0x0f00>;
> + #clock-cells = <1>;
> + clock-output-names = "sdio1",
> + "sdio2",
> + "sdio3",
> + "sdio4",
> + "sdio1_sleep",
> + "sdio2_sleep",
> + "sdio3_sleep",
> + "sdio4_sleep";
> + };
> +
> + slave_ccu: slave_ccu {
> + compatible = BCM21664_DT_SLAVE_CCU_COMPAT;
> + reg = <0x3e011000 0x0f00>;
> + #clock-cells = <1>;
> + clock-output-names = "uartb",
> + "uartb2",
> + "uartb3",
> + "bsc1",
> + "bsc2",
> + "bsc3",
> + "bsc4";
> };
> };
>
> --
> 1.9.1
>

2014-04-26 03:02:19

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH v2 RESEND 0/5] clk: bcm21664: add common clock support

On Fri, Apr 25, 2014 at 05:09:15PM -0700, Mike Turquette wrote:
> Quoting Alex Elder (2014-04-21 14:26:22)
> > This is series has two parts. The first two patches are changes
> > to the existing Broadcom Kona family clock code to prepare for the
> > addition of support for another SoC, bcm21664.
> >
> > The remaining three define the binding and code for bcm21664, and
> > replace the use of "fake" clocks in the device tree with the real
> > ones. This ends up being a fairly straightforward definition of
> > the clocks on this SoC; the rest of the clock code is shared with
> > other SoCs that use the Kona style clock system.
>
> Hi Alex,
>
> I'm happy to take only the clk patches or I can take the DT stuff as
> well if it gets some Acks. Let me know how you want it handled.

Hi Mike,

Since there's a strict ordering requirement in this series (due to
shared use of a DT include by the driver and dts) I'd like it if you
could take the entire series through your tree to keep these together.
I've acked the dts patch.

Thanks,
Matt

> > This series depends on the following patch, which has been taken
> > into the clk-fixes tree:
> > clk: bcm281xx: don't use unnamed structs or unions
> > https://lkml.org/lkml/2014/4/7/322
> >
> > In addition, it depends on the version 4 of the following series,
> > just (re)posted for review:
> > clk: bcm281xx: updates
> > https://lkml.org/lkml/2014/4/8/485
> >
> > The patches in this series--based on the current linus/master branch
> > plus the patches mentioned above--are available here:
> > http://git.linaro.org/git/landing-teams/working/broadcom/kernel.git
> > Branch review/bcm21664-clock-v2
> >
> > Alex Elder (5):
> > clk: bcm281xx: move compatible string definitions
> > ARM: dts: revise kona clock binding document
> > ARM: dts: define clock binding for bcm21664
> > clk: bcm21664: use common clock framework
> > ARM: dts: use real clocks for bcm21664
> >
> > .../devicetree/bindings/clock/bcm-kona-clock.txt | 116 ++++++---
> > arch/arm/boot/dts/bcm21664.dtsi | 190 +++++++++-----
> > drivers/clk/bcm/Kconfig | 2 +-
> > drivers/clk/bcm/Makefile | 1 +
> > drivers/clk/bcm/clk-bcm21664.c | 290 +++++++++++++++++++++
> > drivers/clk/bcm/clk-bcm281xx.c | 12 -
> > include/dt-bindings/clock/bcm21664.h | 62 +++++
> > include/dt-bindings/clock/bcm281xx.h | 12 +
> > 8 files changed, 565 insertions(+), 120 deletions(-)
> > create mode 100644 drivers/clk/bcm/clk-bcm21664.c
> > create mode 100644 include/dt-bindings/clock/bcm21664.h
> >
> > --
> > 1.9.1