clk.h 2.9 KB

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