2018-07-24 16:13:36 +01:00
|
|
|
/*
|
2019-02-14 10:13:39 +00:00
|
|
|
* Copyright (c) 2018-2019, STMicroelectronics - All Rights Reserved
|
2018-07-24 16:13:36 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*/
|
|
|
|
|
2018-11-08 10:20:19 +00:00
|
|
|
#ifndef STM32MP1_CLK_H
|
|
|
|
#define STM32MP1_CLK_H
|
2018-07-24 16:13:36 +01:00
|
|
|
|
2018-12-14 00:18:21 +00:00
|
|
|
#include <arch_helpers.h>
|
|
|
|
|
2018-07-24 16:13:36 +01:00
|
|
|
int stm32mp1_clk_probe(void);
|
|
|
|
int stm32mp1_clk_init(void);
|
2019-02-14 09:53:33 +00:00
|
|
|
|
|
|
|
bool stm32mp1_rcc_is_secure(void);
|
2019-02-15 16:33:27 +00:00
|
|
|
bool stm32mp1_rcc_is_mckprot(void);
|
2019-02-14 09:53:33 +00:00
|
|
|
|
|
|
|
void __stm32mp1_clk_enable(unsigned long id, bool caller_is_secure);
|
|
|
|
void __stm32mp1_clk_disable(unsigned long id, bool caller_is_secure);
|
|
|
|
|
|
|
|
static inline void stm32mp1_clk_enable_non_secure(unsigned long id)
|
|
|
|
{
|
|
|
|
__stm32mp1_clk_enable(id, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void stm32mp1_clk_enable_secure(unsigned long id)
|
|
|
|
{
|
|
|
|
__stm32mp1_clk_enable(id, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void stm32mp1_clk_disable_non_secure(unsigned long id)
|
|
|
|
{
|
|
|
|
__stm32mp1_clk_disable(id, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void stm32mp1_clk_disable_secure(unsigned long id)
|
|
|
|
{
|
|
|
|
__stm32mp1_clk_disable(id, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int stm32mp1_clk_get_refcount(unsigned long id);
|
|
|
|
|
|
|
|
/* SMP protection on RCC registers access */
|
|
|
|
void stm32mp1_clk_rcc_regs_lock(void);
|
|
|
|
void stm32mp1_clk_rcc_regs_unlock(void);
|
|
|
|
|
2018-07-24 16:13:36 +01:00
|
|
|
void stm32mp1_stgen_increment(unsigned long long offset_in_ms);
|
|
|
|
|
2018-11-08 10:20:19 +00:00
|
|
|
#endif /* STM32MP1_CLK_H */
|