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