reset-uclass.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (c) 2016, NVIDIA CORPORATION.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0
  5. */
  6. #ifndef _RESET_UCLASS_H
  7. #define _RESET_UCLASS_H
  8. /* See reset.h for background documentation. */
  9. #include <reset.h>
  10. struct fdtdec_phandle_args;
  11. struct udevice;
  12. /**
  13. * struct reset_ops - The functions that a reset controller driver must
  14. * implement.
  15. */
  16. struct reset_ops {
  17. /**
  18. * of_xlate - Translate a client's device-tree (OF) reset specifier.
  19. *
  20. * The reset core calls this function as the first step in implementing
  21. * a client's reset_get_by_*() call.
  22. *
  23. * If this function pointer is set to NULL, the reset core will use a
  24. * default implementation, which assumes #reset-cells = <1>, and that
  25. * the DT cell contains a simple integer reset signal ID.
  26. *
  27. * At present, the reset API solely supports device-tree. If this
  28. * changes, other xxx_xlate() functions may be added to support those
  29. * other mechanisms.
  30. *
  31. * @reset_ctl: The reset control struct to hold the translation result.
  32. * @args: The reset specifier values from device tree.
  33. * @return 0 if OK, or a negative error code.
  34. */
  35. int (*of_xlate)(struct reset_ctl *reset_ctl,
  36. struct fdtdec_phandle_args *args);
  37. /**
  38. * request - Request a translated reset control.
  39. *
  40. * The reset core calls this function as the second step in
  41. * implementing a client's reset_get_by_*() call, following a
  42. * successful xxx_xlate() call.
  43. *
  44. * @reset_ctl: The reset control struct to request; this has been
  45. * filled in by a previoux xxx_xlate() function call.
  46. * @return 0 if OK, or a negative error code.
  47. */
  48. int (*request)(struct reset_ctl *reset_ctl);
  49. /**
  50. * free - Free a previously requested reset control.
  51. *
  52. * This is the implementation of the client reset_free() API.
  53. *
  54. * @reset_ctl: The reset control to free.
  55. * @return 0 if OK, or a negative error code.
  56. */
  57. int (*free)(struct reset_ctl *reset_ctl);
  58. /**
  59. * rst_assert - Assert a reset signal.
  60. *
  61. * Note: This function is named rst_assert not assert to avoid
  62. * conflicting with global macro assert().
  63. *
  64. * @reset_ctl: The reset signal to assert.
  65. * @return 0 if OK, or a negative error code.
  66. */
  67. int (*rst_assert)(struct reset_ctl *reset_ctl);
  68. /**
  69. * rst_deassert - Deassert a reset signal.
  70. *
  71. * @reset_ctl: The reset signal to deassert.
  72. * @return 0 if OK, or a negative error code.
  73. */
  74. int (*rst_deassert)(struct reset_ctl *reset_ctl);
  75. };
  76. #endif