GNU Linux-libre 4.14.294-gnu1
[releases.git] / Documentation / devicetree / bindings / clock / at91-clock.txt
1 Device Tree Clock bindings for arch-at91
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         "atmel,at91sam9x5-sckc" or
10         "atmel,sama5d4-sckc":
11                 at91 SCKC (Slow Clock Controller)
12                 This node contains the slow clock definitions.
13
14         "atmel,at91sam9x5-clk-slow-osc":
15                 at91 slow oscillator
16
17         "atmel,at91sam9x5-clk-slow-rc-osc":
18                 at91 internal slow RC oscillator
19
20         "atmel,at91rm9200-pmc" or
21         "atmel,at91sam9g45-pmc" or
22         "atmel,at91sam9n12-pmc" or
23         "atmel,at91sam9x5-pmc" or
24         "atmel,sama5d3-pmc":
25                 at91 PMC (Power Management Controller)
26                 All at91 specific clocks (clocks defined below) must be child
27                 node of the PMC node.
28
29         "atmel,at91sam9x5-clk-slow" (under sckc node)
30         or
31         "atmel,at91sam9260-clk-slow" (under pmc node):
32                 at91 slow clk
33
34         "atmel,at91rm9200-clk-main-osc"
35         "atmel,at91sam9x5-clk-main-rc-osc"
36                 at91 main clk sources
37
38         "atmel,at91sam9x5-clk-main"
39         "atmel,at91rm9200-clk-main":
40                 at91 main clock
41
42         "atmel,at91rm9200-clk-master" or
43         "atmel,at91sam9x5-clk-master":
44                 at91 master clock
45
46         "atmel,at91sam9x5-clk-peripheral" or
47         "atmel,at91rm9200-clk-peripheral":
48                 at91 peripheral clocks
49
50         "atmel,at91rm9200-clk-pll" or
51         "atmel,at91sam9g45-clk-pll" or
52         "atmel,at91sam9g20-clk-pllb" or
53         "atmel,sama5d3-clk-pll":
54                 at91 pll clocks
55
56         "atmel,at91sam9x5-clk-plldiv":
57                 at91 plla divisor
58
59         "atmel,at91rm9200-clk-programmable" or
60         "atmel,at91sam9g45-clk-programmable" or
61         "atmel,at91sam9x5-clk-programmable":
62                 at91 programmable clocks
63
64         "atmel,at91sam9x5-clk-smd":
65                 at91 SMD (Soft Modem) clock
66
67         "atmel,at91rm9200-clk-system":
68                 at91 system clocks
69
70         "atmel,at91rm9200-clk-usb" or
71         "atmel,at91sam9x5-clk-usb" or
72         "atmel,at91sam9n12-clk-usb":
73                 at91 usb clock
74
75         "atmel,at91sam9x5-clk-utmi":
76                 at91 utmi clock
77
78         "atmel,sama5d4-clk-h32mx":
79                 at91 h32mx clock
80
81         "atmel,sama5d2-clk-generated":
82                 at91 generated clock
83
84         "atmel,sama5d2-clk-audio-pll-frac":
85                 at91 audio fractional pll
86
87         "atmel,sama5d2-clk-audio-pll-pad":
88                 at91 audio pll CLK_AUDIO output pin
89
90         "atmel,sama5d2-clk-audio-pll-pmc"
91                 at91 audio pll output on AUDIOPLLCLK that feeds the PMC
92                 and can be used by peripheral clock or generic clock
93
94 Required properties for SCKC node:
95 - reg : defines the IO memory reserved for the SCKC.
96 - #size-cells : shall be 0 (reg is used to encode clk id).
97 - #address-cells : shall be 1 (reg is used to encode clk id).
98
99
100 For example:
101         sckc: sckc@fffffe50 {
102                 compatible = "atmel,sama5d3-pmc";
103                 reg = <0xfffffe50 0x4>
104                 #size-cells = <0>;
105                 #address-cells = <1>;
106
107                 /* put at91 slow clocks here */
108         };
109
110
111 Required properties for internal slow RC oscillator:
112 - #clock-cells : from common clock binding; shall be set to 0.
113 - clock-frequency : define the internal RC oscillator frequency.
114
115 Optional properties:
116 - clock-accuracy : define the internal RC oscillator accuracy.
117
118 For example:
119         slow_rc_osc: slow_rc_osc {
120                 compatible = "atmel,at91sam9x5-clk-slow-rc-osc";
121                 clock-frequency = <32768>;
122                 clock-accuracy = <50000000>;
123         };
124
125 Required properties for slow oscillator:
126 - #clock-cells : from common clock binding; shall be set to 0.
127 - clocks : shall encode the main osc source clk sources (see atmel datasheet).
128
129 Optional properties:
130 - atmel,osc-bypass : boolean property. Set this when a clock signal is directly
131   provided on XIN.
132
133 For example:
134         slow_osc: slow_osc {
135                 compatible = "atmel,at91rm9200-clk-slow-osc";
136                 #clock-cells = <0>;
137                 clocks = <&slow_xtal>;
138         };
139
140 Required properties for slow clock:
141 - #clock-cells : from common clock binding; shall be set to 0.
142 - clocks : shall encode the slow clk sources (see atmel datasheet).
143
144 For example:
145         clk32k: slck {
146                 compatible = "atmel,at91sam9x5-clk-slow";
147                 #clock-cells = <0>;
148                 clocks = <&slow_rc_osc &slow_osc>;
149         };
150
151 Required properties for PMC node:
152 - reg : defines the IO memory reserved for the PMC.
153 - #size-cells : shall be 0 (reg is used to encode clk id).
154 - #address-cells : shall be 1 (reg is used to encode clk id).
155 - interrupts : shall be set to PMC interrupt line.
156 - interrupt-controller : tell that the PMC is an interrupt controller.
157 - #interrupt-cells : must be set to 1. The first cell encodes the interrupt id,
158         and reflect the bit position in the PMC_ER/DR/SR registers.
159         You can use the dt macros defined in dt-bindings/clock/at91.h.
160         0 (AT91_PMC_MOSCS) -> main oscillator ready
161         1 (AT91_PMC_LOCKA) -> PLL A ready
162         2 (AT91_PMC_LOCKB) -> PLL B ready
163         3 (AT91_PMC_MCKRDY) -> master clock ready
164         6 (AT91_PMC_LOCKU) -> UTMI PLL clock ready
165         8 .. 15 (AT91_PMC_PCKRDY(id)) -> programmable clock ready
166         16 (AT91_PMC_MOSCSELS) -> main oscillator selected
167         17 (AT91_PMC_MOSCRCS) -> RC main oscillator stabilized
168         18 (AT91_PMC_CFDEV) -> clock failure detected
169
170 For example:
171         pmc: pmc@fffffc00 {
172                 compatible = "atmel,sama5d3-pmc";
173                 interrupts = <1 4 7>;
174                 interrupt-controller;
175                 #interrupt-cells = <2>;
176                 #size-cells = <0>;
177                 #address-cells = <1>;
178
179                 /* put at91 clocks here */
180         };
181
182 Required properties for main clock internal RC oscillator:
183 - interrupt-parent : must reference the PMC node.
184 - interrupts : shall be set to "<0>".
185 - clock-frequency : define the internal RC oscillator frequency.
186
187 Optional properties:
188 - clock-accuracy : define the internal RC oscillator accuracy.
189
190 For example:
191         main_rc_osc: main_rc_osc {
192                 compatible = "atmel,at91sam9x5-clk-main-rc-osc";
193                 interrupt-parent = <&pmc>;
194                 interrupts = <0>;
195                 clock-frequency = <12000000>;
196                 clock-accuracy = <50000000>;
197         };
198
199 Required properties for main clock oscillator:
200 - interrupt-parent : must reference the PMC node.
201 - interrupts : shall be set to "<0>".
202 - #clock-cells : from common clock binding; shall be set to 0.
203 - clocks : shall encode the main osc source clk sources (see atmel datasheet).
204
205 Optional properties:
206 - atmel,osc-bypass : boolean property. Specified if a clock signal is provided
207   on XIN.
208
209   clock signal is directly provided on XIN pin.
210
211 For example:
212         main_osc: main_osc {
213                 compatible = "atmel,at91rm9200-clk-main-osc";
214                 interrupt-parent = <&pmc>;
215                 interrupts = <0>;
216                 #clock-cells = <0>;
217                 clocks = <&main_xtal>;
218         };
219
220 Required properties for main clock:
221 - interrupt-parent : must reference the PMC node.
222 - interrupts : shall be set to "<0>".
223 - #clock-cells : from common clock binding; shall be set to 0.
224 - clocks : shall encode the main clk sources (see atmel datasheet).
225
226 For example:
227         main: mainck {
228                 compatible = "atmel,at91sam9x5-clk-main";
229                 interrupt-parent = <&pmc>;
230                 interrupts = <0>;
231                 #clock-cells = <0>;
232                 clocks = <&main_rc_osc &main_osc>;
233         };
234
235 Required properties for master clock:
236 - interrupt-parent : must reference the PMC node.
237 - interrupts : shall be set to "<3>".
238 - #clock-cells : from common clock binding; shall be set to 0.
239 - clocks : shall be the master clock sources (see atmel datasheet) phandles.
240         e.g. "<&ck32k>, <&main>, <&plla>, <&pllb>".
241 - atmel,clk-output-range : minimum and maximum clock frequency (two u32
242                            fields).
243            e.g. output = <0 133000000>; <=> 0 to 133MHz.
244 - atmel,clk-divisors : master clock divisors table (four u32 fields).
245                 0 <=> reserved value.
246                 e.g. divisors = <1 2 4 6>;
247 - atmel,master-clk-have-div3-pres : some SoC use the reserved value 7 in the
248                                     PRES field as CLOCK_DIV3 (e.g sam9x5).
249
250 For example:
251         mck: mck {
252                 compatible = "atmel,at91rm9200-clk-master";
253                 interrupt-parent = <&pmc>;
254                 interrupts = <3>;
255                 #clock-cells = <0>;
256                 atmel,clk-output-range = <0 133000000>;
257                 atmel,clk-divisors = <1 2 4 0>;
258         };
259
260 Required properties for peripheral clocks:
261 - #size-cells : shall be 0 (reg is used to encode clk id).
262 - #address-cells : shall be 1 (reg is used to encode clk id).
263 - clocks : shall be the master clock phandle.
264         e.g. clocks = <&mck>;
265 - name: device tree node describing a specific peripheral clock.
266         * #clock-cells : from common clock binding; shall be set to 0.
267         * reg: peripheral id. See Atmel's datasheets to get a full
268           list of peripheral ids.
269         * atmel,clk-output-range : minimum and maximum clock frequency
270           (two u32 fields). Only valid on at91sam9x5-clk-peripheral
271           compatible IPs.
272
273 For example:
274         periph: periphck {
275                 compatible = "atmel,at91sam9x5-clk-peripheral";
276                 #size-cells = <0>;
277                 #address-cells = <1>;
278                 clocks = <&mck>;
279
280                 ssc0_clk {
281                         #clock-cells = <0>;
282                         reg = <2>;
283                         atmel,clk-output-range = <0 133000000>;
284                 };
285
286                 usart0_clk {
287                         #clock-cells = <0>;
288                         reg = <3>;
289                         atmel,clk-output-range = <0 66000000>;
290                 };
291         };
292
293
294 Required properties for pll clocks:
295 - interrupt-parent : must reference the PMC node.
296 - interrupts : shall be set to "<1>".
297 - #clock-cells : from common clock binding; shall be set to 0.
298 - clocks : shall be the main clock phandle.
299 - reg : pll id.
300         0 -> PLL A
301         1 -> PLL B
302 - atmel,clk-input-range : minimum and maximum source clock frequency (two u32
303                           fields).
304           e.g. input = <1 32000000>; <=> 1 to 32MHz.
305 - #atmel,pll-clk-output-range-cells : number of cells reserved for pll output
306                                       range description. Sould be set to 2, 3
307                                       or 4.
308         * 1st and 2nd cells represent the frequency range (min-max).
309         * 3rd cell is optional and represents the OUT field value for the given
310           range.
311         * 4th cell is optional and represents the ICPLL field (PLLICPR
312           register)
313 - atmel,pll-clk-output-ranges : pll output frequency ranges + optional parameter
314                                 depending on #atmel,pll-output-range-cells
315                                 property value.
316
317 For example:
318         plla: pllack {
319                 compatible = "atmel,at91sam9g45-clk-pll";
320                 interrupt-parent = <&pmc>;
321                 interrupts = <1>;
322                 #clock-cells = <0>;
323                 clocks = <&main>;
324                 reg = <0>;
325                 atmel,clk-input-range = <2000000 32000000>;
326                 #atmel,pll-clk-output-range-cells = <4>;
327                 atmel,pll-clk-output-ranges = <74500000 800000000 0 0
328                                                69500000 750000000 1 0
329                                                64500000 700000000 2 0
330                                                59500000 650000000 3 0
331                                                54500000 600000000 0 1
332                                                49500000 550000000 1 1
333                                                44500000 500000000 2 1
334                                                40000000 450000000 3 1>;
335         };
336
337 Required properties for plldiv clocks (plldiv = pll / 2):
338 - #clock-cells : from common clock binding; shall be set to 0.
339 - clocks : shall be the plla clock phandle.
340
341 The pll divisor is equal to 2 and cannot be changed.
342
343 For example:
344         plladiv: plladivck {
345                 compatible = "atmel,at91sam9x5-clk-plldiv";
346                 #clock-cells = <0>;
347                 clocks = <&plla>;
348         };
349
350 Required properties for programmable clocks:
351 - interrupt-parent : must reference the PMC node.
352 - #size-cells : shall be 0 (reg is used to encode clk id).
353 - #address-cells : shall be 1 (reg is used to encode clk id).
354 - clocks : shall be the programmable clock source phandles.
355         e.g. clocks = <&clk32k>, <&main>, <&plla>, <&pllb>;
356 - name: device tree node describing a specific prog clock.
357         * #clock-cells : from common clock binding; shall be set to 0.
358         * reg : programmable clock id (register offset from  PCKx
359                          register).
360         * interrupts : shall be set to "<(8 + id)>".
361
362 For example:
363         prog: progck {
364                 compatible = "atmel,at91sam9g45-clk-programmable";
365                 #size-cells = <0>;
366                 #address-cells = <1>;
367                 interrupt-parent = <&pmc>;
368                 clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>;
369
370                 prog0 {
371                         #clock-cells = <0>;
372                         reg = <0>;
373                         interrupts = <8>;
374                 };
375
376                 prog1 {
377                         #clock-cells = <0>;
378                         reg = <1>;
379                         interrupts = <9>;
380                 };
381         };
382
383
384 Required properties for smd clock:
385 - #clock-cells : from common clock binding; shall be set to 0.
386 - clocks : shall be the smd clock source phandles.
387         e.g. clocks = <&plladiv>, <&utmi>;
388
389 For example:
390         smd: smdck {
391                 compatible = "atmel,at91sam9x5-clk-smd";
392                 #clock-cells = <0>;
393                 clocks = <&plladiv>, <&utmi>;
394         };
395
396 Required properties for system clocks:
397 - #size-cells : shall be 0 (reg is used to encode clk id).
398 - #address-cells : shall be 1 (reg is used to encode clk id).
399 - name: device tree node describing a specific system clock.
400         * #clock-cells : from common clock binding; shall be set to 0.
401         * reg: system clock id (bit position in SCER/SCDR/SCSR registers).
402               See Atmel's datasheet to get a full list of system clock ids.
403
404 For example:
405         system: systemck {
406                 compatible = "atmel,at91rm9200-clk-system";
407                 #address-cells = <1>;
408                 #size-cells = <0>;
409
410                 ddrck {
411                         #clock-cells = <0>;
412                         reg = <2>;
413                         clocks = <&mck>;
414                 };
415
416                 uhpck {
417                         #clock-cells = <0>;
418                         reg = <6>;
419                         clocks = <&usb>;
420                 };
421
422                 udpck {
423                         #clock-cells = <0>;
424                         reg = <7>;
425                         clocks = <&usb>;
426                 };
427         };
428
429
430 Required properties for usb clock:
431 - #clock-cells : from common clock binding; shall be set to 0.
432 - clocks : shall be the smd clock source phandles.
433         e.g. clocks = <&pllb>;
434 - atmel,clk-divisors (only available for "atmel,at91rm9200-clk-usb"):
435         usb clock divisor table.
436         e.g. divisors = <1 2 4 0>;
437
438 For example:
439         usb: usbck {
440                 compatible = "atmel,at91sam9x5-clk-usb";
441                 #clock-cells = <0>;
442                 clocks = <&plladiv>, <&utmi>;
443         };
444
445         usb: usbck {
446                 compatible = "atmel,at91rm9200-clk-usb";
447                 #clock-cells = <0>;
448                 clocks = <&pllb>;
449                 atmel,clk-divisors = <1 2 4 0>;
450         };
451
452
453 Required properties for utmi clock:
454 - interrupt-parent : must reference the PMC node.
455 - interrupts : shall be set to "<AT91_PMC_LOCKU IRQ_TYPE_LEVEL_HIGH>".
456 - #clock-cells : from common clock binding; shall be set to 0.
457 - clocks : shall be the main clock source phandle.
458
459 For example:
460         utmi: utmick {
461                 compatible = "atmel,at91sam9x5-clk-utmi";
462                 interrupt-parent = <&pmc>;
463                 interrupts = <AT91_PMC_LOCKU IRQ_TYPE_LEVEL_HIGH>;
464                 #clock-cells = <0>;
465                 clocks = <&main>;
466         };
467
468 Required properties for 32 bits bus Matrix clock (h32mx clock):
469 - #clock-cells : from common clock binding; shall be set to 0.
470 - clocks : shall be the master clock source phandle.
471
472 For example:
473         h32ck: h32mxck {
474                 #clock-cells = <0>;
475                 compatible = "atmel,sama5d4-clk-h32mx";
476                 clocks = <&mck>;
477         };
478
479 Required properties for generated clocks:
480 - #size-cells : shall be 0 (reg is used to encode clk id).
481 - #address-cells : shall be 1 (reg is used to encode clk id).
482 - clocks : shall be the generated clock source phandles.
483         e.g. clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>, <&audio_pll_pmc>;
484 - name: device tree node describing a specific generated clock.
485         * #clock-cells : from common clock binding; shall be set to 0.
486         * reg: peripheral id. See Atmel's datasheets to get a full
487           list of peripheral ids.
488         * atmel,clk-output-range : minimum and maximum clock frequency
489           (two u32 fields).
490
491 For example:
492         gck {
493                 compatible = "atmel,sama5d2-clk-generated";
494                 #address-cells = <1>;
495                 #size-cells = <0>;
496                 clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>, <&audio_pll_pmc>;
497
498                 tcb0_gclk: tcb0_gclk {
499                         #clock-cells = <0>;
500                         reg = <35>;
501                         atmel,clk-output-range = <0 83000000>;
502                 };
503
504                 pwm_gclk: pwm_gclk {
505                         #clock-cells = <0>;
506                         reg = <38>;
507                         atmel,clk-output-range = <0 83000000>;
508                 };
509         };