stm32mp1_clk.h 718 Bytes
Newer Older
1
2
3
4
5
6
/*
 * Copyright (c) 2018, STMicroelectronics - All Rights Reserved
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

7
8
#ifndef STM32MP1_CLK_H
#define STM32MP1_CLK_H
9
10
11

#include <stdbool.h>

12
13
#include <arch_helpers.h>

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
int stm32mp1_clk_probe(void);
int stm32mp1_clk_init(void);
bool stm32mp1_clk_is_enabled(unsigned long id);
int stm32mp1_clk_enable(unsigned long id);
int stm32mp1_clk_disable(unsigned long id);
unsigned long stm32mp1_clk_get_rate(unsigned long id);
void stm32mp1_stgen_increment(unsigned long long offset_in_ms);

static inline uint32_t get_timer(uint32_t base)
{
	if (base == 0U) {
		return (uint32_t)(~read_cntpct_el0());
	}

	return base - (uint32_t)(~read_cntpct_el0());
}

31
#endif /* STM32MP1_CLK_H */