xref: /linux/drivers/clk/uniphier/clk-uniphier-peri.c (revision e5c86679d5e864947a52fb31e45a425dea3e7fa9)
1 /*
2  * Copyright (C) 2016 Socionext Inc.
3  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
15 
16 #include "clk-uniphier.h"
17 
18 #define UNIPHIER_PERI_CLK_UART(idx, ch)					\
19 	UNIPHIER_CLK_GATE("uart" #ch, (idx), "uart", 0x24, 19 + (ch))
20 
21 #define UNIPHIER_PERI_CLK_I2C_COMMON					\
22 	UNIPHIER_CLK_GATE("i2c-common", -1, "i2c", 0x20, 1)
23 
24 #define UNIPHIER_PERI_CLK_I2C(idx, ch)					\
25 	UNIPHIER_CLK_GATE("i2c" #ch, (idx), "i2c-common", 0x24, 5 + (ch))
26 
27 #define UNIPHIER_PERI_CLK_FI2C(idx, ch)					\
28 	UNIPHIER_CLK_GATE("i2c" #ch, (idx), "i2c", 0x24, 24 + (ch))
29 
30 const struct uniphier_clk_data uniphier_ld4_peri_clk_data[] = {
31 	UNIPHIER_PERI_CLK_UART(0, 0),
32 	UNIPHIER_PERI_CLK_UART(1, 1),
33 	UNIPHIER_PERI_CLK_UART(2, 2),
34 	UNIPHIER_PERI_CLK_UART(3, 3),
35 	UNIPHIER_PERI_CLK_I2C_COMMON,
36 	UNIPHIER_PERI_CLK_I2C(4, 0),
37 	UNIPHIER_PERI_CLK_I2C(5, 1),
38 	UNIPHIER_PERI_CLK_I2C(6, 2),
39 	UNIPHIER_PERI_CLK_I2C(7, 3),
40 	UNIPHIER_PERI_CLK_I2C(8, 4),
41 	{ /* sentinel */ }
42 };
43 
44 const struct uniphier_clk_data uniphier_pro4_peri_clk_data[] = {
45 	UNIPHIER_PERI_CLK_UART(0, 0),
46 	UNIPHIER_PERI_CLK_UART(1, 1),
47 	UNIPHIER_PERI_CLK_UART(2, 2),
48 	UNIPHIER_PERI_CLK_UART(3, 3),
49 	UNIPHIER_PERI_CLK_FI2C(4, 0),
50 	UNIPHIER_PERI_CLK_FI2C(5, 1),
51 	UNIPHIER_PERI_CLK_FI2C(6, 2),
52 	UNIPHIER_PERI_CLK_FI2C(7, 3),
53 	UNIPHIER_PERI_CLK_FI2C(8, 4),
54 	UNIPHIER_PERI_CLK_FI2C(9, 5),
55 	UNIPHIER_PERI_CLK_FI2C(10, 6),
56 	{ /* sentinel */ }
57 };
58