test.dts 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. /*
  2. * Copyright (c) 2019, Nordic Semiconductor
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. // Used by testedtlib.py
  7. /dts-v1/;
  8. / {
  9. //
  10. // Interrupts
  11. //
  12. interrupt-parent-test {
  13. controller {
  14. compatible = "interrupt-three-cell";
  15. #interrupt-cells = <3>;
  16. interrupt-controller;
  17. };
  18. node {
  19. interrupts = <1 2 3 4 5 6>;
  20. interrupt-names = "foo", "bar";
  21. interrupt-parent = <&{/interrupt-parent-test/controller}>;
  22. };
  23. };
  24. interrupts-extended-test {
  25. controller-0 {
  26. compatible = "interrupt-one-cell";
  27. #interrupt-cells = <1>;
  28. interrupt-controller;
  29. };
  30. controller-1 {
  31. compatible = "interrupt-two-cell";
  32. #interrupt-cells = <2>;
  33. interrupt-controller;
  34. };
  35. controller-2 {
  36. compatible = "interrupt-three-cell";
  37. #interrupt-cells = <3>;
  38. interrupt-controller;
  39. };
  40. node {
  41. interrupts-extended = <
  42. &{/interrupts-extended-test/controller-0} 1
  43. &{/interrupts-extended-test/controller-1} 2 3
  44. &{/interrupts-extended-test/controller-2} 4 5 6>;
  45. };
  46. };
  47. interrupt-map-test {
  48. #address-cells = <2>;
  49. #size-cells = <0>;
  50. controller-0 {
  51. compatible = "interrupt-one-cell";
  52. #address-cells = <1>;
  53. #interrupt-cells = <1>;
  54. interrupt-controller;
  55. };
  56. controller-1 {
  57. compatible = "interrupt-two-cell";
  58. #address-cells = <2>;
  59. #interrupt-cells = <2>;
  60. interrupt-controller;
  61. };
  62. controller-2 {
  63. compatible = "interrupt-three-cell";
  64. #address-cells = <3>;
  65. #interrupt-cells = <3>;
  66. interrupt-controller;
  67. };
  68. nexus {
  69. #interrupt-cells = <2>;
  70. interrupt-map = <
  71. 0 0 0 0 &{/interrupt-map-test/controller-0} 0 0
  72. 0 0 0 1 &{/interrupt-map-test/controller-1} 0 0 0 1
  73. 0 0 0 2 &{/interrupt-map-test/controller-2} 0 0 0 0 0 2
  74. 0 1 0 0 &{/interrupt-map-test/controller-0} 0 3
  75. 0 1 0 1 &{/interrupt-map-test/controller-1} 0 0 0 4
  76. 0 1 0 2 &{/interrupt-map-test/controller-2} 0 0 0 0 0 5>;
  77. };
  78. node@0 {
  79. reg = <0 0>;
  80. interrupts = <0 0 0 1 0 2>;
  81. interrupt-parent = <&{/interrupt-map-test/nexus}>;
  82. };
  83. node@1 {
  84. reg = <0 1>;
  85. interrupts-extended = <
  86. &{/interrupt-map-test/nexus} 0 0
  87. &{/interrupt-map-test/nexus} 0 1
  88. &{/interrupt-map-test/nexus} 0 2>;
  89. };
  90. };
  91. interrupt-map-bitops-test {
  92. #address-cells = <2>;
  93. #size-cells = <0>;
  94. controller {
  95. compatible = "interrupt-two-cell";
  96. #address-cells = <0>;
  97. #interrupt-cells = <2>;
  98. interrupt-controller;
  99. };
  100. nexus {
  101. #interrupt-cells = <2>;
  102. interrupt-map = <
  103. 6 6 6 6 &{/interrupt-map-bitops-test/controller} 2 1
  104. >;
  105. interrupt-map-mask = <0xE 0x7 0xE 0x7>;
  106. // Not specified in the DT spec., but shows up due to
  107. // common code with GPIO. Might as well test it here.
  108. interrupt-map-pass-thru = <1 2 3 3>;
  109. };
  110. // Child unit specifier: 00000007 0000000E 00000007 0000000E
  111. // Mask: 0000000E 00000007 0000000E 00000007
  112. // Pass-thru: 00000001 00000002 00000003 00000003
  113. node@70000000E {
  114. reg = <0x7 0xE>;
  115. interrupt-parent = <&{/interrupt-map-bitops-test/nexus}>;
  116. interrupts = <0x7 0xE>;
  117. };
  118. };
  119. //
  120. // 'reg'
  121. //
  122. reg-zero-address-cells {
  123. #address-cells = <0>;
  124. #size-cells = <1>;
  125. node {
  126. reg = <1 2>;
  127. };
  128. };
  129. reg-zero-size-cells {
  130. #address-cells = <1>;
  131. #size-cells = <0>;
  132. node {
  133. reg = <1 2>;
  134. };
  135. };
  136. // Use implied #size-cells = <1>
  137. reg-ranges {
  138. #address-cells = <2>;
  139. parent {
  140. #address-cells = <1>;
  141. ranges = <1 0xA 0xB 1 /* 1 -> 0xA 0xB */
  142. 2 0xC 0xD 2 /* 2..3 -> 0xC 0xD */
  143. 4 0xE 0xF 1 /* 4 -> 0xE 0xF */
  144. >;
  145. node {
  146. reg = <5 1 /* Matches no range */
  147. 4 1 /* Matches third range */
  148. 3 1 /* Matches second range */
  149. 2 1 /* Matches second range */
  150. 1 1 /* Matches first range */
  151. 0 1 /* Matches no range */
  152. >;
  153. };
  154. };
  155. };
  156. // Build up <3 2 1> address with nested 'ranges'
  157. reg-nested-ranges {
  158. #address-cells = <3>;
  159. grandparent {
  160. #address-cells = <2>;
  161. #size-cells = <2>;
  162. ranges = <0 0 3 0 0 2 2>;
  163. parent {
  164. #address-cells = <1>;
  165. ranges = <0 2 0 2>;
  166. node {
  167. reg = <1 1>;
  168. };
  169. };
  170. };
  171. };
  172. //
  173. // 'pinctrl-<index>'
  174. //
  175. pinctrl {
  176. dev {
  177. pinctrl-0 = <>;
  178. pinctrl-1 = <&{/pinctrl/pincontroller/state-1}>;
  179. pinctrl-2 = <&{/pinctrl/pincontroller/state-1}
  180. &{/pinctrl/pincontroller/state-2}>;
  181. pinctrl-names = "zero", "one", "two";
  182. };
  183. pincontroller {
  184. state-1 {
  185. };
  186. state-2 {
  187. };
  188. };
  189. };
  190. //
  191. // For testing Node.parent and Node.children
  192. //
  193. parent {
  194. child-1 {
  195. };
  196. child-2 {
  197. grandchild {
  198. };
  199. };
  200. };
  201. //
  202. // For testing 'include:'
  203. //
  204. binding-include {
  205. compatible = "binding-include-test";
  206. foo = <0>;
  207. bar = <1>;
  208. baz = <2>;
  209. qaz = <3>;
  210. };
  211. //
  212. // For testing Node.props (derived from 'properties:' in the binding)
  213. //
  214. props {
  215. compatible = "props";
  216. existent-boolean;
  217. int = <1>;
  218. array = <1 2 3>;
  219. uint8-array = [ 12 34 ];
  220. string = "foo";
  221. string-array = "foo", "bar", "baz";
  222. phandle-ref = < &{/ctrl-1} >;
  223. phandle-refs = < &{/ctrl-1} &{/ctrl-2} >;
  224. phandle-array-foos = < &{/ctrl-1} 1 &{/ctrl-2} 2 3 >;
  225. foo-gpios = < &{/ctrl-1} 1 >;
  226. path = &{/ctrl-1};
  227. };
  228. ctrl-1 {
  229. compatible = "phandle-array-controller-1";
  230. #phandle-array-foo-cells = <1>;
  231. #gpio-cells = <1>;
  232. };
  233. ctrl-2 {
  234. compatible = "phandle-array-controller-2";
  235. #phandle-array-foo-cells = <2>;
  236. };
  237. props-2 {
  238. compatible = "props";
  239. phandle-array-foos = < &{/ctrl-0-1} 0 &{/ctrl-0-2} >;
  240. phandle-array-foo-names = "a", "missing", "b";
  241. };
  242. ctrl-0-1 {
  243. compatible = "phandle-array-controller-0";
  244. #phandle-array-foo-cells = <0>;
  245. };
  246. ctrl-0-2 {
  247. compatible = "phandle-array-controller-0";
  248. #phandle-array-foo-cells = <0>;
  249. };
  250. //
  251. // Test <prefix>-map, via gpio-map
  252. //
  253. gpio-map {
  254. source {
  255. compatible = "gpio-src";
  256. foo-gpios = <&{/gpio-map/connector} 3 4
  257. &{/gpio-map/connector} 1 2>;
  258. };
  259. connector {
  260. #gpio-cells = <2>;
  261. // Use different data lengths for source and
  262. // destination to make it a bit trickier
  263. gpio-map = <1 2 &{/gpio-map/destination} 5
  264. 3 4 &{/gpio-map/destination} 6>;
  265. };
  266. destination {
  267. compatible = "gpio-dst";
  268. gpio-controller;
  269. #gpio-cells = <1>;
  270. };
  271. };
  272. //
  273. // For testing Node.props with 'default:' values in binding
  274. //
  275. defaults {
  276. compatible = "defaults";
  277. // Should override the 'default:' in the binding
  278. default-not-used = <234>;
  279. };
  280. //
  281. // For testing 'enum:'
  282. //
  283. enums {
  284. compatible = "enums";
  285. int-enum = <1>;
  286. string-enum = "foo_bar";
  287. tokenizable-enum = "123 is ok";
  288. tokenizable-lower-enum = "bar";
  289. no-enum = "baz";
  290. };
  291. //
  292. // For testing 'bus:' and 'on-bus:'
  293. //
  294. buses {
  295. // The 'node' nodes below will map to different bindings since
  296. // they appear on different buses
  297. foo-bus {
  298. compatible = "foo-bus";
  299. node1 {
  300. compatible = "on-bus", "on-any-bus";
  301. nested {
  302. compatible = "on-bus";
  303. };
  304. };
  305. node2 {
  306. compatible = "on-any-bus", "on-bus";
  307. };
  308. };
  309. bar-bus {
  310. compatible = "bar-bus";
  311. node {
  312. compatible = "on-bus";
  313. };
  314. };
  315. no-bus-node {
  316. compatible = "on-any-bus";
  317. };
  318. };
  319. //
  320. // Node with 'child-binding:' in binding (along with a recursive
  321. // 'child-binding:')
  322. //
  323. child-binding {
  324. compatible = "top-binding";
  325. child-1 {
  326. child-prop = <1>;
  327. grandchild {
  328. grandchild-prop = <2>;
  329. };
  330. };
  331. child-2 {
  332. child-prop = <3>;
  333. };
  334. };
  335. //
  336. // zephyr,user binding inference
  337. //
  338. zephyr,user {
  339. boolean;
  340. bytes = [81 82 83];
  341. number = <23>;
  342. numbers = <1>, <2>, <3>;
  343. string = "text";
  344. strings = "a", "b", "c";
  345. handle = <&{/ctrl-1}>;
  346. phandles = <&{/ctrl-1}>, <&{/ctrl-2}>;
  347. phandle-array-foos = <&{/ctrl-2} 1 2>;
  348. };
  349. //
  350. // For testing that neither 'include: [foo.yaml, bar.yaml]' nor
  351. // 'include: [bar.yaml, foo.yaml]' causes errors when one of the files
  352. // has 'required: true' and the other 'required: false'
  353. //
  354. include-order {
  355. node-1 {
  356. compatible = "order-1";
  357. foo = <1>;
  358. };
  359. node-2 {
  360. compatible = "order-2";
  361. foo = <2>;
  362. };
  363. };
  364. //
  365. // For testing deprecated property
  366. //
  367. test-deprecated {
  368. compatible = "test-deprecated";
  369. oldprop = <4>; /* deprecated property */
  370. curprop = <5>;
  371. };
  372. //
  373. // For testing deprecated features
  374. //
  375. deprecated {
  376. compatible = "deprecated";
  377. required = <1>;
  378. required-2 = <2>;
  379. #foo-cells = <2>;
  380. sub-node {
  381. foos = <&{/deprecated} 1 2>;
  382. };
  383. };
  384. };