Skip to contentSkip to conversation

dt-bindings: documentation: add clock bindings information for Stratix10

PATCH Superseded Dinh Nguyen 2 participants 4 messages Feb 13, 2018

Subsystems (4)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Dinh Nguyen

author maintainer
#0 lore raw

PATCH v4 1/3 dt-bindings: documentation: add clock bindings information for Stratix10

Document that Stratix10 clock bindings, and add the clock header file. The clock header is an enumeration of all the different clocks on the Stratix10 platform.

---
v4:
- remove '_' in node names
- remove stray tab
- add clock-frequency property for fixed-clocks
- put SPDX license as the very top line
v3:
- s/intc/intel for correct vendor prefix
- fixup node name to "intel,stratix10-clkmgr"
- document the required fixed-clock for oscillators v2:
- use a single binding for the clock controller

---
 .../devicetree/bindings/clock/intc_stratix10.txt   | 51 +++++++++++++
 include/dt-bindings/clock/stratix10-clock.h        | 84 ++++++++++++++++++++++
 2 files changed, 135 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/intc_stratix10.txt
 create mode 100644 include/dt-bindings/clock/stratix10-clock.h
Documentation/devicetree/bindings/clock/intc_stratix10.txt new file +51 -0
new file mode 100644
index 0000000..0652ff1
@@ -0,0 +1,51 @@
+Device Tree Clock bindings for Intel's SoCFPGA Stratix10 platform
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : shall be
+	"intel,stratix10-clkmgr"
+
+- reg : shall be the control register offset from CLOCK_MANAGER's base for the clock.
+
+- #clock-cells : from common clock binding, shall be set to 1.
+
+- clocks : Should contain fixed-clock sources, such as oscillators.
+
+Example:
+	clkmgr: clock-controller at ffd10000 {
+		compatible = "intel,stratix10-clkmgr";
+		reg = <0xffd10000 0x1000>;
+		#clock-cells = <1>;
+
+		clocks {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			cb_intosc_hs_div2_clk: cb-intosc-hs-div2-clk {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <25000000>;
+			};
+
+			cb_intosc_ls_clk: cb-intosc-ls-clk {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <25000000>;
+			};
+
+			f2s_free_clk: f2s-free-clk {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <25000000>;
+			};
+
+			osc1: osc1 {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <25000000>;
+			};
+		};
+	};
include/dt-bindings/clock/stratix10-clock.h new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH v4 2/3 arm64: dts: stratix10: use clock bindings for the Stratix10 platform

Use the clock bindings for the Stratix10 SoC. This includes changing the old binding of "intc,clk-s10-mgr" to "intel,stratix10-clkmgr". The reason that this can be done is that there are currently no clock driver for Stratix10, thus there are no consumers of the old binding. So changing the binding will not break any legacy code.

---
v4:
- remove '_' in name of clock nodes
- use clock-controller in SoCDK node in dts file v3:
- use the correct vendor prefix
- explain the binding change
v2:
- use a single clock binding for the clock controller

---
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi  | 50 +++++++++++++++++++++-
 .../boot/dts/altera/socfpga_stratix10_socdk.dts    | 10 +++++
 2 files changed, 58 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +48 -2
index c89d0c30..5a6a699 100644
@@ -17,6 +17,7 @@
 /dts-v1/;
 #include <dt-bindings/reset/altr,rst-mgr-s10.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/clock/stratix10-clock.h>
 
 / {
 	compatible = "altr,socfpga-stratix10";
@@ -92,9 +93,35 @@
 		interrupt-parent = <&intc>;
 		ranges = <0 0 0 0xffffffff>;
 
-		clkmgr at ffd1000 {
-			compatible = "altr,clk-mgr";
+		clkmgr: clock-controller at ffd10000 {
+			compatible = "intel,stratix10-clkmgr";
 			reg = <0xffd10000 0x1000>;
+			#clock-cells = <1>;
+
+			clocks {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				cb_intosc_hs_div2_clk: cb-intosc-hs-div2-clk {
+					#clock-cells = <0>;
+					compatible = "fixed-clock";
+				};
+
+				cb_intosc_ls_clk: cb-intosc-ls-clk {
+					#clock-cells = <0>;
+					compatible = "fixed-clock";
+				};
+
+				f2s_free_clk: f2s-free-clk {
+					#clock-cells = <0>;
+					compatible = "fixed-clock";
+				};
+
+				osc1: osc1 {
+					#clock-cells = <0>;
+					compatible = "fixed-clock";
+				};
+			};
 		};
 
 		gmac0: ethernet at ff800000 {
@@ -105,6 +132,8 @@
 			mac-address = [00 00 00 00 00 00];
 			resets = <&rst EMAC0_RESET>;
 			reset-names = "stmmaceth";
+			clocks = <&clkmgr STRATIX10_EMAC0_CLK>;
+			clock-names = "stmmaceth";
 			status = "disabled";
 		};
 
@@ -116,6 +145,8 @@
 			mac-address = [00 00 00 00 00 00];
 			resets = <&rst EMAC1_RESET>;
 			reset-names = "stmmaceth";
+			clocks = <&clkmgr STRATIX10_EMAC1_CLK>;
+			clock-names = "stmmaceth";
 			status = "disabled";
 		};
 
@@ -127,6 +158,8 @@
 			mac-address = [00 00 00 00 00 00];
 			resets = <&rst EMAC2_RESET>;
 			reset-names = "stmmaceth";
+			clocks = <&clkmgr STRATIX10_EMAC2_CLK>;
+			clock-names = "stmmaceth";
 			status = "disabled";
 		};
 
@@ -229,6 +262,9 @@
 			fifo-depth = <0x400>;
 			resets = <&rst SDMMC_RESET>;
 			reset-names = "reset";
+			clocks = <&clkmgr STRATIX10_L4_MP_CLK>,
+				 <&clkmgr STRATIX10_SDMMC_CLK>;
+			clock-names = "biu", "ciu";
 			status = "disabled";
 		};
 
@@ -288,24 +324,32 @@
 			compatible = "snps,dw-apb-timer";
 			interrupts = <0 113 4>;
 			reg = <0xffc03000 0x100>;
+			clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
+			clock-names = "timer";
 		};
 
 		timer1: timer1 at ffc03100 {
 			compatible = "snps,dw-apb-timer";
 			interrupts = <0 114 4>;
 			reg = <0xffc03100 0x100>;
+			clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
+			clock-names = "timer";
 		};
 
 		timer2: timer2 at ffd00000 {
 			compatible = "snps,dw-apb-timer";
 			interrupts = <0 115 4>;
 			reg = <0xffd00000 0x100>;
+			clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
+			clock-names = "timer";
 		};
 
 		timer3: timer3 at ffd00100 {
 			compatible = "snps,dw-apb-timer";
 			interrupts = <0 116 4>;
 			reg = <0xffd00100 0x100>;
+			clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
+			clock-names = "timer";
 		};
 
 		uart0: serial0 at ffc02000 {
@@ -315,6 +359,7 @@
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			resets = <&rst UART0_RESET>;
+			clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
 			status = "disabled";
 		};
 
@@ -325,6 +370,7 @@
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			resets = <&rst UART1_RESET>;
+			clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
 			status = "disabled";
 		};
 
arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts +10 -0
index 0007564..b7f0b6b 100644
@@ -50,6 +50,16 @@
 		/* We expect the bootloader to fill in the reg */
 		reg = <0 0 0 0>;
 	};
+
+	soc {
+		clock-controller at ffd10000 {
+			clocks {
+				osc1 {
+					clock-frequency = <25000000>;
+				};
+			};
+		};
+	};
 };
 
 &gpio1 {
Signature · 1 line
2.7.4
author maintainer
#2 lore raw

PATCH v4 3/3 clk: socfpga: stratix10: add clock driver for Stratix10 platform

In reply to Dinh Nguyen

Add a clock driver for the Stratix10 SoC. The driver is similar to the Cyclone5/Arria10 platforms, with the exception that this driver only uses one single clock binding.

---
v4:
- move SPDX license first line of all files
v3:
- use fixed binding "intel,stratix10-clkmgr"
- Fix up SPDX license header
v2:
- Use a single clock binding

---
 drivers/clk/Makefile                 |   1 +
 drivers/clk/socfpga/Makefile         |   5 +
 drivers/clk/socfpga/clk-gate-s10.c   | 103 +++++++++++
 drivers/clk/socfpga/clk-periph-s10.c | 148 ++++++++++++++++
 drivers/clk/socfpga/clk-pll-s10.c    | 140 +++++++++++++++
 drivers/clk/socfpga/clk-s10.c        | 319 +++++++++++++++++++++++++++++++++++
 drivers/clk/socfpga/clk.h            |   4 +
 drivers/clk/socfpga/stratix10-clk.h  |  86 ++++++++++
 8 files changed, 806 insertions(+)
 create mode 100644 drivers/clk/socfpga/clk-gate-s10.c
 create mode 100644 drivers/clk/socfpga/clk-periph-s10.c
 create mode 100644 drivers/clk/socfpga/clk-pll-s10.c
 create mode 100644 drivers/clk/socfpga/clk-s10.c
 create mode 100644 drivers/clk/socfpga/stratix10-clk.h
drivers/clk/Makefile +1 -0
index 71ec41e..80ab422 100644
@@ -88,6 +88,7 @@ obj-$(CONFIG_ARCH_SOCFPGA)		+= socfpga/
 obj-$(CONFIG_PLAT_SPEAR)		+= spear/
 obj-$(CONFIG_ARCH_SPRD)			+= sprd/
 obj-$(CONFIG_ARCH_STI)			+= st/
+obj-$(CONFIG_ARCH_STRATIX10)		+= socfpga/
 obj-$(CONFIG_ARCH_SUNXI)		+= sunxi/
 obj-$(CONFIG_ARCH_SUNXI)		+= sunxi-ng/
 obj-$(CONFIG_ARCH_TEGRA)		+= tegra/
drivers/clk/socfpga/Makefile +5 -0
index 9146c20..87ef977 100644
@@ -1,6 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0
+ifeq ($(CONFIG_ARCH_SOCFPGA),y)
 obj-y += clk.o
 obj-y += clk-gate.o
 obj-y += clk-pll.o
 obj-y += clk-periph.o
 obj-y += clk-pll-a10.o clk-periph-a10.o clk-gate-a10.o
+else
+obj-y += clk-s10.o
+obj-y += clk-pll-s10.o clk-periph-s10.o clk-gate-s10.o
+endif
drivers/clk/socfpga/clk-gate-s10.c new file +103 -0

103 lines not on this page · raw message

drivers/clk/socfpga/clk-periph-s10.c new file +148 -0

148 lines not on this page · raw message

drivers/clk/socfpga/clk-pll-s10.c new file +140 -0

140 lines not on this page · raw message

drivers/clk/socfpga/clk-s10.c new file +319 -0

319 lines not on this page · raw message

drivers/clk/socfpga/clk.h +4 -0
index 9cf1230..26c3a26 100644
@@ -54,9 +54,11 @@ struct socfpga_gate_clk {
 	char *parent_name;
 	u32 fixed_div;
 	void __iomem *div_reg;
+	void __iomem *bypass_reg;
 	struct regmap *sys_mgr_base_addr;
 	u32 width;	/* only valid if div_reg != 0 */
 	u32 shift;	/* only valid if div_reg != 0 */
+	u32 bypass_shift;      /* only valid if bypass_reg != 0 */
 	u32 clk_phase[2];
 };
 
@@ -65,8 +67,10 @@ struct socfpga_periph_clk {
 	char *parent_name;
 	u32 fixed_div;
 	void __iomem *div_reg;
+	void __iomem *bypass_reg;
 	u32 width;      /* only valid if div_reg != 0 */
 	u32 shift;      /* only valid if div_reg != 0 */
+	u32 bypass_shift;      /* only valid if bypass_reg != 0 */
 };
 
 #endif /* SOCFPGA_CLK_H */
drivers/clk/socfpga/stratix10-clk.h new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
2.7.4
#3 lore raw

PATCH v4 1/3 dt-bindings: documentation: add clock bindings information for Stratix10

In reply to Dinh Nguyen
Quoted 87 lines · Dinh Nguyen

Document that Stratix10 clock bindings, and add the clock header file. The clock header is an enumeration of all the different clocks on the Stratix10 platform.

---
v4:
- remove '_' in node names
- remove stray tab
- add clock-frequency property for fixed-clocks
- put SPDX license as the very top line
v3:
- s/intc/intel for correct vendor prefix
- fixup node name to "intel,stratix10-clkmgr"
- document the required fixed-clock for oscillators v2:
- use a single binding for the clock controller

---
 .../devicetree/bindings/clock/intc_stratix10.txt   | 51 +++++++++++++
 include/dt-bindings/clock/stratix10-clock.h        | 84 ++++++++++++++++++++++
 2 files changed, 135 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/intc_stratix10.txt
 create mode 100644 include/dt-bindings/clock/stratix10-clock.h
Documentation/devicetree/bindings/clock/intc_stratix10.txt new file +51 -0
new file mode 100644
index 0000000..0652ff1
@@ -0,0 +1,51 @@
+Device Tree Clock bindings for Intel's SoCFPGA Stratix10 platform
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : shall be
+       "intel,stratix10-clkmgr"
+
+- reg : shall be the control register offset from CLOCK_MANAGER's base for the clock.
+
+- #clock-cells : from common clock binding, shall be set to 1.
+
+- clocks : Should contain fixed-clock sources, such as oscillators.
+
+Example:
+       clkmgr: clock-controller at ffd10000 {
+               compatible = "intel,stratix10-clkmgr";
+               reg = <0xffd10000 0x1000>;
+               #clock-cells = <1>;
+
+               clocks {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       cb_intosc_hs_div2_clk: cb-intosc-hs-div2-clk {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <25000000>;
+                       };
+
+                       cb_intosc_ls_clk: cb-intosc-ls-clk {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <25000000>;
+                       };
+
+                       f2s_free_clk: f2s-free-clk {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <25000000>;
+                       };
+
+                       osc1: osc1 {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <25000000>;
+                       };
+               };
+       };
include/dt-bindings/clock/stratix10-clock.h new file +0 -0
new file mode 100644
index 0000000..5be885d

include/dt-bindings/clock/stratix10-clock.h line 1

Quoted 1 line
include/dt-bindings/clock/stratix10-clock.h new file +1 -0
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier:    GPL-2.0

Sigh. Should be a single line comment and a single space:

/* SPDX-License-Identifier: GPL-2.0 */

With that,

Rob