imx.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Interconnect framework driver for i.MX SoC
  4. *
  5. * Copyright (c) 2019, BayLibre
  6. * Copyright (c) 2019-2020, NXP
  7. * Author: Alexandre Bailon <abailon@baylibre.com>
  8. * Author: Leonard Crestez <leonard.crestez@nxp.com>
  9. */
  10. #ifndef __DRIVERS_INTERCONNECT_IMX_H
  11. #define __DRIVERS_INTERCONNECT_IMX_H
  12. #include <linux/kernel.h>
  13. #define IMX_ICC_MAX_LINKS 4
  14. /*
  15. * struct imx_icc_node_adj - Describe a dynamic adjustable node
  16. */
  17. struct imx_icc_node_adj_desc {
  18. unsigned int bw_mul, bw_div;
  19. const char *phandle_name;
  20. bool main_noc;
  21. };
  22. /*
  23. * struct imx_icc_node - Describe an interconnect node
  24. * @name: name of the node
  25. * @id: an unique id to identify the node
  26. * @links: an array of slaves' node id
  27. * @num_links: number of id defined in links
  28. */
  29. struct imx_icc_node_desc {
  30. const char *name;
  31. u16 id;
  32. u16 links[IMX_ICC_MAX_LINKS];
  33. u16 num_links;
  34. const struct imx_icc_node_adj_desc *adj;
  35. };
  36. #define DEFINE_BUS_INTERCONNECT(_name, _id, _adj, ...) \
  37. { \
  38. .id = _id, \
  39. .name = _name, \
  40. .adj = _adj, \
  41. .num_links = ARRAY_SIZE(((int[]){ __VA_ARGS__ })), \
  42. .links = { __VA_ARGS__ }, \
  43. }
  44. #define DEFINE_BUS_MASTER(_name, _id, _dest_id) \
  45. DEFINE_BUS_INTERCONNECT(_name, _id, NULL, _dest_id)
  46. #define DEFINE_BUS_SLAVE(_name, _id, _adj) \
  47. DEFINE_BUS_INTERCONNECT(_name, _id, _adj)
  48. int imx_icc_register(struct platform_device *pdev,
  49. struct imx_icc_node_desc *nodes,
  50. int nodes_count);
  51. int imx_icc_unregister(struct platform_device *pdev);
  52. #endif /* __DRIVERS_INTERCONNECT_IMX_H */