ofnode.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c) 2017 Google, Inc
  4. * Written by Simon Glass <sjg@chromium.org>
  5. */
  6. #ifndef _DM_OFNODE_H
  7. #define _DM_OFNODE_H
  8. /* TODO(sjg@chromium.org): Drop fdtdec.h include */
  9. #include <fdtdec.h>
  10. #include <dm/of.h>
  11. /* Enable checks to protect against invalid calls */
  12. #undef OF_CHECKS
  13. struct resource;
  14. /**
  15. * ofnode - reference to a device tree node
  16. *
  17. * This union can hold either a straightforward pointer to a struct device_node
  18. * in the live device tree, or an offset within the flat device tree. In the
  19. * latter case, the pointer value is just the integer offset within the flat DT.
  20. *
  21. * Thus we can reference nodes in both the live tree (once available) and the
  22. * flat tree (until then). Functions are available to translate between an
  23. * ofnode and either an offset or a struct device_node *.
  24. *
  25. * The reference can also hold a null offset, in which case the pointer value
  26. * here is NULL. This corresponds to a struct device_node * value of
  27. * NULL, or an offset of -1.
  28. *
  29. * There is no ambiguity as to whether ofnode holds an offset or a node
  30. * pointer: when the live tree is active it holds a node pointer, otherwise it
  31. * holds an offset. The value itself does not need to be unique and in theory
  32. * the same value could point to a valid device node or a valid offset. We
  33. * could arrange for a unique value to be used (e.g. by making the pointer
  34. * point to an offset within the flat device tree in the case of an offset) but
  35. * this increases code size slightly due to the subtraction. Since it offers no
  36. * real benefit, the approach described here seems best.
  37. *
  38. * For now these points use constant types, since we don't allow writing
  39. * the DT.
  40. *
  41. * @np: Pointer to device node, used for live tree
  42. * @of_offset: Pointer into flat device tree, used for flat tree. Note that this
  43. * is not a really a pointer to a node: it is an offset value. See above.
  44. */
  45. typedef union ofnode_union {
  46. const struct device_node *np; /* will be used for future live tree */
  47. long of_offset;
  48. } ofnode;
  49. struct ofnode_phandle_args {
  50. ofnode node;
  51. int args_count;
  52. uint32_t args[OF_MAX_PHANDLE_ARGS];
  53. };
  54. /**
  55. * _ofnode_to_np() - convert an ofnode to a live DT node pointer
  56. *
  57. * This cannot be called if the reference contains an offset.
  58. *
  59. * @node: Reference containing struct device_node * (possibly invalid)
  60. * @return pointer to device node (can be NULL)
  61. */
  62. static inline const struct device_node *ofnode_to_np(ofnode node)
  63. {
  64. #ifdef OF_CHECKS
  65. if (!of_live_active())
  66. return NULL;
  67. #endif
  68. return node.np;
  69. }
  70. /**
  71. * ofnode_to_offset() - convert an ofnode to a flat DT offset
  72. *
  73. * This cannot be called if the reference contains a node pointer.
  74. *
  75. * @node: Reference containing offset (possibly invalid)
  76. * @return DT offset (can be -1)
  77. */
  78. static inline int ofnode_to_offset(ofnode node)
  79. {
  80. #ifdef OF_CHECKS
  81. if (of_live_active())
  82. return -1;
  83. #endif
  84. return node.of_offset;
  85. }
  86. /**
  87. * ofnode_valid() - check if an ofnode is valid
  88. *
  89. * @return true if the reference contains a valid ofnode, false if it is NULL
  90. */
  91. static inline bool ofnode_valid(ofnode node)
  92. {
  93. if (of_live_active())
  94. return node.np != NULL;
  95. else
  96. return node.of_offset != -1;
  97. }
  98. /**
  99. * offset_to_ofnode() - convert a DT offset to an ofnode
  100. *
  101. * @of_offset: DT offset (either valid, or -1)
  102. * @return reference to the associated DT offset
  103. */
  104. static inline ofnode offset_to_ofnode(int of_offset)
  105. {
  106. ofnode node;
  107. if (of_live_active())
  108. node.np = NULL;
  109. else
  110. node.of_offset = of_offset;
  111. return node;
  112. }
  113. /**
  114. * np_to_ofnode() - convert a node pointer to an ofnode
  115. *
  116. * @np: Live node pointer (can be NULL)
  117. * @return reference to the associated node pointer
  118. */
  119. static inline ofnode np_to_ofnode(const struct device_node *np)
  120. {
  121. ofnode node;
  122. node.np = np;
  123. return node;
  124. }
  125. /**
  126. * ofnode_is_np() - check if a reference is a node pointer
  127. *
  128. * This function associated that if there is a valid live tree then all
  129. * references will use it. This is because using the flat DT when the live tree
  130. * is valid is not permitted.
  131. *
  132. * @node: reference to check (possibly invalid)
  133. * @return true if the reference is a live node pointer, false if it is a DT
  134. * offset
  135. */
  136. static inline bool ofnode_is_np(ofnode node)
  137. {
  138. #ifdef OF_CHECKS
  139. /*
  140. * Check our assumption that flat tree offsets are not used when a
  141. * live tree is in use.
  142. */
  143. assert(!ofnode_valid(node) ||
  144. (of_live_active() ? _ofnode_to_np(node)
  145. : _ofnode_to_np(node)));
  146. #endif
  147. return of_live_active() && ofnode_valid(node);
  148. }
  149. /**
  150. * ofnode_equal() - check if two references are equal
  151. *
  152. * @return true if equal, else false
  153. */
  154. static inline bool ofnode_equal(ofnode ref1, ofnode ref2)
  155. {
  156. /* We only need to compare the contents */
  157. return ref1.of_offset == ref2.of_offset;
  158. }
  159. /**
  160. * ofnode_null() - Obtain a null ofnode
  161. *
  162. * This returns an ofnode which points to no node. It works both with the flat
  163. * tree and livetree.
  164. */
  165. static inline ofnode ofnode_null(void)
  166. {
  167. ofnode node;
  168. if (of_live_active())
  169. node.np = NULL;
  170. else
  171. node.of_offset = -1;
  172. return node;
  173. }
  174. /**
  175. * ofnode_read_u32() - Read a 32-bit integer from a property
  176. *
  177. * @ref: valid node reference to read property from
  178. * @propname: name of the property to read from
  179. * @outp: place to put value (if found)
  180. * @return 0 if OK, -ve on error
  181. */
  182. int ofnode_read_u32(ofnode node, const char *propname, u32 *outp);
  183. /**
  184. * ofnode_read_s32() - Read a 32-bit integer from a property
  185. *
  186. * @ref: valid node reference to read property from
  187. * @propname: name of the property to read from
  188. * @outp: place to put value (if found)
  189. * @return 0 if OK, -ve on error
  190. */
  191. static inline int ofnode_read_s32(ofnode node, const char *propname,
  192. s32 *out_value)
  193. {
  194. return ofnode_read_u32(node, propname, (u32 *)out_value);
  195. }
  196. /**
  197. * ofnode_read_u32_default() - Read a 32-bit integer from a property
  198. *
  199. * @ref: valid node reference to read property from
  200. * @propname: name of the property to read from
  201. * @def: default value to return if the property has no value
  202. * @return property value, or @def if not found
  203. */
  204. int ofnode_read_u32_default(ofnode ref, const char *propname, u32 def);
  205. /**
  206. * ofnode_read_s32_default() - Read a 32-bit integer from a property
  207. *
  208. * @ref: valid node reference to read property from
  209. * @propname: name of the property to read from
  210. * @def: default value to return if the property has no value
  211. * @return property value, or @def if not found
  212. */
  213. int ofnode_read_s32_default(ofnode node, const char *propname, s32 def);
  214. /**
  215. * ofnode_read_string() - Read a string from a property
  216. *
  217. * @ref: valid node reference to read property from
  218. * @propname: name of the property to read
  219. * @return string from property value, or NULL if there is no such property
  220. */
  221. const char *ofnode_read_string(ofnode node, const char *propname);
  222. /**
  223. * ofnode_read_u32_array() - Find and read an array of 32 bit integers
  224. *
  225. * @node: valid node reference to read property from
  226. * @propname: name of the property to read
  227. * @out_values: pointer to return value, modified only if return value is 0
  228. * @sz: number of array elements to read
  229. *
  230. * Search for a property in a device node and read 32-bit value(s) from
  231. * it. Returns 0 on success, -EINVAL if the property does not exist,
  232. * -ENODATA if property does not have a value, and -EOVERFLOW if the
  233. * property data isn't large enough.
  234. *
  235. * The out_values is modified only if a valid u32 value can be decoded.
  236. */
  237. int ofnode_read_u32_array(ofnode node, const char *propname,
  238. u32 *out_values, size_t sz);
  239. /**
  240. * ofnode_read_bool() - read a boolean value from a property
  241. *
  242. * @node: valid node reference to read property from
  243. * @propname: name of property to read
  244. * @return true if property is present (meaning true), false if not present
  245. */
  246. bool ofnode_read_bool(ofnode node, const char *propname);
  247. /**
  248. * ofnode_find_subnode() - find a named subnode of a parent node
  249. *
  250. * @node: valid reference to parent node
  251. * @subnode_name: name of subnode to find
  252. * @return reference to subnode (which can be invalid if there is no such
  253. * subnode)
  254. */
  255. ofnode ofnode_find_subnode(ofnode node, const char *subnode_name);
  256. /**
  257. * ofnode_first_subnode() - find the first subnode of a parent node
  258. *
  259. * @node: valid reference to a valid parent node
  260. * @return reference to the first subnode (which can be invalid if the parent
  261. * node has no subnodes)
  262. */
  263. ofnode ofnode_first_subnode(ofnode node);
  264. /**
  265. * ofnode_next_subnode() - find the next sibling of a subnode
  266. *
  267. * @node: valid reference to previous node (sibling)
  268. * @return reference to the next subnode (which can be invalid if the node
  269. * has no more siblings)
  270. */
  271. ofnode ofnode_next_subnode(ofnode node);
  272. /**
  273. * ofnode_get_parent() - get the ofnode's parent (enclosing ofnode)
  274. *
  275. * @node: valid node to look up
  276. * @return ofnode reference of the parent node
  277. */
  278. ofnode ofnode_get_parent(ofnode node);
  279. /**
  280. * ofnode_get_name() - get the name of a node
  281. *
  282. * @node: valid node to look up
  283. * @return name or node
  284. */
  285. const char *ofnode_get_name(ofnode node);
  286. /**
  287. * ofnode_get_by_phandle() - get ofnode from phandle
  288. *
  289. * @phandle: phandle to look up
  290. * @return ofnode reference to the phandle
  291. */
  292. ofnode ofnode_get_by_phandle(uint phandle);
  293. /**
  294. * ofnode_read_size() - read the size of a property
  295. *
  296. * @node: node to check
  297. * @propname: property to check
  298. * @return size of property if present, or -EINVAL if not
  299. */
  300. int ofnode_read_size(ofnode node, const char *propname);
  301. /**
  302. * ofnode_get_addr_index() - get an address from a node
  303. *
  304. * This reads the register address from a node
  305. *
  306. * @node: node to read from
  307. * @index: Index of address to read (0 for first)
  308. * @return address, or FDT_ADDR_T_NONE if not present or invalid
  309. */
  310. phys_addr_t ofnode_get_addr_index(ofnode node, int index);
  311. /**
  312. * ofnode_get_addr() - get an address from a node
  313. *
  314. * This reads the register address from a node
  315. *
  316. * @node: node to read from
  317. * @return address, or FDT_ADDR_T_NONE if not present or invalid
  318. */
  319. phys_addr_t ofnode_get_addr(ofnode node);
  320. /**
  321. * ofnode_stringlist_search() - find a string in a string list and return index
  322. *
  323. * Note that it is possible for this function to succeed on property values
  324. * that are not NUL-terminated. That's because the function will stop after
  325. * finding the first occurrence of @string. This can for example happen with
  326. * small-valued cell properties, such as #address-cells, when searching for
  327. * the empty string.
  328. *
  329. * @node: node to check
  330. * @propname: name of the property containing the string list
  331. * @string: string to look up in the string list
  332. *
  333. * @return:
  334. * the index of the string in the list of strings
  335. * -ENODATA if the property is not found
  336. * -EINVAL on some other error
  337. */
  338. int ofnode_stringlist_search(ofnode node, const char *propname,
  339. const char *string);
  340. /**
  341. * ofnode_read_string_index() - obtain an indexed string from a string list
  342. *
  343. * Note that this will successfully extract strings from properties with
  344. * non-NUL-terminated values. For example on small-valued cell properties
  345. * this function will return the empty string.
  346. *
  347. * If non-NULL, the length of the string (on success) or a negative error-code
  348. * (on failure) will be stored in the integer pointer to by lenp.
  349. *
  350. * @node: node to check
  351. * @propname: name of the property containing the string list
  352. * @index: index of the string to return
  353. * @lenp: return location for the string length or an error code on failure
  354. *
  355. * @return:
  356. * length of string, if found or -ve error value if not found
  357. */
  358. int ofnode_read_string_index(ofnode node, const char *propname, int index,
  359. const char **outp);
  360. /**
  361. * ofnode_read_string_count() - find the number of strings in a string list
  362. *
  363. * @node: node to check
  364. * @propname: name of the property containing the string list
  365. * @return:
  366. * number of strings in the list, or -ve error value if not found
  367. */
  368. int ofnode_read_string_count(ofnode node, const char *property);
  369. /**
  370. * ofnode_parse_phandle_with_args() - Find a node pointed by phandle in a list
  371. *
  372. * This function is useful to parse lists of phandles and their arguments.
  373. * Returns 0 on success and fills out_args, on error returns appropriate
  374. * errno value.
  375. *
  376. * Caller is responsible to call of_node_put() on the returned out_args->np
  377. * pointer.
  378. *
  379. * Example:
  380. *
  381. * phandle1: node1 {
  382. * #list-cells = <2>;
  383. * }
  384. *
  385. * phandle2: node2 {
  386. * #list-cells = <1>;
  387. * }
  388. *
  389. * node3 {
  390. * list = <&phandle1 1 2 &phandle2 3>;
  391. * }
  392. *
  393. * To get a device_node of the `node2' node you may call this:
  394. * ofnode_parse_phandle_with_args(node3, "list", "#list-cells", 0, 1, &args);
  395. *
  396. * @node: device tree node containing a list
  397. * @list_name: property name that contains a list
  398. * @cells_name: property name that specifies phandles' arguments count
  399. * @cells_count: Cell count to use if @cells_name is NULL
  400. * @index: index of a phandle to parse out
  401. * @out_args: optional pointer to output arguments structure (will be filled)
  402. * @return 0 on success (with @out_args filled out if not NULL), -ENOENT if
  403. * @list_name does not exist, -EINVAL if a phandle was not found,
  404. * @cells_name could not be found, the arguments were truncated or there
  405. * were too many arguments.
  406. */
  407. int ofnode_parse_phandle_with_args(ofnode node, const char *list_name,
  408. const char *cells_name, int cell_count,
  409. int index,
  410. struct ofnode_phandle_args *out_args);
  411. /**
  412. * ofnode_count_phandle_with_args() - Count number of phandle in a list
  413. *
  414. * This function is useful to count phandles into a list.
  415. * Returns number of phandle on success, on error returns appropriate
  416. * errno value.
  417. *
  418. * @node: device tree node containing a list
  419. * @list_name: property name that contains a list
  420. * @cells_name: property name that specifies phandles' arguments count
  421. * @return number of phandle on success, -ENOENT if @list_name does not
  422. * exist, -EINVAL if a phandle was not found, @cells_name could not
  423. * be found.
  424. */
  425. int ofnode_count_phandle_with_args(ofnode node, const char *list_name,
  426. const char *cells_name);
  427. /**
  428. * ofnode_path() - find a node by full path
  429. *
  430. * @path: Full path to node, e.g. "/bus/spi@1"
  431. * @return reference to the node found. Use ofnode_valid() to check if it exists
  432. */
  433. ofnode ofnode_path(const char *path);
  434. /**
  435. * ofnode_get_chosen_prop() - get the value of a chosen property
  436. *
  437. * This looks for a property within the /chosen node and returns its value
  438. *
  439. * @propname: Property name to look for
  440. */
  441. const char *ofnode_get_chosen_prop(const char *propname);
  442. /**
  443. * ofnode_get_chosen_node() - get the chosen node
  444. *
  445. * @return the chosen node if present, else ofnode_null()
  446. */
  447. ofnode ofnode_get_chosen_node(const char *name);
  448. struct display_timing;
  449. /**
  450. * ofnode_decode_display_timing() - decode display timings
  451. *
  452. * Decode display timings from the supplied 'display-timings' node.
  453. * See doc/device-tree-bindings/video/display-timing.txt for binding
  454. * information.
  455. *
  456. * @node 'display-timing' node containing the timing subnodes
  457. * @index Index number to read (0=first timing subnode)
  458. * @config Place to put timings
  459. * @return 0 if OK, -FDT_ERR_NOTFOUND if not found
  460. */
  461. int ofnode_decode_display_timing(ofnode node, int index,
  462. struct display_timing *config);
  463. /**
  464. * ofnode_get_property()- - get a pointer to the value of a node property
  465. *
  466. * @node: node to read
  467. * @propname: property to read
  468. * @lenp: place to put length on success
  469. * @return pointer to property, or NULL if not found
  470. */
  471. const void *ofnode_get_property(ofnode node, const char *propname, int *lenp);
  472. /**
  473. * ofnode_is_available() - check if a node is marked available
  474. *
  475. * @node: node to check
  476. * @return true if node's 'status' property is "okay" (or is missing)
  477. */
  478. bool ofnode_is_available(ofnode node);
  479. /**
  480. * ofnode_get_addr_size() - get address and size from a property
  481. *
  482. * This does no address translation. It simply reads an property that contains
  483. * an address and a size value, one after the other.
  484. *
  485. * @node: node to read from
  486. * @propname: property to read
  487. * @sizep: place to put size value (on success)
  488. * @return address value, or FDT_ADDR_T_NONE on error
  489. */
  490. phys_addr_t ofnode_get_addr_size(ofnode node, const char *propname,
  491. phys_size_t *sizep);
  492. /**
  493. * ofnode_read_u8_array_ptr() - find an 8-bit array
  494. *
  495. * Look up a property in a node and return a pointer to its contents as a
  496. * byte array of given length. The property must have at least enough data
  497. * for the array (count bytes). It may have more, but this will be ignored.
  498. * The data is not copied.
  499. *
  500. * @node node to examine
  501. * @propname name of property to find
  502. * @sz number of array elements
  503. * @return pointer to byte array if found, or NULL if the property is not
  504. * found or there is not enough data
  505. */
  506. const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
  507. size_t sz);
  508. /**
  509. * ofnode_read_pci_addr() - look up a PCI address
  510. *
  511. * Look at an address property in a node and return the PCI address which
  512. * corresponds to the given type in the form of fdt_pci_addr.
  513. * The property must hold one fdt_pci_addr with a lengh.
  514. *
  515. * @node node to examine
  516. * @type pci address type (FDT_PCI_SPACE_xxx)
  517. * @propname name of property to find
  518. * @addr returns pci address in the form of fdt_pci_addr
  519. * @return 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
  520. * format of the property was invalid, -ENXIO if the requested
  521. * address type was not found
  522. */
  523. int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
  524. const char *propname, struct fdt_pci_addr *addr);
  525. /**
  526. * ofnode_read_addr_cells() - Get the number of address cells for a node
  527. *
  528. * This walks back up the tree to find the closest #address-cells property
  529. * which controls the given node.
  530. *
  531. * @node: Node to check
  532. * @return number of address cells this node uses
  533. */
  534. int ofnode_read_addr_cells(ofnode node);
  535. /**
  536. * ofnode_read_size_cells() - Get the number of size cells for a node
  537. *
  538. * This walks back up the tree to find the closest #size-cells property
  539. * which controls the given node.
  540. *
  541. * @node: Node to check
  542. * @return number of size cells this node uses
  543. */
  544. int ofnode_read_size_cells(ofnode node);
  545. /**
  546. * ofnode_read_simple_addr_cells() - Get the address cells property in a node
  547. *
  548. * This function matches fdt_address_cells().
  549. *
  550. * @np: Node pointer to check
  551. * @return value of #address-cells property in this node, or 2 if none
  552. */
  553. int ofnode_read_simple_addr_cells(ofnode node);
  554. /**
  555. * ofnode_read_simple_size_cells() - Get the size cells property in a node
  556. *
  557. * This function matches fdt_size_cells().
  558. *
  559. * @np: Node pointer to check
  560. * @return value of #size-cells property in this node, or 2 if none
  561. */
  562. int ofnode_read_simple_size_cells(ofnode node);
  563. /**
  564. * ofnode_pre_reloc() - check if a node should be bound before relocation
  565. *
  566. * Device tree nodes can be marked as needing-to-be-bound in the loader stages
  567. * via special device tree properties.
  568. *
  569. * Before relocation this function can be used to check if nodes are required
  570. * in either SPL or TPL stages.
  571. *
  572. * After relocation and jumping into the real U-Boot binary it is possible to
  573. * determine if a node was bound in one of SPL/TPL stages.
  574. *
  575. * There are 3 settings currently in use
  576. * -
  577. * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL
  578. * Existing platforms only use it to indicate nodes needed in
  579. * SPL. Should probably be replaced by u-boot,dm-spl for
  580. * new platforms.
  581. *
  582. * @node: node to check
  583. * @eturns true if node is needed in SPL/TL, false otherwise
  584. */
  585. bool ofnode_pre_reloc(ofnode node);
  586. int ofnode_read_resource(ofnode node, uint index, struct resource *res);
  587. int ofnode_read_resource_byname(ofnode node, const char *name,
  588. struct resource *res);
  589. /**
  590. * ofnode_for_each_subnode() - iterate over all subnodes of a parent
  591. *
  592. * @node: child node (ofnode, lvalue)
  593. * @parent: parent node (ofnode)
  594. *
  595. * This is a wrapper around a for loop and is used like so:
  596. *
  597. * ofnode node;
  598. *
  599. * ofnode_for_each_subnode(node, parent) {
  600. * Use node
  601. * ...
  602. * }
  603. *
  604. * Note that this is implemented as a macro and @node is used as
  605. * iterator in the loop. The parent variable can be a constant or even a
  606. * literal.
  607. */
  608. #define ofnode_for_each_subnode(node, parent) \
  609. for (node = ofnode_first_subnode(parent); \
  610. ofnode_valid(node); \
  611. node = ofnode_next_subnode(node))
  612. /**
  613. * ofnode_translate_address() - Tranlate a device-tree address
  614. *
  615. * Translate an address from the device-tree into a CPU physical address. This
  616. * function walks up the tree and applies the various bus mappings along the
  617. * way.
  618. *
  619. * @ofnode: Device tree node giving the context in which to translate the
  620. * address
  621. * @in_addr: pointer to the address to translate
  622. * @return the translated address; OF_BAD_ADDR on error
  623. */
  624. u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr);
  625. /**
  626. * ofnode_device_is_compatible() - check if the node is compatible with compat
  627. *
  628. * This allows to check whether the node is comaptible with the compat.
  629. *
  630. * @node: Device tree node for which compatible needs to be verified.
  631. * @compat: Compatible string which needs to verified in the given node.
  632. * @return true if OK, false if the compatible is not found
  633. */
  634. int ofnode_device_is_compatible(ofnode node, const char *compat);
  635. #endif