Skip to content

Commit 362ed48

Browse files
committed
Merge tag 'clk-for-linus-3.10' of git://git.linaro.org/people/mturquette/linux
Pull clock framework update from Michael Turquette: "The common clock framework changes for 3.10 include many fixes for existing platforms, as well as adoption of the framework by new platforms and devices. Some long-needed fixes to the core framework are here as well as new features such as improved initialization of clocks from DT as well as framework reentrancy for nested clock operations." * tag 'clk-for-linus-3.10' of git://git.linaro.org/people/mturquette/linux: (44 commits) clk: add clk_ignore_unused option to keep boot clocks on clk: ux500: fix mismatched types clk: vexpress: Add separate SP810 driver clk: si5351: make clk-si5351 depend on CONFIG_OF clk: export __clk_get_flags for modular clock providers clk: vt8500: Missing breaks in vtwm_pll_round_rate/_set_rate. clk: sunxi: Unify oscillator clock clk: composite: allow fixed rates & fixed dividers clk: composite: rename 'div' references to 'rate' clk: add si5351 i2c common clock driver clk: add device tree fixed-factor-clock binding support clk: Properly handle notifier return values clk: ux500: abx500: Define clock tree for ab850x clk: ux500: Add support for sysctrl clocks clk: mvebu: Fix valid value range checking for cpu_freq_select clk: Fixup locking issues for clk_set_parent clk: Fixup errorhandling for clk_set_parent clk: Restructure code for __clk_reparent clk: sunxi: drop an unnecesary kmalloc clk: sunxi: drop CLK_IGNORE_UNUSED ...
2 parents 61f3d0a + 1e43525 commit 362ed48

48 files changed

Lines changed: 4518 additions & 304 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/arm/sunxi/clocks.txt‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Frequently asked questions about the sunxi clock system
2+
=======================================================
3+
4+
This document contains useful bits of information that people tend to ask
5+
about the sunxi clock system, as well as accompanying ASCII art when adequate.
6+
7+
Q: Why is the main 24MHz oscillator gatable? Wouldn't that break the
8+
system?
9+
10+
A: The 24MHz oscillator allows gating to save power. Indeed, if gated
11+
carelessly the system would stop functioning, but with the right
12+
steps, one can gate it and keep the system running. Consider this
13+
simplified suspend example:
14+
15+
While the system is operational, you would see something like
16+
17+
24MHz 32kHz
18+
|
19+
PLL1
20+
\
21+
\_ CPU Mux
22+
|
23+
[CPU]
24+
25+
When you are about to suspend, you switch the CPU Mux to the 32kHz
26+
oscillator:
27+
28+
24Mhz 32kHz
29+
| |
30+
PLL1 |
31+
/
32+
CPU Mux _/
33+
|
34+
[CPU]
35+
36+
Finally you can gate the main oscillator
37+
38+
32kHz
39+
|
40+
|
41+
/
42+
CPU Mux _/
43+
|
44+
[CPU]
45+
46+
Q: Were can I learn more about the sunxi clocks?
47+
48+
A: The linux-sunxi wiki contains a page documenting the clock registers,
49+
you can find it at
50+
51+
http://linux-sunxi.org/A10/CCM
52+
53+
The authoritative source for information at this time is the ccmu driver
54+
released by Allwinner, you can find it at
55+
56+
https://github.com/linux-sunxi/linux-sunxi/tree/sunxi-3.0/arch/arm/mach-sun4i/clock/ccmu

‎Documentation/clk.txt‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ int clk_foo_enable(struct clk_hw *hw)
174174
};
175175

176176
Below is a matrix detailing which clk_ops are mandatory based upon the
177-
hardware capbilities of that clock. A cell marked as "y" means
177+
hardware capabilities of that clock. A cell marked as "y" means
178178
mandatory, a cell marked as "n" implies that either including that
179-
callback is invalid or otherwise uneccesary. Empty cells are either
179+
callback is invalid or otherwise unnecessary. Empty cells are either
180180
optional or must be evaluated on a case-by-case basis.
181181

182182
clock hardware characteristics
@@ -231,3 +231,14 @@ To better enforce this policy, always follow this simple rule: any
231231
statically initialized clock data MUST be defined in a separate file
232232
from the logic that implements its ops. Basically separate the logic
233233
from the data and all is well.
234+
235+
Part 6 - Disabling clock gating of unused clocks
236+
237+
Sometimes during development it can be useful to be able to bypass the
238+
default disabling of unused clocks. For example, if drivers aren't enabling
239+
clocks properly but rely on them being on from the bootloader, bypassing
240+
the disabling means that the driver will remain functional while the issues
241+
are sorted out.
242+
243+
To bypass this disabling, include "clk_ignore_unused" in the bootargs to the
244+
kernel.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Binding for the axi-clkgen clock generator
2+
3+
This binding uses the common clock binding[1].
4+
5+
[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
6+
7+
Required properties:
8+
- compatible : shall be "adi,axi-clkgen".
9+
- #clock-cells : from common clock binding; Should always be set to 0.
10+
- reg : Address and length of the axi-clkgen register set.
11+
- clocks : Phandle and clock specifier for the parent clock.
12+
13+
Optional properties:
14+
- clock-output-names : From common clock binding.
15+
16+
Example:
17+
clock@0xff000000 {
18+
compatible = "adi,axi-clkgen";
19+
#clock-cells = <0>;
20+
reg = <0xff000000 0x1000>;
21+
clocks = <&osc 1>;
22+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Binding for simple fixed factor rate clock sources.
2+
3+
This binding uses the common clock binding[1].
4+
5+
[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
6+
7+
Required properties:
8+
- compatible : shall be "fixed-factor-clock".
9+
- #clock-cells : from common clock binding; shall be set to 0.
10+
- clock-div: fixed divider.
11+
- clock-mult: fixed multiplier.
12+
- clocks: parent clock.
13+
14+
Optional properties:
15+
- clock-output-names : From common clock binding.
16+
17+
Example:
18+
clock {
19+
compatible = "fixed-factor-clock";
20+
clocks = <&parentclk>;
21+
#clock-cells = <0>;
22+
div = <2>;
23+
mult = <1>;
24+
};
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
Binding for Silicon Labs Si5351a/b/c programmable i2c clock generator.
2+
3+
Reference
4+
[1] Si5351A/B/C Data Sheet
5+
http://www.silabs.com/Support%20Documents/TechnicalDocs/Si5351.pdf
6+
7+
The Si5351a/b/c are programmable i2c clock generators with upto 8 output
8+
clocks. Si5351a also has a reduced pin-count package (MSOP10) where only
9+
3 output clocks are accessible. The internal structure of the clock
10+
generators can be found in [1].
11+
12+
==I2C device node==
13+
14+
Required properties:
15+
- compatible: shall be one of "silabs,si5351{a,a-msop,b,c}".
16+
- reg: i2c device address, shall be 0x60 or 0x61.
17+
- #clock-cells: from common clock binding; shall be set to 1.
18+
- clocks: from common clock binding; list of parent clock
19+
handles, shall be xtal reference clock or xtal and clkin for
20+
si5351c only.
21+
- #address-cells: shall be set to 1.
22+
- #size-cells: shall be set to 0.
23+
24+
Optional properties:
25+
- silabs,pll-source: pair of (number, source) for each pll. Allows
26+
to overwrite clock source of pll A (number=0) or B (number=1).
27+
28+
==Child nodes==
29+
30+
Each of the clock outputs can be overwritten individually by
31+
using a child node to the I2C device node. If a child node for a clock
32+
output is not set, the eeprom configuration is not overwritten.
33+
34+
Required child node properties:
35+
- reg: number of clock output.
36+
37+
Optional child node properties:
38+
- silabs,clock-source: source clock of the output divider stage N, shall be
39+
0 = multisynth N
40+
1 = multisynth 0 for output clocks 0-3, else multisynth4
41+
2 = xtal
42+
3 = clkin (si5351c only)
43+
- silabs,drive-strength: output drive strength in mA, shall be one of {2,4,6,8}.
44+
- silabs,multisynth-source: source pll A(0) or B(1) of corresponding multisynth
45+
divider.
46+
- silabs,pll-master: boolean, multisynth can change pll frequency.
47+
48+
==Example==
49+
50+
/* 25MHz reference crystal */
51+
ref25: ref25M {
52+
compatible = "fixed-clock";
53+
#clock-cells = <0>;
54+
clock-frequency = <25000000>;
55+
};
56+
57+
i2c-master-node {
58+
59+
/* Si5351a msop10 i2c clock generator */
60+
si5351a: clock-generator@60 {
61+
compatible = "silabs,si5351a-msop";
62+
reg = <0x60>;
63+
#address-cells = <1>;
64+
#size-cells = <0>;
65+
#clock-cells = <1>;
66+
67+
/* connect xtal input to 25MHz reference */
68+
clocks = <&ref25>;
69+
70+
/* connect xtal input as source of pll0 and pll1 */
71+
silabs,pll-source = <0 0>, <1 0>;
72+
73+
/*
74+
* overwrite clkout0 configuration with:
75+
* - 8mA output drive strength
76+
* - pll0 as clock source of multisynth0
77+
* - multisynth0 as clock source of output divider
78+
* - multisynth0 can change pll0
79+
* - set initial clock frequency of 74.25MHz
80+
*/
81+
clkout0 {
82+
reg = <0>;
83+
silabs,drive-strength = <8>;
84+
silabs,multisynth-source = <0>;
85+
silabs,clock-source = <0>;
86+
silabs,pll-master;
87+
clock-frequency = <74250000>;
88+
};
89+
90+
/*
91+
* overwrite clkout1 configuration with:
92+
* - 4mA output drive strength
93+
* - pll1 as clock source of multisynth1
94+
* - multisynth1 as clock source of output divider
95+
* - multisynth1 can change pll1
96+
*/
97+
clkout1 {
98+
reg = <1>;
99+
silabs,drive-strength = <4>;
100+
silabs,multisynth-source = <1>;
101+
silabs,clock-source = <0>;
102+
pll-master;
103+
};
104+
105+
/*
106+
* overwrite clkout2 configuration with:
107+
* - xtal as clock source of output divider
108+
*/
109+
clkout2 {
110+
reg = <2>;
111+
silabs,clock-source = <2>;
112+
};
113+
};
114+
};
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
Device Tree Clock bindings for arch-sunxi
2+
3+
This binding uses the common clock binding[1].
4+
5+
[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
6+
7+
Required properties:
8+
- compatible : shall be one of the following:
9+
"allwinner,sun4i-osc-clk" - for a gatable oscillator
10+
"allwinner,sun4i-pll1-clk" - for the main PLL clock
11+
"allwinner,sun4i-cpu-clk" - for the CPU multiplexer clock
12+
"allwinner,sun4i-axi-clk" - for the AXI clock
13+
"allwinner,sun4i-axi-gates-clk" - for the AXI gates
14+
"allwinner,sun4i-ahb-clk" - for the AHB clock
15+
"allwinner,sun4i-ahb-gates-clk" - for the AHB gates
16+
"allwinner,sun4i-apb0-clk" - for the APB0 clock
17+
"allwinner,sun4i-apb0-gates-clk" - for the APB0 gates
18+
"allwinner,sun4i-apb1-clk" - for the APB1 clock
19+
"allwinner,sun4i-apb1-mux-clk" - for the APB1 clock muxing
20+
"allwinner,sun4i-apb1-gates-clk" - for the APB1 gates
21+
22+
Required properties for all clocks:
23+
- reg : shall be the control register address for the clock.
24+
- clocks : shall be the input parent clock(s) phandle for the clock
25+
- #clock-cells : from common clock binding; shall be set to 0 except for
26+
"allwinner,sun4i-*-gates-clk" where it shall be set to 1
27+
28+
Additionally, "allwinner,sun4i-*-gates-clk" clocks require:
29+
- clock-output-names : the corresponding gate names that the clock controls
30+
31+
For example:
32+
33+
osc24M: osc24M@01c20050 {
34+
#clock-cells = <0>;
35+
compatible = "allwinner,sun4i-osc-clk";
36+
reg = <0x01c20050 0x4>;
37+
clocks = <&osc24M_fixed>;
38+
};
39+
40+
pll1: pll1@01c20000 {
41+
#clock-cells = <0>;
42+
compatible = "allwinner,sun4i-pll1-clk";
43+
reg = <0x01c20000 0x4>;
44+
clocks = <&osc24M>;
45+
};
46+
47+
cpu: cpu@01c20054 {
48+
#clock-cells = <0>;
49+
compatible = "allwinner,sun4i-cpu-clk";
50+
reg = <0x01c20054 0x4>;
51+
clocks = <&osc32k>, <&osc24M>, <&pll1>;
52+
};
53+
54+
55+
56+
Gate clock outputs
57+
58+
The "allwinner,sun4i-*-gates-clk" clocks provide several gatable outputs;
59+
their corresponding offsets as present on sun4i are listed below. Note that
60+
some of these gates are not present on sun5i.
61+
62+
* AXI gates ("allwinner,sun4i-axi-gates-clk")
63+
64+
DRAM 0
65+
66+
* AHB gates ("allwinner,sun4i-ahb-gates-clk")
67+
68+
USB0 0
69+
EHCI0 1
70+
OHCI0 2*
71+
EHCI1 3
72+
OHCI1 4*
73+
SS 5
74+
DMA 6
75+
BIST 7
76+
MMC0 8
77+
MMC1 9
78+
MMC2 10
79+
MMC3 11
80+
MS 12**
81+
NAND 13
82+
SDRAM 14
83+
84+
ACE 16
85+
EMAC 17
86+
TS 18
87+
88+
SPI0 20
89+
SPI1 21
90+
SPI2 22
91+
SPI3 23
92+
PATA 24
93+
SATA 25**
94+
GPS 26*
95+
96+
VE 32
97+
TVD 33
98+
TVE0 34
99+
TVE1 35
100+
LCD0 36
101+
LCD1 37
102+
103+
CSI0 40
104+
CSI1 41
105+
106+
HDMI 43
107+
DE_BE0 44
108+
DE_BE1 45
109+
DE_FE0 46
110+
DE_FE1 47
111+
112+
MP 50
113+
114+
MALI400 52
115+
116+
* APB0 gates ("allwinner,sun4i-apb0-gates-clk")
117+
118+
CODEC 0
119+
SPDIF 1*
120+
AC97 2
121+
IIS 3
122+
123+
PIO 5
124+
IR0 6
125+
IR1 7
126+
127+
KEYPAD 10
128+
129+
* APB1 gates ("allwinner,sun4i-apb1-gates-clk")
130+
131+
I2C0 0
132+
I2C1 1
133+
I2C2 2
134+
135+
CAN 4
136+
SCR 5
137+
PS20 6
138+
PS21 7
139+
140+
UART0 16
141+
UART1 17
142+
UART2 18
143+
UART3 19
144+
UART4 20
145+
UART5 21
146+
UART6 22
147+
UART7 23
148+
149+
Notation:
150+
[*]: The datasheet didn't mention these, but they are present on AW code
151+
[**]: The datasheet had this marked as "NC" but they are used on AW code

0 commit comments

Comments
 (0)