Skip to contentSkip to conversation

clk: sunxi: add A20 external output clock support

PATCH New Chen-Yu Tsai 2 participants 12 messages Jan 1, 2014 – Jan 2, 2014

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

v3 cover clk: sunxi: add A20 external output clock support

Hi everyone,

This is v3 of A20 external output clock support patch series, addressing issues raised by Maxime.

The patch series builds upon Emilio's clock series, and adds support for external output clocks on the Allwinner A20 SoC. The outputs can be used to supply a stable clock to external modules, such as WiFi or Bluetooth.

Mike Turquette has already taken patch #1 via Emilio's pull request.

Changes since v2:

- #2, #3: Change dummy clock names to clk at N
- #5: Change pin mux labels to clk_out_[ab]_pins_a

Changes since v1:

- Add clock binding to sunxi clock DT binding documentation
- Rename clock nodes to match device tree conventions
- Add commit message for pin function/mux commits
- Add comments to pin functions

Cheers,
ChenYu

Chen-Yu Tsai (5):
clk: sunxi: Allwinner A20 output clock support
ARM: dts: sun7i: Change 32768 Hz oscillator node name to clk at N style
ARM: dts: sun7i: external clock outputs
pinctrl: sunxi: Add Allwinner A20 clock output pin functions
ARM: dts: sun7i: Add pin muxing options for clock outputs

 Documentation/devicetree/bindings/clock/sunxi.txt |  1 +
 arch/arm/boot/dts/sun7i-a20.dtsi                  | 45 +++++++++++++++++-
 drivers/clk/sunxi/clk-sunxi.c                     | 57 +++++++++++++++++++++++
 drivers/pinctrl/pinctrl-sunxi-pins.h              |  2 +
 4 files changed, 104 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH v3 1/5 clk: sunxi: Allwinner A20 output clock support

This patch adds support for the external clock outputs on the Allwinner A20 SoC. The clock outputs are similar to "module 0" type clocks, with different offsets and widths for clock factors.

---
 Documentation/devicetree/bindings/clock/sunxi.txt |  1 +
 drivers/clk/sunxi/clk-sunxi.c                     | 57 +++++++++++++++++++++++
 2 files changed, 58 insertions(+)
Documentation/devicetree/bindings/clock/sunxi.txt +1 -0
index 46d8433..0c127cd 100644
@@ -36,6 +36,7 @@ Required properties:
 	"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,sun4i-mod0-clk" - for the module 0 family of clocks
+	"allwinner,sun7i-a20-out-clk" - for the external output clocks on A20
 
 Required properties for all clocks:
 - reg : shall be the control register address for the clock.
drivers/clk/sunxi/clk-sunxi.c +57 -0

81 lines not on this page · raw message

Signature · 1 line
1.8.5.2
#2 lore raw

PATCH v3 1/5 clk: sunxi: Allwinner A20 output clock support

Hi,

Quoted 5 lines · Chen-Yu Tsai

This patch adds support for the external clock outputs on the Allwinner A20 SoC. The clock outputs are similar to "module 0" type clocks, with different offsets and widths for clock factors.

Thanks!

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140102/091488c3/attachment-0001.sig>
#3 lore raw

PATCH v3 2/5 ARM: dts: sun7i: Change 32768 Hz oscillator node name to clk@N style

In reply to Chen-Yu Tsai

Device tree naming conventions state that node names should match the nodes function. Change external low speed oscillator node name to match.

---

This patch only changes osc32k in sun7i DT, for proper numbering of the dummy clocks. osc24M does not support clock-output-names yet, nor do the other clocks left. I'd like to do thses in another series, adding support in the clock driver, and fixing up all sunxi DTs.

 arch/arm/boot/dts/sun7i-a20.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sun7i-a20.dtsi +2 -1
index 4c25f81..c0fb390 100644
@@ -53,10 +53,11 @@
 			clock-frequency = <24000000>;
 		};
 
-		osc32k: osc32k {
+		osc32k: clk at 0 {
 			#clock-cells = <0>;
 			compatible = "fixed-clock";
 			clock-frequency = <32768>;
+			clock-output-names = "osc32k";
 		};
 
 		pll1: pll1 at 01c20000 {
Signature · 1 line
1.8.5.2
#4 lore raw

PATCH v3 2/5 ARM: dts: sun7i: Change 32768 Hz oscillator node name to clk@N style

Quoted 5 lines · Chen-Yu Tsai

Device tree naming conventions state that node names should match the nodes function. Change external low speed oscillator node name to match.

Applied, thanks!

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140102/300002bc/attachment.sig>
#5 lore raw

PATCH v3 3/5 ARM: dts: sun7i: external clock outputs

In reply to Chen-Yu Tsai

This commit adds the two external clock outputs available on A20 to its device tree. A dummy fixed factor clock is also added to serve as the first input of the clock outputs, which according to AW's A20 user manual, is the 24MHz oscillator divided by 750.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +28 -0
index c0fb390..e192c99 100644
@@ -303,6 +303,34 @@
 			clocks = <&osc24M>, <&pll6 2>, <&pll5 1>;
 			clock-output-names = "mbus";
 		};
+
+		/*
+		 * Dummy clock used by output clocks
+		 */
+		osc24M_32k: clk at 1 {
+			#clock-cells = <0>;
+			compatible = "fixed-factor-clock";
+			clock-div = <750>;
+			clock-mult = <1>;
+			clocks = <&osc24M>;
+			clock-output-names = "osc24M_32k";
+		};
+
+		clk_out_a: clk at 01c201f0 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun7i-a20-out-clk";
+			reg = <0x01c201f0 0x4>;
+			clocks = <&osc24M_32k>, <&osc32k>, <&osc24M>;
+			clock-output-names = "clk_out_a";
+		};
+
+		clk_out_b: clk at 01c201f4 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun7i-a20-out-clk";
+			reg = <0x01c201f4 0x4>;
+			clocks = <&osc24M_32k>, <&osc32k>, <&osc24M>;
+			clock-output-names = "clk_out_b";
+		};
 	};
 
 	soc at 01c00000 {
Signature · 1 line
1.8.5.2
#6 lore raw

PATCH v3 3/5 ARM: dts: sun7i: external clock outputs

Hi,

Quoted 6 lines · Chen-Yu Tsai

This commit adds the two external clock outputs available on A20 to its device tree. A dummy fixed factor clock is also added to serve as the first input of the clock outputs, which according to AW's A20 user manual, is the 24MHz oscillator divided by 750.

I'm ok with this patch, but I'll let Emilio and Mike give their opinion on the driver before merging it.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140102/7db4f8c6/attachment.sig>
#7 lore raw

PATCH v3 3/5 ARM: dts: sun7i: external clock outputs

Hi,

Quoted 8 lines · Maxime Ripard

Hi,

Quoted 5 lines · Chen-Yu Tsai

This commit adds the two external clock outputs available on A20 to its device tree. A dummy fixed factor clock is also added to serve as the first input of the clock outputs, which according to AW's A20 user manual, is the 24MHz oscillator divided by 750.

Quoted 4 lines
Quoted 1 line

I'm ok with this patch, but I'll let Emilio and Mike give their opinion on the driver before merging it.

The driver has not changed since v1.
Mike merged it via Emilio's pull request.

Or are you referring to the DT part?

Cheers,
ChenYu

#8 lore raw

PATCH v3 3/5 ARM: dts: sun7i: external clock outputs

Quoted 9 lines · Chen-Yu Tsai

Hi,

On Thu, Jan 2, 2014 at 7:10 AM, Maxime Ripard

Quoted 6 lines · Chen-Yu Tsai
Quoted 5 lines

This commit adds the two external clock outputs available on A20 to its device tree. A dummy fixed factor clock is also added to serve as the first input of the clock outputs, which according to AW's A20 user manual, is the 24MHz oscillator divided by 750.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I'm ok with this patch, but I'll let Emilio and Mike give their opinion on the driver before merging it.

The driver has not changed since v1.
Mike merged it via Emilio's pull request.

Ah, right, I forgot about this.

I just merged this patch as well.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140102/968c0869/attachment.sig>
#9 lore raw

PATCH v3 4/5 pinctrl: sunxi: Add Allwinner A20 clock output pin functions

In reply to Chen-Yu Tsai

This patch adds the clock output pin functions on the A20. The 2 pins can output a configurable clock to be used by external modules. This is used on the CubieTruck, to supply a 32768 Hz low power clock to the onboard Wifi+BT module.

---
 drivers/pinctrl/pinctrl-sunxi-pins.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/pinctrl/pinctrl-sunxi-pins.h +2 -0
index 2c7446a..6fd8d4d 100644
@@ -3774,12 +3774,14 @@ static const struct sunxi_desc_pin sun7i_a20_pins[] = {
 		  SUNXI_FUNCTION(0x1, "gpio_out"),
 		  SUNXI_FUNCTION(0x2, "spi0"),		/* MOSI */
 		  SUNXI_FUNCTION(0x3, "uart6"),		/* TX */
+		  SUNXI_FUNCTION(0x4, "clk_out_a"),	/* CLK_OUT_A */
 		  SUNXI_FUNCTION_IRQ(0x5, 24)),		/* EINT24 */
 	SUNXI_PIN(SUNXI_PINCTRL_PIN_PI13,
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
 		  SUNXI_FUNCTION(0x1, "gpio_out"),
 		  SUNXI_FUNCTION(0x2, "spi0"),		/* MISO */
 		  SUNXI_FUNCTION(0x3, "uart6"),		/* RX */
+		  SUNXI_FUNCTION(0x4, "clk_out_b"),	/* CLK_OUT_B */
 		  SUNXI_FUNCTION_IRQ(0x5, 25)),		/* EINT25 */
 	SUNXI_PIN(SUNXI_PINCTRL_PIN_PI14,
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
Signature · 1 line
1.8.5.2
#10 lore raw

PATCH v3 5/5 ARM: dts: sun7i: Add pin muxing options for clock outputs

In reply to Chen-Yu Tsai

This patch adds the clock output pin options on the A20. The 2 pins can output a configurable clock to be used by external modules. This is used on the CubieTruck, to supply a 32768 Hz low power clock to the onboard Wifi+BT module.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +14 -0
index e192c99..0062811 100644
@@ -418,6 +418,20 @@
 				allwinner,drive = <0>;
 				allwinner,pull = <0>;
 			};
+
+			clk_out_a_pins_a: clk_out_a at 0 {
+				allwinner,pins = "PI12";
+				allwinner,function = "clk_out_a";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			clk_out_b_pins_a: clk_out_b at 0 {
+				allwinner,pins = "PI13";
+				allwinner,function = "clk_out_b";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
 		};
 
 		timer at 01c20c00 {
Signature · 1 line
1.8.5.2
#11 lore raw

PATCH v3 5/5 ARM: dts: sun7i: Add pin muxing options for clock outputs

Hi Chen-Yu,

Quoted 6 lines · Chen-Yu Tsai

This patch adds the clock output pin options on the A20. The 2 pins can output a configurable clock to be used by external modules. This is used on the CubieTruck, to supply a 32768 Hz low power clock to the onboard Wifi+BT module.

Applied to sunxi/dt-for-3.14.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140102/b035ea56/attachment.sig>