xref: /openbmc/linux/drivers/clk/samsung/clk-exynos7885.c (revision fac59652993f075d57860769c99045b3ca18780d)
145bd8166SDavid Virag // SPDX-License-Identifier: GPL-2.0-only
245bd8166SDavid Virag /*
345bd8166SDavid Virag  * Copyright (C) 2021 Dávid Virág <virag.david003@gmail.com>
445bd8166SDavid Virag  * Author: Dávid Virág <virag.david003@gmail.com>
545bd8166SDavid Virag  *
645bd8166SDavid Virag  * Common Clock Framework support for Exynos7885 SoC.
745bd8166SDavid Virag  */
845bd8166SDavid Virag 
945bd8166SDavid Virag #include <linux/clk.h>
1045bd8166SDavid Virag #include <linux/clk-provider.h>
1145bd8166SDavid Virag #include <linux/of.h>
1245bd8166SDavid Virag #include <linux/platform_device.h>
1345bd8166SDavid Virag 
1445bd8166SDavid Virag #include <dt-bindings/clock/exynos7885.h>
1545bd8166SDavid Virag 
1645bd8166SDavid Virag #include "clk.h"
1745bd8166SDavid Virag #include "clk-exynos-arm64.h"
1845bd8166SDavid Virag 
19ef4923c8SKrzysztof Kozlowski /* NOTE: Must be equal to the last clock ID increased by one */
20ef4923c8SKrzysztof Kozlowski #define CLKS_NR_TOP			(CLK_GOUT_FSYS_USB30DRD + 1)
21ef4923c8SKrzysztof Kozlowski #define CLKS_NR_CORE			(CLK_GOUT_TREX_P_CORE_PCLK_P_CORE + 1)
22ef4923c8SKrzysztof Kozlowski #define CLKS_NR_PERI			(CLK_GOUT_WDT1_PCLK + 1)
23*7e217706SDavid Virag #define CLKS_NR_FSYS			(CLK_MOUT_FSYS_USB30DRD_USER + 1)
24ef4923c8SKrzysztof Kozlowski 
2545bd8166SDavid Virag /* ---- CMU_TOP ------------------------------------------------------------- */
2645bd8166SDavid Virag 
2745bd8166SDavid Virag /* Register Offset definitions for CMU_TOP (0x12060000) */
2845bd8166SDavid Virag #define PLL_LOCKTIME_PLL_SHARED0		0x0000
2945bd8166SDavid Virag #define PLL_LOCKTIME_PLL_SHARED1		0x0004
3045bd8166SDavid Virag #define PLL_CON0_PLL_SHARED0			0x0100
3145bd8166SDavid Virag #define PLL_CON0_PLL_SHARED1			0x0120
3245bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_CORE_BUS		0x1014
3345bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_CORE_CCI		0x1018
3445bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_CORE_G3D		0x101c
35f392db97SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_FSYS_BUS		0x1028
36f392db97SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_FSYS_MMC_CARD	0x102c
37f392db97SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_FSYS_MMC_EMBD	0x1030
38f392db97SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_FSYS_MMC_SDIO	0x1034
39f392db97SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_FSYS_USB30DRD	0x1038
4045bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_PERI_BUS		0x1058
4145bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_PERI_SPI0	0x105c
4245bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_PERI_SPI1	0x1060
4345bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_PERI_UART0	0x1064
4445bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_PERI_UART1	0x1068
4545bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_PERI_UART2	0x106c
4645bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_PERI_USI0	0x1070
4745bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_PERI_USI1	0x1074
4845bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLKCMU_PERI_USI2	0x1078
4945bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_CORE_BUS		0x181c
5045bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_CORE_CCI		0x1820
5145bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_CORE_G3D		0x1824
52f392db97SDavid Virag #define CLK_CON_DIV_CLKCMU_FSYS_BUS		0x1844
53f392db97SDavid Virag #define CLK_CON_DIV_CLKCMU_FSYS_MMC_CARD	0x1848
54f392db97SDavid Virag #define CLK_CON_DIV_CLKCMU_FSYS_MMC_EMBD	0x184c
55f392db97SDavid Virag #define CLK_CON_DIV_CLKCMU_FSYS_MMC_SDIO	0x1850
56f392db97SDavid Virag #define CLK_CON_DIV_CLKCMU_FSYS_USB30DRD	0x1854
5745bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_PERI_BUS		0x1874
5845bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_PERI_SPI0		0x1878
5945bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_PERI_SPI1		0x187c
6045bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_PERI_UART0		0x1880
6145bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_PERI_UART1		0x1884
6245bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_PERI_UART2		0x1888
6345bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_PERI_USI0		0x188c
6445bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_PERI_USI1		0x1890
6545bd8166SDavid Virag #define CLK_CON_DIV_CLKCMU_PERI_USI2		0x1894
6645bd8166SDavid Virag #define CLK_CON_DIV_PLL_SHARED0_DIV2		0x189c
6745bd8166SDavid Virag #define CLK_CON_DIV_PLL_SHARED0_DIV3		0x18a0
6845bd8166SDavid Virag #define CLK_CON_DIV_PLL_SHARED0_DIV4		0x18a4
6945bd8166SDavid Virag #define CLK_CON_DIV_PLL_SHARED0_DIV5		0x18a8
7045bd8166SDavid Virag #define CLK_CON_DIV_PLL_SHARED1_DIV2		0x18ac
7145bd8166SDavid Virag #define CLK_CON_DIV_PLL_SHARED1_DIV3		0x18b0
7245bd8166SDavid Virag #define CLK_CON_DIV_PLL_SHARED1_DIV4		0x18b4
7345bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMUC_PERI_UART1	0x2004
7445bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_CORE_BUS	0x201c
7545bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_CORE_CCI	0x2020
7645bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_CORE_G3D	0x2024
77f392db97SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_FSYS_BUS	0x2044
78f392db97SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_FSYS_MMC_CARD	0x2048
79f392db97SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_FSYS_MMC_EMBD	0x204c
80f392db97SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_FSYS_MMC_SDIO	0x2050
81f392db97SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_FSYS_USB30DRD	0x2054
8245bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_PERI_BUS	0x207c
8345bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_PERI_SPI0	0x2080
8445bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_PERI_SPI1	0x2084
8545bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_PERI_UART0	0x2088
8645bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_PERI_UART2	0x208c
8745bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_PERI_USI0	0x2090
8845bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_PERI_USI1	0x2094
8945bd8166SDavid Virag #define CLK_CON_GAT_GATE_CLKCMU_PERI_USI2	0x2098
9045bd8166SDavid Virag 
9145bd8166SDavid Virag static const unsigned long top_clk_regs[] __initconst = {
9245bd8166SDavid Virag 	PLL_LOCKTIME_PLL_SHARED0,
9345bd8166SDavid Virag 	PLL_LOCKTIME_PLL_SHARED1,
9445bd8166SDavid Virag 	PLL_CON0_PLL_SHARED0,
9545bd8166SDavid Virag 	PLL_CON0_PLL_SHARED1,
9645bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_CORE_BUS,
9745bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_CORE_CCI,
9845bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_CORE_G3D,
99f392db97SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_FSYS_BUS,
100f392db97SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_FSYS_MMC_CARD,
101f392db97SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_FSYS_MMC_EMBD,
102f392db97SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_FSYS_MMC_SDIO,
103f392db97SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_FSYS_USB30DRD,
10445bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_PERI_BUS,
10545bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_PERI_SPI0,
10645bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_PERI_SPI1,
10745bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_PERI_UART0,
10845bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_PERI_UART1,
10945bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_PERI_UART2,
11045bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_PERI_USI0,
11145bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_PERI_USI1,
11245bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLKCMU_PERI_USI2,
11345bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_CORE_BUS,
11445bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_CORE_CCI,
11545bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_CORE_G3D,
116f392db97SDavid Virag 	CLK_CON_DIV_CLKCMU_FSYS_BUS,
117f392db97SDavid Virag 	CLK_CON_DIV_CLKCMU_FSYS_MMC_CARD,
118f392db97SDavid Virag 	CLK_CON_DIV_CLKCMU_FSYS_MMC_EMBD,
119f392db97SDavid Virag 	CLK_CON_DIV_CLKCMU_FSYS_MMC_SDIO,
120f392db97SDavid Virag 	CLK_CON_DIV_CLKCMU_FSYS_USB30DRD,
12145bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_PERI_BUS,
12245bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_PERI_SPI0,
12345bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_PERI_SPI1,
12445bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_PERI_UART0,
12545bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_PERI_UART1,
12645bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_PERI_UART2,
12745bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_PERI_USI0,
12845bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_PERI_USI1,
12945bd8166SDavid Virag 	CLK_CON_DIV_CLKCMU_PERI_USI2,
13045bd8166SDavid Virag 	CLK_CON_DIV_PLL_SHARED0_DIV2,
13145bd8166SDavid Virag 	CLK_CON_DIV_PLL_SHARED0_DIV3,
13245bd8166SDavid Virag 	CLK_CON_DIV_PLL_SHARED0_DIV4,
13345bd8166SDavid Virag 	CLK_CON_DIV_PLL_SHARED0_DIV5,
13445bd8166SDavid Virag 	CLK_CON_DIV_PLL_SHARED1_DIV2,
13545bd8166SDavid Virag 	CLK_CON_DIV_PLL_SHARED1_DIV3,
13645bd8166SDavid Virag 	CLK_CON_DIV_PLL_SHARED1_DIV4,
13745bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMUC_PERI_UART1,
13845bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_CORE_BUS,
13945bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_CORE_CCI,
14045bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_CORE_G3D,
141f392db97SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_FSYS_BUS,
142f392db97SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_FSYS_MMC_CARD,
143f392db97SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_FSYS_MMC_EMBD,
144f392db97SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_FSYS_MMC_SDIO,
145f392db97SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_FSYS_USB30DRD,
14645bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_PERI_BUS,
14745bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_PERI_SPI0,
14845bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_PERI_SPI1,
14945bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_PERI_UART0,
15045bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_PERI_UART2,
15145bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_PERI_USI0,
15245bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_PERI_USI1,
15345bd8166SDavid Virag 	CLK_CON_GAT_GATE_CLKCMU_PERI_USI2,
15445bd8166SDavid Virag };
15545bd8166SDavid Virag 
15645bd8166SDavid Virag static const struct samsung_pll_clock top_pll_clks[] __initconst = {
15745bd8166SDavid Virag 	PLL(pll_1417x, CLK_FOUT_SHARED0_PLL, "fout_shared0_pll", "oscclk",
15845bd8166SDavid Virag 	    PLL_LOCKTIME_PLL_SHARED0, PLL_CON0_PLL_SHARED0,
15945bd8166SDavid Virag 	    NULL),
16045bd8166SDavid Virag 	PLL(pll_1417x, CLK_FOUT_SHARED1_PLL, "fout_shared1_pll", "oscclk",
16145bd8166SDavid Virag 	    PLL_LOCKTIME_PLL_SHARED1, PLL_CON0_PLL_SHARED1,
16245bd8166SDavid Virag 	    NULL),
16345bd8166SDavid Virag };
16445bd8166SDavid Virag 
16545bd8166SDavid Virag /* List of parent clocks for Muxes in CMU_TOP: for CMU_CORE */
16645bd8166SDavid Virag PNAME(mout_core_bus_p)		= { "dout_shared0_div2", "dout_shared1_div2",
16745bd8166SDavid Virag 				    "dout_shared0_div3", "dout_shared0_div3" };
16845bd8166SDavid Virag PNAME(mout_core_cci_p)		= { "dout_shared0_div2", "dout_shared1_div2",
16945bd8166SDavid Virag 				    "dout_shared0_div3", "dout_shared0_div3" };
17045bd8166SDavid Virag PNAME(mout_core_g3d_p)		= { "dout_shared0_div2", "dout_shared1_div2",
17145bd8166SDavid Virag 				    "dout_shared0_div3", "dout_shared0_div3" };
17245bd8166SDavid Virag 
17345bd8166SDavid Virag /* List of parent clocks for Muxes in CMU_TOP: for CMU_PERI */
17445bd8166SDavid Virag PNAME(mout_peri_bus_p)		= { "dout_shared0_div4", "dout_shared1_div4" };
17545bd8166SDavid Virag PNAME(mout_peri_spi0_p)		= { "oscclk", "dout_shared0_div4" };
17645bd8166SDavid Virag PNAME(mout_peri_spi1_p)		= { "oscclk", "dout_shared0_div4" };
17745bd8166SDavid Virag PNAME(mout_peri_uart0_p)	= { "oscclk", "dout_shared0_div4" };
17845bd8166SDavid Virag PNAME(mout_peri_uart1_p)	= { "oscclk", "dout_shared0_div4" };
17945bd8166SDavid Virag PNAME(mout_peri_uart2_p)	= { "oscclk", "dout_shared0_div4" };
18045bd8166SDavid Virag PNAME(mout_peri_usi0_p)		= { "oscclk", "dout_shared0_div4" };
18145bd8166SDavid Virag PNAME(mout_peri_usi1_p)		= { "oscclk", "dout_shared0_div4" };
18245bd8166SDavid Virag PNAME(mout_peri_usi2_p)		= { "oscclk", "dout_shared0_div4" };
18345bd8166SDavid Virag 
184f392db97SDavid Virag /* List of parent clocks for Muxes in CMU_TOP: for CMU_FSYS */
185f392db97SDavid Virag PNAME(mout_fsys_bus_p)		= { "dout_shared0_div2", "dout_shared1_div2" };
186f392db97SDavid Virag PNAME(mout_fsys_mmc_card_p)	= { "dout_shared0_div2", "dout_shared1_div2" };
187f392db97SDavid Virag PNAME(mout_fsys_mmc_embd_p)	= { "dout_shared0_div2", "dout_shared1_div2" };
188f392db97SDavid Virag PNAME(mout_fsys_mmc_sdio_p)	= { "dout_shared0_div2", "dout_shared1_div2" };
189f392db97SDavid Virag PNAME(mout_fsys_usb30drd_p)	= { "dout_shared0_div4", "dout_shared1_div4" };
190f392db97SDavid Virag 
19145bd8166SDavid Virag static const struct samsung_mux_clock top_mux_clks[] __initconst = {
19245bd8166SDavid Virag 	/* CORE */
19345bd8166SDavid Virag 	MUX(CLK_MOUT_CORE_BUS, "mout_core_bus", mout_core_bus_p,
19445bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_CORE_BUS, 0, 2),
19545bd8166SDavid Virag 	MUX(CLK_MOUT_CORE_CCI, "mout_core_cci", mout_core_cci_p,
19645bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_CORE_CCI, 0, 2),
19745bd8166SDavid Virag 	MUX(CLK_MOUT_CORE_G3D, "mout_core_g3d", mout_core_g3d_p,
19845bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_CORE_G3D, 0, 2),
19945bd8166SDavid Virag 
20045bd8166SDavid Virag 	/* PERI */
20145bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_BUS, "mout_peri_bus", mout_peri_bus_p,
20245bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_PERI_BUS, 0, 1),
20345bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_SPI0, "mout_peri_spi0", mout_peri_spi0_p,
20445bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_PERI_SPI0, 0, 1),
20545bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_SPI1, "mout_peri_spi1", mout_peri_spi1_p,
20645bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_PERI_SPI1, 0, 1),
20745bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_UART0, "mout_peri_uart0", mout_peri_uart0_p,
20845bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_PERI_UART0, 0, 1),
20945bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_UART1, "mout_peri_uart1", mout_peri_uart1_p,
21045bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_PERI_UART1, 0, 1),
21145bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_UART2, "mout_peri_uart2", mout_peri_uart2_p,
21245bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_PERI_UART2, 0, 1),
21345bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_USI0, "mout_peri_usi0", mout_peri_usi0_p,
21445bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_PERI_USI0, 0, 1),
21545bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_USI1, "mout_peri_usi1", mout_peri_usi1_p,
21645bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_PERI_USI1, 0, 1),
21745bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_USI2, "mout_peri_usi2", mout_peri_usi2_p,
21845bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_PERI_USI2, 0, 1),
219f392db97SDavid Virag 
220f392db97SDavid Virag 	/* FSYS */
221f392db97SDavid Virag 	MUX(CLK_MOUT_FSYS_BUS, "mout_fsys_bus", mout_fsys_bus_p,
222f392db97SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_FSYS_BUS, 0, 1),
223f392db97SDavid Virag 	MUX(CLK_MOUT_FSYS_MMC_CARD, "mout_fsys_mmc_card", mout_fsys_mmc_card_p,
224f392db97SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_FSYS_MMC_CARD, 0, 1),
225f392db97SDavid Virag 	MUX(CLK_MOUT_FSYS_MMC_EMBD, "mout_fsys_mmc_embd", mout_fsys_mmc_embd_p,
226f392db97SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_FSYS_MMC_EMBD, 0, 1),
227f392db97SDavid Virag 	MUX(CLK_MOUT_FSYS_MMC_SDIO, "mout_fsys_mmc_sdio", mout_fsys_mmc_sdio_p,
228f392db97SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_FSYS_MMC_SDIO, 0, 1),
229f392db97SDavid Virag 	MUX(CLK_MOUT_FSYS_USB30DRD, "mout_fsys_usb30drd", mout_fsys_usb30drd_p,
230f392db97SDavid Virag 	    CLK_CON_MUX_MUX_CLKCMU_FSYS_USB30DRD, 0, 1),
23145bd8166SDavid Virag };
23245bd8166SDavid Virag 
23345bd8166SDavid Virag static const struct samsung_div_clock top_div_clks[] __initconst = {
23445bd8166SDavid Virag 	/* TOP */
23545bd8166SDavid Virag 	DIV(CLK_DOUT_SHARED0_DIV2, "dout_shared0_div2", "fout_shared0_pll",
23645bd8166SDavid Virag 	    CLK_CON_DIV_PLL_SHARED0_DIV2, 0, 1),
23745bd8166SDavid Virag 	DIV(CLK_DOUT_SHARED0_DIV3, "dout_shared0_div3", "fout_shared0_pll",
23845bd8166SDavid Virag 	    CLK_CON_DIV_PLL_SHARED0_DIV3, 0, 2),
239ef80c95cSDavid Virag 	DIV(CLK_DOUT_SHARED0_DIV4, "dout_shared0_div4", "dout_shared0_div2",
24045bd8166SDavid Virag 	    CLK_CON_DIV_PLL_SHARED0_DIV4, 0, 1),
24145bd8166SDavid Virag 	DIV(CLK_DOUT_SHARED0_DIV5, "dout_shared0_div5", "fout_shared0_pll",
24245bd8166SDavid Virag 	    CLK_CON_DIV_PLL_SHARED0_DIV5, 0, 3),
24345bd8166SDavid Virag 	DIV(CLK_DOUT_SHARED1_DIV2, "dout_shared1_div2", "fout_shared1_pll",
24445bd8166SDavid Virag 	    CLK_CON_DIV_PLL_SHARED1_DIV2, 0, 1),
24545bd8166SDavid Virag 	DIV(CLK_DOUT_SHARED1_DIV3, "dout_shared1_div3", "fout_shared1_pll",
24645bd8166SDavid Virag 	    CLK_CON_DIV_PLL_SHARED1_DIV3, 0, 2),
247ef80c95cSDavid Virag 	DIV(CLK_DOUT_SHARED1_DIV4, "dout_shared1_div4", "dout_shared1_div2",
24845bd8166SDavid Virag 	    CLK_CON_DIV_PLL_SHARED1_DIV4, 0, 1),
24945bd8166SDavid Virag 
25045bd8166SDavid Virag 	/* CORE */
25145bd8166SDavid Virag 	DIV(CLK_DOUT_CORE_BUS, "dout_core_bus", "gout_core_bus",
25245bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_CORE_BUS, 0, 3),
25345bd8166SDavid Virag 	DIV(CLK_DOUT_CORE_CCI, "dout_core_cci", "gout_core_cci",
25445bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_CORE_CCI, 0, 3),
25545bd8166SDavid Virag 	DIV(CLK_DOUT_CORE_G3D, "dout_core_g3d", "gout_core_g3d",
25645bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_CORE_G3D, 0, 3),
25745bd8166SDavid Virag 
25845bd8166SDavid Virag 	/* PERI */
25945bd8166SDavid Virag 	DIV(CLK_DOUT_PERI_BUS, "dout_peri_bus", "gout_peri_bus",
26045bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_PERI_BUS, 0, 4),
26145bd8166SDavid Virag 	DIV(CLK_DOUT_PERI_SPI0, "dout_peri_spi0", "gout_peri_spi0",
26245bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_PERI_SPI0, 0, 6),
26345bd8166SDavid Virag 	DIV(CLK_DOUT_PERI_SPI1, "dout_peri_spi1", "gout_peri_spi1",
26445bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_PERI_SPI1, 0, 6),
26545bd8166SDavid Virag 	DIV(CLK_DOUT_PERI_UART0, "dout_peri_uart0", "gout_peri_uart0",
26645bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_PERI_UART0, 0, 4),
26745bd8166SDavid Virag 	DIV(CLK_DOUT_PERI_UART1, "dout_peri_uart1", "gout_peri_uart1",
26845bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_PERI_UART1, 0, 4),
26945bd8166SDavid Virag 	DIV(CLK_DOUT_PERI_UART2, "dout_peri_uart2", "gout_peri_uart2",
27045bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_PERI_UART2, 0, 4),
27145bd8166SDavid Virag 	DIV(CLK_DOUT_PERI_USI0, "dout_peri_usi0", "gout_peri_usi0",
27245bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_PERI_USI0, 0, 4),
27345bd8166SDavid Virag 	DIV(CLK_DOUT_PERI_USI1, "dout_peri_usi1", "gout_peri_usi1",
27445bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_PERI_USI1, 0, 4),
27545bd8166SDavid Virag 	DIV(CLK_DOUT_PERI_USI2, "dout_peri_usi2", "gout_peri_usi2",
27645bd8166SDavid Virag 	    CLK_CON_DIV_CLKCMU_PERI_USI2, 0, 4),
277f392db97SDavid Virag 
278f392db97SDavid Virag 	/* FSYS */
279f392db97SDavid Virag 	DIV(CLK_DOUT_FSYS_BUS, "dout_fsys_bus", "gout_fsys_bus",
280f392db97SDavid Virag 	    CLK_CON_DIV_CLKCMU_FSYS_BUS, 0, 4),
281f392db97SDavid Virag 	DIV(CLK_DOUT_FSYS_MMC_CARD, "dout_fsys_mmc_card", "gout_fsys_mmc_card",
282f392db97SDavid Virag 	    CLK_CON_DIV_CLKCMU_FSYS_MMC_CARD, 0, 9),
283f392db97SDavid Virag 	DIV(CLK_DOUT_FSYS_MMC_EMBD, "dout_fsys_mmc_embd", "gout_fsys_mmc_embd",
284f392db97SDavid Virag 	    CLK_CON_DIV_CLKCMU_FSYS_MMC_EMBD, 0, 9),
285f392db97SDavid Virag 	DIV(CLK_DOUT_FSYS_MMC_SDIO, "dout_fsys_mmc_sdio", "gout_fsys_mmc_sdio",
286f392db97SDavid Virag 	    CLK_CON_DIV_CLKCMU_FSYS_MMC_SDIO, 0, 9),
287f392db97SDavid Virag 	DIV(CLK_DOUT_FSYS_USB30DRD, "dout_fsys_usb30drd", "gout_fsys_usb30drd",
288f392db97SDavid Virag 	    CLK_CON_DIV_CLKCMU_FSYS_USB30DRD, 0, 4),
28945bd8166SDavid Virag };
29045bd8166SDavid Virag 
29145bd8166SDavid Virag static const struct samsung_gate_clock top_gate_clks[] __initconst = {
29245bd8166SDavid Virag 	/* CORE */
29345bd8166SDavid Virag 	GATE(CLK_GOUT_CORE_BUS, "gout_core_bus", "mout_core_bus",
29445bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_CORE_BUS, 21, 0, 0),
29545bd8166SDavid Virag 	GATE(CLK_GOUT_CORE_CCI, "gout_core_cci", "mout_core_cci",
29645bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_CORE_CCI, 21, 0, 0),
29745bd8166SDavid Virag 	GATE(CLK_GOUT_CORE_G3D, "gout_core_g3d", "mout_core_g3d",
29845bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_CORE_G3D, 21, 0, 0),
29945bd8166SDavid Virag 
30045bd8166SDavid Virag 	/* PERI */
30145bd8166SDavid Virag 	GATE(CLK_GOUT_PERI_BUS, "gout_peri_bus", "mout_peri_bus",
30245bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_PERI_BUS, 21, 0, 0),
30345bd8166SDavid Virag 	GATE(CLK_GOUT_PERI_SPI0, "gout_peri_spi0", "mout_peri_spi0",
30445bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_PERI_SPI0, 21, 0, 0),
30545bd8166SDavid Virag 	GATE(CLK_GOUT_PERI_SPI1, "gout_peri_spi1", "mout_peri_spi1",
30645bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_PERI_SPI1, 21, 0, 0),
30745bd8166SDavid Virag 	GATE(CLK_GOUT_PERI_UART0, "gout_peri_uart0", "mout_peri_uart0",
30845bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_PERI_UART0, 21, 0, 0),
30945bd8166SDavid Virag 	GATE(CLK_GOUT_PERI_UART1, "gout_peri_uart1", "mout_peri_uart1",
31045bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMUC_PERI_UART1, 21, 0, 0),
31145bd8166SDavid Virag 	GATE(CLK_GOUT_PERI_UART2, "gout_peri_uart2", "mout_peri_uart2",
31245bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_PERI_UART2, 21, 0, 0),
31345bd8166SDavid Virag 	GATE(CLK_GOUT_PERI_USI0, "gout_peri_usi0", "mout_peri_usi0",
31445bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_PERI_USI0, 21, 0, 0),
31545bd8166SDavid Virag 	GATE(CLK_GOUT_PERI_USI1, "gout_peri_usi1", "mout_peri_usi1",
31645bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_PERI_USI1, 21, 0, 0),
31745bd8166SDavid Virag 	GATE(CLK_GOUT_PERI_USI2, "gout_peri_usi2", "mout_peri_usi2",
31845bd8166SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_PERI_USI2, 21, 0, 0),
319f392db97SDavid Virag 
320f392db97SDavid Virag 	/* FSYS */
321f392db97SDavid Virag 	GATE(CLK_GOUT_FSYS_BUS, "gout_fsys_bus", "mout_fsys_bus",
322f392db97SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_FSYS_BUS, 21, 0, 0),
323f392db97SDavid Virag 	GATE(CLK_GOUT_FSYS_MMC_CARD, "gout_fsys_mmc_card", "mout_fsys_mmc_card",
324f392db97SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_FSYS_MMC_CARD, 21, 0, 0),
325f392db97SDavid Virag 	GATE(CLK_GOUT_FSYS_MMC_EMBD, "gout_fsys_mmc_embd", "mout_fsys_mmc_embd",
326f392db97SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_FSYS_MMC_EMBD, 21, 0, 0),
327f392db97SDavid Virag 	GATE(CLK_GOUT_FSYS_MMC_SDIO, "gout_fsys_mmc_sdio", "mout_fsys_mmc_sdio",
328f392db97SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_FSYS_MMC_SDIO, 21, 0, 0),
329f392db97SDavid Virag 	GATE(CLK_GOUT_FSYS_USB30DRD, "gout_fsys_usb30drd", "mout_fsys_usb30drd",
330f392db97SDavid Virag 	     CLK_CON_GAT_GATE_CLKCMU_FSYS_USB30DRD, 21, 0, 0),
33145bd8166SDavid Virag };
33245bd8166SDavid Virag 
33345bd8166SDavid Virag static const struct samsung_cmu_info top_cmu_info __initconst = {
33445bd8166SDavid Virag 	.pll_clks		= top_pll_clks,
33545bd8166SDavid Virag 	.nr_pll_clks		= ARRAY_SIZE(top_pll_clks),
33645bd8166SDavid Virag 	.mux_clks		= top_mux_clks,
33745bd8166SDavid Virag 	.nr_mux_clks		= ARRAY_SIZE(top_mux_clks),
33845bd8166SDavid Virag 	.div_clks		= top_div_clks,
33945bd8166SDavid Virag 	.nr_div_clks		= ARRAY_SIZE(top_div_clks),
34045bd8166SDavid Virag 	.gate_clks		= top_gate_clks,
34145bd8166SDavid Virag 	.nr_gate_clks		= ARRAY_SIZE(top_gate_clks),
342ef4923c8SKrzysztof Kozlowski 	.nr_clk_ids		= CLKS_NR_TOP,
34345bd8166SDavid Virag 	.clk_regs		= top_clk_regs,
34445bd8166SDavid Virag 	.nr_clk_regs		= ARRAY_SIZE(top_clk_regs),
34545bd8166SDavid Virag };
34645bd8166SDavid Virag 
exynos7885_cmu_top_init(struct device_node * np)34745bd8166SDavid Virag static void __init exynos7885_cmu_top_init(struct device_node *np)
34845bd8166SDavid Virag {
34945bd8166SDavid Virag 	exynos_arm64_register_cmu(NULL, np, &top_cmu_info);
35045bd8166SDavid Virag }
35145bd8166SDavid Virag 
35245bd8166SDavid Virag /* Register CMU_TOP early, as it's a dependency for other early domains */
35345bd8166SDavid Virag CLK_OF_DECLARE(exynos7885_cmu_top, "samsung,exynos7885-cmu-top",
35445bd8166SDavid Virag 	       exynos7885_cmu_top_init);
35545bd8166SDavid Virag 
35645bd8166SDavid Virag /* ---- CMU_PERI ------------------------------------------------------------ */
35745bd8166SDavid Virag 
35845bd8166SDavid Virag /* Register Offset definitions for CMU_PERI (0x10010000) */
35945bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_PERI_BUS_USER	0x0100
36045bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_PERI_SPI0_USER	0x0120
36145bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_PERI_SPI1_USER	0x0140
36245bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_PERI_UART0_USER	0x0160
36345bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_PERI_UART1_USER	0x0180
36445bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_PERI_UART2_USER	0x01a0
36545bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_PERI_USI0_USER	0x01c0
36645bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_PERI_USI1_USER	0x01e0
36745bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_PERI_USI2_USER	0x0200
36845bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_GPIO_TOP_PCLK	0x2024
36945bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_HSI2C_0_PCLK	0x2028
37045bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_HSI2C_1_PCLK	0x202c
37145bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_HSI2C_2_PCLK	0x2030
37245bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_HSI2C_3_PCLK	0x2034
37345bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_I2C_0_PCLK	0x2038
37445bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_I2C_1_PCLK	0x203c
37545bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_I2C_2_PCLK	0x2040
37645bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_I2C_3_PCLK	0x2044
37745bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_I2C_4_PCLK	0x2048
37845bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_I2C_5_PCLK	0x204c
37945bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_I2C_6_PCLK	0x2050
38045bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_I2C_7_PCLK	0x2054
38145bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_PWM_MOTOR_PCLK	0x2058
38245bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_SPI_0_PCLK	0x205c
38345bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_SPI_0_EXT_CLK	0x2060
38445bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_SPI_1_PCLK	0x2064
38545bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_SPI_1_EXT_CLK	0x2068
38645bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_UART_0_EXT_UCLK	0x206c
38745bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_UART_0_PCLK	0x2070
38845bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_UART_1_EXT_UCLK	0x2074
38945bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_UART_1_PCLK	0x2078
39045bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_UART_2_EXT_UCLK	0x207c
39145bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_UART_2_PCLK	0x2080
39245bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_USI0_PCLK		0x2084
39345bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_USI0_SCLK		0x2088
39445bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_USI1_PCLK		0x208c
39545bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_USI1_SCLK		0x2090
39645bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_USI2_PCLK		0x2094
39745bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_USI2_SCLK		0x2098
39845bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_MCT_PCLK		0x20a0
39945bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_SYSREG_PERI_PCLK	0x20b0
40045bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER0_PCLK	0x20b4
40145bd8166SDavid Virag #define CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER1_PCLK	0x20b8
40245bd8166SDavid Virag 
40345bd8166SDavid Virag static const unsigned long peri_clk_regs[] __initconst = {
40445bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_PERI_BUS_USER,
40545bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_PERI_SPI0_USER,
40645bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_PERI_SPI1_USER,
40745bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_PERI_UART0_USER,
40845bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_PERI_UART1_USER,
40945bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_PERI_UART2_USER,
41045bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_PERI_USI0_USER,
41145bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_PERI_USI1_USER,
41245bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_PERI_USI2_USER,
41345bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_GPIO_TOP_PCLK,
41445bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_HSI2C_0_PCLK,
41545bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_HSI2C_1_PCLK,
41645bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_HSI2C_2_PCLK,
41745bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_HSI2C_3_PCLK,
41845bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_I2C_0_PCLK,
41945bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_I2C_1_PCLK,
42045bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_I2C_2_PCLK,
42145bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_I2C_3_PCLK,
42245bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_I2C_4_PCLK,
42345bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_I2C_5_PCLK,
42445bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_I2C_6_PCLK,
42545bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_I2C_7_PCLK,
42645bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_PWM_MOTOR_PCLK,
42745bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_SPI_0_PCLK,
42845bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_SPI_0_EXT_CLK,
42945bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_SPI_1_PCLK,
43045bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_SPI_1_EXT_CLK,
43145bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_UART_0_EXT_UCLK,
43245bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_UART_0_PCLK,
43345bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_UART_1_EXT_UCLK,
43445bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_UART_1_PCLK,
43545bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_UART_2_EXT_UCLK,
43645bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_UART_2_PCLK,
43745bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_USI0_PCLK,
43845bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_USI0_SCLK,
43945bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_USI1_PCLK,
44045bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_USI1_SCLK,
44145bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_USI2_PCLK,
44245bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_USI2_SCLK,
44345bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_MCT_PCLK,
44445bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_SYSREG_PERI_PCLK,
44545bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER0_PCLK,
44645bd8166SDavid Virag 	CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER1_PCLK,
44745bd8166SDavid Virag };
44845bd8166SDavid Virag 
44945bd8166SDavid Virag /* List of parent clocks for Muxes in CMU_PERI */
45045bd8166SDavid Virag PNAME(mout_peri_bus_user_p)	= { "oscclk", "dout_peri_bus" };
45145bd8166SDavid Virag PNAME(mout_peri_spi0_user_p)	= { "oscclk", "dout_peri_spi0" };
45245bd8166SDavid Virag PNAME(mout_peri_spi1_user_p)	= { "oscclk", "dout_peri_spi1" };
45345bd8166SDavid Virag PNAME(mout_peri_uart0_user_p)	= { "oscclk", "dout_peri_uart0" };
45445bd8166SDavid Virag PNAME(mout_peri_uart1_user_p)	= { "oscclk", "dout_peri_uart1" };
45545bd8166SDavid Virag PNAME(mout_peri_uart2_user_p)	= { "oscclk", "dout_peri_uart2" };
45645bd8166SDavid Virag PNAME(mout_peri_usi0_user_p)	= { "oscclk", "dout_peri_usi0" };
45745bd8166SDavid Virag PNAME(mout_peri_usi1_user_p)	= { "oscclk", "dout_peri_usi1" };
45845bd8166SDavid Virag PNAME(mout_peri_usi2_user_p)	= { "oscclk", "dout_peri_usi2" };
45945bd8166SDavid Virag 
46045bd8166SDavid Virag static const struct samsung_mux_clock peri_mux_clks[] __initconst = {
46145bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_BUS_USER, "mout_peri_bus_user", mout_peri_bus_user_p,
46245bd8166SDavid Virag 	    PLL_CON0_MUX_CLKCMU_PERI_BUS_USER, 4, 1),
46345bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_SPI0_USER, "mout_peri_spi0_user", mout_peri_spi0_user_p,
46445bd8166SDavid Virag 	    PLL_CON0_MUX_CLKCMU_PERI_SPI0_USER, 4, 1),
46545bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_SPI1_USER, "mout_peri_spi1_user", mout_peri_spi1_user_p,
46645bd8166SDavid Virag 	    PLL_CON0_MUX_CLKCMU_PERI_SPI1_USER, 4, 1),
46745bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_UART0_USER, "mout_peri_uart0_user",
46845bd8166SDavid Virag 	    mout_peri_uart0_user_p, PLL_CON0_MUX_CLKCMU_PERI_UART0_USER, 4, 1),
46945bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_UART1_USER, "mout_peri_uart1_user",
47045bd8166SDavid Virag 	    mout_peri_uart1_user_p, PLL_CON0_MUX_CLKCMU_PERI_UART1_USER, 4, 1),
47145bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_UART2_USER, "mout_peri_uart2_user",
47245bd8166SDavid Virag 	    mout_peri_uart2_user_p, PLL_CON0_MUX_CLKCMU_PERI_UART2_USER, 4, 1),
47345bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_USI0_USER, "mout_peri_usi0_user",
47445bd8166SDavid Virag 	    mout_peri_usi0_user_p, PLL_CON0_MUX_CLKCMU_PERI_USI0_USER, 4, 1),
47545bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_USI1_USER, "mout_peri_usi1_user",
47645bd8166SDavid Virag 	    mout_peri_usi1_user_p, PLL_CON0_MUX_CLKCMU_PERI_USI1_USER, 4, 1),
47745bd8166SDavid Virag 	MUX(CLK_MOUT_PERI_USI2_USER, "mout_peri_usi2_user",
47845bd8166SDavid Virag 	    mout_peri_usi2_user_p, PLL_CON0_MUX_CLKCMU_PERI_USI2_USER, 4, 1),
47945bd8166SDavid Virag };
48045bd8166SDavid Virag 
48145bd8166SDavid Virag static const struct samsung_gate_clock peri_gate_clks[] __initconst = {
48245bd8166SDavid Virag 	/* TODO: Should be enabled in GPIO driver (or made CLK_IS_CRITICAL) */
48345bd8166SDavid Virag 	GATE(CLK_GOUT_GPIO_TOP_PCLK, "gout_gpio_top_pclk",
48445bd8166SDavid Virag 	     "mout_peri_bus_user",
48545bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_GPIO_TOP_PCLK, 21, CLK_IGNORE_UNUSED, 0),
48645bd8166SDavid Virag 	GATE(CLK_GOUT_HSI2C0_PCLK, "gout_hsi2c0_pclk", "mout_peri_bus_user",
48745bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_HSI2C_0_PCLK, 21, 0, 0),
48845bd8166SDavid Virag 	GATE(CLK_GOUT_HSI2C1_PCLK, "gout_hsi2c1_pclk", "mout_peri_bus_user",
48945bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_HSI2C_1_PCLK, 21, 0, 0),
49045bd8166SDavid Virag 	GATE(CLK_GOUT_HSI2C2_PCLK, "gout_hsi2c2_pclk", "mout_peri_bus_user",
49145bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_HSI2C_2_PCLK, 21, 0, 0),
49245bd8166SDavid Virag 	GATE(CLK_GOUT_HSI2C3_PCLK, "gout_hsi2c3_pclk", "mout_peri_bus_user",
49345bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_HSI2C_3_PCLK, 21, 0, 0),
49445bd8166SDavid Virag 	GATE(CLK_GOUT_I2C0_PCLK, "gout_i2c0_pclk", "mout_peri_bus_user",
49545bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_I2C_0_PCLK, 21, 0, 0),
49645bd8166SDavid Virag 	GATE(CLK_GOUT_I2C1_PCLK, "gout_i2c1_pclk", "mout_peri_bus_user",
49745bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_I2C_1_PCLK, 21, 0, 0),
49845bd8166SDavid Virag 	GATE(CLK_GOUT_I2C2_PCLK, "gout_i2c2_pclk", "mout_peri_bus_user",
49945bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_I2C_2_PCLK, 21, 0, 0),
50045bd8166SDavid Virag 	GATE(CLK_GOUT_I2C3_PCLK, "gout_i2c3_pclk", "mout_peri_bus_user",
50145bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_I2C_3_PCLK, 21, 0, 0),
50245bd8166SDavid Virag 	GATE(CLK_GOUT_I2C4_PCLK, "gout_i2c4_pclk", "mout_peri_bus_user",
50345bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_I2C_4_PCLK, 21, 0, 0),
50445bd8166SDavid Virag 	GATE(CLK_GOUT_I2C5_PCLK, "gout_i2c5_pclk", "mout_peri_bus_user",
50545bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_I2C_5_PCLK, 21, 0, 0),
50645bd8166SDavid Virag 	GATE(CLK_GOUT_I2C6_PCLK, "gout_i2c6_pclk", "mout_peri_bus_user",
50745bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_I2C_6_PCLK, 21, 0, 0),
50845bd8166SDavid Virag 	GATE(CLK_GOUT_I2C7_PCLK, "gout_i2c7_pclk", "mout_peri_bus_user",
50945bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_I2C_7_PCLK, 21, 0, 0),
51045bd8166SDavid Virag 	GATE(CLK_GOUT_PWM_MOTOR_PCLK, "gout_pwm_motor_pclk",
51145bd8166SDavid Virag 	     "mout_peri_bus_user",
51245bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_PWM_MOTOR_PCLK, 21, 0, 0),
51345bd8166SDavid Virag 	GATE(CLK_GOUT_SPI0_PCLK, "gout_spi0_pclk", "mout_peri_bus_user",
51445bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_SPI_0_PCLK, 21, 0, 0),
51545bd8166SDavid Virag 	GATE(CLK_GOUT_SPI0_EXT_CLK, "gout_spi0_ipclk", "mout_peri_spi0_user",
51645bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_SPI_0_EXT_CLK, 21, 0, 0),
51745bd8166SDavid Virag 	GATE(CLK_GOUT_SPI1_PCLK, "gout_spi1_pclk", "mout_peri_bus_user",
51845bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_SPI_1_PCLK, 21, 0, 0),
51945bd8166SDavid Virag 	GATE(CLK_GOUT_SPI1_EXT_CLK, "gout_spi1_ipclk", "mout_peri_spi1_user",
52045bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_SPI_1_EXT_CLK, 21, 0, 0),
52145bd8166SDavid Virag 	GATE(CLK_GOUT_UART0_EXT_UCLK, "gout_uart0_ext_uclk", "mout_peri_uart0_user",
52245bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_UART_0_EXT_UCLK, 21, 0, 0),
52345bd8166SDavid Virag 	GATE(CLK_GOUT_UART0_PCLK, "gout_uart0_pclk", "mout_peri_bus_user",
52445bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_UART_0_PCLK, 21, 0, 0),
52545bd8166SDavid Virag 	GATE(CLK_GOUT_UART1_EXT_UCLK, "gout_uart1_ext_uclk", "mout_peri_uart1_user",
52645bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_UART_1_EXT_UCLK, 21, 0, 0),
52745bd8166SDavid Virag 	GATE(CLK_GOUT_UART1_PCLK, "gout_uart1_pclk", "mout_peri_bus_user",
52845bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_UART_1_PCLK, 21, 0, 0),
52945bd8166SDavid Virag 	GATE(CLK_GOUT_UART2_EXT_UCLK, "gout_uart2_ext_uclk", "mout_peri_uart2_user",
53045bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_UART_2_EXT_UCLK, 21, 0, 0),
53145bd8166SDavid Virag 	GATE(CLK_GOUT_UART2_PCLK, "gout_uart2_pclk", "mout_peri_bus_user",
53245bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_UART_2_PCLK, 21, 0, 0),
53345bd8166SDavid Virag 	GATE(CLK_GOUT_USI0_PCLK, "gout_usi0_pclk", "mout_peri_bus_user",
53445bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_USI0_PCLK, 21, 0, 0),
53545bd8166SDavid Virag 	GATE(CLK_GOUT_USI0_SCLK, "gout_usi0_sclk", "mout_peri_usi0_user",
53645bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_USI0_SCLK, 21, 0, 0),
53745bd8166SDavid Virag 	GATE(CLK_GOUT_USI1_PCLK, "gout_usi1_pclk", "mout_peri_bus_user",
53845bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_USI1_PCLK, 21, 0, 0),
53945bd8166SDavid Virag 	GATE(CLK_GOUT_USI1_SCLK, "gout_usi1_sclk", "mout_peri_usi1_user",
54045bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_USI1_SCLK, 21, 0, 0),
54145bd8166SDavid Virag 	GATE(CLK_GOUT_USI2_PCLK, "gout_usi2_pclk", "mout_peri_bus_user",
54245bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_USI2_PCLK, 21, 0, 0),
54345bd8166SDavid Virag 	GATE(CLK_GOUT_USI2_SCLK, "gout_usi2_sclk", "mout_peri_usi2_user",
54445bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_USI2_SCLK, 21, 0, 0),
54545bd8166SDavid Virag 	GATE(CLK_GOUT_MCT_PCLK, "gout_mct_pclk", "mout_peri_bus_user",
54645bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_MCT_PCLK, 21, 0, 0),
54745bd8166SDavid Virag 	GATE(CLK_GOUT_SYSREG_PERI_PCLK, "gout_sysreg_peri_pclk",
54845bd8166SDavid Virag 	     "mout_peri_bus_user",
54945bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_SYSREG_PERI_PCLK, 21, 0, 0),
55045bd8166SDavid Virag 	GATE(CLK_GOUT_WDT0_PCLK, "gout_wdt0_pclk", "mout_peri_bus_user",
55145bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER0_PCLK, 21, 0, 0),
55245bd8166SDavid Virag 	GATE(CLK_GOUT_WDT1_PCLK, "gout_wdt1_pclk", "mout_peri_bus_user",
55345bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER1_PCLK, 21, 0, 0),
55445bd8166SDavid Virag };
55545bd8166SDavid Virag 
55645bd8166SDavid Virag static const struct samsung_cmu_info peri_cmu_info __initconst = {
55745bd8166SDavid Virag 	.mux_clks		= peri_mux_clks,
55845bd8166SDavid Virag 	.nr_mux_clks		= ARRAY_SIZE(peri_mux_clks),
55945bd8166SDavid Virag 	.gate_clks		= peri_gate_clks,
56045bd8166SDavid Virag 	.nr_gate_clks		= ARRAY_SIZE(peri_gate_clks),
561ef4923c8SKrzysztof Kozlowski 	.nr_clk_ids		= CLKS_NR_PERI,
56245bd8166SDavid Virag 	.clk_regs		= peri_clk_regs,
56345bd8166SDavid Virag 	.nr_clk_regs		= ARRAY_SIZE(peri_clk_regs),
56445bd8166SDavid Virag 	.clk_name		= "dout_peri_bus",
56545bd8166SDavid Virag };
56645bd8166SDavid Virag 
exynos7885_cmu_peri_init(struct device_node * np)56745bd8166SDavid Virag static void __init exynos7885_cmu_peri_init(struct device_node *np)
56845bd8166SDavid Virag {
56945bd8166SDavid Virag 	exynos_arm64_register_cmu(NULL, np, &peri_cmu_info);
57045bd8166SDavid Virag }
57145bd8166SDavid Virag 
57245bd8166SDavid Virag /* Register CMU_PERI early, as it's needed for MCT timer */
57345bd8166SDavid Virag CLK_OF_DECLARE(exynos7885_cmu_peri, "samsung,exynos7885-cmu-peri",
57445bd8166SDavid Virag 	       exynos7885_cmu_peri_init);
57545bd8166SDavid Virag 
57645bd8166SDavid Virag /* ---- CMU_CORE ------------------------------------------------------------ */
57745bd8166SDavid Virag 
57845bd8166SDavid Virag /* Register Offset definitions for CMU_CORE (0x12000000) */
57945bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_CORE_BUS_USER		0x0100
58045bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_CORE_CCI_USER		0x0120
58145bd8166SDavid Virag #define PLL_CON0_MUX_CLKCMU_CORE_G3D_USER		0x0140
58245bd8166SDavid Virag #define CLK_CON_MUX_MUX_CLK_CORE_GIC			0x1000
58345bd8166SDavid Virag #define CLK_CON_DIV_DIV_CLK_CORE_BUSP			0x1800
58445bd8166SDavid Virag #define CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK		0x2054
58545bd8166SDavid Virag #define CLK_CON_GAT_GOUT_CORE_GIC400_CLK		0x2058
5860e1b2f1fSDavid Virag #define CLK_CON_GAT_GOUT_CORE_TREX_D_CORE_ACLK		0x215c
5870e1b2f1fSDavid Virag #define CLK_CON_GAT_GOUT_CORE_TREX_D_CORE_GCLK		0x2160
5880e1b2f1fSDavid Virag #define CLK_CON_GAT_GOUT_CORE_TREX_D_CORE_PCLK		0x2164
5890e1b2f1fSDavid Virag #define CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_ACLK_P_CORE	0x2168
5900e1b2f1fSDavid Virag #define CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_CCLK_P_CORE	0x216c
5910e1b2f1fSDavid Virag #define CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_PCLK		0x2170
5920e1b2f1fSDavid Virag #define CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_PCLK_P_CORE	0x2174
59345bd8166SDavid Virag 
59445bd8166SDavid Virag static const unsigned long core_clk_regs[] __initconst = {
59545bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_CORE_BUS_USER,
59645bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_CORE_CCI_USER,
59745bd8166SDavid Virag 	PLL_CON0_MUX_CLKCMU_CORE_G3D_USER,
59845bd8166SDavid Virag 	CLK_CON_MUX_MUX_CLK_CORE_GIC,
59945bd8166SDavid Virag 	CLK_CON_DIV_DIV_CLK_CORE_BUSP,
60045bd8166SDavid Virag 	CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK,
60145bd8166SDavid Virag 	CLK_CON_GAT_GOUT_CORE_GIC400_CLK,
6020e1b2f1fSDavid Virag 	CLK_CON_GAT_GOUT_CORE_TREX_D_CORE_ACLK,
6030e1b2f1fSDavid Virag 	CLK_CON_GAT_GOUT_CORE_TREX_D_CORE_GCLK,
6040e1b2f1fSDavid Virag 	CLK_CON_GAT_GOUT_CORE_TREX_D_CORE_PCLK,
6050e1b2f1fSDavid Virag 	CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_ACLK_P_CORE,
6060e1b2f1fSDavid Virag 	CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_CCLK_P_CORE,
6070e1b2f1fSDavid Virag 	CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_PCLK,
6080e1b2f1fSDavid Virag 	CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_PCLK_P_CORE,
60945bd8166SDavid Virag };
61045bd8166SDavid Virag 
61145bd8166SDavid Virag /* List of parent clocks for Muxes in CMU_CORE */
61245bd8166SDavid Virag PNAME(mout_core_bus_user_p)		= { "oscclk", "dout_core_bus" };
61345bd8166SDavid Virag PNAME(mout_core_cci_user_p)		= { "oscclk", "dout_core_cci" };
61445bd8166SDavid Virag PNAME(mout_core_g3d_user_p)		= { "oscclk", "dout_core_g3d" };
61545bd8166SDavid Virag PNAME(mout_core_gic_p)			= { "dout_core_busp", "oscclk" };
61645bd8166SDavid Virag 
61745bd8166SDavid Virag static const struct samsung_mux_clock core_mux_clks[] __initconst = {
61845bd8166SDavid Virag 	MUX(CLK_MOUT_CORE_BUS_USER, "mout_core_bus_user", mout_core_bus_user_p,
61945bd8166SDavid Virag 	    PLL_CON0_MUX_CLKCMU_CORE_BUS_USER, 4, 1),
62045bd8166SDavid Virag 	MUX(CLK_MOUT_CORE_CCI_USER, "mout_core_cci_user", mout_core_cci_user_p,
62145bd8166SDavid Virag 	    PLL_CON0_MUX_CLKCMU_CORE_CCI_USER, 4, 1),
62245bd8166SDavid Virag 	MUX(CLK_MOUT_CORE_G3D_USER, "mout_core_g3d_user", mout_core_g3d_user_p,
62345bd8166SDavid Virag 	    PLL_CON0_MUX_CLKCMU_CORE_G3D_USER, 4, 1),
62445bd8166SDavid Virag 	MUX(CLK_MOUT_CORE_GIC, "mout_core_gic", mout_core_gic_p,
62545bd8166SDavid Virag 	    CLK_CON_MUX_MUX_CLK_CORE_GIC, 0, 1),
62645bd8166SDavid Virag };
62745bd8166SDavid Virag 
62845bd8166SDavid Virag static const struct samsung_div_clock core_div_clks[] __initconst = {
62945bd8166SDavid Virag 	DIV(CLK_DOUT_CORE_BUSP, "dout_core_busp", "mout_core_bus_user",
63045bd8166SDavid Virag 	    CLK_CON_DIV_DIV_CLK_CORE_BUSP, 0, 2),
63145bd8166SDavid Virag };
63245bd8166SDavid Virag 
63345bd8166SDavid Virag static const struct samsung_gate_clock core_gate_clks[] __initconst = {
63445bd8166SDavid Virag 	/* CCI (interconnect) clock must be always running */
63545bd8166SDavid Virag 	GATE(CLK_GOUT_CCI_ACLK, "gout_cci_aclk", "mout_core_cci_user",
63645bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK, 21, CLK_IS_CRITICAL, 0),
63745bd8166SDavid Virag 	/* GIC (interrupt controller) clock must be always running */
63845bd8166SDavid Virag 	GATE(CLK_GOUT_GIC400_CLK, "gout_gic400_clk", "mout_core_gic",
63945bd8166SDavid Virag 	     CLK_CON_GAT_GOUT_CORE_GIC400_CLK, 21, CLK_IS_CRITICAL, 0),
6400e1b2f1fSDavid Virag 	/*
6410e1b2f1fSDavid Virag 	 * TREX D and P Core (seems to be related to "bus traffic shaper")
6420e1b2f1fSDavid Virag 	 * clocks must always be running
6430e1b2f1fSDavid Virag 	 */
6440e1b2f1fSDavid Virag 	GATE(CLK_GOUT_TREX_D_CORE_ACLK, "gout_trex_d_core_aclk", "mout_core_bus_user",
6450e1b2f1fSDavid Virag 	     CLK_CON_GAT_GOUT_CORE_TREX_D_CORE_ACLK, 21, CLK_IS_CRITICAL, 0),
6460e1b2f1fSDavid Virag 	GATE(CLK_GOUT_TREX_D_CORE_GCLK, "gout_trex_d_core_gclk", "mout_core_g3d_user",
6470e1b2f1fSDavid Virag 	     CLK_CON_GAT_GOUT_CORE_TREX_D_CORE_GCLK, 21, CLK_IS_CRITICAL, 0),
6480e1b2f1fSDavid Virag 	GATE(CLK_GOUT_TREX_D_CORE_PCLK, "gout_trex_d_core_pclk", "dout_core_busp",
6490e1b2f1fSDavid Virag 	     CLK_CON_GAT_GOUT_CORE_TREX_D_CORE_PCLK, 21, CLK_IS_CRITICAL, 0),
6500e1b2f1fSDavid Virag 	GATE(CLK_GOUT_TREX_P_CORE_ACLK_P_CORE, "gout_trex_p_core_aclk_p_core",
6510e1b2f1fSDavid Virag 	     "mout_core_bus_user", CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_ACLK_P_CORE, 21,
6520e1b2f1fSDavid Virag 	     CLK_IS_CRITICAL, 0),
6530e1b2f1fSDavid Virag 	GATE(CLK_GOUT_TREX_P_CORE_CCLK_P_CORE, "gout_trex_p_core_cclk_p_core",
6540e1b2f1fSDavid Virag 	     "mout_core_cci_user", CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_CCLK_P_CORE, 21,
6550e1b2f1fSDavid Virag 	     CLK_IS_CRITICAL, 0),
6560e1b2f1fSDavid Virag 	GATE(CLK_GOUT_TREX_P_CORE_PCLK, "gout_trex_p_core_pclk", "dout_core_busp",
6570e1b2f1fSDavid Virag 	     CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_PCLK, 21, CLK_IS_CRITICAL, 0),
6580e1b2f1fSDavid Virag 	GATE(CLK_GOUT_TREX_P_CORE_PCLK_P_CORE, "gout_trex_p_core_pclk_p_core",
6590e1b2f1fSDavid Virag 	     "dout_core_busp", CLK_CON_GAT_GOUT_CORE_TREX_P_CORE_PCLK_P_CORE, 21,
6600e1b2f1fSDavid Virag 	     CLK_IS_CRITICAL, 0),
66145bd8166SDavid Virag };
66245bd8166SDavid Virag 
66345bd8166SDavid Virag static const struct samsung_cmu_info core_cmu_info __initconst = {
66445bd8166SDavid Virag 	.mux_clks		= core_mux_clks,
66545bd8166SDavid Virag 	.nr_mux_clks		= ARRAY_SIZE(core_mux_clks),
66645bd8166SDavid Virag 	.div_clks		= core_div_clks,
66745bd8166SDavid Virag 	.nr_div_clks		= ARRAY_SIZE(core_div_clks),
66845bd8166SDavid Virag 	.gate_clks		= core_gate_clks,
66945bd8166SDavid Virag 	.nr_gate_clks		= ARRAY_SIZE(core_gate_clks),
670ef4923c8SKrzysztof Kozlowski 	.nr_clk_ids		= CLKS_NR_CORE,
67145bd8166SDavid Virag 	.clk_regs		= core_clk_regs,
67245bd8166SDavid Virag 	.nr_clk_regs		= ARRAY_SIZE(core_clk_regs),
67345bd8166SDavid Virag 	.clk_name		= "dout_core_bus",
67445bd8166SDavid Virag };
67545bd8166SDavid Virag 
676f392db97SDavid Virag /* ---- CMU_FSYS ------------------------------------------------------------ */
677f392db97SDavid Virag 
678f392db97SDavid Virag /* Register Offset definitions for CMU_FSYS (0x13400000) */
679f392db97SDavid Virag #define PLL_CON0_MUX_CLKCMU_FSYS_BUS_USER	0x0100
680f392db97SDavid Virag #define PLL_CON0_MUX_CLKCMU_FSYS_MMC_CARD_USER	0x0120
681f392db97SDavid Virag #define PLL_CON0_MUX_CLKCMU_FSYS_MMC_EMBD_USER	0x0140
682f392db97SDavid Virag #define PLL_CON0_MUX_CLKCMU_FSYS_MMC_SDIO_USER	0x0160
683f392db97SDavid Virag #define PLL_CON0_MUX_CLKCMU_FSYS_USB30DRD_USER	0x0180
684f392db97SDavid Virag #define CLK_CON_GAT_GOUT_FSYS_MMC_CARD_I_ACLK	0x2030
685f392db97SDavid Virag #define CLK_CON_GAT_GOUT_FSYS_MMC_CARD_SDCLKIN	0x2034
686f392db97SDavid Virag #define CLK_CON_GAT_GOUT_FSYS_MMC_EMBD_I_ACLK	0x2038
687f392db97SDavid Virag #define CLK_CON_GAT_GOUT_FSYS_MMC_EMBD_SDCLKIN	0x203c
688f392db97SDavid Virag #define CLK_CON_GAT_GOUT_FSYS_MMC_SDIO_I_ACLK	0x2040
689f392db97SDavid Virag #define CLK_CON_GAT_GOUT_FSYS_MMC_SDIO_SDCLKIN	0x2044
690f392db97SDavid Virag 
691f392db97SDavid Virag static const unsigned long fsys_clk_regs[] __initconst = {
692f392db97SDavid Virag 	PLL_CON0_MUX_CLKCMU_FSYS_BUS_USER,
693f392db97SDavid Virag 	PLL_CON0_MUX_CLKCMU_FSYS_MMC_CARD_USER,
694f392db97SDavid Virag 	PLL_CON0_MUX_CLKCMU_FSYS_MMC_EMBD_USER,
695f392db97SDavid Virag 	PLL_CON0_MUX_CLKCMU_FSYS_MMC_SDIO_USER,
696f392db97SDavid Virag 	PLL_CON0_MUX_CLKCMU_FSYS_USB30DRD_USER,
697f392db97SDavid Virag 	CLK_CON_GAT_GOUT_FSYS_MMC_CARD_I_ACLK,
698f392db97SDavid Virag 	CLK_CON_GAT_GOUT_FSYS_MMC_CARD_SDCLKIN,
699f392db97SDavid Virag 	CLK_CON_GAT_GOUT_FSYS_MMC_EMBD_I_ACLK,
700f392db97SDavid Virag 	CLK_CON_GAT_GOUT_FSYS_MMC_EMBD_SDCLKIN,
701f392db97SDavid Virag 	CLK_CON_GAT_GOUT_FSYS_MMC_SDIO_I_ACLK,
702f392db97SDavid Virag 	CLK_CON_GAT_GOUT_FSYS_MMC_SDIO_SDCLKIN,
703f392db97SDavid Virag };
704f392db97SDavid Virag 
705f392db97SDavid Virag /* List of parent clocks for Muxes in CMU_FSYS */
706f392db97SDavid Virag PNAME(mout_fsys_bus_user_p)		= { "oscclk", "dout_fsys_bus" };
707f392db97SDavid Virag PNAME(mout_fsys_mmc_card_user_p)	= { "oscclk", "dout_fsys_mmc_card" };
708f392db97SDavid Virag PNAME(mout_fsys_mmc_embd_user_p)	= { "oscclk", "dout_fsys_mmc_embd" };
709f392db97SDavid Virag PNAME(mout_fsys_mmc_sdio_user_p)	= { "oscclk", "dout_fsys_mmc_sdio" };
710f392db97SDavid Virag PNAME(mout_fsys_usb30drd_user_p)	= { "oscclk", "dout_fsys_usb30drd" };
711f392db97SDavid Virag 
712f392db97SDavid Virag static const struct samsung_mux_clock fsys_mux_clks[] __initconst = {
713f392db97SDavid Virag 	MUX(CLK_MOUT_FSYS_BUS_USER, "mout_fsys_bus_user", mout_fsys_bus_user_p,
714f392db97SDavid Virag 	    PLL_CON0_MUX_CLKCMU_FSYS_BUS_USER, 4, 1),
715f392db97SDavid Virag 	MUX_F(CLK_MOUT_FSYS_MMC_CARD_USER, "mout_fsys_mmc_card_user",
716f392db97SDavid Virag 	      mout_fsys_mmc_card_user_p, PLL_CON0_MUX_CLKCMU_FSYS_MMC_CARD_USER,
717f392db97SDavid Virag 	      4, 1, CLK_SET_RATE_PARENT, 0),
718f392db97SDavid Virag 	MUX_F(CLK_MOUT_FSYS_MMC_EMBD_USER, "mout_fsys_mmc_embd_user",
719f392db97SDavid Virag 	      mout_fsys_mmc_embd_user_p, PLL_CON0_MUX_CLKCMU_FSYS_MMC_EMBD_USER,
720f392db97SDavid Virag 	      4, 1, CLK_SET_RATE_PARENT, 0),
721f392db97SDavid Virag 	MUX_F(CLK_MOUT_FSYS_MMC_SDIO_USER, "mout_fsys_mmc_sdio_user",
722f392db97SDavid Virag 	      mout_fsys_mmc_sdio_user_p, PLL_CON0_MUX_CLKCMU_FSYS_MMC_SDIO_USER,
723f392db97SDavid Virag 	      4, 1, CLK_SET_RATE_PARENT, 0),
724f392db97SDavid Virag 	MUX_F(CLK_MOUT_FSYS_USB30DRD_USER, "mout_fsys_usb30drd_user",
725f392db97SDavid Virag 	      mout_fsys_usb30drd_user_p, PLL_CON0_MUX_CLKCMU_FSYS_USB30DRD_USER,
726f392db97SDavid Virag 	      4, 1, CLK_SET_RATE_PARENT, 0),
727f392db97SDavid Virag };
728f392db97SDavid Virag 
729f392db97SDavid Virag static const struct samsung_gate_clock fsys_gate_clks[] __initconst = {
730f392db97SDavid Virag 	GATE(CLK_GOUT_MMC_CARD_ACLK, "gout_mmc_card_aclk", "mout_fsys_bus_user",
731f392db97SDavid Virag 	     CLK_CON_GAT_GOUT_FSYS_MMC_CARD_I_ACLK, 21, 0, 0),
732f392db97SDavid Virag 	GATE(CLK_GOUT_MMC_CARD_SDCLKIN, "gout_mmc_card_sdclkin",
733f392db97SDavid Virag 	     "mout_fsys_mmc_card_user", CLK_CON_GAT_GOUT_FSYS_MMC_CARD_SDCLKIN,
734f392db97SDavid Virag 	     21, CLK_SET_RATE_PARENT, 0),
735f392db97SDavid Virag 	GATE(CLK_GOUT_MMC_EMBD_ACLK, "gout_mmc_embd_aclk", "mout_fsys_bus_user",
736f392db97SDavid Virag 	     CLK_CON_GAT_GOUT_FSYS_MMC_EMBD_I_ACLK, 21, 0, 0),
737f392db97SDavid Virag 	GATE(CLK_GOUT_MMC_EMBD_SDCLKIN, "gout_mmc_embd_sdclkin",
738f392db97SDavid Virag 	     "mout_fsys_mmc_embd_user", CLK_CON_GAT_GOUT_FSYS_MMC_EMBD_SDCLKIN,
739f392db97SDavid Virag 	     21, CLK_SET_RATE_PARENT, 0),
740f392db97SDavid Virag 	GATE(CLK_GOUT_MMC_SDIO_ACLK, "gout_mmc_sdio_aclk", "mout_fsys_bus_user",
741f392db97SDavid Virag 	     CLK_CON_GAT_GOUT_FSYS_MMC_SDIO_I_ACLK, 21, 0, 0),
742f392db97SDavid Virag 	GATE(CLK_GOUT_MMC_SDIO_SDCLKIN, "gout_mmc_sdio_sdclkin",
743f392db97SDavid Virag 	     "mout_fsys_mmc_sdio_user", CLK_CON_GAT_GOUT_FSYS_MMC_SDIO_SDCLKIN,
744f392db97SDavid Virag 	     21, CLK_SET_RATE_PARENT, 0),
745f392db97SDavid Virag };
746f392db97SDavid Virag 
747f392db97SDavid Virag static const struct samsung_cmu_info fsys_cmu_info __initconst = {
748f392db97SDavid Virag 	.mux_clks		= fsys_mux_clks,
749f392db97SDavid Virag 	.nr_mux_clks		= ARRAY_SIZE(fsys_mux_clks),
750f392db97SDavid Virag 	.gate_clks		= fsys_gate_clks,
751f392db97SDavid Virag 	.nr_gate_clks		= ARRAY_SIZE(fsys_gate_clks),
752ef4923c8SKrzysztof Kozlowski 	.nr_clk_ids		= CLKS_NR_FSYS,
753f392db97SDavid Virag 	.clk_regs		= fsys_clk_regs,
754f392db97SDavid Virag 	.nr_clk_regs		= ARRAY_SIZE(fsys_clk_regs),
755f392db97SDavid Virag 	.clk_name		= "dout_fsys_bus",
756f392db97SDavid Virag };
757f392db97SDavid Virag 
75845bd8166SDavid Virag /* ---- platform_driver ----------------------------------------------------- */
75945bd8166SDavid Virag 
exynos7885_cmu_probe(struct platform_device * pdev)76045bd8166SDavid Virag static int __init exynos7885_cmu_probe(struct platform_device *pdev)
76145bd8166SDavid Virag {
76245bd8166SDavid Virag 	const struct samsung_cmu_info *info;
76345bd8166SDavid Virag 	struct device *dev = &pdev->dev;
76445bd8166SDavid Virag 
76545bd8166SDavid Virag 	info = of_device_get_match_data(dev);
76645bd8166SDavid Virag 	exynos_arm64_register_cmu(dev, dev->of_node, info);
76745bd8166SDavid Virag 
76845bd8166SDavid Virag 	return 0;
76945bd8166SDavid Virag }
77045bd8166SDavid Virag 
77145bd8166SDavid Virag static const struct of_device_id exynos7885_cmu_of_match[] = {
77245bd8166SDavid Virag 	{
77345bd8166SDavid Virag 		.compatible = "samsung,exynos7885-cmu-core",
77445bd8166SDavid Virag 		.data = &core_cmu_info,
77545bd8166SDavid Virag 	}, {
776f392db97SDavid Virag 		.compatible = "samsung,exynos7885-cmu-fsys",
777f392db97SDavid Virag 		.data = &fsys_cmu_info,
778f392db97SDavid Virag 	}, {
77945bd8166SDavid Virag 	},
78045bd8166SDavid Virag };
78145bd8166SDavid Virag 
78245bd8166SDavid Virag static struct platform_driver exynos7885_cmu_driver __refdata = {
78345bd8166SDavid Virag 	.driver	= {
78445bd8166SDavid Virag 		.name = "exynos7885-cmu",
78545bd8166SDavid Virag 		.of_match_table = exynos7885_cmu_of_match,
78645bd8166SDavid Virag 		.suppress_bind_attrs = true,
78745bd8166SDavid Virag 	},
78845bd8166SDavid Virag 	.probe = exynos7885_cmu_probe,
78945bd8166SDavid Virag };
79045bd8166SDavid Virag 
exynos7885_cmu_init(void)79145bd8166SDavid Virag static int __init exynos7885_cmu_init(void)
79245bd8166SDavid Virag {
79345bd8166SDavid Virag 	return platform_driver_register(&exynos7885_cmu_driver);
79445bd8166SDavid Virag }
79545bd8166SDavid Virag core_initcall(exynos7885_cmu_init);
796