clk.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2016, NVIDIA CORPORATION.
  4. */
  5. #ifndef __SANDBOX_CLK_H
  6. #define __SANDBOX_CLK_H
  7. #include <common.h>
  8. struct udevice;
  9. /**
  10. * enum sandbox_clk_id - Identity of clocks implemented by the sandbox clock
  11. * provider.
  12. *
  13. * These IDs are within/relative-to the clock provider.
  14. */
  15. enum sandbox_clk_id {
  16. SANDBOX_CLK_ID_SPI,
  17. SANDBOX_CLK_ID_I2C,
  18. SANDBOX_CLK_ID_COUNT,
  19. };
  20. /**
  21. * enum sandbox_clk_test_id - Identity of the clocks consumed by the sandbox
  22. * clock test device.
  23. *
  24. * These are the IDs the clock consumer knows the clocks as.
  25. */
  26. enum sandbox_clk_test_id {
  27. SANDBOX_CLK_TEST_ID_FIXED,
  28. SANDBOX_CLK_TEST_ID_SPI,
  29. SANDBOX_CLK_TEST_ID_I2C,
  30. SANDBOX_CLK_TEST_ID_COUNT,
  31. };
  32. /**
  33. * sandbox_clk_query_rate - Query the current rate of a sandbox clock.
  34. *
  35. * @dev: The sandbox clock provider device.
  36. * @id: The clock to query.
  37. * @return: The rate of the clock.
  38. */
  39. ulong sandbox_clk_query_rate(struct udevice *dev, int id);
  40. /**
  41. * sandbox_clk_query_enable - Query the enable state of a sandbox clock.
  42. *
  43. * @dev: The sandbox clock provider device.
  44. * @id: The clock to query.
  45. * @return: The rate of the clock.
  46. */
  47. int sandbox_clk_query_enable(struct udevice *dev, int id);
  48. /**
  49. * sandbox_clk_test_get - Ask the sandbox clock test device to request its
  50. * clocks.
  51. *
  52. * @dev: The sandbox clock test (client) devivce.
  53. * @return: 0 if OK, or a negative error code.
  54. */
  55. int sandbox_clk_test_get(struct udevice *dev);
  56. /**
  57. * sandbox_clk_test_get_bulk - Ask the sandbox clock test device to request its
  58. * clocks with the bulk clk API.
  59. *
  60. * @dev: The sandbox clock test (client) devivce.
  61. * @return: 0 if OK, or a negative error code.
  62. */
  63. int sandbox_clk_test_get_bulk(struct udevice *dev);
  64. /**
  65. * sandbox_clk_test_get_rate - Ask the sandbox clock test device to query a
  66. * clock's rate.
  67. *
  68. * @dev: The sandbox clock test (client) devivce.
  69. * @id: The test device's clock ID to query.
  70. * @return: The rate of the clock.
  71. */
  72. ulong sandbox_clk_test_get_rate(struct udevice *dev, int id);
  73. /**
  74. * sandbox_clk_test_set_rate - Ask the sandbox clock test device to set a
  75. * clock's rate.
  76. *
  77. * @dev: The sandbox clock test (client) devivce.
  78. * @id: The test device's clock ID to configure.
  79. * @return: The new rate of the clock.
  80. */
  81. ulong sandbox_clk_test_set_rate(struct udevice *dev, int id, ulong rate);
  82. /**
  83. * sandbox_clk_test_enable - Ask the sandbox clock test device to enable a
  84. * clock.
  85. *
  86. * @dev: The sandbox clock test (client) devivce.
  87. * @id: The test device's clock ID to configure.
  88. * @return: 0 if OK, or a negative error code.
  89. */
  90. int sandbox_clk_test_enable(struct udevice *dev, int id);
  91. /**
  92. * sandbox_clk_test_enable_bulk - Ask the sandbox clock test device to enable
  93. * all clocks in it's clock bulk struct.
  94. *
  95. * @dev: The sandbox clock test (client) devivce.
  96. * @return: 0 if OK, or a negative error code.
  97. */
  98. int sandbox_clk_test_enable_bulk(struct udevice *dev);
  99. /**
  100. * sandbox_clk_test_disable - Ask the sandbox clock test device to disable a
  101. * clock.
  102. *
  103. * @dev: The sandbox clock test (client) devivce.
  104. * @id: The test device's clock ID to configure.
  105. * @return: 0 if OK, or a negative error code.
  106. */
  107. int sandbox_clk_test_disable(struct udevice *dev, int id);
  108. /**
  109. * sandbox_clk_test_disable_bulk - Ask the sandbox clock test device to disable
  110. * all clocks in it's clock bulk struct.
  111. *
  112. * @dev: The sandbox clock test (client) devivce.
  113. * @return: 0 if OK, or a negative error code.
  114. */
  115. int sandbox_clk_test_disable_bulk(struct udevice *dev);
  116. /**
  117. * sandbox_clk_test_free - Ask the sandbox clock test device to free its
  118. * clocks.
  119. *
  120. * @dev: The sandbox clock test (client) devivce.
  121. * @return: 0 if OK, or a negative error code.
  122. */
  123. int sandbox_clk_test_free(struct udevice *dev);
  124. /**
  125. * sandbox_clk_test_release_bulk - Ask the sandbox clock test device to release
  126. * all clocks in it's clock bulk struct.
  127. *
  128. * @dev: The sandbox clock test (client) devivce.
  129. * @return: 0 if OK, or a negative error code.
  130. */
  131. int sandbox_clk_test_release_bulk(struct udevice *dev);
  132. #endif