blob: 1e0d949ac5144003d04a40687edcd1c97d7895ea [file] [log] [blame]
Yann Gautier9aea69e2018-07-24 17:13:36 +02001/*
Yann Gautiera2e2a302019-02-14 11:13:39 +01002 * Copyright (c) 2018-2019, STMicroelectronics - All Rights Reserved
Yann Gautier9aea69e2018-07-24 17:13:36 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef STM32MP1_CLK_H
8#define STM32MP1_CLK_H
Yann Gautier9aea69e2018-07-24 17:13:36 +02009
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <arch_helpers.h>
11
Yann Gautier9aea69e2018-07-24 17:13:36 +020012int stm32mp1_clk_probe(void);
13int stm32mp1_clk_init(void);
Yann Gautiere4a3c352019-02-14 10:53:33 +010014
15bool stm32mp1_rcc_is_secure(void);
16
17void __stm32mp1_clk_enable(unsigned long id, bool caller_is_secure);
18void __stm32mp1_clk_disable(unsigned long id, bool caller_is_secure);
19
20static inline void stm32mp1_clk_enable_non_secure(unsigned long id)
21{
22 __stm32mp1_clk_enable(id, false);
23}
24
25static inline void stm32mp1_clk_enable_secure(unsigned long id)
26{
27 __stm32mp1_clk_enable(id, true);
28}
29
30static inline void stm32mp1_clk_disable_non_secure(unsigned long id)
31{
32 __stm32mp1_clk_disable(id, false);
33}
34
35static inline void stm32mp1_clk_disable_secure(unsigned long id)
36{
37 __stm32mp1_clk_disable(id, true);
38}
39
40unsigned int stm32mp1_clk_get_refcount(unsigned long id);
41
42/* SMP protection on RCC registers access */
43void stm32mp1_clk_rcc_regs_lock(void);
44void stm32mp1_clk_rcc_regs_unlock(void);
45
Yann Gautier9aea69e2018-07-24 17:13:36 +020046void stm32mp1_stgen_increment(unsigned long long offset_in_ms);
47
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000048#endif /* STM32MP1_CLK_H */