1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2016 Socionext Inc.
4  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5  */
6 
7 #include "clk-uniphier.h"
8 
9 #define UNIPHIER_PERI_CLK_UART(idx, ch)					\
10 	UNIPHIER_CLK_GATE("uart" #ch, (idx), "uart", 0x24, 19 + (ch))
11 
12 #define UNIPHIER_PERI_CLK_I2C_COMMON					\
13 	UNIPHIER_CLK_GATE("i2c-common", -1, "i2c", 0x20, 1)
14 
15 #define UNIPHIER_PERI_CLK_I2C(idx, ch)					\
16 	UNIPHIER_CLK_GATE("i2c" #ch, (idx), "i2c-common", 0x24, 5 + (ch))
17 
18 #define UNIPHIER_PERI_CLK_FI2C(idx, ch)					\
19 	UNIPHIER_CLK_GATE("i2c" #ch, (idx), "i2c", 0x24, 24 + (ch))
20 
21 #define UNIPHIER_PERI_CLK_SCSSI(idx, ch)				\
22 	UNIPHIER_CLK_GATE("scssi" #ch, (idx), "spi", 0x20, 17 + (ch))
23 
24 #define UNIPHIER_PERI_CLK_MCSSI(idx)					\
25 	UNIPHIER_CLK_GATE("mcssi", (idx), "spi", 0x24, 14)
26 
27 const struct uniphier_clk_data uniphier_ld4_peri_clk_data[] = {
28 	UNIPHIER_PERI_CLK_UART(0, 0),
29 	UNIPHIER_PERI_CLK_UART(1, 1),
30 	UNIPHIER_PERI_CLK_UART(2, 2),
31 	UNIPHIER_PERI_CLK_UART(3, 3),
32 	UNIPHIER_PERI_CLK_I2C_COMMON,
33 	UNIPHIER_PERI_CLK_I2C(4, 0),
34 	UNIPHIER_PERI_CLK_I2C(5, 1),
35 	UNIPHIER_PERI_CLK_I2C(6, 2),
36 	UNIPHIER_PERI_CLK_I2C(7, 3),
37 	UNIPHIER_PERI_CLK_I2C(8, 4),
38 	UNIPHIER_PERI_CLK_SCSSI(11, 0),
39 	{ /* sentinel */ }
40 };
41 
42 const struct uniphier_clk_data uniphier_pro4_peri_clk_data[] = {
43 	UNIPHIER_PERI_CLK_UART(0, 0),
44 	UNIPHIER_PERI_CLK_UART(1, 1),
45 	UNIPHIER_PERI_CLK_UART(2, 2),
46 	UNIPHIER_PERI_CLK_UART(3, 3),
47 	UNIPHIER_PERI_CLK_FI2C(4, 0),
48 	UNIPHIER_PERI_CLK_FI2C(5, 1),
49 	UNIPHIER_PERI_CLK_FI2C(6, 2),
50 	UNIPHIER_PERI_CLK_FI2C(7, 3),
51 	UNIPHIER_PERI_CLK_FI2C(8, 4),
52 	UNIPHIER_PERI_CLK_FI2C(9, 5),
53 	UNIPHIER_PERI_CLK_FI2C(10, 6),
54 	UNIPHIER_PERI_CLK_SCSSI(11, 0),
55 	UNIPHIER_PERI_CLK_SCSSI(12, 1),
56 	UNIPHIER_PERI_CLK_SCSSI(13, 2),
57 	UNIPHIER_PERI_CLK_SCSSI(14, 3),
58 	UNIPHIER_PERI_CLK_MCSSI(15),
59 	{ /* sentinel */ }
60 };
61