ARM: sunxi: Switch to clock indices
Subsystems (4)
v2 cover ARM: sunxi: Switch to clock indices
Hi,
We currently have in our clock driver a logic very similar to the one that clock-indices is supposed to cover.
Using this property, we can create a new driver generic for all gates that will get the valid indices directly from the device tree, instead of storing that in the driver itself.
While we're at it, we also move to using CLK_OF_DECLARE for that new driver, which should ease the orphan clocks breakage we saw.
Let me know what you think,
Maxime
Changes from v1:
- Remove unused headers in the driver
- Fix the wrong commit log for the A80
Maxime Ripard (7):
ARM: sun4i: Add clock indices
ARM: sun5i: Add clock indices
ARM: sun6i: Add clock indices
ARM: sun7i: Add clock indices
ARM: sun8i: Add clock indices
ARM: sun9i: Wrap the clock-indices
clk: sunxi: Add a simple gates driver
arch/arm/boot/dts/sun4i-a10.dtsi | 69 ++++++++++---- arch/arm/boot/dts/sun5i-a10s.dtsi | 23 ++++- arch/arm/boot/dts/sun5i-a13.dtsi | 18 +++- arch/arm/boot/dts/sun5i.dtsi | 1 + arch/arm/boot/dts/sun6i-a31.dtsi | 24 +++++ arch/arm/boot/dts/sun7i-a20.dtsi | 23 +++++ arch/arm/boot/dts/sun8i-a23-a33.dtsi | 15 +++ arch/arm/boot/dts/sun9i-a80.dtsi | 32 +++++-- drivers/clk/sunxi/Makefile | 1 + drivers/clk/sunxi/clk-simple-gates.c | 157 +++++++++++++++++++++++++++++++ drivers/clk/sunxi/clk-sunxi.c | 177 ----------------------------------- 11 files changed, 333 insertions(+), 207 deletions(-) create mode 100644 drivers/clk/sunxi/clk-simple-gates.c
Signature · 1 line
2.4.6
PATCH v2 1/7 ARM: sun4i: Add clock indices
The A10 gates have a non continuous set of clock IDs that are valid. Add the clock-indices property to the DT to express this.
--- arch/arm/boot/dts/sun4i-a10.dtsi | 69 ++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 17 deletions(-)
arch/arm/boot/dts/sun4i-a10.dtsi +52 -17
@@ -241,6 +241,7 @@ compatible = "allwinner,sun4i-a10-axi-gates-clk"; reg = <0x01c2005c 0x4>; clocks = <&axi>; + clock-indices = <0>; clock-output-names = "axi_dram"; };
@@ -257,17 +258,36 @@ compatible = "allwinner,sun4i-a10-ahb-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb>; + clock-indices = <0>, <1>, + <2>, <3>, + <4>, <5>, <6>, + <7>, <8>, <9>, + <10>, <11>, <12>, + <13>, <14>, <16>, + <17>, <18>, <20>, + <21>, <22>, <23>, + <24>, <25>, <26>, + <32>, <33>, <34>, + <35>, <36>, <37>, + <40>, <41>, <43>, + <44>, <45>, + <46>, <47>, + <50>, <52>; clock-output-names = "ahb_usb0", "ahb_ehci0", - "ahb_ohci0", "ahb_ehci1", "ahb_ohci1", "ahb_ss", - "ahb_dma", "ahb_bist", "ahb_mmc0", "ahb_mmc1", - "ahb_mmc2", "ahb_mmc3", "ahb_ms", "ahb_nand", - "ahb_sdram", "ahb_ace", "ahb_emac", "ahb_ts", - "ahb_spi0", "ahb_spi1", "ahb_spi2", "ahb_spi3", - "ahb_pata", "ahb_sata", "ahb_gps", "ahb_ve", - "ahb_tvd", "ahb_tve0", "ahb_tve1", "ahb_lcd0", - "ahb_lcd1", "ahb_csi0", "ahb_csi1", "ahb_hdmi", - "ahb_de_be0", "ahb_de_be1", "ahb_de_fe0", - "ahb_de_fe1", "ahb_mp", "ahb_mali400"; + "ahb_ohci0", "ahb_ehci1", + "ahb_ohci1", "ahb_ss", "ahb_dma", + "ahb_bist", "ahb_mmc0", "ahb_mmc1", + "ahb_mmc2", "ahb_mmc3", "ahb_ms", + "ahb_nand", "ahb_sdram", "ahb_ace", + "ahb_emac", "ahb_ts", "ahb_spi0", + "ahb_spi1", "ahb_spi2", "ahb_spi3", + "ahb_pata", "ahb_sata", "ahb_gps", + "ahb_ve", "ahb_tvd", "ahb_tve0", + "ahb_tve1", "ahb_lcd0", "ahb_lcd1", + "ahb_csi0", "ahb_csi1", "ahb_hdmi", + "ahb_de_be0", "ahb_de_be1", + "ahb_de_fe0", "ahb_de_fe1", + "ahb_mp", "ahb_mali400"; }; apb0: apb0 at 01c20054 {
@@ -283,9 +303,14 @@ compatible = "allwinner,sun4i-a10-apb0-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb0>; + clock-indices = <0>, <1>, + <2>, <3>, + <5>, <6>, + <7>, <10>; clock-output-names = "apb0_codec", "apb0_spdif", - "apb0_ac97", "apb0_iis", "apb0_pio", "apb0_ir0", - "apb0_ir1", "apb0_keypad"; + "apb0_ac97", "apb0_iis", + "apb0_pio", "apb0_ir0", + "apb0_ir1", "apb0_keypad"; }; apb1: clk at 01c20058 {
@@ -301,12 +326,22 @@ compatible = "allwinner,sun4i-a10-apb1-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb1>; + clock-indices = <0>, <1>, + <2>, <4>, + <5>, <6>, + <7>, <16>, + <17>, <18>, + <19>, <20>, + <21>, <22>, + <23>; clock-output-names = "apb1_i2c0", "apb1_i2c1", - "apb1_i2c2", "apb1_can", "apb1_scr", - "apb1_ps20", "apb1_ps21", "apb1_uart0", - "apb1_uart1", "apb1_uart2", "apb1_uart3", - "apb1_uart4", "apb1_uart5", "apb1_uart6", - "apb1_uart7"; + "apb1_i2c2", "apb1_can", + "apb1_scr", "apb1_ps20", + "apb1_ps21", "apb1_uart0", + "apb1_uart1", "apb1_uart2", + "apb1_uart3", "apb1_uart4", + "apb1_uart5", "apb1_uart6", + "apb1_uart7"; }; nand_clk: clk at 01c20080 {
Signature · 1 line
2.4.6
PATCH v2 2/7 ARM: sun5i: Add clock indices
In reply to Maxime RipardThe A10s and A13 gates have a non continuous set of clock IDs that are valid. Add the clock-indices property to the DT to express this.
--- arch/arm/boot/dts/sun5i-a10s.dtsi | 23 +++++++++++++++++++++-- arch/arm/boot/dts/sun5i-a13.dtsi | 18 +++++++++++++++++- arch/arm/boot/dts/sun5i.dtsi | 1 + 3 files changed, 39 insertions(+), 3 deletions(-)
arch/arm/boot/dts/sun5i-a10s.dtsi +21 -2
@@ -85,6 +85,17 @@ compatible = "allwinner,sun5i-a10s-ahb-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb>; + clock-indices = <0>, <1>, + <2>, <5>, <6>, + <7>, <8>, <9>, + <10>, <13>, + <14>, <17>, <18>, + <20>, <21>, <22>, + <26>, <28>, <32>, + <34>, <36>, <40>, + <43>, <44>, + <46>, <51>, + <52>; clock-output-names = "ahb_usbotg", "ahb_ehci", "ahb_ohci", "ahb_ss", "ahb_dma", "ahb_bist", "ahb_mmc0", "ahb_mmc1",
@@ -103,6 +114,9 @@ compatible = "allwinner,sun5i-a10s-apb0-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb0>; + clock-indices = <0>, <3>, + <5>, <6>, + <10>; clock-output-names = "apb0_codec", "apb0_iis", "apb0_pio", "apb0_ir", "apb0_keypad";
@@ -113,9 +127,14 @@ compatible = "allwinner,sun5i-a10s-apb1-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb1>; + clock-indices = <0>, <1>, + <2>, <16>, + <17>, <18>, + <19>; clock-output-names = "apb1_i2c0", "apb1_i2c1", - "apb1_i2c2", "apb1_uart0", "apb1_uart1", - "apb1_uart2", "apb1_uart3"; + "apb1_i2c2", "apb1_uart0", + "apb1_uart1", "apb1_uart2", + "apb1_uart3"; }; };
arch/arm/boot/dts/sun5i-a13.dtsi +17 -1
@@ -104,6 +104,16 @@ compatible = "allwinner,sun5i-a13-ahb-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb>; + clock-indices = <0>, <1>, + <2>, <5>, <6>, + <7>, <8>, <9>, + <10>, <13>, + <14>, <20>, + <21>, <22>, + <28>, <32>, <36>, + <40>, <44>, + <46>, <51>, + <52>; clock-output-names = "ahb_usbotg", "ahb_ehci", "ahb_ohci", "ahb_ss", "ahb_dma", "ahb_bist", "ahb_mmc0", "ahb_mmc1",
@@ -121,6 +131,8 @@ compatible = "allwinner,sun5i-a13-apb0-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb0>; + clock-indices = <0>, <5>, + <6>; clock-output-names = "apb0_codec", "apb0_pio", "apb0_ir"; };
@@ -130,8 +142,12 @@ compatible = "allwinner,sun5i-a13-apb1-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb1>; + clock-indices = <0>, <1>, + <2>, <17>, + <19>; clock-output-names = "apb1_i2c0", "apb1_i2c1", - "apb1_i2c2", "apb1_uart1", "apb1_uart3"; + "apb1_i2c2", "apb1_uart1", + "apb1_uart3"; }; }; };
arch/arm/boot/dts/sun5i.dtsi +1 -0
@@ -178,6 +178,7 @@ compatible = "allwinner,sun4i-a10-axi-gates-clk"; reg = <0x01c2005c 0x4>; clocks = <&axi>; + clock-indices = <0>; clock-output-names = "axi_dram"; };
Signature · 1 line
2.4.6
PATCH v2 3/7 ARM: sun6i: Add clock indices
In reply to Maxime RipardThe A31 gates have a non continuous set of clock IDs that are valid. Add the clock-indices property to the DT to express this.
--- arch/arm/boot/dts/sun6i-a31.dtsi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm/boot/dts/sun6i-a31.dtsi +24 -0
@@ -252,6 +252,20 @@ compatible = "allwinner,sun6i-a31-ahb1-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb1>; + clock-indices = <1>, <5>, + <6>, <8>, <9>, + <10>, <11>, <12>, + <13>, <14>, + <17>, <18>, <19>, + <20>, <21>, <22>, + <23>, <24>, <26>, + <27>, <29>, + <30>, <31>, <32>, + <36>, <37>, <40>, + <43>, <44>, <45>, + <46>, <47>, <50>, + <52>, <55>, <56>, + <57>, <58>; clock-output-names = "ahb1_mipidsi", "ahb1_ss", "ahb1_dma", "ahb1_mmc0", "ahb1_mmc1", "ahb1_mmc2", "ahb1_mmc3", "ahb1_nand1",
@@ -281,6 +295,9 @@ compatible = "allwinner,sun6i-a31-apb1-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb1>; + clock-indices = <0>, <4>, + <5>, <12>, + <13>; clock-output-names = "apb1_codec", "apb1_digital_mic", "apb1_pio", "apb1_daudio0", "apb1_daudio1";
@@ -299,6 +316,10 @@ compatible = "allwinner,sun6i-a31-apb2-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb2>; + clock-indices = <0>, <1>, + <2>, <3>, <16>, + <17>, <18>, <19>, + <20>, <21>; clock-output-names = "apb2_i2c0", "apb2_i2c1", "apb2_i2c2", "apb2_i2c3", "apb2_uart0", "apb2_uart1",
@@ -384,6 +405,9 @@ compatible = "allwinner,sun6i-a31-usb-clk"; reg = <0x01c200cc 0x4>; clocks = <&osc24M>; + clock-indices = <8>, <9>, <10>, + <16>, <17>, + <18>; clock-output-names = "usb_phy0", "usb_phy1", "usb_phy2", "usb_ohci0", "usb_ohci1", "usb_ohci2";
Signature · 1 line
2.4.6
PATCH v2 4/7 ARM: sun7i: Add clock indices
In reply to Maxime RipardThe A20 gates have a non continuous set of clock IDs that are valid. Add the clock-indices property to the DT to express this.
--- arch/arm/boot/dts/sun7i-a20.dtsi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +23 -0
@@ -267,6 +267,19 @@ compatible = "allwinner,sun7i-a20-ahb-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb>; + clock-indices = <0>, <1>, + <2>, <3>, <4>, + <5>, <6>, <7>, <8>, + <9>, <10>, <11>, <12>, + <13>, <14>, <16>, + <17>, <18>, <20>, <21>, + <22>, <23>, <25>, + <28>, <32>, <33>, <34>, + <35>, <36>, <37>, <40>, + <41>, <42>, <43>, + <44>, <45>, <46>, + <47>, <49>, <50>, + <52>; clock-output-names = "ahb_usb0", "ahb_ehci0", "ahb_ohci0", "ahb_ehci1", "ahb_ohci1", "ahb_ss", "ahb_dma", "ahb_bist", "ahb_mmc0",
@@ -295,6 +308,10 @@ compatible = "allwinner,sun7i-a20-apb0-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb0>; + clock-indices = <0>, <1>, + <2>, <3>, <4>, + <5>, <6>, <7>, + <8>, <10>; clock-output-names = "apb0_codec", "apb0_spdif", "apb0_ac97", "apb0_iis0", "apb0_iis1", "apb0_pio", "apb0_ir0", "apb0_ir1",
@@ -314,6 +331,12 @@ compatible = "allwinner,sun7i-a20-apb1-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb1>; + clock-indices = <0>, <1>, + <2>, <3>, <4>, + <5>, <6>, <7>, + <15>, <16>, <17>, + <18>, <19>, <20>, + <21>, <22>, <23>; clock-output-names = "apb1_i2c0", "apb1_i2c1", "apb1_i2c2", "apb1_i2c3", "apb1_can", "apb1_scr", "apb1_ps20", "apb1_ps21",
Signature · 1 line
2.4.6
PATCH v2 5/7 ARM: sun8i: Add clock indices
In reply to Maxime RipardThe A23 and A33 gates have a non continuous set of clock IDs that are valid. Add the clock-indices property to the DT to express this.
--- arch/arm/boot/dts/sun8i-a23-a33.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/arm/boot/dts/sun8i-a23-a33.dtsi +15 -0
@@ -180,6 +180,15 @@ compatible = "allwinner,sun8i-a23-ahb1-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb1>; + clock-indices = <1>, <6>, + <8>, <9>, <10>, + <13>, <14>, + <19>, <20>, + <21>, <24>, <26>, + <29>, <32>, <36>, + <40>, <44>, <46>, + <52>, <54>, + <57>; clock-output-names = "ahb1_mipidsi", "ahb1_dma", "ahb1_mmc0", "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand", "ahb1_sdram",
@@ -196,6 +205,8 @@ compatible = "allwinner,sun8i-a23-apb1-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb1>; + clock-indices = <0>, <5>, + <12>, <13>; clock-output-names = "apb1_codec", "apb1_pio", "apb1_daudio0", "apb1_daudio1"; };
@@ -213,6 +224,10 @@ compatible = "allwinner,sun8i-a23-apb2-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb2>; + clock-indices = <0>, <1>, + <2>, <16>, + <17>, <18>, + <19>, <20>; clock-output-names = "apb2_i2c0", "apb2_i2c1", "apb2_i2c2", "apb2_uart0", "apb2_uart1", "apb2_uart2",
Signature · 1 line
2.4.6
PATCH v2 5/7 ARM: sun8i: Add clock indices
Quoted 13 lines · Maxime Ripard
The A23 and A33 gates have a non continuous set of clock IDs that are valid. Add the clock-indices property to the DT to express this.
Signed-off-by Maxime Ripard <[email protected]>--- arch/arm/boot/dts/sun8i-a23-a33.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)arch/arm/boot/dts/sun8i-a23-a33.dtsi +0
-0
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 183
Quoted 4 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +1
-0@@ -180,6 +180,15 @@ compatible = "allwinner,sun8i-a23-ahb1-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb1>; + clock-indices = <1>, <6>,
Turns out the A33 (and I assume the same with the A23) has an ahb1 clock gate for the Security System at clock-index <5>.
This is found in the updated A33 user manual.
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 190
Quoted 7 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +7
-0+ <8>, <9>, <10>, + <13>, <14>, + <19>, <20>, + <21>, <24>, <26>, + <29>, <32>, <36>, + <40>, <44>, <46>, + <52>, <54>,
<53> is ahb1 clock gate for msgbox, again found in A33 manual.
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 191
Quoted 1 line
arch/arm/boot/dts/sun8i-a23-a33.dtsi +1
-0+ <57>;
<58> is ahb1 clock gate for SAT, which seems to be part of the display pipeline.
Quoted 24 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +6
-1clock-output-names = "ahb1_mipidsi", "ahb1_dma", "ahb1_mmc0", "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand", "ahb1_sdram",@@ -196,6 +205,8 @@ compatible = "allwinner,sun8i-a23-apb1-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb1>; + clock-indices = <0>, <5>, + <12>, <13>; clock-output-names = "apb1_codec", "apb1_pio", "apb1_daudio0", "apb1_daudio1"; };@@ -213,6 +224,10 @@ compatible = "allwinner,sun8i-a23-apb2-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb2>; + clock-indices = <0>, <1>, + <2>, <16>, + <17>, <18>, + <19>, <20>; clock-output-names = "apb2_i2c0", "apb2_i2c1", "apb2_i2c2", "apb2_uart0", "apb2_uart1", "apb2_uart2", --
Quoted 2 lines
2.4.6
Not sure if you want to add the clocks I mentioned together in this patch, or do a separate patch.
The rest look good.
ChenYu
PATCH v2 5/7 ARM: sun8i: Add clock indices
Quoted 10 lines · Chen-Yu Tsai
Quoted 8 lines · Maxime Ripard
The A23 and A33 gates have a non continuous set of clock IDs that are valid. Add the clock-indices property to the DT to express this.
Signed-off-by Maxime Ripard <[email protected]>--- arch/arm/boot/dts/sun8i-a23-a33.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
Quoted 12 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 183
Quoted 9 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +1
-0@@ -180,6 +180,15 @@ compatible = "allwinner,sun8i-a23-ahb1-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb1>; + clock-indices = <1>, <6>,Turns out the A33 (and I assume the same with the A23) has an ahb1 clock gate for the Security System at clock-index <5>.
Looks like the A23 does not have this one, nor the SS mod clock.
Quoted 11 lines
This is found in the updated A33 user manual.
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 190
Quoted 7 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +7
-0+ <8>, <9>, <10>, + <13>, <14>, + <19>, <20>, + <21>, <24>, <26>, + <29>, <32>, <36>, + <40>, <44>, <46>, + <52>, <54>,<53> is ahb1 clock gate for msgbox, again found in A33 manual.
A23 has this one. Found in Allwinner kernel sources.
Quoted 4 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 191
Quoted 1 line
arch/arm/boot/dts/sun8i-a23-a33.dtsi +1
-0+ <57>;<58> is ahb1 clock gate for SAT, which seems to be part of the display pipeline.
This one is A33 only.
I guess we should do a separate compatible for A33 AHB1 clock gates.
ChenYu
Quoted 33 lines
Quoted 24 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +6
-1clock-output-names = "ahb1_mipidsi", "ahb1_dma", "ahb1_mmc0", "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand", "ahb1_sdram",@@ -196,6 +205,8 @@ compatible = "allwinner,sun8i-a23-apb1-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb1>; + clock-indices = <0>, <5>, + <12>, <13>; clock-output-names = "apb1_codec", "apb1_pio", "apb1_daudio0", "apb1_daudio1"; };@@ -213,6 +224,10 @@ compatible = "allwinner,sun8i-a23-apb2-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb2>; + clock-indices = <0>, <1>, + <2>, <16>, + <17>, <18>, + <19>, <20>; clock-output-names = "apb2_i2c0", "apb2_i2c1", "apb2_i2c2", "apb2_uart0", "apb2_uart1", "apb2_uart2", --Quoted 2 lines
2.4.6
Not sure if you want to add the clocks I mentioned together in this patch, or do a separate patch.
The rest look good.
ChenYu
PATCH v2 5/7 ARM: sun8i: Add clock indices
Quoting Chen-Yu Tsai (2015-08-10 21:49:54)
Quoted 40 lines · Chen-Yu Tsai
Quoted 10 lines
Quoted 8 lines · Maxime Ripard
The A23 and A33 gates have a non continuous set of clock IDs that are valid. Add the clock-indices property to the DT to express this.
Signed-off-by Maxime Ripard <[email protected]>--- arch/arm/boot/dts/sun8i-a23-a33.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)Quoted 12 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 183
Quoted 9 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +1
-0@@ -180,6 +180,15 @@ compatible = "allwinner,sun8i-a23-ahb1-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb1>; + clock-indices = <1>, <6>,Turns out the A33 (and I assume the same with the A23) has an ahb1 clock gate for the Security System at clock-index <5>.
Looks like the A23 does not have this one, nor the SS mod clock.
Quoted 11 lines
This is found in the updated A33 user manual.
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 190
Quoted 7 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +7
-0+ <8>, <9>, <10>, + <13>, <14>, + <19>, <20>, + <21>, <24>, <26>, + <29>, <32>, <36>, + <40>, <44>, <46>, + <52>, <54>,<53> is ahb1 clock gate for msgbox, again found in A33 manual.
A23 has this one. Found in Allwinner kernel sources.
Quoted 8 lines
Quoted 4 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 191
Quoted 1 line
arch/arm/boot/dts/sun8i-a23-a33.dtsi +1
-0+ <57>;<58> is ahb1 clock gate for SAT, which seems to be part of the display pipeline.
This one is A33 only.
I guess we should do a separate compatible for A33 AHB1 clock gates.
ChenYu,
I believe Maxime is on vacation. I told him that I would pick these patches directly. It looks like your comments can be fixed up in follow-up patches at a later date, correct?
If so then I will apply them to clk-next.
Regards,
Mike
Quoted 41 lines
ChenYu
Quoted 30 lines
Quoted 24 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +6
-1clock-output-names = "ahb1_mipidsi", "ahb1_dma", "ahb1_mmc0", "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand", "ahb1_sdram",@@ -196,6 +205,8 @@ compatible = "allwinner,sun8i-a23-apb1-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb1>; + clock-indices = <0>, <5>, + <12>, <13>; clock-output-names = "apb1_codec", "apb1_pio", "apb1_daudio0", "apb1_daudio1"; };@@ -213,6 +224,10 @@ compatible = "allwinner,sun8i-a23-apb2-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb2>; + clock-indices = <0>, <1>, + <2>, <16>, + <17>, <18>, + <19>, <20>; clock-output-names = "apb2_i2c0", "apb2_i2c1", "apb2_i2c2", "apb2_uart0", "apb2_uart1", "apb2_uart2", --Quoted 2 lines
2.4.6
Not sure if you want to add the clocks I mentioned together in this patch, or do a separate patch.
Quoted 3 lines
The rest look good.
ChenYu
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 5/7 ARM: sun8i: Add clock indices
Quoted 48 lines · Michael Turquette
Quoting Chen-Yu Tsai (2015-08-10 21:49:54)
Quoted 47 lines · Chen-Yu Tsai
Quoted 10 lines
Quoted 8 lines · Maxime Ripard
The A23 and A33 gates have a non continuous set of clock IDs that are valid. Add the clock-indices property to the DT to express this.
Signed-off-by Maxime Ripard <[email protected]>--- arch/arm/boot/dts/sun8i-a23-a33.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)Quoted 12 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 183
Quoted 9 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +1
-0@@ -180,6 +180,15 @@ compatible = "allwinner,sun8i-a23-ahb1-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb1>; + clock-indices = <1>, <6>,Turns out the A33 (and I assume the same with the A23) has an ahb1 clock gate for the Security System at clock-index <5>.
Looks like the A23 does not have this one, nor the SS mod clock.
Quoted 11 lines
This is found in the updated A33 user manual.
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 190
Quoted 7 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +7
-0+ <8>, <9>, <10>, + <13>, <14>, + <19>, <20>, + <21>, <24>, <26>, + <29>, <32>, <36>, + <40>, <44>, <46>, + <52>, <54>,<53> is ahb1 clock gate for msgbox, again found in A33 manual.
A23 has this one. Found in Allwinner kernel sources.
Quoted 4 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 191
Quoted 1 line
arch/arm/boot/dts/sun8i-a23-a33.dtsi +1
-0+ <57>;<58> is ahb1 clock gate for SAT, which seems to be part of the display pipeline.
This one is A33 only.
Quoted 7 lines
Quoted 1 line
I guess we should do a separate compatible for A33 AHB1 clock gates.
ChenYu,
I believe Maxime is on vacation. I told him that I would pick these patches directly. It looks like your comments can be fixed up in follow-up patches at a later date, correct?
That's right. I was mostly asking how to proceed with adding them.
Quoted 1 line
If so then I will apply them to clk-next.
Please do. (I see they are already in.)
Thanks
ChenYu
Quoted 44 lines
Regards,
MikeQuoted 41 lines
ChenYu
Quoted 30 lines
Quoted 24 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +6
-1clock-output-names = "ahb1_mipidsi", "ahb1_dma", "ahb1_mmc0", "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand", "ahb1_sdram",@@ -196,6 +205,8 @@ compatible = "allwinner,sun8i-a23-apb1-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb1>; + clock-indices = <0>, <5>, + <12>, <13>; clock-output-names = "apb1_codec", "apb1_pio", "apb1_daudio0", "apb1_daudio1"; };@@ -213,6 +224,10 @@ compatible = "allwinner,sun8i-a23-apb2-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb2>; + clock-indices = <0>, <1>, + <2>, <16>, + <17>, <18>, + <19>, <20>; clock-output-names = "apb2_i2c0", "apb2_i2c1", "apb2_i2c2", "apb2_uart0", "apb2_uart1", "apb2_uart2", --Quoted 2 lines
2.4.6
Not sure if you want to add the clocks I mentioned together in this patch, or do a separate patch.
Quoted 3 lines
The rest look good.
ChenYu
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 5/7 ARM: sun8i: Add clock indices
In reply to Chen-Yu TsaiHi Chen-Yu,
Quoted 70 lines · Chen-Yu Tsai
Quoted 13 lines · Maxime Ripard
The A23 and A33 gates have a non continuous set of clock IDs that are valid. Add the clock-indices property to the DT to express this.
Signed-off-by Maxime Ripard <[email protected]>--- arch/arm/boot/dts/sun8i-a23-a33.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)arch/arm/boot/dts/sun8i-a23-a33.dtsi +0
-0arch/arm/boot/dts/sun8i-a23-a33.dtsi line 183
Quoted 4 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +1
-0@@ -180,6 +180,15 @@ compatible = "allwinner,sun8i-a23-ahb1-gates-clk"; reg = <0x01c20060 0x8>; clocks = <&ahb1>; + clock-indices = <1>, <6>,Turns out the A33 (and I assume the same with the A23) has an ahb1 clock gate for the Security System at clock-index <5>.
This is found in the updated A33 user manual.
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 190
Quoted 7 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +7
-0+ <8>, <9>, <10>, + <13>, <14>, + <19>, <20>, + <21>, <24>, <26>, + <29>, <32>, <36>, + <40>, <44>, <46>, + <52>, <54>,<53> is ahb1 clock gate for msgbox, again found in A33 manual.
arch/arm/boot/dts/sun8i-a23-a33.dtsi line 191
Quoted 1 line
arch/arm/boot/dts/sun8i-a23-a33.dtsi +1
-0+ <57>;<58> is ahb1 clock gate for SAT, which seems to be part of the display pipeline.
Quoted 24 lines
arch/arm/boot/dts/sun8i-a23-a33.dtsi +6
-1clock-output-names = "ahb1_mipidsi", "ahb1_dma", "ahb1_mmc0", "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand", "ahb1_sdram",@@ -196,6 +205,8 @@ compatible = "allwinner,sun8i-a23-apb1-gates-clk"; reg = <0x01c20068 0x4>; clocks = <&apb1>; + clock-indices = <0>, <5>, + <12>, <13>; clock-output-names = "apb1_codec", "apb1_pio", "apb1_daudio0", "apb1_daudio1"; };@@ -213,6 +224,10 @@ compatible = "allwinner,sun8i-a23-apb2-gates-clk"; reg = <0x01c2006c 0x4>; clocks = <&apb2>; + clock-indices = <0>, <1>, + <2>, <16>, + <17>, <18>, + <19>, <20>; clock-output-names = "apb2_i2c0", "apb2_i2c1", "apb2_i2c2", "apb2_uart0", "apb2_uart1", "apb2_uart2", --Quoted 2 lines
2.4.6
Not sure if you want to add the clocks I mentioned together in this patch, or do a separate patch.
Quoted 1 line
The rest look good.
Thanks for your input, I'll send some new patches to deal with this.
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: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150819/a2f3d6ad/attachment-0001.sig>
PATCH v2 6/7 ARM: sun9i: Wrap the clock-indices
In reply to Maxime RipardWrap the clock-indices to match the wrapping of the clock-output-names in order to make it easier to match indices to names.
--- arch/arm/boot/dts/sun9i-a80.dtsi | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-)
arch/arm/boot/dts/sun9i-a80.dtsi +22 -10
@@ -277,9 +277,12 @@ compatible = "allwinner,sun9i-a80-ahb0-gates-clk"; reg = <0x06000580 0x4>; clocks = <&ahb0>; - clock-indices = <0>, <1>, <3>, <5>, <8>, <12>, <13>, - <14>, <15>, <16>, <18>, <20>, <21>, - <22>, <23>; + clock-indices = <0>, <1>, <3>, + <5>, <8>, <12>, + <13>, <14>, + <15>, <16>, <18>, + <20>, <21>, <22>, + <23>; clock-output-names = "ahb0_fd", "ahb0_ve", "ahb0_gpu", "ahb0_ss", "ahb0_sd", "ahb0_nand1", "ahb0_nand0", "ahb0_sdram",
@@ -293,7 +296,10 @@ compatible = "allwinner,sun9i-a80-ahb1-gates-clk"; reg = <0x06000584 0x4>; clocks = <&ahb1>; - clock-indices = <0>, <1>, <17>, <21>, <22>, <23>, <24>; + clock-indices = <0>, <1>, + <17>, <21>, + <22>, <23>, + <24>; clock-output-names = "ahb1_usbotg", "ahb1_usbhci", "ahb1_gmac", "ahb1_msgbox", "ahb1_spinlock", "ahb1_hstimer",
@@ -305,8 +311,9 @@ compatible = "allwinner,sun9i-a80-ahb2-gates-clk"; reg = <0x06000588 0x4>; clocks = <&ahb2>; - clock-indices = <0>, <1>, <2>, <4>, <5>, <7>, <8>, - <11>; + clock-indices = <0>, <1>, + <2>, <4>, <5>, + <7>, <8>, <11>; clock-output-names = "ahb2_lcd0", "ahb2_lcd1", "ahb2_edp", "ahb2_csi", "ahb2_hdmi", "ahb2_de", "ahb2_mp", "ahb2_mipi_dsi";
@@ -317,8 +324,10 @@ compatible = "allwinner,sun9i-a80-apb0-gates-clk"; reg = <0x06000590 0x4>; clocks = <&apb0>; - clock-indices = <1>, <5>, <11>, <12>, <13>, <15>, - <17>, <18>, <19>; + clock-indices = <1>, <5>, + <11>, <12>, <13>, + <15>, <17>, <18>, + <19>; clock-output-names = "apb0_spdif", "apb0_pio", "apb0_ac97", "apb0_i2s0", "apb0_i2s1", "apb0_lradc", "apb0_gpadc", "apb0_twd",
@@ -330,8 +339,11 @@ compatible = "allwinner,sun9i-a80-apb1-gates-clk"; reg = <0x06000594 0x4>; clocks = <&apb1>; - clock-indices = <0>, <1>, <2>, <3>, <4>, - <16>, <17>, <18>, <19>, <20>, <21>; + clock-indices = <0>, <1>, + <2>, <3>, <4>, + <16>, <17>, + <18>, <19>, + <20>, <21>; clock-output-names = "apb1_i2c0", "apb1_i2c1", "apb1_i2c2", "apb1_i2c3", "apb1_i2c4", "apb1_uart0", "apb1_uart1",
Signature · 1 line
2.4.6
PATCH v2 7/7 clk: sunxi: Add a simple gates driver
In reply to Maxime RipardThe gates were handled with a common piece of framework that was registering all gates array, that was not using the CLK_OF_DECLARE logic, and was not using clock-indices but some private masks that were pretty much equivalent.
Move this code in a new driver that handles all the gates array and solves both these issues.
--- drivers/clk/sunxi/Makefile | 1 + drivers/clk/sunxi/clk-simple-gates.c | 157 +++++++++++++++++++++++++++++++ drivers/clk/sunxi/clk-sunxi.c | 177 ----------------------------------- 3 files changed, 158 insertions(+), 177 deletions(-) create mode 100644 drivers/clk/sunxi/clk-simple-gates.c
drivers/clk/sunxi/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-y += clk-sunxi.o clk-factors.o obj-y += clk-a10-hosc.o obj-y += clk-a20-gmac.o obj-y += clk-mod0.o +obj-y += clk-simple-gates.o obj-y += clk-sun8i-mbus.o obj-y += clk-sun9i-core.o obj-y += clk-sun9i-mmc.o
drivers/clk/sunxi/clk-simple-gates.c new file +157 -0
157 lines not on this page · raw message
drivers/clk/sunxi/clk-sunxi.c +0 -177
207 lines not on this page · raw message
Signature · 1 line
2.4.6
PATCH v2 7/7 clk: sunxi: Add a simple gates driver
Quoted 9 lines · Maxime Ripard
The gates were handled with a common piece of framework that was registering all gates array, that was not using the
CLK_OF_DECLARElogic, and was not using clock-indices but some private masks that were pretty much equivalent.Move this code in a new driver that handles all the gates array and solves both these issues.
Signed-off-by Maxime Ripard <[email protected]>
FYI a small fix was rolled into this patch. It was missing clk.h since we removed that from clk-provider.h.
Regards,
Mike
Quoted 401 lines
--- drivers/clk/sunxi/Makefile | 1 + drivers/clk/sunxi/clk-simple-gates.c | 157 +++++++++++++++++++++++++++++++ drivers/clk/sunxi/clk-sunxi.c | 177 ----------------------------------- 3 files changed, 158 insertions(+), 177 deletions(-) create mode 100644 drivers/clk/sunxi/clk-simple-gates.cdrivers/clk/sunxi/Makefile +1
-0@@ -6,6 +6,7 @@ obj-y += clk-sunxi.o clk-factors.o obj-y += clk-a10-hosc.o obj-y += clk-a20-gmac.o obj-y += clk-mod0.o +obj-y += clk-simple-gates.o obj-y += clk-sun8i-mbus.o obj-y += clk-sun9i-core.o obj-y += clk-sun9i-mmc.odrivers/clk/sunxi/clk-simple-gates.c new file +157
-0@@ -0,0 +1,157 @@ +/* +* Copyright 2015 Maxime Ripard +* +* Maxime Ripard <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/clk-provider.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/slab.h> +#include <linux/spinlock.h> + +static DEFINE_SPINLOCK (gates_lock); + +static void __init sunxi_simple_gates_setup (struct device_node *node, +const int protected[], +int nprotected) +{ +struct clk_onecell_data *clk_data; +const char *clk_parent, *clk_name; +struct property *prop; +struct resource res; +void __iomem *clk_reg; +void __iomem *reg; +const __be32 *p; +int number, i =0 , j; +u8 clk_bit; +u32 index; + + reg =of_io_request_and_map (node,0 ,of_node_full_name (node)); +if (IS_ERR (reg)) +return ; + + clk_parent =of_clk_get_parent_name (node,0 ); + + clk_data =kmalloc (sizeof (struct clk_onecell_data ),GFP_KERNEL ); +if (!clk_data) + goto err_unmap; + + number =of_property_count_u32_elems (node,"clock-indices" ); +of_property_read_u32_index (node,"clock-indices" , number -1 , &number); + + clk_data->clks =kcalloc (number +1 ,sizeof (struct clk *),GFP_KERNEL ); +if (!clk_data->clks) + goto err_free_data; + +of_property_for_each_u32 (node,"clock-indices" , prop, p, index) { +of_property_read_string_index (node,"clock-output-names" , + i, &clk_name); + + clk_reg = reg +4 * (index /32 ); + clk_bit = index %32 ; + + clk_data->clks[index] =clk_register_gate (NULL , clk_name, + clk_parent,0 , + clk_reg, + clk_bit, +0 , &gates_lock); + i++; + +if (IS_ERR (clk_data->clks[index])) { +WARN_ON (true); +continue ; + } + +for (j =0 ; j < nprotected; j++) +if (protected[j] == index) +clk_prepare_enable (clk_data->clks[index]); + + } + + clk_data->clk_num = number +1 ; +of_clk_add_provider (node, of_clk_src_onecell_get, clk_data); + +return ; + +err_free_data: +kfree (clk_data); +err_unmap: +iounmap (reg); +of_address_to_resource (node,0 , &res); +release_mem_region (res.start,resource_size (&res)); +} + +static void __init sunxi_simple_gates_init (struct device_node *node) +{ +sunxi_simple_gates_setup (node,NULL ,0 ); +} + +CLK_OF_DECLARE (sun4i_a10_apb0,"allwinner,sun4i-a10-apb0-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun4i_a10_apb1,"allwinner,sun4i-a10-apb1-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun4i_a10_axi,"allwinner,sun4i-a10-axi-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun5i_a10s_apb0,"allwinner,sun5i-a10s-apb0-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun5i_a10s_apb1,"allwinner,sun5i-a10s-apb1-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun5i_a13_apb0,"allwinner,sun5i-a13-apb0-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun5i_a13_apb1,"allwinner,sun5i-a13-apb1-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun6i_a31_ahb1,"allwinner,sun6i-a31-ahb1-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun6i_a31_apb1,"allwinner,sun6i-a31-apb1-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun6i_a31_apb2,"allwinner,sun6i-a31-apb2-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun7i_a20_apb0,"allwinner,sun7i-a20-apb0-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun7i_a20_apb1,"allwinner,sun7i-a20-apb1-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun8i_a23_ahb1,"allwinner,sun8i-a23-ahb1-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun8i_a23_apb1,"allwinner,sun8i-a23-apb1-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun8i_a23_apb2,"allwinner,sun8i-a23-apb2-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun9i_a80_ahb0,"allwinner,sun9i-a80-ahb0-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun9i_a80_ahb1,"allwinner,sun9i-a80-ahb1-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun9i_a80_ahb2,"allwinner,sun9i-a80-ahb2-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun9i_a80_apb0,"allwinner,sun9i-a80-apb0-gates-clk" , + sunxi_simple_gates_init); +CLK_OF_DECLARE (sun9i_a80_apb1,"allwinner,sun9i-a80-apb1-gates-clk" , + sunxi_simple_gates_init); + +static const int sun4i_a10_ahb_critical_clocks[]__initconst = { +14 ,/* ahb_sdram */ +}; + +static void __init sun4i_a10_ahb_init (struct device_node *node) +{ +sunxi_simple_gates_setup (node, sun4i_a10_ahb_critical_clocks, +ARRAY_SIZE (sun4i_a10_ahb_critical_clocks)); +} +CLK_OF_DECLARE (sun4i_a10_ahb,"allwinner,sun4i-a10-ahb-gates-clk" , + sun4i_a10_ahb_init); +CLK_OF_DECLARE (sun5i_a10s_ahb,"allwinner,sun5i-a10s-ahb-gates-clk" , + sun4i_a10_ahb_init); +CLK_OF_DECLARE (sun5i_a13_ahb,"allwinner,sun5i-a13-ahb-gates-clk" , + sun4i_a10_ahb_init); +CLK_OF_DECLARE (sun7i_a20_ahb,"allwinner,sun7i-a20-ahb-gates-clk" , + sun4i_a10_ahb_init);drivers/clk/sunxi/clk-sunxi.c +0
-178@@ -900,150 +900,6 @@ struct gates_data {DECLARE_BITMAP (mask,SUNXI_GATES_MAX_SIZE ); }; -static const struct gates_data sun4i_axi_gates_data__initconst = { - .mask = {1 }, -}; - -static const struct gates_data sun4i_ahb_gates_data__initconst = { - .mask = {0x7F77FFF ,0x14FB3F }, -}; - -static const struct gates_data sun5i_a10s_ahb_gates_data__initconst = { - .mask = {0x147667e7 ,0x185915 }, -}; - -static const struct gates_data sun5i_a13_ahb_gates_data__initconst = { - .mask = {0x107067e7 ,0x185111 }, -}; - -static const struct gates_data sun6i_a31_ahb1_gates_data__initconst = { - .mask = {0xEDFE7F62 ,0x794F931 }, -}; - -static const struct gates_data sun7i_a20_ahb_gates_data__initconst = { - .mask = {0x12f77fff ,0x16ff3f }, -}; - -static const struct gates_data sun8i_a23_ahb1_gates_data__initconst = { - .mask = {0x25386742 ,0x2505111 }, -}; - -static const struct gates_data sun9i_a80_ahb0_gates_data__initconst = { - .mask = {0xF5F12B }, -}; - -static const struct gates_data sun9i_a80_ahb1_gates_data__initconst = { - .mask = {0x1E20003 }, -}; - -static const struct gates_data sun9i_a80_ahb2_gates_data__initconst = { - .mask = {0x9B7 }, -}; - -static const struct gates_data sun4i_apb0_gates_data__initconst = { - .mask = {0x4EF }, -}; - -static const struct gates_data sun5i_a10s_apb0_gates_data__initconst = { - .mask = {0x469 }, -}; - -static const struct gates_data sun5i_a13_apb0_gates_data__initconst = { - .mask = {0x61 }, -}; - -static const struct gates_data sun7i_a20_apb0_gates_data__initconst = { - .mask = {0x4ff }, -}; - -static const struct gates_data sun9i_a80_apb0_gates_data__initconst = { - .mask = {0xEB822 }, -}; - -static const struct gates_data sun4i_apb1_gates_data__initconst = { - .mask = {0xFF00F7 }, -}; - -static const struct gates_data sun5i_a10s_apb1_gates_data__initconst = { - .mask = {0xf0007 }, -}; - -static const struct gates_data sun5i_a13_apb1_gates_data__initconst = { - .mask = {0xa0007 }, -}; - -static const struct gates_data sun6i_a31_apb1_gates_data__initconst = { - .mask = {0x3031 }, -}; - -static const struct gates_data sun8i_a23_apb1_gates_data__initconst = { - .mask = {0x3021 }, -}; - -static const struct gates_data sun6i_a31_apb2_gates_data__initconst = { - .mask = {0x3F000F }, -}; - -static const struct gates_data sun7i_a20_apb1_gates_data__initconst = { - .mask = {0xff80ff }, -}; - -static const struct gates_data sun9i_a80_apb1_gates_data__initconst = { - .mask = {0x3F001F }, -}; - -static const struct gates_data sun8i_a23_apb2_gates_data__initconst = { - .mask = {0x1F0007 }, -}; - -static void __init sunxi_gates_clk_setup (struct device_node *node, -struct gates_data *data) -{ -struct clk_onecell_data *clk_data; -const char *clk_parent; -const char *clk_name; -void __iomem *reg; -int qty; -int i =0 ; -int j =0 ; - - reg =of_iomap (node,0 ); - - clk_parent =of_clk_get_parent_name (node,0 ); - -/* Worst-case size approximation and memory allocation */ - qty =find_last_bit (data->mask,SUNXI_GATES_MAX_SIZE ); - clk_data =kmalloc (sizeof (struct clk_onecell_data ),GFP_KERNEL ); -if (!clk_data) -return ; - clk_data->clks =kzalloc ((qty+1 ) *sizeof (struct clk *),GFP_KERNEL ); -if (!clk_data->clks) { -kfree (clk_data); -return ; - } - -for_each_set_bit (i, data->mask,SUNXI_GATES_MAX_SIZE ) { -of_property_read_string_index (node,"clock-output-names" , - j, &clk_name); - - clk_data->clks[i] =clk_register_gate (NULL , clk_name, - clk_parent,0 , - reg +4 * (i/32 ), i %32 , -0 , &clk_lock); -WARN_ON (IS_ERR (clk_data->clks[i])); -clk_register_clkdev (clk_data->clks[i], clk_name,NULL ); - - j++; - } - -/* Adjust to the real max */ - clk_data->clk_num = i; - -of_clk_add_provider (node, of_clk_src_onecell_get, clk_data); -} - - -/** * sunxi_divs_clk_setup() helper data */ @@ -1281,34 +1137,6 @@ static const struct of_device_id clk_mux_match[] __initconst = { {} }; -/* Matches for gate clocks */ -static const struct of_device_id clk_gates_match[]__initconst = { - {.compatible ="allwinner,sun4i-a10-axi-gates-clk" , .data = &sun4i_axi_gates_data,}, - {.compatible ="allwinner,sun4i-a10-ahb-gates-clk" , .data = &sun4i_ahb_gates_data,}, - {.compatible ="allwinner,sun5i-a10s-ahb-gates-clk" , .data = &sun5i_a10s_ahb_gates_data,}, - {.compatible ="allwinner,sun5i-a13-ahb-gates-clk" , .data = &sun5i_a13_ahb_gates_data,}, - {.compatible ="allwinner,sun6i-a31-ahb1-gates-clk" , .data = &sun6i_a31_ahb1_gates_data,}, - {.compatible ="allwinner,sun7i-a20-ahb-gates-clk" , .data = &sun7i_a20_ahb_gates_data,}, - {.compatible ="allwinner,sun8i-a23-ahb1-gates-clk" , .data = &sun8i_a23_ahb1_gates_data,}, - {.compatible ="allwinner,sun9i-a80-ahb0-gates-clk" , .data = &sun9i_a80_ahb0_gates_data,}, - {.compatible ="allwinner,sun9i-a80-ahb1-gates-clk" , .data = &sun9i_a80_ahb1_gates_data,}, - {.compatible ="allwinner,sun9i-a80-ahb2-gates-clk" , .data = &sun9i_a80_ahb2_gates_data,}, - {.compatible ="allwinner,sun4i-a10-apb0-gates-clk" , .data = &sun4i_apb0_gates_data,}, - {.compatible ="allwinner,sun5i-a10s-apb0-gates-clk" , .data = &sun5i_a10s_apb0_gates_data,}, - {.compatible ="allwinner,sun5i-a13-apb0-gates-clk" , .data = &sun5i_a13_apb0_gates_data,}, - {.compatible ="allwinner,sun7i-a20-apb0-gates-clk" , .data = &sun7i_a20_apb0_gates_data,}, - {.compatible ="allwinner,sun9i-a80-apb0-gates-clk" , .data = &sun9i_a80_apb0_gates_data,}, - {.compatible ="allwinner,sun4i-a10-apb1-gates-clk" , .data = &sun4i_apb1_gates_data,}, - {.compatible ="allwinner,sun5i-a10s-apb1-gates-clk" , .data = &sun5i_a10s_apb1_gates_data,}, - {.compatible ="allwinner,sun5i-a13-apb1-gates-clk" , .data = &sun5i_a13_apb1_gates_data,}, - {.compatible ="allwinner,sun6i-a31-apb1-gates-clk" , .data = &sun6i_a31_apb1_gates_data,}, - {.compatible ="allwinner,sun7i-a20-apb1-gates-clk" , .data = &sun7i_a20_apb1_gates_data,}, - {.compatible ="allwinner,sun8i-a23-apb1-gates-clk" , .data = &sun8i_a23_apb1_gates_data,}, - {.compatible ="allwinner,sun9i-a80-apb1-gates-clk" , .data = &sun9i_a80_apb1_gates_data,}, - {.compatible ="allwinner,sun6i-a31-apb2-gates-clk" , .data = &sun6i_a31_apb2_gates_data,}, - {.compatible ="allwinner,sun8i-a23-apb2-gates-clk" , .data = &sun8i_a23_apb2_gates_data,}, - {} -};static void __init of_sunxi_table_clock_setup (const struct of_device_id *clk_match,void *function)@@ -1340,9 +1168,6 @@ static void __init sunxi_init_clocks(const char *clocks[], int nclocks)/* Register mux clocks */ of_sunxi_table_clock_setup (clk_mux_match, sunxi_mux_clk_setup); -/* Register gate clocks */ -of_sunxi_table_clock_setup (clk_gates_match, sunxi_gates_clk_setup); -/* Protect the clocks that needs to stay on */ for (i =0 ; i < nclocks; i++) {struct clk *clk =clk_get (NULL , clocks[i]);@@ -1354,7 +1179,6 @@ static void __init sunxi_init_clocks(const char *clocks[], int nclocks)static const char *sun4i_a10_critical_clocks[]__initdata = {"pll5_ddr" , -"ahb_sdram" , };static void __init sun4i_a10_init_clocks (struct device_node *node)@@ -1367,7 +1191,6 @@ CLK_OF_DECLARE(sun4i_a10_clk_init, "allwinner,sun4i-a10", sun4i_a10_init_clocks)static const char *sun5i_critical_clocks[]__initdata = {"cpu" ,"pll5_ddr" , -"ahb_sdram" , };static void __init sun5i_init_clocks (struct device_node *node) --2.4.6
Signature · 4 lines
Michael Turquette CEO BayLibre - At the Heart of Embedded Linux http://baylibre.com/