stm32mp_reset.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2018-2024, STMicroelectronics - All Rights Reserved
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef STM32MP_RESET_H
  7. #define STM32MP_RESET_H
  8. #include <stdint.h>
  9. /*
  10. * Assert target reset, if @to_us non null, wait until reset is asserted
  11. *
  12. * @reset_id: Reset controller ID
  13. * @to_us: Timeout in microsecond, or 0 if not waiting
  14. * Return 0 on success and -ETIMEDOUT if waiting and timeout expired
  15. */
  16. int stm32mp_reset_assert(uint32_t reset_id, unsigned int to_us);
  17. /*
  18. * Enable reset control for target resource
  19. *
  20. * @reset_id: Reset controller ID
  21. */
  22. static inline void stm32mp_reset_set(uint32_t reset_id)
  23. {
  24. (void)stm32mp_reset_assert(reset_id, 0U);
  25. }
  26. /*
  27. * Deassert target reset, if @to_us non null, wait until reset is deasserted
  28. *
  29. * @reset_id: Reset controller ID
  30. * @to_us: Timeout in microsecond, or 0 if not waiting
  31. * Return 0 on success and -ETIMEDOUT if waiting and timeout expired
  32. */
  33. int stm32mp_reset_deassert(uint32_t reset_id, unsigned int to_us);
  34. /*
  35. * Release reset control for target resource
  36. *
  37. * @reset_id: Reset controller ID
  38. */
  39. static inline void stm32mp_reset_release(uint32_t reset_id)
  40. {
  41. (void)stm32mp_reset_deassert(reset_id, 0U);
  42. }
  43. /*
  44. * Manage system reset control
  45. */
  46. void __dead2 stm32mp_system_reset(void);
  47. #endif /* STM32MP_RESET_H */