stm32mp_reset.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2018-2019, 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. #endif /* STM32MP_RESET_H */