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 #define UNIPHIER_PERI_CLK_SCSSI(idx)					\
31 	UNIPHIER_CLK_GATE("scssi", (idx), "spi", 0x20, 17)
32 
33 #define UNIPHIER_PERI_CLK_MCSSI(idx)					\
34 	UNIPHIER_CLK_GATE("mcssi", (idx), "spi", 0x24, 14)
35 
36 const struct uniphier_clk_data uniphier_ld4_peri_clk_data[] = {
37 	UNIPHIER_PERI_CLK_UART(0, 0),
38 	UNIPHIER_PERI_CLK_UART(1, 1),
39 	UNIPHIER_PERI_CLK_UART(2, 2),
40 	UNIPHIER_PERI_CLK_UART(3, 3),
41 	UNIPHIER_PERI_CLK_I2C_COMMON,
42 	UNIPHIER_PERI_CLK_I2C(4, 0),
43 	UNIPHIER_PERI_CLK_I2C(5, 1),
44 	UNIPHIER_PERI_CLK_I2C(6, 2),
45 	UNIPHIER_PERI_CLK_I2C(7, 3),
46 	UNIPHIER_PERI_CLK_I2C(8, 4),
47 	UNIPHIER_PERI_CLK_SCSSI(11),
48 	{ /* sentinel */ }
49 };
50 
51 const struct uniphier_clk_data uniphier_pro4_peri_clk_data[] = {
52 	UNIPHIER_PERI_CLK_UART(0, 0),
53 	UNIPHIER_PERI_CLK_UART(1, 1),
54 	UNIPHIER_PERI_CLK_UART(2, 2),
55 	UNIPHIER_PERI_CLK_UART(3, 3),
56 	UNIPHIER_PERI_CLK_FI2C(4, 0),
57 	UNIPHIER_PERI_CLK_FI2C(5, 1),
58 	UNIPHIER_PERI_CLK_FI2C(6, 2),
59 	UNIPHIER_PERI_CLK_FI2C(7, 3),
60 	UNIPHIER_PERI_CLK_FI2C(8, 4),
61 	UNIPHIER_PERI_CLK_FI2C(9, 5),
62 	UNIPHIER_PERI_CLK_FI2C(10, 6),
63 	UNIPHIER_PERI_CLK_SCSSI(11),
64 	UNIPHIER_PERI_CLK_MCSSI(12),
65 	{ /* sentinel */ }
66 };
67