reset-uclass.h 2.6 KB

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