Skip to contentSkip to conversation

clk: sunxi: Unify sun4i apb1 clock

PATCH Superseded Chen-Yu Tsai 1 participant 5 messages Nov 6, 2014

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

cover clk: sunxi: Unify sun4i apb1 clock

Hi everyone,

This series unifies the apb1 clock driver for sun4i, which was previously split into apb1-mux and apb1. This also fixes the apb2 clock on sun6i/sun8i, which we now have documents for.

The first 2 patches were done by Emilio.

Patch 1 unifies the apb1-mux and apb1 clock drivers using a factors clock.

Patch 2 unifies said clocks in the dtsi.

Patch 3 switches the compatibles for apb2 clock on sun6i/sun8i to the unified sun4i apb1 clock.

Patch 4 gets rid of the incorrect and now unused sun6i apb2 clock driver.

Cheers
ChenYu

Chen-Yu Tsai (2):
ARM: dts: sunxi: Use sun4i-a10-apb1-clk for sun6i/sun8i apb2 clocks.
clk: sunxi: Removed unused/incorrect sun6i-a31-apb2-clk driver

Emilio López (2):
clk: sunxi: unify APB1 clock
ARM: dts: sunxi: unify APB1 clock

 Documentation/devicetree/bindings/clock/sunxi.txt |  2 --
 arch/arm/boot/dts/sun4i-a10.dtsi                  | 12 ++----------
 arch/arm/boot/dts/sun5i-a10s.dtsi                 | 12 ++----------
 arch/arm/boot/dts/sun5i-a13.dtsi                  | 12 ++----------
 arch/arm/boot/dts/sun6i-a31.dtsi                  | 12 ++----------
 arch/arm/boot/dts/sun7i-a20.dtsi                  | 12 ++----------
 arch/arm/boot/dts/sun8i-a23.dtsi                  | 12 ++----------
 drivers/clk/sunxi/clk-sunxi.c                     | 14 ++------------
 8 files changed, 14 insertions(+), 74 deletions(-)
Signature · 1 line
2.1.1
#1 lore raw

PATCH 1/4 clk: sunxi: unify APB1 clock

From: Emilio López <[email protected]>

This commit unifies the APB1 mux with the APB1 clock, using the new factors infrastructure.

---
 Documentation/devicetree/bindings/clock/sunxi.txt | 1 -
 drivers/clk/sunxi/clk-sunxi.c                     | 7 ++-----
 2 files changed, 2 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/clock/sunxi.txt +0 -1
index 0455cb9..6ddcf6e 100644
@@ -45,7 +45,6 @@ Required properties:
 	"allwinner,sun9i-a80-apb0-gates-clk" - for the APB0 gates on A80
 	"allwinner,sun4i-a10-apb1-clk" - for the APB1 clock
 	"allwinner,sun9i-a80-apb1-clk" - for the APB1 bus clock on A80
-	"allwinner,sun4i-a10-apb1-mux-clk" - for the APB1 clock muxing
 	"allwinner,sun4i-a10-apb1-gates-clk" - for the APB1 gates on A10
 	"allwinner,sun5i-a13-apb1-gates-clk" - for the APB1 gates on A13
 	"allwinner,sun5i-a10s-apb1-gates-clk" - for the APB1 gates on A10s
drivers/clk/sunxi/clk-sunxi.c +2 -5
index 20f47c6..4133e27 100644
@@ -507,6 +507,8 @@ static const struct factors_data sun6i_a31_pll6_data __initconst = {
 };
 
 static const struct factors_data sun4i_apb1_data __initconst = {
+	.mux = 24,
+	.muxmask = BIT(1) | BIT(0),
 	.table = &sun4i_apb1_config,
 	.getter = sun4i_get_apb1_factors,
 };
@@ -545,10 +547,6 @@ static const struct mux_data sun6i_a31_ahb1_mux_data __initconst = {
 	.shift = 12,
 };
 
-static const struct mux_data sun4i_apb1_mux_data __initconst = {
-	.shift = 24,
-};
-
 static void __init sunxi_mux_clk_setup(struct device_node *node,
 				       struct mux_data *data)
 {
@@ -1109,7 +1107,6 @@ static const struct of_device_id clk_divs_match[] __initconst = {
 /* Matches for mux clocks */
 static const struct of_device_id clk_mux_match[] __initconst = {
 	{.compatible = "allwinner,sun4i-a10-cpu-clk", .data = &sun4i_cpu_mux_data,},
-	{.compatible = "allwinner,sun4i-a10-apb1-mux-clk", .data = &sun4i_apb1_mux_data,},
 	{.compatible = "allwinner,sun6i-a31-ahb1-mux-clk", .data = &sun6i_a31_ahb1_mux_data,},
 	{}
 };
Signature · 1 line
2.1.1
#2 lore raw

PATCH 2/4 ARM: dts: sunxi: unify APB1 clock

In reply to Chen-Yu Tsai

From: Emilio López <[email protected]>

With the new factors infrastructure in place, we can unify apb1 and apb1_mux as a single clock now.

[[email protected]: Change apb1 node label to "apb1"; reword commit title]
---
 arch/arm/boot/dts/sun4i-a10.dtsi  | 12 ++----------
 arch/arm/boot/dts/sun5i-a10s.dtsi | 12 ++----------
 arch/arm/boot/dts/sun5i-a13.dtsi  | 12 ++----------
 arch/arm/boot/dts/sun7i-a20.dtsi  | 12 ++----------
 4 files changed, 8 insertions(+), 40 deletions(-)
arch/arm/boot/dts/sun4i-a10.dtsi +2 -10
index 380f914..5e2ec2d 100644
@@ -174,19 +174,11 @@
 				"apb0_ir1", "apb0_keypad";
 		};
 
-		apb1_mux: apb1_mux@01c20058 {
-			#clock-cells = <0>;
-			compatible = "allwinner,sun4i-a10-apb1-mux-clk";
-			reg = <0x01c20058 0x4>;
-			clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
-			clock-output-names = "apb1_mux";
-		};
-
-		apb1: apb1@01c20058 {
+		apb1: clk@01c20058 {
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-apb1-clk";
 			reg = <0x01c20058 0x4>;
-			clocks = <&apb1_mux>;
+			clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
 			clock-output-names = "apb1";
 		};
 
arch/arm/boot/dts/sun5i-a10s.dtsi +2 -10
index 531272c..d2a8514 100644
@@ -162,19 +162,11 @@
 				"apb0_ir", "apb0_keypad";
 		};
 
-		apb1_mux: apb1_mux@01c20058 {
-			#clock-cells = <0>;
-			compatible = "allwinner,sun4i-a10-apb1-mux-clk";
-			reg = <0x01c20058 0x4>;
-			clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
-			clock-output-names = "apb1_mux";
-		};
-
-		apb1: apb1@01c20058 {
+		apb1: clk@01c20058 {
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-apb1-clk";
 			reg = <0x01c20058 0x4>;
-			clocks = <&apb1_mux>;
+			clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
 			clock-output-names = "apb1";
 		};
 
arch/arm/boot/dts/sun5i-a13.dtsi +2 -10
index b131068..c35217e 100644
@@ -161,19 +161,11 @@
 			clock-output-names = "apb0_codec", "apb0_pio", "apb0_ir";
 		};
 
-		apb1_mux: apb1_mux@01c20058 {
-			#clock-cells = <0>;
-			compatible = "allwinner,sun4i-a10-apb1-mux-clk";
-			reg = <0x01c20058 0x4>;
-			clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
-			clock-output-names = "apb1_mux";
-		};
-
-		apb1: apb1@01c20058 {
+		apb1: clk@01c20058 {
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-apb1-clk";
 			reg = <0x01c20058 0x4>;
-			clocks = <&apb1_mux>;
+			clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
 			clock-output-names = "apb1";
 		};
 
arch/arm/boot/dts/sun7i-a20.dtsi +2 -10
index 45bb916..8605f2b 100644
@@ -222,19 +222,11 @@
 				"apb0_iis2", "apb0_keypad";
 		};
 
-		apb1_mux: apb1_mux@01c20058 {
-			#clock-cells = <0>;
-			compatible = "allwinner,sun4i-a10-apb1-mux-clk";
-			reg = <0x01c20058 0x4>;
-			clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
-			clock-output-names = "apb1_mux";
-		};
-
-		apb1: apb1@01c20058 {
+		apb1: clk@01c20058 {
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-apb1-clk";
 			reg = <0x01c20058 0x4>;
-			clocks = <&apb1_mux>;
+			clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
 			clock-output-names = "apb1";
 		};
 
Signature · 1 line
2.1.1
#3 lore raw

PATCH 3/4 ARM: dts: sunxi: Use sun4i-a10-apb1-clk for sun6i/sun8i apb2 clocks.

In reply to Chen-Yu Tsai

The apb2 clocks are actually the same as apb1 clocks on the other sunxi platforms, hence compatible with "allwinner,sun4i-a10-apb1-clk".

Update the dtsi to use the new unified apb1 clk.

---
 arch/arm/boot/dts/sun6i-a31.dtsi | 12 ++----------
 arch/arm/boot/dts/sun8i-a23.dtsi | 12 ++----------
 2 files changed, 4 insertions(+), 20 deletions(-)
arch/arm/boot/dts/sun6i-a31.dtsi +2 -10
index e80288e..3a51151 100644
@@ -217,19 +217,11 @@
 					"apb1_daudio1";
 		};
 
-		apb2_mux: apb2_mux@01c20058 {
+		apb2: clk@01c20058 {
 			#clock-cells = <0>;
-			compatible = "allwinner,sun4i-a10-apb1-mux-clk";
+			compatible = "allwinner,sun4i-a10-apb1-clk";
 			reg = <0x01c20058 0x4>;
 			clocks = <&osc32k>, <&osc24M>, <&pll6>, <&pll6>;
-			clock-output-names = "apb2_mux";
-		};
-
-		apb2: apb2@01c20058 {
-			#clock-cells = <0>;
-			compatible = "allwinner,sun6i-a31-apb2-div-clk";
-			reg = <0x01c20058 0x4>;
-			clocks = <&apb2_mux>;
 			clock-output-names = "apb2";
 		};
 
arch/arm/boot/dts/sun8i-a23.dtsi +2 -10
index 6086adb..0746cd1 100644
@@ -189,19 +189,11 @@
 					"apb1_daudio0",	"apb1_daudio1";
 		};
 
-		apb2_mux: apb2_mux_clk@01c20058 {
+		apb2: clk@01c20058 {
 			#clock-cells = <0>;
-			compatible = "allwinner,sun4i-a10-apb1-mux-clk";
+			compatible = "allwinner,sun4i-a10-apb1-clk";
 			reg = <0x01c20058 0x4>;
 			clocks = <&osc32k>, <&osc24M>, <&pll6>, <&pll6>;
-			clock-output-names = "apb2_mux";
-		};
-
-		apb2: apb2_clk@01c20058 {
-			#clock-cells = <0>;
-			compatible = "allwinner,sun6i-a31-apb2-div-clk";
-			reg = <0x01c20058 0x4>;
-			clocks = <&apb2_mux>;
 			clock-output-names = "apb2";
 		};
 
Signature · 1 line
2.1.1
#4 lore raw

PATCH 4/4 clk: sunxi: Removed unused/incorrect sun6i-a31-apb2-clk driver

In reply to Chen-Yu Tsai

This driver does not match the hardware, which is actually compatible to sun4i-a10-apb1-clk. Since we've switch to the correct one, drop this driver.

---
 Documentation/devicetree/bindings/clock/sunxi.txt | 1 -
 drivers/clk/sunxi/clk-sunxi.c                     | 7 -------
 2 files changed, 8 deletions(-)
Documentation/devicetree/bindings/clock/sunxi.txt +0 -1
index 6ddcf6e..d199f91 100644
@@ -52,7 +52,6 @@ Required properties:
 	"allwinner,sun7i-a20-apb1-gates-clk" - for the APB1 gates on A20
 	"allwinner,sun8i-a23-apb1-gates-clk" - for the APB1 gates on A23
 	"allwinner,sun9i-a80-apb1-gates-clk" - for the APB1 gates on A80
-	"allwinner,sun6i-a31-apb2-div-clk" - for the APB2 gates on A31
 	"allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31
 	"allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23
 	"allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13
drivers/clk/sunxi/clk-sunxi.c +0 -7
index 4133e27..46d98e3 100644
@@ -632,12 +632,6 @@ static const struct div_data sun4i_apb0_data __initconst = {
 	.table	= sun4i_apb0_table,
 };
 
-static const struct div_data sun6i_a31_apb2_div_data __initconst = {
-	.shift	= 0,
-	.pow	= 0,
-	.width	= 4,
-};
-
 static void __init sunxi_divider_clk_setup(struct device_node *node,
 					   struct div_data *data)
 {
@@ -1093,7 +1087,6 @@ static const struct of_device_id clk_div_match[] __initconst = {
 	{.compatible = "allwinner,sun8i-a23-axi-clk", .data = &sun8i_a23_axi_data,},
 	{.compatible = "allwinner,sun4i-a10-ahb-clk", .data = &sun4i_ahb_data,},
 	{.compatible = "allwinner,sun4i-a10-apb0-clk", .data = &sun4i_apb0_data,},
-	{.compatible = "allwinner,sun6i-a31-apb2-div-clk", .data = &sun6i_a31_apb2_div_data,},
 	{}
 };
 
Signature · 1 line
2.1.1