xref: /linux/drivers/clk/spear/spear1310_clock.c (revision 10d8935f46e5028847b179757ecbf9238b13d129)
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
7*10d8935fSViresh Kumar  * Viresh Kumar <viresh.linux@gmail.com>
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/clk.h>
150b928af1SViresh Kumar #include <linux/clkdev.h>
160b928af1SViresh Kumar #include <linux/err.h>
170b928af1SViresh Kumar #include <linux/io.h>
180b928af1SViresh Kumar #include <linux/of_platform.h>
190b928af1SViresh Kumar #include <linux/spinlock_types.h>
200b928af1SViresh Kumar #include <mach/spear.h>
210b928af1SViresh Kumar #include "clk.h"
220b928af1SViresh Kumar 
230b928af1SViresh Kumar /* PLL related registers and bit values */
240b928af1SViresh Kumar #define SPEAR1310_PLL_CFG			(VA_MISC_BASE + 0x210)
250b928af1SViresh Kumar 	/* PLL_CFG bit values */
260b928af1SViresh Kumar 	#define SPEAR1310_CLCD_SYNT_CLK_MASK		1
270b928af1SViresh Kumar 	#define SPEAR1310_CLCD_SYNT_CLK_SHIFT		31
280b928af1SViresh Kumar 	#define SPEAR1310_RAS_SYNT2_3_CLK_MASK		2
290b928af1SViresh Kumar 	#define SPEAR1310_RAS_SYNT2_3_CLK_SHIFT		29
300b928af1SViresh Kumar 	#define SPEAR1310_RAS_SYNT_CLK_MASK		2
310b928af1SViresh Kumar 	#define SPEAR1310_RAS_SYNT0_1_CLK_SHIFT		27
320b928af1SViresh Kumar 	#define SPEAR1310_PLL_CLK_MASK			2
330b928af1SViresh Kumar 	#define SPEAR1310_PLL3_CLK_SHIFT		24
340b928af1SViresh Kumar 	#define SPEAR1310_PLL2_CLK_SHIFT		22
350b928af1SViresh Kumar 	#define SPEAR1310_PLL1_CLK_SHIFT		20
360b928af1SViresh Kumar 
370b928af1SViresh Kumar #define SPEAR1310_PLL1_CTR			(VA_MISC_BASE + 0x214)
380b928af1SViresh Kumar #define SPEAR1310_PLL1_FRQ			(VA_MISC_BASE + 0x218)
390b928af1SViresh Kumar #define SPEAR1310_PLL2_CTR			(VA_MISC_BASE + 0x220)
400b928af1SViresh Kumar #define SPEAR1310_PLL2_FRQ			(VA_MISC_BASE + 0x224)
410b928af1SViresh Kumar #define SPEAR1310_PLL3_CTR			(VA_MISC_BASE + 0x22C)
420b928af1SViresh Kumar #define SPEAR1310_PLL3_FRQ			(VA_MISC_BASE + 0x230)
430b928af1SViresh Kumar #define SPEAR1310_PLL4_CTR			(VA_MISC_BASE + 0x238)
440b928af1SViresh Kumar #define SPEAR1310_PLL4_FRQ			(VA_MISC_BASE + 0x23C)
450b928af1SViresh Kumar #define SPEAR1310_PERIP_CLK_CFG			(VA_MISC_BASE + 0x244)
460b928af1SViresh Kumar 	/* PERIP_CLK_CFG bit values */
470b928af1SViresh Kumar 	#define SPEAR1310_GPT_OSC24_VAL			0
480b928af1SViresh Kumar 	#define SPEAR1310_GPT_APB_VAL			1
490b928af1SViresh Kumar 	#define SPEAR1310_GPT_CLK_MASK			1
500b928af1SViresh Kumar 	#define SPEAR1310_GPT3_CLK_SHIFT		11
510b928af1SViresh Kumar 	#define SPEAR1310_GPT2_CLK_SHIFT		10
520b928af1SViresh Kumar 	#define SPEAR1310_GPT1_CLK_SHIFT		9
530b928af1SViresh Kumar 	#define SPEAR1310_GPT0_CLK_SHIFT		8
540b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_PLL5_VAL		0
550b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_OSC24_VAL		1
560b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_SYNT_VAL		2
570b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_MASK			2
580b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_SHIFT		4
590b928af1SViresh Kumar 
600b928af1SViresh Kumar 	#define SPEAR1310_AUX_CLK_PLL5_VAL		0
610b928af1SViresh Kumar 	#define SPEAR1310_AUX_CLK_SYNT_VAL		1
620b928af1SViresh Kumar 	#define SPEAR1310_CLCD_CLK_MASK			2
630b928af1SViresh Kumar 	#define SPEAR1310_CLCD_CLK_SHIFT		2
640b928af1SViresh Kumar 	#define SPEAR1310_C3_CLK_MASK			1
650b928af1SViresh Kumar 	#define SPEAR1310_C3_CLK_SHIFT			1
660b928af1SViresh Kumar 
670b928af1SViresh Kumar #define SPEAR1310_GMAC_CLK_CFG			(VA_MISC_BASE + 0x248)
680b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_IF_SEL_MASK		3
690b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_IF_SEL_SHIFT		4
700b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_CLK_MASK		1
710b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_CLK_SHIFT		3
720b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_INPUT_CLK_MASK	2
730b928af1SViresh Kumar 	#define SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT	1
740b928af1SViresh Kumar 
750b928af1SViresh Kumar #define SPEAR1310_I2S_CLK_CFG			(VA_MISC_BASE + 0x24C)
760b928af1SViresh Kumar 	/* I2S_CLK_CFG register mask */
770b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_X_MASK		0x1F
780b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_X_SHIFT		27
790b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_Y_MASK		0x1F
800b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_Y_SHIFT		22
810b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_EQ_SEL_SHIFT		21
820b928af1SViresh Kumar 	#define SPEAR1310_I2S_SCLK_SYNTH_ENB		20
830b928af1SViresh Kumar 	#define SPEAR1310_I2S_PRS1_CLK_X_MASK		0xFF
840b928af1SViresh Kumar 	#define SPEAR1310_I2S_PRS1_CLK_X_SHIFT		12
850b928af1SViresh Kumar 	#define SPEAR1310_I2S_PRS1_CLK_Y_MASK		0xFF
860b928af1SViresh Kumar 	#define SPEAR1310_I2S_PRS1_CLK_Y_SHIFT		4
870b928af1SViresh Kumar 	#define SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT		3
880b928af1SViresh Kumar 	#define SPEAR1310_I2S_REF_SEL_MASK		1
890b928af1SViresh Kumar 	#define SPEAR1310_I2S_REF_SHIFT			2
900b928af1SViresh Kumar 	#define SPEAR1310_I2S_SRC_CLK_MASK		2
910b928af1SViresh Kumar 	#define SPEAR1310_I2S_SRC_CLK_SHIFT		0
920b928af1SViresh Kumar 
930b928af1SViresh Kumar #define SPEAR1310_C3_CLK_SYNT			(VA_MISC_BASE + 0x250)
940b928af1SViresh Kumar #define SPEAR1310_UART_CLK_SYNT			(VA_MISC_BASE + 0x254)
950b928af1SViresh Kumar #define SPEAR1310_GMAC_CLK_SYNT			(VA_MISC_BASE + 0x258)
960b928af1SViresh Kumar #define SPEAR1310_SDHCI_CLK_SYNT		(VA_MISC_BASE + 0x25C)
970b928af1SViresh Kumar #define SPEAR1310_CFXD_CLK_SYNT			(VA_MISC_BASE + 0x260)
980b928af1SViresh Kumar #define SPEAR1310_ADC_CLK_SYNT			(VA_MISC_BASE + 0x264)
990b928af1SViresh Kumar #define SPEAR1310_AMBA_CLK_SYNT			(VA_MISC_BASE + 0x268)
1000b928af1SViresh Kumar #define SPEAR1310_CLCD_CLK_SYNT			(VA_MISC_BASE + 0x270)
1010b928af1SViresh Kumar #define SPEAR1310_RAS_CLK_SYNT0			(VA_MISC_BASE + 0x280)
1020b928af1SViresh Kumar #define SPEAR1310_RAS_CLK_SYNT1			(VA_MISC_BASE + 0x288)
1030b928af1SViresh Kumar #define SPEAR1310_RAS_CLK_SYNT2			(VA_MISC_BASE + 0x290)
1040b928af1SViresh Kumar #define SPEAR1310_RAS_CLK_SYNT3			(VA_MISC_BASE + 0x298)
1050b928af1SViresh Kumar 	/* Check Fractional synthesizer reg masks */
1060b928af1SViresh Kumar 
1070b928af1SViresh Kumar #define SPEAR1310_PERIP1_CLK_ENB		(VA_MISC_BASE + 0x300)
1080b928af1SViresh Kumar 	/* PERIP1_CLK_ENB register masks */
1090b928af1SViresh Kumar 	#define SPEAR1310_RTC_CLK_ENB			31
1100b928af1SViresh Kumar 	#define SPEAR1310_ADC_CLK_ENB			30
1110b928af1SViresh Kumar 	#define SPEAR1310_C3_CLK_ENB			29
1120b928af1SViresh Kumar 	#define SPEAR1310_JPEG_CLK_ENB			28
1130b928af1SViresh Kumar 	#define SPEAR1310_CLCD_CLK_ENB			27
1140b928af1SViresh Kumar 	#define SPEAR1310_DMA_CLK_ENB			25
1150b928af1SViresh Kumar 	#define SPEAR1310_GPIO1_CLK_ENB			24
1160b928af1SViresh Kumar 	#define SPEAR1310_GPIO0_CLK_ENB			23
1170b928af1SViresh Kumar 	#define SPEAR1310_GPT1_CLK_ENB			22
1180b928af1SViresh Kumar 	#define SPEAR1310_GPT0_CLK_ENB			21
1190b928af1SViresh Kumar 	#define SPEAR1310_I2S0_CLK_ENB			20
1200b928af1SViresh Kumar 	#define SPEAR1310_I2S1_CLK_ENB			19
1210b928af1SViresh Kumar 	#define SPEAR1310_I2C0_CLK_ENB			18
1220b928af1SViresh Kumar 	#define SPEAR1310_SSP_CLK_ENB			17
1230b928af1SViresh Kumar 	#define SPEAR1310_UART_CLK_ENB			15
1240b928af1SViresh Kumar 	#define SPEAR1310_PCIE_SATA_2_CLK_ENB		14
1250b928af1SViresh Kumar 	#define SPEAR1310_PCIE_SATA_1_CLK_ENB		13
1260b928af1SViresh Kumar 	#define SPEAR1310_PCIE_SATA_0_CLK_ENB		12
1270b928af1SViresh Kumar 	#define SPEAR1310_UOC_CLK_ENB			11
1280b928af1SViresh Kumar 	#define SPEAR1310_UHC1_CLK_ENB			10
1290b928af1SViresh Kumar 	#define SPEAR1310_UHC0_CLK_ENB			9
1300b928af1SViresh Kumar 	#define SPEAR1310_GMAC_CLK_ENB			8
1310b928af1SViresh Kumar 	#define SPEAR1310_CFXD_CLK_ENB			7
1320b928af1SViresh Kumar 	#define SPEAR1310_SDHCI_CLK_ENB			6
1330b928af1SViresh Kumar 	#define SPEAR1310_SMI_CLK_ENB			5
1340b928af1SViresh Kumar 	#define SPEAR1310_FSMC_CLK_ENB			4
1350b928af1SViresh Kumar 	#define SPEAR1310_SYSRAM0_CLK_ENB		3
1360b928af1SViresh Kumar 	#define SPEAR1310_SYSRAM1_CLK_ENB		2
1370b928af1SViresh Kumar 	#define SPEAR1310_SYSROM_CLK_ENB		1
1380b928af1SViresh Kumar 	#define SPEAR1310_BUS_CLK_ENB			0
1390b928af1SViresh Kumar 
1400b928af1SViresh Kumar #define SPEAR1310_PERIP2_CLK_ENB		(VA_MISC_BASE + 0x304)
1410b928af1SViresh Kumar 	/* PERIP2_CLK_ENB register masks */
1420b928af1SViresh Kumar 	#define SPEAR1310_THSENS_CLK_ENB		8
1430b928af1SViresh Kumar 	#define SPEAR1310_I2S_REF_PAD_CLK_ENB		7
1440b928af1SViresh Kumar 	#define SPEAR1310_ACP_CLK_ENB			6
1450b928af1SViresh Kumar 	#define SPEAR1310_GPT3_CLK_ENB			5
1460b928af1SViresh Kumar 	#define SPEAR1310_GPT2_CLK_ENB			4
1470b928af1SViresh Kumar 	#define SPEAR1310_KBD_CLK_ENB			3
1480b928af1SViresh Kumar 	#define SPEAR1310_CPU_DBG_CLK_ENB		2
1490b928af1SViresh Kumar 	#define SPEAR1310_DDR_CORE_CLK_ENB		1
1500b928af1SViresh Kumar 	#define SPEAR1310_DDR_CTRL_CLK_ENB		0
1510b928af1SViresh Kumar 
1520b928af1SViresh Kumar #define SPEAR1310_RAS_CLK_ENB			(VA_MISC_BASE + 0x310)
1530b928af1SViresh Kumar 	/* RAS_CLK_ENB register masks */
1540b928af1SViresh Kumar 	#define SPEAR1310_SYNT3_CLK_ENB			17
1550b928af1SViresh Kumar 	#define SPEAR1310_SYNT2_CLK_ENB			16
1560b928af1SViresh Kumar 	#define SPEAR1310_SYNT1_CLK_ENB			15
1570b928af1SViresh Kumar 	#define SPEAR1310_SYNT0_CLK_ENB			14
1580b928af1SViresh Kumar 	#define SPEAR1310_PCLK3_CLK_ENB			13
1590b928af1SViresh Kumar 	#define SPEAR1310_PCLK2_CLK_ENB			12
1600b928af1SViresh Kumar 	#define SPEAR1310_PCLK1_CLK_ENB			11
1610b928af1SViresh Kumar 	#define SPEAR1310_PCLK0_CLK_ENB			10
1620b928af1SViresh Kumar 	#define SPEAR1310_PLL3_CLK_ENB			9
1630b928af1SViresh Kumar 	#define SPEAR1310_PLL2_CLK_ENB			8
1640b928af1SViresh Kumar 	#define SPEAR1310_C125M_PAD_CLK_ENB		7
1650b928af1SViresh Kumar 	#define SPEAR1310_C30M_CLK_ENB			6
1660b928af1SViresh Kumar 	#define SPEAR1310_C48M_CLK_ENB			5
1670b928af1SViresh Kumar 	#define SPEAR1310_OSC_25M_CLK_ENB		4
1680b928af1SViresh Kumar 	#define SPEAR1310_OSC_32K_CLK_ENB		3
1690b928af1SViresh Kumar 	#define SPEAR1310_OSC_24M_CLK_ENB		2
1700b928af1SViresh Kumar 	#define SPEAR1310_PCLK_CLK_ENB			1
1710b928af1SViresh Kumar 	#define SPEAR1310_ACLK_CLK_ENB			0
1720b928af1SViresh Kumar 
1730b928af1SViresh Kumar /* RAS Area Control Register */
1740b928af1SViresh Kumar #define SPEAR1310_RAS_CTRL_REG0			(VA_SPEAR1310_RAS_BASE + 0x000)
1750b928af1SViresh Kumar 	#define SPEAR1310_SSP1_CLK_MASK			3
1760b928af1SViresh Kumar 	#define SPEAR1310_SSP1_CLK_SHIFT		26
1770b928af1SViresh Kumar 	#define SPEAR1310_TDM_CLK_MASK			1
1780b928af1SViresh Kumar 	#define SPEAR1310_TDM2_CLK_SHIFT		24
1790b928af1SViresh Kumar 	#define SPEAR1310_TDM1_CLK_SHIFT		23
1800b928af1SViresh Kumar 	#define SPEAR1310_I2C_CLK_MASK			1
1810b928af1SViresh Kumar 	#define SPEAR1310_I2C7_CLK_SHIFT		22
1820b928af1SViresh Kumar 	#define SPEAR1310_I2C6_CLK_SHIFT		21
1830b928af1SViresh Kumar 	#define SPEAR1310_I2C5_CLK_SHIFT		20
1840b928af1SViresh Kumar 	#define SPEAR1310_I2C4_CLK_SHIFT		19
1850b928af1SViresh Kumar 	#define SPEAR1310_I2C3_CLK_SHIFT		18
1860b928af1SViresh Kumar 	#define SPEAR1310_I2C2_CLK_SHIFT		17
1870b928af1SViresh Kumar 	#define SPEAR1310_I2C1_CLK_SHIFT		16
1880b928af1SViresh Kumar 	#define SPEAR1310_GPT64_CLK_MASK		1
1890b928af1SViresh Kumar 	#define SPEAR1310_GPT64_CLK_SHIFT		15
1900b928af1SViresh Kumar 	#define SPEAR1310_RAS_UART_CLK_MASK		1
1910b928af1SViresh Kumar 	#define SPEAR1310_UART5_CLK_SHIFT		14
1920b928af1SViresh Kumar 	#define SPEAR1310_UART4_CLK_SHIFT		13
1930b928af1SViresh Kumar 	#define SPEAR1310_UART3_CLK_SHIFT		12
1940b928af1SViresh Kumar 	#define SPEAR1310_UART2_CLK_SHIFT		11
1950b928af1SViresh Kumar 	#define SPEAR1310_UART1_CLK_SHIFT		10
1960b928af1SViresh Kumar 	#define SPEAR1310_PCI_CLK_MASK			1
1970b928af1SViresh Kumar 	#define SPEAR1310_PCI_CLK_SHIFT			0
1980b928af1SViresh Kumar 
1990b928af1SViresh Kumar #define SPEAR1310_RAS_CTRL_REG1			(VA_SPEAR1310_RAS_BASE + 0x004)
2000b928af1SViresh Kumar 	#define SPEAR1310_PHY_CLK_MASK			0x3
2010b928af1SViresh Kumar 	#define SPEAR1310_RMII_PHY_CLK_SHIFT		0
2020b928af1SViresh Kumar 	#define SPEAR1310_SMII_RGMII_PHY_CLK_SHIFT	2
2030b928af1SViresh Kumar 
2040b928af1SViresh Kumar #define SPEAR1310_RAS_SW_CLK_CTRL		(VA_SPEAR1310_RAS_BASE + 0x0148)
2050b928af1SViresh Kumar 	#define SPEAR1310_CAN1_CLK_ENB			25
2060b928af1SViresh Kumar 	#define SPEAR1310_CAN0_CLK_ENB			24
2070b928af1SViresh Kumar 	#define SPEAR1310_GPT64_CLK_ENB			23
2080b928af1SViresh Kumar 	#define SPEAR1310_SSP1_CLK_ENB			22
2090b928af1SViresh Kumar 	#define SPEAR1310_I2C7_CLK_ENB			21
2100b928af1SViresh Kumar 	#define SPEAR1310_I2C6_CLK_ENB			20
2110b928af1SViresh Kumar 	#define SPEAR1310_I2C5_CLK_ENB			19
2120b928af1SViresh Kumar 	#define SPEAR1310_I2C4_CLK_ENB			18
2130b928af1SViresh Kumar 	#define SPEAR1310_I2C3_CLK_ENB			17
2140b928af1SViresh Kumar 	#define SPEAR1310_I2C2_CLK_ENB			16
2150b928af1SViresh Kumar 	#define SPEAR1310_I2C1_CLK_ENB			15
2160b928af1SViresh Kumar 	#define SPEAR1310_UART5_CLK_ENB			14
2170b928af1SViresh Kumar 	#define SPEAR1310_UART4_CLK_ENB			13
2180b928af1SViresh Kumar 	#define SPEAR1310_UART3_CLK_ENB			12
2190b928af1SViresh Kumar 	#define SPEAR1310_UART2_CLK_ENB			11
2200b928af1SViresh Kumar 	#define SPEAR1310_UART1_CLK_ENB			10
2210b928af1SViresh Kumar 	#define SPEAR1310_RS485_1_CLK_ENB		9
2220b928af1SViresh Kumar 	#define SPEAR1310_RS485_0_CLK_ENB		8
2230b928af1SViresh Kumar 	#define SPEAR1310_TDM2_CLK_ENB			7
2240b928af1SViresh Kumar 	#define SPEAR1310_TDM1_CLK_ENB			6
2250b928af1SViresh Kumar 	#define SPEAR1310_PCI_CLK_ENB			5
2260b928af1SViresh Kumar 	#define SPEAR1310_GMII_CLK_ENB			4
2270b928af1SViresh Kumar 	#define SPEAR1310_MII2_CLK_ENB			3
2280b928af1SViresh Kumar 	#define SPEAR1310_MII1_CLK_ENB			2
2290b928af1SViresh Kumar 	#define SPEAR1310_MII0_CLK_ENB			1
2300b928af1SViresh Kumar 	#define SPEAR1310_ESRAM_CLK_ENB			0
2310b928af1SViresh Kumar 
2320b928af1SViresh Kumar static DEFINE_SPINLOCK(_lock);
2330b928af1SViresh Kumar 
2340b928af1SViresh Kumar /* pll rate configuration table, in ascending order of rates */
2350b928af1SViresh Kumar static struct pll_rate_tbl pll_rtbl[] = {
2360b928af1SViresh Kumar 	/* PCLK 24MHz */
2370b928af1SViresh Kumar 	{.mode = 0, .m = 0x83, .n = 0x04, .p = 0x5}, /* vco 1572, pll 49.125 MHz */
2380b928af1SViresh Kumar 	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x3}, /* vco 1000, pll 125 MHz */
2390b928af1SViresh Kumar 	{.mode = 0, .m = 0x64, .n = 0x06, .p = 0x1}, /* vco 800, pll 400 MHz */
2400b928af1SViresh Kumar 	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x1}, /* vco 1000, pll 500 MHz */
2410b928af1SViresh Kumar 	{.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x1}, /* vco 1328, pll 664 MHz */
2420b928af1SViresh Kumar 	{.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x1}, /* vco 1600, pll 800 MHz */
2430b928af1SViresh Kumar 	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
2440b928af1SViresh Kumar };
2450b928af1SViresh Kumar 
2460b928af1SViresh Kumar /* vco-pll4 rate configuration table, in ascending order of rates */
2470b928af1SViresh Kumar static struct pll_rate_tbl pll4_rtbl[] = {
2480b928af1SViresh Kumar 	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x2}, /* vco 1000, pll 250 MHz */
2490b928af1SViresh Kumar 	{.mode = 0, .m = 0xA6, .n = 0x06, .p = 0x2}, /* vco 1328, pll 332 MHz */
2500b928af1SViresh Kumar 	{.mode = 0, .m = 0xC8, .n = 0x06, .p = 0x2}, /* vco 1600, pll 400 MHz */
2510b928af1SViresh Kumar 	{.mode = 0, .m = 0x7D, .n = 0x06, .p = 0x0}, /* vco 1, pll 1 GHz */
2520b928af1SViresh Kumar };
2530b928af1SViresh Kumar 
2540b928af1SViresh Kumar /* aux rate configuration table, in ascending order of rates */
2550b928af1SViresh Kumar static struct aux_rate_tbl aux_rtbl[] = {
2560b928af1SViresh Kumar 	/* For VCO1div2 = 500 MHz */
2570b928af1SViresh Kumar 	{.xscale = 10, .yscale = 204, .eq = 0}, /* 12.29 MHz */
2580b928af1SViresh Kumar 	{.xscale = 4, .yscale = 21, .eq = 0}, /* 48 MHz */
2590b928af1SViresh Kumar 	{.xscale = 2, .yscale = 6, .eq = 0}, /* 83 MHz */
2600b928af1SViresh Kumar 	{.xscale = 2, .yscale = 4, .eq = 0}, /* 125 MHz */
2610b928af1SViresh Kumar 	{.xscale = 1, .yscale = 3, .eq = 1}, /* 166 MHz */
2620b928af1SViresh Kumar 	{.xscale = 1, .yscale = 2, .eq = 1}, /* 250 MHz */
2630b928af1SViresh Kumar };
2640b928af1SViresh Kumar 
2650b928af1SViresh Kumar /* gmac rate configuration table, in ascending order of rates */
2660b928af1SViresh Kumar static struct aux_rate_tbl gmac_rtbl[] = {
2670b928af1SViresh Kumar 	/* For gmac phy input clk */
2680b928af1SViresh Kumar 	{.xscale = 2, .yscale = 6, .eq = 0}, /* divided by 6 */
2690b928af1SViresh Kumar 	{.xscale = 2, .yscale = 4, .eq = 0}, /* divided by 4 */
2700b928af1SViresh Kumar 	{.xscale = 1, .yscale = 3, .eq = 1}, /* divided by 3 */
2710b928af1SViresh Kumar 	{.xscale = 1, .yscale = 2, .eq = 1}, /* divided by 2 */
2720b928af1SViresh Kumar };
2730b928af1SViresh Kumar 
2740b928af1SViresh Kumar /* clcd rate configuration table, in ascending order of rates */
2750b928af1SViresh Kumar static struct frac_rate_tbl clcd_rtbl[] = {
2760b928af1SViresh Kumar 	{.div = 0x14000}, /* 25 Mhz , for vc01div4 = 250 MHz*/
2770b928af1SViresh Kumar 	{.div = 0x1284B}, /* 27 Mhz , for vc01div4 = 250 MHz*/
2780b928af1SViresh Kumar 	{.div = 0x0D8D3}, /* 58 Mhz , for vco1div4 = 393 MHz */
2790b928af1SViresh Kumar 	{.div = 0x0B72C}, /* 58 Mhz , for vco1div4 = 332 MHz */
2800b928af1SViresh Kumar 	{.div = 0x089EE}, /* 58 Mhz , for vc01div4 = 250 MHz*/
2810b928af1SViresh Kumar 	{.div = 0x06f1C}, /* 72 Mhz , for vc01div4 = 250 MHz*/
2820b928af1SViresh Kumar 	{.div = 0x06E58}, /* 58 Mhz , for vco1div4 = 200 MHz */
2830b928af1SViresh Kumar 	{.div = 0x06c1B}, /* 74 Mhz , for vc01div4 = 250 MHz*/
2840b928af1SViresh Kumar 	{.div = 0x04A12}, /* 108 Mhz , for vc01div4 = 250 MHz*/
2850b928af1SViresh Kumar 	{.div = 0x0378E}, /* 144 Mhz , for vc01div4 = 250 MHz*/
2860b928af1SViresh Kumar };
2870b928af1SViresh Kumar 
2880b928af1SViresh Kumar /* i2s prescaler1 masks */
2890b928af1SViresh Kumar static struct aux_clk_masks i2s_prs1_masks = {
2900b928af1SViresh Kumar 	.eq_sel_mask = AUX_EQ_SEL_MASK,
2910b928af1SViresh Kumar 	.eq_sel_shift = SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT,
2920b928af1SViresh Kumar 	.eq1_mask = AUX_EQ1_SEL,
2930b928af1SViresh Kumar 	.eq2_mask = AUX_EQ2_SEL,
2940b928af1SViresh Kumar 	.xscale_sel_mask = SPEAR1310_I2S_PRS1_CLK_X_MASK,
2950b928af1SViresh Kumar 	.xscale_sel_shift = SPEAR1310_I2S_PRS1_CLK_X_SHIFT,
2960b928af1SViresh Kumar 	.yscale_sel_mask = SPEAR1310_I2S_PRS1_CLK_Y_MASK,
2970b928af1SViresh Kumar 	.yscale_sel_shift = SPEAR1310_I2S_PRS1_CLK_Y_SHIFT,
2980b928af1SViresh Kumar };
2990b928af1SViresh Kumar 
3000b928af1SViresh Kumar /* i2s sclk (bit clock) syynthesizers masks */
3010b928af1SViresh Kumar static struct aux_clk_masks i2s_sclk_masks = {
3020b928af1SViresh Kumar 	.eq_sel_mask = AUX_EQ_SEL_MASK,
3030b928af1SViresh Kumar 	.eq_sel_shift = SPEAR1310_I2S_SCLK_EQ_SEL_SHIFT,
3040b928af1SViresh Kumar 	.eq1_mask = AUX_EQ1_SEL,
3050b928af1SViresh Kumar 	.eq2_mask = AUX_EQ2_SEL,
3060b928af1SViresh Kumar 	.xscale_sel_mask = SPEAR1310_I2S_SCLK_X_MASK,
3070b928af1SViresh Kumar 	.xscale_sel_shift = SPEAR1310_I2S_SCLK_X_SHIFT,
3080b928af1SViresh Kumar 	.yscale_sel_mask = SPEAR1310_I2S_SCLK_Y_MASK,
3090b928af1SViresh Kumar 	.yscale_sel_shift = SPEAR1310_I2S_SCLK_Y_SHIFT,
3100b928af1SViresh Kumar 	.enable_bit = SPEAR1310_I2S_SCLK_SYNTH_ENB,
3110b928af1SViresh Kumar };
3120b928af1SViresh Kumar 
3130b928af1SViresh Kumar /* i2s prs1 aux rate configuration table, in ascending order of rates */
3140b928af1SViresh Kumar static struct aux_rate_tbl i2s_prs1_rtbl[] = {
3150b928af1SViresh Kumar 	/* For parent clk = 49.152 MHz */
3160b928af1SViresh Kumar 	{.xscale = 1, .yscale = 2, .eq = 0}, /* 12.288 MHz */
3170b928af1SViresh Kumar };
3180b928af1SViresh Kumar 
3190b928af1SViresh Kumar /* i2s sclk aux rate configuration table, in ascending order of rates */
3200b928af1SViresh Kumar static struct aux_rate_tbl i2s_sclk_rtbl[] = {
3210b928af1SViresh Kumar 	/* For i2s_ref_clk = 12.288MHz */
3220b928af1SViresh Kumar 	{.xscale = 1, .yscale = 4, .eq = 0}, /* 1.53 MHz */
3230b928af1SViresh Kumar 	{.xscale = 1, .yscale = 2, .eq = 0}, /* 3.07 Mhz */
3240b928af1SViresh Kumar };
3250b928af1SViresh Kumar 
3260b928af1SViresh Kumar /* adc rate configuration table, in ascending order of rates */
3270b928af1SViresh Kumar /* possible adc range is 2.5 MHz to 20 MHz. */
3280b928af1SViresh Kumar static struct aux_rate_tbl adc_rtbl[] = {
3290b928af1SViresh Kumar 	/* For ahb = 166.67 MHz */
3300b928af1SViresh Kumar 	{.xscale = 1, .yscale = 31, .eq = 0}, /* 2.68 MHz */
3310b928af1SViresh Kumar 	{.xscale = 2, .yscale = 21, .eq = 0}, /* 7.94 MHz */
3320b928af1SViresh Kumar 	{.xscale = 4, .yscale = 21, .eq = 0}, /* 15.87 MHz */
3330b928af1SViresh Kumar 	{.xscale = 10, .yscale = 42, .eq = 0}, /* 19.84 MHz */
3340b928af1SViresh Kumar };
3350b928af1SViresh Kumar 
3360b928af1SViresh Kumar /* General synth rate configuration table, in ascending order of rates */
3370b928af1SViresh Kumar static struct frac_rate_tbl gen_rtbl[] = {
3380b928af1SViresh Kumar 	/* For vco1div4 = 250 MHz */
3390b928af1SViresh Kumar 	{.div = 0x14000}, /* 25 MHz */
3400b928af1SViresh Kumar 	{.div = 0x0A000}, /* 50 MHz */
3410b928af1SViresh Kumar 	{.div = 0x05000}, /* 100 MHz */
3420b928af1SViresh Kumar 	{.div = 0x02000}, /* 250 MHz */
3430b928af1SViresh Kumar };
3440b928af1SViresh Kumar 
3450b928af1SViresh Kumar /* clock parents */
3460b928af1SViresh Kumar static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", };
3470b928af1SViresh Kumar static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", };
3480b928af1SViresh Kumar static const char *uart0_parents[] = { "pll5_clk", "uart_synth_gate_clk", };
3490b928af1SViresh Kumar static const char *c3_parents[] = { "pll5_clk", "c3_synth_gate_clk", };
3500b928af1SViresh Kumar static const char *gmac_phy_input_parents[] = { "gmii_125m_pad_clk", "pll2_clk",
3510b928af1SViresh Kumar 	"osc_25m_clk", };
3520b928af1SViresh Kumar static const char *gmac_phy_parents[] = { "gmac_phy_input_mux_clk",
3530b928af1SViresh Kumar 	"gmac_phy_synth_gate_clk", };
3540b928af1SViresh Kumar static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", };
3550b928af1SViresh Kumar static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_synth_clk", };
3560b928af1SViresh Kumar static const char *i2s_src_parents[] = { "vco1div2_clk", "none", "pll3_clk",
3570b928af1SViresh Kumar 	"i2s_src_pad_clk", };
3580b928af1SViresh Kumar static const char *i2s_ref_parents[] = { "i2s_src_mux_clk", "i2s_prs1_clk", };
3590b928af1SViresh Kumar static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk",
3600b928af1SViresh Kumar 	"pll3_clk", };
3610b928af1SViresh Kumar static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco3div2_clk",
3620b928af1SViresh Kumar 	"pll2_clk", };
3630b928af1SViresh Kumar static const char *rmii_phy_parents[] = { "ras_tx50_clk", "none",
3640b928af1SViresh Kumar 	"ras_pll2_clk", "ras_synth0_clk", };
3650b928af1SViresh Kumar static const char *smii_rgmii_phy_parents[] = { "none", "ras_tx125_clk",
3660b928af1SViresh Kumar 	"ras_pll2_clk", "ras_synth0_clk", };
3670b928af1SViresh Kumar static const char *uart_parents[] = { "ras_apb_clk", "gen_synth3_clk", };
3680b928af1SViresh Kumar static const char *i2c_parents[] = { "ras_apb_clk", "gen_synth1_clk", };
3690b928af1SViresh Kumar static const char *ssp1_parents[] = { "ras_apb_clk", "gen_synth1_clk",
3700b928af1SViresh Kumar 	"ras_plclk0_clk", };
3710b928af1SViresh Kumar static const char *pci_parents[] = { "ras_pll3_clk", "gen_synth2_clk", };
3720b928af1SViresh Kumar static const char *tdm_parents[] = { "ras_pll3_clk", "gen_synth1_clk", };
3730b928af1SViresh Kumar 
3740b928af1SViresh Kumar void __init spear1310_clk_init(void)
3750b928af1SViresh Kumar {
3760b928af1SViresh Kumar 	struct clk *clk, *clk1;
3770b928af1SViresh Kumar 
3780b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, CLK_IS_ROOT, 0);
3790b928af1SViresh Kumar 	clk_register_clkdev(clk, "apb_pclk", NULL);
3800b928af1SViresh Kumar 
3810b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, CLK_IS_ROOT,
3820b928af1SViresh Kumar 			32000);
3830b928af1SViresh Kumar 	clk_register_clkdev(clk, "osc_32k_clk", NULL);
3840b928af1SViresh Kumar 
3850b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "osc_24m_clk", NULL, CLK_IS_ROOT,
3860b928af1SViresh Kumar 			24000000);
3870b928af1SViresh Kumar 	clk_register_clkdev(clk, "osc_24m_clk", NULL);
3880b928af1SViresh Kumar 
3890b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "osc_25m_clk", NULL, CLK_IS_ROOT,
3900b928af1SViresh Kumar 			25000000);
3910b928af1SViresh Kumar 	clk_register_clkdev(clk, "osc_25m_clk", NULL);
3920b928af1SViresh Kumar 
3930b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "gmii_125m_pad_clk", NULL,
3940b928af1SViresh Kumar 			CLK_IS_ROOT, 125000000);
3950b928af1SViresh Kumar 	clk_register_clkdev(clk, "gmii_125m_pad_clk", NULL);
3960b928af1SViresh Kumar 
3970b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL,
3980b928af1SViresh Kumar 			CLK_IS_ROOT, 12288000);
3990b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2s_src_pad_clk", NULL);
4000b928af1SViresh Kumar 
4010b928af1SViresh Kumar 	/* clock derived from 32 KHz osc clk */
4020b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "rtc-spear", "osc_32k_clk", 0,
4030b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_RTC_CLK_ENB, 0,
4040b928af1SViresh Kumar 			&_lock);
4050b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "fc900000.rtc");
4060b928af1SViresh Kumar 
4070b928af1SViresh Kumar 	/* clock derived from 24 or 25 MHz osc clk */
4080b928af1SViresh Kumar 	/* vco-pll */
4090b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "vco1_mux_clk", vco_parents,
4100b928af1SViresh Kumar 			ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG,
4110b928af1SViresh Kumar 			SPEAR1310_PLL1_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0,
4120b928af1SViresh Kumar 			&_lock);
4130b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco1_mux_clk", NULL);
4140b928af1SViresh Kumar 	clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mux_clk",
4150b928af1SViresh Kumar 			0, SPEAR1310_PLL1_CTR, SPEAR1310_PLL1_FRQ, pll_rtbl,
4160b928af1SViresh Kumar 			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4170b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco1_clk", NULL);
4180b928af1SViresh Kumar 	clk_register_clkdev(clk1, "pll1_clk", NULL);
4190b928af1SViresh Kumar 
4200b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "vco2_mux_clk", vco_parents,
4210b928af1SViresh Kumar 			ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG,
4220b928af1SViresh Kumar 			SPEAR1310_PLL2_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0,
4230b928af1SViresh Kumar 			&_lock);
4240b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco2_mux_clk", NULL);
4250b928af1SViresh Kumar 	clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mux_clk",
4260b928af1SViresh Kumar 			0, SPEAR1310_PLL2_CTR, SPEAR1310_PLL2_FRQ, pll_rtbl,
4270b928af1SViresh Kumar 			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4280b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco2_clk", NULL);
4290b928af1SViresh Kumar 	clk_register_clkdev(clk1, "pll2_clk", NULL);
4300b928af1SViresh Kumar 
4310b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "vco3_mux_clk", vco_parents,
4320b928af1SViresh Kumar 			ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG,
4330b928af1SViresh Kumar 			SPEAR1310_PLL3_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0,
4340b928af1SViresh Kumar 			&_lock);
4350b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco3_mux_clk", NULL);
4360b928af1SViresh Kumar 	clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mux_clk",
4370b928af1SViresh Kumar 			0, SPEAR1310_PLL3_CTR, SPEAR1310_PLL3_FRQ, pll_rtbl,
4380b928af1SViresh Kumar 			ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL);
4390b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco3_clk", NULL);
4400b928af1SViresh Kumar 	clk_register_clkdev(clk1, "pll3_clk", NULL);
4410b928af1SViresh Kumar 
4420b928af1SViresh Kumar 	clk = clk_register_vco_pll("vco4_clk", "pll4_clk", NULL, "osc_24m_clk",
4430b928af1SViresh Kumar 			0, SPEAR1310_PLL4_CTR, SPEAR1310_PLL4_FRQ, pll4_rtbl,
4440b928af1SViresh Kumar 			ARRAY_SIZE(pll4_rtbl), &_lock, &clk1, NULL);
4450b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco4_clk", NULL);
4460b928af1SViresh Kumar 	clk_register_clkdev(clk1, "pll4_clk", NULL);
4470b928af1SViresh Kumar 
4480b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "pll5_clk", "osc_24m_clk", 0,
4490b928af1SViresh Kumar 			48000000);
4500b928af1SViresh Kumar 	clk_register_clkdev(clk, "pll5_clk", NULL);
4510b928af1SViresh Kumar 
4520b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "pll6_clk", "osc_25m_clk", 0,
4530b928af1SViresh Kumar 			25000000);
4540b928af1SViresh Kumar 	clk_register_clkdev(clk, "pll6_clk", NULL);
4550b928af1SViresh Kumar 
4560b928af1SViresh Kumar 	/* vco div n clocks */
4570b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "vco1div2_clk", "vco1_clk", 0, 1,
4580b928af1SViresh Kumar 			2);
4590b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco1div2_clk", NULL);
4600b928af1SViresh Kumar 
4610b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "vco1div4_clk", "vco1_clk", 0, 1,
4620b928af1SViresh Kumar 			4);
4630b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco1div4_clk", NULL);
4640b928af1SViresh Kumar 
4650b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "vco2div2_clk", "vco2_clk", 0, 1,
4660b928af1SViresh Kumar 			2);
4670b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco2div2_clk", NULL);
4680b928af1SViresh Kumar 
4690b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "vco3div2_clk", "vco3_clk", 0, 1,
4700b928af1SViresh Kumar 			2);
4710b928af1SViresh Kumar 	clk_register_clkdev(clk, "vco3div2_clk", NULL);
4720b928af1SViresh Kumar 
4730b928af1SViresh Kumar 	/* peripherals */
4740b928af1SViresh Kumar 	clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1,
4750b928af1SViresh Kumar 			128);
4760b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "thermal_gate_clk", "thermal_clk", 0,
4770b928af1SViresh Kumar 			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_THSENS_CLK_ENB, 0,
4780b928af1SViresh Kumar 			&_lock);
4790b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "spear_thermal");
4800b928af1SViresh Kumar 
4810b928af1SViresh Kumar 	/* clock derived from pll4 clk */
4820b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "ddr_clk", "pll4_clk", 0, 1,
4830b928af1SViresh Kumar 			1);
4840b928af1SViresh Kumar 	clk_register_clkdev(clk, "ddr_clk", NULL);
4850b928af1SViresh Kumar 
4860b928af1SViresh Kumar 	/* clock derived from pll1 clk */
4870b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "cpu_clk", "pll1_clk", 0, 1, 2);
4880b928af1SViresh Kumar 	clk_register_clkdev(clk, "cpu_clk", NULL);
4890b928af1SViresh Kumar 
4900b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "wdt_clk", "cpu_clk", 0, 1,
4910b928af1SViresh Kumar 			2);
4920b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "ec800620.wdt");
4930b928af1SViresh Kumar 
4940b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "ahb_clk", "pll1_clk", 0, 1,
4950b928af1SViresh Kumar 			6);
4960b928af1SViresh Kumar 	clk_register_clkdev(clk, "ahb_clk", NULL);
4970b928af1SViresh Kumar 
4980b928af1SViresh Kumar 	clk = clk_register_fixed_factor(NULL, "apb_clk", "pll1_clk", 0, 1,
4990b928af1SViresh Kumar 			12);
5000b928af1SViresh Kumar 	clk_register_clkdev(clk, "apb_clk", NULL);
5010b928af1SViresh Kumar 
5020b928af1SViresh Kumar 	/* gpt clocks */
5030b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "gpt0_mux_clk", gpt_parents,
5040b928af1SViresh Kumar 			ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG,
5050b928af1SViresh Kumar 			SPEAR1310_GPT0_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0,
5060b928af1SViresh Kumar 			&_lock);
5070b928af1SViresh Kumar 	clk_register_clkdev(clk, "gpt0_mux_clk", NULL);
5080b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mux_clk", 0,
5090b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT0_CLK_ENB, 0,
5100b928af1SViresh Kumar 			&_lock);
5110b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "gpt0");
5120b928af1SViresh Kumar 
5130b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "gpt1_mux_clk", gpt_parents,
5140b928af1SViresh Kumar 			ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG,
5150b928af1SViresh Kumar 			SPEAR1310_GPT1_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0,
5160b928af1SViresh Kumar 			&_lock);
5170b928af1SViresh Kumar 	clk_register_clkdev(clk, "gpt1_mux_clk", NULL);
5180b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mux_clk", 0,
5190b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT1_CLK_ENB, 0,
5200b928af1SViresh Kumar 			&_lock);
5210b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "gpt1");
5220b928af1SViresh Kumar 
5230b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "gpt2_mux_clk", gpt_parents,
5240b928af1SViresh Kumar 			ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG,
5250b928af1SViresh Kumar 			SPEAR1310_GPT2_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0,
5260b928af1SViresh Kumar 			&_lock);
5270b928af1SViresh Kumar 	clk_register_clkdev(clk, "gpt2_mux_clk", NULL);
5280b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mux_clk", 0,
5290b928af1SViresh Kumar 			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT2_CLK_ENB, 0,
5300b928af1SViresh Kumar 			&_lock);
5310b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "gpt2");
5320b928af1SViresh Kumar 
5330b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "gpt3_mux_clk", gpt_parents,
5340b928af1SViresh Kumar 			ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG,
5350b928af1SViresh Kumar 			SPEAR1310_GPT3_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0,
5360b928af1SViresh Kumar 			&_lock);
5370b928af1SViresh Kumar 	clk_register_clkdev(clk, "gpt3_mux_clk", NULL);
5380b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mux_clk", 0,
5390b928af1SViresh Kumar 			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT3_CLK_ENB, 0,
5400b928af1SViresh Kumar 			&_lock);
5410b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "gpt3");
5420b928af1SViresh Kumar 
5430b928af1SViresh Kumar 	/* others */
5440b928af1SViresh Kumar 	clk = clk_register_aux("uart_synth_clk", "uart_synth_gate_clk",
5450b928af1SViresh Kumar 			"vco1div2_clk", 0, SPEAR1310_UART_CLK_SYNT, NULL,
5460b928af1SViresh Kumar 			aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
5470b928af1SViresh Kumar 	clk_register_clkdev(clk, "uart_synth_clk", NULL);
5480b928af1SViresh Kumar 	clk_register_clkdev(clk1, "uart_synth_gate_clk", NULL);
5490b928af1SViresh Kumar 
5500b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "uart0_mux_clk", uart0_parents,
5510b928af1SViresh Kumar 			ARRAY_SIZE(uart0_parents), 0, SPEAR1310_PERIP_CLK_CFG,
5520b928af1SViresh Kumar 			SPEAR1310_UART_CLK_SHIFT, SPEAR1310_UART_CLK_MASK, 0,
5530b928af1SViresh Kumar 			&_lock);
5540b928af1SViresh Kumar 	clk_register_clkdev(clk, "uart0_mux_clk", NULL);
5550b928af1SViresh Kumar 
5560b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "uart0_clk", "uart0_mux_clk", 0,
5570b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UART_CLK_ENB, 0,
5580b928af1SViresh Kumar 			&_lock);
5590b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0000000.serial");
5600b928af1SViresh Kumar 
5610b928af1SViresh Kumar 	clk = clk_register_aux("sdhci_synth_clk", "sdhci_synth_gate_clk",
5620b928af1SViresh Kumar 			"vco1div2_clk", 0, SPEAR1310_SDHCI_CLK_SYNT, NULL,
5630b928af1SViresh Kumar 			aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
5640b928af1SViresh Kumar 	clk_register_clkdev(clk, "sdhci_synth_clk", NULL);
5650b928af1SViresh Kumar 	clk_register_clkdev(clk1, "sdhci_synth_gate_clk", NULL);
5660b928af1SViresh Kumar 
5670b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_synth_gate_clk", 0,
5680b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SDHCI_CLK_ENB, 0,
5690b928af1SViresh Kumar 			&_lock);
5700b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "b3000000.sdhci");
5710b928af1SViresh Kumar 
5720b928af1SViresh Kumar 	clk = clk_register_aux("cfxd_synth_clk", "cfxd_synth_gate_clk",
5730b928af1SViresh Kumar 			"vco1div2_clk", 0, SPEAR1310_CFXD_CLK_SYNT, NULL,
5740b928af1SViresh Kumar 			aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
5750b928af1SViresh Kumar 	clk_register_clkdev(clk, "cfxd_synth_clk", NULL);
5760b928af1SViresh Kumar 	clk_register_clkdev(clk1, "cfxd_synth_gate_clk", NULL);
5770b928af1SViresh Kumar 
5780b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_synth_gate_clk", 0,
5790b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CFXD_CLK_ENB, 0,
5800b928af1SViresh Kumar 			&_lock);
5810b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "b2800000.cf");
5820b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "arasan_xd");
5830b928af1SViresh Kumar 
5840b928af1SViresh Kumar 	clk = clk_register_aux("c3_synth_clk", "c3_synth_gate_clk",
5850b928af1SViresh Kumar 			"vco1div2_clk", 0, SPEAR1310_C3_CLK_SYNT, NULL,
5860b928af1SViresh Kumar 			aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1);
5870b928af1SViresh Kumar 	clk_register_clkdev(clk, "c3_synth_clk", NULL);
5880b928af1SViresh Kumar 	clk_register_clkdev(clk1, "c3_synth_gate_clk", NULL);
5890b928af1SViresh Kumar 
5900b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "c3_mux_clk", c3_parents,
5910b928af1SViresh Kumar 			ARRAY_SIZE(c3_parents), 0, SPEAR1310_PERIP_CLK_CFG,
5920b928af1SViresh Kumar 			SPEAR1310_C3_CLK_SHIFT, SPEAR1310_C3_CLK_MASK, 0,
5930b928af1SViresh Kumar 			&_lock);
5940b928af1SViresh Kumar 	clk_register_clkdev(clk, "c3_mux_clk", NULL);
5950b928af1SViresh Kumar 
5960b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "c3_clk", "c3_mux_clk", 0,
5970b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_C3_CLK_ENB, 0,
5980b928af1SViresh Kumar 			&_lock);
5990b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "c3");
6000b928af1SViresh Kumar 
6010b928af1SViresh Kumar 	/* gmac */
6020b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "gmac_phy_input_mux_clk",
6030b928af1SViresh Kumar 			gmac_phy_input_parents,
6040b928af1SViresh Kumar 			ARRAY_SIZE(gmac_phy_input_parents), 0,
6050b928af1SViresh Kumar 			SPEAR1310_GMAC_CLK_CFG,
6060b928af1SViresh Kumar 			SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT,
6070b928af1SViresh Kumar 			SPEAR1310_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock);
6080b928af1SViresh Kumar 	clk_register_clkdev(clk, "gmac_phy_input_mux_clk", NULL);
6090b928af1SViresh Kumar 
6100b928af1SViresh Kumar 	clk = clk_register_aux("gmac_phy_synth_clk", "gmac_phy_synth_gate_clk",
6110b928af1SViresh Kumar 			"gmac_phy_input_mux_clk", 0, SPEAR1310_GMAC_CLK_SYNT,
6120b928af1SViresh Kumar 			NULL, gmac_rtbl, ARRAY_SIZE(gmac_rtbl), &_lock, &clk1);
6130b928af1SViresh Kumar 	clk_register_clkdev(clk, "gmac_phy_synth_clk", NULL);
6140b928af1SViresh Kumar 	clk_register_clkdev(clk1, "gmac_phy_synth_gate_clk", NULL);
6150b928af1SViresh Kumar 
6160b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "gmac_phy_mux_clk", gmac_phy_parents,
6170b928af1SViresh Kumar 			ARRAY_SIZE(gmac_phy_parents), 0,
6180b928af1SViresh Kumar 			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GMAC_PHY_CLK_SHIFT,
6190b928af1SViresh Kumar 			SPEAR1310_GMAC_PHY_CLK_MASK, 0, &_lock);
6200b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "stmmacphy.0");
6210b928af1SViresh Kumar 
6220b928af1SViresh Kumar 	/* clcd */
6230b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "clcd_synth_mux_clk", clcd_synth_parents,
6240b928af1SViresh Kumar 			ARRAY_SIZE(clcd_synth_parents), 0,
6250b928af1SViresh Kumar 			SPEAR1310_CLCD_CLK_SYNT, SPEAR1310_CLCD_SYNT_CLK_SHIFT,
6260b928af1SViresh Kumar 			SPEAR1310_CLCD_SYNT_CLK_MASK, 0, &_lock);
6270b928af1SViresh Kumar 	clk_register_clkdev(clk, "clcd_synth_mux_clk", NULL);
6280b928af1SViresh Kumar 
6290b928af1SViresh Kumar 	clk = clk_register_frac("clcd_synth_clk", "clcd_synth_mux_clk", 0,
6300b928af1SViresh Kumar 			SPEAR1310_CLCD_CLK_SYNT, clcd_rtbl,
6310b928af1SViresh Kumar 			ARRAY_SIZE(clcd_rtbl), &_lock);
6320b928af1SViresh Kumar 	clk_register_clkdev(clk, "clcd_synth_clk", NULL);
6330b928af1SViresh Kumar 
6340b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "clcd_pixel_mux_clk", clcd_pixel_parents,
6350b928af1SViresh Kumar 			ARRAY_SIZE(clcd_pixel_parents), 0,
6360b928af1SViresh Kumar 			SPEAR1310_PERIP_CLK_CFG, SPEAR1310_CLCD_CLK_SHIFT,
6370b928af1SViresh Kumar 			SPEAR1310_CLCD_CLK_MASK, 0, &_lock);
6380b928af1SViresh Kumar 	clk_register_clkdev(clk, "clcd_pixel_clk", NULL);
6390b928af1SViresh Kumar 
6400b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mux_clk", 0,
6410b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CLCD_CLK_ENB, 0,
6420b928af1SViresh Kumar 			&_lock);
6430b928af1SViresh Kumar 	clk_register_clkdev(clk, "clcd_clk", NULL);
6440b928af1SViresh Kumar 
6450b928af1SViresh Kumar 	/* i2s */
6460b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "i2s_src_mux_clk", i2s_src_parents,
6470b928af1SViresh Kumar 			ARRAY_SIZE(i2s_src_parents), 0, SPEAR1310_I2S_CLK_CFG,
6480b928af1SViresh Kumar 			SPEAR1310_I2S_SRC_CLK_SHIFT, SPEAR1310_I2S_SRC_CLK_MASK,
6490b928af1SViresh Kumar 			0, &_lock);
6500b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2s_src_clk", NULL);
6510b928af1SViresh Kumar 
6520b928af1SViresh Kumar 	clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mux_clk", 0,
6530b928af1SViresh Kumar 			SPEAR1310_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl,
6540b928af1SViresh Kumar 			ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL);
6550b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2s_prs1_clk", NULL);
6560b928af1SViresh Kumar 
6570b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "i2s_ref_mux_clk", i2s_ref_parents,
6580b928af1SViresh Kumar 			ARRAY_SIZE(i2s_ref_parents), 0, SPEAR1310_I2S_CLK_CFG,
6590b928af1SViresh Kumar 			SPEAR1310_I2S_REF_SHIFT, SPEAR1310_I2S_REF_SEL_MASK, 0,
6600b928af1SViresh Kumar 			&_lock);
6610b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2s_ref_clk", NULL);
6620b928af1SViresh Kumar 
6630b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mux_clk", 0,
6640b928af1SViresh Kumar 			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_I2S_REF_PAD_CLK_ENB,
6650b928af1SViresh Kumar 			0, &_lock);
6660b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL);
6670b928af1SViresh Kumar 
6680b928af1SViresh Kumar 	clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gate_clk",
6690b928af1SViresh Kumar 			"i2s_ref_pad_clk", 0, SPEAR1310_I2S_CLK_CFG,
6700b928af1SViresh Kumar 			&i2s_sclk_masks, i2s_sclk_rtbl,
6710b928af1SViresh Kumar 			ARRAY_SIZE(i2s_sclk_rtbl), &_lock, &clk1);
6720b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2s_sclk_clk", NULL);
6730b928af1SViresh Kumar 	clk_register_clkdev(clk1, "i2s_sclk_gate_clk", NULL);
6740b928af1SViresh Kumar 
6750b928af1SViresh Kumar 	/* clock derived from ahb clk */
6760b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0,
6770b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2C0_CLK_ENB, 0,
6780b928af1SViresh Kumar 			&_lock);
6790b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0280000.i2c");
6800b928af1SViresh Kumar 
6810b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "dma_clk", "ahb_clk", 0,
6820b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_DMA_CLK_ENB, 0,
6830b928af1SViresh Kumar 			&_lock);
6840b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "ea800000.dma");
6850b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "eb000000.dma");
6860b928af1SViresh Kumar 
6870b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "jpeg_clk", "ahb_clk", 0,
6880b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_JPEG_CLK_ENB, 0,
6890b928af1SViresh Kumar 			&_lock);
6900b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "b2000000.jpeg");
6910b928af1SViresh Kumar 
6920b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0,
6930b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GMAC_CLK_ENB, 0,
6940b928af1SViresh Kumar 			&_lock);
6950b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e2000000.eth");
6960b928af1SViresh Kumar 
6970b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "fsmc_clk", "ahb_clk", 0,
6980b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_FSMC_CLK_ENB, 0,
6990b928af1SViresh Kumar 			&_lock);
7000b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "b0000000.flash");
7010b928af1SViresh Kumar 
7020b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "smi_clk", "ahb_clk", 0,
7030b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SMI_CLK_ENB, 0,
7040b928af1SViresh Kumar 			&_lock);
7050b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "ea000000.flash");
7060b928af1SViresh Kumar 
7070b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "usbh0_clk", "ahb_clk", 0,
7080b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UHC0_CLK_ENB, 0,
7090b928af1SViresh Kumar 			&_lock);
7100b928af1SViresh Kumar 	clk_register_clkdev(clk, "usbh.0_clk", NULL);
7110b928af1SViresh Kumar 
7120b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "usbh1_clk", "ahb_clk", 0,
7130b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UHC1_CLK_ENB, 0,
7140b928af1SViresh Kumar 			&_lock);
7150b928af1SViresh Kumar 	clk_register_clkdev(clk, "usbh.1_clk", NULL);
7160b928af1SViresh Kumar 
7170b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "uoc_clk", "ahb_clk", 0,
7180b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UOC_CLK_ENB, 0,
7190b928af1SViresh Kumar 			&_lock);
7200b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "uoc");
7210b928af1SViresh Kumar 
7220b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "pcie_sata_0_clk", "ahb_clk", 0,
7230b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_0_CLK_ENB,
7240b928af1SViresh Kumar 			0, &_lock);
7250b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "dw_pcie.0");
7260b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "ahci.0");
7270b928af1SViresh Kumar 
7280b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "pcie_sata_1_clk", "ahb_clk", 0,
7290b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_1_CLK_ENB,
7300b928af1SViresh Kumar 			0, &_lock);
7310b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "dw_pcie.1");
7320b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "ahci.1");
7330b928af1SViresh Kumar 
7340b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "pcie_sata_2_clk", "ahb_clk", 0,
7350b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_2_CLK_ENB,
7360b928af1SViresh Kumar 			0, &_lock);
7370b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "dw_pcie.2");
7380b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "ahci.2");
7390b928af1SViresh Kumar 
7400b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
7410b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SYSRAM0_CLK_ENB, 0,
7420b928af1SViresh Kumar 			&_lock);
7430b928af1SViresh Kumar 	clk_register_clkdev(clk, "sysram0_clk", NULL);
7440b928af1SViresh Kumar 
7450b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "sysram1_clk", "ahb_clk", 0,
7460b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SYSRAM1_CLK_ENB, 0,
7470b928af1SViresh Kumar 			&_lock);
7480b928af1SViresh Kumar 	clk_register_clkdev(clk, "sysram1_clk", NULL);
7490b928af1SViresh Kumar 
7500b928af1SViresh Kumar 	clk = clk_register_aux("adc_synth_clk", "adc_synth_gate_clk", "ahb_clk",
7510b928af1SViresh Kumar 			0, SPEAR1310_ADC_CLK_SYNT, NULL, adc_rtbl,
7520b928af1SViresh Kumar 			ARRAY_SIZE(adc_rtbl), &_lock, &clk1);
7530b928af1SViresh Kumar 	clk_register_clkdev(clk, "adc_synth_clk", NULL);
7540b928af1SViresh Kumar 	clk_register_clkdev(clk1, "adc_synth_gate_clk", NULL);
7550b928af1SViresh Kumar 
7560b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "adc_clk", "adc_synth_gate_clk", 0,
7570b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_ADC_CLK_ENB, 0,
7580b928af1SViresh Kumar 			&_lock);
7590b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "adc_clk");
7600b928af1SViresh Kumar 
7610b928af1SViresh Kumar 	/* clock derived from apb clk */
7620b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ssp0_clk", "apb_clk", 0,
7630b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SSP_CLK_ENB, 0,
7640b928af1SViresh Kumar 			&_lock);
7650b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0100000.spi");
7660b928af1SViresh Kumar 
7670b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "gpio0_clk", "apb_clk", 0,
7680b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPIO0_CLK_ENB, 0,
7690b928af1SViresh Kumar 			&_lock);
7700b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0600000.gpio");
7710b928af1SViresh Kumar 
7720b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "gpio1_clk", "apb_clk", 0,
7730b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPIO1_CLK_ENB, 0,
7740b928af1SViresh Kumar 			&_lock);
7750b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0680000.gpio");
7760b928af1SViresh Kumar 
7770b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2s0_clk", "apb_clk", 0,
7780b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2S0_CLK_ENB, 0,
7790b928af1SViresh Kumar 			&_lock);
7800b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0180000.i2s");
7810b928af1SViresh Kumar 
7820b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2s1_clk", "apb_clk", 0,
7830b928af1SViresh Kumar 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_I2S1_CLK_ENB, 0,
7840b928af1SViresh Kumar 			&_lock);
7850b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0200000.i2s");
7860b928af1SViresh Kumar 
7870b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "kbd_clk", "apb_clk", 0,
7880b928af1SViresh Kumar 			SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_KBD_CLK_ENB, 0,
7890b928af1SViresh Kumar 			&_lock);
7900b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "e0300000.kbd");
7910b928af1SViresh Kumar 
7920b928af1SViresh Kumar 	/* RAS clks */
7930b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "gen_synth0_1_mux_clk",
7940b928af1SViresh Kumar 			gen_synth0_1_parents, ARRAY_SIZE(gen_synth0_1_parents),
7950b928af1SViresh Kumar 			0, SPEAR1310_PLL_CFG, SPEAR1310_RAS_SYNT0_1_CLK_SHIFT,
7960b928af1SViresh Kumar 			SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock);
7970b928af1SViresh Kumar 	clk_register_clkdev(clk, "gen_synth0_1_clk", NULL);
7980b928af1SViresh Kumar 
7990b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "gen_synth2_3_mux_clk",
8000b928af1SViresh Kumar 			gen_synth2_3_parents, ARRAY_SIZE(gen_synth2_3_parents),
8010b928af1SViresh Kumar 			0, SPEAR1310_PLL_CFG, SPEAR1310_RAS_SYNT2_3_CLK_SHIFT,
8020b928af1SViresh Kumar 			SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock);
8030b928af1SViresh Kumar 	clk_register_clkdev(clk, "gen_synth2_3_clk", NULL);
8040b928af1SViresh Kumar 
8050b928af1SViresh Kumar 	clk = clk_register_frac("gen_synth0_clk", "gen_synth0_1_clk", 0,
8060b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8070b928af1SViresh Kumar 			&_lock);
8080b928af1SViresh Kumar 	clk_register_clkdev(clk, "gen_synth0_clk", NULL);
8090b928af1SViresh Kumar 
8100b928af1SViresh Kumar 	clk = clk_register_frac("gen_synth1_clk", "gen_synth0_1_clk", 0,
8110b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8120b928af1SViresh Kumar 			&_lock);
8130b928af1SViresh Kumar 	clk_register_clkdev(clk, "gen_synth1_clk", NULL);
8140b928af1SViresh Kumar 
8150b928af1SViresh Kumar 	clk = clk_register_frac("gen_synth2_clk", "gen_synth2_3_clk", 0,
8160b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8170b928af1SViresh Kumar 			&_lock);
8180b928af1SViresh Kumar 	clk_register_clkdev(clk, "gen_synth2_clk", NULL);
8190b928af1SViresh Kumar 
8200b928af1SViresh Kumar 	clk = clk_register_frac("gen_synth3_clk", "gen_synth2_3_clk", 0,
8210b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl),
8220b928af1SViresh Kumar 			&_lock);
8230b928af1SViresh Kumar 	clk_register_clkdev(clk, "gen_synth3_clk", NULL);
8240b928af1SViresh Kumar 
8250b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_osc_24m_clk", "osc_24m_clk", 0,
8260b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_24M_CLK_ENB, 0,
8270b928af1SViresh Kumar 			&_lock);
8280b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_osc_24m_clk", NULL);
8290b928af1SViresh Kumar 
8300b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_osc_25m_clk", "osc_25m_clk", 0,
8310b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_25M_CLK_ENB, 0,
8320b928af1SViresh Kumar 			&_lock);
8330b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_osc_25m_clk", NULL);
8340b928af1SViresh Kumar 
8350b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_osc_32k_clk", "osc_32k_clk", 0,
8360b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_32K_CLK_ENB, 0,
8370b928af1SViresh Kumar 			&_lock);
8380b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_osc_32k_clk", NULL);
8390b928af1SViresh Kumar 
8400b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_pll2_clk", "pll2_clk", 0,
8410b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_PLL2_CLK_ENB, 0,
8420b928af1SViresh Kumar 			&_lock);
8430b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_pll2_clk", NULL);
8440b928af1SViresh Kumar 
8450b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_pll3_clk", "pll3_clk", 0,
8460b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_PLL3_CLK_ENB, 0,
8470b928af1SViresh Kumar 			&_lock);
8480b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_pll3_clk", NULL);
8490b928af1SViresh Kumar 
8500b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_tx125_clk", "gmii_125m_pad_clk", 0,
8510b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_C125M_PAD_CLK_ENB, 0,
8520b928af1SViresh Kumar 			&_lock);
8530b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_tx125_clk", NULL);
8540b928af1SViresh Kumar 
8550b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "ras_30m_fixed_clk", "pll5_clk", 0,
8560b928af1SViresh Kumar 			30000000);
8570b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_30m_clk", "ras_30m_fixed_clk", 0,
8580b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_C30M_CLK_ENB, 0,
8590b928af1SViresh Kumar 			&_lock);
8600b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_30m_clk", NULL);
8610b928af1SViresh Kumar 
8620b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "ras_48m_fixed_clk", "pll5_clk", 0,
8630b928af1SViresh Kumar 			48000000);
8640b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_48m_clk", "ras_48m_fixed_clk", 0,
8650b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_C48M_CLK_ENB, 0,
8660b928af1SViresh Kumar 			&_lock);
8670b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_48m_clk", NULL);
8680b928af1SViresh Kumar 
8690b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_ahb_clk", "ahb_clk", 0,
8700b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_ACLK_CLK_ENB, 0,
8710b928af1SViresh Kumar 			&_lock);
8720b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_ahb_clk", NULL);
8730b928af1SViresh Kumar 
8740b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_apb_clk", "apb_clk", 0,
8750b928af1SViresh Kumar 			SPEAR1310_RAS_CLK_ENB, SPEAR1310_PCLK_CLK_ENB, 0,
8760b928af1SViresh Kumar 			&_lock);
8770b928af1SViresh Kumar 	clk_register_clkdev(clk, "ras_apb_clk", NULL);
8780b928af1SViresh Kumar 
8790b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "ras_plclk0_clk", NULL, CLK_IS_ROOT,
8800b928af1SViresh Kumar 			50000000);
8810b928af1SViresh Kumar 
8820b928af1SViresh Kumar 	clk = clk_register_fixed_rate(NULL, "ras_tx50_clk", NULL, CLK_IS_ROOT,
8830b928af1SViresh Kumar 			50000000);
8840b928af1SViresh Kumar 
8850b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "can0_clk", "apb_clk", 0,
8860b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_CAN0_CLK_ENB, 0,
8870b928af1SViresh Kumar 			&_lock);
8880b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "c_can_platform.0");
8890b928af1SViresh Kumar 
8900b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "can1_clk", "apb_clk", 0,
8910b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_CAN1_CLK_ENB, 0,
8920b928af1SViresh Kumar 			&_lock);
8930b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "c_can_platform.1");
8940b928af1SViresh Kumar 
8950b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_smii0_clk", "ras_ahb_clk", 0,
8960b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII0_CLK_ENB, 0,
8970b928af1SViresh Kumar 			&_lock);
8980b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c400000.eth");
8990b928af1SViresh Kumar 
9000b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_smii1_clk", "ras_ahb_clk", 0,
9010b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII1_CLK_ENB, 0,
9020b928af1SViresh Kumar 			&_lock);
9030b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c500000.eth");
9040b928af1SViresh Kumar 
9050b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_smii2_clk", "ras_ahb_clk", 0,
9060b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_MII2_CLK_ENB, 0,
9070b928af1SViresh Kumar 			&_lock);
9080b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c600000.eth");
9090b928af1SViresh Kumar 
9100b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ras_rgmii_clk", "ras_ahb_clk", 0,
9110b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_GMII_CLK_ENB, 0,
9120b928af1SViresh Kumar 			&_lock);
9130b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c700000.eth");
9140b928af1SViresh Kumar 
9150b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "smii_rgmii_phy_mux_clk",
9160b928af1SViresh Kumar 			smii_rgmii_phy_parents,
9170b928af1SViresh Kumar 			ARRAY_SIZE(smii_rgmii_phy_parents), 0,
9180b928af1SViresh Kumar 			SPEAR1310_RAS_CTRL_REG1,
9190b928af1SViresh Kumar 			SPEAR1310_SMII_RGMII_PHY_CLK_SHIFT,
9200b928af1SViresh Kumar 			SPEAR1310_PHY_CLK_MASK, 0, &_lock);
9210b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "stmmacphy.1");
9220b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "stmmacphy.2");
9230b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "stmmacphy.4");
9240b928af1SViresh Kumar 
9250b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "rmii_phy_mux_clk", rmii_phy_parents,
9260b928af1SViresh Kumar 			ARRAY_SIZE(rmii_phy_parents), 0,
9270b928af1SViresh Kumar 			SPEAR1310_RAS_CTRL_REG1, SPEAR1310_RMII_PHY_CLK_SHIFT,
9280b928af1SViresh Kumar 			SPEAR1310_PHY_CLK_MASK, 0, &_lock);
9290b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "stmmacphy.3");
9300b928af1SViresh Kumar 
9310b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "uart1_mux_clk", uart_parents,
9320b928af1SViresh Kumar 			ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0,
9330b928af1SViresh Kumar 			SPEAR1310_UART1_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK,
9340b928af1SViresh Kumar 			0, &_lock);
9350b928af1SViresh Kumar 	clk_register_clkdev(clk, "uart1_mux_clk", NULL);
9360b928af1SViresh Kumar 
9370b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "uart1_clk", "uart1_mux_clk", 0,
9380b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART1_CLK_ENB, 0,
9390b928af1SViresh Kumar 			&_lock);
9400b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c800000.serial");
9410b928af1SViresh Kumar 
9420b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "uart2_mux_clk", uart_parents,
9430b928af1SViresh Kumar 			ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0,
9440b928af1SViresh Kumar 			SPEAR1310_UART2_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK,
9450b928af1SViresh Kumar 			0, &_lock);
9460b928af1SViresh Kumar 	clk_register_clkdev(clk, "uart2_mux_clk", NULL);
9470b928af1SViresh Kumar 
9480b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "uart2_clk", "uart2_mux_clk", 0,
9490b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART2_CLK_ENB, 0,
9500b928af1SViresh Kumar 			&_lock);
9510b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5c900000.serial");
9520b928af1SViresh Kumar 
9530b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "uart3_mux_clk", uart_parents,
9540b928af1SViresh Kumar 			ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0,
9550b928af1SViresh Kumar 			SPEAR1310_UART3_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK,
9560b928af1SViresh Kumar 			0, &_lock);
9570b928af1SViresh Kumar 	clk_register_clkdev(clk, "uart3_mux_clk", NULL);
9580b928af1SViresh Kumar 
9590b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "uart3_clk", "uart3_mux_clk", 0,
9600b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART3_CLK_ENB, 0,
9610b928af1SViresh Kumar 			&_lock);
9620b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5ca00000.serial");
9630b928af1SViresh Kumar 
9640b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "uart4_mux_clk", uart_parents,
9650b928af1SViresh Kumar 			ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0,
9660b928af1SViresh Kumar 			SPEAR1310_UART4_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK,
9670b928af1SViresh Kumar 			0, &_lock);
9680b928af1SViresh Kumar 	clk_register_clkdev(clk, "uart4_mux_clk", NULL);
9690b928af1SViresh Kumar 
9700b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "uart4_clk", "uart4_mux_clk", 0,
9710b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART4_CLK_ENB, 0,
9720b928af1SViresh Kumar 			&_lock);
9730b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5cb00000.serial");
9740b928af1SViresh Kumar 
9750b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "uart5_mux_clk", uart_parents,
9760b928af1SViresh Kumar 			ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0,
9770b928af1SViresh Kumar 			SPEAR1310_UART5_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK,
9780b928af1SViresh Kumar 			0, &_lock);
9790b928af1SViresh Kumar 	clk_register_clkdev(clk, "uart5_mux_clk", NULL);
9800b928af1SViresh Kumar 
9810b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "uart5_clk", "uart5_mux_clk", 0,
9820b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART5_CLK_ENB, 0,
9830b928af1SViresh Kumar 			&_lock);
9840b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5cc00000.serial");
9850b928af1SViresh Kumar 
9860b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "i2c1_mux_clk", i2c_parents,
9870b928af1SViresh Kumar 			ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
9880b928af1SViresh Kumar 			SPEAR1310_I2C1_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
9890b928af1SViresh Kumar 			&_lock);
9900b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2c1_mux_clk", NULL);
9910b928af1SViresh Kumar 
9920b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2c1_clk", "i2c1_mux_clk", 0,
9930b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C1_CLK_ENB, 0,
9940b928af1SViresh Kumar 			&_lock);
9950b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5cd00000.i2c");
9960b928af1SViresh Kumar 
9970b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "i2c2_mux_clk", i2c_parents,
9980b928af1SViresh Kumar 			ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
9990b928af1SViresh Kumar 			SPEAR1310_I2C2_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
10000b928af1SViresh Kumar 			&_lock);
10010b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2c2_mux_clk", NULL);
10020b928af1SViresh Kumar 
10030b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2c2_clk", "i2c2_mux_clk", 0,
10040b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C2_CLK_ENB, 0,
10050b928af1SViresh Kumar 			&_lock);
10060b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5ce00000.i2c");
10070b928af1SViresh Kumar 
10080b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "i2c3_mux_clk", i2c_parents,
10090b928af1SViresh Kumar 			ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
10100b928af1SViresh Kumar 			SPEAR1310_I2C3_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
10110b928af1SViresh Kumar 			&_lock);
10120b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2c3_mux_clk", NULL);
10130b928af1SViresh Kumar 
10140b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2c3_clk", "i2c3_mux_clk", 0,
10150b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C3_CLK_ENB, 0,
10160b928af1SViresh Kumar 			&_lock);
10170b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5cf00000.i2c");
10180b928af1SViresh Kumar 
10190b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "i2c4_mux_clk", i2c_parents,
10200b928af1SViresh Kumar 			ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
10210b928af1SViresh Kumar 			SPEAR1310_I2C4_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
10220b928af1SViresh Kumar 			&_lock);
10230b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2c4_mux_clk", NULL);
10240b928af1SViresh Kumar 
10250b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2c4_clk", "i2c4_mux_clk", 0,
10260b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C4_CLK_ENB, 0,
10270b928af1SViresh Kumar 			&_lock);
10280b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5d000000.i2c");
10290b928af1SViresh Kumar 
10300b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "i2c5_mux_clk", i2c_parents,
10310b928af1SViresh Kumar 			ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
10320b928af1SViresh Kumar 			SPEAR1310_I2C5_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
10330b928af1SViresh Kumar 			&_lock);
10340b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2c5_mux_clk", NULL);
10350b928af1SViresh Kumar 
10360b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2c5_clk", "i2c5_mux_clk", 0,
10370b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C5_CLK_ENB, 0,
10380b928af1SViresh Kumar 			&_lock);
10390b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5d100000.i2c");
10400b928af1SViresh Kumar 
10410b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "i2c6_mux_clk", i2c_parents,
10420b928af1SViresh Kumar 			ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
10430b928af1SViresh Kumar 			SPEAR1310_I2C6_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
10440b928af1SViresh Kumar 			&_lock);
10450b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2c6_mux_clk", NULL);
10460b928af1SViresh Kumar 
10470b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2c6_clk", "i2c6_mux_clk", 0,
10480b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C6_CLK_ENB, 0,
10490b928af1SViresh Kumar 			&_lock);
10500b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5d200000.i2c");
10510b928af1SViresh Kumar 
10520b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "i2c7_mux_clk", i2c_parents,
10530b928af1SViresh Kumar 			ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0,
10540b928af1SViresh Kumar 			SPEAR1310_I2C7_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0,
10550b928af1SViresh Kumar 			&_lock);
10560b928af1SViresh Kumar 	clk_register_clkdev(clk, "i2c7_mux_clk", NULL);
10570b928af1SViresh Kumar 
10580b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "i2c7_clk", "i2c7_mux_clk", 0,
10590b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C7_CLK_ENB, 0,
10600b928af1SViresh Kumar 			&_lock);
10610b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5d300000.i2c");
10620b928af1SViresh Kumar 
10630b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "ssp1_mux_clk", ssp1_parents,
10640b928af1SViresh Kumar 			ARRAY_SIZE(ssp1_parents), 0, SPEAR1310_RAS_CTRL_REG0,
10650b928af1SViresh Kumar 			SPEAR1310_SSP1_CLK_SHIFT, SPEAR1310_SSP1_CLK_MASK, 0,
10660b928af1SViresh Kumar 			&_lock);
10670b928af1SViresh Kumar 	clk_register_clkdev(clk, "ssp1_mux_clk", NULL);
10680b928af1SViresh Kumar 
10690b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "ssp1_clk", "ssp1_mux_clk", 0,
10700b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_SSP1_CLK_ENB, 0,
10710b928af1SViresh Kumar 			&_lock);
10720b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "5d400000.spi");
10730b928af1SViresh Kumar 
10740b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "pci_mux_clk", pci_parents,
10750b928af1SViresh Kumar 			ARRAY_SIZE(pci_parents), 0, SPEAR1310_RAS_CTRL_REG0,
10760b928af1SViresh Kumar 			SPEAR1310_PCI_CLK_SHIFT, SPEAR1310_PCI_CLK_MASK, 0,
10770b928af1SViresh Kumar 			&_lock);
10780b928af1SViresh Kumar 	clk_register_clkdev(clk, "pci_mux_clk", NULL);
10790b928af1SViresh Kumar 
10800b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "pci_clk", "pci_mux_clk", 0,
10810b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_PCI_CLK_ENB, 0,
10820b928af1SViresh Kumar 			&_lock);
10830b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "pci");
10840b928af1SViresh Kumar 
10850b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "tdm1_mux_clk", tdm_parents,
10860b928af1SViresh Kumar 			ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0,
10870b928af1SViresh Kumar 			SPEAR1310_TDM1_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0,
10880b928af1SViresh Kumar 			&_lock);
10890b928af1SViresh Kumar 	clk_register_clkdev(clk, "tdm1_mux_clk", NULL);
10900b928af1SViresh Kumar 
10910b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "tdm1_clk", "tdm1_mux_clk", 0,
10920b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM1_CLK_ENB, 0,
10930b928af1SViresh Kumar 			&_lock);
10940b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "tdm_hdlc.0");
10950b928af1SViresh Kumar 
10960b928af1SViresh Kumar 	clk = clk_register_mux(NULL, "tdm2_mux_clk", tdm_parents,
10970b928af1SViresh Kumar 			ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0,
10980b928af1SViresh Kumar 			SPEAR1310_TDM2_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0,
10990b928af1SViresh Kumar 			&_lock);
11000b928af1SViresh Kumar 	clk_register_clkdev(clk, "tdm2_mux_clk", NULL);
11010b928af1SViresh Kumar 
11020b928af1SViresh Kumar 	clk = clk_register_gate(NULL, "tdm2_clk", "tdm2_mux_clk", 0,
11030b928af1SViresh Kumar 			SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM2_CLK_ENB, 0,
11040b928af1SViresh Kumar 			&_lock);
11050b928af1SViresh Kumar 	clk_register_clkdev(clk, NULL, "tdm_hdlc.1");
11060b928af1SViresh Kumar }
1107