18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * arch/arm/mach-spear13xx/spear1340_clock.c
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * SPEAr1340 machine clock framework source file
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 2012 ST Microelectronics
78c2ecf20Sopenharmony_ci * Viresh Kumar <vireshk@kernel.org>
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * This file is licensed under the terms of the GNU General Public
108c2ecf20Sopenharmony_ci * License version 2. This program is licensed "as is" without any
118c2ecf20Sopenharmony_ci * warranty of any kind, whether express or implied.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/clkdev.h>
158c2ecf20Sopenharmony_ci#include <linux/err.h>
168c2ecf20Sopenharmony_ci#include <linux/io.h>
178c2ecf20Sopenharmony_ci#include <linux/of_platform.h>
188c2ecf20Sopenharmony_ci#include <linux/spinlock_types.h>
198c2ecf20Sopenharmony_ci#include "clk.h"
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Clock Configuration Registers */
228c2ecf20Sopenharmony_ci#define SPEAR1340_SYS_CLK_CTRL			(misc_base + 0x200)
238c2ecf20Sopenharmony_ci	#define SPEAR1340_HCLK_SRC_SEL_SHIFT	27
248c2ecf20Sopenharmony_ci	#define SPEAR1340_HCLK_SRC_SEL_MASK	1
258c2ecf20Sopenharmony_ci	#define SPEAR1340_SCLK_SRC_SEL_SHIFT	23
268c2ecf20Sopenharmony_ci	#define SPEAR1340_SCLK_SRC_SEL_MASK	3
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* PLL related registers and bit values */
298c2ecf20Sopenharmony_ci#define SPEAR1340_PLL_CFG			(misc_base + 0x210)
308c2ecf20Sopenharmony_ci	/* PLL_CFG bit values */
318c2ecf20Sopenharmony_ci	#define SPEAR1340_CLCD_SYNT_CLK_MASK		1
328c2ecf20Sopenharmony_ci	#define SPEAR1340_CLCD_SYNT_CLK_SHIFT		31
338c2ecf20Sopenharmony_ci	#define SPEAR1340_GEN_SYNT2_3_CLK_SHIFT		29
348c2ecf20Sopenharmony_ci	#define SPEAR1340_GEN_SYNT_CLK_MASK		2
358c2ecf20Sopenharmony_ci	#define SPEAR1340_GEN_SYNT0_1_CLK_SHIFT		27
368c2ecf20Sopenharmony_ci	#define SPEAR1340_PLL_CLK_MASK			2
378c2ecf20Sopenharmony_ci	#define SPEAR1340_PLL3_CLK_SHIFT		24
388c2ecf20Sopenharmony_ci	#define SPEAR1340_PLL2_CLK_SHIFT		22
398c2ecf20Sopenharmony_ci	#define SPEAR1340_PLL1_CLK_SHIFT		20
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define SPEAR1340_PLL1_CTR			(misc_base + 0x214)
428c2ecf20Sopenharmony_ci#define SPEAR1340_PLL1_FRQ			(misc_base + 0x218)
438c2ecf20Sopenharmony_ci#define SPEAR1340_PLL2_CTR			(misc_base + 0x220)
448c2ecf20Sopenharmony_ci#define SPEAR1340_PLL2_FRQ			(misc_base + 0x224)
458c2ecf20Sopenharmony_ci#define SPEAR1340_PLL3_CTR			(misc_base + 0x22C)
468c2ecf20Sopenharmony_ci#define SPEAR1340_PLL3_FRQ			(misc_base + 0x230)
478c2ecf20Sopenharmony_ci#define SPEAR1340_PLL4_CTR			(misc_base + 0x238)
488c2ecf20Sopenharmony_ci#define SPEAR1340_PLL4_FRQ			(misc_base + 0x23C)
498c2ecf20Sopenharmony_ci#define SPEAR1340_PERIP_CLK_CFG			(misc_base + 0x244)
508c2ecf20Sopenharmony_ci	/* PERIP_CLK_CFG bit values */
518c2ecf20Sopenharmony_ci	#define SPEAR1340_SPDIF_CLK_MASK		1
528c2ecf20Sopenharmony_ci	#define SPEAR1340_SPDIF_OUT_CLK_SHIFT		15
538c2ecf20Sopenharmony_ci	#define SPEAR1340_SPDIF_IN_CLK_SHIFT		14
548c2ecf20Sopenharmony_ci	#define SPEAR1340_GPT3_CLK_SHIFT		13
558c2ecf20Sopenharmony_ci	#define SPEAR1340_GPT2_CLK_SHIFT		12
568c2ecf20Sopenharmony_ci	#define SPEAR1340_GPT_CLK_MASK			1
578c2ecf20Sopenharmony_ci	#define SPEAR1340_GPT1_CLK_SHIFT		9
588c2ecf20Sopenharmony_ci	#define SPEAR1340_GPT0_CLK_SHIFT		8
598c2ecf20Sopenharmony_ci	#define SPEAR1340_UART_CLK_MASK			2
608c2ecf20Sopenharmony_ci	#define SPEAR1340_UART1_CLK_SHIFT		6
618c2ecf20Sopenharmony_ci	#define SPEAR1340_UART0_CLK_SHIFT		4
628c2ecf20Sopenharmony_ci	#define SPEAR1340_CLCD_CLK_MASK			2
638c2ecf20Sopenharmony_ci	#define SPEAR1340_CLCD_CLK_SHIFT		2
648c2ecf20Sopenharmony_ci	#define SPEAR1340_C3_CLK_MASK			1
658c2ecf20Sopenharmony_ci	#define SPEAR1340_C3_CLK_SHIFT			1
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define SPEAR1340_GMAC_CLK_CFG			(misc_base + 0x248)
688c2ecf20Sopenharmony_ci	#define SPEAR1340_GMAC_PHY_CLK_MASK		1
698c2ecf20Sopenharmony_ci	#define SPEAR1340_GMAC_PHY_CLK_SHIFT		2
708c2ecf20Sopenharmony_ci	#define SPEAR1340_GMAC_PHY_INPUT_CLK_MASK	2
718c2ecf20Sopenharmony_ci	#define SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT	0
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define SPEAR1340_I2S_CLK_CFG			(misc_base + 0x24C)
748c2ecf20Sopenharmony_ci	/* I2S_CLK_CFG register mask */
758c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_SCLK_X_MASK		0x1F
768c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_SCLK_X_SHIFT		27
778c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_SCLK_Y_MASK		0x1F
788c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_SCLK_Y_SHIFT		22
798c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_SCLK_EQ_SEL_SHIFT		21
808c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_SCLK_SYNTH_ENB		20
818c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_PRS1_CLK_X_MASK		0xFF
828c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_PRS1_CLK_X_SHIFT		12
838c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_PRS1_CLK_Y_MASK		0xFF
848c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_PRS1_CLK_Y_SHIFT		4
858c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_PRS1_EQ_SEL_SHIFT		3
868c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_REF_SEL_MASK		1
878c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_REF_SHIFT			2
888c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_SRC_CLK_MASK		2
898c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_SRC_CLK_SHIFT		0
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define SPEAR1340_C3_CLK_SYNT			(misc_base + 0x250)
928c2ecf20Sopenharmony_ci#define SPEAR1340_UART0_CLK_SYNT		(misc_base + 0x254)
938c2ecf20Sopenharmony_ci#define SPEAR1340_UART1_CLK_SYNT		(misc_base + 0x258)
948c2ecf20Sopenharmony_ci#define SPEAR1340_GMAC_CLK_SYNT			(misc_base + 0x25C)
958c2ecf20Sopenharmony_ci#define SPEAR1340_SDHCI_CLK_SYNT		(misc_base + 0x260)
968c2ecf20Sopenharmony_ci#define SPEAR1340_CFXD_CLK_SYNT			(misc_base + 0x264)
978c2ecf20Sopenharmony_ci#define SPEAR1340_ADC_CLK_SYNT			(misc_base + 0x270)
988c2ecf20Sopenharmony_ci#define SPEAR1340_AMBA_CLK_SYNT			(misc_base + 0x274)
998c2ecf20Sopenharmony_ci#define SPEAR1340_CLCD_CLK_SYNT			(misc_base + 0x27C)
1008c2ecf20Sopenharmony_ci#define SPEAR1340_SYS_CLK_SYNT			(misc_base + 0x284)
1018c2ecf20Sopenharmony_ci#define SPEAR1340_GEN_CLK_SYNT0			(misc_base + 0x28C)
1028c2ecf20Sopenharmony_ci#define SPEAR1340_GEN_CLK_SYNT1			(misc_base + 0x294)
1038c2ecf20Sopenharmony_ci#define SPEAR1340_GEN_CLK_SYNT2			(misc_base + 0x29C)
1048c2ecf20Sopenharmony_ci#define SPEAR1340_GEN_CLK_SYNT3			(misc_base + 0x304)
1058c2ecf20Sopenharmony_ci#define SPEAR1340_PERIP1_CLK_ENB		(misc_base + 0x30C)
1068c2ecf20Sopenharmony_ci	#define SPEAR1340_RTC_CLK_ENB			31
1078c2ecf20Sopenharmony_ci	#define SPEAR1340_ADC_CLK_ENB			30
1088c2ecf20Sopenharmony_ci	#define SPEAR1340_C3_CLK_ENB			29
1098c2ecf20Sopenharmony_ci	#define SPEAR1340_CLCD_CLK_ENB			27
1108c2ecf20Sopenharmony_ci	#define SPEAR1340_DMA_CLK_ENB			25
1118c2ecf20Sopenharmony_ci	#define SPEAR1340_GPIO1_CLK_ENB			24
1128c2ecf20Sopenharmony_ci	#define SPEAR1340_GPIO0_CLK_ENB			23
1138c2ecf20Sopenharmony_ci	#define SPEAR1340_GPT1_CLK_ENB			22
1148c2ecf20Sopenharmony_ci	#define SPEAR1340_GPT0_CLK_ENB			21
1158c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_PLAY_CLK_ENB		20
1168c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_REC_CLK_ENB		19
1178c2ecf20Sopenharmony_ci	#define SPEAR1340_I2C0_CLK_ENB			18
1188c2ecf20Sopenharmony_ci	#define SPEAR1340_SSP_CLK_ENB			17
1198c2ecf20Sopenharmony_ci	#define SPEAR1340_UART0_CLK_ENB			15
1208c2ecf20Sopenharmony_ci	#define SPEAR1340_PCIE_SATA_CLK_ENB		12
1218c2ecf20Sopenharmony_ci	#define SPEAR1340_UOC_CLK_ENB			11
1228c2ecf20Sopenharmony_ci	#define SPEAR1340_UHC1_CLK_ENB			10
1238c2ecf20Sopenharmony_ci	#define SPEAR1340_UHC0_CLK_ENB			9
1248c2ecf20Sopenharmony_ci	#define SPEAR1340_GMAC_CLK_ENB			8
1258c2ecf20Sopenharmony_ci	#define SPEAR1340_CFXD_CLK_ENB			7
1268c2ecf20Sopenharmony_ci	#define SPEAR1340_SDHCI_CLK_ENB			6
1278c2ecf20Sopenharmony_ci	#define SPEAR1340_SMI_CLK_ENB			5
1288c2ecf20Sopenharmony_ci	#define SPEAR1340_FSMC_CLK_ENB			4
1298c2ecf20Sopenharmony_ci	#define SPEAR1340_SYSRAM0_CLK_ENB		3
1308c2ecf20Sopenharmony_ci	#define SPEAR1340_SYSRAM1_CLK_ENB		2
1318c2ecf20Sopenharmony_ci	#define SPEAR1340_SYSROM_CLK_ENB		1
1328c2ecf20Sopenharmony_ci	#define SPEAR1340_BUS_CLK_ENB			0
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#define SPEAR1340_PERIP2_CLK_ENB		(misc_base + 0x310)
1358c2ecf20Sopenharmony_ci	#define SPEAR1340_THSENS_CLK_ENB		8
1368c2ecf20Sopenharmony_ci	#define SPEAR1340_I2S_REF_PAD_CLK_ENB		7
1378c2ecf20Sopenharmony_ci	#define SPEAR1340_ACP_CLK_ENB			6
1388c2ecf20Sopenharmony_ci	#define SPEAR1340_GPT3_CLK_ENB			5
1398c2ecf20Sopenharmony_ci	#define SPEAR1340_GPT2_CLK_ENB			4
1408c2ecf20Sopenharmony_ci	#define SPEAR1340_KBD_CLK_ENB			3
1418c2ecf20Sopenharmony_ci	#define SPEAR1340_CPU_DBG_CLK_ENB		2
1428c2ecf20Sopenharmony_ci	#define SPEAR1340_DDR_CORE_CLK_ENB		1
1438c2ecf20Sopenharmony_ci	#define SPEAR1340_DDR_CTRL_CLK_ENB		0
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#define SPEAR1340_PERIP3_CLK_ENB		(misc_base + 0x314)
1468c2ecf20Sopenharmony_ci	#define SPEAR1340_PLGPIO_CLK_ENB		18
1478c2ecf20Sopenharmony_ci	#define SPEAR1340_VIDEO_DEC_CLK_ENB		16
1488c2ecf20Sopenharmony_ci	#define SPEAR1340_VIDEO_ENC_CLK_ENB		15
1498c2ecf20Sopenharmony_ci	#define SPEAR1340_SPDIF_OUT_CLK_ENB		13
1508c2ecf20Sopenharmony_ci	#define SPEAR1340_SPDIF_IN_CLK_ENB		12
1518c2ecf20Sopenharmony_ci	#define SPEAR1340_VIDEO_IN_CLK_ENB		11
1528c2ecf20Sopenharmony_ci	#define SPEAR1340_CAM0_CLK_ENB			10
1538c2ecf20Sopenharmony_ci	#define SPEAR1340_CAM1_CLK_ENB			9
1548c2ecf20Sopenharmony_ci	#define SPEAR1340_CAM2_CLK_ENB			8
1558c2ecf20Sopenharmony_ci	#define SPEAR1340_CAM3_CLK_ENB			7
1568c2ecf20Sopenharmony_ci	#define SPEAR1340_MALI_CLK_ENB			6
1578c2ecf20Sopenharmony_ci	#define SPEAR1340_CEC0_CLK_ENB			5
1588c2ecf20Sopenharmony_ci	#define SPEAR1340_CEC1_CLK_ENB			4
1598c2ecf20Sopenharmony_ci	#define SPEAR1340_PWM_CLK_ENB			3
1608c2ecf20Sopenharmony_ci	#define SPEAR1340_I2C1_CLK_ENB			2
1618c2ecf20Sopenharmony_ci	#define SPEAR1340_UART1_CLK_ENB			1
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_cistatic DEFINE_SPINLOCK(_lock);
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/* pll rate configuration table, in ascending order of rates */
1668c2ecf20Sopenharmony_cistatic struct pll_rate_tbl pll_rtbl[] = {
1678c2ecf20Sopenharmony_ci	/* PCLK 24MHz */
1688c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x83, .n = 0x04, .p = 0x5}, /* vco 1572, pll 49.125 MHz */
1698c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x3}, /* vco 1000, pll 125 MHz */
1708c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x64, .n = 0x06, .p = 0x1}, /* vco 800, pll 400 MHz */
1718c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x1}, /* vco 1000, pll 500 MHz */
1728c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x1}, /* vco 1328, pll 664 MHz */
1738c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x1}, /* vco 1600, pll 800 MHz */
1748c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
1758c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x96, .n = 0x06, .p = 0x0}, /* vco 1200, pll 1200 MHz */
1768c2ecf20Sopenharmony_ci};
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci/* vco-pll4 rate configuration table, in ascending order of rates */
1798c2ecf20Sopenharmony_cistatic struct pll_rate_tbl pll4_rtbl[] = {
1808c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x2}, /* vco 1000, pll 250 MHz */
1818c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x2}, /* vco 1328, pll 332 MHz */
1828c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x2}, /* vco 1600, pll 400 MHz */
1838c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
1848c2ecf20Sopenharmony_ci};
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci/*
1878c2ecf20Sopenharmony_ci * All below entries generate 166 MHz for
1888c2ecf20Sopenharmony_ci * different values of vco1div2
1898c2ecf20Sopenharmony_ci */
1908c2ecf20Sopenharmony_cistatic struct frac_rate_tbl amba_synth_rtbl[] = {
1918c2ecf20Sopenharmony_ci	{.div = 0x073A8}, /* for vco1div2 = 600 MHz */
1928c2ecf20Sopenharmony_ci	{.div = 0x06062}, /* for vco1div2 = 500 MHz */
1938c2ecf20Sopenharmony_ci	{.div = 0x04D1B}, /* for vco1div2 = 400 MHz */
1948c2ecf20Sopenharmony_ci	{.div = 0x04000}, /* for vco1div2 = 332 MHz */
1958c2ecf20Sopenharmony_ci	{.div = 0x03031}, /* for vco1div2 = 250 MHz */
1968c2ecf20Sopenharmony_ci	{.div = 0x0268D}, /* for vco1div2 = 200 MHz */
1978c2ecf20Sopenharmony_ci};
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci/*
2008c2ecf20Sopenharmony_ci * Synthesizer Clock derived from vcodiv2. This clock is one of the
2018c2ecf20Sopenharmony_ci * possible clocks to feed cpu directly.
2028c2ecf20Sopenharmony_ci * We can program this synthesizer to make cpu run on different clock
2038c2ecf20Sopenharmony_ci * frequencies.
2048c2ecf20Sopenharmony_ci * Following table provides configuration values to let cpu run on 200,
2058c2ecf20Sopenharmony_ci * 250, 332, 400 or 500 MHz considering different possibilites of input
2068c2ecf20Sopenharmony_ci * (vco1div2) clock.
2078c2ecf20Sopenharmony_ci *
2088c2ecf20Sopenharmony_ci * --------------------------------------------------------------------
2098c2ecf20Sopenharmony_ci * vco1div2(Mhz)	fout(Mhz)	cpuclk = fout/2		div
2108c2ecf20Sopenharmony_ci * --------------------------------------------------------------------
2118c2ecf20Sopenharmony_ci * 400			200		100			0x04000
2128c2ecf20Sopenharmony_ci * 400			250		125			0x03333
2138c2ecf20Sopenharmony_ci * 400			332		166			0x0268D
2148c2ecf20Sopenharmony_ci * 400			400		200			0x02000
2158c2ecf20Sopenharmony_ci * --------------------------------------------------------------------
2168c2ecf20Sopenharmony_ci * 500			200		100			0x05000
2178c2ecf20Sopenharmony_ci * 500			250		125			0x04000
2188c2ecf20Sopenharmony_ci * 500			332		166			0x03031
2198c2ecf20Sopenharmony_ci * 500			400		200			0x02800
2208c2ecf20Sopenharmony_ci * 500			500		250			0x02000
2218c2ecf20Sopenharmony_ci * --------------------------------------------------------------------
2228c2ecf20Sopenharmony_ci * 600			200		100			0x06000
2238c2ecf20Sopenharmony_ci * 600			250		125			0x04CCE
2248c2ecf20Sopenharmony_ci * 600			332		166			0x039D5
2258c2ecf20Sopenharmony_ci * 600			400		200			0x03000
2268c2ecf20Sopenharmony_ci * 600			500		250			0x02666
2278c2ecf20Sopenharmony_ci * --------------------------------------------------------------------
2288c2ecf20Sopenharmony_ci * 664			200		100			0x06a38
2298c2ecf20Sopenharmony_ci * 664			250		125			0x054FD
2308c2ecf20Sopenharmony_ci * 664			332		166			0x04000
2318c2ecf20Sopenharmony_ci * 664			400		200			0x0351E
2328c2ecf20Sopenharmony_ci * 664			500		250			0x02A7E
2338c2ecf20Sopenharmony_ci * --------------------------------------------------------------------
2348c2ecf20Sopenharmony_ci * 800			200		100			0x08000
2358c2ecf20Sopenharmony_ci * 800			250		125			0x06666
2368c2ecf20Sopenharmony_ci * 800			332		166			0x04D18
2378c2ecf20Sopenharmony_ci * 800			400		200			0x04000
2388c2ecf20Sopenharmony_ci * 800			500		250			0x03333
2398c2ecf20Sopenharmony_ci * --------------------------------------------------------------------
2408c2ecf20Sopenharmony_ci * sys rate configuration table is in descending order of divisor.
2418c2ecf20Sopenharmony_ci */
2428c2ecf20Sopenharmony_cistatic struct frac_rate_tbl sys_synth_rtbl[] = {
2438c2ecf20Sopenharmony_ci	{.div = 0x08000},
2448c2ecf20Sopenharmony_ci	{.div = 0x06a38},
2458c2ecf20Sopenharmony_ci	{.div = 0x06666},
2468c2ecf20Sopenharmony_ci	{.div = 0x06000},
2478c2ecf20Sopenharmony_ci	{.div = 0x054FD},
2488c2ecf20Sopenharmony_ci	{.div = 0x05000},
2498c2ecf20Sopenharmony_ci	{.div = 0x04D18},
2508c2ecf20Sopenharmony_ci	{.div = 0x04CCE},
2518c2ecf20Sopenharmony_ci	{.div = 0x04000},
2528c2ecf20Sopenharmony_ci	{.div = 0x039D5},
2538c2ecf20Sopenharmony_ci	{.div = 0x0351E},
2548c2ecf20Sopenharmony_ci	{.div = 0x03333},
2558c2ecf20Sopenharmony_ci	{.div = 0x03031},
2568c2ecf20Sopenharmony_ci	{.div = 0x03000},
2578c2ecf20Sopenharmony_ci	{.div = 0x02A7E},
2588c2ecf20Sopenharmony_ci	{.div = 0x02800},
2598c2ecf20Sopenharmony_ci	{.div = 0x0268D},
2608c2ecf20Sopenharmony_ci	{.div = 0x02666},
2618c2ecf20Sopenharmony_ci	{.div = 0x02000},
2628c2ecf20Sopenharmony_ci};
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci/* aux rate configuration table, in ascending order of rates */
2658c2ecf20Sopenharmony_cistatic struct aux_rate_tbl aux_rtbl[] = {
2668c2ecf20Sopenharmony_ci	/* 12.29MHz for vic1div2=600MHz and 10.24MHz for VCO1div2=500MHz */
2678c2ecf20Sopenharmony_ci	{.xscale = 5, .yscale = 122, .eq = 0},
2688c2ecf20Sopenharmony_ci	/* 14.70MHz for vic1div2=600MHz and 12.29MHz for VCO1div2=500MHz */
2698c2ecf20Sopenharmony_ci	{.xscale = 10, .yscale = 204, .eq = 0},
2708c2ecf20Sopenharmony_ci	/* 48MHz for vic1div2=600MHz and 40 MHz for VCO1div2=500MHz */
2718c2ecf20Sopenharmony_ci	{.xscale = 4, .yscale = 25, .eq = 0},
2728c2ecf20Sopenharmony_ci	/* 57.14MHz for vic1div2=600MHz and 48 MHz for VCO1div2=500MHz */
2738c2ecf20Sopenharmony_ci	{.xscale = 4, .yscale = 21, .eq = 0},
2748c2ecf20Sopenharmony_ci	/* 83.33MHz for vic1div2=600MHz and 69.44MHz for VCO1div2=500MHz */
2758c2ecf20Sopenharmony_ci	{.xscale = 5, .yscale = 18, .eq = 0},
2768c2ecf20Sopenharmony_ci	/* 100MHz for vic1div2=600MHz and 83.33 MHz for VCO1div2=500MHz */
2778c2ecf20Sopenharmony_ci	{.xscale = 2, .yscale = 6, .eq = 0},
2788c2ecf20Sopenharmony_ci	/* 125MHz for vic1div2=600MHz and 104.1MHz for VCO1div2=500MHz */
2798c2ecf20Sopenharmony_ci	{.xscale = 5, .yscale = 12, .eq = 0},
2808c2ecf20Sopenharmony_ci	/* 150MHz for vic1div2=600MHz and 125MHz for VCO1div2=500MHz */
2818c2ecf20Sopenharmony_ci	{.xscale = 2, .yscale = 4, .eq = 0},
2828c2ecf20Sopenharmony_ci	/* 166MHz for vic1div2=600MHz and 138.88MHz for VCO1div2=500MHz */
2838c2ecf20Sopenharmony_ci	{.xscale = 5, .yscale = 18, .eq = 1},
2848c2ecf20Sopenharmony_ci	/* 200MHz for vic1div2=600MHz and 166MHz for VCO1div2=500MHz */
2858c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 3, .eq = 1},
2868c2ecf20Sopenharmony_ci	/* 250MHz for vic1div2=600MHz and 208.33MHz for VCO1div2=500MHz */
2878c2ecf20Sopenharmony_ci	{.xscale = 5, .yscale = 12, .eq = 1},
2888c2ecf20Sopenharmony_ci	/* 300MHz for vic1div2=600MHz and 250MHz for VCO1div2=500MHz */
2898c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 2, .eq = 1},
2908c2ecf20Sopenharmony_ci};
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci/* gmac rate configuration table, in ascending order of rates */
2938c2ecf20Sopenharmony_cistatic struct aux_rate_tbl gmac_rtbl[] = {
2948c2ecf20Sopenharmony_ci	/* For gmac phy input clk */
2958c2ecf20Sopenharmony_ci	{.xscale = 2, .yscale = 6, .eq = 0}, /* divided by 6 */
2968c2ecf20Sopenharmony_ci	{.xscale = 2, .yscale = 4, .eq = 0}, /* divided by 4 */
2978c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 3, .eq = 1}, /* divided by 3 */
2988c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 2, .eq = 1}, /* divided by 2 */
2998c2ecf20Sopenharmony_ci};
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci/* clcd rate configuration table, in ascending order of rates */
3028c2ecf20Sopenharmony_cistatic struct frac_rate_tbl clcd_rtbl[] = {
3038c2ecf20Sopenharmony_ci	{.div = 0x18000}, /* 25 Mhz , for vc01div4 = 300 MHz*/
3048c2ecf20Sopenharmony_ci	{.div = 0x1638E}, /* 27 Mhz , for vc01div4 = 300 MHz*/
3058c2ecf20Sopenharmony_ci	{.div = 0x14000}, /* 25 Mhz , for vc01div4 = 250 MHz*/
3068c2ecf20Sopenharmony_ci	{.div = 0x1284B}, /* 27 Mhz , for vc01div4 = 250 MHz*/
3078c2ecf20Sopenharmony_ci	{.div = 0x0D8D3}, /* 58 Mhz , for vco1div4 = 393 MHz */
3088c2ecf20Sopenharmony_ci	{.div = 0x0B72C}, /* 58 Mhz , for vco1div4 = 332 MHz */
3098c2ecf20Sopenharmony_ci	{.div = 0x0A584}, /* 58 Mhz , for vco1div4 = 300 MHz */
3108c2ecf20Sopenharmony_ci	{.div = 0x093B1}, /* 65 Mhz , for vc01div4 = 300 MHz*/
3118c2ecf20Sopenharmony_ci	{.div = 0x089EE}, /* 58 Mhz , for vc01div4 = 250 MHz*/
3128c2ecf20Sopenharmony_ci	{.div = 0x081BA}, /* 74 Mhz , for vc01div4 = 300 MHz*/
3138c2ecf20Sopenharmony_ci	{.div = 0x07BA0}, /* 65 Mhz , for vc01div4 = 250 MHz*/
3148c2ecf20Sopenharmony_ci	{.div = 0x06f1C}, /* 72 Mhz , for vc01div4 = 250 MHz*/
3158c2ecf20Sopenharmony_ci	{.div = 0x06E58}, /* 58 Mhz , for vco1div4 = 200 MHz */
3168c2ecf20Sopenharmony_ci	{.div = 0x06c1B}, /* 74 Mhz , for vc01div4 = 250 MHz*/
3178c2ecf20Sopenharmony_ci	{.div = 0x058E3}, /* 108 Mhz , for vc01div4 = 300 MHz*/
3188c2ecf20Sopenharmony_ci	{.div = 0x04A12}, /* 108 Mhz , for vc01div4 = 250 MHz*/
3198c2ecf20Sopenharmony_ci	{.div = 0x040A5}, /* 148.5 Mhz , for vc01div4 = 300 MHz*/
3208c2ecf20Sopenharmony_ci	{.div = 0x0378E}, /* 144 Mhz , for vc01div4 = 250 MHz*/
3218c2ecf20Sopenharmony_ci	{.div = 0x0360D}, /* 148 Mhz , for vc01div4 = 250 MHz*/
3228c2ecf20Sopenharmony_ci	{.div = 0x035E0}, /* 148.5 MHz, for vc01div4 = 250 MHz*/
3238c2ecf20Sopenharmony_ci};
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci/* i2s prescaler1 masks */
3268c2ecf20Sopenharmony_cistatic const struct aux_clk_masks i2s_prs1_masks = {
3278c2ecf20Sopenharmony_ci	.eq_sel_mask = AUX_EQ_SEL_MASK,
3288c2ecf20Sopenharmony_ci	.eq_sel_shift = SPEAR1340_I2S_PRS1_EQ_SEL_SHIFT,
3298c2ecf20Sopenharmony_ci	.eq1_mask = AUX_EQ1_SEL,
3308c2ecf20Sopenharmony_ci	.eq2_mask = AUX_EQ2_SEL,
3318c2ecf20Sopenharmony_ci	.xscale_sel_mask = SPEAR1340_I2S_PRS1_CLK_X_MASK,
3328c2ecf20Sopenharmony_ci	.xscale_sel_shift = SPEAR1340_I2S_PRS1_CLK_X_SHIFT,
3338c2ecf20Sopenharmony_ci	.yscale_sel_mask = SPEAR1340_I2S_PRS1_CLK_Y_MASK,
3348c2ecf20Sopenharmony_ci	.yscale_sel_shift = SPEAR1340_I2S_PRS1_CLK_Y_SHIFT,
3358c2ecf20Sopenharmony_ci};
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci/* i2s sclk (bit clock) syynthesizers masks */
3388c2ecf20Sopenharmony_cistatic const struct aux_clk_masks i2s_sclk_masks = {
3398c2ecf20Sopenharmony_ci	.eq_sel_mask = AUX_EQ_SEL_MASK,
3408c2ecf20Sopenharmony_ci	.eq_sel_shift = SPEAR1340_I2S_SCLK_EQ_SEL_SHIFT,
3418c2ecf20Sopenharmony_ci	.eq1_mask = AUX_EQ1_SEL,
3428c2ecf20Sopenharmony_ci	.eq2_mask = AUX_EQ2_SEL,
3438c2ecf20Sopenharmony_ci	.xscale_sel_mask = SPEAR1340_I2S_SCLK_X_MASK,
3448c2ecf20Sopenharmony_ci	.xscale_sel_shift = SPEAR1340_I2S_SCLK_X_SHIFT,
3458c2ecf20Sopenharmony_ci	.yscale_sel_mask = SPEAR1340_I2S_SCLK_Y_MASK,
3468c2ecf20Sopenharmony_ci	.yscale_sel_shift = SPEAR1340_I2S_SCLK_Y_SHIFT,
3478c2ecf20Sopenharmony_ci	.enable_bit = SPEAR1340_I2S_SCLK_SYNTH_ENB,
3488c2ecf20Sopenharmony_ci};
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci/* i2s prs1 aux rate configuration table, in ascending order of rates */
3518c2ecf20Sopenharmony_cistatic struct aux_rate_tbl i2s_prs1_rtbl[] = {
3528c2ecf20Sopenharmony_ci	/* For parent clk = 49.152 MHz */
3538c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 12, .eq = 0}, /* 2.048 MHz, smp freq = 8Khz */
3548c2ecf20Sopenharmony_ci	{.xscale = 11, .yscale = 96, .eq = 0}, /* 2.816 MHz, smp freq = 11Khz */
3558c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 6, .eq = 0}, /* 4.096 MHz, smp freq = 16Khz */
3568c2ecf20Sopenharmony_ci	{.xscale = 11, .yscale = 48, .eq = 0}, /* 5.632 MHz, smp freq = 22Khz */
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci	/*
3598c2ecf20Sopenharmony_ci	 * with parent clk = 49.152, freq gen is 8.192 MHz, smp freq = 32Khz
3608c2ecf20Sopenharmony_ci	 * with parent clk = 12.288, freq gen is 2.048 MHz, smp freq = 8Khz
3618c2ecf20Sopenharmony_ci	 */
3628c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 3, .eq = 0},
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci	/* For parent clk = 49.152 MHz */
3658c2ecf20Sopenharmony_ci	{.xscale = 17, .yscale = 37, .eq = 0}, /* 11.289 MHz, smp freq = 44Khz*/
3668c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 2, .eq = 0}, /* 12.288 MHz, smp freq = 48Khz*/
3678c2ecf20Sopenharmony_ci};
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci/* i2s sclk aux rate configuration table, in ascending order of rates */
3708c2ecf20Sopenharmony_cistatic struct aux_rate_tbl i2s_sclk_rtbl[] = {
3718c2ecf20Sopenharmony_ci	/* For sclk = ref_clk * x/2/y */
3728c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 4, .eq = 0},
3738c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 2, .eq = 0},
3748c2ecf20Sopenharmony_ci};
3758c2ecf20Sopenharmony_ci
3768c2ecf20Sopenharmony_ci/* adc rate configuration table, in ascending order of rates */
3778c2ecf20Sopenharmony_ci/* possible adc range is 2.5 MHz to 20 MHz. */
3788c2ecf20Sopenharmony_cistatic struct aux_rate_tbl adc_rtbl[] = {
3798c2ecf20Sopenharmony_ci	/* For ahb = 166.67 MHz */
3808c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 31, .eq = 0}, /* 2.68 MHz */
3818c2ecf20Sopenharmony_ci	{.xscale = 2, .yscale = 21, .eq = 0}, /* 7.94 MHz */
3828c2ecf20Sopenharmony_ci	{.xscale = 4, .yscale = 21, .eq = 0}, /* 15.87 MHz */
3838c2ecf20Sopenharmony_ci	{.xscale = 10, .yscale = 42, .eq = 0}, /* 19.84 MHz */
3848c2ecf20Sopenharmony_ci};
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci/* General synth rate configuration table, in ascending order of rates */
3878c2ecf20Sopenharmony_cistatic struct frac_rate_tbl gen_rtbl[] = {
3888c2ecf20Sopenharmony_ci	{.div = 0x1A92B}, /* 22.5792 MHz for vco1div4=300 MHz*/
3898c2ecf20Sopenharmony_ci	{.div = 0x186A0}, /* 24.576 MHz for vco1div4=300 MHz*/
3908c2ecf20Sopenharmony_ci	{.div = 0x18000}, /* 25 MHz for vco1div4=300 MHz*/
3918c2ecf20Sopenharmony_ci	{.div = 0x1624E}, /* 22.5792 MHz for vco1div4=250 MHz*/
3928c2ecf20Sopenharmony_ci	{.div = 0x14585}, /* 24.576 MHz for vco1div4=250 MHz*/
3938c2ecf20Sopenharmony_ci	{.div = 0x14000}, /* 25 MHz for vco1div4=250 MHz*/
3948c2ecf20Sopenharmony_ci	{.div = 0x0D495}, /* 45.1584 MHz for vco1div4=300 MHz*/
3958c2ecf20Sopenharmony_ci	{.div = 0x0C000}, /* 50 MHz for vco1div4=300 MHz*/
3968c2ecf20Sopenharmony_ci	{.div = 0x0B127}, /* 45.1584 MHz for vco1div4=250 MHz*/
3978c2ecf20Sopenharmony_ci	{.div = 0x0A000}, /* 50 MHz for vco1div4=250 MHz*/
3988c2ecf20Sopenharmony_ci	{.div = 0x07530}, /* 81.92 MHz for vco1div4=300 MHz*/
3998c2ecf20Sopenharmony_ci	{.div = 0x061A8}, /* 81.92 MHz for vco1div4=250 MHz*/
4008c2ecf20Sopenharmony_ci	{.div = 0x06000}, /* 100 MHz for vco1div4=300 MHz*/
4018c2ecf20Sopenharmony_ci	{.div = 0x05000}, /* 100 MHz for vco1div4=250 MHz*/
4028c2ecf20Sopenharmony_ci	{.div = 0x03000}, /* 200 MHz for vco1div4=300 MHz*/
4038c2ecf20Sopenharmony_ci	{.div = 0x02DB6}, /* 210 MHz for vco1div4=300 MHz*/
4048c2ecf20Sopenharmony_ci	{.div = 0x02BA2}, /* 220 MHz for vco1div4=300 MHz*/
4058c2ecf20Sopenharmony_ci	{.div = 0x029BD}, /* 230 MHz for vco1div4=300 MHz*/
4068c2ecf20Sopenharmony_ci	{.div = 0x02800}, /* 200 MHz for vco1div4=250 MHz*/
4078c2ecf20Sopenharmony_ci	{.div = 0x02666}, /* 250 MHz for vco1div4=300 MHz*/
4088c2ecf20Sopenharmony_ci	{.div = 0x02620}, /* 210 MHz for vco1div4=250 MHz*/
4098c2ecf20Sopenharmony_ci	{.div = 0x02460}, /* 220 MHz for vco1div4=250 MHz*/
4108c2ecf20Sopenharmony_ci	{.div = 0x022C0}, /* 230 MHz for vco1div4=250 MHz*/
4118c2ecf20Sopenharmony_ci	{.div = 0x02160}, /* 240 MHz for vco1div4=250 MHz*/
4128c2ecf20Sopenharmony_ci	{.div = 0x02000}, /* 250 MHz for vco1div4=250 MHz*/
4138c2ecf20Sopenharmony_ci};
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_ci/* clock parents */
4168c2ecf20Sopenharmony_cistatic const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", };
4178c2ecf20Sopenharmony_cistatic const char *sys_parents[] = { "pll1_clk", "pll1_clk", "pll1_clk",
4188c2ecf20Sopenharmony_ci	"pll1_clk", "sys_syn_clk", "sys_syn_clk", "pll2_clk", "pll3_clk", };
4198c2ecf20Sopenharmony_cistatic const char *ahb_parents[] = { "cpu_div3_clk", "amba_syn_clk", };
4208c2ecf20Sopenharmony_cistatic const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", };
4218c2ecf20Sopenharmony_cistatic const char *uart0_parents[] = { "pll5_clk", "osc_24m_clk",
4228c2ecf20Sopenharmony_ci	"uart0_syn_gclk", };
4238c2ecf20Sopenharmony_cistatic const char *uart1_parents[] = { "pll5_clk", "osc_24m_clk",
4248c2ecf20Sopenharmony_ci	"uart1_syn_gclk", };
4258c2ecf20Sopenharmony_cistatic const char *c3_parents[] = { "pll5_clk", "c3_syn_gclk", };
4268c2ecf20Sopenharmony_cistatic const char *gmac_phy_input_parents[] = { "gmii_pad_clk", "pll2_clk",
4278c2ecf20Sopenharmony_ci	"osc_25m_clk", };
4288c2ecf20Sopenharmony_cistatic const char *gmac_phy_parents[] = { "phy_input_mclk", "phy_syn_gclk", };
4298c2ecf20Sopenharmony_cistatic const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", };
4308c2ecf20Sopenharmony_cistatic const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_syn_clk", };
4318c2ecf20Sopenharmony_cistatic const char *i2s_src_parents[] = { "vco1div2_clk", "pll2_clk", "pll3_clk",
4328c2ecf20Sopenharmony_ci	"i2s_src_pad_clk", };
4338c2ecf20Sopenharmony_cistatic const char *i2s_ref_parents[] = { "i2s_src_mclk", "i2s_prs1_clk", };
4348c2ecf20Sopenharmony_cistatic const char *spdif_out_parents[] = { "i2s_src_pad_clk", "gen_syn2_clk", };
4358c2ecf20Sopenharmony_cistatic const char *spdif_in_parents[] = { "pll2_clk", "gen_syn3_clk", };
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_cistatic const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk",
4388c2ecf20Sopenharmony_ci	"pll3_clk", };
4398c2ecf20Sopenharmony_cistatic const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco2div2_clk",
4408c2ecf20Sopenharmony_ci	"pll2_clk", };
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_civoid __init spear1340_clk_init(void __iomem *misc_base)
4438c2ecf20Sopenharmony_ci{
4448c2ecf20Sopenharmony_ci	struct clk *clk, *clk1;
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, 0, 32000);
4478c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "osc_32k_clk", NULL);
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "osc_24m_clk", NULL, 0, 24000000);
4508c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "osc_24m_clk", NULL);
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "osc_25m_clk", NULL, 0, 25000000);
4538c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "osc_25m_clk", NULL);
4548c2ecf20Sopenharmony_ci
4558c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "gmii_pad_clk", NULL, 0, 125000000);
4568c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gmii_pad_clk", NULL);
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, 0,
4598c2ecf20Sopenharmony_ci				      12288000);
4608c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_src_pad_clk", NULL);
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci	/* clock derived from 32 KHz osc clk */
4638c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "rtc-spear", "osc_32k_clk", 0,
4648c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_RTC_CLK_ENB, 0,
4658c2ecf20Sopenharmony_ci			&_lock);
4668c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0580000.rtc");
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ci	/* clock derived from 24 or 25 MHz osc clk */
4698c2ecf20Sopenharmony_ci	/* vco-pll */
4708c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "vco1_mclk", vco_parents,
4718c2ecf20Sopenharmony_ci			ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
4728c2ecf20Sopenharmony_ci			SPEAR1340_PLL_CFG, SPEAR1340_PLL1_CLK_SHIFT,
4738c2ecf20Sopenharmony_ci			SPEAR1340_PLL_CLK_MASK, 0, &_lock);
4748c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco1_mclk", NULL);
4758c2ecf20Sopenharmony_ci	clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mclk", 0,
4768c2ecf20Sopenharmony_ci			SPEAR1340_PLL1_CTR, SPEAR1340_PLL1_FRQ, pll_rtbl,
4778c2ecf20Sopenharmony_ci			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4788c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco1_clk", NULL);
4798c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "pll1_clk", NULL);
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "vco2_mclk", vco_parents,
4828c2ecf20Sopenharmony_ci			ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
4838c2ecf20Sopenharmony_ci			SPEAR1340_PLL_CFG, SPEAR1340_PLL2_CLK_SHIFT,
4848c2ecf20Sopenharmony_ci			SPEAR1340_PLL_CLK_MASK, 0, &_lock);
4858c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco2_mclk", NULL);
4868c2ecf20Sopenharmony_ci	clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mclk", 0,
4878c2ecf20Sopenharmony_ci			SPEAR1340_PLL2_CTR, SPEAR1340_PLL2_FRQ, pll_rtbl,
4888c2ecf20Sopenharmony_ci			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4898c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco2_clk", NULL);
4908c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "pll2_clk", NULL);
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "vco3_mclk", vco_parents,
4938c2ecf20Sopenharmony_ci			ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
4948c2ecf20Sopenharmony_ci			SPEAR1340_PLL_CFG, SPEAR1340_PLL3_CLK_SHIFT,
4958c2ecf20Sopenharmony_ci			SPEAR1340_PLL_CLK_MASK, 0, &_lock);
4968c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco3_mclk", NULL);
4978c2ecf20Sopenharmony_ci	clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mclk", 0,
4988c2ecf20Sopenharmony_ci			SPEAR1340_PLL3_CTR, SPEAR1340_PLL3_FRQ, pll_rtbl,
4998c2ecf20Sopenharmony_ci			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
5008c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco3_clk", NULL);
5018c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "pll3_clk", NULL);
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci	clk = clk_register_vco_pll("vco4_clk", "pll4_clk", NULL, "osc_24m_clk",
5048c2ecf20Sopenharmony_ci			0, SPEAR1340_PLL4_CTR, SPEAR1340_PLL4_FRQ, pll4_rtbl,
5058c2ecf20Sopenharmony_ci			ARRAY_SIZE(pll4_rtbl), &_lock, &clk1, NULL);
5068c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco4_clk", NULL);
5078c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "pll4_clk", NULL);
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "pll5_clk", "osc_24m_clk", 0,
5108c2ecf20Sopenharmony_ci			48000000);
5118c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "pll5_clk", NULL);
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "pll6_clk", "osc_25m_clk", 0,
5148c2ecf20Sopenharmony_ci			25000000);
5158c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "pll6_clk", NULL);
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci	/* vco div n clocks */
5188c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "vco1div2_clk", "vco1_clk", 0, 1,
5198c2ecf20Sopenharmony_ci			2);
5208c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco1div2_clk", NULL);
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "vco1div4_clk", "vco1_clk", 0, 1,
5238c2ecf20Sopenharmony_ci			4);
5248c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco1div4_clk", NULL);
5258c2ecf20Sopenharmony_ci
5268c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "vco2div2_clk", "vco2_clk", 0, 1,
5278c2ecf20Sopenharmony_ci			2);
5288c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco2div2_clk", NULL);
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "vco3div2_clk", "vco3_clk", 0, 1,
5318c2ecf20Sopenharmony_ci			2);
5328c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco3div2_clk", NULL);
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_ci	/* peripherals */
5358c2ecf20Sopenharmony_ci	clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1,
5368c2ecf20Sopenharmony_ci			128);
5378c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "thermal_gclk", "thermal_clk", 0,
5388c2ecf20Sopenharmony_ci			SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_THSENS_CLK_ENB, 0,
5398c2ecf20Sopenharmony_ci			&_lock);
5408c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e07008c4.thermal");
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci	/* clock derived from pll4 clk */
5438c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "ddr_clk", "pll4_clk", 0, 1,
5448c2ecf20Sopenharmony_ci			1);
5458c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ddr_clk", NULL);
5468c2ecf20Sopenharmony_ci
5478c2ecf20Sopenharmony_ci	/* clock derived from pll1 clk */
5488c2ecf20Sopenharmony_ci	clk = clk_register_frac("sys_syn_clk", "vco1div2_clk", 0,
5498c2ecf20Sopenharmony_ci			SPEAR1340_SYS_CLK_SYNT, sys_synth_rtbl,
5508c2ecf20Sopenharmony_ci			ARRAY_SIZE(sys_synth_rtbl), &_lock);
5518c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "sys_syn_clk", NULL);
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_ci	clk = clk_register_frac("amba_syn_clk", "vco1div2_clk", 0,
5548c2ecf20Sopenharmony_ci			SPEAR1340_AMBA_CLK_SYNT, amba_synth_rtbl,
5558c2ecf20Sopenharmony_ci			ARRAY_SIZE(amba_synth_rtbl), &_lock);
5568c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "amba_syn_clk", NULL);
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "sys_mclk", sys_parents,
5598c2ecf20Sopenharmony_ci			ARRAY_SIZE(sys_parents), CLK_SET_RATE_NO_REPARENT,
5608c2ecf20Sopenharmony_ci			SPEAR1340_SYS_CLK_CTRL, SPEAR1340_SCLK_SRC_SEL_SHIFT,
5618c2ecf20Sopenharmony_ci			SPEAR1340_SCLK_SRC_SEL_MASK, 0, &_lock);
5628c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "sys_mclk", NULL);
5638c2ecf20Sopenharmony_ci
5648c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "cpu_clk", "sys_mclk", 0, 1,
5658c2ecf20Sopenharmony_ci			2);
5668c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "cpu_clk", NULL);
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "cpu_div3_clk", "cpu_clk", 0, 1,
5698c2ecf20Sopenharmony_ci			3);
5708c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "cpu_div3_clk", NULL);
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "wdt_clk", "cpu_clk", 0, 1,
5738c2ecf20Sopenharmony_ci			2);
5748c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "ec800620.wdt");
5758c2ecf20Sopenharmony_ci
5768c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "smp_twd_clk", "cpu_clk", 0, 1,
5778c2ecf20Sopenharmony_ci			2);
5788c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "smp_twd");
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "ahb_clk", ahb_parents,
5818c2ecf20Sopenharmony_ci			ARRAY_SIZE(ahb_parents), CLK_SET_RATE_NO_REPARENT,
5828c2ecf20Sopenharmony_ci			SPEAR1340_SYS_CLK_CTRL, SPEAR1340_HCLK_SRC_SEL_SHIFT,
5838c2ecf20Sopenharmony_ci			SPEAR1340_HCLK_SRC_SEL_MASK, 0, &_lock);
5848c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ahb_clk", NULL);
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "apb_clk", "ahb_clk", 0, 1,
5878c2ecf20Sopenharmony_ci			2);
5888c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "apb_clk", NULL);
5898c2ecf20Sopenharmony_ci
5908c2ecf20Sopenharmony_ci	/* gpt clocks */
5918c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gpt0_mclk", gpt_parents,
5928c2ecf20Sopenharmony_ci			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
5938c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GPT0_CLK_SHIFT,
5948c2ecf20Sopenharmony_ci			SPEAR1340_GPT_CLK_MASK, 0, &_lock);
5958c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gpt0_mclk", NULL);
5968c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mclk", 0,
5978c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT0_CLK_ENB, 0,
5988c2ecf20Sopenharmony_ci			&_lock);
5998c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "gpt0");
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gpt1_mclk", gpt_parents,
6028c2ecf20Sopenharmony_ci			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
6038c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GPT1_CLK_SHIFT,
6048c2ecf20Sopenharmony_ci			SPEAR1340_GPT_CLK_MASK, 0, &_lock);
6058c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gpt1_mclk", NULL);
6068c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0,
6078c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT1_CLK_ENB, 0,
6088c2ecf20Sopenharmony_ci			&_lock);
6098c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "gpt1");
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gpt2_mclk", gpt_parents,
6128c2ecf20Sopenharmony_ci			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
6138c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GPT2_CLK_SHIFT,
6148c2ecf20Sopenharmony_ci			SPEAR1340_GPT_CLK_MASK, 0, &_lock);
6158c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gpt2_mclk", NULL);
6168c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0,
6178c2ecf20Sopenharmony_ci			SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT2_CLK_ENB, 0,
6188c2ecf20Sopenharmony_ci			&_lock);
6198c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "gpt2");
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gpt3_mclk", gpt_parents,
6228c2ecf20Sopenharmony_ci			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
6238c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GPT3_CLK_SHIFT,
6248c2ecf20Sopenharmony_ci			SPEAR1340_GPT_CLK_MASK, 0, &_lock);
6258c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gpt3_mclk", NULL);
6268c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0,
6278c2ecf20Sopenharmony_ci			SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT3_CLK_ENB, 0,
6288c2ecf20Sopenharmony_ci			&_lock);
6298c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "gpt3");
6308c2ecf20Sopenharmony_ci
6318c2ecf20Sopenharmony_ci	/* others */
6328c2ecf20Sopenharmony_ci	clk = clk_register_aux("uart0_syn_clk", "uart0_syn_gclk",
6338c2ecf20Sopenharmony_ci			"vco1div2_clk", 0, SPEAR1340_UART0_CLK_SYNT, NULL,
6348c2ecf20Sopenharmony_ci			aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
6358c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart0_syn_clk", NULL);
6368c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "uart0_syn_gclk", NULL);
6378c2ecf20Sopenharmony_ci
6388c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents,
6398c2ecf20Sopenharmony_ci			ARRAY_SIZE(uart0_parents),
6408c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
6418c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_UART0_CLK_SHIFT,
6428c2ecf20Sopenharmony_ci			SPEAR1340_UART_CLK_MASK, 0, &_lock);
6438c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart0_mclk", NULL);
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "uart0_clk", "uart0_mclk",
6468c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
6478c2ecf20Sopenharmony_ci			SPEAR1340_UART0_CLK_ENB, 0, &_lock);
6488c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0000000.serial");
6498c2ecf20Sopenharmony_ci
6508c2ecf20Sopenharmony_ci	clk = clk_register_aux("uart1_syn_clk", "uart1_syn_gclk",
6518c2ecf20Sopenharmony_ci			"vco1div2_clk", 0, SPEAR1340_UART1_CLK_SYNT, NULL,
6528c2ecf20Sopenharmony_ci			aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
6538c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart1_syn_clk", NULL);
6548c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "uart1_syn_gclk", NULL);
6558c2ecf20Sopenharmony_ci
6568c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "uart1_mclk", uart1_parents,
6578c2ecf20Sopenharmony_ci			ARRAY_SIZE(uart1_parents), CLK_SET_RATE_NO_REPARENT,
6588c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_UART1_CLK_SHIFT,
6598c2ecf20Sopenharmony_ci			SPEAR1340_UART_CLK_MASK, 0, &_lock);
6608c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart1_mclk", NULL);
6618c2ecf20Sopenharmony_ci
6628c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "uart1_clk", "uart1_mclk", 0,
6638c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_UART1_CLK_ENB, 0,
6648c2ecf20Sopenharmony_ci			&_lock);
6658c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b4100000.serial");
6668c2ecf20Sopenharmony_ci
6678c2ecf20Sopenharmony_ci	clk = clk_register_aux("sdhci_syn_clk", "sdhci_syn_gclk",
6688c2ecf20Sopenharmony_ci			"vco1div2_clk", 0, SPEAR1340_SDHCI_CLK_SYNT, NULL,
6698c2ecf20Sopenharmony_ci			aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
6708c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "sdhci_syn_clk", NULL);
6718c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "sdhci_syn_gclk", NULL);
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_syn_gclk",
6748c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
6758c2ecf20Sopenharmony_ci			SPEAR1340_SDHCI_CLK_ENB, 0, &_lock);
6768c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b3000000.sdhci");
6778c2ecf20Sopenharmony_ci
6788c2ecf20Sopenharmony_ci	clk = clk_register_aux("cfxd_syn_clk", "cfxd_syn_gclk", "vco1div2_clk",
6798c2ecf20Sopenharmony_ci			0, SPEAR1340_CFXD_CLK_SYNT, NULL, aux_rtbl,
6808c2ecf20Sopenharmony_ci			ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
6818c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "cfxd_syn_clk", NULL);
6828c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "cfxd_syn_gclk", NULL);
6838c2ecf20Sopenharmony_ci
6848c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_syn_gclk",
6858c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
6868c2ecf20Sopenharmony_ci			SPEAR1340_CFXD_CLK_ENB, 0, &_lock);
6878c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b2800000.cf");
6888c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "arasan_xd");
6898c2ecf20Sopenharmony_ci
6908c2ecf20Sopenharmony_ci	clk = clk_register_aux("c3_syn_clk", "c3_syn_gclk", "vco1div2_clk", 0,
6918c2ecf20Sopenharmony_ci			SPEAR1340_C3_CLK_SYNT, NULL, aux_rtbl,
6928c2ecf20Sopenharmony_ci			ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
6938c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "c3_syn_clk", NULL);
6948c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "c3_syn_gclk", NULL);
6958c2ecf20Sopenharmony_ci
6968c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "c3_mclk", c3_parents,
6978c2ecf20Sopenharmony_ci			ARRAY_SIZE(c3_parents),
6988c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
6998c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_C3_CLK_SHIFT,
7008c2ecf20Sopenharmony_ci			SPEAR1340_C3_CLK_MASK, 0, &_lock);
7018c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "c3_mclk", NULL);
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "c3_clk", "c3_mclk", CLK_SET_RATE_PARENT,
7048c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_C3_CLK_ENB, 0,
7058c2ecf20Sopenharmony_ci			&_lock);
7068c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e1800000.c3");
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_ci	/* gmac */
7098c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "phy_input_mclk", gmac_phy_input_parents,
7108c2ecf20Sopenharmony_ci			ARRAY_SIZE(gmac_phy_input_parents),
7118c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT, SPEAR1340_GMAC_CLK_CFG,
7128c2ecf20Sopenharmony_ci			SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT,
7138c2ecf20Sopenharmony_ci			SPEAR1340_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock);
7148c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "phy_input_mclk", NULL);
7158c2ecf20Sopenharmony_ci
7168c2ecf20Sopenharmony_ci	clk = clk_register_aux("phy_syn_clk", "phy_syn_gclk", "phy_input_mclk",
7178c2ecf20Sopenharmony_ci			0, SPEAR1340_GMAC_CLK_SYNT, NULL, gmac_rtbl,
7188c2ecf20Sopenharmony_ci			ARRAY_SIZE(gmac_rtbl), &_lock, &clk1);
7198c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "phy_syn_clk", NULL);
7208c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "phy_syn_gclk", NULL);
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "phy_mclk", gmac_phy_parents,
7238c2ecf20Sopenharmony_ci			ARRAY_SIZE(gmac_phy_parents), CLK_SET_RATE_NO_REPARENT,
7248c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GMAC_PHY_CLK_SHIFT,
7258c2ecf20Sopenharmony_ci			SPEAR1340_GMAC_PHY_CLK_MASK, 0, &_lock);
7268c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "stmmacphy.0", NULL);
7278c2ecf20Sopenharmony_ci
7288c2ecf20Sopenharmony_ci	/* clcd */
7298c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "clcd_syn_mclk", clcd_synth_parents,
7308c2ecf20Sopenharmony_ci			ARRAY_SIZE(clcd_synth_parents),
7318c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT, SPEAR1340_CLCD_CLK_SYNT,
7328c2ecf20Sopenharmony_ci			SPEAR1340_CLCD_SYNT_CLK_SHIFT,
7338c2ecf20Sopenharmony_ci			SPEAR1340_CLCD_SYNT_CLK_MASK, 0, &_lock);
7348c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "clcd_syn_mclk", NULL);
7358c2ecf20Sopenharmony_ci
7368c2ecf20Sopenharmony_ci	clk = clk_register_frac("clcd_syn_clk", "clcd_syn_mclk", 0,
7378c2ecf20Sopenharmony_ci			SPEAR1340_CLCD_CLK_SYNT, clcd_rtbl,
7388c2ecf20Sopenharmony_ci			ARRAY_SIZE(clcd_rtbl), &_lock);
7398c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "clcd_syn_clk", NULL);
7408c2ecf20Sopenharmony_ci
7418c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "clcd_pixel_mclk", clcd_pixel_parents,
7428c2ecf20Sopenharmony_ci			ARRAY_SIZE(clcd_pixel_parents),
7438c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
7448c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_CLCD_CLK_SHIFT,
7458c2ecf20Sopenharmony_ci			SPEAR1340_CLCD_CLK_MASK, 0, &_lock);
7468c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "clcd_pixel_mclk", NULL);
7478c2ecf20Sopenharmony_ci
7488c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mclk", 0,
7498c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CLCD_CLK_ENB, 0,
7508c2ecf20Sopenharmony_ci			&_lock);
7518c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e1000000.clcd");
7528c2ecf20Sopenharmony_ci
7538c2ecf20Sopenharmony_ci	/* i2s */
7548c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2s_src_mclk", i2s_src_parents,
7558c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2s_src_parents), CLK_SET_RATE_NO_REPARENT,
7568c2ecf20Sopenharmony_ci			SPEAR1340_I2S_CLK_CFG, SPEAR1340_I2S_SRC_CLK_SHIFT,
7578c2ecf20Sopenharmony_ci			SPEAR1340_I2S_SRC_CLK_MASK, 0, &_lock);
7588c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_src_mclk", NULL);
7598c2ecf20Sopenharmony_ci
7608c2ecf20Sopenharmony_ci	clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mclk",
7618c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1340_I2S_CLK_CFG,
7628c2ecf20Sopenharmony_ci			&i2s_prs1_masks, i2s_prs1_rtbl,
7638c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL);
7648c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_prs1_clk", NULL);
7658c2ecf20Sopenharmony_ci
7668c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2s_ref_mclk", i2s_ref_parents,
7678c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2s_ref_parents),
7688c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
7698c2ecf20Sopenharmony_ci			SPEAR1340_I2S_CLK_CFG, SPEAR1340_I2S_REF_SHIFT,
7708c2ecf20Sopenharmony_ci			SPEAR1340_I2S_REF_SEL_MASK, 0, &_lock);
7718c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_ref_mclk", NULL);
7728c2ecf20Sopenharmony_ci
7738c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mclk", 0,
7748c2ecf20Sopenharmony_ci			SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_I2S_REF_PAD_CLK_ENB,
7758c2ecf20Sopenharmony_ci			0, &_lock);
7768c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL);
7778c2ecf20Sopenharmony_ci
7788c2ecf20Sopenharmony_ci	clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gclk", "i2s_ref_mclk",
7798c2ecf20Sopenharmony_ci			0, SPEAR1340_I2S_CLK_CFG, &i2s_sclk_masks,
7808c2ecf20Sopenharmony_ci			i2s_sclk_rtbl, ARRAY_SIZE(i2s_sclk_rtbl), &_lock,
7818c2ecf20Sopenharmony_ci			&clk1);
7828c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_sclk_clk", NULL);
7838c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "i2s_sclk_gclk", NULL);
7848c2ecf20Sopenharmony_ci
7858c2ecf20Sopenharmony_ci	/* clock derived from ahb clk */
7868c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0,
7878c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2C0_CLK_ENB, 0,
7888c2ecf20Sopenharmony_ci			&_lock);
7898c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0280000.i2c");
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2c1_clk", "ahb_clk", 0,
7928c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_I2C1_CLK_ENB, 0,
7938c2ecf20Sopenharmony_ci			&_lock);
7948c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b4000000.i2c");
7958c2ecf20Sopenharmony_ci
7968c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "dma_clk", "ahb_clk", 0,
7978c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_DMA_CLK_ENB, 0,
7988c2ecf20Sopenharmony_ci			&_lock);
7998c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "ea800000.dma");
8008c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "eb000000.dma");
8018c2ecf20Sopenharmony_ci
8028c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0,
8038c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GMAC_CLK_ENB, 0,
8048c2ecf20Sopenharmony_ci			&_lock);
8058c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e2000000.eth");
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "fsmc_clk", "ahb_clk", 0,
8088c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_FSMC_CLK_ENB, 0,
8098c2ecf20Sopenharmony_ci			&_lock);
8108c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b0000000.flash");
8118c2ecf20Sopenharmony_ci
8128c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "smi_clk", "ahb_clk", 0,
8138c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SMI_CLK_ENB, 0,
8148c2ecf20Sopenharmony_ci			&_lock);
8158c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "ea000000.flash");
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "usbh0_clk", "ahb_clk", 0,
8188c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UHC0_CLK_ENB, 0,
8198c2ecf20Sopenharmony_ci			&_lock);
8208c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e4000000.ohci");
8218c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e4800000.ehci");
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "usbh1_clk", "ahb_clk", 0,
8248c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UHC1_CLK_ENB, 0,
8258c2ecf20Sopenharmony_ci			&_lock);
8268c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e5000000.ohci");
8278c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e5800000.ehci");
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "uoc_clk", "ahb_clk", 0,
8308c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UOC_CLK_ENB, 0,
8318c2ecf20Sopenharmony_ci			&_lock);
8328c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e3800000.otg");
8338c2ecf20Sopenharmony_ci
8348c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "pcie_sata_clk", "ahb_clk", 0,
8358c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_PCIE_SATA_CLK_ENB,
8368c2ecf20Sopenharmony_ci			0, &_lock);
8378c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b1000000.pcie");
8388c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b1000000.ahci");
8398c2ecf20Sopenharmony_ci
8408c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
8418c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SYSRAM0_CLK_ENB, 0,
8428c2ecf20Sopenharmony_ci			&_lock);
8438c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "sysram0_clk", NULL);
8448c2ecf20Sopenharmony_ci
8458c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "sysram1_clk", "ahb_clk", 0,
8468c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SYSRAM1_CLK_ENB, 0,
8478c2ecf20Sopenharmony_ci			&_lock);
8488c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "sysram1_clk", NULL);
8498c2ecf20Sopenharmony_ci
8508c2ecf20Sopenharmony_ci	clk = clk_register_aux("adc_syn_clk", "adc_syn_gclk", "ahb_clk",
8518c2ecf20Sopenharmony_ci			0, SPEAR1340_ADC_CLK_SYNT, NULL, adc_rtbl,
8528c2ecf20Sopenharmony_ci			ARRAY_SIZE(adc_rtbl), &_lock, &clk1);
8538c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "adc_syn_clk", NULL);
8548c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "adc_syn_gclk", NULL);
8558c2ecf20Sopenharmony_ci
8568c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "adc_clk", "adc_syn_gclk",
8578c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1340_PERIP1_CLK_ENB,
8588c2ecf20Sopenharmony_ci			SPEAR1340_ADC_CLK_ENB, 0, &_lock);
8598c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0080000.adc");
8608c2ecf20Sopenharmony_ci
8618c2ecf20Sopenharmony_ci	/* clock derived from apb clk */
8628c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ssp_clk", "apb_clk", 0,
8638c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SSP_CLK_ENB, 0,
8648c2ecf20Sopenharmony_ci			&_lock);
8658c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0100000.spi");
8668c2ecf20Sopenharmony_ci
8678c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpio0_clk", "apb_clk", 0,
8688c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPIO0_CLK_ENB, 0,
8698c2ecf20Sopenharmony_ci			&_lock);
8708c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0600000.gpio");
8718c2ecf20Sopenharmony_ci
8728c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpio1_clk", "apb_clk", 0,
8738c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPIO1_CLK_ENB, 0,
8748c2ecf20Sopenharmony_ci			&_lock);
8758c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0680000.gpio");
8768c2ecf20Sopenharmony_ci
8778c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2s_play_clk", "apb_clk", 0,
8788c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2S_PLAY_CLK_ENB, 0,
8798c2ecf20Sopenharmony_ci			&_lock);
8808c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b2400000.i2s-play");
8818c2ecf20Sopenharmony_ci
8828c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2s_rec_clk", "apb_clk", 0,
8838c2ecf20Sopenharmony_ci			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2S_REC_CLK_ENB, 0,
8848c2ecf20Sopenharmony_ci			&_lock);
8858c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b2000000.i2s-rec");
8868c2ecf20Sopenharmony_ci
8878c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "kbd_clk", "apb_clk", 0,
8888c2ecf20Sopenharmony_ci			SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_KBD_CLK_ENB, 0,
8898c2ecf20Sopenharmony_ci			&_lock);
8908c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0300000.kbd");
8918c2ecf20Sopenharmony_ci
8928c2ecf20Sopenharmony_ci	/* RAS clks */
8938c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gen_syn0_1_mclk", gen_synth0_1_parents,
8948c2ecf20Sopenharmony_ci			ARRAY_SIZE(gen_synth0_1_parents),
8958c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT, SPEAR1340_PLL_CFG,
8968c2ecf20Sopenharmony_ci			SPEAR1340_GEN_SYNT0_1_CLK_SHIFT,
8978c2ecf20Sopenharmony_ci			SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock);
8988c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn0_1_mclk", NULL);
8998c2ecf20Sopenharmony_ci
9008c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gen_syn2_3_mclk", gen_synth2_3_parents,
9018c2ecf20Sopenharmony_ci			ARRAY_SIZE(gen_synth2_3_parents),
9028c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT, SPEAR1340_PLL_CFG,
9038c2ecf20Sopenharmony_ci			SPEAR1340_GEN_SYNT2_3_CLK_SHIFT,
9048c2ecf20Sopenharmony_ci			SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock);
9058c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn2_3_mclk", NULL);
9068c2ecf20Sopenharmony_ci
9078c2ecf20Sopenharmony_ci	clk = clk_register_frac("gen_syn0_clk", "gen_syn0_1_mclk", 0,
9088c2ecf20Sopenharmony_ci			SPEAR1340_GEN_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl),
9098c2ecf20Sopenharmony_ci			&_lock);
9108c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn0_clk", NULL);
9118c2ecf20Sopenharmony_ci
9128c2ecf20Sopenharmony_ci	clk = clk_register_frac("gen_syn1_clk", "gen_syn0_1_mclk", 0,
9138c2ecf20Sopenharmony_ci			SPEAR1340_GEN_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl),
9148c2ecf20Sopenharmony_ci			&_lock);
9158c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn1_clk", NULL);
9168c2ecf20Sopenharmony_ci
9178c2ecf20Sopenharmony_ci	clk = clk_register_frac("gen_syn2_clk", "gen_syn2_3_mclk", 0,
9188c2ecf20Sopenharmony_ci			SPEAR1340_GEN_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl),
9198c2ecf20Sopenharmony_ci			&_lock);
9208c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn2_clk", NULL);
9218c2ecf20Sopenharmony_ci
9228c2ecf20Sopenharmony_ci	clk = clk_register_frac("gen_syn3_clk", "gen_syn2_3_mclk", 0,
9238c2ecf20Sopenharmony_ci			SPEAR1340_GEN_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl),
9248c2ecf20Sopenharmony_ci			&_lock);
9258c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn3_clk", NULL);
9268c2ecf20Sopenharmony_ci
9278c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "mali_clk", "gen_syn3_clk",
9288c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1340_PERIP3_CLK_ENB,
9298c2ecf20Sopenharmony_ci			SPEAR1340_MALI_CLK_ENB, 0, &_lock);
9308c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "mali");
9318c2ecf20Sopenharmony_ci
9328c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "cec0_clk", "ahb_clk", 0,
9338c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CEC0_CLK_ENB, 0,
9348c2ecf20Sopenharmony_ci			&_lock);
9358c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "spear_cec.0");
9368c2ecf20Sopenharmony_ci
9378c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "cec1_clk", "ahb_clk", 0,
9388c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CEC1_CLK_ENB, 0,
9398c2ecf20Sopenharmony_ci			&_lock);
9408c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "spear_cec.1");
9418c2ecf20Sopenharmony_ci
9428c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "spdif_out_mclk", spdif_out_parents,
9438c2ecf20Sopenharmony_ci			ARRAY_SIZE(spdif_out_parents),
9448c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
9458c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_OUT_CLK_SHIFT,
9468c2ecf20Sopenharmony_ci			SPEAR1340_SPDIF_CLK_MASK, 0, &_lock);
9478c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "spdif_out_mclk", NULL);
9488c2ecf20Sopenharmony_ci
9498c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "spdif_out_clk", "spdif_out_mclk",
9508c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1340_PERIP3_CLK_ENB,
9518c2ecf20Sopenharmony_ci			SPEAR1340_SPDIF_OUT_CLK_ENB, 0, &_lock);
9528c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "d0000000.spdif-out");
9538c2ecf20Sopenharmony_ci
9548c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "spdif_in_mclk", spdif_in_parents,
9558c2ecf20Sopenharmony_ci			ARRAY_SIZE(spdif_in_parents),
9568c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
9578c2ecf20Sopenharmony_ci			SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_IN_CLK_SHIFT,
9588c2ecf20Sopenharmony_ci			SPEAR1340_SPDIF_CLK_MASK, 0, &_lock);
9598c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "spdif_in_mclk", NULL);
9608c2ecf20Sopenharmony_ci
9618c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "spdif_in_clk", "spdif_in_mclk",
9628c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1340_PERIP3_CLK_ENB,
9638c2ecf20Sopenharmony_ci			SPEAR1340_SPDIF_IN_CLK_ENB, 0, &_lock);
9648c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "d0100000.spdif-in");
9658c2ecf20Sopenharmony_ci
9668c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "acp_clk", "ahb_clk", 0,
9678c2ecf20Sopenharmony_ci			SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0,
9688c2ecf20Sopenharmony_ci			&_lock);
9698c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "acp_clk");
9708c2ecf20Sopenharmony_ci
9718c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "plgpio_clk", "ahb_clk", 0,
9728c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0,
9738c2ecf20Sopenharmony_ci			&_lock);
9748c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e2800000.gpio");
9758c2ecf20Sopenharmony_ci
9768c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "video_dec_clk", "ahb_clk", 0,
9778c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB,
9788c2ecf20Sopenharmony_ci			0, &_lock);
9798c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "video_dec");
9808c2ecf20Sopenharmony_ci
9818c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "video_enc_clk", "ahb_clk", 0,
9828c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB,
9838c2ecf20Sopenharmony_ci			0, &_lock);
9848c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "video_enc");
9858c2ecf20Sopenharmony_ci
9868c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "video_in_clk", "ahb_clk", 0,
9878c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0,
9888c2ecf20Sopenharmony_ci			&_lock);
9898c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "spear_vip");
9908c2ecf20Sopenharmony_ci
9918c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "cam0_clk", "ahb_clk", 0,
9928c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0,
9938c2ecf20Sopenharmony_ci			&_lock);
9948c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "d0200000.cam0");
9958c2ecf20Sopenharmony_ci
9968c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "cam1_clk", "ahb_clk", 0,
9978c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0,
9988c2ecf20Sopenharmony_ci			&_lock);
9998c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "d0300000.cam1");
10008c2ecf20Sopenharmony_ci
10018c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "cam2_clk", "ahb_clk", 0,
10028c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0,
10038c2ecf20Sopenharmony_ci			&_lock);
10048c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "d0400000.cam2");
10058c2ecf20Sopenharmony_ci
10068c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "cam3_clk", "ahb_clk", 0,
10078c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0,
10088c2ecf20Sopenharmony_ci			&_lock);
10098c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "d0500000.cam3");
10108c2ecf20Sopenharmony_ci
10118c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "pwm_clk", "ahb_clk", 0,
10128c2ecf20Sopenharmony_ci			SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PWM_CLK_ENB, 0,
10138c2ecf20Sopenharmony_ci			&_lock);
10148c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0180000.pwm");
10158c2ecf20Sopenharmony_ci}
1016