18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * arch/arm/mach-spear13xx/spear1310_clock.c
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * SPEAr1310 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/* PLL related registers and bit values */
228c2ecf20Sopenharmony_ci#define SPEAR1310_PLL_CFG			(misc_base + 0x210)
238c2ecf20Sopenharmony_ci	/* PLL_CFG bit values */
248c2ecf20Sopenharmony_ci	#define SPEAR1310_CLCD_SYNT_CLK_MASK		1
258c2ecf20Sopenharmony_ci	#define SPEAR1310_CLCD_SYNT_CLK_SHIFT		31
268c2ecf20Sopenharmony_ci	#define SPEAR1310_RAS_SYNT2_3_CLK_MASK		2
278c2ecf20Sopenharmony_ci	#define SPEAR1310_RAS_SYNT2_3_CLK_SHIFT		29
288c2ecf20Sopenharmony_ci	#define SPEAR1310_RAS_SYNT_CLK_MASK		2
298c2ecf20Sopenharmony_ci	#define SPEAR1310_RAS_SYNT0_1_CLK_SHIFT		27
308c2ecf20Sopenharmony_ci	#define SPEAR1310_PLL_CLK_MASK			2
318c2ecf20Sopenharmony_ci	#define SPEAR1310_PLL3_CLK_SHIFT		24
328c2ecf20Sopenharmony_ci	#define SPEAR1310_PLL2_CLK_SHIFT		22
338c2ecf20Sopenharmony_ci	#define SPEAR1310_PLL1_CLK_SHIFT		20
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define SPEAR1310_PLL1_CTR			(misc_base + 0x214)
368c2ecf20Sopenharmony_ci#define SPEAR1310_PLL1_FRQ			(misc_base + 0x218)
378c2ecf20Sopenharmony_ci#define SPEAR1310_PLL2_CTR			(misc_base + 0x220)
388c2ecf20Sopenharmony_ci#define SPEAR1310_PLL2_FRQ			(misc_base + 0x224)
398c2ecf20Sopenharmony_ci#define SPEAR1310_PLL3_CTR			(misc_base + 0x22C)
408c2ecf20Sopenharmony_ci#define SPEAR1310_PLL3_FRQ			(misc_base + 0x230)
418c2ecf20Sopenharmony_ci#define SPEAR1310_PLL4_CTR			(misc_base + 0x238)
428c2ecf20Sopenharmony_ci#define SPEAR1310_PLL4_FRQ			(misc_base + 0x23C)
438c2ecf20Sopenharmony_ci#define SPEAR1310_PERIP_CLK_CFG			(misc_base + 0x244)
448c2ecf20Sopenharmony_ci	/* PERIP_CLK_CFG bit values */
458c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT_OSC24_VAL			0
468c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT_APB_VAL			1
478c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT_CLK_MASK			1
488c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT3_CLK_SHIFT		11
498c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT2_CLK_SHIFT		10
508c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT1_CLK_SHIFT		9
518c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT0_CLK_SHIFT		8
528c2ecf20Sopenharmony_ci	#define SPEAR1310_UART_CLK_PLL5_VAL		0
538c2ecf20Sopenharmony_ci	#define SPEAR1310_UART_CLK_OSC24_VAL		1
548c2ecf20Sopenharmony_ci	#define SPEAR1310_UART_CLK_SYNT_VAL		2
558c2ecf20Sopenharmony_ci	#define SPEAR1310_UART_CLK_MASK			2
568c2ecf20Sopenharmony_ci	#define SPEAR1310_UART_CLK_SHIFT		4
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci	#define SPEAR1310_AUX_CLK_PLL5_VAL		0
598c2ecf20Sopenharmony_ci	#define SPEAR1310_AUX_CLK_SYNT_VAL		1
608c2ecf20Sopenharmony_ci	#define SPEAR1310_CLCD_CLK_MASK			2
618c2ecf20Sopenharmony_ci	#define SPEAR1310_CLCD_CLK_SHIFT		2
628c2ecf20Sopenharmony_ci	#define SPEAR1310_C3_CLK_MASK			1
638c2ecf20Sopenharmony_ci	#define SPEAR1310_C3_CLK_SHIFT			1
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define SPEAR1310_GMAC_CLK_CFG			(misc_base + 0x248)
668c2ecf20Sopenharmony_ci	#define SPEAR1310_GMAC_PHY_IF_SEL_MASK		3
678c2ecf20Sopenharmony_ci	#define SPEAR1310_GMAC_PHY_IF_SEL_SHIFT		4
688c2ecf20Sopenharmony_ci	#define SPEAR1310_GMAC_PHY_CLK_MASK		1
698c2ecf20Sopenharmony_ci	#define SPEAR1310_GMAC_PHY_CLK_SHIFT		3
708c2ecf20Sopenharmony_ci	#define SPEAR1310_GMAC_PHY_INPUT_CLK_MASK	2
718c2ecf20Sopenharmony_ci	#define SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT	1
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define SPEAR1310_I2S_CLK_CFG			(misc_base + 0x24C)
748c2ecf20Sopenharmony_ci	/* I2S_CLK_CFG register mask */
758c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_SCLK_X_MASK		0x1F
768c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_SCLK_X_SHIFT		27
778c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_SCLK_Y_MASK		0x1F
788c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_SCLK_Y_SHIFT		22
798c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_SCLK_EQ_SEL_SHIFT		21
808c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_SCLK_SYNTH_ENB		20
818c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_PRS1_CLK_X_MASK		0xFF
828c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_PRS1_CLK_X_SHIFT		12
838c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_PRS1_CLK_Y_MASK		0xFF
848c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_PRS1_CLK_Y_SHIFT		4
858c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT		3
868c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_REF_SEL_MASK		1
878c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_REF_SHIFT			2
888c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_SRC_CLK_MASK		2
898c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_SRC_CLK_SHIFT		0
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define SPEAR1310_C3_CLK_SYNT			(misc_base + 0x250)
928c2ecf20Sopenharmony_ci#define SPEAR1310_UART_CLK_SYNT			(misc_base + 0x254)
938c2ecf20Sopenharmony_ci#define SPEAR1310_GMAC_CLK_SYNT			(misc_base + 0x258)
948c2ecf20Sopenharmony_ci#define SPEAR1310_SDHCI_CLK_SYNT		(misc_base + 0x25C)
958c2ecf20Sopenharmony_ci#define SPEAR1310_CFXD_CLK_SYNT			(misc_base + 0x260)
968c2ecf20Sopenharmony_ci#define SPEAR1310_ADC_CLK_SYNT			(misc_base + 0x264)
978c2ecf20Sopenharmony_ci#define SPEAR1310_AMBA_CLK_SYNT			(misc_base + 0x268)
988c2ecf20Sopenharmony_ci#define SPEAR1310_CLCD_CLK_SYNT			(misc_base + 0x270)
998c2ecf20Sopenharmony_ci#define SPEAR1310_RAS_CLK_SYNT0			(misc_base + 0x280)
1008c2ecf20Sopenharmony_ci#define SPEAR1310_RAS_CLK_SYNT1			(misc_base + 0x288)
1018c2ecf20Sopenharmony_ci#define SPEAR1310_RAS_CLK_SYNT2			(misc_base + 0x290)
1028c2ecf20Sopenharmony_ci#define SPEAR1310_RAS_CLK_SYNT3			(misc_base + 0x298)
1038c2ecf20Sopenharmony_ci	/* Check Fractional synthesizer reg masks */
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define SPEAR1310_PERIP1_CLK_ENB		(misc_base + 0x300)
1068c2ecf20Sopenharmony_ci	/* PERIP1_CLK_ENB register masks */
1078c2ecf20Sopenharmony_ci	#define SPEAR1310_RTC_CLK_ENB			31
1088c2ecf20Sopenharmony_ci	#define SPEAR1310_ADC_CLK_ENB			30
1098c2ecf20Sopenharmony_ci	#define SPEAR1310_C3_CLK_ENB			29
1108c2ecf20Sopenharmony_ci	#define SPEAR1310_JPEG_CLK_ENB			28
1118c2ecf20Sopenharmony_ci	#define SPEAR1310_CLCD_CLK_ENB			27
1128c2ecf20Sopenharmony_ci	#define SPEAR1310_DMA_CLK_ENB			25
1138c2ecf20Sopenharmony_ci	#define SPEAR1310_GPIO1_CLK_ENB			24
1148c2ecf20Sopenharmony_ci	#define SPEAR1310_GPIO0_CLK_ENB			23
1158c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT1_CLK_ENB			22
1168c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT0_CLK_ENB			21
1178c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S0_CLK_ENB			20
1188c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S1_CLK_ENB			19
1198c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C0_CLK_ENB			18
1208c2ecf20Sopenharmony_ci	#define SPEAR1310_SSP_CLK_ENB			17
1218c2ecf20Sopenharmony_ci	#define SPEAR1310_UART_CLK_ENB			15
1228c2ecf20Sopenharmony_ci	#define SPEAR1310_PCIE_SATA_2_CLK_ENB		14
1238c2ecf20Sopenharmony_ci	#define SPEAR1310_PCIE_SATA_1_CLK_ENB		13
1248c2ecf20Sopenharmony_ci	#define SPEAR1310_PCIE_SATA_0_CLK_ENB		12
1258c2ecf20Sopenharmony_ci	#define SPEAR1310_UOC_CLK_ENB			11
1268c2ecf20Sopenharmony_ci	#define SPEAR1310_UHC1_CLK_ENB			10
1278c2ecf20Sopenharmony_ci	#define SPEAR1310_UHC0_CLK_ENB			9
1288c2ecf20Sopenharmony_ci	#define SPEAR1310_GMAC_CLK_ENB			8
1298c2ecf20Sopenharmony_ci	#define SPEAR1310_CFXD_CLK_ENB			7
1308c2ecf20Sopenharmony_ci	#define SPEAR1310_SDHCI_CLK_ENB			6
1318c2ecf20Sopenharmony_ci	#define SPEAR1310_SMI_CLK_ENB			5
1328c2ecf20Sopenharmony_ci	#define SPEAR1310_FSMC_CLK_ENB			4
1338c2ecf20Sopenharmony_ci	#define SPEAR1310_SYSRAM0_CLK_ENB		3
1348c2ecf20Sopenharmony_ci	#define SPEAR1310_SYSRAM1_CLK_ENB		2
1358c2ecf20Sopenharmony_ci	#define SPEAR1310_SYSROM_CLK_ENB		1
1368c2ecf20Sopenharmony_ci	#define SPEAR1310_BUS_CLK_ENB			0
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci#define SPEAR1310_PERIP2_CLK_ENB		(misc_base + 0x304)
1398c2ecf20Sopenharmony_ci	/* PERIP2_CLK_ENB register masks */
1408c2ecf20Sopenharmony_ci	#define SPEAR1310_THSENS_CLK_ENB		8
1418c2ecf20Sopenharmony_ci	#define SPEAR1310_I2S_REF_PAD_CLK_ENB		7
1428c2ecf20Sopenharmony_ci	#define SPEAR1310_ACP_CLK_ENB			6
1438c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT3_CLK_ENB			5
1448c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT2_CLK_ENB			4
1458c2ecf20Sopenharmony_ci	#define SPEAR1310_KBD_CLK_ENB			3
1468c2ecf20Sopenharmony_ci	#define SPEAR1310_CPU_DBG_CLK_ENB		2
1478c2ecf20Sopenharmony_ci	#define SPEAR1310_DDR_CORE_CLK_ENB		1
1488c2ecf20Sopenharmony_ci	#define SPEAR1310_DDR_CTRL_CLK_ENB		0
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci#define SPEAR1310_RAS_CLK_ENB			(misc_base + 0x310)
1518c2ecf20Sopenharmony_ci	/* RAS_CLK_ENB register masks */
1528c2ecf20Sopenharmony_ci	#define SPEAR1310_SYNT3_CLK_ENB			17
1538c2ecf20Sopenharmony_ci	#define SPEAR1310_SYNT2_CLK_ENB			16
1548c2ecf20Sopenharmony_ci	#define SPEAR1310_SYNT1_CLK_ENB			15
1558c2ecf20Sopenharmony_ci	#define SPEAR1310_SYNT0_CLK_ENB			14
1568c2ecf20Sopenharmony_ci	#define SPEAR1310_PCLK3_CLK_ENB			13
1578c2ecf20Sopenharmony_ci	#define SPEAR1310_PCLK2_CLK_ENB			12
1588c2ecf20Sopenharmony_ci	#define SPEAR1310_PCLK1_CLK_ENB			11
1598c2ecf20Sopenharmony_ci	#define SPEAR1310_PCLK0_CLK_ENB			10
1608c2ecf20Sopenharmony_ci	#define SPEAR1310_PLL3_CLK_ENB			9
1618c2ecf20Sopenharmony_ci	#define SPEAR1310_PLL2_CLK_ENB			8
1628c2ecf20Sopenharmony_ci	#define SPEAR1310_C125M_PAD_CLK_ENB		7
1638c2ecf20Sopenharmony_ci	#define SPEAR1310_C30M_CLK_ENB			6
1648c2ecf20Sopenharmony_ci	#define SPEAR1310_C48M_CLK_ENB			5
1658c2ecf20Sopenharmony_ci	#define SPEAR1310_OSC_25M_CLK_ENB		4
1668c2ecf20Sopenharmony_ci	#define SPEAR1310_OSC_32K_CLK_ENB		3
1678c2ecf20Sopenharmony_ci	#define SPEAR1310_OSC_24M_CLK_ENB		2
1688c2ecf20Sopenharmony_ci	#define SPEAR1310_PCLK_CLK_ENB			1
1698c2ecf20Sopenharmony_ci	#define SPEAR1310_ACLK_CLK_ENB			0
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci/* RAS Area Control Register */
1728c2ecf20Sopenharmony_ci#define SPEAR1310_RAS_CTRL_REG0			(ras_base + 0x000)
1738c2ecf20Sopenharmony_ci	#define SPEAR1310_SSP1_CLK_MASK			3
1748c2ecf20Sopenharmony_ci	#define SPEAR1310_SSP1_CLK_SHIFT		26
1758c2ecf20Sopenharmony_ci	#define SPEAR1310_TDM_CLK_MASK			1
1768c2ecf20Sopenharmony_ci	#define SPEAR1310_TDM2_CLK_SHIFT		24
1778c2ecf20Sopenharmony_ci	#define SPEAR1310_TDM1_CLK_SHIFT		23
1788c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C_CLK_MASK			1
1798c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C7_CLK_SHIFT		22
1808c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C6_CLK_SHIFT		21
1818c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C5_CLK_SHIFT		20
1828c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C4_CLK_SHIFT		19
1838c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C3_CLK_SHIFT		18
1848c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C2_CLK_SHIFT		17
1858c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C1_CLK_SHIFT		16
1868c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT64_CLK_MASK		1
1878c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT64_CLK_SHIFT		15
1888c2ecf20Sopenharmony_ci	#define SPEAR1310_RAS_UART_CLK_MASK		1
1898c2ecf20Sopenharmony_ci	#define SPEAR1310_UART5_CLK_SHIFT		14
1908c2ecf20Sopenharmony_ci	#define SPEAR1310_UART4_CLK_SHIFT		13
1918c2ecf20Sopenharmony_ci	#define SPEAR1310_UART3_CLK_SHIFT		12
1928c2ecf20Sopenharmony_ci	#define SPEAR1310_UART2_CLK_SHIFT		11
1938c2ecf20Sopenharmony_ci	#define SPEAR1310_UART1_CLK_SHIFT		10
1948c2ecf20Sopenharmony_ci	#define SPEAR1310_PCI_CLK_MASK			1
1958c2ecf20Sopenharmony_ci	#define SPEAR1310_PCI_CLK_SHIFT			0
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci#define SPEAR1310_RAS_CTRL_REG1			(ras_base + 0x004)
1988c2ecf20Sopenharmony_ci	#define SPEAR1310_PHY_CLK_MASK			0x3
1998c2ecf20Sopenharmony_ci	#define SPEAR1310_RMII_PHY_CLK_SHIFT		0
2008c2ecf20Sopenharmony_ci	#define SPEAR1310_SMII_RGMII_PHY_CLK_SHIFT	2
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci#define SPEAR1310_RAS_SW_CLK_CTRL		(ras_base + 0x0148)
2038c2ecf20Sopenharmony_ci	#define SPEAR1310_CAN1_CLK_ENB			25
2048c2ecf20Sopenharmony_ci	#define SPEAR1310_CAN0_CLK_ENB			24
2058c2ecf20Sopenharmony_ci	#define SPEAR1310_GPT64_CLK_ENB			23
2068c2ecf20Sopenharmony_ci	#define SPEAR1310_SSP1_CLK_ENB			22
2078c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C7_CLK_ENB			21
2088c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C6_CLK_ENB			20
2098c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C5_CLK_ENB			19
2108c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C4_CLK_ENB			18
2118c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C3_CLK_ENB			17
2128c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C2_CLK_ENB			16
2138c2ecf20Sopenharmony_ci	#define SPEAR1310_I2C1_CLK_ENB			15
2148c2ecf20Sopenharmony_ci	#define SPEAR1310_UART5_CLK_ENB			14
2158c2ecf20Sopenharmony_ci	#define SPEAR1310_UART4_CLK_ENB			13
2168c2ecf20Sopenharmony_ci	#define SPEAR1310_UART3_CLK_ENB			12
2178c2ecf20Sopenharmony_ci	#define SPEAR1310_UART2_CLK_ENB			11
2188c2ecf20Sopenharmony_ci	#define SPEAR1310_UART1_CLK_ENB			10
2198c2ecf20Sopenharmony_ci	#define SPEAR1310_RS485_1_CLK_ENB		9
2208c2ecf20Sopenharmony_ci	#define SPEAR1310_RS485_0_CLK_ENB		8
2218c2ecf20Sopenharmony_ci	#define SPEAR1310_TDM2_CLK_ENB			7
2228c2ecf20Sopenharmony_ci	#define SPEAR1310_TDM1_CLK_ENB			6
2238c2ecf20Sopenharmony_ci	#define SPEAR1310_PCI_CLK_ENB			5
2248c2ecf20Sopenharmony_ci	#define SPEAR1310_GMII_CLK_ENB			4
2258c2ecf20Sopenharmony_ci	#define SPEAR1310_MII2_CLK_ENB			3
2268c2ecf20Sopenharmony_ci	#define SPEAR1310_MII1_CLK_ENB			2
2278c2ecf20Sopenharmony_ci	#define SPEAR1310_MII0_CLK_ENB			1
2288c2ecf20Sopenharmony_ci	#define SPEAR1310_ESRAM_CLK_ENB			0
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_cistatic DEFINE_SPINLOCK(_lock);
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci/* pll rate configuration table, in ascending order of rates */
2338c2ecf20Sopenharmony_cistatic struct pll_rate_tbl pll_rtbl[] = {
2348c2ecf20Sopenharmony_ci	/* PCLK 24MHz */
2358c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x83, .n = 0x04, .p = 0x5}, /* vco 1572, pll 49.125 MHz */
2368c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x3}, /* vco 1000, pll 125 MHz */
2378c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x64, .n = 0x06, .p = 0x1}, /* vco 800, pll 400 MHz */
2388c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x1}, /* vco 1000, pll 500 MHz */
2398c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x1}, /* vco 1328, pll 664 MHz */
2408c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x1}, /* vco 1600, pll 800 MHz */
2418c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
2428c2ecf20Sopenharmony_ci};
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/* vco-pll4 rate configuration table, in ascending order of rates */
2458c2ecf20Sopenharmony_cistatic struct pll_rate_tbl pll4_rtbl[] = {
2468c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x2}, /* vco 1000, pll 250 MHz */
2478c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x2}, /* vco 1328, pll 332 MHz */
2488c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x2}, /* vco 1600, pll 400 MHz */
2498c2ecf20Sopenharmony_ci	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
2508c2ecf20Sopenharmony_ci};
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci/* aux rate configuration table, in ascending order of rates */
2538c2ecf20Sopenharmony_cistatic struct aux_rate_tbl aux_rtbl[] = {
2548c2ecf20Sopenharmony_ci	/* For VCO1div2 = 500 MHz */
2558c2ecf20Sopenharmony_ci	{.xscale = 10, .yscale = 204, .eq = 0}, /* 12.29 MHz */
2568c2ecf20Sopenharmony_ci	{.xscale = 4, .yscale = 21, .eq = 0}, /* 48 MHz */
2578c2ecf20Sopenharmony_ci	{.xscale = 2, .yscale = 6, .eq = 0}, /* 83 MHz */
2588c2ecf20Sopenharmony_ci	{.xscale = 2, .yscale = 4, .eq = 0}, /* 125 MHz */
2598c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 3, .eq = 1}, /* 166 MHz */
2608c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 2, .eq = 1}, /* 250 MHz */
2618c2ecf20Sopenharmony_ci};
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci/* gmac rate configuration table, in ascending order of rates */
2648c2ecf20Sopenharmony_cistatic struct aux_rate_tbl gmac_rtbl[] = {
2658c2ecf20Sopenharmony_ci	/* For gmac phy input clk */
2668c2ecf20Sopenharmony_ci	{.xscale = 2, .yscale = 6, .eq = 0}, /* divided by 6 */
2678c2ecf20Sopenharmony_ci	{.xscale = 2, .yscale = 4, .eq = 0}, /* divided by 4 */
2688c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 3, .eq = 1}, /* divided by 3 */
2698c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 2, .eq = 1}, /* divided by 2 */
2708c2ecf20Sopenharmony_ci};
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci/* clcd rate configuration table, in ascending order of rates */
2738c2ecf20Sopenharmony_cistatic struct frac_rate_tbl clcd_rtbl[] = {
2748c2ecf20Sopenharmony_ci	{.div = 0x14000}, /* 25 Mhz , for vc01div4 = 250 MHz*/
2758c2ecf20Sopenharmony_ci	{.div = 0x1284B}, /* 27 Mhz , for vc01div4 = 250 MHz*/
2768c2ecf20Sopenharmony_ci	{.div = 0x0D8D3}, /* 58 Mhz , for vco1div4 = 393 MHz */
2778c2ecf20Sopenharmony_ci	{.div = 0x0B72C}, /* 58 Mhz , for vco1div4 = 332 MHz */
2788c2ecf20Sopenharmony_ci	{.div = 0x089EE}, /* 58 Mhz , for vc01div4 = 250 MHz*/
2798c2ecf20Sopenharmony_ci	{.div = 0x06f1C}, /* 72 Mhz , for vc01div4 = 250 MHz*/
2808c2ecf20Sopenharmony_ci	{.div = 0x06E58}, /* 58 Mhz , for vco1div4 = 200 MHz */
2818c2ecf20Sopenharmony_ci	{.div = 0x06c1B}, /* 74 Mhz , for vc01div4 = 250 MHz*/
2828c2ecf20Sopenharmony_ci	{.div = 0x04A12}, /* 108 Mhz , for vc01div4 = 250 MHz*/
2838c2ecf20Sopenharmony_ci	{.div = 0x0378E}, /* 144 Mhz , for vc01div4 = 250 MHz*/
2848c2ecf20Sopenharmony_ci};
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci/* i2s prescaler1 masks */
2878c2ecf20Sopenharmony_cistatic const struct aux_clk_masks i2s_prs1_masks = {
2888c2ecf20Sopenharmony_ci	.eq_sel_mask = AUX_EQ_SEL_MASK,
2898c2ecf20Sopenharmony_ci	.eq_sel_shift = SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT,
2908c2ecf20Sopenharmony_ci	.eq1_mask = AUX_EQ1_SEL,
2918c2ecf20Sopenharmony_ci	.eq2_mask = AUX_EQ2_SEL,
2928c2ecf20Sopenharmony_ci	.xscale_sel_mask = SPEAR1310_I2S_PRS1_CLK_X_MASK,
2938c2ecf20Sopenharmony_ci	.xscale_sel_shift = SPEAR1310_I2S_PRS1_CLK_X_SHIFT,
2948c2ecf20Sopenharmony_ci	.yscale_sel_mask = SPEAR1310_I2S_PRS1_CLK_Y_MASK,
2958c2ecf20Sopenharmony_ci	.yscale_sel_shift = SPEAR1310_I2S_PRS1_CLK_Y_SHIFT,
2968c2ecf20Sopenharmony_ci};
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci/* i2s sclk (bit clock) syynthesizers masks */
2998c2ecf20Sopenharmony_cistatic struct aux_clk_masks i2s_sclk_masks = {
3008c2ecf20Sopenharmony_ci	.eq_sel_mask = AUX_EQ_SEL_MASK,
3018c2ecf20Sopenharmony_ci	.eq_sel_shift = SPEAR1310_I2S_SCLK_EQ_SEL_SHIFT,
3028c2ecf20Sopenharmony_ci	.eq1_mask = AUX_EQ1_SEL,
3038c2ecf20Sopenharmony_ci	.eq2_mask = AUX_EQ2_SEL,
3048c2ecf20Sopenharmony_ci	.xscale_sel_mask = SPEAR1310_I2S_SCLK_X_MASK,
3058c2ecf20Sopenharmony_ci	.xscale_sel_shift = SPEAR1310_I2S_SCLK_X_SHIFT,
3068c2ecf20Sopenharmony_ci	.yscale_sel_mask = SPEAR1310_I2S_SCLK_Y_MASK,
3078c2ecf20Sopenharmony_ci	.yscale_sel_shift = SPEAR1310_I2S_SCLK_Y_SHIFT,
3088c2ecf20Sopenharmony_ci	.enable_bit = SPEAR1310_I2S_SCLK_SYNTH_ENB,
3098c2ecf20Sopenharmony_ci};
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci/* i2s prs1 aux rate configuration table, in ascending order of rates */
3128c2ecf20Sopenharmony_cistatic struct aux_rate_tbl i2s_prs1_rtbl[] = {
3138c2ecf20Sopenharmony_ci	/* For parent clk = 49.152 MHz */
3148c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 12, .eq = 0}, /* 2.048 MHz, smp freq = 8Khz */
3158c2ecf20Sopenharmony_ci	{.xscale = 11, .yscale = 96, .eq = 0}, /* 2.816 MHz, smp freq = 11Khz */
3168c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 6, .eq = 0}, /* 4.096 MHz, smp freq = 16Khz */
3178c2ecf20Sopenharmony_ci	{.xscale = 11, .yscale = 48, .eq = 0}, /* 5.632 MHz, smp freq = 22Khz */
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci	/*
3208c2ecf20Sopenharmony_ci	 * with parent clk = 49.152, freq gen is 8.192 MHz, smp freq = 32Khz
3218c2ecf20Sopenharmony_ci	 * with parent clk = 12.288, freq gen is 2.048 MHz, smp freq = 8Khz
3228c2ecf20Sopenharmony_ci	 */
3238c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 3, .eq = 0},
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci	/* For parent clk = 49.152 MHz */
3268c2ecf20Sopenharmony_ci	{.xscale = 17, .yscale = 37, .eq = 0}, /* 11.289 MHz, smp freq = 44Khz*/
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 2, .eq = 0}, /* 12.288 MHz */
3298c2ecf20Sopenharmony_ci};
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci/* i2s sclk aux rate configuration table, in ascending order of rates */
3328c2ecf20Sopenharmony_cistatic struct aux_rate_tbl i2s_sclk_rtbl[] = {
3338c2ecf20Sopenharmony_ci	/* For i2s_ref_clk = 12.288MHz */
3348c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 4, .eq = 0}, /* 1.53 MHz */
3358c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 2, .eq = 0}, /* 3.07 Mhz */
3368c2ecf20Sopenharmony_ci};
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci/* adc rate configuration table, in ascending order of rates */
3398c2ecf20Sopenharmony_ci/* possible adc range is 2.5 MHz to 20 MHz. */
3408c2ecf20Sopenharmony_cistatic struct aux_rate_tbl adc_rtbl[] = {
3418c2ecf20Sopenharmony_ci	/* For ahb = 166.67 MHz */
3428c2ecf20Sopenharmony_ci	{.xscale = 1, .yscale = 31, .eq = 0}, /* 2.68 MHz */
3438c2ecf20Sopenharmony_ci	{.xscale = 2, .yscale = 21, .eq = 0}, /* 7.94 MHz */
3448c2ecf20Sopenharmony_ci	{.xscale = 4, .yscale = 21, .eq = 0}, /* 15.87 MHz */
3458c2ecf20Sopenharmony_ci	{.xscale = 10, .yscale = 42, .eq = 0}, /* 19.84 MHz */
3468c2ecf20Sopenharmony_ci};
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci/* General synth rate configuration table, in ascending order of rates */
3498c2ecf20Sopenharmony_cistatic struct frac_rate_tbl gen_rtbl[] = {
3508c2ecf20Sopenharmony_ci	/* For vco1div4 = 250 MHz */
3518c2ecf20Sopenharmony_ci	{.div = 0x14000}, /* 25 MHz */
3528c2ecf20Sopenharmony_ci	{.div = 0x0A000}, /* 50 MHz */
3538c2ecf20Sopenharmony_ci	{.div = 0x05000}, /* 100 MHz */
3548c2ecf20Sopenharmony_ci	{.div = 0x02000}, /* 250 MHz */
3558c2ecf20Sopenharmony_ci};
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci/* clock parents */
3588c2ecf20Sopenharmony_cistatic const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", };
3598c2ecf20Sopenharmony_cistatic const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", };
3608c2ecf20Sopenharmony_cistatic const char *uart0_parents[] = { "pll5_clk", "uart_syn_gclk", };
3618c2ecf20Sopenharmony_cistatic const char *c3_parents[] = { "pll5_clk", "c3_syn_gclk", };
3628c2ecf20Sopenharmony_cistatic const char *gmac_phy_input_parents[] = { "gmii_pad_clk", "pll2_clk",
3638c2ecf20Sopenharmony_ci	"osc_25m_clk", };
3648c2ecf20Sopenharmony_cistatic const char *gmac_phy_parents[] = { "phy_input_mclk", "phy_syn_gclk", };
3658c2ecf20Sopenharmony_cistatic const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", };
3668c2ecf20Sopenharmony_cistatic const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_syn_clk", };
3678c2ecf20Sopenharmony_cistatic const char *i2s_src_parents[] = { "vco1div2_clk", "none", "pll3_clk",
3688c2ecf20Sopenharmony_ci	"i2s_src_pad_clk", };
3698c2ecf20Sopenharmony_cistatic const char *i2s_ref_parents[] = { "i2s_src_mclk", "i2s_prs1_clk", };
3708c2ecf20Sopenharmony_cistatic const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk",
3718c2ecf20Sopenharmony_ci	"pll3_clk", };
3728c2ecf20Sopenharmony_cistatic const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco3div2_clk",
3738c2ecf20Sopenharmony_ci	"pll2_clk", };
3748c2ecf20Sopenharmony_cistatic const char *rmii_phy_parents[] = { "ras_tx50_clk", "none",
3758c2ecf20Sopenharmony_ci	"ras_pll2_clk", "ras_syn0_clk", };
3768c2ecf20Sopenharmony_cistatic const char *smii_rgmii_phy_parents[] = { "none", "ras_tx125_clk",
3778c2ecf20Sopenharmony_ci	"ras_pll2_clk", "ras_syn0_clk", };
3788c2ecf20Sopenharmony_cistatic const char *uart_parents[] = { "ras_apb_clk", "gen_syn3_clk", };
3798c2ecf20Sopenharmony_cistatic const char *i2c_parents[] = { "ras_apb_clk", "gen_syn1_clk", };
3808c2ecf20Sopenharmony_cistatic const char *ssp1_parents[] = { "ras_apb_clk", "gen_syn1_clk",
3818c2ecf20Sopenharmony_ci	"ras_plclk0_clk", };
3828c2ecf20Sopenharmony_cistatic const char *pci_parents[] = { "ras_pll3_clk", "gen_syn2_clk", };
3838c2ecf20Sopenharmony_cistatic const char *tdm_parents[] = { "ras_pll3_clk", "gen_syn1_clk", };
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_civoid __init spear1310_clk_init(void __iomem *misc_base, void __iomem *ras_base)
3868c2ecf20Sopenharmony_ci{
3878c2ecf20Sopenharmony_ci	struct clk *clk, *clk1;
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, 0, 32000);
3908c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "osc_32k_clk", NULL);
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "osc_24m_clk", NULL, 0, 24000000);
3938c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "osc_24m_clk", NULL);
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "osc_25m_clk", NULL, 0, 25000000);
3968c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "osc_25m_clk", NULL);
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "gmii_pad_clk", NULL, 0, 125000000);
3998c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gmii_pad_clk", NULL);
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, 0,
4028c2ecf20Sopenharmony_ci				      12288000);
4038c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_src_pad_clk", NULL);
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_ci	/* clock derived from 32 KHz osc clk */
4068c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "rtc-spear", "osc_32k_clk", 0,
4078c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_RTC_CLK_ENB, 0,
4088c2ecf20Sopenharmony_ci			&_lock);
4098c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0580000.rtc");
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci	/* clock derived from 24 or 25 MHz osc clk */
4128c2ecf20Sopenharmony_ci	/* vco-pll */
4138c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "vco1_mclk", vco_parents,
4148c2ecf20Sopenharmony_ci			ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
4158c2ecf20Sopenharmony_ci			SPEAR1310_PLL_CFG, SPEAR1310_PLL1_CLK_SHIFT,
4168c2ecf20Sopenharmony_ci			SPEAR1310_PLL_CLK_MASK, 0, &_lock);
4178c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco1_mclk", NULL);
4188c2ecf20Sopenharmony_ci	clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mclk",
4198c2ecf20Sopenharmony_ci			0, SPEAR1310_PLL1_CTR, SPEAR1310_PLL1_FRQ, pll_rtbl,
4208c2ecf20Sopenharmony_ci			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4218c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco1_clk", NULL);
4228c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "pll1_clk", NULL);
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "vco2_mclk", vco_parents,
4258c2ecf20Sopenharmony_ci			ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
4268c2ecf20Sopenharmony_ci			SPEAR1310_PLL_CFG, SPEAR1310_PLL2_CLK_SHIFT,
4278c2ecf20Sopenharmony_ci			SPEAR1310_PLL_CLK_MASK, 0, &_lock);
4288c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco2_mclk", NULL);
4298c2ecf20Sopenharmony_ci	clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mclk",
4308c2ecf20Sopenharmony_ci			0, SPEAR1310_PLL2_CTR, SPEAR1310_PLL2_FRQ, pll_rtbl,
4318c2ecf20Sopenharmony_ci			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4328c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco2_clk", NULL);
4338c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "pll2_clk", NULL);
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "vco3_mclk", vco_parents,
4368c2ecf20Sopenharmony_ci			ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
4378c2ecf20Sopenharmony_ci			SPEAR1310_PLL_CFG, SPEAR1310_PLL3_CLK_SHIFT,
4388c2ecf20Sopenharmony_ci			SPEAR1310_PLL_CLK_MASK, 0, &_lock);
4398c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco3_mclk", NULL);
4408c2ecf20Sopenharmony_ci	clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mclk",
4418c2ecf20Sopenharmony_ci			0, SPEAR1310_PLL3_CTR, SPEAR1310_PLL3_FRQ, pll_rtbl,
4428c2ecf20Sopenharmony_ci			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4438c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco3_clk", NULL);
4448c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "pll3_clk", NULL);
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci	clk = clk_register_vco_pll("vco4_clk", "pll4_clk", NULL, "osc_24m_clk",
4478c2ecf20Sopenharmony_ci			0, SPEAR1310_PLL4_CTR, SPEAR1310_PLL4_FRQ, pll4_rtbl,
4488c2ecf20Sopenharmony_ci			ARRAY_SIZE(pll4_rtbl), &_lock, &clk1, NULL);
4498c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco4_clk", NULL);
4508c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "pll4_clk", NULL);
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "pll5_clk", "osc_24m_clk", 0,
4538c2ecf20Sopenharmony_ci			48000000);
4548c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "pll5_clk", NULL);
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "pll6_clk", "osc_25m_clk", 0,
4578c2ecf20Sopenharmony_ci			25000000);
4588c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "pll6_clk", NULL);
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci	/* vco div n clocks */
4618c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "vco1div2_clk", "vco1_clk", 0, 1,
4628c2ecf20Sopenharmony_ci			2);
4638c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco1div2_clk", NULL);
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "vco1div4_clk", "vco1_clk", 0, 1,
4668c2ecf20Sopenharmony_ci			4);
4678c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco1div4_clk", NULL);
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "vco2div2_clk", "vco2_clk", 0, 1,
4708c2ecf20Sopenharmony_ci			2);
4718c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco2div2_clk", NULL);
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "vco3div2_clk", "vco3_clk", 0, 1,
4748c2ecf20Sopenharmony_ci			2);
4758c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "vco3div2_clk", NULL);
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ci	/* peripherals */
4788c2ecf20Sopenharmony_ci	clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1,
4798c2ecf20Sopenharmony_ci			128);
4808c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "thermal_gclk", "thermal_clk", 0,
4818c2ecf20Sopenharmony_ci			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_THSENS_CLK_ENB, 0,
4828c2ecf20Sopenharmony_ci			&_lock);
4838c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "spear_thermal");
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ci	/* clock derived from pll4 clk */
4868c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "ddr_clk", "pll4_clk", 0, 1,
4878c2ecf20Sopenharmony_ci			1);
4888c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ddr_clk", NULL);
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci	/* clock derived from pll1 clk */
4918c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "cpu_clk", "pll1_clk",
4928c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, 1, 2);
4938c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "cpu_clk", NULL);
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "wdt_clk", "cpu_clk", 0, 1,
4968c2ecf20Sopenharmony_ci			2);
4978c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "ec800620.wdt");
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "smp_twd_clk", "cpu_clk", 0, 1,
5008c2ecf20Sopenharmony_ci			2);
5018c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "smp_twd");
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "ahb_clk", "pll1_clk", 0, 1,
5048c2ecf20Sopenharmony_ci			6);
5058c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ahb_clk", NULL);
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ci	clk = clk_register_fixed_factor(NULL, "apb_clk", "pll1_clk", 0, 1,
5088c2ecf20Sopenharmony_ci			12);
5098c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "apb_clk", NULL);
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_ci	/* gpt clocks */
5128c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gpt0_mclk", gpt_parents,
5138c2ecf20Sopenharmony_ci			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
5148c2ecf20Sopenharmony_ci			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GPT0_CLK_SHIFT,
5158c2ecf20Sopenharmony_ci			SPEAR1310_GPT_CLK_MASK, 0, &_lock);
5168c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gpt0_mclk", NULL);
5178c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mclk", 0,
5188c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT0_CLK_ENB, 0,
5198c2ecf20Sopenharmony_ci			&_lock);
5208c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "gpt0");
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gpt1_mclk", gpt_parents,
5238c2ecf20Sopenharmony_ci			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
5248c2ecf20Sopenharmony_ci			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GPT1_CLK_SHIFT,
5258c2ecf20Sopenharmony_ci			SPEAR1310_GPT_CLK_MASK, 0, &_lock);
5268c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gpt1_mclk", NULL);
5278c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0,
5288c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT1_CLK_ENB, 0,
5298c2ecf20Sopenharmony_ci			&_lock);
5308c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "gpt1");
5318c2ecf20Sopenharmony_ci
5328c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gpt2_mclk", gpt_parents,
5338c2ecf20Sopenharmony_ci			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
5348c2ecf20Sopenharmony_ci			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GPT2_CLK_SHIFT,
5358c2ecf20Sopenharmony_ci			SPEAR1310_GPT_CLK_MASK, 0, &_lock);
5368c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gpt2_mclk", NULL);
5378c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0,
5388c2ecf20Sopenharmony_ci			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT2_CLK_ENB, 0,
5398c2ecf20Sopenharmony_ci			&_lock);
5408c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "gpt2");
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gpt3_mclk", gpt_parents,
5438c2ecf20Sopenharmony_ci			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
5448c2ecf20Sopenharmony_ci			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GPT3_CLK_SHIFT,
5458c2ecf20Sopenharmony_ci			SPEAR1310_GPT_CLK_MASK, 0, &_lock);
5468c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gpt3_mclk", NULL);
5478c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0,
5488c2ecf20Sopenharmony_ci			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT3_CLK_ENB, 0,
5498c2ecf20Sopenharmony_ci			&_lock);
5508c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "gpt3");
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci	/* others */
5538c2ecf20Sopenharmony_ci	clk = clk_register_aux("uart_syn_clk", "uart_syn_gclk", "vco1div2_clk",
5548c2ecf20Sopenharmony_ci			0, SPEAR1310_UART_CLK_SYNT, NULL, aux_rtbl,
5558c2ecf20Sopenharmony_ci			ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
5568c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart_syn_clk", NULL);
5578c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "uart_syn_gclk", NULL);
5588c2ecf20Sopenharmony_ci
5598c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents,
5608c2ecf20Sopenharmony_ci			ARRAY_SIZE(uart0_parents),
5618c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
5628c2ecf20Sopenharmony_ci			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_UART_CLK_SHIFT,
5638c2ecf20Sopenharmony_ci			SPEAR1310_UART_CLK_MASK, 0, &_lock);
5648c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart0_mclk", NULL);
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "uart0_clk", "uart0_mclk",
5678c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
5688c2ecf20Sopenharmony_ci			SPEAR1310_UART_CLK_ENB, 0, &_lock);
5698c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0000000.serial");
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_ci	clk = clk_register_aux("sdhci_syn_clk", "sdhci_syn_gclk",
5728c2ecf20Sopenharmony_ci			"vco1div2_clk", 0, SPEAR1310_SDHCI_CLK_SYNT, NULL,
5738c2ecf20Sopenharmony_ci			aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
5748c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "sdhci_syn_clk", NULL);
5758c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "sdhci_syn_gclk", NULL);
5768c2ecf20Sopenharmony_ci
5778c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_syn_gclk",
5788c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
5798c2ecf20Sopenharmony_ci			SPEAR1310_SDHCI_CLK_ENB, 0, &_lock);
5808c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b3000000.sdhci");
5818c2ecf20Sopenharmony_ci
5828c2ecf20Sopenharmony_ci	clk = clk_register_aux("cfxd_syn_clk", "cfxd_syn_gclk", "vco1div2_clk",
5838c2ecf20Sopenharmony_ci			0, SPEAR1310_CFXD_CLK_SYNT, NULL, aux_rtbl,
5848c2ecf20Sopenharmony_ci			ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
5858c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "cfxd_syn_clk", NULL);
5868c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "cfxd_syn_gclk", NULL);
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_syn_gclk",
5898c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
5908c2ecf20Sopenharmony_ci			SPEAR1310_CFXD_CLK_ENB, 0, &_lock);
5918c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b2800000.cf");
5928c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "arasan_xd");
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ci	clk = clk_register_aux("c3_syn_clk", "c3_syn_gclk", "vco1div2_clk",
5958c2ecf20Sopenharmony_ci			0, SPEAR1310_C3_CLK_SYNT, NULL, aux_rtbl,
5968c2ecf20Sopenharmony_ci			ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
5978c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "c3_syn_clk", NULL);
5988c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "c3_syn_gclk", NULL);
5998c2ecf20Sopenharmony_ci
6008c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "c3_mclk", c3_parents,
6018c2ecf20Sopenharmony_ci			ARRAY_SIZE(c3_parents),
6028c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
6038c2ecf20Sopenharmony_ci			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_C3_CLK_SHIFT,
6048c2ecf20Sopenharmony_ci			SPEAR1310_C3_CLK_MASK, 0, &_lock);
6058c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "c3_mclk", NULL);
6068c2ecf20Sopenharmony_ci
6078c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "c3_clk", "c3_mclk", 0,
6088c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_C3_CLK_ENB, 0,
6098c2ecf20Sopenharmony_ci			&_lock);
6108c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "c3");
6118c2ecf20Sopenharmony_ci
6128c2ecf20Sopenharmony_ci	/* gmac */
6138c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "phy_input_mclk", gmac_phy_input_parents,
6148c2ecf20Sopenharmony_ci			ARRAY_SIZE(gmac_phy_input_parents),
6158c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT, SPEAR1310_GMAC_CLK_CFG,
6168c2ecf20Sopenharmony_ci			SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT,
6178c2ecf20Sopenharmony_ci			SPEAR1310_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock);
6188c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "phy_input_mclk", NULL);
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci	clk = clk_register_aux("phy_syn_clk", "phy_syn_gclk", "phy_input_mclk",
6218c2ecf20Sopenharmony_ci			0, SPEAR1310_GMAC_CLK_SYNT, NULL, gmac_rtbl,
6228c2ecf20Sopenharmony_ci			ARRAY_SIZE(gmac_rtbl), &_lock, &clk1);
6238c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "phy_syn_clk", NULL);
6248c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "phy_syn_gclk", NULL);
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "phy_mclk", gmac_phy_parents,
6278c2ecf20Sopenharmony_ci			ARRAY_SIZE(gmac_phy_parents), CLK_SET_RATE_NO_REPARENT,
6288c2ecf20Sopenharmony_ci			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GMAC_PHY_CLK_SHIFT,
6298c2ecf20Sopenharmony_ci			SPEAR1310_GMAC_PHY_CLK_MASK, 0, &_lock);
6308c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "stmmacphy.0", NULL);
6318c2ecf20Sopenharmony_ci
6328c2ecf20Sopenharmony_ci	/* clcd */
6338c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "clcd_syn_mclk", clcd_synth_parents,
6348c2ecf20Sopenharmony_ci			ARRAY_SIZE(clcd_synth_parents),
6358c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT, SPEAR1310_CLCD_CLK_SYNT,
6368c2ecf20Sopenharmony_ci			SPEAR1310_CLCD_SYNT_CLK_SHIFT,
6378c2ecf20Sopenharmony_ci			SPEAR1310_CLCD_SYNT_CLK_MASK, 0, &_lock);
6388c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "clcd_syn_mclk", NULL);
6398c2ecf20Sopenharmony_ci
6408c2ecf20Sopenharmony_ci	clk = clk_register_frac("clcd_syn_clk", "clcd_syn_mclk", 0,
6418c2ecf20Sopenharmony_ci			SPEAR1310_CLCD_CLK_SYNT, clcd_rtbl,
6428c2ecf20Sopenharmony_ci			ARRAY_SIZE(clcd_rtbl), &_lock);
6438c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "clcd_syn_clk", NULL);
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "clcd_pixel_mclk", clcd_pixel_parents,
6468c2ecf20Sopenharmony_ci			ARRAY_SIZE(clcd_pixel_parents),
6478c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
6488c2ecf20Sopenharmony_ci			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_CLCD_CLK_SHIFT,
6498c2ecf20Sopenharmony_ci			SPEAR1310_CLCD_CLK_MASK, 0, &_lock);
6508c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "clcd_pixel_mclk", NULL);
6518c2ecf20Sopenharmony_ci
6528c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mclk", 0,
6538c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CLCD_CLK_ENB, 0,
6548c2ecf20Sopenharmony_ci			&_lock);
6558c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e1000000.clcd");
6568c2ecf20Sopenharmony_ci
6578c2ecf20Sopenharmony_ci	/* i2s */
6588c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2s_src_mclk", i2s_src_parents,
6598c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2s_src_parents), CLK_SET_RATE_NO_REPARENT,
6608c2ecf20Sopenharmony_ci			SPEAR1310_I2S_CLK_CFG, SPEAR1310_I2S_SRC_CLK_SHIFT,
6618c2ecf20Sopenharmony_ci			SPEAR1310_I2S_SRC_CLK_MASK, 0, &_lock);
6628c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_src_mclk", NULL);
6638c2ecf20Sopenharmony_ci
6648c2ecf20Sopenharmony_ci	clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mclk", 0,
6658c2ecf20Sopenharmony_ci			SPEAR1310_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl,
6668c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL);
6678c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_prs1_clk", NULL);
6688c2ecf20Sopenharmony_ci
6698c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2s_ref_mclk", i2s_ref_parents,
6708c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2s_ref_parents),
6718c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
6728c2ecf20Sopenharmony_ci			SPEAR1310_I2S_CLK_CFG, SPEAR1310_I2S_REF_SHIFT,
6738c2ecf20Sopenharmony_ci			SPEAR1310_I2S_REF_SEL_MASK, 0, &_lock);
6748c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_ref_mclk", NULL);
6758c2ecf20Sopenharmony_ci
6768c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mclk", 0,
6778c2ecf20Sopenharmony_ci			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_I2S_REF_PAD_CLK_ENB,
6788c2ecf20Sopenharmony_ci			0, &_lock);
6798c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL);
6808c2ecf20Sopenharmony_ci
6818c2ecf20Sopenharmony_ci	clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gclk",
6828c2ecf20Sopenharmony_ci			"i2s_ref_mclk", 0, SPEAR1310_I2S_CLK_CFG,
6838c2ecf20Sopenharmony_ci			&i2s_sclk_masks, i2s_sclk_rtbl,
6848c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2s_sclk_rtbl), &_lock, &clk1);
6858c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2s_sclk_clk", NULL);
6868c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "i2s_sclk_gclk", NULL);
6878c2ecf20Sopenharmony_ci
6888c2ecf20Sopenharmony_ci	/* clock derived from ahb clk */
6898c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0,
6908c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2C0_CLK_ENB, 0,
6918c2ecf20Sopenharmony_ci			&_lock);
6928c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0280000.i2c");
6938c2ecf20Sopenharmony_ci
6948c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "dma_clk", "ahb_clk", 0,
6958c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_DMA_CLK_ENB, 0,
6968c2ecf20Sopenharmony_ci			&_lock);
6978c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "ea800000.dma");
6988c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "eb000000.dma");
6998c2ecf20Sopenharmony_ci
7008c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "jpeg_clk", "ahb_clk", 0,
7018c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_JPEG_CLK_ENB, 0,
7028c2ecf20Sopenharmony_ci			&_lock);
7038c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b2000000.jpeg");
7048c2ecf20Sopenharmony_ci
7058c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0,
7068c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GMAC_CLK_ENB, 0,
7078c2ecf20Sopenharmony_ci			&_lock);
7088c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e2000000.eth");
7098c2ecf20Sopenharmony_ci
7108c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "fsmc_clk", "ahb_clk", 0,
7118c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_FSMC_CLK_ENB, 0,
7128c2ecf20Sopenharmony_ci			&_lock);
7138c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b0000000.flash");
7148c2ecf20Sopenharmony_ci
7158c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "smi_clk", "ahb_clk", 0,
7168c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SMI_CLK_ENB, 0,
7178c2ecf20Sopenharmony_ci			&_lock);
7188c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "ea000000.flash");
7198c2ecf20Sopenharmony_ci
7208c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "usbh0_clk", "ahb_clk", 0,
7218c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UHC0_CLK_ENB, 0,
7228c2ecf20Sopenharmony_ci			&_lock);
7238c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e4000000.ohci");
7248c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e4800000.ehci");
7258c2ecf20Sopenharmony_ci
7268c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "usbh1_clk", "ahb_clk", 0,
7278c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UHC1_CLK_ENB, 0,
7288c2ecf20Sopenharmony_ci			&_lock);
7298c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e5000000.ohci");
7308c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e5800000.ehci");
7318c2ecf20Sopenharmony_ci
7328c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "uoc_clk", "ahb_clk", 0,
7338c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UOC_CLK_ENB, 0,
7348c2ecf20Sopenharmony_ci			&_lock);
7358c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e3800000.otg");
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "pcie_sata_0_clk", "ahb_clk", 0,
7388c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_0_CLK_ENB,
7398c2ecf20Sopenharmony_ci			0, &_lock);
7408c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b1000000.pcie");
7418c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b1000000.ahci");
7428c2ecf20Sopenharmony_ci
7438c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "pcie_sata_1_clk", "ahb_clk", 0,
7448c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_1_CLK_ENB,
7458c2ecf20Sopenharmony_ci			0, &_lock);
7468c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b1800000.pcie");
7478c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b1800000.ahci");
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "pcie_sata_2_clk", "ahb_clk", 0,
7508c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_2_CLK_ENB,
7518c2ecf20Sopenharmony_ci			0, &_lock);
7528c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b4000000.pcie");
7538c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "b4000000.ahci");
7548c2ecf20Sopenharmony_ci
7558c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
7568c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SYSRAM0_CLK_ENB, 0,
7578c2ecf20Sopenharmony_ci			&_lock);
7588c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "sysram0_clk", NULL);
7598c2ecf20Sopenharmony_ci
7608c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "sysram1_clk", "ahb_clk", 0,
7618c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SYSRAM1_CLK_ENB, 0,
7628c2ecf20Sopenharmony_ci			&_lock);
7638c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "sysram1_clk", NULL);
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_ci	clk = clk_register_aux("adc_syn_clk", "adc_syn_gclk", "ahb_clk",
7668c2ecf20Sopenharmony_ci			0, SPEAR1310_ADC_CLK_SYNT, NULL, adc_rtbl,
7678c2ecf20Sopenharmony_ci			ARRAY_SIZE(adc_rtbl), &_lock, &clk1);
7688c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "adc_syn_clk", NULL);
7698c2ecf20Sopenharmony_ci	clk_register_clkdev(clk1, "adc_syn_gclk", NULL);
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "adc_clk", "adc_syn_gclk",
7728c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
7738c2ecf20Sopenharmony_ci			SPEAR1310_ADC_CLK_ENB, 0, &_lock);
7748c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0080000.adc");
7758c2ecf20Sopenharmony_ci
7768c2ecf20Sopenharmony_ci	/* clock derived from apb clk */
7778c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ssp0_clk", "apb_clk", 0,
7788c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SSP_CLK_ENB, 0,
7798c2ecf20Sopenharmony_ci			&_lock);
7808c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0100000.spi");
7818c2ecf20Sopenharmony_ci
7828c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpio0_clk", "apb_clk", 0,
7838c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPIO0_CLK_ENB, 0,
7848c2ecf20Sopenharmony_ci			&_lock);
7858c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0600000.gpio");
7868c2ecf20Sopenharmony_ci
7878c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "gpio1_clk", "apb_clk", 0,
7888c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPIO1_CLK_ENB, 0,
7898c2ecf20Sopenharmony_ci			&_lock);
7908c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0680000.gpio");
7918c2ecf20Sopenharmony_ci
7928c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2s0_clk", "apb_clk", 0,
7938c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2S0_CLK_ENB, 0,
7948c2ecf20Sopenharmony_ci			&_lock);
7958c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0180000.i2s");
7968c2ecf20Sopenharmony_ci
7978c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2s1_clk", "apb_clk", 0,
7988c2ecf20Sopenharmony_ci			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2S1_CLK_ENB, 0,
7998c2ecf20Sopenharmony_ci			&_lock);
8008c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0200000.i2s");
8018c2ecf20Sopenharmony_ci
8028c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "kbd_clk", "apb_clk", 0,
8038c2ecf20Sopenharmony_ci			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_KBD_CLK_ENB, 0,
8048c2ecf20Sopenharmony_ci			&_lock);
8058c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "e0300000.kbd");
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_ci	/* RAS clks */
8088c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gen_syn0_1_mclk", gen_synth0_1_parents,
8098c2ecf20Sopenharmony_ci			ARRAY_SIZE(gen_synth0_1_parents),
8108c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT, SPEAR1310_PLL_CFG,
8118c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SYNT0_1_CLK_SHIFT,
8128c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock);
8138c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn0_1_clk", NULL);
8148c2ecf20Sopenharmony_ci
8158c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "gen_syn2_3_mclk", gen_synth2_3_parents,
8168c2ecf20Sopenharmony_ci			ARRAY_SIZE(gen_synth2_3_parents),
8178c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT, SPEAR1310_PLL_CFG,
8188c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SYNT2_3_CLK_SHIFT,
8198c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock);
8208c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn2_3_clk", NULL);
8218c2ecf20Sopenharmony_ci
8228c2ecf20Sopenharmony_ci	clk = clk_register_frac("gen_syn0_clk", "gen_syn0_1_clk", 0,
8238c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8248c2ecf20Sopenharmony_ci			&_lock);
8258c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn0_clk", NULL);
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_ci	clk = clk_register_frac("gen_syn1_clk", "gen_syn0_1_clk", 0,
8288c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8298c2ecf20Sopenharmony_ci			&_lock);
8308c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn1_clk", NULL);
8318c2ecf20Sopenharmony_ci
8328c2ecf20Sopenharmony_ci	clk = clk_register_frac("gen_syn2_clk", "gen_syn2_3_clk", 0,
8338c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8348c2ecf20Sopenharmony_ci			&_lock);
8358c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn2_clk", NULL);
8368c2ecf20Sopenharmony_ci
8378c2ecf20Sopenharmony_ci	clk = clk_register_frac("gen_syn3_clk", "gen_syn2_3_clk", 0,
8388c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8398c2ecf20Sopenharmony_ci			&_lock);
8408c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "gen_syn3_clk", NULL);
8418c2ecf20Sopenharmony_ci
8428c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_osc_24m_clk", "osc_24m_clk", 0,
8438c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_24M_CLK_ENB, 0,
8448c2ecf20Sopenharmony_ci			&_lock);
8458c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ras_osc_24m_clk", NULL);
8468c2ecf20Sopenharmony_ci
8478c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_osc_25m_clk", "osc_25m_clk", 0,
8488c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_25M_CLK_ENB, 0,
8498c2ecf20Sopenharmony_ci			&_lock);
8508c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ras_osc_25m_clk", NULL);
8518c2ecf20Sopenharmony_ci
8528c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_osc_32k_clk", "osc_32k_clk", 0,
8538c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_32K_CLK_ENB, 0,
8548c2ecf20Sopenharmony_ci			&_lock);
8558c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ras_osc_32k_clk", NULL);
8568c2ecf20Sopenharmony_ci
8578c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_pll2_clk", "pll2_clk", 0,
8588c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_ENB, SPEAR1310_PLL2_CLK_ENB, 0,
8598c2ecf20Sopenharmony_ci			&_lock);
8608c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ras_pll2_clk", NULL);
8618c2ecf20Sopenharmony_ci
8628c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_pll3_clk", "pll3_clk", 0,
8638c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_ENB, SPEAR1310_PLL3_CLK_ENB, 0,
8648c2ecf20Sopenharmony_ci			&_lock);
8658c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ras_pll3_clk", NULL);
8668c2ecf20Sopenharmony_ci
8678c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_tx125_clk", "gmii_pad_clk", 0,
8688c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_ENB, SPEAR1310_C125M_PAD_CLK_ENB, 0,
8698c2ecf20Sopenharmony_ci			&_lock);
8708c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ras_tx125_clk", NULL);
8718c2ecf20Sopenharmony_ci
8728c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "ras_30m_fixed_clk", "pll5_clk", 0,
8738c2ecf20Sopenharmony_ci			30000000);
8748c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_30m_clk", "ras_30m_fixed_clk", 0,
8758c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_ENB, SPEAR1310_C30M_CLK_ENB, 0,
8768c2ecf20Sopenharmony_ci			&_lock);
8778c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ras_30m_clk", NULL);
8788c2ecf20Sopenharmony_ci
8798c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "ras_48m_fixed_clk", "pll5_clk", 0,
8808c2ecf20Sopenharmony_ci			48000000);
8818c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_48m_clk", "ras_48m_fixed_clk", 0,
8828c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_ENB, SPEAR1310_C48M_CLK_ENB, 0,
8838c2ecf20Sopenharmony_ci			&_lock);
8848c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ras_48m_clk", NULL);
8858c2ecf20Sopenharmony_ci
8868c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_ahb_clk", "ahb_clk", 0,
8878c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_ENB, SPEAR1310_ACLK_CLK_ENB, 0,
8888c2ecf20Sopenharmony_ci			&_lock);
8898c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ras_ahb_clk", NULL);
8908c2ecf20Sopenharmony_ci
8918c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_apb_clk", "apb_clk", 0,
8928c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CLK_ENB, SPEAR1310_PCLK_CLK_ENB, 0,
8938c2ecf20Sopenharmony_ci			&_lock);
8948c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ras_apb_clk", NULL);
8958c2ecf20Sopenharmony_ci
8968c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "ras_plclk0_clk", NULL, 0,
8978c2ecf20Sopenharmony_ci			50000000);
8988c2ecf20Sopenharmony_ci
8998c2ecf20Sopenharmony_ci	clk = clk_register_fixed_rate(NULL, "ras_tx50_clk", NULL, 0, 50000000);
9008c2ecf20Sopenharmony_ci
9018c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "can0_clk", "apb_clk", 0,
9028c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_CAN0_CLK_ENB, 0,
9038c2ecf20Sopenharmony_ci			&_lock);
9048c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "c_can_platform.0");
9058c2ecf20Sopenharmony_ci
9068c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "can1_clk", "apb_clk", 0,
9078c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_CAN1_CLK_ENB, 0,
9088c2ecf20Sopenharmony_ci			&_lock);
9098c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "c_can_platform.1");
9108c2ecf20Sopenharmony_ci
9118c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_smii0_clk", "ras_ahb_clk", 0,
9128c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII0_CLK_ENB, 0,
9138c2ecf20Sopenharmony_ci			&_lock);
9148c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5c400000.eth");
9158c2ecf20Sopenharmony_ci
9168c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_smii1_clk", "ras_ahb_clk", 0,
9178c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII1_CLK_ENB, 0,
9188c2ecf20Sopenharmony_ci			&_lock);
9198c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5c500000.eth");
9208c2ecf20Sopenharmony_ci
9218c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_smii2_clk", "ras_ahb_clk", 0,
9228c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII2_CLK_ENB, 0,
9238c2ecf20Sopenharmony_ci			&_lock);
9248c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5c600000.eth");
9258c2ecf20Sopenharmony_ci
9268c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ras_rgmii_clk", "ras_ahb_clk", 0,
9278c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_GMII_CLK_ENB, 0,
9288c2ecf20Sopenharmony_ci			&_lock);
9298c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5c700000.eth");
9308c2ecf20Sopenharmony_ci
9318c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "smii_rgmii_phy_mclk",
9328c2ecf20Sopenharmony_ci			smii_rgmii_phy_parents,
9338c2ecf20Sopenharmony_ci			ARRAY_SIZE(smii_rgmii_phy_parents),
9348c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT, SPEAR1310_RAS_CTRL_REG1,
9358c2ecf20Sopenharmony_ci			SPEAR1310_SMII_RGMII_PHY_CLK_SHIFT,
9368c2ecf20Sopenharmony_ci			SPEAR1310_PHY_CLK_MASK, 0, &_lock);
9378c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "stmmacphy.1", NULL);
9388c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "stmmacphy.2", NULL);
9398c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "stmmacphy.4", NULL);
9408c2ecf20Sopenharmony_ci
9418c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "rmii_phy_mclk", rmii_phy_parents,
9428c2ecf20Sopenharmony_ci			ARRAY_SIZE(rmii_phy_parents), CLK_SET_RATE_NO_REPARENT,
9438c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG1, SPEAR1310_RMII_PHY_CLK_SHIFT,
9448c2ecf20Sopenharmony_ci			SPEAR1310_PHY_CLK_MASK, 0, &_lock);
9458c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "stmmacphy.3", NULL);
9468c2ecf20Sopenharmony_ci
9478c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "uart1_mclk", uart_parents,
9488c2ecf20Sopenharmony_ci			ARRAY_SIZE(uart_parents), CLK_SET_RATE_NO_REPARENT,
9498c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_UART1_CLK_SHIFT,
9508c2ecf20Sopenharmony_ci			SPEAR1310_RAS_UART_CLK_MASK, 0, &_lock);
9518c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart1_mclk", NULL);
9528c2ecf20Sopenharmony_ci
9538c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "uart1_clk", "uart1_mclk", 0,
9548c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART1_CLK_ENB, 0,
9558c2ecf20Sopenharmony_ci			&_lock);
9568c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5c800000.serial");
9578c2ecf20Sopenharmony_ci
9588c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "uart2_mclk", uart_parents,
9598c2ecf20Sopenharmony_ci			ARRAY_SIZE(uart_parents), CLK_SET_RATE_NO_REPARENT,
9608c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_UART2_CLK_SHIFT,
9618c2ecf20Sopenharmony_ci			SPEAR1310_RAS_UART_CLK_MASK, 0, &_lock);
9628c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart2_mclk", NULL);
9638c2ecf20Sopenharmony_ci
9648c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "uart2_clk", "uart2_mclk", 0,
9658c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART2_CLK_ENB, 0,
9668c2ecf20Sopenharmony_ci			&_lock);
9678c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5c900000.serial");
9688c2ecf20Sopenharmony_ci
9698c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "uart3_mclk", uart_parents,
9708c2ecf20Sopenharmony_ci			ARRAY_SIZE(uart_parents), CLK_SET_RATE_NO_REPARENT,
9718c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_UART3_CLK_SHIFT,
9728c2ecf20Sopenharmony_ci			SPEAR1310_RAS_UART_CLK_MASK, 0, &_lock);
9738c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart3_mclk", NULL);
9748c2ecf20Sopenharmony_ci
9758c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "uart3_clk", "uart3_mclk", 0,
9768c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART3_CLK_ENB, 0,
9778c2ecf20Sopenharmony_ci			&_lock);
9788c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5ca00000.serial");
9798c2ecf20Sopenharmony_ci
9808c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "uart4_mclk", uart_parents,
9818c2ecf20Sopenharmony_ci			ARRAY_SIZE(uart_parents), CLK_SET_RATE_NO_REPARENT,
9828c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_UART4_CLK_SHIFT,
9838c2ecf20Sopenharmony_ci			SPEAR1310_RAS_UART_CLK_MASK, 0, &_lock);
9848c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart4_mclk", NULL);
9858c2ecf20Sopenharmony_ci
9868c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "uart4_clk", "uart4_mclk", 0,
9878c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART4_CLK_ENB, 0,
9888c2ecf20Sopenharmony_ci			&_lock);
9898c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5cb00000.serial");
9908c2ecf20Sopenharmony_ci
9918c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "uart5_mclk", uart_parents,
9928c2ecf20Sopenharmony_ci			ARRAY_SIZE(uart_parents), CLK_SET_RATE_NO_REPARENT,
9938c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_UART5_CLK_SHIFT,
9948c2ecf20Sopenharmony_ci			SPEAR1310_RAS_UART_CLK_MASK, 0, &_lock);
9958c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "uart5_mclk", NULL);
9968c2ecf20Sopenharmony_ci
9978c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "uart5_clk", "uart5_mclk", 0,
9988c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART5_CLK_ENB, 0,
9998c2ecf20Sopenharmony_ci			&_lock);
10008c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5cc00000.serial");
10018c2ecf20Sopenharmony_ci
10028c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2c1_mclk", i2c_parents,
10038c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
10048c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C1_CLK_SHIFT,
10058c2ecf20Sopenharmony_ci			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
10068c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2c1_mclk", NULL);
10078c2ecf20Sopenharmony_ci
10088c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2c1_clk", "i2c1_mclk", 0,
10098c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C1_CLK_ENB, 0,
10108c2ecf20Sopenharmony_ci			&_lock);
10118c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5cd00000.i2c");
10128c2ecf20Sopenharmony_ci
10138c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2c2_mclk", i2c_parents,
10148c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
10158c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C2_CLK_SHIFT,
10168c2ecf20Sopenharmony_ci			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
10178c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2c2_mclk", NULL);
10188c2ecf20Sopenharmony_ci
10198c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2c2_clk", "i2c2_mclk", 0,
10208c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C2_CLK_ENB, 0,
10218c2ecf20Sopenharmony_ci			&_lock);
10228c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5ce00000.i2c");
10238c2ecf20Sopenharmony_ci
10248c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2c3_mclk", i2c_parents,
10258c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
10268c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C3_CLK_SHIFT,
10278c2ecf20Sopenharmony_ci			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
10288c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2c3_mclk", NULL);
10298c2ecf20Sopenharmony_ci
10308c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2c3_clk", "i2c3_mclk", 0,
10318c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C3_CLK_ENB, 0,
10328c2ecf20Sopenharmony_ci			&_lock);
10338c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5cf00000.i2c");
10348c2ecf20Sopenharmony_ci
10358c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2c4_mclk", i2c_parents,
10368c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
10378c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C4_CLK_SHIFT,
10388c2ecf20Sopenharmony_ci			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
10398c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2c4_mclk", NULL);
10408c2ecf20Sopenharmony_ci
10418c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2c4_clk", "i2c4_mclk", 0,
10428c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C4_CLK_ENB, 0,
10438c2ecf20Sopenharmony_ci			&_lock);
10448c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5d000000.i2c");
10458c2ecf20Sopenharmony_ci
10468c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2c5_mclk", i2c_parents,
10478c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
10488c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C5_CLK_SHIFT,
10498c2ecf20Sopenharmony_ci			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
10508c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2c5_mclk", NULL);
10518c2ecf20Sopenharmony_ci
10528c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2c5_clk", "i2c5_mclk", 0,
10538c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C5_CLK_ENB, 0,
10548c2ecf20Sopenharmony_ci			&_lock);
10558c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5d100000.i2c");
10568c2ecf20Sopenharmony_ci
10578c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2c6_mclk", i2c_parents,
10588c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
10598c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C6_CLK_SHIFT,
10608c2ecf20Sopenharmony_ci			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
10618c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2c6_mclk", NULL);
10628c2ecf20Sopenharmony_ci
10638c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2c6_clk", "i2c6_mclk", 0,
10648c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C6_CLK_ENB, 0,
10658c2ecf20Sopenharmony_ci			&_lock);
10668c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5d200000.i2c");
10678c2ecf20Sopenharmony_ci
10688c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "i2c7_mclk", i2c_parents,
10698c2ecf20Sopenharmony_ci			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
10708c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C7_CLK_SHIFT,
10718c2ecf20Sopenharmony_ci			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
10728c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "i2c7_mclk", NULL);
10738c2ecf20Sopenharmony_ci
10748c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "i2c7_clk", "i2c7_mclk", 0,
10758c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C7_CLK_ENB, 0,
10768c2ecf20Sopenharmony_ci			&_lock);
10778c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5d300000.i2c");
10788c2ecf20Sopenharmony_ci
10798c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "ssp1_mclk", ssp1_parents,
10808c2ecf20Sopenharmony_ci			ARRAY_SIZE(ssp1_parents), CLK_SET_RATE_NO_REPARENT,
10818c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_SSP1_CLK_SHIFT,
10828c2ecf20Sopenharmony_ci			SPEAR1310_SSP1_CLK_MASK, 0, &_lock);
10838c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "ssp1_mclk", NULL);
10848c2ecf20Sopenharmony_ci
10858c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "ssp1_clk", "ssp1_mclk", 0,
10868c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_SSP1_CLK_ENB, 0,
10878c2ecf20Sopenharmony_ci			&_lock);
10888c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "5d400000.spi");
10898c2ecf20Sopenharmony_ci
10908c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "pci_mclk", pci_parents,
10918c2ecf20Sopenharmony_ci			ARRAY_SIZE(pci_parents), CLK_SET_RATE_NO_REPARENT,
10928c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_PCI_CLK_SHIFT,
10938c2ecf20Sopenharmony_ci			SPEAR1310_PCI_CLK_MASK, 0, &_lock);
10948c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "pci_mclk", NULL);
10958c2ecf20Sopenharmony_ci
10968c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "pci_clk", "pci_mclk", 0,
10978c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_PCI_CLK_ENB, 0,
10988c2ecf20Sopenharmony_ci			&_lock);
10998c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "pci");
11008c2ecf20Sopenharmony_ci
11018c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "tdm1_mclk", tdm_parents,
11028c2ecf20Sopenharmony_ci			ARRAY_SIZE(tdm_parents), CLK_SET_RATE_NO_REPARENT,
11038c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_TDM1_CLK_SHIFT,
11048c2ecf20Sopenharmony_ci			SPEAR1310_TDM_CLK_MASK, 0, &_lock);
11058c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "tdm1_mclk", NULL);
11068c2ecf20Sopenharmony_ci
11078c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "tdm1_clk", "tdm1_mclk", 0,
11088c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM1_CLK_ENB, 0,
11098c2ecf20Sopenharmony_ci			&_lock);
11108c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "tdm_hdlc.0");
11118c2ecf20Sopenharmony_ci
11128c2ecf20Sopenharmony_ci	clk = clk_register_mux(NULL, "tdm2_mclk", tdm_parents,
11138c2ecf20Sopenharmony_ci			ARRAY_SIZE(tdm_parents), CLK_SET_RATE_NO_REPARENT,
11148c2ecf20Sopenharmony_ci			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_TDM2_CLK_SHIFT,
11158c2ecf20Sopenharmony_ci			SPEAR1310_TDM_CLK_MASK, 0, &_lock);
11168c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, "tdm2_mclk", NULL);
11178c2ecf20Sopenharmony_ci
11188c2ecf20Sopenharmony_ci	clk = clk_register_gate(NULL, "tdm2_clk", "tdm2_mclk", 0,
11198c2ecf20Sopenharmony_ci			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM2_CLK_ENB, 0,
11208c2ecf20Sopenharmony_ci			&_lock);
11218c2ecf20Sopenharmony_ci	clk_register_clkdev(clk, NULL, "tdm_hdlc.1");
11228c2ecf20Sopenharmony_ci}
1123