Skip to contentSkip to conversation

clk: sirf: add CSR atlas7 clk and reset support

PATCH New Barry Song 2 participants 4 messages May 20, 2015

Subsystems (2)
lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH v4 1/2 clk: sirf: add CSR atlas7 clk and reset support

From: Zhiwu Song <[email protected]>

the hardware node includes both clock and reset support, so it is named as "car".
this patch implements Flexible clocks(mux, divider, gate), Selectable clock(mux, divider, gate), root clock(gate),leaf clock(gate), others. it also implements the reset controller functionality.

---
-v4: fix checkpatch issues;
drop unless headfile;
add const;

 .../devicetree/bindings/clock/csr,atlas7-car.txt   |   55 +
 drivers/clk/sirf/Makefile                          |    2 +-
 drivers/clk/sirf/clk-atlas7.c                      | 1633 ++++++++++++++++++++
 3 files changed, 1689 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/clock/csr,atlas7-car.txt
 create mode 100644 drivers/clk/sirf/clk-atlas7.c
Documentation/devicetree/bindings/clock/csr,atlas7-car.txt new file +55 -0
new file mode 100644
index 0000000..54d6d13
@@ -0,0 +1,55 @@
+* Clock and reset bindings for CSR atlas7
+
+Required properties:
+- compatible: Should be "sirf,atlas7-car"
+- reg: Address and length of the register set
+- #clock-cells: Should be <1>
+- #reset-cells: Should be <1>
+
+The clock consumer should specify the desired clock by having the clock
+ID in its "clocks" phandle cell.
+The ID list atlas7_clks defined in drivers/clk/sirf/clk-atlas7.c
+
+The reset consumer should specify the desired reset by having the reset
+ID in its "reset" phandle cell.
+The ID list atlas7_reset_unit defined in drivers/clk/sirf/clk-atlas7.c
+
+Examples: Clock and reset controller node:
+
+car: clock-controller at 18620000 {
+	compatible = "sirf,atlas7-car";
+	reg = <0x18620000 0x1000>;
+	#clock-cells = <1>;
+	#reset-cells = <1>;
+};
+
+Examples: Consumers using clock or reset:
+
+timer at 10dc0000 {
+	compatible = "sirf,macro-tick";
+	reg = <0x10dc0000 0x1000>;
+	clocks = <&car 54>;
+	interrupts = <0 0 0>,
+		   <0 1 0>,
+		   <0 2 0>,
+		   <0 49 0>,
+		   <0 50 0>,
+		   <0 51 0>;
+};
+
+uart1: uart at 18020000 {
+	cell-index = <1>;
+	compatible = "sirf,macro-uart";
+	reg = <0x18020000 0x1000>;
+	clocks = <&clks 95>;
+	interrupts = <0 18 0>;
+	fifosize = <32>;
+};
+
+vpp at 13110000 {
+	compatible = "sirf,prima2-vpp";
+	reg = <0x13110000 0x10000>;
+	interrupts = <0 31 0>;
+	clocks = <&car 85>;
+	resets = <&car 29>;
+};
drivers/clk/sirf/Makefile +1 -1
index 36b8e20..09b4210 100644
@@ -2,4 +2,4 @@
 # Makefile for sirf specific clk
 #
 
-obj-$(CONFIG_ARCH_SIRF) += clk-prima2.o clk-atlas6.o
+obj-$(CONFIG_ARCH_SIRF) += clk-prima2.o clk-atlas6.o clk-atlas7.o
drivers/clk/sirf/clk-atlas7.c new file +1633 -0

1,633 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v4 2/2 ARM: dts: atlas7: add fixed frequency clocks in car node

From: Guo Zeng <[email protected]>

This patch adds the fixed clocks of external crystal oscillators.

---
-v4: move the clocks to be global;

 arch/arm/boot/dts/atlas7.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/boot/dts/atlas7.dtsi +18 -0
index a753178..1760dac 100644
@@ -38,6 +38,24 @@
 		};
 	};
 
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		xinw {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+			clock-frequency = <32768>;
+			clock-output-names = "xinw";
+		};
+		xin {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+			clock-frequency = <26000000>;
+			clock-output-names = "xin";
+		};
+	};
+
 	noc {
 		compatible = "simple-bus";
 		#address-cells = <1>;
Signature · 1 line
1.9.1
#2 lore raw

PATCH v4 2/2 ARM: dts: atlas7: add fixed frequency clocks in car node

Quoted 17 lines · Barry Song

From: Guo Zeng <[email protected]>

This patch adds the fixed clocks of external crystal oscillators.

---
-v4: move the clocks to be global;

 arch/arm/boot/dts/atlas7.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/boot/dts/atlas7.dtsi +0 -0
index a753178..1760dac 100644

arch/arm/boot/dts/atlas7.dtsi line 43

Quoted 6 lines
arch/arm/boot/dts/atlas7.dtsi +3 -0
@@ -38,6 +38,24 @@
 		};
 	};
 
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <1>;

This isn't necessary right? I dropped it and applied it.

----8<-----

arch/arm/boot/dts/atlas7.dtsi +0 -3
index 1760dac6a2b0..5dfd3a44bf82 100644
@@ -39,9 +39,6 @@
 	};
 
 	clocks {
-		#address-cells = <1>;
-		#size-cells = <1>;
-
 		xinw {
 			compatible = "fixed-clock";
 			#clock-cells = <0>;
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
Applied
#3 lore raw

PATCH v4 1/2 clk: sirf: add CSR atlas7 clk and reset support

In reply to Barry Song
Quoted 8 lines · Barry Song

From: Zhiwu Song <[email protected]>

the hardware node includes both clock and reset support, so it is named as "car".
this patch implements Flexible clocks(mux, divider, gate), Selectable clock(mux, divider, gate), root clock(gate),leaf clock(gate), others. it also implements the reset controller functionality.

Quoted 4 lines

---

Applied to clk-next with two checkpatches squelched

WARNING: __initdata should be placed after divider_list[] #740: FILE: drivers/clk/sirf/clk-atlas7.c:637:
+static __initdata struct atlas7_div_init_data divider_list[] = {

WARNING: static const char * array should probably be static const char * const #1061: FILE: drivers/clk/sirf/clk-atlas7.c:958:
+static const char *vip_clk_parents[] = {

---8<----

drivers/clk/sirf/clk-atlas7.c +2 -2
index aeb6cfb4e72f..7e36d9623a4b 100644
@@ -634,7 +634,7 @@ static struct clk_dto clk_disp1_dto = {
 	},
 };
 
-static __initdata struct atlas7_div_init_data divider_list[] = {
+static struct atlas7_div_init_data divider_list[] __initdata = {
 	/* div_name, parent_name, gate_name, clk_flag, divider_flag, gate_flag, div_offset, shift, wdith, gate_offset, bit_enable, lock */
 	{ "sys0pll_qa1", "sys0pll_fixdiv", "sys0pll_a1", 0, 0, 0, SIRFSOC_CLKC_USBPHY_CLKDIV_CFG, 0, 6, SIRFSOC_CLKC_USBPHY_CLKDIV_ENA, 0, &usbphy_div_lock },
 	{ "sys1pll_qa1", "sys1pll_fixdiv", "sys1pll_a1", 0, 0, 0, SIRFSOC_CLKC_USBPHY_CLKDIV_CFG, 8, 6, SIRFSOC_CLKC_USBPHY_CLKDIV_ENA, 4, &usbphy_div_lock },
@@ -955,7 +955,7 @@ static const char * const sdr_clk_parents[] = {
 	"sys1pll_a17",
 };
 
-static const char *vip_clk_parents[] = {
+static const char * const vip_clk_parents[] = {
 	"xin",
 	"xinw",
 	"sys2pll_a20",
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project