blob: 7afa5ad84528309d98bd71c9ded6bb71ab28e898 [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);
Yann Gautiered342322019-02-15 17:33:27 +010016bool stm32mp1_rcc_is_mckprot(void);
Yann Gautiere4a3c352019-02-14 10:53:33 +010017
18void __stm32mp1_clk_enable(unsigned long id, bool caller_is_secure);
19void __stm32mp1_clk_disable(unsigned long id, bool caller_is_secure);
20
21static inline void stm32mp1_clk_enable_non_secure(unsigned long id)
22{
23 __stm32mp1_clk_enable(id, false);
24}
25
26static inline void stm32mp1_clk_enable_secure(unsigned long id)
27{
28 __stm32mp1_clk_enable(id, true);
29}
30
31static inline void stm32mp1_clk_disable_non_secure(unsigned long id)
32{
33 __stm32mp1_clk_disable(id, false);
34}
35
36static inline void stm32mp1_clk_disable_secure(unsigned long id)
37{
38 __stm32mp1_clk_disable(id, true);
39}
40
41unsigned int stm32mp1_clk_get_refcount(unsigned long id);
42
43/* SMP protection on RCC registers access */
44void stm32mp1_clk_rcc_regs_lock(void);
45void stm32mp1_clk_rcc_regs_unlock(void);
46
Yann Gautier9aea69e2018-07-24 17:13:36 +020047void stm32mp1_stgen_increment(unsigned long long offset_in_ms);
48
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000049#endif /* STM32MP1_CLK_H */