xref: /rk3399_ARM-atf/include/drivers/clk.h (revision 847c6bc8e6d55b1c0f31a52407aa61515cd6c612)
1*847c6bc8SGabriel Fernandez /*
2*847c6bc8SGabriel Fernandez  * Copyright (c) 2021, STMicroelectronics - All Rights Reserved
3*847c6bc8SGabriel Fernandez  *
4*847c6bc8SGabriel Fernandez  * SPDX-License-Identifier: BSD-3-Clause
5*847c6bc8SGabriel Fernandez  */
6*847c6bc8SGabriel Fernandez 
7*847c6bc8SGabriel Fernandez #ifndef CLK_H
8*847c6bc8SGabriel Fernandez #define CLK_H
9*847c6bc8SGabriel Fernandez 
10*847c6bc8SGabriel Fernandez #include <stdbool.h>
11*847c6bc8SGabriel Fernandez 
12*847c6bc8SGabriel Fernandez struct clk_ops {
13*847c6bc8SGabriel Fernandez 	int (*enable)(unsigned long id);
14*847c6bc8SGabriel Fernandez 	void (*disable)(unsigned long id);
15*847c6bc8SGabriel Fernandez 	unsigned long (*get_rate)(unsigned long id);
16*847c6bc8SGabriel Fernandez 	int (*get_parent)(unsigned long id);
17*847c6bc8SGabriel Fernandez 	bool (*is_enabled)(unsigned long id);
18*847c6bc8SGabriel Fernandez };
19*847c6bc8SGabriel Fernandez 
20*847c6bc8SGabriel Fernandez int clk_enable(unsigned long id);
21*847c6bc8SGabriel Fernandez void clk_disable(unsigned long id);
22*847c6bc8SGabriel Fernandez unsigned long clk_get_rate(unsigned long id);
23*847c6bc8SGabriel Fernandez bool clk_is_enabled(unsigned long id);
24*847c6bc8SGabriel Fernandez int clk_get_parent(unsigned long id);
25*847c6bc8SGabriel Fernandez 
26*847c6bc8SGabriel Fernandez void clk_register(const struct clk_ops *ops);
27*847c6bc8SGabriel Fernandez 
28*847c6bc8SGabriel Fernandez #endif /* CLK_H */
29