1 /*
2  * Copyright (C) 2016 Socionext Inc.
3  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #ifndef __CLK_UNIPHIER_H__
9 #define __CLK_UNIPHIER_H__
10 
11 #include <linux/kernel.h>
12 
13 #define UNIPHIER_CLK_MAX_NR_MUXS	8
14 
15 struct uniphier_clk_gate_data {
16 	unsigned int id;
17 	unsigned int reg;
18 	unsigned int bit;
19 };
20 
21 struct uniphier_clk_mux_data {
22 	unsigned int id;
23 	unsigned int nr_muxs;
24 	unsigned int reg;
25 	unsigned int masks[UNIPHIER_CLK_MAX_NR_MUXS];
26 	unsigned int vals[UNIPHIER_CLK_MAX_NR_MUXS];
27 	unsigned long rates[UNIPHIER_CLK_MAX_NR_MUXS];
28 };
29 
30 struct uniphier_clk_data {
31 	const struct uniphier_clk_gate_data *gate;
32 	const struct uniphier_clk_mux_data *mux;
33 };
34 
35 #define UNIPHIER_CLK_ID_END		(unsigned int)(-1)
36 
37 #define UNIPHIER_CLK_END				\
38 	{ .id = UNIPHIER_CLK_ID_END }
39 
40 #define UNIPHIER_CLK_GATE(_id, _reg, _bit)		\
41 	{						\
42 		.id = (_id),				\
43 		.reg = (_reg),				\
44 		.bit = (_bit),				\
45 	}
46 
47 #define UNIPHIER_CLK_FIXED_RATE(_id, _rate)		\
48 	{						\
49 		.id = (_id),				\
50 		.rates = {(_reg),},			\
51 	}
52 
53 extern const struct uniphier_clk_data uniphier_pxs2_sys_clk_data;
54 extern const struct uniphier_clk_data uniphier_ld20_sys_clk_data;
55 extern const struct uniphier_clk_data uniphier_mio_clk_data;
56 
57 #endif /* __CLK_UNIPHIER_H__ */
58