clk: sunxi: add A20 external output clock support
Subsystems (5)
v2 cover clk: sunxi: add A20 external output clock support
Hi everyone,
This is a resend of A20 external output clock support patch series v2.
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 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 (4):
clk: sunxi: Allwinner A20 output clock support
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 | 41 ++++++++++++++++ drivers/clk/sunxi/clk-sunxi.c | 57 +++++++++++++++++++++++ drivers/pinctrl/pinctrl-sunxi-pins.h | 2 + 4 files changed, 101 insertions(+)
Signature · 1 line
1.8.5.2
PATCH v2 1/4 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
@@ -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 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
PATCH v2 2/4 ARM: dts: sun7i: external clock outputs
In reply to Chen-Yu TsaiThis 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 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +27 -0
@@ -302,6 +302,33 @@ clocks = <&osc24M>, <&pll6 2>, <&pll5 1>; clock-output-names = "mbus"; }; + + /* + * Dummy clock used by output clocks + */ + osc24M_32k: osc24M_32k { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clock-div = <750>; + clock-mult = <1>; + clocks = <&osc24M>; + }; + + 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
PATCH v2 2/4 ARM: dts: sun7i: external clock outputs
Hi,
Quoted 15 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.
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/boot/dts/sun7i-a20.dtsi | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)arch/arm/boot/dts/sun7i-a20.dtsi +0
-0
arch/arm/boot/dts/sun7i-a20.dtsi line 309
Quoted 8 lines
arch/arm/boot/dts/sun7i-a20.dtsi +5
-0@@ -302,6 +302,33 @@ clocks = <&osc24M>, <&pll6 2>, <&pll5 1>; clock-output-names = "mbus"; }; + + /* + * Dummy clock used by output clocks + */ + osc24M_32k: osc24M_32k {
the node name should be clk to reflect the function of the device, and not what instance of it it might be.
You should probably use something like clk at 0, to avoid collisions with other dummy clocks.
Note that we have pretty much the same problem already for the losc and osc24M, it would be great if you could do a patch for these too :)
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/20131230/409a4777/attachment.sig>
PATCH v2 2/4 ARM: dts: sun7i: external clock outputs
Hi,
Quoted 30 lines · Maxime Ripard
Hi,
Quoted 15 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.
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/boot/dts/sun7i-a20.dtsi | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)arch/arm/boot/dts/sun7i-a20.dtsi +0
-0arch/arm/boot/dts/sun7i-a20.dtsi line 309
Quoted 8 lines
arch/arm/boot/dts/sun7i-a20.dtsi +5
-0@@ -302,6 +302,33 @@ clocks = <&osc24M>, <&pll6 2>, <&pll5 1>; clock-output-names = "mbus"; }; + + /* + * Dummy clock used by output clocks + */ + osc24M_32k: osc24M_32k {the node name should be clk to reflect the function of the device, and not what instance of it it might be.
Quoted 2 lines
You should probably use something like clk at 0, to avoid collisions with other dummy clocks.
No problem. I will fix this and the pin mux set names.
Quoted 2 lines
Note that we have pretty much the same problem already for the losc and osc24M, it would be great if you could do a patch for these too :)
I will add a patch before this one, so the numbering won't be confusing, i.e. @1 appears before @0.
Mind if I add a patch enabling i2c0 on CubieTruck?
I noticed it was missing when I helped Carlo with AXP209 stuff.
Cheers
ChenYu
PATCH v2 2/4 ARM: dts: sun7i: external clock outputs
Hi,
Quoted 2 lines · Chen-Yu Tsai
Mind if I add a patch enabling i2c0 on CubieTruck?
I noticed it was missing when I helped Carlo with AXP209 stuff.
Feel free to submit anything you think is relevant :)
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/18715baa/attachment.sig>
PATCH v2 3/4 pinctrl: sunxi: Add Allwinner A20 clock output pin functions
In reply to Chen-Yu TsaiThis 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
@@ -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
PATCH v2 3/4 pinctrl: sunxi: Add Allwinner A20 clock output pin functions
Hi Chen-Yu,
Quoted 6 lines · 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.
Signed-off-by Chen-Yu Tsai <[email protected]>
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/20131230/59c41610/attachment-0001.sig>
PATCH v2 3/4 pinctrl: sunxi: Add Allwinner A20 clock output pin functions
In reply to Chen-Yu TsaiQuoted 6 lines · 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.
Signed-off-by Chen-Yu Tsai <[email protected]>
Patch applied with Maxime's ACK.
Yours,
Linus Walleij
PATCH v2 4/4 ARM: dts: sun7i: Add pin muxing options for clock outputs
In reply to Chen-Yu TsaiThis 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
@@ -416,6 +416,20 @@ allwinner,drive = <0>; allwinner,pull = <0>; }; + + clk_out_a_pins: clk_out_a at 0 { + allwinner,pins = "PI12"; + allwinner,function = "clk_out_a"; + allwinner,drive = <0>; + allwinner,pull = <0>; + }; + + clk_out_b_pins: 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
PATCH v2 4/4 ARM: dts: sun7i: Add pin muxing options for clock outputs
Hi Chen-Yu,
Quoted 22 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.
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/boot/dts/sun7i-a20.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)arch/arm/boot/dts/sun7i-a20.dtsi +4
-0@@ -416,6 +416,20 @@ allwinner,drive = <0>; allwinner,pull = <0>; }; + + clk_out_a_pins: clk_out_a at 0 { + allwinner,pins = "PI12"; + allwinner,function = "clk_out_a";
arch/arm/boot/dts/sun7i-a20.dtsi line 432
Quoted 10 lines
arch/arm/boot/dts/sun7i-a20.dtsi +10
-0+ allwinner,drive = <0>; + allwinner,pull = <0>; + }; + + clk_out_b_pins: clk_out_b at 0 { + allwinner,pins = "PI13"; + allwinner,function = "clk_out_b"; + allwinner,drive = <0>; + allwinner,pull = <0>; + };
The labels should be clk_out_[ab]_pins_a. That way, if another muxing pops up for this clock, we will just need to add the new node, without modifying the one you add just there.
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/20131230/19b5534f/attachment.sig>