of_graph.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * OF graph binding parsing helpers
  3. *
  4. * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
  5. * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
  6. *
  7. * Copyright (C) 2012 Renesas Electronics Corp.
  8. * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef __LINUX_OF_GRAPH_H
  15. #define __LINUX_OF_GRAPH_H
  16. /**
  17. * struct of_endpoint - the OF graph endpoint data structure
  18. * @port: identifier (value of reg property) of a port this endpoint belongs to
  19. * @id: identifier (value of reg property) of this endpoint
  20. * @local_node: pointer to device_node of this endpoint
  21. */
  22. struct of_endpoint {
  23. unsigned int port;
  24. unsigned int id;
  25. const struct device_node *local_node;
  26. };
  27. #ifdef CONFIG_OF
  28. int of_graph_parse_endpoint(const struct device_node *node,
  29. struct of_endpoint *endpoint);
  30. struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
  31. struct device_node *previous);
  32. struct device_node *of_graph_get_remote_port_parent(
  33. const struct device_node *node);
  34. struct device_node *of_graph_get_remote_port(const struct device_node *node);
  35. #else
  36. static inline int of_graph_parse_endpoint(const struct device_node *node,
  37. struct of_endpoint *endpoint)
  38. {
  39. return -ENOSYS;
  40. }
  41. static inline struct device_node *of_graph_get_next_endpoint(
  42. const struct device_node *parent,
  43. struct device_node *previous)
  44. {
  45. return NULL;
  46. }
  47. static inline struct device_node *of_graph_get_remote_port_parent(
  48. const struct device_node *node)
  49. {
  50. return NULL;
  51. }
  52. static inline struct device_node *of_graph_get_remote_port(
  53. const struct device_node *node)
  54. {
  55. return NULL;
  56. }
  57. #endif /* CONFIG_OF */
  58. #endif /* __LINUX_OF_GRAPH_H */