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