arm-trusted-firmware/include/drivers/st/stm32mp_reset.h
Etienne Carriere 45c70e6867 drivers: stm32_reset adapt interface to timeout argument
Changes stm32mp1 reset driver to API to add a timeout argument
to stm32mp_reset_assert() and stm32mp_reset_deassert() and
a return value.

With a supplied timeout, the functions wait the target reset state
is reached before returning. With a timeout of zero, the functions
simply load target reset state in SoC interface and return without
waiting.

Helper functions stm32mp_reset_set() and stm32mp_reset_release()
use a zero timeout and return without a return code.

This change updates few stm32 drivers and plat/stm32mp1 blé_plat_setup.c
accordingly without any functional change.
functional change.

Change-Id: Ia1a73a15125d3055fd8739c125b70bcb9562c27f
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2020-06-01 08:38:20 +02:00

50 lines
1.2 KiB
C

/*
* Copyright (c) 2018-2019, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef STM32MP_RESET_H
#define STM32MP_RESET_H
#include <stdint.h>
/*
* Assert target reset, if @to_us non null, wait until reset is asserted
*
* @reset_id: Reset controller ID
* @to_us: Timeout in microsecond, or 0 if not waiting
* Return 0 on success and -ETIMEDOUT if waiting and timeout expired
*/
int stm32mp_reset_assert(uint32_t reset_id, unsigned int to_us);
/*
* Enable reset control for target resource
*
* @reset_id: Reset controller ID
*/
static inline void stm32mp_reset_set(uint32_t reset_id)
{
(void)stm32mp_reset_assert(reset_id, 0U);
}
/*
* Deassert target reset, if @to_us non null, wait until reset is deasserted
*
* @reset_id: Reset controller ID
* @to_us: Timeout in microsecond, or 0 if not waiting
* Return 0 on success and -ETIMEDOUT if waiting and timeout expired
*/
int stm32mp_reset_deassert(uint32_t reset_id, unsigned int to_us);
/*
* Release reset control for target resource
*
* @reset_id: Reset controller ID
*/
static inline void stm32mp_reset_release(uint32_t reset_id)
{
(void)stm32mp_reset_deassert(reset_id, 0U);
}
#endif /* STM32MP_RESET_H */