xref: /linux/drivers/clk/spear/spear1310_clock.c (revision 37d2f45d940bfdd7c9a5323f3d3462bea3a3e957)
10b928af1SViresh Kumar /*
20b928af1SViresh Kumar  * arch/arm/mach-spear13xx/spear1310_clock.c
30b928af1SViresh Kumar  *
40b928af1SViresh Kumar  * SPEAr1310 machine clock framework source file
50b928af1SViresh Kumar  *
60b928af1SViresh Kumar  * Copyright (C) 2012 ST Microelectronics
7da89947bSViresh Kumar  * Viresh Kumar <vireshk@kernel.org>
80b928af1SViresh Kumar  *
90b928af1SViresh Kumar  * This file is licensed under the terms of the GNU General Public
100b928af1SViresh Kumar  * License version 2. This program is licensed "as is" without any
110b928af1SViresh Kumar  * warranty of any kind, whether express or implied.
120b928af1SViresh Kumar  */
130b928af1SViresh Kumar 
140b928af1SViresh Kumar #include <linux/clkdev.h>
150b928af1SViresh Kumar #include <linux/err.h>
160b928af1SViresh Kumar #include <linux/io.h>
170b928af1SViresh Kumar #include <linux/of_platform.h>
180b928af1SViresh Kumar #include <linux/spinlock_types.h>
190b928af1SViresh Kumar #include "clk.h"
200b928af1SViresh Kumar 
210b928af1SViresh Kumar /* PLL related registers and bit values */
22d9909ebeSArnd Bergmann #define SPEAR1310_PLL_CFG			(misc_base + 0x210)
230b928af1SViresh Kumar 	/* PLL_CFG bit values */
240b928af1SViresh Kumar 	#define SPEAR1310_CLCD_SYNT_CLK_MASK		1
250b928af1SViresh Kumar 	#define SPEAR1310_CLCD_SYNT_CLK_SHIFT		31
260b928af1SViresh Kumar 	#define SPEAR1310_RAS_SYNT2_3_CLK_MASK		2
270b928af1SViresh Kumar 	#define SPEAR1310_RAS_SYNT2_3_CLK_SHIFT		29
280b928af1SViresh Kumar 	#define SPEAR1310_RAS_SYNT_CLK_MASK		2
290b928af1SViresh Kumar 	#define SPEAR1310_RAS_SYNT0_1_CLK_SHIFT		27
300b928af1SViresh Kumar 	#define SPEAR1310_PLL_CLK_MASK			2
310b928af1SViresh Kumar 	#define SPEAR1310_PLL3_CLK_SHIFT		24
320b928af1SViresh Kumar 	#define SPEAR1310_PLL2_CLK_SHIFT		22
330b928af1SViresh Kumar 	#define SPEAR1310_PLL1_CLK_SHIFT		20
340b928af1SViresh Kumar 
35d9909ebeSArnd Bergmann #define SPEAR1310_PLL1_CTR			(misc_base + 0x214)
36d9909ebeSArnd Bergmann #define SPEAR1310_PLL1_FRQ			(misc_base + 0x218)
37d9909ebeSArnd Bergmann #define SPEAR1310_PLL2_CTR			(misc_base + 0x220)
38d9909ebeSArnd Bergmann #define SPEAR1310_PLL2_FRQ			(misc_base + 0x224)
39d9909ebeSArnd Bergmann #define SPEAR1310_PLL3_CTR			(misc_base + 0x22C)
40d9909ebeSArnd Bergmann #define SPEAR1310_PLL3_FRQ			(misc_base + 0x230)
41d9909ebeSArnd Bergmann #define SPEAR1310_PLL4_CTR			(misc_base + 0x238)
42d9909ebeSArnd Bergmann #define SPEAR1310_PLL4_FRQ			(misc_base + 0x23C)
43d9909ebeSArnd Bergmann #define SPEAR1310_PERIP_CLK_CFG			(misc_base + 0x244)
440b928af1SViresh Kumar 	/* PERIP_CLK_CFG bit values */
450b928af1SViresh Kumar 	#define SPEAR1310_GPT_OSC24_VAL			0
460b928af1SViresh Kumar 	#define SPEAR1310_GPT_APB_VAL			1
470b928af1SViresh Kumar 	#define SPEAR1310_GPT_CLK_MASK			1
480b928af1SViresh Kumar 	#define SPEAR1310_GPT3_CLK_SHIFT		11
490b928af1SViresh Kumar 	#define SPEAR1310_GPT2_CLK_SHIFT		10
500b928af1SViresh Kumar 	#define SPEAR1310_GPT1_CLK_SHIFT		9
510b928af1SViresh Kumar 	#define SPEAR1310_GPT0_CLK_SHIFT		8
520b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_PLL5_VAL		0
530b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_OSC24_VAL		1
540b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_SYNT_VAL		2
550b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_MASK			2
560b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_SHIFT		4
570b928af1SViresh Kumar 
580b928af1SViresh Kumar 	#define SPEAR1310_AUX_CLK_PLL5_VAL		0
590b928af1SViresh Kumar 	#define SPEAR1310_AUX_CLK_SYNT_VAL		1
600b928af1SViresh Kumar 	#define SPEAR1310_CLCD_CLK_MASK			2
610b928af1SViresh Kumar 	#define SPEAR1310_CLCD_CLK_SHIFT		2
620b928af1SViresh Kumar 	#define SPEAR1310_C3_CLK_MASK			1
630b928af1SViresh Kumar 	#define SPEAR1310_C3_CLK_SHIFT			1
640b928af1SViresh Kumar 
65d9909ebeSArnd Bergmann #define SPEAR1310_GMAC_CLK_CFG			(misc_base + 0x248)
660b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_IF_SEL_MASK		3
670b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_IF_SEL_SHIFT		4
680b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_CLK_MASK		1
690b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_CLK_SHIFT		3
700b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_INPUT_CLK_MASK	2
710b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT	1
720b928af1SViresh Kumar 
73d9909ebeSArnd Bergmann #define SPEAR1310_I2S_CLK_CFG			(misc_base + 0x24C)
740b928af1SViresh Kumar 	/* I2S_CLK_CFG register mask */
750b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_X_MASK		0x1F
760b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_X_SHIFT		27
770b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_Y_MASK		0x1F
780b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_Y_SHIFT		22
790b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_EQ_SEL_SHIFT		21
800b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_SYNTH_ENB		20
810b928af1SViresh Kumar 	#define SPEAR1310_I2S_PRS1_CLK_X_MASK		0xFF
820b928af1SViresh Kumar 	#define SPEAR1310_I2S_PRS1_CLK_X_SHIFT		12
830b928af1SViresh Kumar 	#define SPEAR1310_I2S_PRS1_CLK_Y_MASK		0xFF
840b928af1SViresh Kumar 	#define SPEAR1310_I2S_PRS1_CLK_Y_SHIFT		4
850b928af1SViresh Kumar 	#define SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT		3
860b928af1SViresh Kumar 	#define SPEAR1310_I2S_REF_SEL_MASK		1
870b928af1SViresh Kumar 	#define SPEAR1310_I2S_REF_SHIFT			2
880b928af1SViresh Kumar 	#define SPEAR1310_I2S_SRC_CLK_MASK		2
890b928af1SViresh Kumar 	#define SPEAR1310_I2S_SRC_CLK_SHIFT		0
900b928af1SViresh Kumar 
91d9909ebeSArnd Bergmann #define SPEAR1310_C3_CLK_SYNT			(misc_base + 0x250)
92d9909ebeSArnd Bergmann #define SPEAR1310_UART_CLK_SYNT			(misc_base + 0x254)
93d9909ebeSArnd Bergmann #define SPEAR1310_GMAC_CLK_SYNT			(misc_base + 0x258)
94d9909ebeSArnd Bergmann #define SPEAR1310_SDHCI_CLK_SYNT		(misc_base + 0x25C)
95d9909ebeSArnd Bergmann #define SPEAR1310_CFXD_CLK_SYNT			(misc_base + 0x260)
96d9909ebeSArnd Bergmann #define SPEAR1310_ADC_CLK_SYNT			(misc_base + 0x264)
97d9909ebeSArnd Bergmann #define SPEAR1310_AMBA_CLK_SYNT			(misc_base + 0x268)
98d9909ebeSArnd Bergmann #define SPEAR1310_CLCD_CLK_SYNT			(misc_base + 0x270)
99d9909ebeSArnd Bergmann #define SPEAR1310_RAS_CLK_SYNT0			(misc_base + 0x280)
100d9909ebeSArnd Bergmann #define SPEAR1310_RAS_CLK_SYNT1			(misc_base + 0x288)
101d9909ebeSArnd Bergmann #define SPEAR1310_RAS_CLK_SYNT2			(misc_base + 0x290)
102d9909ebeSArnd Bergmann #define SPEAR1310_RAS_CLK_SYNT3			(misc_base + 0x298)
1030b928af1SViresh Kumar 	/* Check Fractional synthesizer reg masks */
1040b928af1SViresh Kumar 
105d9909ebeSArnd Bergmann #define SPEAR1310_PERIP1_CLK_ENB		(misc_base + 0x300)
1060b928af1SViresh Kumar 	/* PERIP1_CLK_ENB register masks */
1070b928af1SViresh Kumar 	#define SPEAR1310_RTC_CLK_ENB			31
1080b928af1SViresh Kumar 	#define SPEAR1310_ADC_CLK_ENB			30
1090b928af1SViresh Kumar 	#define SPEAR1310_C3_CLK_ENB			29
1100b928af1SViresh Kumar 	#define SPEAR1310_JPEG_CLK_ENB			28
1110b928af1SViresh Kumar 	#define SPEAR1310_CLCD_CLK_ENB			27
1120b928af1SViresh Kumar 	#define SPEAR1310_DMA_CLK_ENB			25
1130b928af1SViresh Kumar 	#define SPEAR1310_GPIO1_CLK_ENB			24
1140b928af1SViresh Kumar 	#define SPEAR1310_GPIO0_CLK_ENB			23
1150b928af1SViresh Kumar 	#define SPEAR1310_GPT1_CLK_ENB			22
1160b928af1SViresh Kumar 	#define SPEAR1310_GPT0_CLK_ENB			21
1170b928af1SViresh Kumar 	#define SPEAR1310_I2S0_CLK_ENB			20
1180b928af1SViresh Kumar 	#define SPEAR1310_I2S1_CLK_ENB			19
1190b928af1SViresh Kumar 	#define SPEAR1310_I2C0_CLK_ENB			18
1200b928af1SViresh Kumar 	#define SPEAR1310_SSP_CLK_ENB			17
1210b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_ENB			15
1220b928af1SViresh Kumar 	#define SPEAR1310_PCIE_SATA_2_CLK_ENB		14
1230b928af1SViresh Kumar 	#define SPEAR1310_PCIE_SATA_1_CLK_ENB		13
1240b928af1SViresh Kumar 	#define SPEAR1310_PCIE_SATA_0_CLK_ENB		12
1250b928af1SViresh Kumar 	#define SPEAR1310_UOC_CLK_ENB			11
1260b928af1SViresh Kumar 	#define SPEAR1310_UHC1_CLK_ENB			10
1270b928af1SViresh Kumar 	#define SPEAR1310_UHC0_CLK_ENB			9
1280b928af1SViresh Kumar 	#define SPEAR1310_GMAC_CLK_ENB			8
1290b928af1SViresh Kumar 	#define SPEAR1310_CFXD_CLK_ENB			7
1300b928af1SViresh Kumar 	#define SPEAR1310_SDHCI_CLK_ENB			6
1310b928af1SViresh Kumar 	#define SPEAR1310_SMI_CLK_ENB			5
1320b928af1SViresh Kumar 	#define SPEAR1310_FSMC_CLK_ENB			4
1330b928af1SViresh Kumar 	#define SPEAR1310_SYSRAM0_CLK_ENB		3
1340b928af1SViresh Kumar 	#define SPEAR1310_SYSRAM1_CLK_ENB		2
1350b928af1SViresh Kumar 	#define SPEAR1310_SYSROM_CLK_ENB		1
1360b928af1SViresh Kumar 	#define SPEAR1310_BUS_CLK_ENB			0
1370b928af1SViresh Kumar 
138d9909ebeSArnd Bergmann #define SPEAR1310_PERIP2_CLK_ENB		(misc_base + 0x304)
1390b928af1SViresh Kumar 	/* PERIP2_CLK_ENB register masks */
1400b928af1SViresh Kumar 	#define SPEAR1310_THSENS_CLK_ENB		8
1410b928af1SViresh Kumar 	#define SPEAR1310_I2S_REF_PAD_CLK_ENB		7
1420b928af1SViresh Kumar 	#define SPEAR1310_ACP_CLK_ENB			6
1430b928af1SViresh Kumar 	#define SPEAR1310_GPT3_CLK_ENB			5
1440b928af1SViresh Kumar 	#define SPEAR1310_GPT2_CLK_ENB			4
1450b928af1SViresh Kumar 	#define SPEAR1310_KBD_CLK_ENB			3
1460b928af1SViresh Kumar 	#define SPEAR1310_CPU_DBG_CLK_ENB		2
1470b928af1SViresh Kumar 	#define SPEAR1310_DDR_CORE_CLK_ENB		1
1480b928af1SViresh Kumar 	#define SPEAR1310_DDR_CTRL_CLK_ENB		0
1490b928af1SViresh Kumar 
150d9909ebeSArnd Bergmann #define SPEAR1310_RAS_CLK_ENB			(misc_base + 0x310)
1510b928af1SViresh Kumar 	/* RAS_CLK_ENB register masks */
1520b928af1SViresh Kumar 	#define SPEAR1310_SYNT3_CLK_ENB			17
1530b928af1SViresh Kumar 	#define SPEAR1310_SYNT2_CLK_ENB			16
1540b928af1SViresh Kumar 	#define SPEAR1310_SYNT1_CLK_ENB			15
1550b928af1SViresh Kumar 	#define SPEAR1310_SYNT0_CLK_ENB			14
1560b928af1SViresh Kumar 	#define SPEAR1310_PCLK3_CLK_ENB			13
1570b928af1SViresh Kumar 	#define SPEAR1310_PCLK2_CLK_ENB			12
1580b928af1SViresh Kumar 	#define SPEAR1310_PCLK1_CLK_ENB			11
1590b928af1SViresh Kumar 	#define SPEAR1310_PCLK0_CLK_ENB			10
1600b928af1SViresh Kumar 	#define SPEAR1310_PLL3_CLK_ENB			9
1610b928af1SViresh Kumar 	#define SPEAR1310_PLL2_CLK_ENB			8
1620b928af1SViresh Kumar 	#define SPEAR1310_C125M_PAD_CLK_ENB		7
1630b928af1SViresh Kumar 	#define SPEAR1310_C30M_CLK_ENB			6
1640b928af1SViresh Kumar 	#define SPEAR1310_C48M_CLK_ENB			5
1650b928af1SViresh Kumar 	#define SPEAR1310_OSC_25M_CLK_ENB		4
1660b928af1SViresh Kumar 	#define SPEAR1310_OSC_32K_CLK_ENB		3
1670b928af1SViresh Kumar 	#define SPEAR1310_OSC_24M_CLK_ENB		2
1680b928af1SViresh Kumar 	#define SPEAR1310_PCLK_CLK_ENB			1
1690b928af1SViresh Kumar 	#define SPEAR1310_ACLK_CLK_ENB			0
1700b928af1SViresh Kumar 
1710b928af1SViresh Kumar /* RAS Area Control Register */
172d9909ebeSArnd Bergmann #define SPEAR1310_RAS_CTRL_REG0			(ras_base + 0x000)
1730b928af1SViresh Kumar 	#define SPEAR1310_SSP1_CLK_MASK			3
1740b928af1SViresh Kumar 	#define SPEAR1310_SSP1_CLK_SHIFT		26
1750b928af1SViresh Kumar 	#define SPEAR1310_TDM_CLK_MASK			1
1760b928af1SViresh Kumar 	#define SPEAR1310_TDM2_CLK_SHIFT		24
1770b928af1SViresh Kumar 	#define SPEAR1310_TDM1_CLK_SHIFT		23
1780b928af1SViresh Kumar 	#define SPEAR1310_I2C_CLK_MASK			1
1790b928af1SViresh Kumar 	#define SPEAR1310_I2C7_CLK_SHIFT		22
1800b928af1SViresh Kumar 	#define SPEAR1310_I2C6_CLK_SHIFT		21
1810b928af1SViresh Kumar 	#define SPEAR1310_I2C5_CLK_SHIFT		20
1820b928af1SViresh Kumar 	#define SPEAR1310_I2C4_CLK_SHIFT		19
1830b928af1SViresh Kumar 	#define SPEAR1310_I2C3_CLK_SHIFT		18
1840b928af1SViresh Kumar 	#define SPEAR1310_I2C2_CLK_SHIFT		17
1850b928af1SViresh Kumar 	#define SPEAR1310_I2C1_CLK_SHIFT		16
1860b928af1SViresh Kumar 	#define SPEAR1310_GPT64_CLK_MASK		1
1870b928af1SViresh Kumar 	#define SPEAR1310_GPT64_CLK_SHIFT		15
1880b928af1SViresh Kumar 	#define SPEAR1310_RAS_UART_CLK_MASK		1
1890b928af1SViresh Kumar 	#define SPEAR1310_UART5_CLK_SHIFT		14
1900b928af1SViresh Kumar 	#define SPEAR1310_UART4_CLK_SHIFT		13
1910b928af1SViresh Kumar 	#define SPEAR1310_UART3_CLK_SHIFT		12
1920b928af1SViresh Kumar 	#define SPEAR1310_UART2_CLK_SHIFT		11
1930b928af1SViresh Kumar 	#define SPEAR1310_UART1_CLK_SHIFT		10
1940b928af1SViresh Kumar 	#define SPEAR1310_PCI_CLK_MASK			1
1950b928af1SViresh Kumar 	#define SPEAR1310_PCI_CLK_SHIFT			0
1960b928af1SViresh Kumar 
197d9909ebeSArnd Bergmann #define SPEAR1310_RAS_CTRL_REG1			(ras_base + 0x004)
1980b928af1SViresh Kumar 	#define SPEAR1310_PHY_CLK_MASK			0x3
1990b928af1SViresh Kumar 	#define SPEAR1310_RMII_PHY_CLK_SHIFT		0
2000b928af1SViresh Kumar 	#define SPEAR1310_SMII_RGMII_PHY_CLK_SHIFT	2
2010b928af1SViresh Kumar 
202d9909ebeSArnd Bergmann #define SPEAR1310_RAS_SW_CLK_CTRL		(ras_base + 0x0148)
2030b928af1SViresh Kumar 	#define SPEAR1310_CAN1_CLK_ENB			25
2040b928af1SViresh Kumar 	#define SPEAR1310_CAN0_CLK_ENB			24
2050b928af1SViresh Kumar 	#define SPEAR1310_GPT64_CLK_ENB			23
2060b928af1SViresh Kumar 	#define SPEAR1310_SSP1_CLK_ENB			22
2070b928af1SViresh Kumar 	#define SPEAR1310_I2C7_CLK_ENB			21
2080b928af1SViresh Kumar 	#define SPEAR1310_I2C6_CLK_ENB			20
2090b928af1SViresh Kumar 	#define SPEAR1310_I2C5_CLK_ENB			19
2100b928af1SViresh Kumar 	#define SPEAR1310_I2C4_CLK_ENB			18
2110b928af1SViresh Kumar 	#define SPEAR1310_I2C3_CLK_ENB			17
2120b928af1SViresh Kumar 	#define SPEAR1310_I2C2_CLK_ENB			16
2130b928af1SViresh Kumar 	#define SPEAR1310_I2C1_CLK_ENB			15
2140b928af1SViresh Kumar 	#define SPEAR1310_UART5_CLK_ENB			14
2150b928af1SViresh Kumar 	#define SPEAR1310_UART4_CLK_ENB			13
2160b928af1SViresh Kumar 	#define SPEAR1310_UART3_CLK_ENB			12
2170b928af1SViresh Kumar 	#define SPEAR1310_UART2_CLK_ENB			11
2180b928af1SViresh Kumar 	#define SPEAR1310_UART1_CLK_ENB			10
2190b928af1SViresh Kumar 	#define SPEAR1310_RS485_1_CLK_ENB		9
2200b928af1SViresh Kumar 	#define SPEAR1310_RS485_0_CLK_ENB		8
2210b928af1SViresh Kumar 	#define SPEAR1310_TDM2_CLK_ENB			7
2220b928af1SViresh Kumar 	#define SPEAR1310_TDM1_CLK_ENB			6
2230b928af1SViresh Kumar 	#define SPEAR1310_PCI_CLK_ENB			5
2240b928af1SViresh Kumar 	#define SPEAR1310_GMII_CLK_ENB			4
2250b928af1SViresh Kumar 	#define SPEAR1310_MII2_CLK_ENB			3
2260b928af1SViresh Kumar 	#define SPEAR1310_MII1_CLK_ENB			2
2270b928af1SViresh Kumar 	#define SPEAR1310_MII0_CLK_ENB			1
2280b928af1SViresh Kumar 	#define SPEAR1310_ESRAM_CLK_ENB			0
2290b928af1SViresh Kumar 
2300b928af1SViresh Kumar static DEFINE_SPINLOCK(_lock);
2310b928af1SViresh Kumar 
2320b928af1SViresh Kumar /* pll rate configuration table, in ascending order of rates */
2330b928af1SViresh Kumar static struct pll_rate_tbl pll_rtbl[] = {
2340b928af1SViresh Kumar 	/* PCLK 24MHz */
2350b928af1SViresh Kumar 	{.mode = 0, .m = 0x83, .n = 0x04, .p = 0x5}, /* vco 1572, pll 49.125 MHz */
2360b928af1SViresh Kumar 	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x3}, /* vco 1000, pll 125 MHz */
2370b928af1SViresh Kumar 	{.mode = 0, .m = 0x64, .n = 0x06, .p = 0x1}, /* vco 800, pll 400 MHz */
2380b928af1SViresh Kumar 	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x1}, /* vco 1000, pll 500 MHz */
2390b928af1SViresh Kumar 	{.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x1}, /* vco 1328, pll 664 MHz */
2400b928af1SViresh Kumar 	{.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x1}, /* vco 1600, pll 800 MHz */
2410b928af1SViresh Kumar 	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
2420b928af1SViresh Kumar };
2430b928af1SViresh Kumar 
2440b928af1SViresh Kumar /* vco-pll4 rate configuration table, in ascending order of rates */
2450b928af1SViresh Kumar static struct pll_rate_tbl pll4_rtbl[] = {
2460b928af1SViresh Kumar 	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x2}, /* vco 1000, pll 250 MHz */
2470b928af1SViresh Kumar 	{.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x2}, /* vco 1328, pll 332 MHz */
2480b928af1SViresh Kumar 	{.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x2}, /* vco 1600, pll 400 MHz */
2490b928af1SViresh Kumar 	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
2500b928af1SViresh Kumar };
2510b928af1SViresh Kumar 
2520b928af1SViresh Kumar /* aux rate configuration table, in ascending order of rates */
2530b928af1SViresh Kumar static struct aux_rate_tbl aux_rtbl[] = {
2540b928af1SViresh Kumar 	/* For VCO1div2 = 500 MHz */
2550b928af1SViresh Kumar 	{.xscale = 10, .yscale = 204, .eq = 0}, /* 12.29 MHz */
2560b928af1SViresh Kumar 	{.xscale = 4, .yscale = 21, .eq = 0}, /* 48 MHz */
2570b928af1SViresh Kumar 	{.xscale = 2, .yscale = 6, .eq = 0}, /* 83 MHz */
2580b928af1SViresh Kumar 	{.xscale = 2, .yscale = 4, .eq = 0}, /* 125 MHz */
2590b928af1SViresh Kumar 	{.xscale = 1, .yscale = 3, .eq = 1}, /* 166 MHz */
2600b928af1SViresh Kumar 	{.xscale = 1, .yscale = 2, .eq = 1}, /* 250 MHz */
2610b928af1SViresh Kumar };
2620b928af1SViresh Kumar 
2630b928af1SViresh Kumar /* gmac rate configuration table, in ascending order of rates */
2640b928af1SViresh Kumar static struct aux_rate_tbl gmac_rtbl[] = {
2650b928af1SViresh Kumar 	/* For gmac phy input clk */
2660b928af1SViresh Kumar 	{.xscale = 2, .yscale = 6, .eq = 0}, /* divided by 6 */
2670b928af1SViresh Kumar 	{.xscale = 2, .yscale = 4, .eq = 0}, /* divided by 4 */
2680b928af1SViresh Kumar 	{.xscale = 1, .yscale = 3, .eq = 1}, /* divided by 3 */
2690b928af1SViresh Kumar 	{.xscale = 1, .yscale = 2, .eq = 1}, /* divided by 2 */
2700b928af1SViresh Kumar };
2710b928af1SViresh Kumar 
2720b928af1SViresh Kumar /* clcd rate configuration table, in ascending order of rates */
2730b928af1SViresh Kumar static struct frac_rate_tbl clcd_rtbl[] = {
2740b928af1SViresh Kumar 	{.div = 0x14000}, /* 25 Mhz , for vc01div4 = 250 MHz*/
2750b928af1SViresh Kumar 	{.div = 0x1284B}, /* 27 Mhz , for vc01div4 = 250 MHz*/
2760b928af1SViresh Kumar 	{.div = 0x0D8D3}, /* 58 Mhz , for vco1div4 = 393 MHz */
2770b928af1SViresh Kumar 	{.div = 0x0B72C}, /* 58 Mhz , for vco1div4 = 332 MHz */
2780b928af1SViresh Kumar 	{.div = 0x089EE}, /* 58 Mhz , for vc01div4 = 250 MHz*/
2790b928af1SViresh Kumar 	{.div = 0x06f1C}, /* 72 Mhz , for vc01div4 = 250 MHz*/
2800b928af1SViresh Kumar 	{.div = 0x06E58}, /* 58 Mhz , for vco1div4 = 200 MHz */
2810b928af1SViresh Kumar 	{.div = 0x06c1B}, /* 74 Mhz , for vc01div4 = 250 MHz*/
2820b928af1SViresh Kumar 	{.div = 0x04A12}, /* 108 Mhz , for vc01div4 = 250 MHz*/
2830b928af1SViresh Kumar 	{.div = 0x0378E}, /* 144 Mhz , for vc01div4 = 250 MHz*/
2840b928af1SViresh Kumar };
2850b928af1SViresh Kumar 
2860b928af1SViresh Kumar /* i2s prescaler1 masks */
287*37d2f45dSBhumika Goyal static const struct aux_clk_masks i2s_prs1_masks = {
2880b928af1SViresh Kumar 	.eq_sel_mask = AUX_EQ_SEL_MASK,
2890b928af1SViresh Kumar 	.eq_sel_shift = SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT,
2900b928af1SViresh Kumar 	.eq1_mask = AUX_EQ1_SEL,
2910b928af1SViresh Kumar 	.eq2_mask = AUX_EQ2_SEL,
2920b928af1SViresh Kumar 	.xscale_sel_mask = SPEAR1310_I2S_PRS1_CLK_X_MASK,
2930b928af1SViresh Kumar 	.xscale_sel_shift = SPEAR1310_I2S_PRS1_CLK_X_SHIFT,
2940b928af1SViresh Kumar 	.yscale_sel_mask = SPEAR1310_I2S_PRS1_CLK_Y_MASK,
2950b928af1SViresh Kumar 	.yscale_sel_shift = SPEAR1310_I2S_PRS1_CLK_Y_SHIFT,
2960b928af1SViresh Kumar };
2970b928af1SViresh Kumar 
2980b928af1SViresh Kumar /* i2s sclk (bit clock) syynthesizers masks */
2990b928af1SViresh Kumar static struct aux_clk_masks i2s_sclk_masks = {
3000b928af1SViresh Kumar 	.eq_sel_mask = AUX_EQ_SEL_MASK,
3010b928af1SViresh Kumar 	.eq_sel_shift = SPEAR1310_I2S_SCLK_EQ_SEL_SHIFT,
3020b928af1SViresh Kumar 	.eq1_mask = AUX_EQ1_SEL,
3030b928af1SViresh Kumar 	.eq2_mask = AUX_EQ2_SEL,
3040b928af1SViresh Kumar 	.xscale_sel_mask = SPEAR1310_I2S_SCLK_X_MASK,
3050b928af1SViresh Kumar 	.xscale_sel_shift = SPEAR1310_I2S_SCLK_X_SHIFT,
3060b928af1SViresh Kumar 	.yscale_sel_mask = SPEAR1310_I2S_SCLK_Y_MASK,
3070b928af1SViresh Kumar 	.yscale_sel_shift = SPEAR1310_I2S_SCLK_Y_SHIFT,
3080b928af1SViresh Kumar 	.enable_bit = SPEAR1310_I2S_SCLK_SYNTH_ENB,
3090b928af1SViresh Kumar };
3100b928af1SViresh Kumar 
3110b928af1SViresh Kumar /* i2s prs1 aux rate configuration table, in ascending order of rates */
3120b928af1SViresh Kumar static struct aux_rate_tbl i2s_prs1_rtbl[] = {
3130b928af1SViresh Kumar 	/* For parent clk = 49.152 MHz */
314ef0fd0a2SDeepak Sikri 	{.xscale = 1, .yscale = 12, .eq = 0}, /* 2.048 MHz, smp freq = 8Khz */
315ef0fd0a2SDeepak Sikri 	{.xscale = 11, .yscale = 96, .eq = 0}, /* 2.816 MHz, smp freq = 11Khz */
316ef0fd0a2SDeepak Sikri 	{.xscale = 1, .yscale = 6, .eq = 0}, /* 4.096 MHz, smp freq = 16Khz */
317ef0fd0a2SDeepak Sikri 	{.xscale = 11, .yscale = 48, .eq = 0}, /* 5.632 MHz, smp freq = 22Khz */
318ef0fd0a2SDeepak Sikri 
319ef0fd0a2SDeepak Sikri 	/*
320ef0fd0a2SDeepak Sikri 	 * with parent clk = 49.152, freq gen is 8.192 MHz, smp freq = 32Khz
321ef0fd0a2SDeepak Sikri 	 * with parent clk = 12.288, freq gen is 2.048 MHz, smp freq = 8Khz
322ef0fd0a2SDeepak Sikri 	 */
323ef0fd0a2SDeepak Sikri 	{.xscale = 1, .yscale = 3, .eq = 0},
324ef0fd0a2SDeepak Sikri 
325ef0fd0a2SDeepak Sikri 	/* For parent clk = 49.152 MHz */
326ef0fd0a2SDeepak Sikri 	{.xscale = 17, .yscale = 37, .eq = 0}, /* 11.289 MHz, smp freq = 44Khz*/
327ef0fd0a2SDeepak Sikri 
3280b928af1SViresh Kumar 	{.xscale = 1, .yscale = 2, .eq = 0}, /* 12.288 MHz */
3290b928af1SViresh Kumar };
3300b928af1SViresh Kumar 
3310b928af1SViresh Kumar /* i2s sclk aux rate configuration table, in ascending order of rates */
3320b928af1SViresh Kumar static struct aux_rate_tbl i2s_sclk_rtbl[] = {
3330b928af1SViresh Kumar 	/* For i2s_ref_clk = 12.288MHz */
3340b928af1SViresh Kumar 	{.xscale = 1, .yscale = 4, .eq = 0}, /* 1.53 MHz */
3350b928af1SViresh Kumar 	{.xscale = 1, .yscale = 2, .eq = 0}, /* 3.07 Mhz */
3360b928af1SViresh Kumar };
3370b928af1SViresh Kumar 
3380b928af1SViresh Kumar /* adc rate configuration table, in ascending order of rates */
3390b928af1SViresh Kumar /* possible adc range is 2.5 MHz to 20 MHz. */
3400b928af1SViresh Kumar static struct aux_rate_tbl adc_rtbl[] = {
3410b928af1SViresh Kumar 	/* For ahb = 166.67 MHz */
3420b928af1SViresh Kumar 	{.xscale = 1, .yscale = 31, .eq = 0}, /* 2.68 MHz */
3430b928af1SViresh Kumar 	{.xscale = 2, .yscale = 21, .eq = 0}, /* 7.94 MHz */
3440b928af1SViresh Kumar 	{.xscale = 4, .yscale = 21, .eq = 0}, /* 15.87 MHz */
3450b928af1SViresh Kumar 	{.xscale = 10, .yscale = 42, .eq = 0}, /* 19.84 MHz */
3460b928af1SViresh Kumar };
3470b928af1SViresh Kumar 
3480b928af1SViresh Kumar /* General synth rate configuration table, in ascending order of rates */
3490b928af1SViresh Kumar static struct frac_rate_tbl gen_rtbl[] = {
3500b928af1SViresh Kumar 	/* For vco1div4 = 250 MHz */
3510b928af1SViresh Kumar 	{.div = 0x14000}, /* 25 MHz */
3520b928af1SViresh Kumar 	{.div = 0x0A000}, /* 50 MHz */
3530b928af1SViresh Kumar 	{.div = 0x05000}, /* 100 MHz */
3540b928af1SViresh Kumar 	{.div = 0x02000}, /* 250 MHz */
3550b928af1SViresh Kumar };
3560b928af1SViresh Kumar 
3570b928af1SViresh Kumar /* clock parents */
3580b928af1SViresh Kumar static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", };
3590b928af1SViresh Kumar static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", };
360e28f1aa1SVipul Kumar Samar static const char *uart0_parents[] = { "pll5_clk", "uart_syn_gclk", };
361e28f1aa1SVipul Kumar Samar static const char *c3_parents[] = { "pll5_clk", "c3_syn_gclk", };
362e28f1aa1SVipul Kumar Samar static const char *gmac_phy_input_parents[] = { "gmii_pad_clk", "pll2_clk",
3630b928af1SViresh Kumar 	"osc_25m_clk", };
364e28f1aa1SVipul Kumar Samar static const char *gmac_phy_parents[] = { "phy_input_mclk", "phy_syn_gclk", };
3650b928af1SViresh Kumar static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", };
366e28f1aa1SVipul Kumar Samar static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_syn_clk", };
3670b928af1SViresh Kumar static const char *i2s_src_parents[] = { "vco1div2_clk", "none", "pll3_clk",
3680b928af1SViresh Kumar 	"i2s_src_pad_clk", };
369e28f1aa1SVipul Kumar Samar static const char *i2s_ref_parents[] = { "i2s_src_mclk", "i2s_prs1_clk", };
3700b928af1SViresh Kumar static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk",
3710b928af1SViresh Kumar 	"pll3_clk", };
3720b928af1SViresh Kumar static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco3div2_clk",
3730b928af1SViresh Kumar 	"pll2_clk", };
3740b928af1SViresh Kumar static const char *rmii_phy_parents[] = { "ras_tx50_clk", "none",
375e28f1aa1SVipul Kumar Samar 	"ras_pll2_clk", "ras_syn0_clk", };
3760b928af1SViresh Kumar static const char *smii_rgmii_phy_parents[] = { "none", "ras_tx125_clk",
377e28f1aa1SVipul Kumar Samar 	"ras_pll2_clk", "ras_syn0_clk", };
378e28f1aa1SVipul Kumar Samar static const char *uart_parents[] = { "ras_apb_clk", "gen_syn3_clk", };
379e28f1aa1SVipul Kumar Samar static const char *i2c_parents[] = { "ras_apb_clk", "gen_syn1_clk", };
380e28f1aa1SVipul Kumar Samar static const char *ssp1_parents[] = { "ras_apb_clk", "gen_syn1_clk",
3810b928af1SViresh Kumar 	"ras_plclk0_clk", };
382e28f1aa1SVipul Kumar Samar static const char *pci_parents[] = { "ras_pll3_clk", "gen_syn2_clk", };
383e28f1aa1SVipul Kumar Samar static const char *tdm_parents[] = { "ras_pll3_clk", "gen_syn1_clk", };
3840b928af1SViresh Kumar 
385d9909ebeSArnd Bergmann void __init spear1310_clk_init(void __iomem *misc_base, void __iomem *ras_base)
3860b928af1SViresh Kumar {
3870b928af1SViresh Kumar 	struct clk *clk, *clk1;
3880b928af1SViresh Kumar 
389afb4bdc9SStephen Boyd 	clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, 0, 32000);
3900b928af1SViresh Kumar 	clk_register_clkdev(clk, "osc_32k_clk", NULL);
3910b928af1SViresh Kumar 
392afb4bdc9SStephen Boyd 	clk = clk_register_fixed_rate(NULL, "osc_24m_clk", NULL, 0, 24000000);
3930b928af1SViresh Kumar 	clk_register_clkdev(clk, "osc_24m_clk", NULL);
3940b928af1SViresh Kumar 
395afb4bdc9SStephen Boyd 	clk = clk_register_fixed_rate(NULL, "osc_25m_clk", NULL, 0, 25000000);
3960b928af1SViresh Kumar 	clk_register_clkdev(clk, "osc_25m_clk", NULL);
3970b928af1SViresh Kumar 
398afb4bdc9SStephen Boyd 	clk = clk_register_fixed_rate(NULL, "gmii_pad_clk", NULL, 0, 125000000);
399e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gmii_pad_clk", NULL);
4000b928af1SViresh Kumar 
401afb4bdc9SStephen Boyd 	clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, 0,
402afb4bdc9SStephen Boyd 				      12288000);
4030b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2s_src_pad_clk", NULL);
4040b928af1SViresh Kumar 
4050b928af1SViresh Kumar 	/* clock derived from 32 KHz osc clk */
4060b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "rtc-spear", "osc_32k_clk", 0,
4070b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_RTC_CLK_ENB, 0,
4080b928af1SViresh Kumar 			&_lock);
409df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "e0580000.rtc");
4100b928af1SViresh Kumar 
4110b928af1SViresh Kumar 	/* clock derived from 24 or 25 MHz osc clk */
4120b928af1SViresh Kumar 	/* vco-pll */
413e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "vco1_mclk", vco_parents,
414819c1de3SJames Hogan 			ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
415819c1de3SJames Hogan 			SPEAR1310_PLL_CFG, SPEAR1310_PLL1_CLK_SHIFT,
416819c1de3SJames Hogan 			SPEAR1310_PLL_CLK_MASK, 0, &_lock);
417e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "vco1_mclk", NULL);
418e28f1aa1SVipul Kumar Samar 	clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mclk",
4190b928af1SViresh Kumar 			0, SPEAR1310_PLL1_CTR, SPEAR1310_PLL1_FRQ, pll_rtbl,
4200b928af1SViresh Kumar 			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4210b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco1_clk", NULL);
4220b928af1SViresh Kumar 	clk_register_clkdev(clk1, "pll1_clk", NULL);
4230b928af1SViresh Kumar 
424e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "vco2_mclk", vco_parents,
425819c1de3SJames Hogan 			ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
426819c1de3SJames Hogan 			SPEAR1310_PLL_CFG, SPEAR1310_PLL2_CLK_SHIFT,
427819c1de3SJames Hogan 			SPEAR1310_PLL_CLK_MASK, 0, &_lock);
428e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "vco2_mclk", NULL);
429e28f1aa1SVipul Kumar Samar 	clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mclk",
4300b928af1SViresh Kumar 			0, SPEAR1310_PLL2_CTR, SPEAR1310_PLL2_FRQ, pll_rtbl,
4310b928af1SViresh Kumar 			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4320b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco2_clk", NULL);
4330b928af1SViresh Kumar 	clk_register_clkdev(clk1, "pll2_clk", NULL);
4340b928af1SViresh Kumar 
435e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "vco3_mclk", vco_parents,
436819c1de3SJames Hogan 			ARRAY_SIZE(vco_parents), CLK_SET_RATE_NO_REPARENT,
437819c1de3SJames Hogan 			SPEAR1310_PLL_CFG, SPEAR1310_PLL3_CLK_SHIFT,
438819c1de3SJames Hogan 			SPEAR1310_PLL_CLK_MASK, 0, &_lock);
439e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "vco3_mclk", NULL);
440e28f1aa1SVipul Kumar Samar 	clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mclk",
4410b928af1SViresh Kumar 			0, SPEAR1310_PLL3_CTR, SPEAR1310_PLL3_FRQ, pll_rtbl,
4420b928af1SViresh Kumar 			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4430b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco3_clk", NULL);
4440b928af1SViresh Kumar 	clk_register_clkdev(clk1, "pll3_clk", NULL);
4450b928af1SViresh Kumar 
4460b928af1SViresh Kumar 	clk = clk_register_vco_pll("vco4_clk", "pll4_clk", NULL, "osc_24m_clk",
4470b928af1SViresh Kumar 			0, SPEAR1310_PLL4_CTR, SPEAR1310_PLL4_FRQ, pll4_rtbl,
4480b928af1SViresh Kumar 			ARRAY_SIZE(pll4_rtbl), &_lock, &clk1, NULL);
4490b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco4_clk", NULL);
4500b928af1SViresh Kumar 	clk_register_clkdev(clk1, "pll4_clk", NULL);
4510b928af1SViresh Kumar 
4520b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "pll5_clk", "osc_24m_clk", 0,
4530b928af1SViresh Kumar 			48000000);
4540b928af1SViresh Kumar 	clk_register_clkdev(clk, "pll5_clk", NULL);
4550b928af1SViresh Kumar 
4560b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "pll6_clk", "osc_25m_clk", 0,
4570b928af1SViresh Kumar 			25000000);
4580b928af1SViresh Kumar 	clk_register_clkdev(clk, "pll6_clk", NULL);
4590b928af1SViresh Kumar 
4600b928af1SViresh Kumar 	/* vco div n clocks */
4610b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "vco1div2_clk", "vco1_clk", 0, 1,
4620b928af1SViresh Kumar 			2);
4630b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco1div2_clk", NULL);
4640b928af1SViresh Kumar 
4650b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "vco1div4_clk", "vco1_clk", 0, 1,
4660b928af1SViresh Kumar 			4);
4670b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco1div4_clk", NULL);
4680b928af1SViresh Kumar 
4690b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "vco2div2_clk", "vco2_clk", 0, 1,
4700b928af1SViresh Kumar 			2);
4710b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco2div2_clk", NULL);
4720b928af1SViresh Kumar 
4730b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "vco3div2_clk", "vco3_clk", 0, 1,
4740b928af1SViresh Kumar 			2);
4750b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco3div2_clk", NULL);
4760b928af1SViresh Kumar 
4770b928af1SViresh Kumar 	/* peripherals */
4780b928af1SViresh Kumar 	clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1,
4790b928af1SViresh Kumar 			128);
480e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "thermal_gclk", "thermal_clk", 0,
4810b928af1SViresh Kumar 			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_THSENS_CLK_ENB, 0,
4820b928af1SViresh Kumar 			&_lock);
4830b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "spear_thermal");
4840b928af1SViresh Kumar 
4850b928af1SViresh Kumar 	/* clock derived from pll4 clk */
4860b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "ddr_clk", "pll4_clk", 0, 1,
4870b928af1SViresh Kumar 			1);
4880b928af1SViresh Kumar 	clk_register_clkdev(clk, "ddr_clk", NULL);
4890b928af1SViresh Kumar 
4900b928af1SViresh Kumar 	/* clock derived from pll1 clk */
49112499792SVipul Kumar Samar 	clk = clk_register_fixed_factor(NULL, "cpu_clk", "pll1_clk",
49212499792SVipul Kumar Samar 			CLK_SET_RATE_PARENT, 1, 2);
4930b928af1SViresh Kumar 	clk_register_clkdev(clk, "cpu_clk", NULL);
4940b928af1SViresh Kumar 
4950b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "wdt_clk", "cpu_clk", 0, 1,
4960b928af1SViresh Kumar 			2);
4970b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "ec800620.wdt");
4980b928af1SViresh Kumar 
499cd4b519aSVipul Kumar Samar 	clk = clk_register_fixed_factor(NULL, "smp_twd_clk", "cpu_clk", 0, 1,
500cd4b519aSVipul Kumar Samar 			2);
501cd4b519aSVipul Kumar Samar 	clk_register_clkdev(clk, NULL, "smp_twd");
502cd4b519aSVipul Kumar Samar 
5030b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "ahb_clk", "pll1_clk", 0, 1,
5040b928af1SViresh Kumar 			6);
5050b928af1SViresh Kumar 	clk_register_clkdev(clk, "ahb_clk", NULL);
5060b928af1SViresh Kumar 
5070b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "apb_clk", "pll1_clk", 0, 1,
5080b928af1SViresh Kumar 			12);
5090b928af1SViresh Kumar 	clk_register_clkdev(clk, "apb_clk", NULL);
5100b928af1SViresh Kumar 
5110b928af1SViresh Kumar 	/* gpt clocks */
512e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "gpt0_mclk", gpt_parents,
513819c1de3SJames Hogan 			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
514819c1de3SJames Hogan 			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GPT0_CLK_SHIFT,
515819c1de3SJames Hogan 			SPEAR1310_GPT_CLK_MASK, 0, &_lock);
516e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gpt0_mclk", NULL);
517e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mclk", 0,
5180b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT0_CLK_ENB, 0,
5190b928af1SViresh Kumar 			&_lock);
5200b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "gpt0");
5210b928af1SViresh Kumar 
522e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "gpt1_mclk", gpt_parents,
523819c1de3SJames Hogan 			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
524819c1de3SJames Hogan 			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GPT1_CLK_SHIFT,
525819c1de3SJames Hogan 			SPEAR1310_GPT_CLK_MASK, 0, &_lock);
526e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gpt1_mclk", NULL);
527e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0,
5280b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT1_CLK_ENB, 0,
5290b928af1SViresh Kumar 			&_lock);
5300b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "gpt1");
5310b928af1SViresh Kumar 
532e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "gpt2_mclk", gpt_parents,
533819c1de3SJames Hogan 			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
534819c1de3SJames Hogan 			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GPT2_CLK_SHIFT,
535819c1de3SJames Hogan 			SPEAR1310_GPT_CLK_MASK, 0, &_lock);
536e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gpt2_mclk", NULL);
537e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0,
5380b928af1SViresh Kumar 			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT2_CLK_ENB, 0,
5390b928af1SViresh Kumar 			&_lock);
5400b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "gpt2");
5410b928af1SViresh Kumar 
542e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "gpt3_mclk", gpt_parents,
543819c1de3SJames Hogan 			ARRAY_SIZE(gpt_parents), CLK_SET_RATE_NO_REPARENT,
544819c1de3SJames Hogan 			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GPT3_CLK_SHIFT,
545819c1de3SJames Hogan 			SPEAR1310_GPT_CLK_MASK, 0, &_lock);
546e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gpt3_mclk", NULL);
547e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0,
5480b928af1SViresh Kumar 			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT3_CLK_ENB, 0,
5490b928af1SViresh Kumar 			&_lock);
5500b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "gpt3");
5510b928af1SViresh Kumar 
5520b928af1SViresh Kumar 	/* others */
553e28f1aa1SVipul Kumar Samar 	clk = clk_register_aux("uart_syn_clk", "uart_syn_gclk", "vco1div2_clk",
554e28f1aa1SVipul Kumar Samar 			0, SPEAR1310_UART_CLK_SYNT, NULL, aux_rtbl,
555e28f1aa1SVipul Kumar Samar 			ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
556e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "uart_syn_clk", NULL);
557e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk1, "uart_syn_gclk", NULL);
5580b928af1SViresh Kumar 
559e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents,
560819c1de3SJames Hogan 			ARRAY_SIZE(uart0_parents),
561819c1de3SJames Hogan 			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
56212499792SVipul Kumar Samar 			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_UART_CLK_SHIFT,
56312499792SVipul Kumar Samar 			SPEAR1310_UART_CLK_MASK, 0, &_lock);
564e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "uart0_mclk", NULL);
5650b928af1SViresh Kumar 
56612499792SVipul Kumar Samar 	clk = clk_register_gate(NULL, "uart0_clk", "uart0_mclk",
56712499792SVipul Kumar Samar 			CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
56812499792SVipul Kumar Samar 			SPEAR1310_UART_CLK_ENB, 0, &_lock);
5690b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0000000.serial");
5700b928af1SViresh Kumar 
571e28f1aa1SVipul Kumar Samar 	clk = clk_register_aux("sdhci_syn_clk", "sdhci_syn_gclk",
5720b928af1SViresh Kumar 			"vco1div2_clk", 0, SPEAR1310_SDHCI_CLK_SYNT, NULL,
5730b928af1SViresh Kumar 			aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
574e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "sdhci_syn_clk", NULL);
575e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk1, "sdhci_syn_gclk", NULL);
5760b928af1SViresh Kumar 
57712499792SVipul Kumar Samar 	clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_syn_gclk",
57812499792SVipul Kumar Samar 			CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
57912499792SVipul Kumar Samar 			SPEAR1310_SDHCI_CLK_ENB, 0, &_lock);
5800b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "b3000000.sdhci");
5810b928af1SViresh Kumar 
582e28f1aa1SVipul Kumar Samar 	clk = clk_register_aux("cfxd_syn_clk", "cfxd_syn_gclk", "vco1div2_clk",
583e28f1aa1SVipul Kumar Samar 			0, SPEAR1310_CFXD_CLK_SYNT, NULL, aux_rtbl,
584e28f1aa1SVipul Kumar Samar 			ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
585e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "cfxd_syn_clk", NULL);
586e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk1, "cfxd_syn_gclk", NULL);
5870b928af1SViresh Kumar 
58812499792SVipul Kumar Samar 	clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_syn_gclk",
58912499792SVipul Kumar Samar 			CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
59012499792SVipul Kumar Samar 			SPEAR1310_CFXD_CLK_ENB, 0, &_lock);
5910b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "b2800000.cf");
5920b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "arasan_xd");
5930b928af1SViresh Kumar 
594e28f1aa1SVipul Kumar Samar 	clk = clk_register_aux("c3_syn_clk", "c3_syn_gclk", "vco1div2_clk",
595e28f1aa1SVipul Kumar Samar 			0, SPEAR1310_C3_CLK_SYNT, NULL, aux_rtbl,
596e28f1aa1SVipul Kumar Samar 			ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
597e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "c3_syn_clk", NULL);
598e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk1, "c3_syn_gclk", NULL);
5990b928af1SViresh Kumar 
600e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "c3_mclk", c3_parents,
601819c1de3SJames Hogan 			ARRAY_SIZE(c3_parents),
602819c1de3SJames Hogan 			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
60312499792SVipul Kumar Samar 			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_C3_CLK_SHIFT,
60412499792SVipul Kumar Samar 			SPEAR1310_C3_CLK_MASK, 0, &_lock);
605e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "c3_mclk", NULL);
6060b928af1SViresh Kumar 
607e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "c3_clk", "c3_mclk", 0,
6080b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_C3_CLK_ENB, 0,
6090b928af1SViresh Kumar 			&_lock);
6100b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "c3");
6110b928af1SViresh Kumar 
6120b928af1SViresh Kumar 	/* gmac */
613e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "phy_input_mclk", gmac_phy_input_parents,
614819c1de3SJames Hogan 			ARRAY_SIZE(gmac_phy_input_parents),
615819c1de3SJames Hogan 			CLK_SET_RATE_NO_REPARENT, SPEAR1310_GMAC_CLK_CFG,
6160b928af1SViresh Kumar 			SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT,
6170b928af1SViresh Kumar 			SPEAR1310_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock);
618e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "phy_input_mclk", NULL);
6190b928af1SViresh Kumar 
620e28f1aa1SVipul Kumar Samar 	clk = clk_register_aux("phy_syn_clk", "phy_syn_gclk", "phy_input_mclk",
621e28f1aa1SVipul Kumar Samar 			0, SPEAR1310_GMAC_CLK_SYNT, NULL, gmac_rtbl,
622e28f1aa1SVipul Kumar Samar 			ARRAY_SIZE(gmac_rtbl), &_lock, &clk1);
623e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "phy_syn_clk", NULL);
624e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk1, "phy_syn_gclk", NULL);
6250b928af1SViresh Kumar 
626e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "phy_mclk", gmac_phy_parents,
627819c1de3SJames Hogan 			ARRAY_SIZE(gmac_phy_parents), CLK_SET_RATE_NO_REPARENT,
6280b928af1SViresh Kumar 			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GMAC_PHY_CLK_SHIFT,
6290b928af1SViresh Kumar 			SPEAR1310_GMAC_PHY_CLK_MASK, 0, &_lock);
630df2449abSRajeev Kumar 	clk_register_clkdev(clk, "stmmacphy.0", NULL);
6310b928af1SViresh Kumar 
6320b928af1SViresh Kumar 	/* clcd */
633e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "clcd_syn_mclk", clcd_synth_parents,
634819c1de3SJames Hogan 			ARRAY_SIZE(clcd_synth_parents),
635819c1de3SJames Hogan 			CLK_SET_RATE_NO_REPARENT, SPEAR1310_CLCD_CLK_SYNT,
636819c1de3SJames Hogan 			SPEAR1310_CLCD_SYNT_CLK_SHIFT,
6370b928af1SViresh Kumar 			SPEAR1310_CLCD_SYNT_CLK_MASK, 0, &_lock);
638e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "clcd_syn_mclk", NULL);
6390b928af1SViresh Kumar 
640e28f1aa1SVipul Kumar Samar 	clk = clk_register_frac("clcd_syn_clk", "clcd_syn_mclk", 0,
6410b928af1SViresh Kumar 			SPEAR1310_CLCD_CLK_SYNT, clcd_rtbl,
6420b928af1SViresh Kumar 			ARRAY_SIZE(clcd_rtbl), &_lock);
643e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "clcd_syn_clk", NULL);
6440b928af1SViresh Kumar 
645e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "clcd_pixel_mclk", clcd_pixel_parents,
646819c1de3SJames Hogan 			ARRAY_SIZE(clcd_pixel_parents),
647819c1de3SJames Hogan 			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
6480b928af1SViresh Kumar 			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_CLCD_CLK_SHIFT,
6490b928af1SViresh Kumar 			SPEAR1310_CLCD_CLK_MASK, 0, &_lock);
650e0b9c210SShiraz Hashim 	clk_register_clkdev(clk, "clcd_pixel_mclk", NULL);
6510b928af1SViresh Kumar 
652e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mclk", 0,
6530b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CLCD_CLK_ENB, 0,
6540b928af1SViresh Kumar 			&_lock);
655df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "e1000000.clcd");
6560b928af1SViresh Kumar 
6570b928af1SViresh Kumar 	/* i2s */
658e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "i2s_src_mclk", i2s_src_parents,
659819c1de3SJames Hogan 			ARRAY_SIZE(i2s_src_parents), CLK_SET_RATE_NO_REPARENT,
660819c1de3SJames Hogan 			SPEAR1310_I2S_CLK_CFG, SPEAR1310_I2S_SRC_CLK_SHIFT,
661819c1de3SJames Hogan 			SPEAR1310_I2S_SRC_CLK_MASK, 0, &_lock);
662e0b9c210SShiraz Hashim 	clk_register_clkdev(clk, "i2s_src_mclk", NULL);
6630b928af1SViresh Kumar 
664e28f1aa1SVipul Kumar Samar 	clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mclk", 0,
6650b928af1SViresh Kumar 			SPEAR1310_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl,
6660b928af1SViresh Kumar 			ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL);
6670b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2s_prs1_clk", NULL);
6680b928af1SViresh Kumar 
669e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "i2s_ref_mclk", i2s_ref_parents,
670819c1de3SJames Hogan 			ARRAY_SIZE(i2s_ref_parents),
671819c1de3SJames Hogan 			CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
67212499792SVipul Kumar Samar 			SPEAR1310_I2S_CLK_CFG, SPEAR1310_I2S_REF_SHIFT,
67312499792SVipul Kumar Samar 			SPEAR1310_I2S_REF_SEL_MASK, 0, &_lock);
67412499792SVipul Kumar Samar 	clk_register_clkdev(clk, "i2s_ref_mclk", NULL);
6750b928af1SViresh Kumar 
676e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mclk", 0,
6770b928af1SViresh Kumar 			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_I2S_REF_PAD_CLK_ENB,
6780b928af1SViresh Kumar 			0, &_lock);
6790b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL);
6800b928af1SViresh Kumar 
681e28f1aa1SVipul Kumar Samar 	clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gclk",
682463f9e20SShiraz Hashim 			"i2s_ref_mclk", 0, SPEAR1310_I2S_CLK_CFG,
6830b928af1SViresh Kumar 			&i2s_sclk_masks, i2s_sclk_rtbl,
6840b928af1SViresh Kumar 			ARRAY_SIZE(i2s_sclk_rtbl), &_lock, &clk1);
6850b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2s_sclk_clk", NULL);
686e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk1, "i2s_sclk_gclk", NULL);
6870b928af1SViresh Kumar 
6880b928af1SViresh Kumar 	/* clock derived from ahb clk */
6890b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0,
6900b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2C0_CLK_ENB, 0,
6910b928af1SViresh Kumar 			&_lock);
6920b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0280000.i2c");
6930b928af1SViresh Kumar 
6940b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "dma_clk", "ahb_clk", 0,
6950b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_DMA_CLK_ENB, 0,
6960b928af1SViresh Kumar 			&_lock);
6970b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "ea800000.dma");
6980b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "eb000000.dma");
6990b928af1SViresh Kumar 
7000b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "jpeg_clk", "ahb_clk", 0,
7010b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_JPEG_CLK_ENB, 0,
7020b928af1SViresh Kumar 			&_lock);
7030b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "b2000000.jpeg");
7040b928af1SViresh Kumar 
7050b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0,
7060b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GMAC_CLK_ENB, 0,
7070b928af1SViresh Kumar 			&_lock);
7080b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e2000000.eth");
7090b928af1SViresh Kumar 
7100b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "fsmc_clk", "ahb_clk", 0,
7110b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_FSMC_CLK_ENB, 0,
7120b928af1SViresh Kumar 			&_lock);
7130b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "b0000000.flash");
7140b928af1SViresh Kumar 
7150b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "smi_clk", "ahb_clk", 0,
7160b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SMI_CLK_ENB, 0,
7170b928af1SViresh Kumar 			&_lock);
7180b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "ea000000.flash");
7190b928af1SViresh Kumar 
7200b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "usbh0_clk", "ahb_clk", 0,
7210b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UHC0_CLK_ENB, 0,
7220b928af1SViresh Kumar 			&_lock);
723df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "e4000000.ohci");
724df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "e4800000.ehci");
7250b928af1SViresh Kumar 
7260b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "usbh1_clk", "ahb_clk", 0,
7270b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UHC1_CLK_ENB, 0,
7280b928af1SViresh Kumar 			&_lock);
729df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "e5000000.ohci");
730df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "e5800000.ehci");
7310b928af1SViresh Kumar 
7320b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "uoc_clk", "ahb_clk", 0,
7330b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UOC_CLK_ENB, 0,
7340b928af1SViresh Kumar 			&_lock);
735df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "e3800000.otg");
7360b928af1SViresh Kumar 
7370b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "pcie_sata_0_clk", "ahb_clk", 0,
7380b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_0_CLK_ENB,
7390b928af1SViresh Kumar 			0, &_lock);
74022a69230SPratyush Anand 	clk_register_clkdev(clk, NULL, "b1000000.pcie");
741df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "b1000000.ahci");
7420b928af1SViresh Kumar 
7430b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "pcie_sata_1_clk", "ahb_clk", 0,
7440b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_1_CLK_ENB,
7450b928af1SViresh Kumar 			0, &_lock);
74622a69230SPratyush Anand 	clk_register_clkdev(clk, NULL, "b1800000.pcie");
747df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "b1800000.ahci");
7480b928af1SViresh Kumar 
7490b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "pcie_sata_2_clk", "ahb_clk", 0,
7500b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_2_CLK_ENB,
7510b928af1SViresh Kumar 			0, &_lock);
75222a69230SPratyush Anand 	clk_register_clkdev(clk, NULL, "b4000000.pcie");
753df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "b4000000.ahci");
7540b928af1SViresh Kumar 
7550b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
7560b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SYSRAM0_CLK_ENB, 0,
7570b928af1SViresh Kumar 			&_lock);
7580b928af1SViresh Kumar 	clk_register_clkdev(clk, "sysram0_clk", NULL);
7590b928af1SViresh Kumar 
7600b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "sysram1_clk", "ahb_clk", 0,
7610b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SYSRAM1_CLK_ENB, 0,
7620b928af1SViresh Kumar 			&_lock);
7630b928af1SViresh Kumar 	clk_register_clkdev(clk, "sysram1_clk", NULL);
7640b928af1SViresh Kumar 
765e28f1aa1SVipul Kumar Samar 	clk = clk_register_aux("adc_syn_clk", "adc_syn_gclk", "ahb_clk",
7660b928af1SViresh Kumar 			0, SPEAR1310_ADC_CLK_SYNT, NULL, adc_rtbl,
7670b928af1SViresh Kumar 			ARRAY_SIZE(adc_rtbl), &_lock, &clk1);
768e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "adc_syn_clk", NULL);
769e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk1, "adc_syn_gclk", NULL);
7700b928af1SViresh Kumar 
77112499792SVipul Kumar Samar 	clk = clk_register_gate(NULL, "adc_clk", "adc_syn_gclk",
77212499792SVipul Kumar Samar 			CLK_SET_RATE_PARENT, SPEAR1310_PERIP1_CLK_ENB,
77312499792SVipul Kumar Samar 			SPEAR1310_ADC_CLK_ENB, 0, &_lock);
774df2449abSRajeev Kumar 	clk_register_clkdev(clk, NULL, "e0080000.adc");
7750b928af1SViresh Kumar 
7760b928af1SViresh Kumar 	/* clock derived from apb clk */
7770b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ssp0_clk", "apb_clk", 0,
7780b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SSP_CLK_ENB, 0,
7790b928af1SViresh Kumar 			&_lock);
7800b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0100000.spi");
7810b928af1SViresh Kumar 
7820b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "gpio0_clk", "apb_clk", 0,
7830b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPIO0_CLK_ENB, 0,
7840b928af1SViresh Kumar 			&_lock);
7850b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0600000.gpio");
7860b928af1SViresh Kumar 
7870b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "gpio1_clk", "apb_clk", 0,
7880b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPIO1_CLK_ENB, 0,
7890b928af1SViresh Kumar 			&_lock);
7900b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0680000.gpio");
7910b928af1SViresh Kumar 
7920b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2s0_clk", "apb_clk", 0,
7930b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2S0_CLK_ENB, 0,
7940b928af1SViresh Kumar 			&_lock);
7950b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0180000.i2s");
7960b928af1SViresh Kumar 
7970b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2s1_clk", "apb_clk", 0,
7980b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2S1_CLK_ENB, 0,
7990b928af1SViresh Kumar 			&_lock);
8000b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0200000.i2s");
8010b928af1SViresh Kumar 
8020b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "kbd_clk", "apb_clk", 0,
8030b928af1SViresh Kumar 			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_KBD_CLK_ENB, 0,
8040b928af1SViresh Kumar 			&_lock);
8050b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0300000.kbd");
8060b928af1SViresh Kumar 
8070b928af1SViresh Kumar 	/* RAS clks */
808e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "gen_syn0_1_mclk", gen_synth0_1_parents,
809819c1de3SJames Hogan 			ARRAY_SIZE(gen_synth0_1_parents),
810819c1de3SJames Hogan 			CLK_SET_RATE_NO_REPARENT, SPEAR1310_PLL_CFG,
811e28f1aa1SVipul Kumar Samar 			SPEAR1310_RAS_SYNT0_1_CLK_SHIFT,
8120b928af1SViresh Kumar 			SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock);
813e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gen_syn0_1_clk", NULL);
8140b928af1SViresh Kumar 
815e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "gen_syn2_3_mclk", gen_synth2_3_parents,
816819c1de3SJames Hogan 			ARRAY_SIZE(gen_synth2_3_parents),
817819c1de3SJames Hogan 			CLK_SET_RATE_NO_REPARENT, SPEAR1310_PLL_CFG,
818e28f1aa1SVipul Kumar Samar 			SPEAR1310_RAS_SYNT2_3_CLK_SHIFT,
8190b928af1SViresh Kumar 			SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock);
820e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gen_syn2_3_clk", NULL);
8210b928af1SViresh Kumar 
822e28f1aa1SVipul Kumar Samar 	clk = clk_register_frac("gen_syn0_clk", "gen_syn0_1_clk", 0,
8230b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8240b928af1SViresh Kumar 			&_lock);
825e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gen_syn0_clk", NULL);
8260b928af1SViresh Kumar 
827e28f1aa1SVipul Kumar Samar 	clk = clk_register_frac("gen_syn1_clk", "gen_syn0_1_clk", 0,
8280b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8290b928af1SViresh Kumar 			&_lock);
830e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gen_syn1_clk", NULL);
8310b928af1SViresh Kumar 
832e28f1aa1SVipul Kumar Samar 	clk = clk_register_frac("gen_syn2_clk", "gen_syn2_3_clk", 0,
8330b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8340b928af1SViresh Kumar 			&_lock);
835e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gen_syn2_clk", NULL);
8360b928af1SViresh Kumar 
837e28f1aa1SVipul Kumar Samar 	clk = clk_register_frac("gen_syn3_clk", "gen_syn2_3_clk", 0,
8380b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8390b928af1SViresh Kumar 			&_lock);
840e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "gen_syn3_clk", NULL);
8410b928af1SViresh Kumar 
8420b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_osc_24m_clk", "osc_24m_clk", 0,
8430b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_24M_CLK_ENB, 0,
8440b928af1SViresh Kumar 			&_lock);
8450b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_osc_24m_clk", NULL);
8460b928af1SViresh Kumar 
8470b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_osc_25m_clk", "osc_25m_clk", 0,
8480b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_25M_CLK_ENB, 0,
8490b928af1SViresh Kumar 			&_lock);
8500b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_osc_25m_clk", NULL);
8510b928af1SViresh Kumar 
8520b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_osc_32k_clk", "osc_32k_clk", 0,
8530b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_32K_CLK_ENB, 0,
8540b928af1SViresh Kumar 			&_lock);
8550b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_osc_32k_clk", NULL);
8560b928af1SViresh Kumar 
8570b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_pll2_clk", "pll2_clk", 0,
8580b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_PLL2_CLK_ENB, 0,
8590b928af1SViresh Kumar 			&_lock);
8600b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_pll2_clk", NULL);
8610b928af1SViresh Kumar 
8620b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_pll3_clk", "pll3_clk", 0,
8630b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_PLL3_CLK_ENB, 0,
8640b928af1SViresh Kumar 			&_lock);
8650b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_pll3_clk", NULL);
8660b928af1SViresh Kumar 
867e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "ras_tx125_clk", "gmii_pad_clk", 0,
8680b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_C125M_PAD_CLK_ENB, 0,
8690b928af1SViresh Kumar 			&_lock);
8700b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_tx125_clk", NULL);
8710b928af1SViresh Kumar 
8720b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "ras_30m_fixed_clk", "pll5_clk", 0,
8730b928af1SViresh Kumar 			30000000);
8740b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_30m_clk", "ras_30m_fixed_clk", 0,
8750b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_C30M_CLK_ENB, 0,
8760b928af1SViresh Kumar 			&_lock);
8770b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_30m_clk", NULL);
8780b928af1SViresh Kumar 
8790b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "ras_48m_fixed_clk", "pll5_clk", 0,
8800b928af1SViresh Kumar 			48000000);
8810b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_48m_clk", "ras_48m_fixed_clk", 0,
8820b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_C48M_CLK_ENB, 0,
8830b928af1SViresh Kumar 			&_lock);
8840b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_48m_clk", NULL);
8850b928af1SViresh Kumar 
8860b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_ahb_clk", "ahb_clk", 0,
8870b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_ACLK_CLK_ENB, 0,
8880b928af1SViresh Kumar 			&_lock);
8890b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_ahb_clk", NULL);
8900b928af1SViresh Kumar 
8910b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_apb_clk", "apb_clk", 0,
8920b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_PCLK_CLK_ENB, 0,
8930b928af1SViresh Kumar 			&_lock);
8940b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_apb_clk", NULL);
8950b928af1SViresh Kumar 
896afb4bdc9SStephen Boyd 	clk = clk_register_fixed_rate(NULL, "ras_plclk0_clk", NULL, 0,
8970b928af1SViresh Kumar 			50000000);
8980b928af1SViresh Kumar 
899afb4bdc9SStephen Boyd 	clk = clk_register_fixed_rate(NULL, "ras_tx50_clk", NULL, 0, 50000000);
9000b928af1SViresh Kumar 
9010b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "can0_clk", "apb_clk", 0,
9020b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_CAN0_CLK_ENB, 0,
9030b928af1SViresh Kumar 			&_lock);
9040b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "c_can_platform.0");
9050b928af1SViresh Kumar 
9060b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "can1_clk", "apb_clk", 0,
9070b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_CAN1_CLK_ENB, 0,
9080b928af1SViresh Kumar 			&_lock);
9090b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "c_can_platform.1");
9100b928af1SViresh Kumar 
9110b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_smii0_clk", "ras_ahb_clk", 0,
9120b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII0_CLK_ENB, 0,
9130b928af1SViresh Kumar 			&_lock);
9140b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c400000.eth");
9150b928af1SViresh Kumar 
9160b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_smii1_clk", "ras_ahb_clk", 0,
9170b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII1_CLK_ENB, 0,
9180b928af1SViresh Kumar 			&_lock);
9190b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c500000.eth");
9200b928af1SViresh Kumar 
9210b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_smii2_clk", "ras_ahb_clk", 0,
9220b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII2_CLK_ENB, 0,
9230b928af1SViresh Kumar 			&_lock);
9240b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c600000.eth");
9250b928af1SViresh Kumar 
9260b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_rgmii_clk", "ras_ahb_clk", 0,
9270b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_GMII_CLK_ENB, 0,
9280b928af1SViresh Kumar 			&_lock);
9290b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c700000.eth");
9300b928af1SViresh Kumar 
931e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "smii_rgmii_phy_mclk",
9320b928af1SViresh Kumar 			smii_rgmii_phy_parents,
933819c1de3SJames Hogan 			ARRAY_SIZE(smii_rgmii_phy_parents),
934819c1de3SJames Hogan 			CLK_SET_RATE_NO_REPARENT, SPEAR1310_RAS_CTRL_REG1,
9350b928af1SViresh Kumar 			SPEAR1310_SMII_RGMII_PHY_CLK_SHIFT,
9360b928af1SViresh Kumar 			SPEAR1310_PHY_CLK_MASK, 0, &_lock);
937df2449abSRajeev Kumar 	clk_register_clkdev(clk, "stmmacphy.1", NULL);
938df2449abSRajeev Kumar 	clk_register_clkdev(clk, "stmmacphy.2", NULL);
939df2449abSRajeev Kumar 	clk_register_clkdev(clk, "stmmacphy.4", NULL);
9400b928af1SViresh Kumar 
941e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "rmii_phy_mclk", rmii_phy_parents,
942819c1de3SJames Hogan 			ARRAY_SIZE(rmii_phy_parents), CLK_SET_RATE_NO_REPARENT,
9430b928af1SViresh Kumar 			SPEAR1310_RAS_CTRL_REG1, SPEAR1310_RMII_PHY_CLK_SHIFT,
9440b928af1SViresh Kumar 			SPEAR1310_PHY_CLK_MASK, 0, &_lock);
945df2449abSRajeev Kumar 	clk_register_clkdev(clk, "stmmacphy.3", NULL);
9460b928af1SViresh Kumar 
947e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "uart1_mclk", uart_parents,
948819c1de3SJames Hogan 			ARRAY_SIZE(uart_parents), CLK_SET_RATE_NO_REPARENT,
949819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_UART1_CLK_SHIFT,
950819c1de3SJames Hogan 			SPEAR1310_RAS_UART_CLK_MASK, 0, &_lock);
951e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "uart1_mclk", NULL);
9520b928af1SViresh Kumar 
953e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "uart1_clk", "uart1_mclk", 0,
9540b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART1_CLK_ENB, 0,
9550b928af1SViresh Kumar 			&_lock);
9560b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c800000.serial");
9570b928af1SViresh Kumar 
958e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "uart2_mclk", uart_parents,
959819c1de3SJames Hogan 			ARRAY_SIZE(uart_parents), CLK_SET_RATE_NO_REPARENT,
960819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_UART2_CLK_SHIFT,
961819c1de3SJames Hogan 			SPEAR1310_RAS_UART_CLK_MASK, 0, &_lock);
962e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "uart2_mclk", NULL);
9630b928af1SViresh Kumar 
964e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "uart2_clk", "uart2_mclk", 0,
9650b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART2_CLK_ENB, 0,
9660b928af1SViresh Kumar 			&_lock);
9670b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c900000.serial");
9680b928af1SViresh Kumar 
969e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "uart3_mclk", uart_parents,
970819c1de3SJames Hogan 			ARRAY_SIZE(uart_parents), CLK_SET_RATE_NO_REPARENT,
971819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_UART3_CLK_SHIFT,
972819c1de3SJames Hogan 			SPEAR1310_RAS_UART_CLK_MASK, 0, &_lock);
973e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "uart3_mclk", NULL);
9740b928af1SViresh Kumar 
975e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "uart3_clk", "uart3_mclk", 0,
9760b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART3_CLK_ENB, 0,
9770b928af1SViresh Kumar 			&_lock);
9780b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5ca00000.serial");
9790b928af1SViresh Kumar 
980e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "uart4_mclk", uart_parents,
981819c1de3SJames Hogan 			ARRAY_SIZE(uart_parents), CLK_SET_RATE_NO_REPARENT,
982819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_UART4_CLK_SHIFT,
983819c1de3SJames Hogan 			SPEAR1310_RAS_UART_CLK_MASK, 0, &_lock);
984e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "uart4_mclk", NULL);
9850b928af1SViresh Kumar 
986e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "uart4_clk", "uart4_mclk", 0,
9870b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART4_CLK_ENB, 0,
9880b928af1SViresh Kumar 			&_lock);
9890b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5cb00000.serial");
9900b928af1SViresh Kumar 
991e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "uart5_mclk", uart_parents,
992819c1de3SJames Hogan 			ARRAY_SIZE(uart_parents), CLK_SET_RATE_NO_REPARENT,
993819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_UART5_CLK_SHIFT,
994819c1de3SJames Hogan 			SPEAR1310_RAS_UART_CLK_MASK, 0, &_lock);
995e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "uart5_mclk", NULL);
9960b928af1SViresh Kumar 
997e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "uart5_clk", "uart5_mclk", 0,
9980b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART5_CLK_ENB, 0,
9990b928af1SViresh Kumar 			&_lock);
10000b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5cc00000.serial");
10010b928af1SViresh Kumar 
1002e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "i2c1_mclk", i2c_parents,
1003819c1de3SJames Hogan 			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
1004819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C1_CLK_SHIFT,
1005819c1de3SJames Hogan 			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
1006e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "i2c1_mclk", NULL);
10070b928af1SViresh Kumar 
1008e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "i2c1_clk", "i2c1_mclk", 0,
10090b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C1_CLK_ENB, 0,
10100b928af1SViresh Kumar 			&_lock);
10110b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5cd00000.i2c");
10120b928af1SViresh Kumar 
1013e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "i2c2_mclk", i2c_parents,
1014819c1de3SJames Hogan 			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
1015819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C2_CLK_SHIFT,
1016819c1de3SJames Hogan 			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
1017e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "i2c2_mclk", NULL);
10180b928af1SViresh Kumar 
1019e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "i2c2_clk", "i2c2_mclk", 0,
10200b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C2_CLK_ENB, 0,
10210b928af1SViresh Kumar 			&_lock);
10220b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5ce00000.i2c");
10230b928af1SViresh Kumar 
1024e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "i2c3_mclk", i2c_parents,
1025819c1de3SJames Hogan 			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
1026819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C3_CLK_SHIFT,
1027819c1de3SJames Hogan 			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
1028e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "i2c3_mclk", NULL);
10290b928af1SViresh Kumar 
1030e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "i2c3_clk", "i2c3_mclk", 0,
10310b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C3_CLK_ENB, 0,
10320b928af1SViresh Kumar 			&_lock);
10330b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5cf00000.i2c");
10340b928af1SViresh Kumar 
1035e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "i2c4_mclk", i2c_parents,
1036819c1de3SJames Hogan 			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
1037819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C4_CLK_SHIFT,
1038819c1de3SJames Hogan 			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
1039e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "i2c4_mclk", NULL);
10400b928af1SViresh Kumar 
1041e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "i2c4_clk", "i2c4_mclk", 0,
10420b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C4_CLK_ENB, 0,
10430b928af1SViresh Kumar 			&_lock);
10440b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5d000000.i2c");
10450b928af1SViresh Kumar 
1046e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "i2c5_mclk", i2c_parents,
1047819c1de3SJames Hogan 			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
1048819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C5_CLK_SHIFT,
1049819c1de3SJames Hogan 			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
1050e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "i2c5_mclk", NULL);
10510b928af1SViresh Kumar 
1052e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "i2c5_clk", "i2c5_mclk", 0,
10530b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C5_CLK_ENB, 0,
10540b928af1SViresh Kumar 			&_lock);
10550b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5d100000.i2c");
10560b928af1SViresh Kumar 
1057e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "i2c6_mclk", i2c_parents,
1058819c1de3SJames Hogan 			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
1059819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C6_CLK_SHIFT,
1060819c1de3SJames Hogan 			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
1061e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "i2c6_mclk", NULL);
10620b928af1SViresh Kumar 
1063e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "i2c6_clk", "i2c6_mclk", 0,
10640b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C6_CLK_ENB, 0,
10650b928af1SViresh Kumar 			&_lock);
10660b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5d200000.i2c");
10670b928af1SViresh Kumar 
1068e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "i2c7_mclk", i2c_parents,
1069819c1de3SJames Hogan 			ARRAY_SIZE(i2c_parents), CLK_SET_RATE_NO_REPARENT,
1070819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_I2C7_CLK_SHIFT,
1071819c1de3SJames Hogan 			SPEAR1310_I2C_CLK_MASK, 0, &_lock);
1072e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "i2c7_mclk", NULL);
10730b928af1SViresh Kumar 
1074e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "i2c7_clk", "i2c7_mclk", 0,
10750b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C7_CLK_ENB, 0,
10760b928af1SViresh Kumar 			&_lock);
10770b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5d300000.i2c");
10780b928af1SViresh Kumar 
1079e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "ssp1_mclk", ssp1_parents,
1080819c1de3SJames Hogan 			ARRAY_SIZE(ssp1_parents), CLK_SET_RATE_NO_REPARENT,
1081819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_SSP1_CLK_SHIFT,
1082819c1de3SJames Hogan 			SPEAR1310_SSP1_CLK_MASK, 0, &_lock);
1083e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "ssp1_mclk", NULL);
10840b928af1SViresh Kumar 
1085e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "ssp1_clk", "ssp1_mclk", 0,
10860b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_SSP1_CLK_ENB, 0,
10870b928af1SViresh Kumar 			&_lock);
10880b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5d400000.spi");
10890b928af1SViresh Kumar 
1090e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "pci_mclk", pci_parents,
1091819c1de3SJames Hogan 			ARRAY_SIZE(pci_parents), CLK_SET_RATE_NO_REPARENT,
1092819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_PCI_CLK_SHIFT,
1093819c1de3SJames Hogan 			SPEAR1310_PCI_CLK_MASK, 0, &_lock);
1094e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "pci_mclk", NULL);
10950b928af1SViresh Kumar 
1096e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "pci_clk", "pci_mclk", 0,
10970b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_PCI_CLK_ENB, 0,
10980b928af1SViresh Kumar 			&_lock);
10990b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "pci");
11000b928af1SViresh Kumar 
1101e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "tdm1_mclk", tdm_parents,
1102819c1de3SJames Hogan 			ARRAY_SIZE(tdm_parents), CLK_SET_RATE_NO_REPARENT,
1103819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_TDM1_CLK_SHIFT,
1104819c1de3SJames Hogan 			SPEAR1310_TDM_CLK_MASK, 0, &_lock);
1105e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "tdm1_mclk", NULL);
11060b928af1SViresh Kumar 
1107e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "tdm1_clk", "tdm1_mclk", 0,
11080b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM1_CLK_ENB, 0,
11090b928af1SViresh Kumar 			&_lock);
11100b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "tdm_hdlc.0");
11110b928af1SViresh Kumar 
1112e28f1aa1SVipul Kumar Samar 	clk = clk_register_mux(NULL, "tdm2_mclk", tdm_parents,
1113819c1de3SJames Hogan 			ARRAY_SIZE(tdm_parents), CLK_SET_RATE_NO_REPARENT,
1114819c1de3SJames Hogan 			SPEAR1310_RAS_CTRL_REG0, SPEAR1310_TDM2_CLK_SHIFT,
1115819c1de3SJames Hogan 			SPEAR1310_TDM_CLK_MASK, 0, &_lock);
1116e28f1aa1SVipul Kumar Samar 	clk_register_clkdev(clk, "tdm2_mclk", NULL);
11170b928af1SViresh Kumar 
1118e28f1aa1SVipul Kumar Samar 	clk = clk_register_gate(NULL, "tdm2_clk", "tdm2_mclk", 0,
11190b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM2_CLK_ENB, 0,
11200b928af1SViresh Kumar 			&_lock);
11210b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "tdm_hdlc.1");
11220b928af1SViresh Kumar }
1123