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	// 'reg'
128	//
129
130	reg-zero-address-cells {
131		#address-cells = <0>;
132		#size-cells = <1>;
133
134		node {
135			reg = <1 2>;
136		};
137	};
138	reg-zero-size-cells {
139		#address-cells = <1>;
140		#size-cells = <0>;
141
142		node {
143			reg = <1 2>;
144		};
145	};
146	// Use implied #size-cells = <1>
147	reg-ranges {
148		#address-cells = <2>;
149
150		parent {
151			#address-cells = <1>;
152			ranges = <1  0xA 0xB  1 /* 1    -> 0xA 0xB */
153				  2  0xC 0xD  2 /* 2..3 -> 0xC 0xD */
154				  4  0xE 0xF  1 /* 4    -> 0xE 0xF */
155				 >;
156
157			node {
158				reg = <5 1 /* Matches no range */
159				       4 1 /* Matches third range */
160				       3 1 /* Matches second range */
161				       2 1 /* Matches second range */
162				       1 1 /* Matches first range */
163				       0 1 /* Matches no range */
164				       >;
165			};
166		};
167	};
168	// Build up <3 2 1> address with nested 'ranges'
169	reg-nested-ranges {
170		#address-cells = <3>;
171
172		grandparent {
173			#address-cells = <2>;
174			#size-cells = <2>;
175			ranges = <0 0  3 0 0  2 2>;
176
177			parent {
178				#address-cells = <1>;
179				ranges = <0  2 0  2>;
180
181				node {
182					reg = <1 1>;
183				};
184			};
185		};
186	};
187
188	//
189	// 'pinctrl-<index>'
190	//
191
192	pinctrl {
193		dev {
194			pinctrl-0 = <>;
195			pinctrl-1 = <&{/pinctrl/pincontroller/state-1}>;
196			pinctrl-2 = <&{/pinctrl/pincontroller/state-1}
197				     &{/pinctrl/pincontroller/state-2}>;
198			pinctrl-names = "zero", "one", "two";
199		};
200		pincontroller {
201			state-1 {
202			};
203			state-2 {
204			};
205		};
206	};
207
208	//
209	// For testing Node.parent and Node.children
210	//
211
212	parent {
213		child-1 {
214		};
215		child-2 {
216			grandchild {
217			};
218		};
219	};
220
221	//
222	// For testing 'include:'
223	//
224
225	binding-include {
226		compatible = "binding-include-test";
227		foo = <0>;
228		bar = <1>;
229		baz = <2>;
230		qaz = <3>;
231	};
232
233	//
234	// For testing Node.props (derived from 'properties:' in the binding)
235	//
236
237	props {
238		compatible = "props";
239		existent-boolean;
240		int = <1>;
241		array = <1 2 3>;
242		uint8-array = [ 12 34 ];
243		string = "foo";
244		string-array = "foo", "bar", "baz";
245		phandle-ref = < &{/ctrl-1} >;
246		phandle-refs = < &{/ctrl-1} &{/ctrl-2} >;
247		phandle-array-foos = < &{/ctrl-1} 1 &{/ctrl-2} 2 3 >;
248		foo-gpios = < &{/ctrl-1} 1 >;
249		path = &{/ctrl-1};
250	};
251
252	ctrl-1 {
253		compatible = "phandle-array-controller-1";
254		#phandle-array-foo-cells = <1>;
255		#gpio-cells = <1>;
256	};
257
258	ctrl-2 {
259		compatible = "phandle-array-controller-2";
260		#phandle-array-foo-cells = <2>;
261	};
262
263	props-2 {
264		compatible = "props";
265		phandle-array-foos = < &{/ctrl-0-1} 0 &{/ctrl-0-2} >;
266		phandle-array-foo-names = "a", "missing", "b";
267	};
268
269	ctrl-0-1 {
270		compatible = "phandle-array-controller-0";
271		#phandle-array-foo-cells = <0>;
272	};
273
274	ctrl-0-2 {
275		compatible = "phandle-array-controller-0";
276		#phandle-array-foo-cells = <0>;
277	};
278
279	//
280	// Test <prefix>-map, via gpio-map
281	//
282
283	gpio-map {
284		source {
285			compatible = "gpio-src";
286			foo-gpios = <&{/gpio-map/connector} 3 4
287				     &{/gpio-map/connector} 1 2>;
288		};
289		connector {
290			#gpio-cells = <2>;
291			// Use different data lengths for source and
292			// destination to make it a bit trickier
293			gpio-map = <1 2 &{/gpio-map/destination} 5
294				    3 4 &{/gpio-map/destination} 6>;
295		};
296		destination {
297			compatible = "gpio-dst";
298			gpio-controller;
299			#gpio-cells = <1>;
300		};
301	};
302
303	//
304	// For testing Node.props with 'default:' values in binding
305	//
306
307	defaults {
308		compatible = "defaults";
309		// Should override the 'default:' in the binding
310		default-not-used = <234>;
311	};
312
313	//
314	// For testing 'enum:'
315	//
316
317	enums {
318		compatible = "enums";
319		int-enum = <1>;
320		string-enum = "foo_bar";
321		tokenizable-enum = "123 is ok";
322		tokenizable-lower-enum = "bar";
323		no-enum = "baz";
324	};
325
326	//
327	// For testing 'bus:' and 'on-bus:'
328	//
329
330	buses {
331		// The 'node' nodes below will map to different bindings since
332		// they appear on different buses
333		foo-bus {
334			compatible = "foo-bus";
335			node1 {
336				compatible = "on-bus", "on-any-bus";
337				nested {
338					compatible = "on-bus";
339				};
340			};
341			node2 {
342				compatible = "on-any-bus", "on-bus";
343			};
344		};
345		bar-bus {
346			compatible = "bar-bus";
347			node {
348				compatible = "on-bus";
349			};
350		};
351		no-bus-node {
352			compatible = "on-any-bus";
353		};
354	};
355
356	//
357	// Node with 'child-binding:' in binding (along with a recursive
358	// 'child-binding:')
359	//
360
361	child-binding {
362		compatible = "top-binding";
363		child-1 {
364			child-prop = <1>;
365			grandchild {
366				grandchild-prop = <2>;
367			};
368		};
369		child-2 {
370			child-prop = <3>;
371		};
372	};
373
374	//
375	// zephyr,user binding inference
376	//
377
378	zephyr,user {
379		boolean;
380		bytes = [81 82 83];
381		number = <23>;
382		numbers = <1>, <2>, <3>;
383		string = "text";
384		strings = "a", "b", "c";
385		handle = <&{/ctrl-1}>;
386		phandles = <&{/ctrl-1}>, <&{/ctrl-2}>;
387		phandle-array-foos = <&{/ctrl-2} 1 2>;
388	};
389
390	//
391	// For testing that neither 'include: [foo.yaml, bar.yaml]' nor
392	// 'include: [bar.yaml, foo.yaml]' causes errors when one of the files
393	// has 'required: true' and the other 'required: false'
394	//
395
396	include-order {
397		node-1 {
398			compatible = "order-1";
399			foo = <1>;
400		};
401		node-2 {
402			compatible = "order-2";
403			foo = <2>;
404		};
405	};
406
407	//
408	// For testing deprecated property
409	//
410	test-deprecated {
411		compatible = "test-deprecated";
412		oldprop = <4>;	/* deprecated property */
413		curprop = <5>;
414	};
415
416
417	//
418	// For testing deprecated features
419	//
420
421	deprecated {
422		compatible = "deprecated";
423		required = <1>;
424		required-2 = <2>;
425		#foo-cells = <2>;
426		sub-node {
427			foos = <&{/deprecated} 1 2>;
428		};
429	};
430};
431