18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2013 Tomasz Figa <tomasz.figa at gmail.com>
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Common Clock Framework support for all S3C64xx SoCs.
68c2ecf20Sopenharmony_ci*/
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/slab.h>
98c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
108c2ecf20Sopenharmony_ci#include <linux/clk/samsung.h>
118c2ecf20Sopenharmony_ci#include <linux/of.h>
128c2ecf20Sopenharmony_ci#include <linux/of_address.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <dt-bindings/clock/samsung,s3c64xx-clock.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include "clk.h"
178c2ecf20Sopenharmony_ci#include "clk-pll.h"
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* S3C64xx clock controller register offsets. */
208c2ecf20Sopenharmony_ci#define APLL_LOCK		0x000
218c2ecf20Sopenharmony_ci#define MPLL_LOCK		0x004
228c2ecf20Sopenharmony_ci#define EPLL_LOCK		0x008
238c2ecf20Sopenharmony_ci#define APLL_CON		0x00c
248c2ecf20Sopenharmony_ci#define MPLL_CON		0x010
258c2ecf20Sopenharmony_ci#define EPLL_CON0		0x014
268c2ecf20Sopenharmony_ci#define EPLL_CON1		0x018
278c2ecf20Sopenharmony_ci#define CLK_SRC			0x01c
288c2ecf20Sopenharmony_ci#define CLK_DIV0		0x020
298c2ecf20Sopenharmony_ci#define CLK_DIV1		0x024
308c2ecf20Sopenharmony_ci#define CLK_DIV2		0x028
318c2ecf20Sopenharmony_ci#define HCLK_GATE		0x030
328c2ecf20Sopenharmony_ci#define PCLK_GATE		0x034
338c2ecf20Sopenharmony_ci#define SCLK_GATE		0x038
348c2ecf20Sopenharmony_ci#define MEM0_GATE		0x03c
358c2ecf20Sopenharmony_ci#define CLK_SRC2		0x10c
368c2ecf20Sopenharmony_ci#define OTHERS			0x900
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* Helper macros to define clock arrays. */
398c2ecf20Sopenharmony_ci#define FIXED_RATE_CLOCKS(name)	\
408c2ecf20Sopenharmony_ci		static struct samsung_fixed_rate_clock name[]
418c2ecf20Sopenharmony_ci#define MUX_CLOCKS(name)	\
428c2ecf20Sopenharmony_ci		static struct samsung_mux_clock name[]
438c2ecf20Sopenharmony_ci#define DIV_CLOCKS(name)	\
448c2ecf20Sopenharmony_ci		static struct samsung_div_clock name[]
458c2ecf20Sopenharmony_ci#define GATE_CLOCKS(name)	\
468c2ecf20Sopenharmony_ci		static struct samsung_gate_clock name[]
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* Helper macros for gate types present on S3C64xx. */
498c2ecf20Sopenharmony_ci#define GATE_BUS(_id, cname, pname, o, b) \
508c2ecf20Sopenharmony_ci		GATE(_id, cname, pname, o, b, 0, 0)
518c2ecf20Sopenharmony_ci#define GATE_SCLK(_id, cname, pname, o, b) \
528c2ecf20Sopenharmony_ci		GATE(_id, cname, pname, o, b, CLK_SET_RATE_PARENT, 0)
538c2ecf20Sopenharmony_ci#define GATE_ON(_id, cname, pname, o, b) \
548c2ecf20Sopenharmony_ci		GATE(_id, cname, pname, o, b, CLK_IGNORE_UNUSED, 0)
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cistatic void __iomem *reg_base;
578c2ecf20Sopenharmony_cistatic bool is_s3c6400;
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/*
608c2ecf20Sopenharmony_ci * List of controller registers to be saved and restored during
618c2ecf20Sopenharmony_ci * a suspend/resume cycle.
628c2ecf20Sopenharmony_ci */
638c2ecf20Sopenharmony_cistatic unsigned long s3c64xx_clk_regs[] __initdata = {
648c2ecf20Sopenharmony_ci	APLL_LOCK,
658c2ecf20Sopenharmony_ci	MPLL_LOCK,
668c2ecf20Sopenharmony_ci	EPLL_LOCK,
678c2ecf20Sopenharmony_ci	APLL_CON,
688c2ecf20Sopenharmony_ci	MPLL_CON,
698c2ecf20Sopenharmony_ci	EPLL_CON0,
708c2ecf20Sopenharmony_ci	EPLL_CON1,
718c2ecf20Sopenharmony_ci	CLK_SRC,
728c2ecf20Sopenharmony_ci	CLK_DIV0,
738c2ecf20Sopenharmony_ci	CLK_DIV1,
748c2ecf20Sopenharmony_ci	CLK_DIV2,
758c2ecf20Sopenharmony_ci	HCLK_GATE,
768c2ecf20Sopenharmony_ci	PCLK_GATE,
778c2ecf20Sopenharmony_ci	SCLK_GATE,
788c2ecf20Sopenharmony_ci};
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_cistatic unsigned long s3c6410_clk_regs[] __initdata = {
818c2ecf20Sopenharmony_ci	CLK_SRC2,
828c2ecf20Sopenharmony_ci	MEM0_GATE,
838c2ecf20Sopenharmony_ci};
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* List of parent clocks common for all S3C64xx SoCs. */
868c2ecf20Sopenharmony_ciPNAME(spi_mmc_p)	= { "mout_epll", "dout_mpll", "fin_pll", "clk27m" };
878c2ecf20Sopenharmony_ciPNAME(uart_p)		= { "mout_epll", "dout_mpll" };
888c2ecf20Sopenharmony_ciPNAME(audio0_p)		= { "mout_epll", "dout_mpll", "fin_pll", "iiscdclk0",
898c2ecf20Sopenharmony_ci				"pcmcdclk0", "none", "none", "none" };
908c2ecf20Sopenharmony_ciPNAME(audio1_p)		= { "mout_epll", "dout_mpll", "fin_pll", "iiscdclk1",
918c2ecf20Sopenharmony_ci				"pcmcdclk0", "none", "none", "none" };
928c2ecf20Sopenharmony_ciPNAME(mfc_p)		= { "hclkx2", "mout_epll" };
938c2ecf20Sopenharmony_ciPNAME(apll_p)		= { "fin_pll", "fout_apll" };
948c2ecf20Sopenharmony_ciPNAME(mpll_p)		= { "fin_pll", "fout_mpll" };
958c2ecf20Sopenharmony_ciPNAME(epll_p)		= { "fin_pll", "fout_epll" };
968c2ecf20Sopenharmony_ciPNAME(hclkx2_p)		= { "mout_mpll", "mout_apll" };
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/* S3C6400-specific parent clocks. */
998c2ecf20Sopenharmony_ciPNAME(scaler_lcd_p6400)	= { "mout_epll", "dout_mpll", "none", "none" };
1008c2ecf20Sopenharmony_ciPNAME(irda_p6400)	= { "mout_epll", "dout_mpll", "none", "clk48m" };
1018c2ecf20Sopenharmony_ciPNAME(uhost_p6400)	= { "clk48m", "mout_epll", "dout_mpll", "none" };
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/* S3C6410-specific parent clocks. */
1048c2ecf20Sopenharmony_ciPNAME(clk27_p6410)	= { "clk27m", "fin_pll" };
1058c2ecf20Sopenharmony_ciPNAME(scaler_lcd_p6410)	= { "mout_epll", "dout_mpll", "fin_pll", "none" };
1068c2ecf20Sopenharmony_ciPNAME(irda_p6410)	= { "mout_epll", "dout_mpll", "fin_pll", "clk48m" };
1078c2ecf20Sopenharmony_ciPNAME(uhost_p6410)	= { "clk48m", "mout_epll", "dout_mpll", "fin_pll" };
1088c2ecf20Sopenharmony_ciPNAME(audio2_p6410)	= { "mout_epll", "dout_mpll", "fin_pll", "iiscdclk2",
1098c2ecf20Sopenharmony_ci				"pcmcdclk1", "none", "none", "none" };
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci/* Fixed rate clocks generated outside the SoC. */
1128c2ecf20Sopenharmony_ciFIXED_RATE_CLOCKS(s3c64xx_fixed_rate_ext_clks) __initdata = {
1138c2ecf20Sopenharmony_ci	FRATE(0, "fin_pll", NULL, 0, 0),
1148c2ecf20Sopenharmony_ci	FRATE(0, "xusbxti", NULL, 0, 0),
1158c2ecf20Sopenharmony_ci};
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci/* Fixed rate clocks generated inside the SoC. */
1188c2ecf20Sopenharmony_ciFIXED_RATE_CLOCKS(s3c64xx_fixed_rate_clks) __initdata = {
1198c2ecf20Sopenharmony_ci	FRATE(CLK27M, "clk27m", NULL, 0, 27000000),
1208c2ecf20Sopenharmony_ci	FRATE(CLK48M, "clk48m", NULL, 0, 48000000),
1218c2ecf20Sopenharmony_ci};
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/* List of clock muxes present on all S3C64xx SoCs. */
1248c2ecf20Sopenharmony_ciMUX_CLOCKS(s3c64xx_mux_clks) __initdata = {
1258c2ecf20Sopenharmony_ci	MUX_F(0, "mout_syncmux", hclkx2_p, OTHERS, 6, 1, 0, CLK_MUX_READ_ONLY),
1268c2ecf20Sopenharmony_ci	MUX(MOUT_APLL, "mout_apll", apll_p, CLK_SRC, 0, 1),
1278c2ecf20Sopenharmony_ci	MUX(MOUT_MPLL, "mout_mpll", mpll_p, CLK_SRC, 1, 1),
1288c2ecf20Sopenharmony_ci	MUX(MOUT_EPLL, "mout_epll", epll_p, CLK_SRC, 2, 1),
1298c2ecf20Sopenharmony_ci	MUX(MOUT_MFC, "mout_mfc", mfc_p, CLK_SRC, 4, 1),
1308c2ecf20Sopenharmony_ci	MUX(MOUT_AUDIO0, "mout_audio0", audio0_p, CLK_SRC, 7, 3),
1318c2ecf20Sopenharmony_ci	MUX(MOUT_AUDIO1, "mout_audio1", audio1_p, CLK_SRC, 10, 3),
1328c2ecf20Sopenharmony_ci	MUX(MOUT_UART, "mout_uart", uart_p, CLK_SRC, 13, 1),
1338c2ecf20Sopenharmony_ci	MUX(MOUT_SPI0, "mout_spi0", spi_mmc_p, CLK_SRC, 14, 2),
1348c2ecf20Sopenharmony_ci	MUX(MOUT_SPI1, "mout_spi1", spi_mmc_p, CLK_SRC, 16, 2),
1358c2ecf20Sopenharmony_ci	MUX(MOUT_MMC0, "mout_mmc0", spi_mmc_p, CLK_SRC, 18, 2),
1368c2ecf20Sopenharmony_ci	MUX(MOUT_MMC1, "mout_mmc1", spi_mmc_p, CLK_SRC, 20, 2),
1378c2ecf20Sopenharmony_ci	MUX(MOUT_MMC2, "mout_mmc2", spi_mmc_p, CLK_SRC, 22, 2),
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci/* List of clock muxes present on S3C6400. */
1418c2ecf20Sopenharmony_ciMUX_CLOCKS(s3c6400_mux_clks) __initdata = {
1428c2ecf20Sopenharmony_ci	MUX(MOUT_UHOST, "mout_uhost", uhost_p6400, CLK_SRC, 5, 2),
1438c2ecf20Sopenharmony_ci	MUX(MOUT_IRDA, "mout_irda", irda_p6400, CLK_SRC, 24, 2),
1448c2ecf20Sopenharmony_ci	MUX(MOUT_LCD, "mout_lcd", scaler_lcd_p6400, CLK_SRC, 26, 2),
1458c2ecf20Sopenharmony_ci	MUX(MOUT_SCALER, "mout_scaler", scaler_lcd_p6400, CLK_SRC, 28, 2),
1468c2ecf20Sopenharmony_ci};
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci/* List of clock muxes present on S3C6410. */
1498c2ecf20Sopenharmony_ciMUX_CLOCKS(s3c6410_mux_clks) __initdata = {
1508c2ecf20Sopenharmony_ci	MUX(MOUT_UHOST, "mout_uhost", uhost_p6410, CLK_SRC, 5, 2),
1518c2ecf20Sopenharmony_ci	MUX(MOUT_IRDA, "mout_irda", irda_p6410, CLK_SRC, 24, 2),
1528c2ecf20Sopenharmony_ci	MUX(MOUT_LCD, "mout_lcd", scaler_lcd_p6410, CLK_SRC, 26, 2),
1538c2ecf20Sopenharmony_ci	MUX(MOUT_SCALER, "mout_scaler", scaler_lcd_p6410, CLK_SRC, 28, 2),
1548c2ecf20Sopenharmony_ci	MUX(MOUT_DAC27, "mout_dac27", clk27_p6410, CLK_SRC, 30, 1),
1558c2ecf20Sopenharmony_ci	MUX(MOUT_TV27, "mout_tv27", clk27_p6410, CLK_SRC, 31, 1),
1568c2ecf20Sopenharmony_ci	MUX(MOUT_AUDIO2, "mout_audio2", audio2_p6410, CLK_SRC2, 0, 3),
1578c2ecf20Sopenharmony_ci};
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/* List of clock dividers present on all S3C64xx SoCs. */
1608c2ecf20Sopenharmony_ciDIV_CLOCKS(s3c64xx_div_clks) __initdata = {
1618c2ecf20Sopenharmony_ci	DIV(DOUT_MPLL, "dout_mpll", "mout_mpll", CLK_DIV0, 4, 1),
1628c2ecf20Sopenharmony_ci	DIV(HCLKX2, "hclkx2", "mout_syncmux", CLK_DIV0, 9, 3),
1638c2ecf20Sopenharmony_ci	DIV(HCLK, "hclk", "hclkx2", CLK_DIV0, 8, 1),
1648c2ecf20Sopenharmony_ci	DIV(PCLK, "pclk", "hclkx2", CLK_DIV0, 12, 4),
1658c2ecf20Sopenharmony_ci	DIV(DOUT_SECUR, "dout_secur", "hclkx2", CLK_DIV0, 18, 2),
1668c2ecf20Sopenharmony_ci	DIV(DOUT_CAM, "dout_cam", "hclkx2", CLK_DIV0, 20, 4),
1678c2ecf20Sopenharmony_ci	DIV(DOUT_JPEG, "dout_jpeg", "hclkx2", CLK_DIV0, 24, 4),
1688c2ecf20Sopenharmony_ci	DIV(DOUT_MFC, "dout_mfc", "mout_mfc", CLK_DIV0, 28, 4),
1698c2ecf20Sopenharmony_ci	DIV(DOUT_MMC0, "dout_mmc0", "mout_mmc0", CLK_DIV1, 0, 4),
1708c2ecf20Sopenharmony_ci	DIV(DOUT_MMC1, "dout_mmc1", "mout_mmc1", CLK_DIV1, 4, 4),
1718c2ecf20Sopenharmony_ci	DIV(DOUT_MMC2, "dout_mmc2", "mout_mmc2", CLK_DIV1, 8, 4),
1728c2ecf20Sopenharmony_ci	DIV(DOUT_LCD, "dout_lcd", "mout_lcd", CLK_DIV1, 12, 4),
1738c2ecf20Sopenharmony_ci	DIV(DOUT_SCALER, "dout_scaler", "mout_scaler", CLK_DIV1, 16, 4),
1748c2ecf20Sopenharmony_ci	DIV(DOUT_UHOST, "dout_uhost", "mout_uhost", CLK_DIV1, 20, 4),
1758c2ecf20Sopenharmony_ci	DIV(DOUT_SPI0, "dout_spi0", "mout_spi0", CLK_DIV2, 0, 4),
1768c2ecf20Sopenharmony_ci	DIV(DOUT_SPI1, "dout_spi1", "mout_spi1", CLK_DIV2, 4, 4),
1778c2ecf20Sopenharmony_ci	DIV(DOUT_AUDIO0, "dout_audio0", "mout_audio0", CLK_DIV2, 8, 4),
1788c2ecf20Sopenharmony_ci	DIV(DOUT_AUDIO1, "dout_audio1", "mout_audio1", CLK_DIV2, 12, 4),
1798c2ecf20Sopenharmony_ci	DIV(DOUT_UART, "dout_uart", "mout_uart", CLK_DIV2, 16, 4),
1808c2ecf20Sopenharmony_ci	DIV(DOUT_IRDA, "dout_irda", "mout_irda", CLK_DIV2, 20, 4),
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* List of clock dividers present on S3C6400. */
1848c2ecf20Sopenharmony_ciDIV_CLOCKS(s3c6400_div_clks) __initdata = {
1858c2ecf20Sopenharmony_ci	DIV(ARMCLK, "armclk", "mout_apll", CLK_DIV0, 0, 3),
1868c2ecf20Sopenharmony_ci};
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci/* List of clock dividers present on S3C6410. */
1898c2ecf20Sopenharmony_ciDIV_CLOCKS(s3c6410_div_clks) __initdata = {
1908c2ecf20Sopenharmony_ci	DIV(ARMCLK, "armclk", "mout_apll", CLK_DIV0, 0, 4),
1918c2ecf20Sopenharmony_ci	DIV(DOUT_FIMC, "dout_fimc", "hclk", CLK_DIV1, 24, 4),
1928c2ecf20Sopenharmony_ci	DIV(DOUT_AUDIO2, "dout_audio2", "mout_audio2", CLK_DIV2, 24, 4),
1938c2ecf20Sopenharmony_ci};
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci/* List of clock gates present on all S3C64xx SoCs. */
1968c2ecf20Sopenharmony_ciGATE_CLOCKS(s3c64xx_gate_clks) __initdata = {
1978c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_UHOST, "hclk_uhost", "hclk", HCLK_GATE, 29),
1988c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_SECUR, "hclk_secur", "hclk", HCLK_GATE, 28),
1998c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_SDMA1, "hclk_sdma1", "hclk", HCLK_GATE, 27),
2008c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_SDMA0, "hclk_sdma0", "hclk", HCLK_GATE, 26),
2018c2ecf20Sopenharmony_ci	GATE_ON(HCLK_DDR1, "hclk_ddr1", "hclk", HCLK_GATE, 24),
2028c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_USB, "hclk_usb", "hclk", HCLK_GATE, 20),
2038c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_HSMMC2, "hclk_hsmmc2", "hclk", HCLK_GATE, 19),
2048c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_HSMMC1, "hclk_hsmmc1", "hclk", HCLK_GATE, 18),
2058c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_HSMMC0, "hclk_hsmmc0", "hclk", HCLK_GATE, 17),
2068c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_MDP, "hclk_mdp", "hclk", HCLK_GATE, 16),
2078c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_DHOST, "hclk_dhost", "hclk", HCLK_GATE, 15),
2088c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_IHOST, "hclk_ihost", "hclk", HCLK_GATE, 14),
2098c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_DMA1, "hclk_dma1", "hclk", HCLK_GATE, 13),
2108c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_DMA0, "hclk_dma0", "hclk", HCLK_GATE, 12),
2118c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_JPEG, "hclk_jpeg", "hclk", HCLK_GATE, 11),
2128c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_CAMIF, "hclk_camif", "hclk", HCLK_GATE, 10),
2138c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_SCALER, "hclk_scaler", "hclk", HCLK_GATE, 9),
2148c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_2D, "hclk_2d", "hclk", HCLK_GATE, 8),
2158c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_TV, "hclk_tv", "hclk", HCLK_GATE, 7),
2168c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_POST0, "hclk_post0", "hclk", HCLK_GATE, 5),
2178c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_ROT, "hclk_rot", "hclk", HCLK_GATE, 4),
2188c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_LCD, "hclk_lcd", "hclk", HCLK_GATE, 3),
2198c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_TZIC, "hclk_tzic", "hclk", HCLK_GATE, 2),
2208c2ecf20Sopenharmony_ci	GATE_ON(HCLK_INTC, "hclk_intc", "hclk", HCLK_GATE, 1),
2218c2ecf20Sopenharmony_ci	GATE_ON(PCLK_SKEY, "pclk_skey", "pclk", PCLK_GATE, 24),
2228c2ecf20Sopenharmony_ci	GATE_ON(PCLK_CHIPID, "pclk_chipid", "pclk", PCLK_GATE, 23),
2238c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_SPI1, "pclk_spi1", "pclk", PCLK_GATE, 22),
2248c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_SPI0, "pclk_spi0", "pclk", PCLK_GATE, 21),
2258c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_HSIRX, "pclk_hsirx", "pclk", PCLK_GATE, 20),
2268c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_HSITX, "pclk_hsitx", "pclk", PCLK_GATE, 19),
2278c2ecf20Sopenharmony_ci	GATE_ON(PCLK_GPIO, "pclk_gpio", "pclk", PCLK_GATE, 18),
2288c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_IIC0, "pclk_iic0", "pclk", PCLK_GATE, 17),
2298c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_IIS1, "pclk_iis1", "pclk", PCLK_GATE, 16),
2308c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_IIS0, "pclk_iis0", "pclk", PCLK_GATE, 15),
2318c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_AC97, "pclk_ac97", "pclk", PCLK_GATE, 14),
2328c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_TZPC, "pclk_tzpc", "pclk", PCLK_GATE, 13),
2338c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_TSADC, "pclk_tsadc", "pclk", PCLK_GATE, 12),
2348c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_KEYPAD, "pclk_keypad", "pclk", PCLK_GATE, 11),
2358c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_IRDA, "pclk_irda", "pclk", PCLK_GATE, 10),
2368c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_PCM1, "pclk_pcm1", "pclk", PCLK_GATE, 9),
2378c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_PCM0, "pclk_pcm0", "pclk", PCLK_GATE, 8),
2388c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_PWM, "pclk_pwm", "pclk", PCLK_GATE, 7),
2398c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_RTC, "pclk_rtc", "pclk", PCLK_GATE, 6),
2408c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_WDT, "pclk_wdt", "pclk", PCLK_GATE, 5),
2418c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_UART3, "pclk_uart3", "pclk", PCLK_GATE, 4),
2428c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_UART2, "pclk_uart2", "pclk", PCLK_GATE, 3),
2438c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_UART1, "pclk_uart1", "pclk", PCLK_GATE, 2),
2448c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_UART0, "pclk_uart0", "pclk", PCLK_GATE, 1),
2458c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_MFC, "pclk_mfc", "pclk", PCLK_GATE, 0),
2468c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_UHOST, "sclk_uhost", "dout_uhost", SCLK_GATE, 30),
2478c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_MMC2_48, "sclk_mmc2_48", "clk48m", SCLK_GATE, 29),
2488c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_MMC1_48, "sclk_mmc1_48", "clk48m", SCLK_GATE, 28),
2498c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_MMC0_48, "sclk_mmc0_48", "clk48m", SCLK_GATE, 27),
2508c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_MMC2, "sclk_mmc2", "dout_mmc2", SCLK_GATE, 26),
2518c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_MMC1, "sclk_mmc1", "dout_mmc1", SCLK_GATE, 25),
2528c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_MMC0, "sclk_mmc0", "dout_mmc0", SCLK_GATE, 24),
2538c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_SPI1_48, "sclk_spi1_48", "clk48m", SCLK_GATE, 23),
2548c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_SPI0_48, "sclk_spi0_48", "clk48m", SCLK_GATE, 22),
2558c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_SPI1, "sclk_spi1", "dout_spi1", SCLK_GATE, 21),
2568c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_SPI0, "sclk_spi0", "dout_spi0", SCLK_GATE, 20),
2578c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_DAC27, "sclk_dac27", "mout_dac27", SCLK_GATE, 19),
2588c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_TV27, "sclk_tv27", "mout_tv27", SCLK_GATE, 18),
2598c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_SCALER27, "sclk_scaler27", "clk27m", SCLK_GATE, 17),
2608c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_SCALER, "sclk_scaler", "dout_scaler", SCLK_GATE, 16),
2618c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_LCD27, "sclk_lcd27", "clk27m", SCLK_GATE, 15),
2628c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_LCD, "sclk_lcd", "dout_lcd", SCLK_GATE, 14),
2638c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_POST0_27, "sclk_post0_27", "clk27m", SCLK_GATE, 12),
2648c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_POST0, "sclk_post0", "dout_lcd", SCLK_GATE, 10),
2658c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_AUDIO1, "sclk_audio1", "dout_audio1", SCLK_GATE, 9),
2668c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_AUDIO0, "sclk_audio0", "dout_audio0", SCLK_GATE, 8),
2678c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_SECUR, "sclk_secur", "dout_secur", SCLK_GATE, 7),
2688c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_IRDA, "sclk_irda", "dout_irda", SCLK_GATE, 6),
2698c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_UART, "sclk_uart", "dout_uart", SCLK_GATE, 5),
2708c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_MFC, "sclk_mfc", "dout_mfc", SCLK_GATE, 3),
2718c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_CAM, "sclk_cam", "dout_cam", SCLK_GATE, 2),
2728c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_JPEG, "sclk_jpeg", "dout_jpeg", SCLK_GATE, 1),
2738c2ecf20Sopenharmony_ci};
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci/* List of clock gates present on S3C6400. */
2768c2ecf20Sopenharmony_ciGATE_CLOCKS(s3c6400_gate_clks) __initdata = {
2778c2ecf20Sopenharmony_ci	GATE_ON(HCLK_DDR0, "hclk_ddr0", "hclk", HCLK_GATE, 23),
2788c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_ONENAND, "sclk_onenand", "parent", SCLK_GATE, 4),
2798c2ecf20Sopenharmony_ci};
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci/* List of clock gates present on S3C6410. */
2828c2ecf20Sopenharmony_ciGATE_CLOCKS(s3c6410_gate_clks) __initdata = {
2838c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_3DSE, "hclk_3dse", "hclk", HCLK_GATE, 31),
2848c2ecf20Sopenharmony_ci	GATE_ON(HCLK_IROM, "hclk_irom", "hclk", HCLK_GATE, 25),
2858c2ecf20Sopenharmony_ci	GATE_ON(HCLK_MEM1, "hclk_mem1", "hclk", HCLK_GATE, 22),
2868c2ecf20Sopenharmony_ci	GATE_ON(HCLK_MEM0, "hclk_mem0", "hclk", HCLK_GATE, 21),
2878c2ecf20Sopenharmony_ci	GATE_BUS(HCLK_MFC, "hclk_mfc", "hclk", HCLK_GATE, 0),
2888c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_IIC1, "pclk_iic1", "pclk", PCLK_GATE, 27),
2898c2ecf20Sopenharmony_ci	GATE_BUS(PCLK_IIS2, "pclk_iis2", "pclk", PCLK_GATE, 26),
2908c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_FIMC, "sclk_fimc", "dout_fimc", SCLK_GATE, 13),
2918c2ecf20Sopenharmony_ci	GATE_SCLK(SCLK_AUDIO2, "sclk_audio2", "dout_audio2", SCLK_GATE, 11),
2928c2ecf20Sopenharmony_ci	GATE_BUS(MEM0_CFCON, "mem0_cfcon", "hclk_mem0", MEM0_GATE, 5),
2938c2ecf20Sopenharmony_ci	GATE_BUS(MEM0_ONENAND1, "mem0_onenand1", "hclk_mem0", MEM0_GATE, 4),
2948c2ecf20Sopenharmony_ci	GATE_BUS(MEM0_ONENAND0, "mem0_onenand0", "hclk_mem0", MEM0_GATE, 3),
2958c2ecf20Sopenharmony_ci	GATE_BUS(MEM0_NFCON, "mem0_nfcon", "hclk_mem0", MEM0_GATE, 2),
2968c2ecf20Sopenharmony_ci	GATE_ON(MEM0_SROM, "mem0_srom", "hclk_mem0", MEM0_GATE, 1),
2978c2ecf20Sopenharmony_ci};
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci/* List of PLL clocks. */
3008c2ecf20Sopenharmony_cistatic struct samsung_pll_clock s3c64xx_pll_clks[] __initdata = {
3018c2ecf20Sopenharmony_ci	PLL(pll_6552, FOUT_APLL, "fout_apll", "fin_pll",
3028c2ecf20Sopenharmony_ci					APLL_LOCK, APLL_CON, NULL),
3038c2ecf20Sopenharmony_ci	PLL(pll_6552, FOUT_MPLL, "fout_mpll", "fin_pll",
3048c2ecf20Sopenharmony_ci					MPLL_LOCK, MPLL_CON, NULL),
3058c2ecf20Sopenharmony_ci	PLL(pll_6553, FOUT_EPLL, "fout_epll", "fin_pll",
3068c2ecf20Sopenharmony_ci					EPLL_LOCK, EPLL_CON0, NULL),
3078c2ecf20Sopenharmony_ci};
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci/* Aliases for common s3c64xx clocks. */
3108c2ecf20Sopenharmony_cistatic struct samsung_clock_alias s3c64xx_clock_aliases[] = {
3118c2ecf20Sopenharmony_ci	ALIAS(FOUT_APLL, NULL, "fout_apll"),
3128c2ecf20Sopenharmony_ci	ALIAS(FOUT_MPLL, NULL, "fout_mpll"),
3138c2ecf20Sopenharmony_ci	ALIAS(FOUT_EPLL, NULL, "fout_epll"),
3148c2ecf20Sopenharmony_ci	ALIAS(MOUT_EPLL, NULL, "mout_epll"),
3158c2ecf20Sopenharmony_ci	ALIAS(DOUT_MPLL, NULL, "dout_mpll"),
3168c2ecf20Sopenharmony_ci	ALIAS(HCLKX2, NULL, "hclk2"),
3178c2ecf20Sopenharmony_ci	ALIAS(HCLK, NULL, "hclk"),
3188c2ecf20Sopenharmony_ci	ALIAS(PCLK, NULL, "pclk"),
3198c2ecf20Sopenharmony_ci	ALIAS(PCLK, NULL, "clk_uart_baud2"),
3208c2ecf20Sopenharmony_ci	ALIAS(ARMCLK, NULL, "armclk"),
3218c2ecf20Sopenharmony_ci	ALIAS(HCLK_UHOST, "s3c2410-ohci", "usb-host"),
3228c2ecf20Sopenharmony_ci	ALIAS(HCLK_USB, "s3c-hsotg", "otg"),
3238c2ecf20Sopenharmony_ci	ALIAS(HCLK_HSMMC2, "s3c-sdhci.2", "hsmmc"),
3248c2ecf20Sopenharmony_ci	ALIAS(HCLK_HSMMC2, "s3c-sdhci.2", "mmc_busclk.0"),
3258c2ecf20Sopenharmony_ci	ALIAS(HCLK_HSMMC1, "s3c-sdhci.1", "hsmmc"),
3268c2ecf20Sopenharmony_ci	ALIAS(HCLK_HSMMC1, "s3c-sdhci.1", "mmc_busclk.0"),
3278c2ecf20Sopenharmony_ci	ALIAS(HCLK_HSMMC0, "s3c-sdhci.0", "hsmmc"),
3288c2ecf20Sopenharmony_ci	ALIAS(HCLK_HSMMC0, "s3c-sdhci.0", "mmc_busclk.0"),
3298c2ecf20Sopenharmony_ci	ALIAS(HCLK_DMA1, "dma-pl080s.1", "apb_pclk"),
3308c2ecf20Sopenharmony_ci	ALIAS(HCLK_DMA0, "dma-pl080s.0", "apb_pclk"),
3318c2ecf20Sopenharmony_ci	ALIAS(HCLK_CAMIF, "s3c-camif", "camif"),
3328c2ecf20Sopenharmony_ci	ALIAS(HCLK_LCD, "s3c-fb", "lcd"),
3338c2ecf20Sopenharmony_ci	ALIAS(PCLK_SPI1, "s3c6410-spi.1", "spi"),
3348c2ecf20Sopenharmony_ci	ALIAS(PCLK_SPI0, "s3c6410-spi.0", "spi"),
3358c2ecf20Sopenharmony_ci	ALIAS(PCLK_IIC0, "s3c2440-i2c.0", "i2c"),
3368c2ecf20Sopenharmony_ci	ALIAS(PCLK_IIS1, "samsung-i2s.1", "iis"),
3378c2ecf20Sopenharmony_ci	ALIAS(PCLK_IIS0, "samsung-i2s.0", "iis"),
3388c2ecf20Sopenharmony_ci	ALIAS(PCLK_AC97, "samsung-ac97", "ac97"),
3398c2ecf20Sopenharmony_ci	ALIAS(PCLK_TSADC, "s3c64xx-adc", "adc"),
3408c2ecf20Sopenharmony_ci	ALIAS(PCLK_KEYPAD, "samsung-keypad", "keypad"),
3418c2ecf20Sopenharmony_ci	ALIAS(PCLK_PCM1, "samsung-pcm.1", "pcm"),
3428c2ecf20Sopenharmony_ci	ALIAS(PCLK_PCM0, "samsung-pcm.0", "pcm"),
3438c2ecf20Sopenharmony_ci	ALIAS(PCLK_PWM, NULL, "timers"),
3448c2ecf20Sopenharmony_ci	ALIAS(PCLK_RTC, "s3c64xx-rtc", "rtc"),
3458c2ecf20Sopenharmony_ci	ALIAS(PCLK_WDT, NULL, "watchdog"),
3468c2ecf20Sopenharmony_ci	ALIAS(PCLK_UART3, "s3c6400-uart.3", "uart"),
3478c2ecf20Sopenharmony_ci	ALIAS(PCLK_UART2, "s3c6400-uart.2", "uart"),
3488c2ecf20Sopenharmony_ci	ALIAS(PCLK_UART1, "s3c6400-uart.1", "uart"),
3498c2ecf20Sopenharmony_ci	ALIAS(PCLK_UART0, "s3c6400-uart.0", "uart"),
3508c2ecf20Sopenharmony_ci	ALIAS(SCLK_UHOST, "s3c2410-ohci", "usb-bus-host"),
3518c2ecf20Sopenharmony_ci	ALIAS(SCLK_MMC2, "s3c-sdhci.2", "mmc_busclk.2"),
3528c2ecf20Sopenharmony_ci	ALIAS(SCLK_MMC1, "s3c-sdhci.1", "mmc_busclk.2"),
3538c2ecf20Sopenharmony_ci	ALIAS(SCLK_MMC0, "s3c-sdhci.0", "mmc_busclk.2"),
3548c2ecf20Sopenharmony_ci	ALIAS(PCLK_SPI1, "s3c6410-spi.1", "spi_busclk0"),
3558c2ecf20Sopenharmony_ci	ALIAS(SCLK_SPI1, "s3c6410-spi.1", "spi_busclk2"),
3568c2ecf20Sopenharmony_ci	ALIAS(PCLK_SPI0, "s3c6410-spi.0", "spi_busclk0"),
3578c2ecf20Sopenharmony_ci	ALIAS(SCLK_SPI0, "s3c6410-spi.0", "spi_busclk2"),
3588c2ecf20Sopenharmony_ci	ALIAS(SCLK_AUDIO1, "samsung-pcm.1", "audio-bus"),
3598c2ecf20Sopenharmony_ci	ALIAS(SCLK_AUDIO1, "samsung-i2s.1", "audio-bus"),
3608c2ecf20Sopenharmony_ci	ALIAS(SCLK_AUDIO0, "samsung-pcm.0", "audio-bus"),
3618c2ecf20Sopenharmony_ci	ALIAS(SCLK_AUDIO0, "samsung-i2s.0", "audio-bus"),
3628c2ecf20Sopenharmony_ci	ALIAS(SCLK_UART, NULL, "clk_uart_baud3"),
3638c2ecf20Sopenharmony_ci	ALIAS(SCLK_CAM, "s3c-camif", "camera"),
3648c2ecf20Sopenharmony_ci};
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci/* Aliases for s3c6400-specific clocks. */
3678c2ecf20Sopenharmony_cistatic struct samsung_clock_alias s3c6400_clock_aliases[] = {
3688c2ecf20Sopenharmony_ci	/* Nothing to place here yet. */
3698c2ecf20Sopenharmony_ci};
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci/* Aliases for s3c6410-specific clocks. */
3728c2ecf20Sopenharmony_cistatic struct samsung_clock_alias s3c6410_clock_aliases[] = {
3738c2ecf20Sopenharmony_ci	ALIAS(PCLK_IIC1, "s3c2440-i2c.1", "i2c"),
3748c2ecf20Sopenharmony_ci	ALIAS(PCLK_IIS2, "samsung-i2s.2", "iis"),
3758c2ecf20Sopenharmony_ci	ALIAS(SCLK_FIMC, "s3c-camif", "fimc"),
3768c2ecf20Sopenharmony_ci	ALIAS(SCLK_AUDIO2, "samsung-i2s.2", "audio-bus"),
3778c2ecf20Sopenharmony_ci	ALIAS(MEM0_SROM, NULL, "srom"),
3788c2ecf20Sopenharmony_ci};
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_cistatic void __init s3c64xx_clk_register_fixed_ext(
3818c2ecf20Sopenharmony_ci				struct samsung_clk_provider *ctx,
3828c2ecf20Sopenharmony_ci				unsigned long fin_pll_f,
3838c2ecf20Sopenharmony_ci				unsigned long xusbxti_f)
3848c2ecf20Sopenharmony_ci{
3858c2ecf20Sopenharmony_ci	s3c64xx_fixed_rate_ext_clks[0].fixed_rate = fin_pll_f;
3868c2ecf20Sopenharmony_ci	s3c64xx_fixed_rate_ext_clks[1].fixed_rate = xusbxti_f;
3878c2ecf20Sopenharmony_ci	samsung_clk_register_fixed_rate(ctx, s3c64xx_fixed_rate_ext_clks,
3888c2ecf20Sopenharmony_ci				ARRAY_SIZE(s3c64xx_fixed_rate_ext_clks));
3898c2ecf20Sopenharmony_ci}
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci/* Register s3c64xx clocks. */
3928c2ecf20Sopenharmony_civoid __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
3938c2ecf20Sopenharmony_ci			     unsigned long xusbxti_f, bool s3c6400,
3948c2ecf20Sopenharmony_ci			     void __iomem *base)
3958c2ecf20Sopenharmony_ci{
3968c2ecf20Sopenharmony_ci	struct samsung_clk_provider *ctx;
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci	reg_base = base;
3998c2ecf20Sopenharmony_ci	is_s3c6400 = s3c6400;
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci	if (np) {
4028c2ecf20Sopenharmony_ci		reg_base = of_iomap(np, 0);
4038c2ecf20Sopenharmony_ci		if (!reg_base)
4048c2ecf20Sopenharmony_ci			panic("%s: failed to map registers\n", __func__);
4058c2ecf20Sopenharmony_ci	}
4068c2ecf20Sopenharmony_ci
4078c2ecf20Sopenharmony_ci	ctx = samsung_clk_init(np, reg_base, NR_CLKS);
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci	/* Register external clocks. */
4108c2ecf20Sopenharmony_ci	if (!np)
4118c2ecf20Sopenharmony_ci		s3c64xx_clk_register_fixed_ext(ctx, xtal_f, xusbxti_f);
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ci	/* Register PLLs. */
4148c2ecf20Sopenharmony_ci	samsung_clk_register_pll(ctx, s3c64xx_pll_clks,
4158c2ecf20Sopenharmony_ci				ARRAY_SIZE(s3c64xx_pll_clks), reg_base);
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_ci	/* Register common internal clocks. */
4188c2ecf20Sopenharmony_ci	samsung_clk_register_fixed_rate(ctx, s3c64xx_fixed_rate_clks,
4198c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c64xx_fixed_rate_clks));
4208c2ecf20Sopenharmony_ci	samsung_clk_register_mux(ctx, s3c64xx_mux_clks,
4218c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c64xx_mux_clks));
4228c2ecf20Sopenharmony_ci	samsung_clk_register_div(ctx, s3c64xx_div_clks,
4238c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c64xx_div_clks));
4248c2ecf20Sopenharmony_ci	samsung_clk_register_gate(ctx, s3c64xx_gate_clks,
4258c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c64xx_gate_clks));
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci	/* Register SoC-specific clocks. */
4288c2ecf20Sopenharmony_ci	if (is_s3c6400) {
4298c2ecf20Sopenharmony_ci		samsung_clk_register_mux(ctx, s3c6400_mux_clks,
4308c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c6400_mux_clks));
4318c2ecf20Sopenharmony_ci		samsung_clk_register_div(ctx, s3c6400_div_clks,
4328c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c6400_div_clks));
4338c2ecf20Sopenharmony_ci		samsung_clk_register_gate(ctx, s3c6400_gate_clks,
4348c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c6400_gate_clks));
4358c2ecf20Sopenharmony_ci		samsung_clk_register_alias(ctx, s3c6400_clock_aliases,
4368c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c6400_clock_aliases));
4378c2ecf20Sopenharmony_ci	} else {
4388c2ecf20Sopenharmony_ci		samsung_clk_register_mux(ctx, s3c6410_mux_clks,
4398c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c6410_mux_clks));
4408c2ecf20Sopenharmony_ci		samsung_clk_register_div(ctx, s3c6410_div_clks,
4418c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c6410_div_clks));
4428c2ecf20Sopenharmony_ci		samsung_clk_register_gate(ctx, s3c6410_gate_clks,
4438c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c6410_gate_clks));
4448c2ecf20Sopenharmony_ci		samsung_clk_register_alias(ctx, s3c6410_clock_aliases,
4458c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c6410_clock_aliases));
4468c2ecf20Sopenharmony_ci	}
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci	samsung_clk_register_alias(ctx, s3c64xx_clock_aliases,
4498c2ecf20Sopenharmony_ci					ARRAY_SIZE(s3c64xx_clock_aliases));
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci	samsung_clk_sleep_init(reg_base, s3c64xx_clk_regs,
4528c2ecf20Sopenharmony_ci			       ARRAY_SIZE(s3c64xx_clk_regs));
4538c2ecf20Sopenharmony_ci	if (!is_s3c6400)
4548c2ecf20Sopenharmony_ci		samsung_clk_sleep_init(reg_base, s3c6410_clk_regs,
4558c2ecf20Sopenharmony_ci				       ARRAY_SIZE(s3c6410_clk_regs));
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_ci	samsung_clk_of_add_provider(np, ctx);
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ci	pr_info("%s clocks: apll = %lu, mpll = %lu\n"
4608c2ecf20Sopenharmony_ci		"\tepll = %lu, arm_clk = %lu\n",
4618c2ecf20Sopenharmony_ci		is_s3c6400 ? "S3C6400" : "S3C6410",
4628c2ecf20Sopenharmony_ci		_get_rate("fout_apll"),	_get_rate("fout_mpll"),
4638c2ecf20Sopenharmony_ci		_get_rate("fout_epll"), _get_rate("armclk"));
4648c2ecf20Sopenharmony_ci}
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_cistatic void __init s3c6400_clk_init(struct device_node *np)
4678c2ecf20Sopenharmony_ci{
4688c2ecf20Sopenharmony_ci	s3c64xx_clk_init(np, 0, 0, true, NULL);
4698c2ecf20Sopenharmony_ci}
4708c2ecf20Sopenharmony_ciCLK_OF_DECLARE(s3c6400_clk, "samsung,s3c6400-clock", s3c6400_clk_init);
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_cistatic void __init s3c6410_clk_init(struct device_node *np)
4738c2ecf20Sopenharmony_ci{
4748c2ecf20Sopenharmony_ci	s3c64xx_clk_init(np, 0, 0, false, NULL);
4758c2ecf20Sopenharmony_ci}
4768c2ecf20Sopenharmony_ciCLK_OF_DECLARE(s3c6410_clk, "samsung,s3c6410-clock", s3c6410_clk_init);
477