Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
Device Tree Clock bindings for arch-at91

This binding uses the common clock binding[1].

[1] Documentation/devicetree/bindings/clock/clock-bindings.txt

Required properties:
- compatible : shall be one of the following:
	"atmel,at91sam9x5-sckc" or
	"atmel,sama5d4-sckc":
		at91 SCKC (Slow Clock Controller)
		This node contains the slow clock definitions.

	"atmel,at91sam9x5-clk-slow-osc":
		at91 slow oscillator

	"atmel,at91sam9x5-clk-slow-rc-osc":
		at91 internal slow RC oscillator

	"atmel,at91rm9200-pmc" or
	"atmel,at91sam9g45-pmc" or
	"atmel,at91sam9n12-pmc" or
	"atmel,at91sam9x5-pmc" or
	"atmel,sama5d3-pmc":
		at91 PMC (Power Management Controller)
		All at91 specific clocks (clocks defined below) must be child
		node of the PMC node.

	"atmel,at91sam9x5-clk-slow" (under sckc node)
	or
	"atmel,at91sam9260-clk-slow" (under pmc node):
		at91 slow clk

	"atmel,at91rm9200-clk-main-osc"
	"atmel,at91sam9x5-clk-main-rc-osc"
		at91 main clk sources

	"atmel,at91sam9x5-clk-main"
	"atmel,at91rm9200-clk-main":
		at91 main clock

	"atmel,at91rm9200-clk-master" or
	"atmel,at91sam9x5-clk-master":
		at91 master clock

	"atmel,at91sam9x5-clk-peripheral" or
	"atmel,at91rm9200-clk-peripheral":
		at91 peripheral clocks

	"atmel,at91rm9200-clk-pll" or
	"atmel,at91sam9g45-clk-pll" or
	"atmel,at91sam9g20-clk-pllb" or
	"atmel,sama5d3-clk-pll":
		at91 pll clocks

	"atmel,at91sam9x5-clk-plldiv":
		at91 plla divisor

	"atmel,at91rm9200-clk-programmable" or
	"atmel,at91sam9g45-clk-programmable" or
	"atmel,at91sam9x5-clk-programmable":
		at91 programmable clocks

	"atmel,at91sam9x5-clk-smd":
		at91 SMD (Soft Modem) clock

	"atmel,at91rm9200-clk-system":
		at91 system clocks

	"atmel,at91rm9200-clk-usb" or
	"atmel,at91sam9x5-clk-usb" or
	"atmel,at91sam9n12-clk-usb":
		at91 usb clock

	"atmel,at91sam9x5-clk-utmi":
		at91 utmi clock

	"atmel,sama5d4-clk-h32mx":
		at91 h32mx clock

	"atmel,sama5d2-clk-generated":
		at91 generated clock

Required properties for SCKC node:
- reg : defines the IO memory reserved for the SCKC.
- #size-cells : shall be 0 (reg is used to encode clk id).
- #address-cells : shall be 1 (reg is used to encode clk id).


For example:
	sckc: sckc@fffffe50 {
		compatible = "atmel,sama5d3-pmc";
		reg = <0xfffffe50 0x4>
		#size-cells = <0>;
		#address-cells = <1>;

		/* put at91 slow clocks here */
	};


Required properties for internal slow RC oscillator:
- #clock-cells : from common clock binding; shall be set to 0.
- clock-frequency : define the internal RC oscillator frequency.

Optional properties:
- clock-accuracy : define the internal RC oscillator accuracy.

For example:
	slow_rc_osc: slow_rc_osc {
		compatible = "atmel,at91sam9x5-clk-slow-rc-osc";
		clock-frequency = <32768>;
		clock-accuracy = <50000000>;
	};

Required properties for slow oscillator:
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall encode the main osc source clk sources (see atmel datasheet).

Optional properties:
- atmel,osc-bypass : boolean property. Set this when a clock signal is directly
  provided on XIN.

For example:
	slow_osc: slow_osc {
		compatible = "atmel,at91rm9200-clk-slow-osc";
		#clock-cells = <0>;
		clocks = <&slow_xtal>;
	};

Required properties for slow clock:
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall encode the slow clk sources (see atmel datasheet).

For example:
	clk32k: slck {
		compatible = "atmel,at91sam9x5-clk-slow";
		#clock-cells = <0>;
		clocks = <&slow_rc_osc &slow_osc>;
	};

Required properties for PMC node:
- reg : defines the IO memory reserved for the PMC.
- #size-cells : shall be 0 (reg is used to encode clk id).
- #address-cells : shall be 1 (reg is used to encode clk id).
- interrupts : shall be set to PMC interrupt line.
- interrupt-controller : tell that the PMC is an interrupt controller.
- #interrupt-cells : must be set to 1. The first cell encodes the interrupt id,
	and reflect the bit position in the PMC_ER/DR/SR registers.
	You can use the dt macros defined in dt-bindings/clock/at91.h.
	0 (AT91_PMC_MOSCS) -> main oscillator ready
	1 (AT91_PMC_LOCKA) -> PLL A ready
	2 (AT91_PMC_LOCKB) -> PLL B ready
	3 (AT91_PMC_MCKRDY) -> master clock ready
	6 (AT91_PMC_LOCKU) -> UTMI PLL clock ready
	8 .. 15 (AT91_PMC_PCKRDY(id)) -> programmable clock ready
	16 (AT91_PMC_MOSCSELS) -> main oscillator selected
	17 (AT91_PMC_MOSCRCS) -> RC main oscillator stabilized
	18 (AT91_PMC_CFDEV) -> clock failure detected

For example:
	pmc: pmc@fffffc00 {
		compatible = "atmel,sama5d3-pmc";
		interrupts = <1 4 7>;
		interrupt-controller;
		#interrupt-cells = <2>;
		#size-cells = <0>;
		#address-cells = <1>;

		/* put at91 clocks here */
	};

Required properties for main clock internal RC oscillator:
- interrupt-parent : must reference the PMC node.
- interrupts : shall be set to "<0>".
- clock-frequency : define the internal RC oscillator frequency.

Optional properties:
- clock-accuracy : define the internal RC oscillator accuracy.

For example:
	main_rc_osc: main_rc_osc {
		compatible = "atmel,at91sam9x5-clk-main-rc-osc";
		interrupt-parent = <&pmc>;
		interrupts = <0>;
		clock-frequency = <12000000>;
		clock-accuracy = <50000000>;
	};

Required properties for main clock oscillator:
- interrupt-parent : must reference the PMC node.
- interrupts : shall be set to "<0>".
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall encode the main osc source clk sources (see atmel datasheet).

Optional properties:
- atmel,osc-bypass : boolean property. Specified if a clock signal is provided
  on XIN.

  clock signal is directly provided on XIN pin.

For example:
	main_osc: main_osc {
		compatible = "atmel,at91rm9200-clk-main-osc";
		interrupt-parent = <&pmc>;
		interrupts = <0>;
		#clock-cells = <0>;
		clocks = <&main_xtal>;
	};

Required properties for main clock:
- interrupt-parent : must reference the PMC node.
- interrupts : shall be set to "<0>".
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall encode the main clk sources (see atmel datasheet).

For example:
	main: mainck {
		compatible = "atmel,at91sam9x5-clk-main";
		interrupt-parent = <&pmc>;
		interrupts = <0>;
		#clock-cells = <0>;
		clocks = <&main_rc_osc &main_osc>;
	};

Required properties for master clock:
- interrupt-parent : must reference the PMC node.
- interrupts : shall be set to "<3>".
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall be the master clock sources (see atmel datasheet) phandles.
	e.g. "<&ck32k>, <&main>, <&plla>, <&pllb>".
- atmel,clk-output-range : minimum and maximum clock frequency (two u32
			   fields).
	   e.g. output = <0 133000000>; <=> 0 to 133MHz.
- atmel,clk-divisors : master clock divisors table (four u32 fields).
		0 <=> reserved value.
		e.g. divisors = <1 2 4 6>;
- atmel,master-clk-have-div3-pres : some SoC use the reserved value 7 in the
				    PRES field as CLOCK_DIV3 (e.g sam9x5).

For example:
	mck: mck {
		compatible = "atmel,at91rm9200-clk-master";
		interrupt-parent = <&pmc>;
		interrupts = <3>;
		#clock-cells = <0>;
		atmel,clk-output-range = <0 133000000>;
		atmel,clk-divisors = <1 2 4 0>;
	};

Required properties for peripheral clocks:
- #size-cells : shall be 0 (reg is used to encode clk id).
- #address-cells : shall be 1 (reg is used to encode clk id).
- clocks : shall be the master clock phandle.
	e.g. clocks = <&mck>;
- name: device tree node describing a specific peripheral clock.
	* #clock-cells : from common clock binding; shall be set to 0.
	* reg: peripheral id. See Atmel's datasheets to get a full
	  list of peripheral ids.
	* atmel,clk-output-range : minimum and maximum clock frequency
	  (two u32 fields). Only valid on at91sam9x5-clk-peripheral
	  compatible IPs.

For example:
	periph: periphck {
		compatible = "atmel,at91sam9x5-clk-peripheral";
		#size-cells = <0>;
		#address-cells = <1>;
		clocks = <&mck>;

		ssc0_clk {
			#clock-cells = <0>;
			reg = <2>;
			atmel,clk-output-range = <0 133000000>;
		};

		usart0_clk {
			#clock-cells = <0>;
			reg = <3>;
			atmel,clk-output-range = <0 66000000>;
		};
	};


Required properties for pll clocks:
- interrupt-parent : must reference the PMC node.
- interrupts : shall be set to "<1>".
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall be the main clock phandle.
- reg : pll id.
	0 -> PLL A
	1 -> PLL B
- atmel,clk-input-range : minimum and maximum source clock frequency (two u32
			  fields).
	  e.g. input = <1 32000000>; <=> 1 to 32MHz.
- #atmel,pll-clk-output-range-cells : number of cells reserved for pll output
				      range description. Sould be set to 2, 3
				      or 4.
	* 1st and 2nd cells represent the frequency range (min-max).
	* 3rd cell is optional and represents the OUT field value for the given
	  range.
	* 4th cell is optional and represents the ICPLL field (PLLICPR
	  register)
- atmel,pll-clk-output-ranges : pll output frequency ranges + optional parameter
				depending on #atmel,pll-output-range-cells
				property value.

For example:
	plla: pllack {
		compatible = "atmel,at91sam9g45-clk-pll";
		interrupt-parent = <&pmc>;
		interrupts = <1>;
		#clock-cells = <0>;
		clocks = <&main>;
		reg = <0>;
		atmel,clk-input-range = <2000000 32000000>;
		#atmel,pll-clk-output-range-cells = <4>;
		atmel,pll-clk-output-ranges = <74500000 800000000 0 0
					       69500000 750000000 1 0
					       64500000 700000000 2 0
					       59500000 650000000 3 0
					       54500000 600000000 0 1
					       49500000 550000000 1 1
					       44500000 500000000 2 1
					       40000000 450000000 3 1>;
	};

Required properties for plldiv clocks (plldiv = pll / 2):
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall be the plla clock phandle.

The pll divisor is equal to 2 and cannot be changed.

For example:
	plladiv: plladivck {
		compatible = "atmel,at91sam9x5-clk-plldiv";
		#clock-cells = <0>;
		clocks = <&plla>;
	};

Required properties for programmable clocks:
- interrupt-parent : must reference the PMC node.
- #size-cells : shall be 0 (reg is used to encode clk id).
- #address-cells : shall be 1 (reg is used to encode clk id).
- clocks : shall be the programmable clock source phandles.
	e.g. clocks = <&clk32k>, <&main>, <&plla>, <&pllb>;
- name: device tree node describing a specific prog clock.
	* #clock-cells : from common clock binding; shall be set to 0.
	* reg : programmable clock id (register offset from  PCKx
			 register).
	* interrupts : shall be set to "<(8 + id)>".

For example:
	prog: progck {
		compatible = "atmel,at91sam9g45-clk-programmable";
		#size-cells = <0>;
		#address-cells = <1>;
		interrupt-parent = <&pmc>;
		clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>;

		prog0 {
			#clock-cells = <0>;
			reg = <0>;
			interrupts = <8>;
		};

		prog1 {
			#clock-cells = <0>;
			reg = <1>;
			interrupts = <9>;
		};
	};


Required properties for smd clock:
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall be the smd clock source phandles.
	e.g. clocks = <&plladiv>, <&utmi>;

For example:
	smd: smdck {
		compatible = "atmel,at91sam9x5-clk-smd";
		#clock-cells = <0>;
		clocks = <&plladiv>, <&utmi>;
	};

Required properties for system clocks:
- #size-cells : shall be 0 (reg is used to encode clk id).
- #address-cells : shall be 1 (reg is used to encode clk id).
- name: device tree node describing a specific system clock.
	* #clock-cells : from common clock binding; shall be set to 0.
	* reg: system clock id (bit position in SCER/SCDR/SCSR registers).
	      See Atmel's datasheet to get a full list of system clock ids.

For example:
	system: systemck {
		compatible = "atmel,at91rm9200-clk-system";
		#address-cells = <1>;
		#size-cells = <0>;

		ddrck {
			#clock-cells = <0>;
			reg = <2>;
			clocks = <&mck>;
		};

		uhpck {
			#clock-cells = <0>;
			reg = <6>;
			clocks = <&usb>;
		};

		udpck {
			#clock-cells = <0>;
			reg = <7>;
			clocks = <&usb>;
		};
	};


Required properties for usb clock:
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall be the smd clock source phandles.
	e.g. clocks = <&pllb>;
- atmel,clk-divisors (only available for "atmel,at91rm9200-clk-usb"):
	usb clock divisor table.
	e.g. divisors = <1 2 4 0>;

For example:
	usb: usbck {
		compatible = "atmel,at91sam9x5-clk-usb";
		#clock-cells = <0>;
		clocks = <&plladiv>, <&utmi>;
	};

	usb: usbck {
		compatible = "atmel,at91rm9200-clk-usb";
		#clock-cells = <0>;
		clocks = <&pllb>;
		atmel,clk-divisors = <1 2 4 0>;
	};


Required properties for utmi clock:
- interrupt-parent : must reference the PMC node.
- interrupts : shall be set to "<AT91_PMC_LOCKU IRQ_TYPE_LEVEL_HIGH>".
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall be the main clock source phandle.

For example:
	utmi: utmick {
		compatible = "atmel,at91sam9x5-clk-utmi";
		interrupt-parent = <&pmc>;
		interrupts = <AT91_PMC_LOCKU IRQ_TYPE_LEVEL_HIGH>;
		#clock-cells = <0>;
		clocks = <&main>;
	};

Required properties for 32 bits bus Matrix clock (h32mx clock):
- #clock-cells : from common clock binding; shall be set to 0.
- clocks : shall be the master clock source phandle.

For example:
	h32ck: h32mxck {
		#clock-cells = <0>;
		compatible = "atmel,sama5d4-clk-h32mx";
		clocks = <&mck>;
	};

Required properties for generated clocks:
- #size-cells : shall be 0 (reg is used to encode clk id).
- #address-cells : shall be 1 (reg is used to encode clk id).
- clocks : shall be the generated clock source phandles.
	e.g. clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>, <&audio_pll_pmc>;
- name: device tree node describing a specific generated clock.
	* #clock-cells : from common clock binding; shall be set to 0.
	* reg: peripheral id. See Atmel's datasheets to get a full
	  list of peripheral ids.
	* atmel,clk-output-range : minimum and maximum clock frequency
	  (two u32 fields).

For example:
	gck {
		compatible = "atmel,sama5d2-clk-generated";
		#address-cells = <1>;
		#size-cells = <0>;
		clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>, <&audio_pll_pmc>;

		tcb0_gclk: tcb0_gclk {
			#clock-cells = <0>;
			reg = <35>;
			atmel,clk-output-range = <0 83000000>;
		};

		pwm_gclk: pwm_gclk {
			#clock-cells = <0>;
			reg = <38>;
			atmel,clk-output-range = <0 83000000>;
		};
	};