1/*
2 * Copyright (c) 2019, Nordic Semiconductor
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7// Used by testedtlib.py
8
9/dts-v1/;
10
11/ {
12	//
13	// Interrupts
14	//
15
16	interrupt-parent-test {
17		controller {
18			compatible = "interrupt-three-cell";
19			#interrupt-cells = <3>;
20			interrupt-controller;
21		};
22		node {
23			interrupts = <1 2 3 4 5 6>;
24			interrupt-names = "foo", "bar";
25			interrupt-parent = <&{/interrupt-parent-test/controller}>;
26		};
27	};
28	interrupts-extended-test {
29		controller-0 {
30			compatible = "interrupt-one-cell";
31			#interrupt-cells = <1>;
32			interrupt-controller;
33		};
34		controller-1 {
35			compatible = "interrupt-two-cell";
36			#interrupt-cells = <2>;
37			interrupt-controller;
38		};
39		controller-2 {
40			compatible = "interrupt-three-cell";
41			#interrupt-cells = <3>;
42			interrupt-controller;
43		};
44		node {
45			interrupts-extended = <
46				&{/interrupts-extended-test/controller-0} 1
47				&{/interrupts-extended-test/controller-1} 2 3
48				&{/interrupts-extended-test/controller-2} 4 5 6>;
49		};
50	};
51	interrupt-map-test {
52		#address-cells = <2>;
53		#size-cells = <0>;
54
55		controller-0 {
56			compatible = "interrupt-one-cell";
57			#address-cells = <1>;
58			#interrupt-cells = <1>;
59			interrupt-controller;
60		};
61		controller-1 {
62			compatible = "interrupt-two-cell";
63			#address-cells = <2>;
64			#interrupt-cells = <2>;
65			interrupt-controller;
66		};
67		controller-2 {
68			compatible = "interrupt-three-cell";
69			#address-cells = <3>;
70			#interrupt-cells = <3>;
71			interrupt-controller;
72		};
73		nexus {
74			#interrupt-cells = <2>;
75			interrupt-map = <
76				0 0  0 0  &{/interrupt-map-test/controller-0}  0      0
77				0 0  0 1  &{/interrupt-map-test/controller-1}  0 0    0 1
78				0 0  0 2  &{/interrupt-map-test/controller-2}  0 0 0  0 0 2
79				0 1  0 0  &{/interrupt-map-test/controller-0}  0      3
80				0 1  0 1  &{/interrupt-map-test/controller-1}  0 0    0 4
81				0 1  0 2  &{/interrupt-map-test/controller-2}  0 0 0  0 0 5>;
82		};
83		nexus-0 {
84			#address-cells = <0>;
85			#interrupt-cells = <2>;
86			interrupt-map = <
87				0 0  &{/interrupt-map-test/controller-0}  0      0
88				0 1  &{/interrupt-map-test/controller-1}  0 0    0 1
89				1 2  &{/interrupt-map-test/controller-2}  0 0 0  0 0 2>;
90		};
91		nexus-1 {
92			#address-cells = <1>;
93			#interrupt-cells = <1>;
94			interrupt-map = <
95				4 0  &{/interrupt-map-test/controller-0}  0      3
96				4 1  &{/interrupt-map-test/controller-1}  0 0    0 4
97				4 2  &{/interrupt-map-test/controller-2}  0 0 0  0 0 5>;
98		};
99		node@0 {
100			reg = <0 0>;
101			interrupts = <0 0 0 1 0 2>;
102			interrupt-parent = <&{/interrupt-map-test/nexus}>;
103		};
104		node@1 {
105			reg = <0 1>;
106			interrupts-extended = <
107			    &{/interrupt-map-test/nexus} 0 0
108			    &{/interrupt-map-test/nexus} 0 1
109			    &{/interrupt-map-test/nexus} 0 2>;
110		};
111		node@2 {
112			reg = <0 2>;
113			interrupts = <0 0 0 1 1 2>;
114			interrupt-parent = <&{/interrupt-map-test/nexus-0}>;
115		};
116		node@3 { /* Test the precedence of interrupts/interrupts-extended too */
117			reg = <0 3>;
118			interrupts = <1 2 0 0 0 1>;
119			interrupt-parent = <&{/interrupt-map-test/nexus-0}>;
120			interrupts-extended = <
121			    &{/interrupt-map-test/nexus-0} 0 0
122			    &{/interrupt-map-test/nexus-0} 0 1
123			    &{/interrupt-map-test/nexus-0} 1 2>;
124		};
125		node@4 {
126			reg = <0 4>;
127			interrupts = <0 1 2>;
128			interrupt-parent = <&{/interrupt-map-test/nexus-1}>;
129		};
130		node@100000004 {
131			reg = <1 4>;
132			interrupts = <0 1 2>;
133			interrupt-parent = <&{/interrupt-map-test/nexus-1}>;
134		};
135	};
136	interrupt-map-bitops-test {
137		#address-cells = <2>;
138		#size-cells = <0>;
139
140		controller {
141			compatible = "interrupt-two-cell";
142			#address-cells = <0>;
143			#interrupt-cells = <2>;
144			interrupt-controller;
145		};
146		nexus {
147			#interrupt-cells = <2>;
148			interrupt-map = <
149			    6 6  6 6  &{/interrupt-map-bitops-test/controller}  2 1
150			>;
151			interrupt-map-mask = <0xE 0x7 0xE 0x7>;
152			// Not specified in the DT spec., but shows up due to
153			// common code with GPIO. Might as well test it here.
154			interrupt-map-pass-thru = <1 2 3 3>;
155		};
156		// Child unit specifier: 00000007 0000000E 00000007 0000000E
157		// Mask:                 0000000E 00000007 0000000E 00000007
158		// Pass-thru:            00000001 00000002 00000003 00000003
159		node@70000000E {
160			reg = <0x7 0xE>;
161			interrupt-parent = <&{/interrupt-map-bitops-test/nexus}>;
162			interrupts = <0x7 0xE>;
163		};
164	};
165
166	//
167	// 'ranges'
168	//
169
170	ranges-zero-cells {
171		#address-cells = <0>;
172
173		node {
174			#address-cells = <0>;
175			#size-cells = <0>;
176
177			ranges;
178		};
179	};
180
181	ranges-zero-parent-cells {
182		#address-cells = <0>;
183
184		node {
185			#address-cells = <1>;
186			#size-cells = <0>;
187
188			ranges = <0xA>,
189				 <0x1A>,
190				 <0x2A>;
191		};
192	};
193
194	ranges-one-address-cells {
195		#address-cells = <0>;
196
197		node {
198			reg = <1>;
199			#address-cells = <1>;
200
201			ranges = <0xA 0xB>,
202				 <0x1A 0x1B>,
203				 <0x2A 0x2B>;
204		};
205	};
206
207	ranges-one-address-two-size-cells {
208		#address-cells = <0>;
209
210		node {
211			reg = <1>;
212			#address-cells = <1>;
213			#size-cells = <2>;
214
215			ranges = <0xA 0xB 0xC>,
216				 <0x1A 0x1B 0x1C>,
217				 <0x2A 0x2B 0x2C>;
218		};
219	};
220
221	ranges-two-address-cells {
222		#address-cells = <1>;
223
224		node@1 {
225			reg = <1 2>;
226
227			ranges = <0xA 0xB 0xC 0xD>,
228				 <0x1A 0x1B 0x1C 0x1D>,
229				 <0x2A 0x2B 0x2C 0x2D>;
230		};
231	};
232
233	ranges-two-address-two-size-cells {
234		#address-cells = <1>;
235
236		node@1 {
237			reg = <1 2>;
238			#size-cells = <2>;
239
240			ranges = <0xA 0xB 0xC 0xD 0xE>,
241				 <0x1A 0x1B 0x1C 0x1D 0x1E>,
242				 <0x2A 0x2B 0x2C 0x2D 0x1D>;
243		};
244	};
245
246	ranges-three-address-cells {
247		node@1 {
248			reg = <0 1 2>;
249			#address-cells = <3>;
250
251			ranges = <0xA 0xB 0xC 0xD 0xE 0xF>,
252				 <0x1A 0x1B 0x1C 0x1D 0x1E 0x1F>,
253				 <0x2A 0x2B 0x2C 0x2D 0x2E 0x2F>;
254		};
255	};
256
257	ranges-three-address-two-size-cells {
258		node@1 {
259			reg = <0 1 2>;
260			#address-cells = <3>;
261			#size-cells = <2>;
262
263			ranges = <0xA 0xB 0xC 0xD 0xE 0xF 0x10>,
264				 <0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x110>,
265				 <0x2A 0x2B 0x2C 0x2D 0x2E 0x2F 0x210>;
266		};
267	};
268
269
270	//
271	// 'reg'
272	//
273
274	reg-zero-address-cells {
275		#address-cells = <0>;
276		#size-cells = <1>;
277
278		node {
279			reg = <1 2>;
280			reg-names = "foo", "bar";
281		};
282	};
283	reg-zero-size-cells {
284		#address-cells = <1>;
285		#size-cells = <0>;
286
287		node {
288			reg = <1 2>;
289		};
290	};
291	// Use implied #size-cells = <1>
292	reg-ranges {
293		#address-cells = <2>;
294
295		parent {
296			#address-cells = <1>;
297			ranges = <1  0xA 0xB  1 /* 1    -> 0xA 0xB */
298				  2  0xC 0xD  2 /* 2..3 -> 0xC 0xD */
299				  4  0xE 0xF  1 /* 4    -> 0xE 0xF */
300				 >;
301
302			node {
303				reg = <5 1 /* Matches no range */
304				       4 1 /* Matches third range */
305				       3 1 /* Matches second range */
306				       2 1 /* Matches second range */
307				       1 1 /* Matches first range */
308				       0 1 /* Matches no range */
309				       >;
310			};
311		};
312	};
313	// Build up <3 2 1> address with nested 'ranges'
314	reg-nested-ranges {
315		#address-cells = <3>;
316
317		grandparent {
318			#address-cells = <2>;
319			#size-cells = <2>;
320			ranges = <0 0  3 0 0  2 2>;
321
322			parent {
323				#address-cells = <1>;
324				ranges = <0  2 0  2>;
325
326				node {
327					reg = <1 1>;
328				};
329			};
330		};
331	};
332
333	//
334	// 'pinctrl-<index>'
335	//
336
337	pinctrl {
338		dev {
339			pinctrl-0 = <>;
340			pinctrl-1 = <&{/pinctrl/pincontroller/state-1}>;
341			pinctrl-2 = <&{/pinctrl/pincontroller/state-1}
342				     &{/pinctrl/pincontroller/state-2}>;
343			pinctrl-names = "zero", "one", "two";
344		};
345		pincontroller {
346			state-1 {
347			};
348			state-2 {
349			};
350		};
351	};
352
353	//
354	// For testing hierarchy.
355	//
356
357	parent {
358		child-1 {
359		};
360		child-2 {
361			grandchild {
362			};
363		};
364	};
365
366	//
367	// For testing 'include:'
368	//
369
370	binding-include {
371		compatible = "binding-include-test";
372		foo = <0>;
373		bar = <1>;
374		baz = <2>;
375		qaz = <3>;
376
377		child {
378			foo = <0>;
379			bar = <1>;
380			baz = <2>;
381			qaz = <3>;
382		};
383	};
384
385	//
386	// For testing Node.props (derived from 'properties:' in the binding)
387	//
388
389	props {
390		compatible = "props";
391		existent-boolean;
392		int = <1>;
393		array = <1 2 3>;
394		uint8-array = [ 12 34 ];
395		string = "foo";
396		string-array = "foo", "bar", "baz";
397		phandle-ref = < &{/ctrl-1} >;
398		phandle-refs = < &{/ctrl-1} &{/ctrl-2} >;
399		phandle-array-foos = < &{/ctrl-1} 1 &{/ctrl-2} 2 3 >;
400		foo-gpios = < &{/ctrl-1} 1 >;
401		path = &{/ctrl-1};
402	};
403
404	ctrl-1 {
405		compatible = "phandle-array-controller-1";
406		#phandle-array-foo-cells = <1>;
407		#gpio-cells = <1>;
408	};
409
410	ctrl-2 {
411		compatible = "phandle-array-controller-2";
412		#phandle-array-foo-cells = <2>;
413	};
414
415	props-2 {
416		compatible = "props";
417		phandle-array-foos = < &{/ctrl-0-1} 0 &{/ctrl-0-2} >;
418		phandle-array-foo-names = "a", "missing", "b";
419	};
420
421	ctrl-0-1 {
422		compatible = "phandle-array-controller-0";
423		#phandle-array-foo-cells = <0>;
424	};
425
426	ctrl-0-2 {
427		compatible = "phandle-array-controller-0";
428		#phandle-array-foo-cells = <0>;
429	};
430
431	//
432	// Test <prefix>-map, via gpio-map
433	//
434
435	gpio-map {
436		source {
437			compatible = "gpio-src";
438			foo-gpios = <&{/gpio-map/connector} 3 4
439				     &{/gpio-map/connector} 1 2>;
440		};
441		connector {
442			#gpio-cells = <2>;
443			// Use different data lengths for source and
444			// destination to make it a bit trickier
445			gpio-map = <1 2 &{/gpio-map/destination} 5
446				    3 4 &{/gpio-map/destination} 6>;
447		};
448		destination {
449			compatible = "gpio-dst";
450			gpio-controller;
451			#gpio-cells = <1>;
452		};
453	};
454
455	//
456	// For testing Node.props with 'default:' values in binding
457	//
458
459	defaults {
460		compatible = "defaults";
461		// Should override the 'default:' in the binding
462		default-not-used = <234>;
463	};
464
465	//
466	// For testing 'enum:'
467	//
468
469	enums {
470		compatible = "enums";
471		int-enum = <1>;
472		string-enum = "foo_bar";
473		tokenizable-enum = "123 is ok";
474		tokenizable-lower-enum = "bar";
475		array-enum = <0 40 40 10>;
476		string-array-enum = "foo", "bar";
477		no-enum = "baz";
478	};
479
480	//
481	// For testing 'bus:' and 'on-bus:'
482	//
483
484	buses {
485		// The 'node' nodes below will map to different bindings since
486		// they appear on different buses
487		foo-bus {
488			compatible = "foo-bus";
489			node1 {
490				compatible = "on-bus", "on-any-bus";
491				nested {
492					compatible = "on-bus";
493				};
494			};
495			node2 {
496				compatible = "on-any-bus", "on-bus";
497			};
498		};
499		bar-bus {
500			compatible = "bar-bus";
501			node {
502				compatible = "on-bus";
503			};
504		};
505		no-bus-node {
506			compatible = "on-any-bus";
507		};
508	};
509
510	//
511	// Node with 'child-binding:' in binding (along with a recursive
512	// 'child-binding:')
513	//
514
515	child-binding-dep {
516	};
517
518	child-binding {
519		compatible = "top-binding";
520		child-1 {
521			child-prop = <1>;
522			grandchild {
523				grandchild-prop = <2>;
524				grandchild-ref = < &{/child-binding-dep} >;
525			};
526		};
527		child-2 {
528			child-prop = <3>;
529			child-ref = < &{/child-binding-dep} >;
530		};
531	};
532
533	//
534	// zephyr,user binding inference
535	//
536
537	zephyr,user {
538		boolean;
539		bytes = [81 82 83];
540		number = <23>;
541		numbers = <1>, <2>, <3>;
542		string = "text";
543		strings = "a", "b", "c";
544		handle = <&{/ctrl-1}>;
545		phandles = <&{/ctrl-1}>, <&{/ctrl-2}>;
546		phandle-array-foos = <&{/ctrl-2} 1 2>;
547	};
548
549	//
550	// For testing that neither 'include: [foo.yaml, bar.yaml]' nor
551	// 'include: [bar.yaml, foo.yaml]' causes errors when one of the files
552	// has 'required: true' and the other 'required: false'
553	//
554
555	include-order {
556		node-1 {
557			compatible = "order-1";
558			foo = <1>;
559		};
560		node-2 {
561			compatible = "order-2";
562			foo = <2>;
563		};
564	};
565
566	//
567	// For testing deprecated property
568	//
569	test-deprecated {
570		compatible = "test-deprecated";
571		oldprop = <4>;	/* deprecated property */
572		curprop = <5>;
573	};
574
575
576	//
577	// For testing deprecated features
578	//
579
580	deprecated {
581		compatible = "deprecated";
582		required = <1>;
583		required-2 = <2>;
584		#foo-cells = <2>;
585		sub-node {
586			foos = <&{/deprecated} 1 2>;
587		};
588	};
589};
590