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