1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2019-20 Sean Anderson <seanga2@gmail.com>
4  */
5 
6 #ifndef K210_CLK_H
7 #define K210_CLK_H
8 
9 #define LOG_CATEGORY UCLASS_CLK
10 #include <linux/types.h>
11 #include <linux/clk-provider.h>
12 
k210_clk_gate(const char * name,const char * parent_name,void __iomem * reg,u8 bit_idx)13 static inline struct clk *k210_clk_gate(const char *name,
14 					const char *parent_name,
15 					void __iomem *reg, u8 bit_idx)
16 {
17 	return clk_register_gate(NULL, name, parent_name, 0, reg, bit_idx, 0,
18 				 NULL);
19 }
20 
k210_clk_half(const char * name,const char * parent_name)21 static inline struct clk *k210_clk_half(const char *name,
22 					const char *parent_name)
23 {
24 	return clk_register_fixed_factor(NULL, name, parent_name, 0, 1, 2);
25 }
26 
k210_clk_div(const char * name,const char * parent_name,void __iomem * reg,u8 shift,u8 width)27 static inline struct clk *k210_clk_div(const char *name,
28 				       const char *parent_name,
29 				       void __iomem *reg, u8 shift, u8 width)
30 {
31 	return clk_register_divider(NULL, name, parent_name, 0, reg, shift,
32 				    width, 0);
33 }
34 
35 #endif /* K210_CLK_H */
36