Skip to contentSkip to conversation

clk: add BCM63268 timer clock and reset

PATCH Applied Álvaro Fernández Rojas 2 participants 9 messages Mar 22, 2023 – Mar 27, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover clk: add BCM63268 timer clock and reset

Broadcom BCM63268 has a timer clock and reset controller which has the following layout:

  #define POR_RESET_STATUS            (1 << 31)
  #define HW_RESET_STATUS             (1 << 30)
  #define SW_RESET_STATUS             (1 << 29)
  #define USB_REF_CLKEN               (1 << 18)
  #define UTO_EXTIN_CLKEN             (1 << 17)
  #define UTO_CLK50_SEL               (1 << 16)
  #define FAP2_PLL_CLKEN              (1 << 15)
  #define FAP2_PLL_FREQ_SHIFT         12
  #define FAP1_PLL_CLKEN              (1 << 11)
  #define FAP1_PLL_FREQ_SHIFT         8
  #define WAKEON_DSL                  (1 << 7)
  #define WAKEON_EPHY                 (1 << 6)
  #define DSL_ENERGY_DETECT_ENABLE    (1 << 4)

#define GPHY_1_ENERGY_DETECT_ENABLE (1 << 3)
#define EPHY_3_ENERGY_DETECT_ENABLE (1 << 2)
#define EPHY_2_ENERGY_DETECT_ENABLE (1 << 1)
#define EPHY_1_ENERGY_DETECT_ENABLE (1 << 0)

v4: add changes suggested by Stephen Boyd.
v3: add missing <linux/io.h> include to fix build warning
v2: add changes suggested by Stephen Boyd.

Álvaro Fernández Rojas (4):
dt-bindings: clk: add BCM63268 timer clock definitions
dt-bindings: reset: add BCM63268 timer reset definitions
dt-bindings: clock: Add BCM63268 timer binding
clk: bcm: Add BCM63268 timer clock and reset driver

 .../clock/brcm,bcm63268-timer-clocks.yaml     |  40 ++++
 drivers/clk/bcm/Kconfig                       |   9 +
 drivers/clk/bcm/Makefile                      |   1 +
 drivers/clk/bcm/clk-bcm63268-timer.c          | 215 ++++++++++++++++++
 include/dt-bindings/clock/bcm63268-clock.h    |  13 ++
 include/dt-bindings/reset/bcm63268-reset.h    |   4 +
 6 files changed, 282 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm63268-timer-clocks.yaml
 create mode 100644 drivers/clk/bcm/clk-bcm63268-timer.c
Signature · 1 line
2.30.2
#1 lore raw

PATCH v4 1/4 dt-bindings: clk: add BCM63268 timer clock definitions

Add missing timer clock definitions for BCM63268.

---
v4: no changes
v3: no changes
v2: change commit title, as suggested by Stephen Boyd

 include/dt-bindings/clock/bcm63268-clock.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
include/dt-bindings/clock/bcm63268-clock.h +13 -0
index da23e691d359..dea8adc8510e 100644
@@ -27,4 +27,17 @@
 #define BCM63268_CLK_TBUS	27
 #define BCM63268_CLK_ROBOSW250	31
 
+#define BCM63268_TCLK_EPHY1		0
+#define BCM63268_TCLK_EPHY2		1
+#define BCM63268_TCLK_EPHY3		2
+#define BCM63268_TCLK_GPHY1		3
+#define BCM63268_TCLK_DSL		4
+#define BCM63268_TCLK_WAKEON_EPHY	6
+#define BCM63268_TCLK_WAKEON_DSL	7
+#define BCM63268_TCLK_FAP1		11
+#define BCM63268_TCLK_FAP2		15
+#define BCM63268_TCLK_UTO_50		16
+#define BCM63268_TCLK_UTO_EXTIN		17
+#define BCM63268_TCLK_USB_REF		18
+
 #endif /* __DT_BINDINGS_CLOCK_BCM63268_H */
Signature · 1 line
2.30.2
#3 lore raw

PATCH v4 2/4 dt-bindings: reset: add BCM63268 timer reset definitions

In reply to Álvaro Fernández Rojas

Add missing timer reset definitions for BCM63268.

---
v4: no changes
v3: no changes
v2: change commit title, as suggested by Stephen Boyd

 include/dt-bindings/reset/bcm63268-reset.h | 4 ++++
 1 file changed, 4 insertions(+)
include/dt-bindings/reset/bcm63268-reset.h +4 -0
index 6a6403a4c2d5..d87a7882782a 100644
@@ -23,4 +23,8 @@
 #define BCM63268_RST_PCIE_HARD	17
 #define BCM63268_RST_GPHY	18
 
+#define BCM63268_TRST_SW	29
+#define BCM63268_TRST_HW	30
+#define BCM63268_TRST_POR	31
+
 #endif /* __DT_BINDINGS_RESET_BCM63268_H */
Signature · 1 line
2.30.2
#5 lore raw

PATCH v4 3/4 dt-bindings: clock: Add BCM63268 timer binding

In reply to Álvaro Fernández Rojas

Document the Broadcom BCM63268 Clock and Reset controller.

---
v4: no changes
v3: no changes
v2: no changes

 .../clock/brcm,bcm63268-timer-clocks.yaml     | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm63268-timer-clocks.yaml
Documentation/devicetree/bindings/clock/brcm,bcm63268-timer-clocks.yaml new file +40 -0
new file mode 100644
index 000000000000..199818b2fb6d
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/brcm,bcm63268-timer-clocks.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM63268 Timer Clock and Reset Device Tree Bindings
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+
+properties:
+  compatible:
+    const: brcm,bcm63268-timer-clocks
+
+  reg:
+    maxItems: 1
+
+  "#clock-cells":
+    const: 1
+
+  "#reset-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - "#clock-cells"
+  - "#reset-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    timer_clk: clock-controller@100000ac {
+      compatible = "brcm,bcm63268-timer-clocks";
+      reg = <0x100000ac 0x4>;
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+    };
Signature · 1 line
2.30.2
#7 lore raw

PATCH v4 4/4 clk: bcm: Add BCM63268 timer clock and reset driver

In reply to Álvaro Fernández Rojas

Add driver for BCM63268 timer clock and reset controller.

---
v4: add changes suggested by Stephen Boyd:
- Usage of of_device_get_match_data() isn't needed.
- Use devm_clk_hw_register_gate().
- Drop clk_hw_unregister_gate().
v3: add missing <linux/io.h> include to fix build warning
v2: add changes suggested by Stephen Boyd

 drivers/clk/bcm/Kconfig              |   9 ++
 drivers/clk/bcm/Makefile             |   1 +
 drivers/clk/bcm/clk-bcm63268-timer.c | 215 +++++++++++++++++++++++++++
 3 files changed, 225 insertions(+)
 create mode 100644 drivers/clk/bcm/clk-bcm63268-timer.c
drivers/clk/bcm/Kconfig +9 -0
index 77266afb1c79..a972d763eb77 100644
@@ -37,6 +37,15 @@ config CLK_BCM_63XX_GATE
 	  Enable common clock framework support for Broadcom BCM63xx DSL SoCs
 	  based on the MIPS architecture
 
+config CLK_BCM63268_TIMER
+	bool "Broadcom BCM63268 timer clock and reset support"
+	depends on BMIPS_GENERIC || COMPILE_TEST
+	default BMIPS_GENERIC
+	select RESET_CONTROLLER
+	help
+	  Enable timer clock and reset support for Broadcom BCM63268 DSL SoCs
+	  based on the MIPS architecture.
+
 config CLK_BCM_KONA
 	bool "Broadcom Kona CCU clock support"
 	depends on ARCH_BCM_MOBILE || COMPILE_TEST
drivers/clk/bcm/Makefile +1 -0
index edb66b44cb27..d0b6f4b1fb08 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_CLK_BCM_63XX)	+= clk-bcm63xx.o
 obj-$(CONFIG_CLK_BCM_63XX_GATE)	+= clk-bcm63xx-gate.o
+obj-$(CONFIG_CLK_BCM63268_TIMER) += clk-bcm63268-timer.o
 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
drivers/clk/bcm/clk-bcm63268-timer.c new file +215 -0

215 lines not on this page · raw message

Signature · 1 line
2.30.2
maintainer Applied
#8 lore raw

Re: [PATCH v4 4/4] clk: bcm: Add BCM63268 timer clock and reset driver

Quoting Álvaro Fernández Rojas (2023-03-22 10:15:15)

Quoted 4 lines

Add driver for BCM63268 timer clock and reset controller.

---

Applied to clk-next