blob: 1035caf95f419591e40fbdc6086d324b62721f3b [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/err.h>
16#include <linux/ctype.h>
17#include <linux/bitops.h>
18#include <linux/io.h>
19#include <linux/spinlock.h>
20#include <linux/delay.h>
21#include <linux/clk.h>
22
23#include <asm/clkdev.h>
24#include <asm/mach-types.h>
25
26#include <mach/msm_iomap.h>
27#include <mach/clk.h>
28#include <mach/rpm-regulator.h>
Stephen Boyd94625ef2011-07-12 17:06:01 -070029#include <mach/socinfo.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030
31#include "clock-local.h"
32#include "clock-rpm.h"
33#include "clock-voter.h"
34#include "clock-dss-8960.h"
35#include "devices.h"
Vikram Mulukutla681d8682012-03-09 23:56:20 -080036#include "clock-pll.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38#define REG(off) (MSM_CLK_CTL_BASE + (off))
39#define REG_MM(off) (MSM_MMSS_CLK_CTL_BASE + (off))
40#define REG_LPA(off) (MSM_LPASS_CLK_CTL_BASE + (off))
Matt Wagantall8b38f942011-08-02 18:23:18 -070041#define REG_GCC(off) (MSM_APCS_GCC_BASE + (off))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
43/* Peripheral clock registers. */
Stephen Boyda52d7e32011-11-10 11:59:00 -080044#define ADM0_PBUS_CLK_CTL_REG REG(0x2208)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#define CE1_HCLK_CTL_REG REG(0x2720)
46#define CE1_CORE_CLK_CTL_REG REG(0x2724)
Tianyi Gou05e01102012-02-08 22:15:49 -080047#define PRNG_CLK_NS_REG REG(0x2E80)
Tianyi Gou41515e22011-09-01 19:37:43 -070048#define CE3_HCLK_CTL_REG REG(0x36C4)
49#define CE3_CORE_CLK_CTL_REG REG(0x36CC)
50#define CE3_CLK_SRC_NS_REG REG(0x36C0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#define DMA_BAM_HCLK_CTL REG(0x25C0)
Tianyi Gou41515e22011-09-01 19:37:43 -070052#define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070053#define CLK_HALT_CFPB_STATEA_REG REG(0x2FCC)
54#define CLK_HALT_CFPB_STATEB_REG REG(0x2FD0)
55#define CLK_HALT_CFPB_STATEC_REG REG(0x2FD4)
56#define CLK_HALT_DFAB_STATE_REG REG(0x2FC8)
Tianyi Gou41515e22011-09-01 19:37:43 -070057/* 8064 name CLK_HALT_GSS_KPSS_MISC_STATE_REG */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058#define CLK_HALT_MSS_SMPSS_MISC_STATE_REG REG(0x2FDC)
59#define CLK_HALT_SFPB_MISC_STATE_REG REG(0x2FD8)
Stephen Boyd973e4ba2011-07-12 17:06:01 -070060#define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061#define CLK_TEST_REG REG(0x2FA0)
Matt Wagantall7625a4c2011-11-01 16:17:53 -070062#define GPn_MD_REG(n) REG(0x2D00+(0x20*(n)))
63#define GPn_NS_REG(n) REG(0x2D24+(0x20*(n)))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070064#define GSBIn_HCLK_CTL_REG(n) REG(0x29C0+(0x20*((n)-1)))
65#define GSBIn_QUP_APPS_MD_REG(n) REG(0x29C8+(0x20*((n)-1)))
66#define GSBIn_QUP_APPS_NS_REG(n) REG(0x29CC+(0x20*((n)-1)))
67#define GSBIn_RESET_REG(n) REG(0x29DC+(0x20*((n)-1)))
68#define GSBIn_UART_APPS_MD_REG(n) REG(0x29D0+(0x20*((n)-1)))
69#define GSBIn_UART_APPS_NS_REG(n) REG(0x29D4+(0x20*((n)-1)))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070#define PDM_CLK_NS_REG REG(0x2CC0)
Tianyi Gou41515e22011-09-01 19:37:43 -070071/* 8064 name BB_PLL_ENA_APCS_REG */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072#define BB_PLL_ENA_SC0_REG REG(0x34C0)
Tianyi Gou59608a72012-01-31 22:19:30 -080073#define BB_PLL_ENA_RPM_REG REG(0x34A0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074#define BB_PLL0_STATUS_REG REG(0x30D8)
75#define BB_PLL5_STATUS_REG REG(0x30F8)
76#define BB_PLL6_STATUS_REG REG(0x3118)
77#define BB_PLL7_STATUS_REG REG(0x3138)
78#define BB_PLL8_L_VAL_REG REG(0x3144)
79#define BB_PLL8_M_VAL_REG REG(0x3148)
80#define BB_PLL8_MODE_REG REG(0x3140)
81#define BB_PLL8_N_VAL_REG REG(0x314C)
82#define BB_PLL8_STATUS_REG REG(0x3158)
83#define BB_PLL8_CONFIG_REG REG(0x3154)
84#define BB_PLL8_TEST_CTL_REG REG(0x3150)
Stephen Boyd94625ef2011-07-12 17:06:01 -070085#define BB_MMCC_PLL2_MODE_REG REG(0x3160)
86#define BB_MMCC_PLL2_TEST_CTL_REG REG(0x3170)
Tianyi Gou41515e22011-09-01 19:37:43 -070087#define BB_PLL14_MODE_REG REG(0x31C0)
88#define BB_PLL14_L_VAL_REG REG(0x31C4)
89#define BB_PLL14_M_VAL_REG REG(0x31C8)
90#define BB_PLL14_N_VAL_REG REG(0x31CC)
91#define BB_PLL14_TEST_CTL_REG REG(0x31D0)
92#define BB_PLL14_CONFIG_REG REG(0x31D4)
Stephen Boyd94625ef2011-07-12 17:06:01 -070093#define BB_PLL14_STATUS_REG REG(0x31D8)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094#define PLLTEST_PAD_CFG_REG REG(0x2FA4)
95#define PMEM_ACLK_CTL_REG REG(0x25A0)
96#define RINGOSC_NS_REG REG(0x2DC0)
97#define RINGOSC_STATUS_REG REG(0x2DCC)
98#define RINGOSC_TCXO_CTL_REG REG(0x2DC4)
Stephen Boyda52d7e32011-11-10 11:59:00 -080099#define RPM_MSG_RAM_HCLK_CTL_REG REG(0x27E0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700100#define SC0_U_CLK_BRANCH_ENA_VOTE_REG REG(0x3080)
101#define SDCn_APPS_CLK_MD_REG(n) REG(0x2828+(0x20*((n)-1)))
102#define SDCn_APPS_CLK_NS_REG(n) REG(0x282C+(0x20*((n)-1)))
103#define SDCn_HCLK_CTL_REG(n) REG(0x2820+(0x20*((n)-1)))
104#define SDCn_RESET_REG(n) REG(0x2830+(0x20*((n)-1)))
105#define SLIMBUS_XO_SRC_CLK_CTL_REG REG(0x2628)
106#define TSIF_HCLK_CTL_REG REG(0x2700)
107#define TSIF_REF_CLK_MD_REG REG(0x270C)
108#define TSIF_REF_CLK_NS_REG REG(0x2710)
109#define TSSC_CLK_CTL_REG REG(0x2CA0)
Tianyi Gou41515e22011-09-01 19:37:43 -0700110#define SATA_CLK_SRC_NS_REG REG(0x2C08)
111#define SATA_RXOOB_CLK_CTL_REG REG(0x2C0C)
112#define SATA_PMALIVE_CLK_CTL_REG REG(0x2C10)
113#define SATA_PHY_REF_CLK_CTL_REG REG(0x2C14)
114#define SATA_PHY_CFG_CLK_CTL_REG REG(0x2C40)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700115#define USB_FSn_HCLK_CTL_REG(n) REG(0x2960+(0x20*((n)-1)))
116#define USB_FSn_RESET_REG(n) REG(0x2974+(0x20*((n)-1)))
117#define USB_FSn_SYSTEM_CLK_CTL_REG(n) REG(0x296C+(0x20*((n)-1)))
118#define USB_FSn_XCVR_FS_CLK_MD_REG(n) REG(0x2964+(0x20*((n)-1)))
119#define USB_FSn_XCVR_FS_CLK_NS_REG(n) REG(0x2968+(0x20*((n)-1)))
120#define USB_HS1_HCLK_CTL_REG REG(0x2900)
Tianyi Gou41515e22011-09-01 19:37:43 -0700121#define USB_HS1_HCLK_FS_REG REG(0x2904)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700122#define USB_HS1_RESET_REG REG(0x2910)
123#define USB_HS1_XCVR_FS_CLK_MD_REG REG(0x2908)
124#define USB_HS1_XCVR_FS_CLK_NS_REG REG(0x290C)
Tianyi Gou41515e22011-09-01 19:37:43 -0700125#define USB_HS3_HCLK_CTL_REG REG(0x3700)
126#define USB_HS3_HCLK_FS_REG REG(0x3704)
127#define USB_HS3_RESET_REG REG(0x3710)
128#define USB_HS3_XCVR_FS_CLK_MD_REG REG(0X3708)
129#define USB_HS3_XCVR_FS_CLK_NS_REG REG(0X370C)
130#define USB_HS4_HCLK_CTL_REG REG(0x3720)
131#define USB_HS4_HCLK_FS_REG REG(0x3724)
132#define USB_HS4_RESET_REG REG(0x3730)
133#define USB_HS4_XCVR_FS_CLK_MD_REG REG(0X3728)
134#define USB_HS4_XCVR_FS_CLK_NS_REG REG(0X372C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700135#define USB_HSIC_HCLK_CTL_REG REG(0x2920)
136#define USB_HSIC_HSIC_CLK_CTL_REG REG(0x2B44)
137#define USB_HSIC_HSIC_CLK_SRC_CTL_REG REG(0x2B40)
138#define USB_HSIC_HSIO_CAL_CLK_CTL_REG REG(0x2B48)
139#define USB_HSIC_RESET_REG REG(0x2934)
140#define USB_HSIC_SYSTEM_CLK_CTL_REG REG(0x292C)
141#define USB_HSIC_XCVR_FS_CLK_MD_REG REG(0x2924)
142#define USB_HSIC_XCVR_FS_CLK_NS_REG REG(0x2928)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700143#define USB_PHY0_RESET_REG REG(0x2E20)
Tianyi Gou41515e22011-09-01 19:37:43 -0700144#define PCIE_ALT_REF_CLK_NS_REG REG(0x3860)
145#define PCIE_HCLK_CTL_REG REG(0x22CC)
146#define GPLL1_MODE_REG REG(0x3160)
147#define GPLL1_L_VAL_REG REG(0x3164)
148#define GPLL1_M_VAL_REG REG(0x3168)
149#define GPLL1_N_VAL_REG REG(0x316C)
150#define GPLL1_CONFIG_REG REG(0x3174)
151#define GPLL1_STATUS_REG REG(0x3178)
152#define PXO_SRC_CLK_CTL_REG REG(0x2EA0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700153
154/* Multimedia clock registers. */
155#define AHB_EN_REG REG_MM(0x0008)
156#define AHB_EN2_REG REG_MM(0x0038)
Tianyi Gou41515e22011-09-01 19:37:43 -0700157#define AHB_EN3_REG REG_MM(0x0248)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700158#define AHB_NS_REG REG_MM(0x0004)
159#define AXI_NS_REG REG_MM(0x0014)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700160#define CAMCLK0_NS_REG REG_MM(0x0148)
161#define CAMCLK0_CC_REG REG_MM(0x0140)
162#define CAMCLK0_MD_REG REG_MM(0x0144)
163#define CAMCLK1_NS_REG REG_MM(0x015C)
164#define CAMCLK1_CC_REG REG_MM(0x0154)
165#define CAMCLK1_MD_REG REG_MM(0x0158)
166#define CAMCLK2_NS_REG REG_MM(0x0228)
167#define CAMCLK2_CC_REG REG_MM(0x0220)
168#define CAMCLK2_MD_REG REG_MM(0x0224)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700169#define CSI0_NS_REG REG_MM(0x0048)
170#define CSI0_CC_REG REG_MM(0x0040)
171#define CSI0_MD_REG REG_MM(0x0044)
172#define CSI1_NS_REG REG_MM(0x0010)
173#define CSI1_CC_REG REG_MM(0x0024)
174#define CSI1_MD_REG REG_MM(0x0028)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700175#define CSI2_NS_REG REG_MM(0x0234)
176#define CSI2_CC_REG REG_MM(0x022C)
177#define CSI2_MD_REG REG_MM(0x0230)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700178#define CSIPHYTIMER_CC_REG REG_MM(0x0160)
179#define CSIPHYTIMER_MD_REG REG_MM(0x0164)
180#define CSIPHYTIMER_NS_REG REG_MM(0x0168)
181#define DSI1_BYTE_NS_REG REG_MM(0x00B0)
182#define DSI1_BYTE_CC_REG REG_MM(0x0090)
183#define DSI2_BYTE_NS_REG REG_MM(0x00BC)
184#define DSI2_BYTE_CC_REG REG_MM(0x00B4)
185#define DSI1_ESC_NS_REG REG_MM(0x011C)
186#define DSI1_ESC_CC_REG REG_MM(0x00CC)
187#define DSI2_ESC_NS_REG REG_MM(0x0150)
188#define DSI2_ESC_CC_REG REG_MM(0x013C)
189#define DSI_PIXEL_CC_REG REG_MM(0x0130)
190#define DSI2_PIXEL_CC_REG REG_MM(0x0094)
191#define DBG_BUS_VEC_A_REG REG_MM(0x01C8)
192#define DBG_BUS_VEC_B_REG REG_MM(0x01CC)
193#define DBG_BUS_VEC_C_REG REG_MM(0x01D0)
194#define DBG_BUS_VEC_D_REG REG_MM(0x01D4)
195#define DBG_BUS_VEC_E_REG REG_MM(0x01D8)
196#define DBG_BUS_VEC_F_REG REG_MM(0x01DC)
197#define DBG_BUS_VEC_G_REG REG_MM(0x01E0)
198#define DBG_BUS_VEC_H_REG REG_MM(0x01E4)
199#define DBG_BUS_VEC_I_REG REG_MM(0x01E8)
Tianyi Gou41515e22011-09-01 19:37:43 -0700200#define DBG_BUS_VEC_J_REG REG_MM(0x0240)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700201#define DBG_CFG_REG_HS_REG REG_MM(0x01B4)
202#define DBG_CFG_REG_LS_REG REG_MM(0x01B8)
203#define GFX2D0_CC_REG REG_MM(0x0060)
204#define GFX2D0_MD0_REG REG_MM(0x0064)
205#define GFX2D0_MD1_REG REG_MM(0x0068)
206#define GFX2D0_NS_REG REG_MM(0x0070)
207#define GFX2D1_CC_REG REG_MM(0x0074)
208#define GFX2D1_MD0_REG REG_MM(0x0078)
209#define GFX2D1_MD1_REG REG_MM(0x006C)
210#define GFX2D1_NS_REG REG_MM(0x007C)
211#define GFX3D_CC_REG REG_MM(0x0080)
212#define GFX3D_MD0_REG REG_MM(0x0084)
213#define GFX3D_MD1_REG REG_MM(0x0088)
214#define GFX3D_NS_REG REG_MM(0x008C)
215#define IJPEG_CC_REG REG_MM(0x0098)
216#define IJPEG_MD_REG REG_MM(0x009C)
217#define IJPEG_NS_REG REG_MM(0x00A0)
218#define JPEGD_CC_REG REG_MM(0x00A4)
219#define JPEGD_NS_REG REG_MM(0x00AC)
Tianyi Gou41515e22011-09-01 19:37:43 -0700220#define VCAP_CC_REG REG_MM(0x0178)
221#define VCAP_NS_REG REG_MM(0x021C)
222#define VCAP_MD0_REG REG_MM(0x01EC)
223#define VCAP_MD1_REG REG_MM(0x0218)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700224#define MAXI_EN_REG REG_MM(0x0018)
225#define MAXI_EN2_REG REG_MM(0x0020)
226#define MAXI_EN3_REG REG_MM(0x002C)
227#define MAXI_EN4_REG REG_MM(0x0114)
Tianyi Gou41515e22011-09-01 19:37:43 -0700228#define MAXI_EN5_REG REG_MM(0x0244)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700229#define MDP_CC_REG REG_MM(0x00C0)
230#define MDP_LUT_CC_REG REG_MM(0x016C)
231#define MDP_MD0_REG REG_MM(0x00C4)
232#define MDP_MD1_REG REG_MM(0x00C8)
233#define MDP_NS_REG REG_MM(0x00D0)
234#define MISC_CC_REG REG_MM(0x0058)
235#define MISC_CC2_REG REG_MM(0x005C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700236#define MISC_CC3_REG REG_MM(0x0238)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700237#define MM_PLL1_MODE_REG REG_MM(0x031C)
Tianyi Gou41515e22011-09-01 19:37:43 -0700238#define MM_PLL1_L_VAL_REG REG_MM(0x0320)
239#define MM_PLL1_M_VAL_REG REG_MM(0x0324)
240#define MM_PLL1_N_VAL_REG REG_MM(0x0328)
241#define MM_PLL1_CONFIG_REG REG_MM(0x032C)
242#define MM_PLL1_TEST_CTL_REG REG_MM(0x0330)
243#define MM_PLL1_STATUS_REG REG_MM(0x0334)
244#define MM_PLL3_MODE_REG REG_MM(0x0338)
Tianyi Gou621f8742011-09-01 21:45:01 -0700245#define MM_PLL3_L_VAL_REG REG_MM(0x033C)
246#define MM_PLL3_M_VAL_REG REG_MM(0x0340)
247#define MM_PLL3_N_VAL_REG REG_MM(0x0344)
248#define MM_PLL3_CONFIG_REG REG_MM(0x0348)
249#define MM_PLL3_TEST_CTL_REG REG_MM(0x034C)
250#define MM_PLL3_STATUS_REG REG_MM(0x0350)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700251#define ROT_CC_REG REG_MM(0x00E0)
252#define ROT_NS_REG REG_MM(0x00E8)
253#define SAXI_EN_REG REG_MM(0x0030)
254#define SW_RESET_AHB_REG REG_MM(0x020C)
255#define SW_RESET_AHB2_REG REG_MM(0x0200)
256#define SW_RESET_ALL_REG REG_MM(0x0204)
257#define SW_RESET_AXI_REG REG_MM(0x0208)
258#define SW_RESET_CORE_REG REG_MM(0x0210)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700259#define SW_RESET_CORE2_REG REG_MM(0x0214)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700260#define TV_CC_REG REG_MM(0x00EC)
261#define TV_CC2_REG REG_MM(0x0124)
262#define TV_MD_REG REG_MM(0x00F0)
263#define TV_NS_REG REG_MM(0x00F4)
264#define VCODEC_CC_REG REG_MM(0x00F8)
265#define VCODEC_MD0_REG REG_MM(0x00FC)
266#define VCODEC_MD1_REG REG_MM(0x0128)
267#define VCODEC_NS_REG REG_MM(0x0100)
268#define VFE_CC_REG REG_MM(0x0104)
269#define VFE_MD_REG REG_MM(0x0108)
270#define VFE_NS_REG REG_MM(0x010C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700271#define VFE_CC2_REG REG_MM(0x023C)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700272#define VPE_CC_REG REG_MM(0x0110)
273#define VPE_NS_REG REG_MM(0x0118)
274
275/* Low-power Audio clock registers. */
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700276#define LCC_CLK_HS_DEBUG_CFG_REG REG_LPA(0x00A4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700277#define LCC_CLK_LS_DEBUG_CFG_REG REG_LPA(0x00A8)
278#define LCC_CODEC_I2S_MIC_MD_REG REG_LPA(0x0064)
279#define LCC_CODEC_I2S_MIC_NS_REG REG_LPA(0x0060)
280#define LCC_CODEC_I2S_MIC_STATUS_REG REG_LPA(0x0068)
281#define LCC_CODEC_I2S_SPKR_MD_REG REG_LPA(0x0070)
282#define LCC_CODEC_I2S_SPKR_NS_REG REG_LPA(0x006C)
283#define LCC_CODEC_I2S_SPKR_STATUS_REG REG_LPA(0x0074)
284#define LCC_MI2S_MD_REG REG_LPA(0x004C)
285#define LCC_MI2S_NS_REG REG_LPA(0x0048)
286#define LCC_MI2S_STATUS_REG REG_LPA(0x0050)
287#define LCC_PCM_MD_REG REG_LPA(0x0058)
288#define LCC_PCM_NS_REG REG_LPA(0x0054)
289#define LCC_PCM_STATUS_REG REG_LPA(0x005C)
Tianyi Gouc29c3242011-10-12 21:02:15 -0700290#define LCC_PLL0_MODE_REG REG_LPA(0x0000)
291#define LCC_PLL0_L_VAL_REG REG_LPA(0x0004)
292#define LCC_PLL0_M_VAL_REG REG_LPA(0x0008)
293#define LCC_PLL0_N_VAL_REG REG_LPA(0x000C)
294#define LCC_PLL0_CONFIG_REG REG_LPA(0x0014)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700295#define LCC_PLL0_STATUS_REG REG_LPA(0x0018)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700296#define LCC_SPARE_I2S_MIC_MD_REG REG_LPA(0x007C)
297#define LCC_SPARE_I2S_MIC_NS_REG REG_LPA(0x0078)
298#define LCC_SPARE_I2S_MIC_STATUS_REG REG_LPA(0x0080)
299#define LCC_SPARE_I2S_SPKR_MD_REG REG_LPA(0x0088)
300#define LCC_SPARE_I2S_SPKR_NS_REG REG_LPA(0x0084)
301#define LCC_SPARE_I2S_SPKR_STATUS_REG REG_LPA(0x008C)
302#define LCC_SLIMBUS_NS_REG REG_LPA(0x00CC)
303#define LCC_SLIMBUS_MD_REG REG_LPA(0x00D0)
304#define LCC_SLIMBUS_STATUS_REG REG_LPA(0x00D4)
305#define LCC_AHBEX_BRANCH_CTL_REG REG_LPA(0x00E4)
Tianyi Gouc29c3242011-10-12 21:02:15 -0700306#define LCC_PRI_PLL_CLK_CTL_REG REG_LPA(0x00C4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700307
Matt Wagantall8b38f942011-08-02 18:23:18 -0700308#define GCC_APCS_CLK_DIAG REG_GCC(0x001C)
309
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700310/* MUX source input identifiers. */
311#define pxo_to_bb_mux 0
Matt Wagantall7625a4c2011-11-01 16:17:53 -0700312#define cxo_to_bb_mux 5
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313#define pll0_to_bb_mux 2
314#define pll8_to_bb_mux 3
315#define pll6_to_bb_mux 4
316#define gnd_to_bb_mux 5
Stephen Boyd94625ef2011-07-12 17:06:01 -0700317#define pll3_to_bb_mux 6
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700318#define pxo_to_mm_mux 0
319#define pll1_to_mm_mux 1
Tianyi Gou41515e22011-09-01 19:37:43 -0700320#define pll2_to_mm_mux 1 /* or MMCC_PLL1 */
321#define pll8_to_mm_mux 2 /* or GCC_PERF */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322#define pll0_to_mm_mux 3
Tianyi Gou41515e22011-09-01 19:37:43 -0700323#define pll15_to_mm_mux 3 /* or MM_PLL3 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324#define gnd_to_mm_mux 4
Stephen Boyd7a776cd2011-10-20 12:46:04 -0700325#define pll3_to_mm_mux 3 /* or MMCC_PLL2 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700326#define hdmi_pll_to_mm_mux 3
327#define cxo_to_xo_mux 0
328#define pxo_to_xo_mux 1
329#define gnd_to_xo_mux 3
330#define pxo_to_lpa_mux 0
331#define cxo_to_lpa_mux 1
332#define pll4_to_lpa_mux 2
333#define gnd_to_lpa_mux 6
Tianyi Gou41515e22011-09-01 19:37:43 -0700334#define pxo_to_pcie_mux 0
335#define pll3_to_pcie_mux 1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700336
337/* Test Vector Macros */
338#define TEST_TYPE_PER_LS 1
339#define TEST_TYPE_PER_HS 2
340#define TEST_TYPE_MM_LS 3
341#define TEST_TYPE_MM_HS 4
342#define TEST_TYPE_LPA 5
Matt Wagantall8b38f942011-08-02 18:23:18 -0700343#define TEST_TYPE_CPUL2 6
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700344#define TEST_TYPE_LPA_HS 7
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345#define TEST_TYPE_SHIFT 24
346#define TEST_CLK_SEL_MASK BM(23, 0)
347#define TEST_VECTOR(s, t) (((t) << TEST_TYPE_SHIFT) | BVAL(23, 0, (s)))
348#define TEST_PER_LS(s) TEST_VECTOR((s), TEST_TYPE_PER_LS)
349#define TEST_PER_HS(s) TEST_VECTOR((s), TEST_TYPE_PER_HS)
350#define TEST_MM_LS(s) TEST_VECTOR((s), TEST_TYPE_MM_LS)
351#define TEST_MM_HS(s) TEST_VECTOR((s), TEST_TYPE_MM_HS)
352#define TEST_LPA(s) TEST_VECTOR((s), TEST_TYPE_LPA)
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700353#define TEST_LPA_HS(s) TEST_VECTOR((s), TEST_TYPE_LPA_HS)
Matt Wagantall8b38f942011-08-02 18:23:18 -0700354#define TEST_CPUL2(s) TEST_VECTOR((s), TEST_TYPE_CPUL2)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700355
356#define MN_MODE_DUAL_EDGE 0x2
357
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700358struct pll_rate {
359 const uint32_t l_val;
360 const uint32_t m_val;
361 const uint32_t n_val;
362 const uint32_t vco;
363 const uint32_t post_div;
364 const uint32_t i_bits;
365};
366#define PLL_RATE(l, m, n, v, d, i) { l, m, n, v, (d>>1), i }
367
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700368enum vdd_dig_levels {
369 VDD_DIG_NONE,
370 VDD_DIG_LOW,
371 VDD_DIG_NOMINAL,
372 VDD_DIG_HIGH
373};
374
Saravana Kannan298ec392012-02-08 19:21:47 -0800375static int set_vdd_dig_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700376{
377 static const int vdd_uv[] = {
378 [VDD_DIG_NONE] = 0,
379 [VDD_DIG_LOW] = 945000,
380 [VDD_DIG_NOMINAL] = 1050000,
381 [VDD_DIG_HIGH] = 1150000
382 };
Saravana Kannan298ec392012-02-08 19:21:47 -0800383 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S3, RPM_VREG_VOTER3,
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700384 vdd_uv[level], 1150000, 1);
385}
386
Saravana Kannan298ec392012-02-08 19:21:47 -0800387static DEFINE_VDD_CLASS(vdd_dig, set_vdd_dig_8960);
388
389static int set_vdd_dig_8930(struct clk_vdd_class *vdd_class, int level)
390{
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800391 static const int vdd_corner[] = {
392 [VDD_DIG_NONE] = RPM_VREG_CORNER_NONE,
393 [VDD_DIG_LOW] = RPM_VREG_CORNER_LOW,
394 [VDD_DIG_NOMINAL] = RPM_VREG_CORNER_NOMINAL,
395 [VDD_DIG_HIGH] = RPM_VREG_CORNER_HIGH,
Saravana Kannan298ec392012-02-08 19:21:47 -0800396 };
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800397 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8038_VDD_DIG_CORNER,
398 RPM_VREG_VOTER3,
399 vdd_corner[level],
400 RPM_VREG_CORNER_HIGH, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800401}
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700402
403#define VDD_DIG_FMAX_MAP1(l1, f1) \
404 .vdd_class = &vdd_dig, \
405 .fmax[VDD_DIG_##l1] = (f1)
406#define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \
407 .vdd_class = &vdd_dig, \
408 .fmax[VDD_DIG_##l1] = (f1), \
409 .fmax[VDD_DIG_##l2] = (f2)
410#define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \
411 .vdd_class = &vdd_dig, \
412 .fmax[VDD_DIG_##l1] = (f1), \
413 .fmax[VDD_DIG_##l2] = (f2), \
414 .fmax[VDD_DIG_##l3] = (f3)
415
Tianyi Goue1faaf22012-01-24 16:07:19 -0800416enum vdd_sr2_pll_levels {
417 VDD_SR2_PLL_OFF,
418 VDD_SR2_PLL_ON
Matt Wagantallc57577d2011-10-06 17:06:53 -0700419};
420
Saravana Kannan298ec392012-02-08 19:21:47 -0800421static int set_vdd_sr2_pll_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantallc57577d2011-10-06 17:06:53 -0700422{
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800423 int rc = 0;
Saravana Kannan298ec392012-02-08 19:21:47 -0800424
425 if (level == VDD_SR2_PLL_OFF) {
426 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
427 RPM_VREG_VOTER3, 0, 0, 1);
428 if (rc)
429 return rc;
430 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
431 RPM_VREG_VOTER3, 0, 0, 1);
432 if (rc)
433 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
434 RPM_VREG_VOTER3, 1800000, 1800000, 1);
Tianyi Goue1faaf22012-01-24 16:07:19 -0800435 } else {
Saravana Kannan298ec392012-02-08 19:21:47 -0800436 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
David Collins9a81d6c2012-03-29 15:11:33 -0700437 RPM_VREG_VOTER3, 2050000, 2100000, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800438 if (rc)
439 return rc;
440 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
441 RPM_VREG_VOTER3, 1800000, 1800000, 1);
442 if (rc)
443 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800444 RPM_VREG_VOTER3, 0, 0, 1);
Matt Wagantallc57577d2011-10-06 17:06:53 -0700445 }
446
447 return rc;
448}
449
Saravana Kannan298ec392012-02-08 19:21:47 -0800450static DEFINE_VDD_CLASS(vdd_sr2_pll, set_vdd_sr2_pll_8960);
451
452static int sr2_lreg_uv[] = {
453 [VDD_SR2_PLL_OFF] = 0,
454 [VDD_SR2_PLL_ON] = 1800000,
455};
456
457static int set_vdd_sr2_pll_8064(struct clk_vdd_class *vdd_class, int level)
458{
459 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_LVS7, RPM_VREG_VOTER3,
460 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
461}
462
463static int set_vdd_sr2_pll_8930(struct clk_vdd_class *vdd_class, int level)
464{
465 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8038_L23, RPM_VREG_VOTER3,
466 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
467}
Matt Wagantallc57577d2011-10-06 17:06:53 -0700468
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700469/*
470 * Clock Descriptions
471 */
472
Stephen Boyd72a80352012-01-26 15:57:38 -0800473DEFINE_CLK_RPM_BRANCH(pxo_clk, pxo_a_clk, PXO, 27000000);
474DEFINE_CLK_RPM_BRANCH(cxo_clk, cxo_a_clk, CXO, 19200000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700475
476static struct pll_clk pll2_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700477 .mode_reg = MM_PLL1_MODE_REG,
478 .parent = &pxo_clk.c,
479 .c = {
480 .dbg_name = "pll2_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800481 .rate = 800000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800482 .ops = &clk_ops_local_pll,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700483 CLK_INIT(pll2_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800484 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700485 },
486};
487
Stephen Boyd94625ef2011-07-12 17:06:01 -0700488static struct pll_clk pll3_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700489 .mode_reg = BB_MMCC_PLL2_MODE_REG,
490 .parent = &pxo_clk.c,
491 .c = {
492 .dbg_name = "pll3_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800493 .rate = 1200000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800494 .ops = &clk_ops_local_pll,
Tianyi Goue1faaf22012-01-24 16:07:19 -0800495 .vdd_class = &vdd_sr2_pll,
496 .fmax[VDD_SR2_PLL_ON] = ULONG_MAX,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700497 CLK_INIT(pll3_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800498 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700499 },
500};
501
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700502static struct pll_vote_clk pll4_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700503 .en_reg = BB_PLL_ENA_SC0_REG,
504 .en_mask = BIT(4),
505 .status_reg = LCC_PLL0_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800506 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700507 .parent = &pxo_clk.c,
508 .c = {
509 .dbg_name = "pll4_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800510 .rate = 393216000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700511 .ops = &clk_ops_pll_vote,
512 CLK_INIT(pll4_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800513 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700514 },
515};
516
517static struct pll_vote_clk pll8_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700518 .en_reg = BB_PLL_ENA_SC0_REG,
519 .en_mask = BIT(8),
520 .status_reg = BB_PLL8_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800521 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700522 .parent = &pxo_clk.c,
523 .c = {
524 .dbg_name = "pll8_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800525 .rate = 384000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700526 .ops = &clk_ops_pll_vote,
527 CLK_INIT(pll8_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800528 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700529 },
530};
531
Stephen Boyd94625ef2011-07-12 17:06:01 -0700532static struct pll_vote_clk pll14_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700533 .en_reg = BB_PLL_ENA_SC0_REG,
534 .en_mask = BIT(14),
535 .status_reg = BB_PLL14_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800536 .status_mask = BIT(16),
Stephen Boyd94625ef2011-07-12 17:06:01 -0700537 .parent = &pxo_clk.c,
538 .c = {
539 .dbg_name = "pll14_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800540 .rate = 480000000,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700541 .ops = &clk_ops_pll_vote,
542 CLK_INIT(pll14_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800543 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700544 },
545};
546
Tianyi Gou41515e22011-09-01 19:37:43 -0700547static struct pll_clk pll15_clk = {
Tianyi Gou41515e22011-09-01 19:37:43 -0700548 .mode_reg = MM_PLL3_MODE_REG,
549 .parent = &pxo_clk.c,
550 .c = {
551 .dbg_name = "pll15_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800552 .rate = 975000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800553 .ops = &clk_ops_local_pll,
Tianyi Gou41515e22011-09-01 19:37:43 -0700554 CLK_INIT(pll15_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800555 .warned = true,
Tianyi Gou41515e22011-09-01 19:37:43 -0700556 },
557};
558
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700559/* AXI Interfaces */
560static struct branch_clk gmem_axi_clk = {
561 .b = {
562 .ctl_reg = MAXI_EN_REG,
563 .en_mask = BIT(24),
564 .halt_reg = DBG_BUS_VEC_E_REG,
565 .halt_bit = 6,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800566 .retain_reg = MAXI_EN2_REG,
567 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568 },
569 .c = {
570 .dbg_name = "gmem_axi_clk",
571 .ops = &clk_ops_branch,
572 CLK_INIT(gmem_axi_clk.c),
573 },
574};
575
576static struct branch_clk ijpeg_axi_clk = {
577 .b = {
578 .ctl_reg = MAXI_EN_REG,
579 .en_mask = BIT(21),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800580 .hwcg_reg = MAXI_EN_REG,
581 .hwcg_mask = BIT(11),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582 .reset_reg = SW_RESET_AXI_REG,
583 .reset_mask = BIT(14),
584 .halt_reg = DBG_BUS_VEC_E_REG,
585 .halt_bit = 4,
586 },
587 .c = {
588 .dbg_name = "ijpeg_axi_clk",
589 .ops = &clk_ops_branch,
590 CLK_INIT(ijpeg_axi_clk.c),
591 },
592};
593
594static struct branch_clk imem_axi_clk = {
595 .b = {
596 .ctl_reg = MAXI_EN_REG,
597 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800598 .hwcg_reg = MAXI_EN_REG,
599 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700600 .reset_reg = SW_RESET_CORE_REG,
601 .reset_mask = BIT(10),
602 .halt_reg = DBG_BUS_VEC_E_REG,
603 .halt_bit = 7,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800604 .retain_reg = MAXI_EN2_REG,
605 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 },
607 .c = {
608 .dbg_name = "imem_axi_clk",
609 .ops = &clk_ops_branch,
610 CLK_INIT(imem_axi_clk.c),
611 },
612};
613
614static struct branch_clk jpegd_axi_clk = {
615 .b = {
616 .ctl_reg = MAXI_EN_REG,
617 .en_mask = BIT(25),
618 .halt_reg = DBG_BUS_VEC_E_REG,
619 .halt_bit = 5,
620 },
621 .c = {
622 .dbg_name = "jpegd_axi_clk",
623 .ops = &clk_ops_branch,
624 CLK_INIT(jpegd_axi_clk.c),
625 },
626};
627
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700628static struct branch_clk vcodec_axi_b_clk = {
629 .b = {
630 .ctl_reg = MAXI_EN4_REG,
631 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800632 .hwcg_reg = MAXI_EN4_REG,
633 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700634 .halt_reg = DBG_BUS_VEC_I_REG,
635 .halt_bit = 25,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800636 .retain_reg = MAXI_EN4_REG,
637 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700638 },
639 .c = {
640 .dbg_name = "vcodec_axi_b_clk",
641 .ops = &clk_ops_branch,
642 CLK_INIT(vcodec_axi_b_clk.c),
643 },
644};
645
Matt Wagantall91f42702011-07-14 12:01:15 -0700646static struct branch_clk vcodec_axi_a_clk = {
647 .b = {
648 .ctl_reg = MAXI_EN4_REG,
649 .en_mask = BIT(25),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800650 .hwcg_reg = MAXI_EN4_REG,
651 .hwcg_mask = BIT(24),
Matt Wagantall91f42702011-07-14 12:01:15 -0700652 .halt_reg = DBG_BUS_VEC_I_REG,
653 .halt_bit = 26,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800654 .retain_reg = MAXI_EN4_REG,
655 .retain_mask = BIT(10),
Matt Wagantall91f42702011-07-14 12:01:15 -0700656 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700657 .c = {
658 .dbg_name = "vcodec_axi_a_clk",
659 .ops = &clk_ops_branch,
660 CLK_INIT(vcodec_axi_a_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700661 .depends = &vcodec_axi_b_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700662 },
663};
664
665static struct branch_clk vcodec_axi_clk = {
666 .b = {
667 .ctl_reg = MAXI_EN_REG,
668 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800669 .hwcg_reg = MAXI_EN_REG,
670 .hwcg_mask = BIT(13),
Matt Wagantall91f42702011-07-14 12:01:15 -0700671 .reset_reg = SW_RESET_AXI_REG,
Gopikrishnaiah Anandan83b6e852012-01-05 17:47:02 -0800672 .reset_mask = BIT(4)|BIT(5)|BIT(7),
Matt Wagantall91f42702011-07-14 12:01:15 -0700673 .halt_reg = DBG_BUS_VEC_E_REG,
674 .halt_bit = 3,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800675 .retain_reg = MAXI_EN2_REG,
676 .retain_mask = BIT(28),
Matt Wagantall91f42702011-07-14 12:01:15 -0700677 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700678 .c = {
679 .dbg_name = "vcodec_axi_clk",
680 .ops = &clk_ops_branch,
681 CLK_INIT(vcodec_axi_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700682 .depends = &vcodec_axi_a_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700683 },
684};
685
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700686static struct branch_clk vfe_axi_clk = {
687 .b = {
688 .ctl_reg = MAXI_EN_REG,
689 .en_mask = BIT(18),
690 .reset_reg = SW_RESET_AXI_REG,
691 .reset_mask = BIT(9),
692 .halt_reg = DBG_BUS_VEC_E_REG,
693 .halt_bit = 0,
694 },
695 .c = {
696 .dbg_name = "vfe_axi_clk",
697 .ops = &clk_ops_branch,
698 CLK_INIT(vfe_axi_clk.c),
699 },
700};
701
702static struct branch_clk mdp_axi_clk = {
703 .b = {
704 .ctl_reg = MAXI_EN_REG,
705 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800706 .hwcg_reg = MAXI_EN_REG,
707 .hwcg_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700708 .reset_reg = SW_RESET_AXI_REG,
709 .reset_mask = BIT(13),
710 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700711 .halt_bit = 8,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800712 .retain_reg = MAXI_EN_REG,
713 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700714 },
715 .c = {
716 .dbg_name = "mdp_axi_clk",
717 .ops = &clk_ops_branch,
718 CLK_INIT(mdp_axi_clk.c),
719 },
720};
721
722static struct branch_clk rot_axi_clk = {
723 .b = {
724 .ctl_reg = MAXI_EN2_REG,
725 .en_mask = BIT(24),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800726 .hwcg_reg = MAXI_EN2_REG,
727 .hwcg_mask = BIT(25),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700728 .reset_reg = SW_RESET_AXI_REG,
729 .reset_mask = BIT(6),
730 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700731 .halt_bit = 2,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800732 .retain_reg = MAXI_EN3_REG,
733 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700734 },
735 .c = {
736 .dbg_name = "rot_axi_clk",
737 .ops = &clk_ops_branch,
738 CLK_INIT(rot_axi_clk.c),
739 },
740};
741
742static struct branch_clk vpe_axi_clk = {
743 .b = {
744 .ctl_reg = MAXI_EN2_REG,
745 .en_mask = BIT(26),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800746 .hwcg_reg = MAXI_EN2_REG,
747 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700748 .reset_reg = SW_RESET_AXI_REG,
749 .reset_mask = BIT(15),
750 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700751 .halt_bit = 1,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800752 .retain_reg = MAXI_EN3_REG,
753 .retain_mask = BIT(21),
754
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700755 },
756 .c = {
757 .dbg_name = "vpe_axi_clk",
758 .ops = &clk_ops_branch,
759 CLK_INIT(vpe_axi_clk.c),
760 },
761};
762
Tianyi Gou41515e22011-09-01 19:37:43 -0700763static struct branch_clk vcap_axi_clk = {
764 .b = {
765 .ctl_reg = MAXI_EN5_REG,
766 .en_mask = BIT(12),
767 .reset_reg = SW_RESET_AXI_REG,
768 .reset_mask = BIT(16),
769 .halt_reg = DBG_BUS_VEC_J_REG,
770 .halt_bit = 20,
771 },
772 .c = {
773 .dbg_name = "vcap_axi_clk",
774 .ops = &clk_ops_branch,
775 CLK_INIT(vcap_axi_clk.c),
776 },
777};
778
Tianyi Goue3d4f542012-03-15 17:06:45 -0700779/* gfx3d_axi_clk is set as a dependency of gmem_axi_clk at runtime */
780static struct branch_clk gfx3d_axi_clk_8064 = {
Tianyi Gou621f8742011-09-01 21:45:01 -0700781 .b = {
782 .ctl_reg = MAXI_EN5_REG,
783 .en_mask = BIT(25),
784 .reset_reg = SW_RESET_AXI_REG,
785 .reset_mask = BIT(17),
786 .halt_reg = DBG_BUS_VEC_J_REG,
787 .halt_bit = 30,
788 },
789 .c = {
790 .dbg_name = "gfx3d_axi_clk",
791 .ops = &clk_ops_branch,
Tianyi Goue3d4f542012-03-15 17:06:45 -0700792 CLK_INIT(gfx3d_axi_clk_8064.c),
793 },
794};
795
796static struct branch_clk gfx3d_axi_clk_8930 = {
797 .b = {
798 .ctl_reg = MAXI_EN5_REG,
799 .en_mask = BIT(12),
800 .reset_reg = SW_RESET_AXI_REG,
801 .reset_mask = BIT(16),
802 .halt_reg = DBG_BUS_VEC_J_REG,
803 .halt_bit = 12,
804 },
805 .c = {
806 .dbg_name = "gfx3d_axi_clk",
807 .ops = &clk_ops_branch,
808 CLK_INIT(gfx3d_axi_clk_8930.c),
Tianyi Gou621f8742011-09-01 21:45:01 -0700809 },
810};
811
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700812/* AHB Interfaces */
813static struct branch_clk amp_p_clk = {
814 .b = {
815 .ctl_reg = AHB_EN_REG,
816 .en_mask = BIT(24),
Matt Wagantalld40857a2012-04-10 19:15:43 -0700817 .reset_reg = SW_RESET_CORE_REG,
818 .reset_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700819 .halt_reg = DBG_BUS_VEC_F_REG,
820 .halt_bit = 18,
821 },
822 .c = {
823 .dbg_name = "amp_p_clk",
824 .ops = &clk_ops_branch,
825 CLK_INIT(amp_p_clk.c),
826 },
827};
828
Matt Wagantallc23eee92011-08-16 23:06:52 -0700829static struct branch_clk csi_p_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700830 .b = {
831 .ctl_reg = AHB_EN_REG,
832 .en_mask = BIT(7),
833 .reset_reg = SW_RESET_AHB_REG,
834 .reset_mask = BIT(17),
835 .halt_reg = DBG_BUS_VEC_F_REG,
836 .halt_bit = 16,
837 },
838 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -0700839 .dbg_name = "csi_p_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700840 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -0700841 CLK_INIT(csi_p_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700842 },
843};
844
845static struct branch_clk dsi1_m_p_clk = {
846 .b = {
847 .ctl_reg = AHB_EN_REG,
848 .en_mask = BIT(9),
849 .reset_reg = SW_RESET_AHB_REG,
850 .reset_mask = BIT(6),
851 .halt_reg = DBG_BUS_VEC_F_REG,
852 .halt_bit = 19,
853 },
854 .c = {
855 .dbg_name = "dsi1_m_p_clk",
856 .ops = &clk_ops_branch,
857 CLK_INIT(dsi1_m_p_clk.c),
858 },
859};
860
861static struct branch_clk dsi1_s_p_clk = {
862 .b = {
863 .ctl_reg = AHB_EN_REG,
864 .en_mask = BIT(18),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800865 .hwcg_reg = AHB_EN2_REG,
866 .hwcg_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700867 .reset_reg = SW_RESET_AHB_REG,
868 .reset_mask = BIT(5),
869 .halt_reg = DBG_BUS_VEC_F_REG,
870 .halt_bit = 21,
871 },
872 .c = {
873 .dbg_name = "dsi1_s_p_clk",
874 .ops = &clk_ops_branch,
875 CLK_INIT(dsi1_s_p_clk.c),
876 },
877};
878
879static struct branch_clk dsi2_m_p_clk = {
880 .b = {
881 .ctl_reg = AHB_EN_REG,
882 .en_mask = BIT(17),
883 .reset_reg = SW_RESET_AHB2_REG,
884 .reset_mask = BIT(1),
885 .halt_reg = DBG_BUS_VEC_E_REG,
886 .halt_bit = 18,
887 },
888 .c = {
889 .dbg_name = "dsi2_m_p_clk",
890 .ops = &clk_ops_branch,
891 CLK_INIT(dsi2_m_p_clk.c),
892 },
893};
894
895static struct branch_clk dsi2_s_p_clk = {
896 .b = {
897 .ctl_reg = AHB_EN_REG,
898 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800899 .hwcg_reg = AHB_EN2_REG,
900 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700901 .reset_reg = SW_RESET_AHB2_REG,
902 .reset_mask = BIT(0),
903 .halt_reg = DBG_BUS_VEC_F_REG,
904 .halt_bit = 20,
905 },
906 .c = {
907 .dbg_name = "dsi2_s_p_clk",
908 .ops = &clk_ops_branch,
909 CLK_INIT(dsi2_s_p_clk.c),
910 },
911};
912
913static struct branch_clk gfx2d0_p_clk = {
914 .b = {
915 .ctl_reg = AHB_EN_REG,
916 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800917 .hwcg_reg = AHB_EN2_REG,
918 .hwcg_mask = BIT(28),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700919 .reset_reg = SW_RESET_AHB_REG,
920 .reset_mask = BIT(12),
921 .halt_reg = DBG_BUS_VEC_F_REG,
922 .halt_bit = 2,
923 },
924 .c = {
925 .dbg_name = "gfx2d0_p_clk",
926 .ops = &clk_ops_branch,
927 CLK_INIT(gfx2d0_p_clk.c),
928 },
929};
930
931static struct branch_clk gfx2d1_p_clk = {
932 .b = {
933 .ctl_reg = AHB_EN_REG,
934 .en_mask = BIT(2),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800935 .hwcg_reg = AHB_EN2_REG,
936 .hwcg_mask = BIT(29),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700937 .reset_reg = SW_RESET_AHB_REG,
938 .reset_mask = BIT(11),
939 .halt_reg = DBG_BUS_VEC_F_REG,
940 .halt_bit = 3,
941 },
942 .c = {
943 .dbg_name = "gfx2d1_p_clk",
944 .ops = &clk_ops_branch,
945 CLK_INIT(gfx2d1_p_clk.c),
946 },
947};
948
949static struct branch_clk gfx3d_p_clk = {
950 .b = {
951 .ctl_reg = AHB_EN_REG,
952 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800953 .hwcg_reg = AHB_EN2_REG,
954 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700955 .reset_reg = SW_RESET_AHB_REG,
956 .reset_mask = BIT(10),
957 .halt_reg = DBG_BUS_VEC_F_REG,
958 .halt_bit = 4,
959 },
960 .c = {
961 .dbg_name = "gfx3d_p_clk",
962 .ops = &clk_ops_branch,
963 CLK_INIT(gfx3d_p_clk.c),
964 },
965};
966
967static struct branch_clk hdmi_m_p_clk = {
968 .b = {
969 .ctl_reg = AHB_EN_REG,
970 .en_mask = BIT(14),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800971 .hwcg_reg = AHB_EN2_REG,
972 .hwcg_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700973 .reset_reg = SW_RESET_AHB_REG,
974 .reset_mask = BIT(9),
975 .halt_reg = DBG_BUS_VEC_F_REG,
976 .halt_bit = 5,
977 },
978 .c = {
979 .dbg_name = "hdmi_m_p_clk",
980 .ops = &clk_ops_branch,
981 CLK_INIT(hdmi_m_p_clk.c),
982 },
983};
984
985static struct branch_clk hdmi_s_p_clk = {
986 .b = {
987 .ctl_reg = AHB_EN_REG,
988 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800989 .hwcg_reg = AHB_EN2_REG,
990 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700991 .reset_reg = SW_RESET_AHB_REG,
992 .reset_mask = BIT(9),
993 .halt_reg = DBG_BUS_VEC_F_REG,
994 .halt_bit = 6,
995 },
996 .c = {
997 .dbg_name = "hdmi_s_p_clk",
998 .ops = &clk_ops_branch,
999 CLK_INIT(hdmi_s_p_clk.c),
1000 },
1001};
1002
1003static struct branch_clk ijpeg_p_clk = {
1004 .b = {
1005 .ctl_reg = AHB_EN_REG,
1006 .en_mask = BIT(5),
1007 .reset_reg = SW_RESET_AHB_REG,
1008 .reset_mask = BIT(7),
1009 .halt_reg = DBG_BUS_VEC_F_REG,
1010 .halt_bit = 9,
1011 },
1012 .c = {
1013 .dbg_name = "ijpeg_p_clk",
1014 .ops = &clk_ops_branch,
1015 CLK_INIT(ijpeg_p_clk.c),
1016 },
1017};
1018
1019static struct branch_clk imem_p_clk = {
1020 .b = {
1021 .ctl_reg = AHB_EN_REG,
1022 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001023 .hwcg_reg = AHB_EN2_REG,
1024 .hwcg_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001025 .reset_reg = SW_RESET_AHB_REG,
1026 .reset_mask = BIT(8),
1027 .halt_reg = DBG_BUS_VEC_F_REG,
1028 .halt_bit = 10,
1029 },
1030 .c = {
1031 .dbg_name = "imem_p_clk",
1032 .ops = &clk_ops_branch,
1033 CLK_INIT(imem_p_clk.c),
1034 },
1035};
1036
1037static struct branch_clk jpegd_p_clk = {
1038 .b = {
1039 .ctl_reg = AHB_EN_REG,
1040 .en_mask = BIT(21),
1041 .reset_reg = SW_RESET_AHB_REG,
1042 .reset_mask = BIT(4),
1043 .halt_reg = DBG_BUS_VEC_F_REG,
1044 .halt_bit = 7,
1045 },
1046 .c = {
1047 .dbg_name = "jpegd_p_clk",
1048 .ops = &clk_ops_branch,
1049 CLK_INIT(jpegd_p_clk.c),
1050 },
1051};
1052
1053static struct branch_clk mdp_p_clk = {
1054 .b = {
1055 .ctl_reg = AHB_EN_REG,
1056 .en_mask = BIT(10),
1057 .reset_reg = SW_RESET_AHB_REG,
1058 .reset_mask = BIT(3),
1059 .halt_reg = DBG_BUS_VEC_F_REG,
1060 .halt_bit = 11,
1061 },
1062 .c = {
1063 .dbg_name = "mdp_p_clk",
1064 .ops = &clk_ops_branch,
1065 CLK_INIT(mdp_p_clk.c),
1066 },
1067};
1068
1069static struct branch_clk rot_p_clk = {
1070 .b = {
1071 .ctl_reg = AHB_EN_REG,
1072 .en_mask = BIT(12),
1073 .reset_reg = SW_RESET_AHB_REG,
1074 .reset_mask = BIT(2),
1075 .halt_reg = DBG_BUS_VEC_F_REG,
1076 .halt_bit = 13,
1077 },
1078 .c = {
1079 .dbg_name = "rot_p_clk",
1080 .ops = &clk_ops_branch,
1081 CLK_INIT(rot_p_clk.c),
1082 },
1083};
1084
1085static struct branch_clk smmu_p_clk = {
1086 .b = {
1087 .ctl_reg = AHB_EN_REG,
1088 .en_mask = BIT(15),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001089 .hwcg_reg = AHB_EN_REG,
1090 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001091 .halt_reg = DBG_BUS_VEC_F_REG,
1092 .halt_bit = 22,
1093 },
1094 .c = {
1095 .dbg_name = "smmu_p_clk",
1096 .ops = &clk_ops_branch,
1097 CLK_INIT(smmu_p_clk.c),
1098 },
1099};
1100
1101static struct branch_clk tv_enc_p_clk = {
1102 .b = {
1103 .ctl_reg = AHB_EN_REG,
1104 .en_mask = BIT(25),
1105 .reset_reg = SW_RESET_AHB_REG,
1106 .reset_mask = BIT(15),
1107 .halt_reg = DBG_BUS_VEC_F_REG,
1108 .halt_bit = 23,
1109 },
1110 .c = {
1111 .dbg_name = "tv_enc_p_clk",
1112 .ops = &clk_ops_branch,
1113 CLK_INIT(tv_enc_p_clk.c),
1114 },
1115};
1116
1117static struct branch_clk vcodec_p_clk = {
1118 .b = {
1119 .ctl_reg = AHB_EN_REG,
1120 .en_mask = BIT(11),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001121 .hwcg_reg = AHB_EN2_REG,
1122 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001123 .reset_reg = SW_RESET_AHB_REG,
1124 .reset_mask = BIT(1),
1125 .halt_reg = DBG_BUS_VEC_F_REG,
1126 .halt_bit = 12,
1127 },
1128 .c = {
1129 .dbg_name = "vcodec_p_clk",
1130 .ops = &clk_ops_branch,
1131 CLK_INIT(vcodec_p_clk.c),
1132 },
1133};
1134
1135static struct branch_clk vfe_p_clk = {
1136 .b = {
1137 .ctl_reg = AHB_EN_REG,
1138 .en_mask = BIT(13),
1139 .reset_reg = SW_RESET_AHB_REG,
1140 .reset_mask = BIT(0),
1141 .halt_reg = DBG_BUS_VEC_F_REG,
1142 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08001143 .retain_reg = AHB_EN2_REG,
1144 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001145 },
1146 .c = {
1147 .dbg_name = "vfe_p_clk",
1148 .ops = &clk_ops_branch,
1149 CLK_INIT(vfe_p_clk.c),
1150 },
1151};
1152
1153static struct branch_clk vpe_p_clk = {
1154 .b = {
1155 .ctl_reg = AHB_EN_REG,
1156 .en_mask = BIT(16),
1157 .reset_reg = SW_RESET_AHB_REG,
1158 .reset_mask = BIT(14),
1159 .halt_reg = DBG_BUS_VEC_F_REG,
1160 .halt_bit = 15,
1161 },
1162 .c = {
1163 .dbg_name = "vpe_p_clk",
1164 .ops = &clk_ops_branch,
1165 CLK_INIT(vpe_p_clk.c),
1166 },
1167};
1168
Tianyi Gou41515e22011-09-01 19:37:43 -07001169static struct branch_clk vcap_p_clk = {
1170 .b = {
1171 .ctl_reg = AHB_EN3_REG,
1172 .en_mask = BIT(1),
1173 .reset_reg = SW_RESET_AHB2_REG,
1174 .reset_mask = BIT(2),
1175 .halt_reg = DBG_BUS_VEC_J_REG,
1176 .halt_bit = 23,
1177 },
1178 .c = {
1179 .dbg_name = "vcap_p_clk",
1180 .ops = &clk_ops_branch,
1181 CLK_INIT(vcap_p_clk.c),
1182 },
1183};
1184
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001185/*
1186 * Peripheral Clocks
1187 */
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001188#define CLK_GP(i, n, h_r, h_b) \
1189 struct rcg_clk i##_clk = { \
1190 .b = { \
1191 .ctl_reg = GPn_NS_REG(n), \
1192 .en_mask = BIT(9), \
1193 .halt_reg = h_r, \
1194 .halt_bit = h_b, \
1195 }, \
1196 .ns_reg = GPn_NS_REG(n), \
1197 .md_reg = GPn_MD_REG(n), \
1198 .root_en_mask = BIT(11), \
1199 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001200 .mnd_en_mask = BIT(8), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001201 .set_rate = set_rate_mnd, \
1202 .freq_tbl = clk_tbl_gp, \
1203 .current_freq = &rcg_dummy_freq, \
1204 .c = { \
1205 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001206 .ops = &clk_ops_rcg, \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001207 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), \
1208 CLK_INIT(i##_clk.c), \
1209 }, \
1210 }
1211#define F_GP(f, s, d, m, n) \
1212 { \
1213 .freq_hz = f, \
1214 .src_clk = &s##_clk.c, \
1215 .md_val = MD8(16, m, 0, n), \
1216 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001217 }
1218static struct clk_freq_tbl clk_tbl_gp[] = {
1219 F_GP( 0, gnd, 1, 0, 0),
1220 F_GP( 9600000, cxo, 2, 0, 0),
1221 F_GP( 13500000, pxo, 2, 0, 0),
1222 F_GP( 19200000, cxo, 1, 0, 0),
1223 F_GP( 27000000, pxo, 1, 0, 0),
1224 F_GP( 64000000, pll8, 2, 1, 3),
1225 F_GP( 76800000, pll8, 1, 1, 5),
1226 F_GP( 96000000, pll8, 4, 0, 0),
1227 F_GP(128000000, pll8, 3, 0, 0),
1228 F_GP(192000000, pll8, 2, 0, 0),
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001229 F_END
1230};
1231
1232static CLK_GP(gp0, 0, CLK_HALT_SFPB_MISC_STATE_REG, 7);
1233static CLK_GP(gp1, 1, CLK_HALT_SFPB_MISC_STATE_REG, 6);
1234static CLK_GP(gp2, 2, CLK_HALT_SFPB_MISC_STATE_REG, 5);
1235
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001236#define CLK_GSBI_UART(i, n, h_r, h_b) \
1237 struct rcg_clk i##_clk = { \
1238 .b = { \
1239 .ctl_reg = GSBIn_UART_APPS_NS_REG(n), \
1240 .en_mask = BIT(9), \
1241 .reset_reg = GSBIn_RESET_REG(n), \
1242 .reset_mask = BIT(0), \
1243 .halt_reg = h_r, \
1244 .halt_bit = h_b, \
1245 }, \
1246 .ns_reg = GSBIn_UART_APPS_NS_REG(n), \
1247 .md_reg = GSBIn_UART_APPS_MD_REG(n), \
1248 .root_en_mask = BIT(11), \
1249 .ns_mask = (BM(31, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001250 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001251 .set_rate = set_rate_mnd, \
1252 .freq_tbl = clk_tbl_gsbi_uart, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001253 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001254 .c = { \
1255 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001256 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001257 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001258 CLK_INIT(i##_clk.c), \
1259 }, \
1260 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001261#define F_GSBI_UART(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001262 { \
1263 .freq_hz = f, \
1264 .src_clk = &s##_clk.c, \
1265 .md_val = MD16(m, n), \
1266 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001267 }
1268static struct clk_freq_tbl clk_tbl_gsbi_uart[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001269 F_GSBI_UART( 0, gnd, 1, 0, 0),
Matt Wagantall9a561f72012-01-19 16:13:12 -08001270 F_GSBI_UART( 1843200, pll8, 2, 6, 625),
1271 F_GSBI_UART( 3686400, pll8, 2, 12, 625),
1272 F_GSBI_UART( 7372800, pll8, 2, 24, 625),
1273 F_GSBI_UART(14745600, pll8, 2, 48, 625),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001274 F_GSBI_UART(16000000, pll8, 4, 1, 6),
1275 F_GSBI_UART(24000000, pll8, 4, 1, 4),
1276 F_GSBI_UART(32000000, pll8, 4, 1, 3),
1277 F_GSBI_UART(40000000, pll8, 1, 5, 48),
1278 F_GSBI_UART(46400000, pll8, 1, 29, 240),
1279 F_GSBI_UART(48000000, pll8, 4, 1, 2),
1280 F_GSBI_UART(51200000, pll8, 1, 2, 15),
1281 F_GSBI_UART(56000000, pll8, 1, 7, 48),
1282 F_GSBI_UART(58982400, pll8, 1, 96, 625),
1283 F_GSBI_UART(64000000, pll8, 2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001284 F_END
1285};
1286
1287static CLK_GSBI_UART(gsbi1_uart, 1, CLK_HALT_CFPB_STATEA_REG, 10);
1288static CLK_GSBI_UART(gsbi2_uart, 2, CLK_HALT_CFPB_STATEA_REG, 6);
1289static CLK_GSBI_UART(gsbi3_uart, 3, CLK_HALT_CFPB_STATEA_REG, 2);
1290static CLK_GSBI_UART(gsbi4_uart, 4, CLK_HALT_CFPB_STATEB_REG, 26);
1291static CLK_GSBI_UART(gsbi5_uart, 5, CLK_HALT_CFPB_STATEB_REG, 22);
1292static CLK_GSBI_UART(gsbi6_uart, 6, CLK_HALT_CFPB_STATEB_REG, 18);
1293static CLK_GSBI_UART(gsbi7_uart, 7, CLK_HALT_CFPB_STATEB_REG, 14);
1294static CLK_GSBI_UART(gsbi8_uart, 8, CLK_HALT_CFPB_STATEB_REG, 10);
1295static CLK_GSBI_UART(gsbi9_uart, 9, CLK_HALT_CFPB_STATEB_REG, 6);
1296static CLK_GSBI_UART(gsbi10_uart, 10, CLK_HALT_CFPB_STATEB_REG, 2);
1297static CLK_GSBI_UART(gsbi11_uart, 11, CLK_HALT_CFPB_STATEC_REG, 17);
1298static CLK_GSBI_UART(gsbi12_uart, 12, CLK_HALT_CFPB_STATEC_REG, 13);
1299
1300#define CLK_GSBI_QUP(i, n, h_r, h_b) \
1301 struct rcg_clk i##_clk = { \
1302 .b = { \
1303 .ctl_reg = GSBIn_QUP_APPS_NS_REG(n), \
1304 .en_mask = BIT(9), \
1305 .reset_reg = GSBIn_RESET_REG(n), \
1306 .reset_mask = BIT(0), \
1307 .halt_reg = h_r, \
1308 .halt_bit = h_b, \
1309 }, \
1310 .ns_reg = GSBIn_QUP_APPS_NS_REG(n), \
1311 .md_reg = GSBIn_QUP_APPS_MD_REG(n), \
1312 .root_en_mask = BIT(11), \
1313 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001314 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001315 .set_rate = set_rate_mnd, \
1316 .freq_tbl = clk_tbl_gsbi_qup, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001317 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001318 .c = { \
1319 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001320 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001321 VDD_DIG_FMAX_MAP2(LOW, 24000000, NOMINAL, 52000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001322 CLK_INIT(i##_clk.c), \
1323 }, \
1324 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001325#define F_GSBI_QUP(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326 { \
1327 .freq_hz = f, \
1328 .src_clk = &s##_clk.c, \
1329 .md_val = MD8(16, m, 0, n), \
1330 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001331 }
1332static struct clk_freq_tbl clk_tbl_gsbi_qup[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001333 F_GSBI_QUP( 0, gnd, 1, 0, 0),
1334 F_GSBI_QUP( 1100000, pxo, 1, 2, 49),
1335 F_GSBI_QUP( 5400000, pxo, 1, 1, 5),
1336 F_GSBI_QUP(10800000, pxo, 1, 2, 5),
1337 F_GSBI_QUP(15060000, pll8, 1, 2, 51),
1338 F_GSBI_QUP(24000000, pll8, 4, 1, 4),
1339 F_GSBI_QUP(25600000, pll8, 1, 1, 15),
1340 F_GSBI_QUP(27000000, pxo, 1, 0, 0),
1341 F_GSBI_QUP(48000000, pll8, 4, 1, 2),
1342 F_GSBI_QUP(51200000, pll8, 1, 2, 15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001343 F_END
1344};
1345
1346static CLK_GSBI_QUP(gsbi1_qup, 1, CLK_HALT_CFPB_STATEA_REG, 9);
1347static CLK_GSBI_QUP(gsbi2_qup, 2, CLK_HALT_CFPB_STATEA_REG, 4);
1348static CLK_GSBI_QUP(gsbi3_qup, 3, CLK_HALT_CFPB_STATEA_REG, 0);
1349static CLK_GSBI_QUP(gsbi4_qup, 4, CLK_HALT_CFPB_STATEB_REG, 24);
1350static CLK_GSBI_QUP(gsbi5_qup, 5, CLK_HALT_CFPB_STATEB_REG, 20);
1351static CLK_GSBI_QUP(gsbi6_qup, 6, CLK_HALT_CFPB_STATEB_REG, 16);
1352static CLK_GSBI_QUP(gsbi7_qup, 7, CLK_HALT_CFPB_STATEB_REG, 12);
1353static CLK_GSBI_QUP(gsbi8_qup, 8, CLK_HALT_CFPB_STATEB_REG, 8);
1354static CLK_GSBI_QUP(gsbi9_qup, 9, CLK_HALT_CFPB_STATEB_REG, 4);
1355static CLK_GSBI_QUP(gsbi10_qup, 10, CLK_HALT_CFPB_STATEB_REG, 0);
1356static CLK_GSBI_QUP(gsbi11_qup, 11, CLK_HALT_CFPB_STATEC_REG, 15);
1357static CLK_GSBI_QUP(gsbi12_qup, 12, CLK_HALT_CFPB_STATEC_REG, 11);
1358
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001359#define F_PDM(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001360 { \
1361 .freq_hz = f, \
1362 .src_clk = &s##_clk.c, \
1363 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364 }
1365static struct clk_freq_tbl clk_tbl_pdm[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001366 F_PDM( 0, gnd, 1),
1367 F_PDM(27000000, pxo, 1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001368 F_END
1369};
1370
1371static struct rcg_clk pdm_clk = {
1372 .b = {
1373 .ctl_reg = PDM_CLK_NS_REG,
1374 .en_mask = BIT(9),
1375 .reset_reg = PDM_CLK_NS_REG,
1376 .reset_mask = BIT(12),
1377 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1378 .halt_bit = 3,
1379 },
1380 .ns_reg = PDM_CLK_NS_REG,
1381 .root_en_mask = BIT(11),
1382 .ns_mask = BM(1, 0),
1383 .set_rate = set_rate_nop,
1384 .freq_tbl = clk_tbl_pdm,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001385 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001386 .c = {
1387 .dbg_name = "pdm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001388 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001389 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001390 CLK_INIT(pdm_clk.c),
1391 },
1392};
1393
1394static struct branch_clk pmem_clk = {
1395 .b = {
1396 .ctl_reg = PMEM_ACLK_CTL_REG,
1397 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001398 .hwcg_reg = PMEM_ACLK_CTL_REG,
1399 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001400 .halt_reg = CLK_HALT_DFAB_STATE_REG,
1401 .halt_bit = 20,
1402 },
1403 .c = {
1404 .dbg_name = "pmem_clk",
1405 .ops = &clk_ops_branch,
1406 CLK_INIT(pmem_clk.c),
1407 },
1408};
1409
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001410#define F_PRNG(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001411 { \
1412 .freq_hz = f, \
1413 .src_clk = &s##_clk.c, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001414 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07001415static struct clk_freq_tbl clk_tbl_prng_32[] = {
1416 F_PRNG(32000000, pll8),
1417 F_END
1418};
1419
1420static struct clk_freq_tbl clk_tbl_prng_64[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001421 F_PRNG(64000000, pll8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001422 F_END
1423};
1424
1425static struct rcg_clk prng_clk = {
1426 .b = {
1427 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
1428 .en_mask = BIT(10),
1429 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
1430 .halt_check = HALT_VOTED,
1431 .halt_bit = 10,
1432 },
1433 .set_rate = set_rate_nop,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001434 .freq_tbl = clk_tbl_prng_32,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001435 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001436 .c = {
1437 .dbg_name = "prng_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001438 .ops = &clk_ops_rcg,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001439 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001440 CLK_INIT(prng_clk.c),
1441 },
1442};
1443
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001444#define CLK_SDC(name, n, h_b, fmax_low, fmax_nom) \
Stephen Boyda78a7402011-08-02 11:23:39 -07001445 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001446 .b = { \
1447 .ctl_reg = SDCn_APPS_CLK_NS_REG(n), \
1448 .en_mask = BIT(9), \
1449 .reset_reg = SDCn_RESET_REG(n), \
1450 .reset_mask = BIT(0), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001451 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001452 .halt_bit = h_b, \
1453 }, \
1454 .ns_reg = SDCn_APPS_CLK_NS_REG(n), \
1455 .md_reg = SDCn_APPS_CLK_MD_REG(n), \
1456 .root_en_mask = BIT(11), \
1457 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001458 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001459 .set_rate = set_rate_mnd, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001460 .freq_tbl = clk_tbl_sdc, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001461 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001462 .c = { \
Stephen Boyda78a7402011-08-02 11:23:39 -07001463 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001464 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001465 VDD_DIG_FMAX_MAP2(LOW, fmax_low, NOMINAL, fmax_nom), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001466 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001467 }, \
1468 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001469#define F_SDC(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001470 { \
1471 .freq_hz = f, \
1472 .src_clk = &s##_clk.c, \
1473 .md_val = MD8(16, m, 0, n), \
1474 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001475 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001476static struct clk_freq_tbl clk_tbl_sdc[] = {
1477 F_SDC( 0, gnd, 1, 0, 0),
1478 F_SDC( 144000, pxo, 3, 2, 125),
1479 F_SDC( 400000, pll8, 4, 1, 240),
1480 F_SDC( 16000000, pll8, 4, 1, 6),
1481 F_SDC( 17070000, pll8, 1, 2, 45),
1482 F_SDC( 20210000, pll8, 1, 1, 19),
1483 F_SDC( 24000000, pll8, 4, 1, 4),
1484 F_SDC( 48000000, pll8, 4, 1, 2),
1485 F_SDC( 64000000, pll8, 3, 1, 2),
1486 F_SDC( 96000000, pll8, 4, 0, 0),
Subhash Jadavanibd238ba2011-11-24 15:12:39 +05301487 F_SDC(192000000, pll8, 2, 0, 0),
Stephen Boyda78a7402011-08-02 11:23:39 -07001488 F_END
1489};
1490
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001491static CLK_SDC(sdc1_clk, 1, 6, 52000000, 104000000);
1492static CLK_SDC(sdc2_clk, 2, 5, 52000000, 104000000);
1493static CLK_SDC(sdc3_clk, 3, 4, 104000000, 208000000);
1494static CLK_SDC(sdc4_clk, 4, 3, 33000000, 67000000);
1495static CLK_SDC(sdc5_clk, 5, 2, 33000000, 67000000);
Stephen Boyda78a7402011-08-02 11:23:39 -07001496
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001497#define F_TSIF_REF(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001498 { \
1499 .freq_hz = f, \
1500 .src_clk = &s##_clk.c, \
1501 .md_val = MD16(m, n), \
1502 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001503 }
1504static struct clk_freq_tbl clk_tbl_tsif_ref[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001505 F_TSIF_REF( 0, gnd, 1, 0, 0),
1506 F_TSIF_REF(105000, pxo, 1, 1, 256),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001507 F_END
1508};
1509
1510static struct rcg_clk tsif_ref_clk = {
1511 .b = {
1512 .ctl_reg = TSIF_REF_CLK_NS_REG,
1513 .en_mask = BIT(9),
1514 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1515 .halt_bit = 5,
1516 },
1517 .ns_reg = TSIF_REF_CLK_NS_REG,
1518 .md_reg = TSIF_REF_CLK_MD_REG,
1519 .root_en_mask = BIT(11),
1520 .ns_mask = (BM(31, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001521 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001522 .set_rate = set_rate_mnd,
1523 .freq_tbl = clk_tbl_tsif_ref,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001524 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001525 .c = {
1526 .dbg_name = "tsif_ref_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001527 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001528 VDD_DIG_FMAX_MAP2(LOW, 27000000, NOMINAL, 54000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001529 CLK_INIT(tsif_ref_clk.c),
1530 },
1531};
1532
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001533#define F_TSSC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001534 { \
1535 .freq_hz = f, \
1536 .src_clk = &s##_clk.c, \
1537 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001538 }
1539static struct clk_freq_tbl clk_tbl_tssc[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001540 F_TSSC( 0, gnd),
1541 F_TSSC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001542 F_END
1543};
1544
1545static struct rcg_clk tssc_clk = {
1546 .b = {
1547 .ctl_reg = TSSC_CLK_CTL_REG,
1548 .en_mask = BIT(4),
1549 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1550 .halt_bit = 4,
1551 },
1552 .ns_reg = TSSC_CLK_CTL_REG,
1553 .ns_mask = BM(1, 0),
1554 .set_rate = set_rate_nop,
1555 .freq_tbl = clk_tbl_tssc,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001556 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001557 .c = {
1558 .dbg_name = "tssc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001559 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001560 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001561 CLK_INIT(tssc_clk.c),
1562 },
1563};
1564
Tianyi Gou41515e22011-09-01 19:37:43 -07001565#define CLK_USB_HS(name, n, h_b) \
1566 static struct rcg_clk name = { \
1567 .b = { \
1568 .ctl_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1569 .en_mask = BIT(9), \
1570 .reset_reg = USB_HS##n##_RESET_REG, \
1571 .reset_mask = BIT(0), \
1572 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
1573 .halt_bit = h_b, \
1574 }, \
1575 .ns_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1576 .md_reg = USB_HS##n##_XCVR_FS_CLK_MD_REG, \
1577 .root_en_mask = BIT(11), \
1578 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001579 .mnd_en_mask = BIT(8), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001580 .set_rate = set_rate_mnd, \
1581 .freq_tbl = clk_tbl_usb, \
1582 .current_freq = &rcg_dummy_freq, \
1583 .c = { \
1584 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001585 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001586 VDD_DIG_FMAX_MAP1(NOMINAL, 64000000), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001587 CLK_INIT(name.c), \
1588 }, \
1589}
1590
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001591#define F_USB(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001592 { \
1593 .freq_hz = f, \
1594 .src_clk = &s##_clk.c, \
1595 .md_val = MD8(16, m, 0, n), \
1596 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001597 }
1598static struct clk_freq_tbl clk_tbl_usb[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001599 F_USB( 0, gnd, 1, 0, 0),
1600 F_USB(60000000, pll8, 1, 5, 32),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001601 F_END
1602};
1603
Tianyi Gou41515e22011-09-01 19:37:43 -07001604CLK_USB_HS(usb_hs1_xcvr_clk, 1, 0);
1605CLK_USB_HS(usb_hs3_xcvr_clk, 3, 30);
1606CLK_USB_HS(usb_hs4_xcvr_clk, 4, 2);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001607
Stephen Boyd94625ef2011-07-12 17:06:01 -07001608static struct clk_freq_tbl clk_tbl_usb_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001609 F_USB( 0, gnd, 1, 0, 0),
1610 F_USB(60000000, pll8, 1, 5, 32),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001611 F_END
1612};
1613
1614static struct rcg_clk usb_hsic_xcvr_fs_clk = {
1615 .b = {
1616 .ctl_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1617 .en_mask = BIT(9),
1618 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1619 .halt_bit = 26,
1620 },
1621 .ns_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1622 .md_reg = USB_HSIC_XCVR_FS_CLK_MD_REG,
1623 .root_en_mask = BIT(11),
1624 .ns_mask = (BM(23, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001625 .mnd_en_mask = BIT(8),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001626 .set_rate = set_rate_mnd,
1627 .freq_tbl = clk_tbl_usb_hsic,
1628 .current_freq = &rcg_dummy_freq,
1629 .c = {
1630 .dbg_name = "usb_hsic_xcvr_fs_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001631 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001632 VDD_DIG_FMAX_MAP1(LOW, 60000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001633 CLK_INIT(usb_hsic_xcvr_fs_clk.c),
1634 },
1635};
1636
1637static struct branch_clk usb_hsic_system_clk = {
1638 .b = {
1639 .ctl_reg = USB_HSIC_SYSTEM_CLK_CTL_REG,
1640 .en_mask = BIT(4),
1641 .reset_reg = USB_HSIC_RESET_REG,
1642 .reset_mask = BIT(0),
1643 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1644 .halt_bit = 24,
1645 },
1646 .parent = &usb_hsic_xcvr_fs_clk.c,
1647 .c = {
1648 .dbg_name = "usb_hsic_system_clk",
1649 .ops = &clk_ops_branch,
1650 CLK_INIT(usb_hsic_system_clk.c),
1651 },
1652};
1653
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001654#define F_USB_HSIC(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001655 { \
1656 .freq_hz = f, \
1657 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001658 }
1659static struct clk_freq_tbl clk_tbl_usb2_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001660 F_USB_HSIC(480000000, pll14),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001661 F_END
1662};
1663
1664static struct rcg_clk usb_hsic_hsic_src_clk = {
1665 .b = {
1666 .ctl_reg = USB_HSIC_HSIC_CLK_SRC_CTL_REG,
1667 .halt_check = NOCHECK,
1668 },
1669 .root_en_mask = BIT(0),
1670 .set_rate = set_rate_nop,
1671 .freq_tbl = clk_tbl_usb2_hsic,
1672 .current_freq = &rcg_dummy_freq,
1673 .c = {
1674 .dbg_name = "usb_hsic_hsic_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001675 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001676 VDD_DIG_FMAX_MAP1(LOW, 480000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001677 CLK_INIT(usb_hsic_hsic_src_clk.c),
1678 },
1679};
1680
1681static struct branch_clk usb_hsic_hsic_clk = {
1682 .b = {
1683 .ctl_reg = USB_HSIC_HSIC_CLK_CTL_REG,
1684 .en_mask = BIT(0),
1685 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1686 .halt_bit = 19,
1687 },
1688 .parent = &usb_hsic_hsic_src_clk.c,
1689 .c = {
1690 .dbg_name = "usb_hsic_hsic_clk",
1691 .ops = &clk_ops_branch,
1692 CLK_INIT(usb_hsic_hsic_clk.c),
1693 },
1694};
1695
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001696#define F_USB_HSIO_CAL(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001697 { \
1698 .freq_hz = f, \
1699 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001700 }
1701static struct clk_freq_tbl clk_tbl_usb_hsio_cal[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001702 F_USB_HSIO_CAL(9000000, pxo),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001703 F_END
1704};
1705
1706static struct rcg_clk usb_hsic_hsio_cal_clk = {
1707 .b = {
1708 .ctl_reg = USB_HSIC_HSIO_CAL_CLK_CTL_REG,
1709 .en_mask = BIT(0),
1710 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1711 .halt_bit = 23,
1712 },
1713 .set_rate = set_rate_nop,
1714 .freq_tbl = clk_tbl_usb_hsio_cal,
1715 .current_freq = &rcg_dummy_freq,
1716 .c = {
1717 .dbg_name = "usb_hsic_hsio_cal_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001718 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001719 VDD_DIG_FMAX_MAP1(LOW, 10000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001720 CLK_INIT(usb_hsic_hsio_cal_clk.c),
1721 },
1722};
1723
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001724static struct branch_clk usb_phy0_clk = {
1725 .b = {
1726 .reset_reg = USB_PHY0_RESET_REG,
1727 .reset_mask = BIT(0),
1728 },
1729 .c = {
1730 .dbg_name = "usb_phy0_clk",
1731 .ops = &clk_ops_reset,
1732 CLK_INIT(usb_phy0_clk.c),
1733 },
1734};
1735
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001736#define CLK_USB_FS(i, n, fmax_nom) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001737 struct rcg_clk i##_clk = { \
1738 .ns_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1739 .b = { \
1740 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1741 .halt_check = NOCHECK, \
1742 }, \
1743 .md_reg = USB_FSn_XCVR_FS_CLK_MD_REG(n), \
1744 .root_en_mask = BIT(11), \
1745 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001746 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001747 .set_rate = set_rate_mnd, \
1748 .freq_tbl = clk_tbl_usb, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001749 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001750 .c = { \
1751 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001752 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001753 VDD_DIG_FMAX_MAP1(NOMINAL, fmax_nom), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001754 CLK_INIT(i##_clk.c), \
1755 }, \
1756 }
1757
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001758static CLK_USB_FS(usb_fs1_src, 1, 64000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001759static struct branch_clk usb_fs1_xcvr_clk = {
1760 .b = {
1761 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(1),
1762 .en_mask = BIT(9),
1763 .reset_reg = USB_FSn_RESET_REG(1),
1764 .reset_mask = BIT(1),
1765 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1766 .halt_bit = 15,
1767 },
1768 .parent = &usb_fs1_src_clk.c,
1769 .c = {
1770 .dbg_name = "usb_fs1_xcvr_clk",
1771 .ops = &clk_ops_branch,
1772 CLK_INIT(usb_fs1_xcvr_clk.c),
1773 },
1774};
1775
1776static struct branch_clk usb_fs1_sys_clk = {
1777 .b = {
1778 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(1),
1779 .en_mask = BIT(4),
1780 .reset_reg = USB_FSn_RESET_REG(1),
1781 .reset_mask = BIT(0),
1782 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1783 .halt_bit = 16,
1784 },
1785 .parent = &usb_fs1_src_clk.c,
1786 .c = {
1787 .dbg_name = "usb_fs1_sys_clk",
1788 .ops = &clk_ops_branch,
1789 CLK_INIT(usb_fs1_sys_clk.c),
1790 },
1791};
1792
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001793static CLK_USB_FS(usb_fs2_src, 2, 60000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001794static struct branch_clk usb_fs2_xcvr_clk = {
1795 .b = {
1796 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(2),
1797 .en_mask = BIT(9),
1798 .reset_reg = USB_FSn_RESET_REG(2),
1799 .reset_mask = BIT(1),
1800 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1801 .halt_bit = 12,
1802 },
1803 .parent = &usb_fs2_src_clk.c,
1804 .c = {
1805 .dbg_name = "usb_fs2_xcvr_clk",
1806 .ops = &clk_ops_branch,
1807 CLK_INIT(usb_fs2_xcvr_clk.c),
1808 },
1809};
1810
1811static struct branch_clk usb_fs2_sys_clk = {
1812 .b = {
1813 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(2),
1814 .en_mask = BIT(4),
1815 .reset_reg = USB_FSn_RESET_REG(2),
1816 .reset_mask = BIT(0),
1817 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1818 .halt_bit = 13,
1819 },
1820 .parent = &usb_fs2_src_clk.c,
1821 .c = {
1822 .dbg_name = "usb_fs2_sys_clk",
1823 .ops = &clk_ops_branch,
1824 CLK_INIT(usb_fs2_sys_clk.c),
1825 },
1826};
1827
1828/* Fast Peripheral Bus Clocks */
1829static struct branch_clk ce1_core_clk = {
1830 .b = {
1831 .ctl_reg = CE1_CORE_CLK_CTL_REG,
1832 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001833 .hwcg_reg = CE1_CORE_CLK_CTL_REG,
1834 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001835 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1836 .halt_bit = 27,
1837 },
1838 .c = {
1839 .dbg_name = "ce1_core_clk",
1840 .ops = &clk_ops_branch,
1841 CLK_INIT(ce1_core_clk.c),
1842 },
1843};
Tianyi Gou41515e22011-09-01 19:37:43 -07001844
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001845static struct branch_clk ce1_p_clk = {
1846 .b = {
1847 .ctl_reg = CE1_HCLK_CTL_REG,
1848 .en_mask = BIT(4),
1849 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1850 .halt_bit = 1,
1851 },
1852 .c = {
1853 .dbg_name = "ce1_p_clk",
1854 .ops = &clk_ops_branch,
1855 CLK_INIT(ce1_p_clk.c),
1856 },
1857};
1858
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001859#define F_CE3(f, s, d) \
Tianyi Gou41515e22011-09-01 19:37:43 -07001860 { \
1861 .freq_hz = f, \
1862 .src_clk = &s##_clk.c, \
1863 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001864 }
1865
1866static struct clk_freq_tbl clk_tbl_ce3[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001867 F_CE3( 0, gnd, 1),
1868 F_CE3( 48000000, pll8, 8),
1869 F_CE3(100000000, pll3, 12),
Tianyi Gou41515e22011-09-01 19:37:43 -07001870 F_END
1871};
1872
1873static struct rcg_clk ce3_src_clk = {
1874 .b = {
1875 .ctl_reg = CE3_CLK_SRC_NS_REG,
1876 .halt_check = NOCHECK,
1877 },
1878 .ns_reg = CE3_CLK_SRC_NS_REG,
1879 .root_en_mask = BIT(7),
1880 .ns_mask = BM(6, 0),
1881 .set_rate = set_rate_nop,
1882 .freq_tbl = clk_tbl_ce3,
1883 .current_freq = &rcg_dummy_freq,
1884 .c = {
1885 .dbg_name = "ce3_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001886 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001887 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
Tianyi Gou41515e22011-09-01 19:37:43 -07001888 CLK_INIT(ce3_src_clk.c),
1889 },
1890};
1891
1892static struct branch_clk ce3_core_clk = {
1893 .b = {
1894 .ctl_reg = CE3_CORE_CLK_CTL_REG,
1895 .en_mask = BIT(4),
1896 .reset_reg = CE3_CORE_CLK_CTL_REG,
1897 .reset_mask = BIT(7),
1898 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
1899 .halt_bit = 5,
1900 },
1901 .parent = &ce3_src_clk.c,
1902 .c = {
1903 .dbg_name = "ce3_core_clk",
1904 .ops = &clk_ops_branch,
1905 CLK_INIT(ce3_core_clk.c),
1906 }
1907};
1908
1909static struct branch_clk ce3_p_clk = {
1910 .b = {
1911 .ctl_reg = CE3_HCLK_CTL_REG,
1912 .en_mask = BIT(4),
1913 .reset_reg = CE3_HCLK_CTL_REG,
1914 .reset_mask = BIT(7),
1915 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
1916 .halt_bit = 16,
1917 },
1918 .parent = &ce3_src_clk.c,
1919 .c = {
1920 .dbg_name = "ce3_p_clk",
1921 .ops = &clk_ops_branch,
1922 CLK_INIT(ce3_p_clk.c),
1923 }
1924};
1925
1926static struct branch_clk sata_phy_ref_clk = {
1927 .b = {
1928 .ctl_reg = SATA_PHY_REF_CLK_CTL_REG,
1929 .en_mask = BIT(4),
1930 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
1931 .halt_bit = 24,
1932 },
1933 .parent = &pxo_clk.c,
1934 .c = {
1935 .dbg_name = "sata_phy_ref_clk",
1936 .ops = &clk_ops_branch,
1937 CLK_INIT(sata_phy_ref_clk.c),
1938 },
1939};
1940
1941static struct branch_clk pcie_p_clk = {
1942 .b = {
1943 .ctl_reg = PCIE_HCLK_CTL_REG,
1944 .en_mask = BIT(4),
1945 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1946 .halt_bit = 8,
1947 },
1948 .c = {
1949 .dbg_name = "pcie_p_clk",
1950 .ops = &clk_ops_branch,
1951 CLK_INIT(pcie_p_clk.c),
1952 },
1953};
1954
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001955static struct branch_clk dma_bam_p_clk = {
1956 .b = {
1957 .ctl_reg = DMA_BAM_HCLK_CTL,
1958 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001959 .hwcg_reg = DMA_BAM_HCLK_CTL,
1960 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001961 .halt_reg = CLK_HALT_DFAB_STATE_REG,
1962 .halt_bit = 12,
1963 },
1964 .c = {
1965 .dbg_name = "dma_bam_p_clk",
1966 .ops = &clk_ops_branch,
1967 CLK_INIT(dma_bam_p_clk.c),
1968 },
1969};
1970
1971static struct branch_clk gsbi1_p_clk = {
1972 .b = {
1973 .ctl_reg = GSBIn_HCLK_CTL_REG(1),
1974 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001975 .hwcg_reg = GSBIn_HCLK_CTL_REG(1),
1976 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001977 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1978 .halt_bit = 11,
1979 },
1980 .c = {
1981 .dbg_name = "gsbi1_p_clk",
1982 .ops = &clk_ops_branch,
1983 CLK_INIT(gsbi1_p_clk.c),
1984 },
1985};
1986
1987static struct branch_clk gsbi2_p_clk = {
1988 .b = {
1989 .ctl_reg = GSBIn_HCLK_CTL_REG(2),
1990 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001991 .hwcg_reg = GSBIn_HCLK_CTL_REG(2),
1992 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001993 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1994 .halt_bit = 7,
1995 },
1996 .c = {
1997 .dbg_name = "gsbi2_p_clk",
1998 .ops = &clk_ops_branch,
1999 CLK_INIT(gsbi2_p_clk.c),
2000 },
2001};
2002
2003static struct branch_clk gsbi3_p_clk = {
2004 .b = {
2005 .ctl_reg = GSBIn_HCLK_CTL_REG(3),
2006 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002007 .hwcg_reg = GSBIn_HCLK_CTL_REG(3),
2008 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002009 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2010 .halt_bit = 3,
2011 },
2012 .c = {
2013 .dbg_name = "gsbi3_p_clk",
2014 .ops = &clk_ops_branch,
2015 CLK_INIT(gsbi3_p_clk.c),
2016 },
2017};
2018
2019static struct branch_clk gsbi4_p_clk = {
2020 .b = {
2021 .ctl_reg = GSBIn_HCLK_CTL_REG(4),
2022 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002023 .hwcg_reg = GSBIn_HCLK_CTL_REG(4),
2024 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002025 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2026 .halt_bit = 27,
2027 },
2028 .c = {
2029 .dbg_name = "gsbi4_p_clk",
2030 .ops = &clk_ops_branch,
2031 CLK_INIT(gsbi4_p_clk.c),
2032 },
2033};
2034
2035static struct branch_clk gsbi5_p_clk = {
2036 .b = {
2037 .ctl_reg = GSBIn_HCLK_CTL_REG(5),
2038 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002039 .hwcg_reg = GSBIn_HCLK_CTL_REG(5),
2040 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002041 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2042 .halt_bit = 23,
2043 },
2044 .c = {
2045 .dbg_name = "gsbi5_p_clk",
2046 .ops = &clk_ops_branch,
2047 CLK_INIT(gsbi5_p_clk.c),
2048 },
2049};
2050
2051static struct branch_clk gsbi6_p_clk = {
2052 .b = {
2053 .ctl_reg = GSBIn_HCLK_CTL_REG(6),
2054 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002055 .hwcg_reg = GSBIn_HCLK_CTL_REG(6),
2056 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002057 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2058 .halt_bit = 19,
2059 },
2060 .c = {
2061 .dbg_name = "gsbi6_p_clk",
2062 .ops = &clk_ops_branch,
2063 CLK_INIT(gsbi6_p_clk.c),
2064 },
2065};
2066
2067static struct branch_clk gsbi7_p_clk = {
2068 .b = {
2069 .ctl_reg = GSBIn_HCLK_CTL_REG(7),
2070 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002071 .hwcg_reg = GSBIn_HCLK_CTL_REG(7),
2072 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002073 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2074 .halt_bit = 15,
2075 },
2076 .c = {
2077 .dbg_name = "gsbi7_p_clk",
2078 .ops = &clk_ops_branch,
2079 CLK_INIT(gsbi7_p_clk.c),
2080 },
2081};
2082
2083static struct branch_clk gsbi8_p_clk = {
2084 .b = {
2085 .ctl_reg = GSBIn_HCLK_CTL_REG(8),
2086 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002087 .hwcg_reg = GSBIn_HCLK_CTL_REG(8),
2088 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002089 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2090 .halt_bit = 11,
2091 },
2092 .c = {
2093 .dbg_name = "gsbi8_p_clk",
2094 .ops = &clk_ops_branch,
2095 CLK_INIT(gsbi8_p_clk.c),
2096 },
2097};
2098
2099static struct branch_clk gsbi9_p_clk = {
2100 .b = {
2101 .ctl_reg = GSBIn_HCLK_CTL_REG(9),
2102 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002103 .hwcg_reg = GSBIn_HCLK_CTL_REG(9),
2104 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002105 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2106 .halt_bit = 7,
2107 },
2108 .c = {
2109 .dbg_name = "gsbi9_p_clk",
2110 .ops = &clk_ops_branch,
2111 CLK_INIT(gsbi9_p_clk.c),
2112 },
2113};
2114
2115static struct branch_clk gsbi10_p_clk = {
2116 .b = {
2117 .ctl_reg = GSBIn_HCLK_CTL_REG(10),
2118 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002119 .hwcg_reg = GSBIn_HCLK_CTL_REG(10),
2120 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002121 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2122 .halt_bit = 3,
2123 },
2124 .c = {
2125 .dbg_name = "gsbi10_p_clk",
2126 .ops = &clk_ops_branch,
2127 CLK_INIT(gsbi10_p_clk.c),
2128 },
2129};
2130
2131static struct branch_clk gsbi11_p_clk = {
2132 .b = {
2133 .ctl_reg = GSBIn_HCLK_CTL_REG(11),
2134 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002135 .hwcg_reg = GSBIn_HCLK_CTL_REG(11),
2136 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002137 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2138 .halt_bit = 18,
2139 },
2140 .c = {
2141 .dbg_name = "gsbi11_p_clk",
2142 .ops = &clk_ops_branch,
2143 CLK_INIT(gsbi11_p_clk.c),
2144 },
2145};
2146
2147static struct branch_clk gsbi12_p_clk = {
2148 .b = {
2149 .ctl_reg = GSBIn_HCLK_CTL_REG(12),
2150 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002151 .hwcg_reg = GSBIn_HCLK_CTL_REG(12),
2152 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002153 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2154 .halt_bit = 14,
2155 },
2156 .c = {
2157 .dbg_name = "gsbi12_p_clk",
2158 .ops = &clk_ops_branch,
2159 CLK_INIT(gsbi12_p_clk.c),
2160 },
2161};
2162
Tianyi Gou41515e22011-09-01 19:37:43 -07002163static struct branch_clk sata_phy_cfg_clk = {
2164 .b = {
2165 .ctl_reg = SATA_PHY_CFG_CLK_CTL_REG,
2166 .en_mask = BIT(4),
2167 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2168 .halt_bit = 12,
2169 },
2170 .c = {
2171 .dbg_name = "sata_phy_cfg_clk",
2172 .ops = &clk_ops_branch,
2173 CLK_INIT(sata_phy_cfg_clk.c),
Stephen Boyd973e4ba2011-07-12 17:06:01 -07002174 },
2175};
2176
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002177static struct branch_clk tsif_p_clk = {
2178 .b = {
2179 .ctl_reg = TSIF_HCLK_CTL_REG,
2180 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002181 .hwcg_reg = TSIF_HCLK_CTL_REG,
2182 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002183 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2184 .halt_bit = 7,
2185 },
2186 .c = {
2187 .dbg_name = "tsif_p_clk",
2188 .ops = &clk_ops_branch,
2189 CLK_INIT(tsif_p_clk.c),
2190 },
2191};
2192
2193static struct branch_clk usb_fs1_p_clk = {
2194 .b = {
2195 .ctl_reg = USB_FSn_HCLK_CTL_REG(1),
2196 .en_mask = BIT(4),
2197 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2198 .halt_bit = 17,
2199 },
2200 .c = {
2201 .dbg_name = "usb_fs1_p_clk",
2202 .ops = &clk_ops_branch,
2203 CLK_INIT(usb_fs1_p_clk.c),
2204 },
2205};
2206
2207static struct branch_clk usb_fs2_p_clk = {
2208 .b = {
2209 .ctl_reg = USB_FSn_HCLK_CTL_REG(2),
2210 .en_mask = BIT(4),
2211 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2212 .halt_bit = 14,
2213 },
2214 .c = {
2215 .dbg_name = "usb_fs2_p_clk",
2216 .ops = &clk_ops_branch,
2217 CLK_INIT(usb_fs2_p_clk.c),
2218 },
2219};
2220
2221static struct branch_clk usb_hs1_p_clk = {
2222 .b = {
2223 .ctl_reg = USB_HS1_HCLK_CTL_REG,
2224 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002225 .hwcg_reg = USB_HS1_HCLK_CTL_REG,
2226 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002227 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2228 .halt_bit = 1,
2229 },
2230 .c = {
2231 .dbg_name = "usb_hs1_p_clk",
2232 .ops = &clk_ops_branch,
2233 CLK_INIT(usb_hs1_p_clk.c),
2234 },
2235};
2236
Tianyi Gou41515e22011-09-01 19:37:43 -07002237static struct branch_clk usb_hs3_p_clk = {
2238 .b = {
2239 .ctl_reg = USB_HS3_HCLK_CTL_REG,
2240 .en_mask = BIT(4),
2241 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2242 .halt_bit = 31,
2243 },
2244 .c = {
2245 .dbg_name = "usb_hs3_p_clk",
2246 .ops = &clk_ops_branch,
2247 CLK_INIT(usb_hs3_p_clk.c),
2248 },
2249};
2250
2251static struct branch_clk usb_hs4_p_clk = {
2252 .b = {
2253 .ctl_reg = USB_HS4_HCLK_CTL_REG,
2254 .en_mask = BIT(4),
2255 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2256 .halt_bit = 7,
2257 },
2258 .c = {
2259 .dbg_name = "usb_hs4_p_clk",
2260 .ops = &clk_ops_branch,
2261 CLK_INIT(usb_hs4_p_clk.c),
2262 },
2263};
2264
Stephen Boyd94625ef2011-07-12 17:06:01 -07002265static struct branch_clk usb_hsic_p_clk = {
2266 .b = {
2267 .ctl_reg = USB_HSIC_HCLK_CTL_REG,
2268 .en_mask = BIT(4),
2269 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2270 .halt_bit = 28,
2271 },
2272 .c = {
2273 .dbg_name = "usb_hsic_p_clk",
2274 .ops = &clk_ops_branch,
2275 CLK_INIT(usb_hsic_p_clk.c),
2276 },
2277};
2278
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002279static struct branch_clk sdc1_p_clk = {
2280 .b = {
2281 .ctl_reg = SDCn_HCLK_CTL_REG(1),
2282 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002283 .hwcg_reg = SDCn_HCLK_CTL_REG(1),
2284 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002285 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2286 .halt_bit = 11,
2287 },
2288 .c = {
2289 .dbg_name = "sdc1_p_clk",
2290 .ops = &clk_ops_branch,
2291 CLK_INIT(sdc1_p_clk.c),
2292 },
2293};
2294
2295static struct branch_clk sdc2_p_clk = {
2296 .b = {
2297 .ctl_reg = SDCn_HCLK_CTL_REG(2),
2298 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002299 .hwcg_reg = SDCn_HCLK_CTL_REG(2),
2300 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002301 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2302 .halt_bit = 10,
2303 },
2304 .c = {
2305 .dbg_name = "sdc2_p_clk",
2306 .ops = &clk_ops_branch,
2307 CLK_INIT(sdc2_p_clk.c),
2308 },
2309};
2310
2311static struct branch_clk sdc3_p_clk = {
2312 .b = {
2313 .ctl_reg = SDCn_HCLK_CTL_REG(3),
2314 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002315 .hwcg_reg = SDCn_HCLK_CTL_REG(3),
2316 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002317 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2318 .halt_bit = 9,
2319 },
2320 .c = {
2321 .dbg_name = "sdc3_p_clk",
2322 .ops = &clk_ops_branch,
2323 CLK_INIT(sdc3_p_clk.c),
2324 },
2325};
2326
2327static struct branch_clk sdc4_p_clk = {
2328 .b = {
2329 .ctl_reg = SDCn_HCLK_CTL_REG(4),
2330 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002331 .hwcg_reg = SDCn_HCLK_CTL_REG(4),
2332 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002333 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2334 .halt_bit = 8,
2335 },
2336 .c = {
2337 .dbg_name = "sdc4_p_clk",
2338 .ops = &clk_ops_branch,
2339 CLK_INIT(sdc4_p_clk.c),
2340 },
2341};
2342
2343static struct branch_clk sdc5_p_clk = {
2344 .b = {
2345 .ctl_reg = SDCn_HCLK_CTL_REG(5),
2346 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002347 .hwcg_reg = SDCn_HCLK_CTL_REG(5),
2348 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002349 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2350 .halt_bit = 7,
2351 },
2352 .c = {
2353 .dbg_name = "sdc5_p_clk",
2354 .ops = &clk_ops_branch,
2355 CLK_INIT(sdc5_p_clk.c),
2356 },
2357};
2358
2359/* HW-Voteable Clocks */
2360static struct branch_clk adm0_clk = {
2361 .b = {
2362 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2363 .en_mask = BIT(2),
2364 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2365 .halt_check = HALT_VOTED,
2366 .halt_bit = 14,
2367 },
2368 .c = {
2369 .dbg_name = "adm0_clk",
2370 .ops = &clk_ops_branch,
2371 CLK_INIT(adm0_clk.c),
2372 },
2373};
2374
2375static struct branch_clk adm0_p_clk = {
2376 .b = {
2377 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2378 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002379 .hwcg_reg = ADM0_PBUS_CLK_CTL_REG,
2380 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002381 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2382 .halt_check = HALT_VOTED,
2383 .halt_bit = 13,
2384 },
2385 .c = {
2386 .dbg_name = "adm0_p_clk",
2387 .ops = &clk_ops_branch,
2388 CLK_INIT(adm0_p_clk.c),
2389 },
2390};
2391
2392static struct branch_clk pmic_arb0_p_clk = {
2393 .b = {
2394 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2395 .en_mask = BIT(8),
2396 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2397 .halt_check = HALT_VOTED,
2398 .halt_bit = 22,
2399 },
2400 .c = {
2401 .dbg_name = "pmic_arb0_p_clk",
2402 .ops = &clk_ops_branch,
2403 CLK_INIT(pmic_arb0_p_clk.c),
2404 },
2405};
2406
2407static struct branch_clk pmic_arb1_p_clk = {
2408 .b = {
2409 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2410 .en_mask = BIT(9),
2411 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2412 .halt_check = HALT_VOTED,
2413 .halt_bit = 21,
2414 },
2415 .c = {
2416 .dbg_name = "pmic_arb1_p_clk",
2417 .ops = &clk_ops_branch,
2418 CLK_INIT(pmic_arb1_p_clk.c),
2419 },
2420};
2421
2422static struct branch_clk pmic_ssbi2_clk = {
2423 .b = {
2424 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2425 .en_mask = BIT(7),
2426 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2427 .halt_check = HALT_VOTED,
2428 .halt_bit = 23,
2429 },
2430 .c = {
2431 .dbg_name = "pmic_ssbi2_clk",
2432 .ops = &clk_ops_branch,
2433 CLK_INIT(pmic_ssbi2_clk.c),
2434 },
2435};
2436
2437static struct branch_clk rpm_msg_ram_p_clk = {
2438 .b = {
2439 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2440 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002441 .hwcg_reg = RPM_MSG_RAM_HCLK_CTL_REG,
2442 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002443 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2444 .halt_check = HALT_VOTED,
2445 .halt_bit = 12,
2446 },
2447 .c = {
2448 .dbg_name = "rpm_msg_ram_p_clk",
2449 .ops = &clk_ops_branch,
2450 CLK_INIT(rpm_msg_ram_p_clk.c),
2451 },
2452};
2453
2454/*
2455 * Multimedia Clocks
2456 */
2457
Stephen Boyd94625ef2011-07-12 17:06:01 -07002458#define CLK_CAM(name, n, hb) \
2459 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002460 .b = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002461 .ctl_reg = CAMCLK##n##_CC_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002462 .en_mask = BIT(0), \
2463 .halt_reg = DBG_BUS_VEC_I_REG, \
2464 .halt_bit = hb, \
2465 }, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002466 .ns_reg = CAMCLK##n##_NS_REG, \
2467 .md_reg = CAMCLK##n##_MD_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002468 .root_en_mask = BIT(2), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002469 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), \
Matt Wagantall07c45472012-02-10 23:27:24 -08002470 .mnd_en_mask = BIT(5), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002471 .ctl_mask = BM(7, 6), \
2472 .set_rate = set_rate_mnd_8, \
2473 .freq_tbl = clk_tbl_cam, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002474 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002475 .c = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002476 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07002477 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002478 VDD_DIG_FMAX_MAP2(LOW, 64000000, NOMINAL, 128000000), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002479 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002480 }, \
2481 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002482#define F_CAM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002483 { \
2484 .freq_hz = f, \
2485 .src_clk = &s##_clk.c, \
2486 .md_val = MD8(8, m, 0, n), \
2487 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2488 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002489 }
2490static struct clk_freq_tbl clk_tbl_cam[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002491 F_CAM( 0, gnd, 1, 0, 0),
2492 F_CAM( 6000000, pll8, 4, 1, 16),
2493 F_CAM( 8000000, pll8, 4, 1, 12),
2494 F_CAM( 12000000, pll8, 4, 1, 8),
2495 F_CAM( 16000000, pll8, 4, 1, 6),
2496 F_CAM( 19200000, pll8, 4, 1, 5),
2497 F_CAM( 24000000, pll8, 4, 1, 4),
2498 F_CAM( 32000000, pll8, 4, 1, 3),
2499 F_CAM( 48000000, pll8, 4, 1, 2),
2500 F_CAM( 64000000, pll8, 3, 1, 2),
2501 F_CAM( 96000000, pll8, 4, 0, 0),
2502 F_CAM(128000000, pll8, 3, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002503 F_END
2504};
2505
Stephen Boyd94625ef2011-07-12 17:06:01 -07002506static CLK_CAM(cam0_clk, 0, 15);
2507static CLK_CAM(cam1_clk, 1, 16);
2508static CLK_CAM(cam2_clk, 2, 31);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002509
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002510#define F_CSI(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002511 { \
2512 .freq_hz = f, \
2513 .src_clk = &s##_clk.c, \
2514 .md_val = MD8(8, m, 0, n), \
2515 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2516 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002517 }
2518static struct clk_freq_tbl clk_tbl_csi[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002519 F_CSI( 0, gnd, 1, 0, 0),
Stephen Boyd092fd182011-10-21 15:56:30 -07002520 F_CSI( 27000000, pxo, 1, 0, 0),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002521 F_CSI( 85330000, pll8, 1, 2, 9),
2522 F_CSI(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002523 F_END
2524};
2525
2526static struct rcg_clk csi0_src_clk = {
2527 .ns_reg = CSI0_NS_REG,
2528 .b = {
2529 .ctl_reg = CSI0_CC_REG,
2530 .halt_check = NOCHECK,
2531 },
2532 .md_reg = CSI0_MD_REG,
2533 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002534 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002535 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002536 .ctl_mask = BM(7, 6),
2537 .set_rate = set_rate_mnd,
2538 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002539 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002540 .c = {
2541 .dbg_name = "csi0_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002542 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002543 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002544 CLK_INIT(csi0_src_clk.c),
2545 },
2546};
2547
2548static struct branch_clk csi0_clk = {
2549 .b = {
2550 .ctl_reg = CSI0_CC_REG,
2551 .en_mask = BIT(0),
2552 .reset_reg = SW_RESET_CORE_REG,
2553 .reset_mask = BIT(8),
2554 .halt_reg = DBG_BUS_VEC_B_REG,
2555 .halt_bit = 13,
2556 },
2557 .parent = &csi0_src_clk.c,
2558 .c = {
2559 .dbg_name = "csi0_clk",
2560 .ops = &clk_ops_branch,
2561 CLK_INIT(csi0_clk.c),
2562 },
2563};
2564
2565static struct branch_clk csi0_phy_clk = {
2566 .b = {
2567 .ctl_reg = CSI0_CC_REG,
2568 .en_mask = BIT(8),
2569 .reset_reg = SW_RESET_CORE_REG,
2570 .reset_mask = BIT(29),
2571 .halt_reg = DBG_BUS_VEC_I_REG,
2572 .halt_bit = 9,
2573 },
2574 .parent = &csi0_src_clk.c,
2575 .c = {
2576 .dbg_name = "csi0_phy_clk",
2577 .ops = &clk_ops_branch,
2578 CLK_INIT(csi0_phy_clk.c),
2579 },
2580};
2581
2582static struct rcg_clk csi1_src_clk = {
2583 .ns_reg = CSI1_NS_REG,
2584 .b = {
2585 .ctl_reg = CSI1_CC_REG,
2586 .halt_check = NOCHECK,
2587 },
2588 .md_reg = CSI1_MD_REG,
2589 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002590 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002591 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002592 .ctl_mask = BM(7, 6),
2593 .set_rate = set_rate_mnd,
2594 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002595 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002596 .c = {
2597 .dbg_name = "csi1_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002598 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002599 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002600 CLK_INIT(csi1_src_clk.c),
2601 },
2602};
2603
2604static struct branch_clk csi1_clk = {
2605 .b = {
2606 .ctl_reg = CSI1_CC_REG,
2607 .en_mask = BIT(0),
2608 .reset_reg = SW_RESET_CORE_REG,
2609 .reset_mask = BIT(18),
2610 .halt_reg = DBG_BUS_VEC_B_REG,
2611 .halt_bit = 14,
2612 },
2613 .parent = &csi1_src_clk.c,
2614 .c = {
2615 .dbg_name = "csi1_clk",
2616 .ops = &clk_ops_branch,
2617 CLK_INIT(csi1_clk.c),
2618 },
2619};
2620
2621static struct branch_clk csi1_phy_clk = {
2622 .b = {
2623 .ctl_reg = CSI1_CC_REG,
2624 .en_mask = BIT(8),
2625 .reset_reg = SW_RESET_CORE_REG,
2626 .reset_mask = BIT(28),
2627 .halt_reg = DBG_BUS_VEC_I_REG,
2628 .halt_bit = 10,
2629 },
2630 .parent = &csi1_src_clk.c,
2631 .c = {
2632 .dbg_name = "csi1_phy_clk",
2633 .ops = &clk_ops_branch,
2634 CLK_INIT(csi1_phy_clk.c),
2635 },
2636};
2637
Stephen Boyd94625ef2011-07-12 17:06:01 -07002638static struct rcg_clk csi2_src_clk = {
2639 .ns_reg = CSI2_NS_REG,
2640 .b = {
2641 .ctl_reg = CSI2_CC_REG,
2642 .halt_check = NOCHECK,
2643 },
2644 .md_reg = CSI2_MD_REG,
2645 .root_en_mask = BIT(2),
2646 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002647 .mnd_en_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002648 .ctl_mask = BM(7, 6),
2649 .set_rate = set_rate_mnd,
2650 .freq_tbl = clk_tbl_csi,
2651 .current_freq = &rcg_dummy_freq,
2652 .c = {
2653 .dbg_name = "csi2_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002654 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002655 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002656 CLK_INIT(csi2_src_clk.c),
2657 },
2658};
2659
2660static struct branch_clk csi2_clk = {
2661 .b = {
2662 .ctl_reg = CSI2_CC_REG,
2663 .en_mask = BIT(0),
2664 .reset_reg = SW_RESET_CORE2_REG,
2665 .reset_mask = BIT(2),
2666 .halt_reg = DBG_BUS_VEC_B_REG,
2667 .halt_bit = 29,
2668 },
2669 .parent = &csi2_src_clk.c,
2670 .c = {
2671 .dbg_name = "csi2_clk",
2672 .ops = &clk_ops_branch,
2673 CLK_INIT(csi2_clk.c),
2674 },
2675};
2676
2677static struct branch_clk csi2_phy_clk = {
2678 .b = {
2679 .ctl_reg = CSI2_CC_REG,
2680 .en_mask = BIT(8),
2681 .reset_reg = SW_RESET_CORE_REG,
2682 .reset_mask = BIT(31),
2683 .halt_reg = DBG_BUS_VEC_I_REG,
2684 .halt_bit = 29,
2685 },
2686 .parent = &csi2_src_clk.c,
2687 .c = {
2688 .dbg_name = "csi2_phy_clk",
2689 .ops = &clk_ops_branch,
2690 CLK_INIT(csi2_phy_clk.c),
2691 },
2692};
2693
Stephen Boyd092fd182011-10-21 15:56:30 -07002694static struct clk *pix_rdi_mux_map[] = {
2695 [0] = &csi0_clk.c,
2696 [1] = &csi1_clk.c,
2697 [2] = &csi2_clk.c,
2698 NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002699};
2700
Stephen Boyd092fd182011-10-21 15:56:30 -07002701struct pix_rdi_clk {
2702 bool enabled;
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002703 unsigned long cur_rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002704
2705 void __iomem *const s_reg;
2706 u32 s_mask;
2707
2708 void __iomem *const s2_reg;
2709 u32 s2_mask;
2710
2711 struct branch b;
2712 struct clk c;
2713};
2714
2715static inline struct pix_rdi_clk *to_pix_rdi_clk(struct clk *clk)
2716{
2717 return container_of(clk, struct pix_rdi_clk, c);
2718}
2719
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002720static int pix_rdi_clk_set_rate(struct clk *c, unsigned long rate)
Stephen Boyd092fd182011-10-21 15:56:30 -07002721{
2722 int ret, i;
2723 u32 reg;
2724 unsigned long flags;
2725 struct pix_rdi_clk *clk = to_pix_rdi_clk(c);
2726 struct clk **mux_map = pix_rdi_mux_map;
2727
2728 /*
2729 * These clocks select three inputs via two muxes. One mux selects
2730 * between csi0 and csi1 and the second mux selects between that mux's
2731 * output and csi2. The source and destination selections for each
2732 * mux must be clocking for the switch to succeed so just turn on
2733 * all three sources because it's easier than figuring out what source
2734 * needs to be on at what time.
2735 */
2736 for (i = 0; mux_map[i]; i++) {
2737 ret = clk_enable(mux_map[i]);
2738 if (ret)
2739 goto err;
2740 }
2741 if (rate >= i) {
2742 ret = -EINVAL;
2743 goto err;
2744 }
2745 /* Keep the new source on when switching inputs of an enabled clock */
2746 if (clk->enabled) {
2747 clk_disable(mux_map[clk->cur_rate]);
2748 clk_enable(mux_map[rate]);
2749 }
2750 spin_lock_irqsave(&local_clock_reg_lock, flags);
2751 reg = readl_relaxed(clk->s2_reg);
2752 reg &= ~clk->s2_mask;
2753 reg |= rate == 2 ? clk->s2_mask : 0;
2754 writel_relaxed(reg, clk->s2_reg);
2755 /*
2756 * Wait at least 6 cycles of slowest clock
2757 * for the glitch-free MUX to fully switch sources.
2758 */
2759 mb();
2760 udelay(1);
2761 reg = readl_relaxed(clk->s_reg);
2762 reg &= ~clk->s_mask;
2763 reg |= rate == 1 ? clk->s_mask : 0;
2764 writel_relaxed(reg, clk->s_reg);
2765 /*
2766 * Wait at least 6 cycles of slowest clock
2767 * for the glitch-free MUX to fully switch sources.
2768 */
2769 mb();
2770 udelay(1);
2771 clk->cur_rate = rate;
2772 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2773err:
2774 for (i--; i >= 0; i--)
2775 clk_disable(mux_map[i]);
2776
2777 return 0;
2778}
2779
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002780static unsigned long pix_rdi_clk_get_rate(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002781{
2782 return to_pix_rdi_clk(c)->cur_rate;
2783}
2784
2785static int pix_rdi_clk_enable(struct clk *c)
2786{
2787 unsigned long flags;
2788 struct pix_rdi_clk *clk = to_pix_rdi_clk(c);
2789
2790 spin_lock_irqsave(&local_clock_reg_lock, flags);
2791 __branch_clk_enable_reg(&clk->b, clk->c.dbg_name);
2792 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2793 clk->enabled = true;
2794
2795 return 0;
2796}
2797
2798static void pix_rdi_clk_disable(struct clk *c)
2799{
2800 unsigned long flags;
2801 struct pix_rdi_clk *clk = to_pix_rdi_clk(c);
2802
2803 spin_lock_irqsave(&local_clock_reg_lock, flags);
2804 __branch_clk_disable_reg(&clk->b, clk->c.dbg_name);
2805 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2806 clk->enabled = false;
2807}
2808
2809static int pix_rdi_clk_reset(struct clk *clk, enum clk_reset_action action)
2810{
2811 return branch_reset(&to_pix_rdi_clk(clk)->b, action);
2812}
2813
2814static struct clk *pix_rdi_clk_get_parent(struct clk *c)
2815{
2816 struct pix_rdi_clk *clk = to_pix_rdi_clk(c);
2817
2818 return pix_rdi_mux_map[clk->cur_rate];
2819}
2820
2821static int pix_rdi_clk_list_rate(struct clk *c, unsigned n)
2822{
2823 if (pix_rdi_mux_map[n])
2824 return n;
2825 return -ENXIO;
2826}
2827
Matt Wagantalla15833b2012-04-03 11:00:56 -07002828static enum handoff pix_rdi_clk_handoff(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002829{
2830 u32 reg;
2831 struct pix_rdi_clk *clk = to_pix_rdi_clk(c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07002832 enum handoff ret;
2833
2834 ret = branch_handoff(&clk->b, &clk->c);
2835 if (ret == HANDOFF_DISABLED_CLK)
2836 return ret;
Stephen Boyd092fd182011-10-21 15:56:30 -07002837
2838 reg = readl_relaxed(clk->s_reg);
2839 clk->cur_rate = reg & clk->s_mask ? 1 : 0;
2840 reg = readl_relaxed(clk->s2_reg);
2841 clk->cur_rate = reg & clk->s2_mask ? 2 : clk->cur_rate;
Matt Wagantalla15833b2012-04-03 11:00:56 -07002842
2843 return HANDOFF_ENABLED_CLK;
Stephen Boyd092fd182011-10-21 15:56:30 -07002844}
2845
2846static struct clk_ops clk_ops_pix_rdi_8960 = {
2847 .enable = pix_rdi_clk_enable,
2848 .disable = pix_rdi_clk_disable,
2849 .auto_off = pix_rdi_clk_disable,
2850 .handoff = pix_rdi_clk_handoff,
2851 .set_rate = pix_rdi_clk_set_rate,
2852 .get_rate = pix_rdi_clk_get_rate,
2853 .list_rate = pix_rdi_clk_list_rate,
2854 .reset = pix_rdi_clk_reset,
Stephen Boyd092fd182011-10-21 15:56:30 -07002855 .get_parent = pix_rdi_clk_get_parent,
2856};
2857
2858static struct pix_rdi_clk csi_pix_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002859 .b = {
2860 .ctl_reg = MISC_CC_REG,
2861 .en_mask = BIT(26),
2862 .halt_check = DELAY,
2863 .reset_reg = SW_RESET_CORE_REG,
2864 .reset_mask = BIT(26),
2865 },
Stephen Boyd092fd182011-10-21 15:56:30 -07002866 .s_reg = MISC_CC_REG,
2867 .s_mask = BIT(25),
2868 .s2_reg = MISC_CC3_REG,
2869 .s2_mask = BIT(13),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002870 .c = {
2871 .dbg_name = "csi_pix_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07002872 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002873 CLK_INIT(csi_pix_clk.c),
2874 },
2875};
2876
Stephen Boyd092fd182011-10-21 15:56:30 -07002877static struct pix_rdi_clk csi_pix1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07002878 .b = {
2879 .ctl_reg = MISC_CC3_REG,
2880 .en_mask = BIT(10),
2881 .halt_check = DELAY,
2882 .reset_reg = SW_RESET_CORE_REG,
2883 .reset_mask = BIT(30),
2884 },
Stephen Boyd092fd182011-10-21 15:56:30 -07002885 .s_reg = MISC_CC3_REG,
2886 .s_mask = BIT(8),
2887 .s2_reg = MISC_CC3_REG,
2888 .s2_mask = BIT(9),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002889 .c = {
2890 .dbg_name = "csi_pix1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07002891 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002892 CLK_INIT(csi_pix1_clk.c),
2893 },
2894};
2895
Stephen Boyd092fd182011-10-21 15:56:30 -07002896static struct pix_rdi_clk csi_rdi_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002897 .b = {
2898 .ctl_reg = MISC_CC_REG,
2899 .en_mask = BIT(13),
2900 .halt_check = DELAY,
2901 .reset_reg = SW_RESET_CORE_REG,
2902 .reset_mask = BIT(27),
2903 },
Stephen Boyd092fd182011-10-21 15:56:30 -07002904 .s_reg = MISC_CC_REG,
2905 .s_mask = BIT(12),
2906 .s2_reg = MISC_CC3_REG,
2907 .s2_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002908 .c = {
2909 .dbg_name = "csi_rdi_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07002910 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002911 CLK_INIT(csi_rdi_clk.c),
2912 },
2913};
2914
Stephen Boyd092fd182011-10-21 15:56:30 -07002915static struct pix_rdi_clk csi_rdi1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07002916 .b = {
2917 .ctl_reg = MISC_CC3_REG,
2918 .en_mask = BIT(2),
2919 .halt_check = DELAY,
2920 .reset_reg = SW_RESET_CORE2_REG,
2921 .reset_mask = BIT(1),
2922 },
Stephen Boyd092fd182011-10-21 15:56:30 -07002923 .s_reg = MISC_CC3_REG,
2924 .s_mask = BIT(0),
2925 .s2_reg = MISC_CC3_REG,
2926 .s2_mask = BIT(1),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002927 .c = {
2928 .dbg_name = "csi_rdi1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07002929 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002930 CLK_INIT(csi_rdi1_clk.c),
2931 },
2932};
2933
Stephen Boyd092fd182011-10-21 15:56:30 -07002934static struct pix_rdi_clk csi_rdi2_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07002935 .b = {
2936 .ctl_reg = MISC_CC3_REG,
2937 .en_mask = BIT(6),
2938 .halt_check = DELAY,
2939 .reset_reg = SW_RESET_CORE2_REG,
2940 .reset_mask = BIT(0),
2941 },
Stephen Boyd092fd182011-10-21 15:56:30 -07002942 .s_reg = MISC_CC3_REG,
2943 .s_mask = BIT(4),
2944 .s2_reg = MISC_CC3_REG,
2945 .s2_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002946 .c = {
2947 .dbg_name = "csi_rdi2_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07002948 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002949 CLK_INIT(csi_rdi2_clk.c),
2950 },
2951};
2952
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002953#define F_CSI_PHYTIMER(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002954 { \
2955 .freq_hz = f, \
2956 .src_clk = &s##_clk.c, \
2957 .md_val = MD8(8, m, 0, n), \
2958 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2959 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002960 }
2961static struct clk_freq_tbl clk_tbl_csi_phytimer[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002962 F_CSI_PHYTIMER( 0, gnd, 1, 0, 0),
2963 F_CSI_PHYTIMER( 85330000, pll8, 1, 2, 9),
2964 F_CSI_PHYTIMER(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002965 F_END
2966};
2967
2968static struct rcg_clk csiphy_timer_src_clk = {
2969 .ns_reg = CSIPHYTIMER_NS_REG,
2970 .b = {
2971 .ctl_reg = CSIPHYTIMER_CC_REG,
2972 .halt_check = NOCHECK,
2973 },
2974 .md_reg = CSIPHYTIMER_MD_REG,
2975 .root_en_mask = BIT(2),
2976 .ns_mask = (BM(31, 24) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08002977 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002978 .ctl_mask = BM(7, 6),
2979 .set_rate = set_rate_mnd_8,
2980 .freq_tbl = clk_tbl_csi_phytimer,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002981 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002982 .c = {
2983 .dbg_name = "csiphy_timer_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002984 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002985 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002986 CLK_INIT(csiphy_timer_src_clk.c),
2987 },
2988};
2989
2990static struct branch_clk csi0phy_timer_clk = {
2991 .b = {
2992 .ctl_reg = CSIPHYTIMER_CC_REG,
2993 .en_mask = BIT(0),
2994 .halt_reg = DBG_BUS_VEC_I_REG,
2995 .halt_bit = 17,
2996 },
2997 .parent = &csiphy_timer_src_clk.c,
2998 .c = {
2999 .dbg_name = "csi0phy_timer_clk",
3000 .ops = &clk_ops_branch,
3001 CLK_INIT(csi0phy_timer_clk.c),
3002 },
3003};
3004
3005static struct branch_clk csi1phy_timer_clk = {
3006 .b = {
3007 .ctl_reg = CSIPHYTIMER_CC_REG,
3008 .en_mask = BIT(9),
3009 .halt_reg = DBG_BUS_VEC_I_REG,
3010 .halt_bit = 18,
3011 },
3012 .parent = &csiphy_timer_src_clk.c,
3013 .c = {
3014 .dbg_name = "csi1phy_timer_clk",
3015 .ops = &clk_ops_branch,
3016 CLK_INIT(csi1phy_timer_clk.c),
3017 },
3018};
3019
Stephen Boyd94625ef2011-07-12 17:06:01 -07003020static struct branch_clk csi2phy_timer_clk = {
3021 .b = {
3022 .ctl_reg = CSIPHYTIMER_CC_REG,
3023 .en_mask = BIT(11),
3024 .halt_reg = DBG_BUS_VEC_I_REG,
3025 .halt_bit = 30,
3026 },
3027 .parent = &csiphy_timer_src_clk.c,
3028 .c = {
3029 .dbg_name = "csi2phy_timer_clk",
3030 .ops = &clk_ops_branch,
3031 CLK_INIT(csi2phy_timer_clk.c),
3032 },
3033};
3034
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003035#define F_DSI(d) \
3036 { \
3037 .freq_hz = d, \
3038 .ns_val = BVAL(15, 12, (d-1)), \
3039 }
3040/*
3041 * The DSI_BYTE/ESC clock is sourced from the DSI PHY PLL, which may change rate
3042 * without this clock driver knowing. So, overload the clk_set_rate() to set
3043 * the divider (1 to 16) of the clock with respect to the PLL rate.
3044 */
3045static struct clk_freq_tbl clk_tbl_dsi_byte[] = {
3046 F_DSI(1), F_DSI(2), F_DSI(3), F_DSI(4),
3047 F_DSI(5), F_DSI(6), F_DSI(7), F_DSI(8),
3048 F_DSI(9), F_DSI(10), F_DSI(11), F_DSI(12),
3049 F_DSI(13), F_DSI(14), F_DSI(15), F_DSI(16),
3050 F_END
3051};
3052
3053static struct rcg_clk dsi1_byte_clk = {
3054 .b = {
3055 .ctl_reg = DSI1_BYTE_CC_REG,
3056 .en_mask = BIT(0),
3057 .reset_reg = SW_RESET_CORE_REG,
3058 .reset_mask = BIT(7),
3059 .halt_reg = DBG_BUS_VEC_B_REG,
3060 .halt_bit = 21,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003061 .retain_reg = DSI1_BYTE_CC_REG,
3062 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003063 },
3064 .ns_reg = DSI1_BYTE_NS_REG,
3065 .root_en_mask = BIT(2),
3066 .ns_mask = BM(15, 12),
3067 .set_rate = set_rate_nop,
3068 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003069 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003070 .c = {
3071 .dbg_name = "dsi1_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003072 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003073 CLK_INIT(dsi1_byte_clk.c),
3074 },
3075};
3076
3077static struct rcg_clk dsi2_byte_clk = {
3078 .b = {
3079 .ctl_reg = DSI2_BYTE_CC_REG,
3080 .en_mask = BIT(0),
3081 .reset_reg = SW_RESET_CORE_REG,
3082 .reset_mask = BIT(25),
3083 .halt_reg = DBG_BUS_VEC_B_REG,
3084 .halt_bit = 20,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003085 .retain_reg = DSI2_BYTE_CC_REG,
3086 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003087 },
3088 .ns_reg = DSI2_BYTE_NS_REG,
3089 .root_en_mask = BIT(2),
3090 .ns_mask = BM(15, 12),
3091 .set_rate = set_rate_nop,
3092 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003093 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003094 .c = {
3095 .dbg_name = "dsi2_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003096 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003097 CLK_INIT(dsi2_byte_clk.c),
3098 },
3099};
3100
3101static struct rcg_clk dsi1_esc_clk = {
3102 .b = {
3103 .ctl_reg = DSI1_ESC_CC_REG,
3104 .en_mask = BIT(0),
3105 .reset_reg = SW_RESET_CORE_REG,
3106 .halt_reg = DBG_BUS_VEC_I_REG,
3107 .halt_bit = 1,
3108 },
3109 .ns_reg = DSI1_ESC_NS_REG,
3110 .root_en_mask = BIT(2),
3111 .ns_mask = BM(15, 12),
3112 .set_rate = set_rate_nop,
3113 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003114 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003115 .c = {
3116 .dbg_name = "dsi1_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003117 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003118 CLK_INIT(dsi1_esc_clk.c),
3119 },
3120};
3121
3122static struct rcg_clk dsi2_esc_clk = {
3123 .b = {
3124 .ctl_reg = DSI2_ESC_CC_REG,
3125 .en_mask = BIT(0),
3126 .halt_reg = DBG_BUS_VEC_I_REG,
3127 .halt_bit = 3,
3128 },
3129 .ns_reg = DSI2_ESC_NS_REG,
3130 .root_en_mask = BIT(2),
3131 .ns_mask = BM(15, 12),
3132 .set_rate = set_rate_nop,
3133 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003134 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003135 .c = {
3136 .dbg_name = "dsi2_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003137 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003138 CLK_INIT(dsi2_esc_clk.c),
3139 },
3140};
3141
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003142#define F_GFX2D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003143 { \
3144 .freq_hz = f, \
3145 .src_clk = &s##_clk.c, \
3146 .md_val = MD4(4, m, 0, n), \
3147 .ns_val = NS_MND_BANKED4(20, 16, n, m, 3, 0, s##_to_mm_mux), \
3148 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003149 }
3150static struct clk_freq_tbl clk_tbl_gfx2d[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003151 F_GFX2D( 0, gnd, 0, 0),
3152 F_GFX2D( 27000000, pxo, 0, 0),
3153 F_GFX2D( 48000000, pll8, 1, 8),
3154 F_GFX2D( 54857000, pll8, 1, 7),
3155 F_GFX2D( 64000000, pll8, 1, 6),
3156 F_GFX2D( 76800000, pll8, 1, 5),
3157 F_GFX2D( 96000000, pll8, 1, 4),
3158 F_GFX2D(128000000, pll8, 1, 3),
3159 F_GFX2D(145455000, pll2, 2, 11),
3160 F_GFX2D(160000000, pll2, 1, 5),
3161 F_GFX2D(177778000, pll2, 2, 9),
3162 F_GFX2D(200000000, pll2, 1, 4),
3163 F_GFX2D(228571000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003164 F_END
3165};
3166
3167static struct bank_masks bmnd_info_gfx2d0 = {
3168 .bank_sel_mask = BIT(11),
3169 .bank0_mask = {
3170 .md_reg = GFX2D0_MD0_REG,
3171 .ns_mask = BM(23, 20) | BM(5, 3),
3172 .rst_mask = BIT(25),
3173 .mnd_en_mask = BIT(8),
3174 .mode_mask = BM(10, 9),
3175 },
3176 .bank1_mask = {
3177 .md_reg = GFX2D0_MD1_REG,
3178 .ns_mask = BM(19, 16) | BM(2, 0),
3179 .rst_mask = BIT(24),
3180 .mnd_en_mask = BIT(5),
3181 .mode_mask = BM(7, 6),
3182 },
3183};
3184
3185static struct rcg_clk gfx2d0_clk = {
3186 .b = {
3187 .ctl_reg = GFX2D0_CC_REG,
3188 .en_mask = BIT(0),
3189 .reset_reg = SW_RESET_CORE_REG,
3190 .reset_mask = BIT(14),
3191 .halt_reg = DBG_BUS_VEC_A_REG,
3192 .halt_bit = 9,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003193 .retain_reg = GFX2D0_CC_REG,
3194 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003195 },
3196 .ns_reg = GFX2D0_NS_REG,
3197 .root_en_mask = BIT(2),
3198 .set_rate = set_rate_mnd_banked,
3199 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003200 .bank_info = &bmnd_info_gfx2d0,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003201 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003202 .c = {
3203 .dbg_name = "gfx2d0_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003204 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003205 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3206 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003207 CLK_INIT(gfx2d0_clk.c),
3208 },
3209};
3210
3211static struct bank_masks bmnd_info_gfx2d1 = {
3212 .bank_sel_mask = BIT(11),
3213 .bank0_mask = {
3214 .md_reg = GFX2D1_MD0_REG,
3215 .ns_mask = BM(23, 20) | BM(5, 3),
3216 .rst_mask = BIT(25),
3217 .mnd_en_mask = BIT(8),
3218 .mode_mask = BM(10, 9),
3219 },
3220 .bank1_mask = {
3221 .md_reg = GFX2D1_MD1_REG,
3222 .ns_mask = BM(19, 16) | BM(2, 0),
3223 .rst_mask = BIT(24),
3224 .mnd_en_mask = BIT(5),
3225 .mode_mask = BM(7, 6),
3226 },
3227};
3228
3229static struct rcg_clk gfx2d1_clk = {
3230 .b = {
3231 .ctl_reg = GFX2D1_CC_REG,
3232 .en_mask = BIT(0),
3233 .reset_reg = SW_RESET_CORE_REG,
3234 .reset_mask = BIT(13),
3235 .halt_reg = DBG_BUS_VEC_A_REG,
3236 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003237 .retain_reg = GFX2D1_CC_REG,
3238 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003239 },
3240 .ns_reg = GFX2D1_NS_REG,
3241 .root_en_mask = BIT(2),
3242 .set_rate = set_rate_mnd_banked,
3243 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003244 .bank_info = &bmnd_info_gfx2d1,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003245 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003246 .c = {
3247 .dbg_name = "gfx2d1_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003248 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003249 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3250 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003251 CLK_INIT(gfx2d1_clk.c),
3252 },
3253};
3254
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003255#define F_GFX3D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003256 { \
3257 .freq_hz = f, \
3258 .src_clk = &s##_clk.c, \
3259 .md_val = MD4(4, m, 0, n), \
3260 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3261 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003262 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003263
3264static struct clk_freq_tbl clk_tbl_gfx3d_8960[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003265 F_GFX3D( 0, gnd, 0, 0),
3266 F_GFX3D( 27000000, pxo, 0, 0),
3267 F_GFX3D( 48000000, pll8, 1, 8),
3268 F_GFX3D( 54857000, pll8, 1, 7),
3269 F_GFX3D( 64000000, pll8, 1, 6),
3270 F_GFX3D( 76800000, pll8, 1, 5),
3271 F_GFX3D( 96000000, pll8, 1, 4),
3272 F_GFX3D(128000000, pll8, 1, 3),
3273 F_GFX3D(145455000, pll2, 2, 11),
3274 F_GFX3D(160000000, pll2, 1, 5),
3275 F_GFX3D(177778000, pll2, 2, 9),
3276 F_GFX3D(200000000, pll2, 1, 4),
3277 F_GFX3D(228571000, pll2, 2, 7),
3278 F_GFX3D(266667000, pll2, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003279 F_GFX3D(300000000, pll3, 1, 4),
3280 F_GFX3D(320000000, pll2, 2, 5),
3281 F_GFX3D(400000000, pll2, 1, 2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003282 F_END
3283};
3284
Tianyi Gou41515e22011-09-01 19:37:43 -07003285static struct clk_freq_tbl clk_tbl_gfx3d_8064[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003286 F_GFX3D( 0, gnd, 0, 0),
3287 F_GFX3D( 27000000, pxo, 0, 0),
3288 F_GFX3D( 48000000, pll8, 1, 8),
3289 F_GFX3D( 54857000, pll8, 1, 7),
3290 F_GFX3D( 64000000, pll8, 1, 6),
3291 F_GFX3D( 76800000, pll8, 1, 5),
3292 F_GFX3D( 96000000, pll8, 1, 4),
3293 F_GFX3D(128000000, pll8, 1, 3),
3294 F_GFX3D(145455000, pll2, 2, 11),
3295 F_GFX3D(160000000, pll2, 1, 5),
3296 F_GFX3D(177778000, pll2, 2, 9),
3297 F_GFX3D(200000000, pll2, 1, 4),
3298 F_GFX3D(228571000, pll2, 2, 7),
3299 F_GFX3D(266667000, pll2, 1, 3),
Tianyi Gou0c50fe32011-10-19 15:50:35 -07003300 F_GFX3D(325000000, pll15, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003301 F_GFX3D(400000000, pll2, 1, 2),
Tianyi Gou41515e22011-09-01 19:37:43 -07003302 F_END
3303};
3304
Tianyi Goue3d4f542012-03-15 17:06:45 -07003305static struct clk_freq_tbl clk_tbl_gfx3d_8930[] = {
3306 F_GFX3D( 0, gnd, 0, 0),
3307 F_GFX3D( 27000000, pxo, 0, 0),
3308 F_GFX3D( 48000000, pll8, 1, 8),
3309 F_GFX3D( 54857000, pll8, 1, 7),
3310 F_GFX3D( 64000000, pll8, 1, 6),
3311 F_GFX3D( 76800000, pll8, 1, 5),
3312 F_GFX3D( 96000000, pll8, 1, 4),
3313 F_GFX3D(128000000, pll8, 1, 3),
3314 F_GFX3D(145455000, pll2, 2, 11),
3315 F_GFX3D(160000000, pll2, 1, 5),
3316 F_GFX3D(177778000, pll2, 2, 9),
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003317 F_GFX3D(192000000, pll8, 1, 2),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003318 F_GFX3D(200000000, pll2, 1, 4),
3319 F_GFX3D(228571000, pll2, 2, 7),
3320 F_GFX3D(266667000, pll2, 1, 3),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003321 F_GFX3D(320000000, pll2, 2, 5),
3322 F_GFX3D(400000000, pll2, 1, 2),
3323 F_GFX3D(450000000, pll15, 1, 2),
3324 F_END
3325};
3326
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003327static unsigned long fmax_gfx3d_8064[MAX_VDD_LEVELS] __initdata = {
3328 [VDD_DIG_LOW] = 128000000,
3329 [VDD_DIG_NOMINAL] = 325000000,
3330 [VDD_DIG_HIGH] = 400000000
3331};
3332
Tianyi Goue3d4f542012-03-15 17:06:45 -07003333static unsigned long fmax_gfx3d_8930[MAX_VDD_LEVELS] __initdata = {
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003334 [VDD_DIG_LOW] = 192000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003335 [VDD_DIG_NOMINAL] = 320000000,
3336 [VDD_DIG_HIGH] = 450000000
3337};
3338
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003339static struct bank_masks bmnd_info_gfx3d = {
3340 .bank_sel_mask = BIT(11),
3341 .bank0_mask = {
3342 .md_reg = GFX3D_MD0_REG,
3343 .ns_mask = BM(21, 18) | BM(5, 3),
3344 .rst_mask = BIT(23),
3345 .mnd_en_mask = BIT(8),
3346 .mode_mask = BM(10, 9),
3347 },
3348 .bank1_mask = {
3349 .md_reg = GFX3D_MD1_REG,
3350 .ns_mask = BM(17, 14) | BM(2, 0),
3351 .rst_mask = BIT(22),
3352 .mnd_en_mask = BIT(5),
3353 .mode_mask = BM(7, 6),
3354 },
3355};
3356
3357static struct rcg_clk gfx3d_clk = {
3358 .b = {
3359 .ctl_reg = GFX3D_CC_REG,
3360 .en_mask = BIT(0),
3361 .reset_reg = SW_RESET_CORE_REG,
3362 .reset_mask = BIT(12),
3363 .halt_reg = DBG_BUS_VEC_A_REG,
3364 .halt_bit = 4,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003365 .retain_reg = GFX3D_CC_REG,
3366 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003367 },
3368 .ns_reg = GFX3D_NS_REG,
3369 .root_en_mask = BIT(2),
3370 .set_rate = set_rate_mnd_banked,
Tianyi Gou41515e22011-09-01 19:37:43 -07003371 .freq_tbl = clk_tbl_gfx3d_8960,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003372 .bank_info = &bmnd_info_gfx3d,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003373 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003374 .c = {
3375 .dbg_name = "gfx3d_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003376 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003377 VDD_DIG_FMAX_MAP3(LOW, 128000000, NOMINAL, 300000000,
3378 HIGH, 400000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003379 CLK_INIT(gfx3d_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003380 .depends = &gmem_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003381 },
3382};
3383
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003384#define F_VCAP(f, s, m, n) \
Tianyi Gou621f8742011-09-01 21:45:01 -07003385 { \
3386 .freq_hz = f, \
3387 .src_clk = &s##_clk.c, \
3388 .md_val = MD4(4, m, 0, n), \
3389 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3390 .ctl_val = CC_BANKED(9, 6, n), \
Tianyi Gou621f8742011-09-01 21:45:01 -07003391 }
3392
3393static struct clk_freq_tbl clk_tbl_vcap[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003394 F_VCAP( 0, gnd, 0, 0),
3395 F_VCAP( 27000000, pxo, 0, 0),
3396 F_VCAP( 54860000, pll8, 1, 7),
3397 F_VCAP( 64000000, pll8, 1, 6),
3398 F_VCAP( 76800000, pll8, 1, 5),
3399 F_VCAP(128000000, pll8, 1, 3),
3400 F_VCAP(160000000, pll2, 1, 5),
3401 F_VCAP(200000000, pll2, 1, 4),
Tianyi Gou621f8742011-09-01 21:45:01 -07003402 F_END
3403};
3404
3405static struct bank_masks bmnd_info_vcap = {
3406 .bank_sel_mask = BIT(11),
3407 .bank0_mask = {
3408 .md_reg = VCAP_MD0_REG,
3409 .ns_mask = BM(21, 18) | BM(5, 3),
3410 .rst_mask = BIT(23),
3411 .mnd_en_mask = BIT(8),
3412 .mode_mask = BM(10, 9),
3413 },
3414 .bank1_mask = {
3415 .md_reg = VCAP_MD1_REG,
3416 .ns_mask = BM(17, 14) | BM(2, 0),
3417 .rst_mask = BIT(22),
3418 .mnd_en_mask = BIT(5),
3419 .mode_mask = BM(7, 6),
3420 },
3421};
3422
3423static struct rcg_clk vcap_clk = {
3424 .b = {
3425 .ctl_reg = VCAP_CC_REG,
3426 .en_mask = BIT(0),
3427 .halt_reg = DBG_BUS_VEC_J_REG,
3428 .halt_bit = 15,
3429 },
3430 .ns_reg = VCAP_NS_REG,
3431 .root_en_mask = BIT(2),
3432 .set_rate = set_rate_mnd_banked,
3433 .freq_tbl = clk_tbl_vcap,
3434 .bank_info = &bmnd_info_vcap,
3435 .current_freq = &rcg_dummy_freq,
3436 .c = {
3437 .dbg_name = "vcap_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003438 .ops = &clk_ops_rcg,
Tianyi Gou621f8742011-09-01 21:45:01 -07003439 .depends = &vcap_axi_clk.c,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003440 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
Tianyi Gou621f8742011-09-01 21:45:01 -07003441 CLK_INIT(vcap_clk.c),
3442 },
3443};
3444
3445static struct branch_clk vcap_npl_clk = {
3446 .b = {
3447 .ctl_reg = VCAP_CC_REG,
3448 .en_mask = BIT(13),
3449 .halt_reg = DBG_BUS_VEC_J_REG,
3450 .halt_bit = 25,
3451 },
3452 .parent = &vcap_clk.c,
3453 .c = {
3454 .dbg_name = "vcap_npl_clk",
3455 .ops = &clk_ops_branch,
3456 CLK_INIT(vcap_npl_clk.c),
3457 },
3458};
3459
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003460#define F_IJPEG(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003461 { \
3462 .freq_hz = f, \
3463 .src_clk = &s##_clk.c, \
3464 .md_val = MD8(8, m, 0, n), \
3465 .ns_val = NS_MM(23, 16, n, m, 15, 12, d, 2, 0, s##_to_mm_mux), \
3466 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003467 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003468
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003469static struct clk_freq_tbl clk_tbl_ijpeg[] = {
3470 F_IJPEG( 0, gnd, 1, 0, 0),
3471 F_IJPEG( 27000000, pxo, 1, 0, 0),
3472 F_IJPEG( 36570000, pll8, 1, 2, 21),
3473 F_IJPEG( 54860000, pll8, 7, 0, 0),
3474 F_IJPEG( 96000000, pll8, 4, 0, 0),
3475 F_IJPEG(109710000, pll8, 1, 2, 7),
3476 F_IJPEG(128000000, pll8, 3, 0, 0),
3477 F_IJPEG(153600000, pll8, 1, 2, 5),
3478 F_IJPEG(200000000, pll2, 4, 0, 0),
3479 F_IJPEG(228571000, pll2, 1, 2, 7),
3480 F_IJPEG(266667000, pll2, 1, 1, 3),
3481 F_IJPEG(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003482 F_END
3483};
3484
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003485static unsigned long fmax_ijpeg_8064[MAX_VDD_LEVELS] __initdata = {
3486 [VDD_DIG_LOW] = 128000000,
3487 [VDD_DIG_NOMINAL] = 266667000,
3488 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07003489};
3490
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003491static struct rcg_clk ijpeg_clk = {
3492 .b = {
3493 .ctl_reg = IJPEG_CC_REG,
3494 .en_mask = BIT(0),
3495 .reset_reg = SW_RESET_CORE_REG,
3496 .reset_mask = BIT(9),
3497 .halt_reg = DBG_BUS_VEC_A_REG,
3498 .halt_bit = 24,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003499 .retain_reg = IJPEG_CC_REG,
3500 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003501 },
3502 .ns_reg = IJPEG_NS_REG,
3503 .md_reg = IJPEG_MD_REG,
3504 .root_en_mask = BIT(2),
3505 .ns_mask = (BM(23, 16) | BM(15, 12) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003506 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003507 .ctl_mask = BM(7, 6),
3508 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003509 .freq_tbl = clk_tbl_ijpeg,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003510 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003511 .c = {
3512 .dbg_name = "ijpeg_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003513 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003514 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
3515 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003516 CLK_INIT(ijpeg_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003517 .depends = &ijpeg_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003518 },
3519};
3520
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003521#define F_JPEGD(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003522 { \
3523 .freq_hz = f, \
3524 .src_clk = &s##_clk.c, \
3525 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003526 }
3527static struct clk_freq_tbl clk_tbl_jpegd[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003528 F_JPEGD( 0, gnd, 1),
3529 F_JPEGD( 64000000, pll8, 6),
3530 F_JPEGD( 76800000, pll8, 5),
3531 F_JPEGD( 96000000, pll8, 4),
3532 F_JPEGD(160000000, pll2, 5),
3533 F_JPEGD(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003534 F_END
3535};
3536
3537static struct rcg_clk jpegd_clk = {
3538 .b = {
3539 .ctl_reg = JPEGD_CC_REG,
3540 .en_mask = BIT(0),
3541 .reset_reg = SW_RESET_CORE_REG,
3542 .reset_mask = BIT(19),
3543 .halt_reg = DBG_BUS_VEC_A_REG,
3544 .halt_bit = 19,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003545 .retain_reg = JPEGD_CC_REG,
3546 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003547 },
3548 .ns_reg = JPEGD_NS_REG,
3549 .root_en_mask = BIT(2),
3550 .ns_mask = (BM(15, 12) | BM(2, 0)),
3551 .set_rate = set_rate_nop,
3552 .freq_tbl = clk_tbl_jpegd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003553 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003554 .c = {
3555 .dbg_name = "jpegd_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003556 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003557 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003558 CLK_INIT(jpegd_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003559 .depends = &jpegd_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003560 },
3561};
3562
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003563#define F_MDP(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003564 { \
3565 .freq_hz = f, \
3566 .src_clk = &s##_clk.c, \
3567 .md_val = MD8(8, m, 0, n), \
3568 .ns_val = NS_MND_BANKED8(22, 14, n, m, 3, 0, s##_to_mm_mux), \
3569 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003570 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003571static struct clk_freq_tbl clk_tbl_mdp[] = {
3572 F_MDP( 0, gnd, 0, 0),
3573 F_MDP( 9600000, pll8, 1, 40),
3574 F_MDP( 13710000, pll8, 1, 28),
3575 F_MDP( 27000000, pxo, 0, 0),
3576 F_MDP( 29540000, pll8, 1, 13),
3577 F_MDP( 34910000, pll8, 1, 11),
3578 F_MDP( 38400000, pll8, 1, 10),
3579 F_MDP( 59080000, pll8, 2, 13),
3580 F_MDP( 76800000, pll8, 1, 5),
3581 F_MDP( 85330000, pll8, 2, 9),
3582 F_MDP( 96000000, pll8, 1, 4),
3583 F_MDP(128000000, pll8, 1, 3),
3584 F_MDP(160000000, pll2, 1, 5),
3585 F_MDP(177780000, pll2, 2, 9),
3586 F_MDP(200000000, pll2, 1, 4),
3587 F_MDP(266667000, pll2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003588 F_END
3589};
3590
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003591static unsigned long fmax_mdp_8064[MAX_VDD_LEVELS] __initdata = {
3592 [VDD_DIG_LOW] = 128000000,
3593 [VDD_DIG_NOMINAL] = 266667000
Tianyi Gou621f8742011-09-01 21:45:01 -07003594};
3595
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003596static struct bank_masks bmnd_info_mdp = {
3597 .bank_sel_mask = BIT(11),
3598 .bank0_mask = {
3599 .md_reg = MDP_MD0_REG,
3600 .ns_mask = BM(29, 22) | BM(5, 3),
3601 .rst_mask = BIT(31),
3602 .mnd_en_mask = BIT(8),
3603 .mode_mask = BM(10, 9),
3604 },
3605 .bank1_mask = {
3606 .md_reg = MDP_MD1_REG,
3607 .ns_mask = BM(21, 14) | BM(2, 0),
3608 .rst_mask = BIT(30),
3609 .mnd_en_mask = BIT(5),
3610 .mode_mask = BM(7, 6),
3611 },
3612};
3613
3614static struct rcg_clk mdp_clk = {
3615 .b = {
3616 .ctl_reg = MDP_CC_REG,
3617 .en_mask = BIT(0),
3618 .reset_reg = SW_RESET_CORE_REG,
3619 .reset_mask = BIT(21),
3620 .halt_reg = DBG_BUS_VEC_C_REG,
3621 .halt_bit = 10,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003622 .retain_reg = MDP_CC_REG,
3623 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003624 },
3625 .ns_reg = MDP_NS_REG,
3626 .root_en_mask = BIT(2),
3627 .set_rate = set_rate_mnd_banked,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003628 .freq_tbl = clk_tbl_mdp,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003629 .bank_info = &bmnd_info_mdp,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003630 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003631 .c = {
3632 .dbg_name = "mdp_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003633 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003634 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003635 CLK_INIT(mdp_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003636 .depends = &mdp_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003637 },
3638};
3639
3640static struct branch_clk lut_mdp_clk = {
3641 .b = {
3642 .ctl_reg = MDP_LUT_CC_REG,
3643 .en_mask = BIT(0),
3644 .halt_reg = DBG_BUS_VEC_I_REG,
3645 .halt_bit = 13,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003646 .retain_reg = MDP_LUT_CC_REG,
3647 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003648 },
3649 .parent = &mdp_clk.c,
3650 .c = {
3651 .dbg_name = "lut_mdp_clk",
3652 .ops = &clk_ops_branch,
3653 CLK_INIT(lut_mdp_clk.c),
3654 },
3655};
3656
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003657#define F_MDP_VSYNC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003658 { \
3659 .freq_hz = f, \
3660 .src_clk = &s##_clk.c, \
3661 .ns_val = NS_SRC_SEL(13, 13, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003662 }
3663static struct clk_freq_tbl clk_tbl_mdp_vsync[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003664 F_MDP_VSYNC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003665 F_END
3666};
3667
3668static struct rcg_clk mdp_vsync_clk = {
3669 .b = {
3670 .ctl_reg = MISC_CC_REG,
3671 .en_mask = BIT(6),
3672 .reset_reg = SW_RESET_CORE_REG,
3673 .reset_mask = BIT(3),
3674 .halt_reg = DBG_BUS_VEC_B_REG,
3675 .halt_bit = 22,
3676 },
3677 .ns_reg = MISC_CC2_REG,
3678 .ns_mask = BIT(13),
3679 .set_rate = set_rate_nop,
3680 .freq_tbl = clk_tbl_mdp_vsync,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003681 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003682 .c = {
3683 .dbg_name = "mdp_vsync_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003684 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003685 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003686 CLK_INIT(mdp_vsync_clk.c),
3687 },
3688};
3689
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003690#define F_ROT(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003691 { \
3692 .freq_hz = f, \
3693 .src_clk = &s##_clk.c, \
3694 .ns_val = NS_DIVSRC_BANKED(29, 26, 25, 22, d, \
3695 21, 19, 18, 16, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003696 }
3697static struct clk_freq_tbl clk_tbl_rot[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003698 F_ROT( 0, gnd, 1),
3699 F_ROT( 27000000, pxo, 1),
3700 F_ROT( 29540000, pll8, 13),
3701 F_ROT( 32000000, pll8, 12),
3702 F_ROT( 38400000, pll8, 10),
3703 F_ROT( 48000000, pll8, 8),
3704 F_ROT( 54860000, pll8, 7),
3705 F_ROT( 64000000, pll8, 6),
3706 F_ROT( 76800000, pll8, 5),
3707 F_ROT( 96000000, pll8, 4),
3708 F_ROT(100000000, pll2, 8),
3709 F_ROT(114290000, pll2, 7),
3710 F_ROT(133330000, pll2, 6),
3711 F_ROT(160000000, pll2, 5),
3712 F_ROT(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003713 F_END
3714};
3715
3716static struct bank_masks bdiv_info_rot = {
3717 .bank_sel_mask = BIT(30),
3718 .bank0_mask = {
3719 .ns_mask = BM(25, 22) | BM(18, 16),
3720 },
3721 .bank1_mask = {
3722 .ns_mask = BM(29, 26) | BM(21, 19),
3723 },
3724};
3725
3726static struct rcg_clk rot_clk = {
3727 .b = {
3728 .ctl_reg = ROT_CC_REG,
3729 .en_mask = BIT(0),
3730 .reset_reg = SW_RESET_CORE_REG,
3731 .reset_mask = BIT(2),
3732 .halt_reg = DBG_BUS_VEC_C_REG,
3733 .halt_bit = 15,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003734 .retain_reg = ROT_CC_REG,
3735 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003736 },
3737 .ns_reg = ROT_NS_REG,
3738 .root_en_mask = BIT(2),
3739 .set_rate = set_rate_div_banked,
3740 .freq_tbl = clk_tbl_rot,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003741 .bank_info = &bdiv_info_rot,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003742 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003743 .c = {
3744 .dbg_name = "rot_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003745 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003746 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003747 CLK_INIT(rot_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003748 .depends = &rot_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003749 },
3750};
3751
3752static int hdmi_pll_clk_enable(struct clk *clk)
3753{
3754 int ret;
3755 unsigned long flags;
3756 spin_lock_irqsave(&local_clock_reg_lock, flags);
3757 ret = hdmi_pll_enable();
3758 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
3759 return ret;
3760}
3761
3762static void hdmi_pll_clk_disable(struct clk *clk)
3763{
3764 unsigned long flags;
3765 spin_lock_irqsave(&local_clock_reg_lock, flags);
3766 hdmi_pll_disable();
3767 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
3768}
3769
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07003770static unsigned long hdmi_pll_clk_get_rate(struct clk *clk)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003771{
3772 return hdmi_pll_get_rate();
3773}
3774
Stephen Boyd5b35dee2011-09-21 12:17:38 -07003775static struct clk *hdmi_pll_clk_get_parent(struct clk *clk)
3776{
3777 return &pxo_clk.c;
3778}
3779
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003780static struct clk_ops clk_ops_hdmi_pll = {
3781 .enable = hdmi_pll_clk_enable,
3782 .disable = hdmi_pll_clk_disable,
3783 .get_rate = hdmi_pll_clk_get_rate,
Stephen Boyd5b35dee2011-09-21 12:17:38 -07003784 .get_parent = hdmi_pll_clk_get_parent,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003785};
3786
3787static struct clk hdmi_pll_clk = {
3788 .dbg_name = "hdmi_pll_clk",
3789 .ops = &clk_ops_hdmi_pll,
3790 CLK_INIT(hdmi_pll_clk),
3791};
3792
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003793#define F_TV_GND(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003794 { \
3795 .freq_hz = f, \
3796 .src_clk = &s##_clk.c, \
3797 .md_val = MD8(8, m, 0, n), \
3798 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
3799 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003800 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003801#define F_TV(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003802 { \
3803 .freq_hz = f, \
3804 .src_clk = &s##_clk, \
3805 .md_val = MD8(8, m, 0, n), \
3806 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
3807 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003808 .extra_freq_data = (void *)p_r, \
3809 }
3810/* Switching TV freqs requires PLL reconfiguration. */
3811static struct clk_freq_tbl clk_tbl_tv[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003812 F_TV_GND( 0, gnd, 0, 1, 0, 0),
3813 F_TV( 25200000, hdmi_pll, 25200000, 1, 0, 0),
3814 F_TV( 27000000, hdmi_pll, 27000000, 1, 0, 0),
3815 F_TV( 27030000, hdmi_pll, 27030000, 1, 0, 0),
3816 F_TV( 74250000, hdmi_pll, 74250000, 1, 0, 0),
3817 F_TV(148500000, hdmi_pll, 148500000, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003818 F_END
3819};
3820
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003821static unsigned long fmax_tv_src_8064[MAX_VDD_LEVELS] __initdata = {
3822 [VDD_DIG_LOW] = 74250000,
3823 [VDD_DIG_NOMINAL] = 149000000
3824};
3825
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003826/*
3827 * Unlike other clocks, the TV rate is adjusted through PLL
3828 * re-programming. It is also routed through an MND divider.
3829 */
3830void set_rate_tv(struct rcg_clk *clk, struct clk_freq_tbl *nf)
3831{
3832 unsigned long pll_rate = (unsigned long)nf->extra_freq_data;
3833 if (pll_rate)
3834 hdmi_pll_set_rate(pll_rate);
3835 set_rate_mnd(clk, nf);
3836}
3837
3838static struct rcg_clk tv_src_clk = {
3839 .ns_reg = TV_NS_REG,
3840 .b = {
3841 .ctl_reg = TV_CC_REG,
3842 .halt_check = NOCHECK,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003843 .retain_reg = TV_CC_REG,
3844 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003845 },
3846 .md_reg = TV_MD_REG,
3847 .root_en_mask = BIT(2),
3848 .ns_mask = (BM(23, 16) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003849 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003850 .ctl_mask = BM(7, 6),
3851 .set_rate = set_rate_tv,
3852 .freq_tbl = clk_tbl_tv,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003853 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003854 .c = {
3855 .dbg_name = "tv_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003856 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003857 VDD_DIG_FMAX_MAP2(LOW, 27030000, NOMINAL, 149000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003858 CLK_INIT(tv_src_clk.c),
3859 },
3860};
3861
Tianyi Gou51918802012-01-26 14:05:43 -08003862static struct cdiv_clk tv_src_div_clk = {
3863 .b = {
3864 .ctl_reg = TV_NS_REG,
3865 .halt_check = NOCHECK,
3866 },
3867 .ns_reg = TV_NS_REG,
3868 .div_offset = 6,
3869 .max_div = 2,
3870 .c = {
3871 .dbg_name = "tv_src_div_clk",
3872 .ops = &clk_ops_cdiv,
3873 CLK_INIT(tv_src_div_clk.c),
3874 },
3875};
3876
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003877static struct branch_clk tv_enc_clk = {
3878 .b = {
3879 .ctl_reg = TV_CC_REG,
3880 .en_mask = BIT(8),
3881 .reset_reg = SW_RESET_CORE_REG,
3882 .reset_mask = BIT(0),
3883 .halt_reg = DBG_BUS_VEC_D_REG,
3884 .halt_bit = 9,
3885 },
3886 .parent = &tv_src_clk.c,
3887 .c = {
3888 .dbg_name = "tv_enc_clk",
3889 .ops = &clk_ops_branch,
3890 CLK_INIT(tv_enc_clk.c),
3891 },
3892};
3893
3894static struct branch_clk tv_dac_clk = {
3895 .b = {
3896 .ctl_reg = TV_CC_REG,
3897 .en_mask = BIT(10),
3898 .halt_reg = DBG_BUS_VEC_D_REG,
3899 .halt_bit = 10,
3900 },
3901 .parent = &tv_src_clk.c,
3902 .c = {
3903 .dbg_name = "tv_dac_clk",
3904 .ops = &clk_ops_branch,
3905 CLK_INIT(tv_dac_clk.c),
3906 },
3907};
3908
3909static struct branch_clk mdp_tv_clk = {
3910 .b = {
3911 .ctl_reg = TV_CC_REG,
3912 .en_mask = BIT(0),
3913 .reset_reg = SW_RESET_CORE_REG,
3914 .reset_mask = BIT(4),
3915 .halt_reg = DBG_BUS_VEC_D_REG,
3916 .halt_bit = 12,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003917 .retain_reg = TV_CC2_REG,
3918 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003919 },
3920 .parent = &tv_src_clk.c,
3921 .c = {
3922 .dbg_name = "mdp_tv_clk",
3923 .ops = &clk_ops_branch,
3924 CLK_INIT(mdp_tv_clk.c),
3925 },
3926};
3927
3928static struct branch_clk hdmi_tv_clk = {
3929 .b = {
3930 .ctl_reg = TV_CC_REG,
3931 .en_mask = BIT(12),
3932 .reset_reg = SW_RESET_CORE_REG,
3933 .reset_mask = BIT(1),
3934 .halt_reg = DBG_BUS_VEC_D_REG,
3935 .halt_bit = 11,
3936 },
3937 .parent = &tv_src_clk.c,
3938 .c = {
3939 .dbg_name = "hdmi_tv_clk",
3940 .ops = &clk_ops_branch,
3941 CLK_INIT(hdmi_tv_clk.c),
3942 },
3943};
3944
Tianyi Gou51918802012-01-26 14:05:43 -08003945static struct branch_clk rgb_tv_clk = {
3946 .b = {
3947 .ctl_reg = TV_CC2_REG,
3948 .en_mask = BIT(14),
3949 .halt_reg = DBG_BUS_VEC_J_REG,
3950 .halt_bit = 27,
3951 },
3952 .parent = &tv_src_clk.c,
3953 .c = {
3954 .dbg_name = "rgb_tv_clk",
3955 .ops = &clk_ops_branch,
3956 CLK_INIT(rgb_tv_clk.c),
3957 },
3958};
3959
3960static struct branch_clk npl_tv_clk = {
3961 .b = {
3962 .ctl_reg = TV_CC2_REG,
3963 .en_mask = BIT(16),
3964 .halt_reg = DBG_BUS_VEC_J_REG,
3965 .halt_bit = 26,
3966 },
3967 .parent = &tv_src_clk.c,
3968 .c = {
3969 .dbg_name = "npl_tv_clk",
3970 .ops = &clk_ops_branch,
3971 CLK_INIT(npl_tv_clk.c),
3972 },
3973};
3974
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003975static struct branch_clk hdmi_app_clk = {
3976 .b = {
3977 .ctl_reg = MISC_CC2_REG,
3978 .en_mask = BIT(11),
3979 .reset_reg = SW_RESET_CORE_REG,
3980 .reset_mask = BIT(11),
3981 .halt_reg = DBG_BUS_VEC_B_REG,
3982 .halt_bit = 25,
3983 },
3984 .c = {
3985 .dbg_name = "hdmi_app_clk",
3986 .ops = &clk_ops_branch,
3987 CLK_INIT(hdmi_app_clk.c),
3988 },
3989};
3990
3991static struct bank_masks bmnd_info_vcodec = {
3992 .bank_sel_mask = BIT(13),
3993 .bank0_mask = {
3994 .md_reg = VCODEC_MD0_REG,
3995 .ns_mask = BM(18, 11) | BM(2, 0),
3996 .rst_mask = BIT(31),
3997 .mnd_en_mask = BIT(5),
3998 .mode_mask = BM(7, 6),
3999 },
4000 .bank1_mask = {
4001 .md_reg = VCODEC_MD1_REG,
4002 .ns_mask = BM(26, 19) | BM(29, 27),
4003 .rst_mask = BIT(30),
4004 .mnd_en_mask = BIT(10),
4005 .mode_mask = BM(12, 11),
4006 },
4007};
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004008#define F_VCODEC(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004009 { \
4010 .freq_hz = f, \
4011 .src_clk = &s##_clk.c, \
4012 .md_val = MD8(8, m, 0, n), \
4013 .ns_val = NS_MND_BANKED8(11, 19, n, m, 0, 27, s##_to_mm_mux), \
4014 .ctl_val = CC_BANKED(6, 11, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004015 }
4016static struct clk_freq_tbl clk_tbl_vcodec[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004017 F_VCODEC( 0, gnd, 0, 0),
4018 F_VCODEC( 27000000, pxo, 0, 0),
4019 F_VCODEC( 32000000, pll8, 1, 12),
4020 F_VCODEC( 48000000, pll8, 1, 8),
4021 F_VCODEC( 54860000, pll8, 1, 7),
4022 F_VCODEC( 96000000, pll8, 1, 4),
4023 F_VCODEC(133330000, pll2, 1, 6),
4024 F_VCODEC(200000000, pll2, 1, 4),
4025 F_VCODEC(228570000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004026 F_END
4027};
4028
4029static struct rcg_clk vcodec_clk = {
4030 .b = {
4031 .ctl_reg = VCODEC_CC_REG,
4032 .en_mask = BIT(0),
4033 .reset_reg = SW_RESET_CORE_REG,
4034 .reset_mask = BIT(6),
4035 .halt_reg = DBG_BUS_VEC_C_REG,
4036 .halt_bit = 29,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004037 .retain_reg = VCODEC_CC_REG,
4038 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004039 },
4040 .ns_reg = VCODEC_NS_REG,
4041 .root_en_mask = BIT(2),
4042 .set_rate = set_rate_mnd_banked,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004043 .bank_info = &bmnd_info_vcodec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004044 .freq_tbl = clk_tbl_vcodec,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004045 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004046 .c = {
4047 .dbg_name = "vcodec_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004048 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004049 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
4050 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004051 CLK_INIT(vcodec_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004052 .depends = &vcodec_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004053 },
4054};
4055
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004056#define F_VPE(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004057 { \
4058 .freq_hz = f, \
4059 .src_clk = &s##_clk.c, \
4060 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004061 }
4062static struct clk_freq_tbl clk_tbl_vpe[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004063 F_VPE( 0, gnd, 1),
4064 F_VPE( 27000000, pxo, 1),
4065 F_VPE( 34909000, pll8, 11),
4066 F_VPE( 38400000, pll8, 10),
4067 F_VPE( 64000000, pll8, 6),
4068 F_VPE( 76800000, pll8, 5),
4069 F_VPE( 96000000, pll8, 4),
4070 F_VPE(100000000, pll2, 8),
4071 F_VPE(160000000, pll2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004072 F_END
4073};
4074
4075static struct rcg_clk vpe_clk = {
4076 .b = {
4077 .ctl_reg = VPE_CC_REG,
4078 .en_mask = BIT(0),
4079 .reset_reg = SW_RESET_CORE_REG,
4080 .reset_mask = BIT(17),
4081 .halt_reg = DBG_BUS_VEC_A_REG,
4082 .halt_bit = 28,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004083 .retain_reg = VPE_CC_REG,
4084 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004085 },
4086 .ns_reg = VPE_NS_REG,
4087 .root_en_mask = BIT(2),
4088 .ns_mask = (BM(15, 12) | BM(2, 0)),
4089 .set_rate = set_rate_nop,
4090 .freq_tbl = clk_tbl_vpe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004091 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004092 .c = {
4093 .dbg_name = "vpe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004094 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004095 VDD_DIG_FMAX_MAP2(LOW, 76800000, NOMINAL, 160000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004096 CLK_INIT(vpe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004097 .depends = &vpe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004098 },
4099};
4100
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004101#define F_VFE(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004102 { \
4103 .freq_hz = f, \
4104 .src_clk = &s##_clk.c, \
4105 .md_val = MD8(8, m, 0, n), \
4106 .ns_val = NS_MM(23, 16, n, m, 11, 10, d, 2, 0, s##_to_mm_mux), \
4107 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004108 }
Tianyi Gou41515e22011-09-01 19:37:43 -07004109
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004110static struct clk_freq_tbl clk_tbl_vfe[] = {
4111 F_VFE( 0, gnd, 1, 0, 0),
4112 F_VFE( 13960000, pll8, 1, 2, 55),
4113 F_VFE( 27000000, pxo, 1, 0, 0),
4114 F_VFE( 36570000, pll8, 1, 2, 21),
4115 F_VFE( 38400000, pll8, 2, 1, 5),
4116 F_VFE( 45180000, pll8, 1, 2, 17),
4117 F_VFE( 48000000, pll8, 2, 1, 4),
4118 F_VFE( 54860000, pll8, 1, 1, 7),
4119 F_VFE( 64000000, pll8, 2, 1, 3),
4120 F_VFE( 76800000, pll8, 1, 1, 5),
4121 F_VFE( 96000000, pll8, 2, 1, 2),
4122 F_VFE(109710000, pll8, 1, 2, 7),
4123 F_VFE(128000000, pll8, 1, 1, 3),
4124 F_VFE(153600000, pll8, 1, 2, 5),
4125 F_VFE(200000000, pll2, 2, 1, 2),
4126 F_VFE(228570000, pll2, 1, 2, 7),
4127 F_VFE(266667000, pll2, 1, 1, 3),
4128 F_VFE(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004129 F_END
4130};
4131
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004132static unsigned long fmax_vfe_8064[MAX_VDD_LEVELS] __initdata = {
4133 [VDD_DIG_LOW] = 128000000,
4134 [VDD_DIG_NOMINAL] = 266667000,
4135 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07004136};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004137
4138static struct rcg_clk vfe_clk = {
4139 .b = {
4140 .ctl_reg = VFE_CC_REG,
4141 .reset_reg = SW_RESET_CORE_REG,
4142 .reset_mask = BIT(15),
4143 .halt_reg = DBG_BUS_VEC_B_REG,
4144 .halt_bit = 6,
4145 .en_mask = BIT(0),
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004146 .retain_reg = VFE_CC2_REG,
4147 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004148 },
4149 .ns_reg = VFE_NS_REG,
4150 .md_reg = VFE_MD_REG,
4151 .root_en_mask = BIT(2),
4152 .ns_mask = (BM(23, 16) | BM(11, 10) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004153 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004154 .ctl_mask = BM(7, 6),
4155 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004156 .freq_tbl = clk_tbl_vfe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004157 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004158 .c = {
4159 .dbg_name = "vfe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004160 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08004161 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
4162 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004163 CLK_INIT(vfe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004164 .depends = &vfe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004165 },
4166};
4167
Matt Wagantallc23eee92011-08-16 23:06:52 -07004168static struct branch_clk csi_vfe_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004169 .b = {
4170 .ctl_reg = VFE_CC_REG,
4171 .en_mask = BIT(12),
4172 .reset_reg = SW_RESET_CORE_REG,
4173 .reset_mask = BIT(24),
4174 .halt_reg = DBG_BUS_VEC_B_REG,
4175 .halt_bit = 8,
4176 },
4177 .parent = &vfe_clk.c,
4178 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -07004179 .dbg_name = "csi_vfe_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004180 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -07004181 CLK_INIT(csi_vfe_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004182 },
4183};
4184
4185/*
4186 * Low Power Audio Clocks
4187 */
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004188#define F_AIF_OSR(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004189 { \
4190 .freq_hz = f, \
4191 .src_clk = &s##_clk.c, \
4192 .md_val = MD8(8, m, 0, n), \
4193 .ns_val = NS(31, 24, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004194 }
4195static struct clk_freq_tbl clk_tbl_aif_osr[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004196 F_AIF_OSR( 0, gnd, 1, 0, 0),
4197 F_AIF_OSR( 512000, pll4, 4, 1, 192),
4198 F_AIF_OSR( 768000, pll4, 4, 1, 128),
4199 F_AIF_OSR( 1024000, pll4, 4, 1, 96),
4200 F_AIF_OSR( 1536000, pll4, 4, 1, 64),
4201 F_AIF_OSR( 2048000, pll4, 4, 1, 48),
4202 F_AIF_OSR( 3072000, pll4, 4, 1, 32),
4203 F_AIF_OSR( 4096000, pll4, 4, 1, 24),
4204 F_AIF_OSR( 6144000, pll4, 4, 1, 16),
4205 F_AIF_OSR( 8192000, pll4, 4, 1, 12),
4206 F_AIF_OSR(12288000, pll4, 4, 1, 8),
4207 F_AIF_OSR(24576000, pll4, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004208 F_END
4209};
4210
4211#define CLK_AIF_OSR(i, ns, md, h_r) \
4212 struct rcg_clk i##_clk = { \
4213 .b = { \
4214 .ctl_reg = ns, \
4215 .en_mask = BIT(17), \
4216 .reset_reg = ns, \
4217 .reset_mask = BIT(19), \
4218 .halt_reg = h_r, \
4219 .halt_check = ENABLE, \
4220 .halt_bit = 1, \
4221 }, \
4222 .ns_reg = ns, \
4223 .md_reg = md, \
4224 .root_en_mask = BIT(9), \
4225 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004226 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004227 .set_rate = set_rate_mnd, \
4228 .freq_tbl = clk_tbl_aif_osr, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004229 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004230 .c = { \
4231 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004232 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004233 VDD_DIG_FMAX_MAP1(LOW, 24576000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004234 CLK_INIT(i##_clk.c), \
4235 }, \
4236 }
4237#define CLK_AIF_OSR_DIV(i, ns, md, h_r) \
4238 struct rcg_clk i##_clk = { \
4239 .b = { \
4240 .ctl_reg = ns, \
4241 .en_mask = BIT(21), \
4242 .reset_reg = ns, \
4243 .reset_mask = BIT(23), \
4244 .halt_reg = h_r, \
4245 .halt_check = ENABLE, \
4246 .halt_bit = 1, \
4247 }, \
4248 .ns_reg = ns, \
4249 .md_reg = md, \
4250 .root_en_mask = BIT(9), \
4251 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004252 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004253 .set_rate = set_rate_mnd, \
4254 .freq_tbl = clk_tbl_aif_osr, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004255 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004256 .c = { \
4257 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004258 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004259 VDD_DIG_FMAX_MAP1(LOW, 24576000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004260 CLK_INIT(i##_clk.c), \
4261 }, \
4262 }
4263
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004264#define CLK_AIF_BIT(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004265 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004266 .b = { \
4267 .ctl_reg = ns, \
4268 .en_mask = BIT(15), \
4269 .halt_reg = h_r, \
4270 .halt_check = DELAY, \
4271 }, \
4272 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004273 .ext_mask = BIT(14), \
4274 .div_offset = 10, \
4275 .max_div = 16, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004276 .c = { \
4277 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004278 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004279 CLK_INIT(i##_clk.c), \
4280 }, \
4281 }
4282
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004283#define CLK_AIF_BIT_DIV(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004284 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004285 .b = { \
4286 .ctl_reg = ns, \
4287 .en_mask = BIT(19), \
4288 .halt_reg = h_r, \
Stephen Boyd7bb9cf82012-01-25 18:09:01 -08004289 .halt_check = DELAY, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004290 }, \
4291 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004292 .ext_mask = BIT(18), \
4293 .div_offset = 10, \
4294 .max_div = 256, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004295 .c = { \
4296 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004297 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004298 CLK_INIT(i##_clk.c), \
4299 }, \
4300 }
4301
4302static CLK_AIF_OSR(mi2s_osr, LCC_MI2S_NS_REG, LCC_MI2S_MD_REG,
4303 LCC_MI2S_STATUS_REG);
4304static CLK_AIF_BIT(mi2s_bit, LCC_MI2S_NS_REG, LCC_MI2S_STATUS_REG);
4305
4306static CLK_AIF_OSR_DIV(codec_i2s_mic_osr, LCC_CODEC_I2S_MIC_NS_REG,
4307 LCC_CODEC_I2S_MIC_MD_REG, LCC_CODEC_I2S_MIC_STATUS_REG);
4308static CLK_AIF_BIT_DIV(codec_i2s_mic_bit, LCC_CODEC_I2S_MIC_NS_REG,
4309 LCC_CODEC_I2S_MIC_STATUS_REG);
4310
4311static CLK_AIF_OSR_DIV(spare_i2s_mic_osr, LCC_SPARE_I2S_MIC_NS_REG,
4312 LCC_SPARE_I2S_MIC_MD_REG, LCC_SPARE_I2S_MIC_STATUS_REG);
4313static CLK_AIF_BIT_DIV(spare_i2s_mic_bit, LCC_SPARE_I2S_MIC_NS_REG,
4314 LCC_SPARE_I2S_MIC_STATUS_REG);
4315
4316static CLK_AIF_OSR_DIV(codec_i2s_spkr_osr, LCC_CODEC_I2S_SPKR_NS_REG,
4317 LCC_CODEC_I2S_SPKR_MD_REG, LCC_CODEC_I2S_SPKR_STATUS_REG);
4318static CLK_AIF_BIT_DIV(codec_i2s_spkr_bit, LCC_CODEC_I2S_SPKR_NS_REG,
4319 LCC_CODEC_I2S_SPKR_STATUS_REG);
4320
4321static CLK_AIF_OSR_DIV(spare_i2s_spkr_osr, LCC_SPARE_I2S_SPKR_NS_REG,
4322 LCC_SPARE_I2S_SPKR_MD_REG, LCC_SPARE_I2S_SPKR_STATUS_REG);
4323static CLK_AIF_BIT_DIV(spare_i2s_spkr_bit, LCC_SPARE_I2S_SPKR_NS_REG,
4324 LCC_SPARE_I2S_SPKR_STATUS_REG);
4325
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004326#define F_PCM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004327 { \
4328 .freq_hz = f, \
4329 .src_clk = &s##_clk.c, \
4330 .md_val = MD16(m, n), \
4331 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004332 }
4333static struct clk_freq_tbl clk_tbl_pcm[] = {
Stephen Boyd630f3252012-01-31 00:10:08 -08004334 { .ns_val = BIT(10) /* external input */ },
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004335 F_PCM( 512000, pll4, 4, 1, 192),
4336 F_PCM( 768000, pll4, 4, 1, 128),
4337 F_PCM( 1024000, pll4, 4, 1, 96),
4338 F_PCM( 1536000, pll4, 4, 1, 64),
4339 F_PCM( 2048000, pll4, 4, 1, 48),
4340 F_PCM( 3072000, pll4, 4, 1, 32),
4341 F_PCM( 4096000, pll4, 4, 1, 24),
4342 F_PCM( 6144000, pll4, 4, 1, 16),
4343 F_PCM( 8192000, pll4, 4, 1, 12),
4344 F_PCM(12288000, pll4, 4, 1, 8),
4345 F_PCM(24576000, pll4, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004346 F_END
4347};
4348
4349static struct rcg_clk pcm_clk = {
4350 .b = {
4351 .ctl_reg = LCC_PCM_NS_REG,
4352 .en_mask = BIT(11),
4353 .reset_reg = LCC_PCM_NS_REG,
4354 .reset_mask = BIT(13),
4355 .halt_reg = LCC_PCM_STATUS_REG,
4356 .halt_check = ENABLE,
4357 .halt_bit = 0,
4358 },
4359 .ns_reg = LCC_PCM_NS_REG,
4360 .md_reg = LCC_PCM_MD_REG,
4361 .root_en_mask = BIT(9),
Stephen Boyd630f3252012-01-31 00:10:08 -08004362 .ns_mask = BM(31, 16) | BIT(10) | BM(6, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08004363 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004364 .set_rate = set_rate_mnd,
4365 .freq_tbl = clk_tbl_pcm,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004366 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004367 .c = {
4368 .dbg_name = "pcm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004369 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004370 VDD_DIG_FMAX_MAP1(LOW, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004371 CLK_INIT(pcm_clk.c),
4372 },
4373};
4374
4375static struct rcg_clk audio_slimbus_clk = {
4376 .b = {
4377 .ctl_reg = LCC_SLIMBUS_NS_REG,
4378 .en_mask = BIT(10),
4379 .reset_reg = LCC_AHBEX_BRANCH_CTL_REG,
4380 .reset_mask = BIT(5),
4381 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4382 .halt_check = ENABLE,
4383 .halt_bit = 0,
4384 },
4385 .ns_reg = LCC_SLIMBUS_NS_REG,
4386 .md_reg = LCC_SLIMBUS_MD_REG,
4387 .root_en_mask = BIT(9),
4388 .ns_mask = (BM(31, 24) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004389 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004390 .set_rate = set_rate_mnd,
4391 .freq_tbl = clk_tbl_aif_osr,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004392 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004393 .c = {
4394 .dbg_name = "audio_slimbus_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004395 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004396 VDD_DIG_FMAX_MAP1(LOW, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004397 CLK_INIT(audio_slimbus_clk.c),
4398 },
4399};
4400
4401static struct branch_clk sps_slimbus_clk = {
4402 .b = {
4403 .ctl_reg = LCC_SLIMBUS_NS_REG,
4404 .en_mask = BIT(12),
4405 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4406 .halt_check = ENABLE,
4407 .halt_bit = 1,
4408 },
4409 .parent = &audio_slimbus_clk.c,
4410 .c = {
4411 .dbg_name = "sps_slimbus_clk",
4412 .ops = &clk_ops_branch,
4413 CLK_INIT(sps_slimbus_clk.c),
4414 },
4415};
4416
4417static struct branch_clk slimbus_xo_src_clk = {
4418 .b = {
4419 .ctl_reg = SLIMBUS_XO_SRC_CLK_CTL_REG,
4420 .en_mask = BIT(2),
4421 .halt_reg = CLK_HALT_DFAB_STATE_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004422 .halt_bit = 28,
4423 },
4424 .parent = &sps_slimbus_clk.c,
4425 .c = {
4426 .dbg_name = "slimbus_xo_src_clk",
4427 .ops = &clk_ops_branch,
4428 CLK_INIT(slimbus_xo_src_clk.c),
4429 },
4430};
4431
Matt Wagantall735f01a2011-08-12 12:40:28 -07004432DEFINE_CLK_RPM(afab_clk, afab_a_clk, APPS_FABRIC, NULL);
4433DEFINE_CLK_RPM(cfpb_clk, cfpb_a_clk, CFPB, NULL);
4434DEFINE_CLK_RPM(dfab_clk, dfab_a_clk, DAYTONA_FABRIC, NULL);
4435DEFINE_CLK_RPM(ebi1_clk, ebi1_a_clk, EBI1, NULL);
4436DEFINE_CLK_RPM(mmfab_clk, mmfab_a_clk, MM_FABRIC, NULL);
4437DEFINE_CLK_RPM(mmfpb_clk, mmfpb_a_clk, MMFPB, NULL);
4438DEFINE_CLK_RPM(sfab_clk, sfab_a_clk, SYSTEM_FABRIC, NULL);
4439DEFINE_CLK_RPM(sfpb_clk, sfpb_a_clk, SFPB, NULL);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004440
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004441static DEFINE_CLK_VOTER(sfab_msmbus_a_clk, &sfab_a_clk.c, 0);
4442static DEFINE_CLK_VOTER(sfab_tmr_a_clk, &sfab_a_clk.c, 0);
Stephen Boydd7a143a2012-02-16 17:59:26 -08004443
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004444static DEFINE_CLK_VOTER(dfab_dsps_clk, &dfab_clk.c, 0);
4445static DEFINE_CLK_VOTER(dfab_usb_hs_clk, &dfab_clk.c, 0);
4446static DEFINE_CLK_VOTER(dfab_usb_hs3_clk, &dfab_clk.c, 0);
4447static DEFINE_CLK_VOTER(dfab_usb_hs4_clk, &dfab_clk.c, 0);
4448static DEFINE_CLK_VOTER(dfab_sdc1_clk, &dfab_clk.c, 0);
4449static DEFINE_CLK_VOTER(dfab_sdc2_clk, &dfab_clk.c, 0);
4450static DEFINE_CLK_VOTER(dfab_sdc3_clk, &dfab_clk.c, 0);
4451static DEFINE_CLK_VOTER(dfab_sdc4_clk, &dfab_clk.c, 0);
4452static DEFINE_CLK_VOTER(dfab_sdc5_clk, &dfab_clk.c, 0);
4453static DEFINE_CLK_VOTER(dfab_sps_clk, &dfab_clk.c, 0);
4454static DEFINE_CLK_VOTER(dfab_bam_dmux_clk, &dfab_clk.c, 0);
4455static DEFINE_CLK_VOTER(dfab_scm_clk, &dfab_clk.c, 0);
4456static DEFINE_CLK_VOTER(dfab_qseecom_clk, &dfab_clk.c, 0);
4457static DEFINE_CLK_VOTER(dfab_tzcom_clk, &dfab_clk.c, 0);
4458static DEFINE_CLK_VOTER(dfab_msmbus_clk, &dfab_clk.c, 0);
4459static DEFINE_CLK_VOTER(dfab_msmbus_a_clk, &dfab_a_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004460
Matt Wagantall42cd12a2012-03-30 18:02:40 -07004461static DEFINE_CLK_VOTER(ebi1_msmbus_clk, &ebi1_clk.c, LONG_MAX);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004462static DEFINE_CLK_VOTER(ebi1_adm_clk, &ebi1_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004463
4464#ifdef CONFIG_DEBUG_FS
4465struct measure_sel {
4466 u32 test_vector;
4467 struct clk *clk;
4468};
4469
Matt Wagantall8b38f942011-08-02 18:23:18 -07004470static DEFINE_CLK_MEASURE(l2_m_clk);
4471static DEFINE_CLK_MEASURE(krait0_m_clk);
4472static DEFINE_CLK_MEASURE(krait1_m_clk);
Tianyi Gou455c13c2012-02-02 16:33:24 -08004473static DEFINE_CLK_MEASURE(krait2_m_clk);
4474static DEFINE_CLK_MEASURE(krait3_m_clk);
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004475static DEFINE_CLK_MEASURE(q6sw_clk);
4476static DEFINE_CLK_MEASURE(q6fw_clk);
4477static DEFINE_CLK_MEASURE(q6_func_clk);
Matt Wagantall8b38f942011-08-02 18:23:18 -07004478
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004479static struct measure_sel measure_mux[] = {
4480 { TEST_PER_LS(0x08), &slimbus_xo_src_clk.c },
4481 { TEST_PER_LS(0x12), &sdc1_p_clk.c },
4482 { TEST_PER_LS(0x13), &sdc1_clk.c },
4483 { TEST_PER_LS(0x14), &sdc2_p_clk.c },
4484 { TEST_PER_LS(0x15), &sdc2_clk.c },
4485 { TEST_PER_LS(0x16), &sdc3_p_clk.c },
4486 { TEST_PER_LS(0x17), &sdc3_clk.c },
4487 { TEST_PER_LS(0x18), &sdc4_p_clk.c },
4488 { TEST_PER_LS(0x19), &sdc4_clk.c },
4489 { TEST_PER_LS(0x1A), &sdc5_p_clk.c },
4490 { TEST_PER_LS(0x1B), &sdc5_clk.c },
Matt Wagantall7625a4c2011-11-01 16:17:53 -07004491 { TEST_PER_LS(0x1F), &gp0_clk.c },
4492 { TEST_PER_LS(0x20), &gp1_clk.c },
4493 { TEST_PER_LS(0x21), &gp2_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004494 { TEST_PER_LS(0x25), &dfab_clk.c },
4495 { TEST_PER_LS(0x25), &dfab_a_clk.c },
4496 { TEST_PER_LS(0x26), &pmem_clk.c },
4497 { TEST_PER_LS(0x32), &dma_bam_p_clk.c },
4498 { TEST_PER_LS(0x33), &cfpb_clk.c },
4499 { TEST_PER_LS(0x33), &cfpb_a_clk.c },
4500 { TEST_PER_LS(0x3D), &gsbi1_p_clk.c },
4501 { TEST_PER_LS(0x3E), &gsbi1_uart_clk.c },
4502 { TEST_PER_LS(0x3F), &gsbi1_qup_clk.c },
4503 { TEST_PER_LS(0x41), &gsbi2_p_clk.c },
4504 { TEST_PER_LS(0x42), &gsbi2_uart_clk.c },
4505 { TEST_PER_LS(0x44), &gsbi2_qup_clk.c },
4506 { TEST_PER_LS(0x45), &gsbi3_p_clk.c },
4507 { TEST_PER_LS(0x46), &gsbi3_uart_clk.c },
4508 { TEST_PER_LS(0x48), &gsbi3_qup_clk.c },
4509 { TEST_PER_LS(0x49), &gsbi4_p_clk.c },
4510 { TEST_PER_LS(0x4A), &gsbi4_uart_clk.c },
4511 { TEST_PER_LS(0x4C), &gsbi4_qup_clk.c },
4512 { TEST_PER_LS(0x4D), &gsbi5_p_clk.c },
4513 { TEST_PER_LS(0x4E), &gsbi5_uart_clk.c },
4514 { TEST_PER_LS(0x50), &gsbi5_qup_clk.c },
4515 { TEST_PER_LS(0x51), &gsbi6_p_clk.c },
4516 { TEST_PER_LS(0x52), &gsbi6_uart_clk.c },
4517 { TEST_PER_LS(0x54), &gsbi6_qup_clk.c },
4518 { TEST_PER_LS(0x55), &gsbi7_p_clk.c },
4519 { TEST_PER_LS(0x56), &gsbi7_uart_clk.c },
4520 { TEST_PER_LS(0x58), &gsbi7_qup_clk.c },
4521 { TEST_PER_LS(0x59), &gsbi8_p_clk.c },
4522 { TEST_PER_LS(0x5A), &gsbi8_uart_clk.c },
4523 { TEST_PER_LS(0x5C), &gsbi8_qup_clk.c },
4524 { TEST_PER_LS(0x5D), &gsbi9_p_clk.c },
4525 { TEST_PER_LS(0x5E), &gsbi9_uart_clk.c },
4526 { TEST_PER_LS(0x60), &gsbi9_qup_clk.c },
4527 { TEST_PER_LS(0x61), &gsbi10_p_clk.c },
4528 { TEST_PER_LS(0x62), &gsbi10_uart_clk.c },
4529 { TEST_PER_LS(0x64), &gsbi10_qup_clk.c },
4530 { TEST_PER_LS(0x65), &gsbi11_p_clk.c },
4531 { TEST_PER_LS(0x66), &gsbi11_uart_clk.c },
4532 { TEST_PER_LS(0x68), &gsbi11_qup_clk.c },
4533 { TEST_PER_LS(0x69), &gsbi12_p_clk.c },
4534 { TEST_PER_LS(0x6A), &gsbi12_uart_clk.c },
4535 { TEST_PER_LS(0x6C), &gsbi12_qup_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004536 { TEST_PER_LS(0x5E), &pcie_p_clk.c },
4537 { TEST_PER_LS(0x5F), &ce3_p_clk.c },
4538 { TEST_PER_LS(0x60), &ce3_core_clk.c },
4539 { TEST_PER_LS(0x63), &usb_hs3_p_clk.c },
4540 { TEST_PER_LS(0x64), &usb_hs3_xcvr_clk.c },
4541 { TEST_PER_LS(0x65), &usb_hs4_p_clk.c },
4542 { TEST_PER_LS(0x66), &usb_hs4_xcvr_clk.c },
4543 { TEST_PER_LS(0x6B), &sata_phy_ref_clk.c },
4544 { TEST_PER_LS(0x6C), &sata_phy_cfg_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004545 { TEST_PER_LS(0x78), &sfpb_clk.c },
4546 { TEST_PER_LS(0x78), &sfpb_a_clk.c },
4547 { TEST_PER_LS(0x7A), &pmic_ssbi2_clk.c },
4548 { TEST_PER_LS(0x7B), &pmic_arb0_p_clk.c },
4549 { TEST_PER_LS(0x7C), &pmic_arb1_p_clk.c },
4550 { TEST_PER_LS(0x7D), &prng_clk.c },
4551 { TEST_PER_LS(0x7F), &rpm_msg_ram_p_clk.c },
4552 { TEST_PER_LS(0x80), &adm0_p_clk.c },
4553 { TEST_PER_LS(0x84), &usb_hs1_p_clk.c },
4554 { TEST_PER_LS(0x85), &usb_hs1_xcvr_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004555 { TEST_PER_LS(0x86), &usb_hsic_p_clk.c },
4556 { TEST_PER_LS(0x87), &usb_hsic_system_clk.c },
4557 { TEST_PER_LS(0x88), &usb_hsic_xcvr_fs_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004558 { TEST_PER_LS(0x89), &usb_fs1_p_clk.c },
4559 { TEST_PER_LS(0x8A), &usb_fs1_sys_clk.c },
4560 { TEST_PER_LS(0x8B), &usb_fs1_xcvr_clk.c },
4561 { TEST_PER_LS(0x8C), &usb_fs2_p_clk.c },
4562 { TEST_PER_LS(0x8D), &usb_fs2_sys_clk.c },
4563 { TEST_PER_LS(0x8E), &usb_fs2_xcvr_clk.c },
4564 { TEST_PER_LS(0x8F), &tsif_p_clk.c },
4565 { TEST_PER_LS(0x91), &tsif_ref_clk.c },
4566 { TEST_PER_LS(0x92), &ce1_p_clk.c },
4567 { TEST_PER_LS(0x94), &tssc_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004568 { TEST_PER_LS(0x9D), &usb_hsic_hsio_cal_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004569 { TEST_PER_LS(0xA4), &ce1_core_clk.c },
4570
4571 { TEST_PER_HS(0x07), &afab_clk.c },
4572 { TEST_PER_HS(0x07), &afab_a_clk.c },
4573 { TEST_PER_HS(0x18), &sfab_clk.c },
4574 { TEST_PER_HS(0x18), &sfab_a_clk.c },
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004575 { TEST_PER_HS(0x26), &q6sw_clk },
4576 { TEST_PER_HS(0x27), &q6fw_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004577 { TEST_PER_HS(0x2A), &adm0_clk.c },
4578 { TEST_PER_HS(0x34), &ebi1_clk.c },
4579 { TEST_PER_HS(0x34), &ebi1_a_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004580 { TEST_PER_HS(0x50), &usb_hsic_hsic_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004581
4582 { TEST_MM_LS(0x00), &dsi1_byte_clk.c },
4583 { TEST_MM_LS(0x01), &dsi2_byte_clk.c },
4584 { TEST_MM_LS(0x02), &cam1_clk.c },
4585 { TEST_MM_LS(0x06), &amp_p_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004586 { TEST_MM_LS(0x07), &csi_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004587 { TEST_MM_LS(0x08), &dsi2_s_p_clk.c },
4588 { TEST_MM_LS(0x09), &dsi1_m_p_clk.c },
4589 { TEST_MM_LS(0x0A), &dsi1_s_p_clk.c },
4590 { TEST_MM_LS(0x0C), &gfx2d0_p_clk.c },
4591 { TEST_MM_LS(0x0D), &gfx2d1_p_clk.c },
4592 { TEST_MM_LS(0x0E), &gfx3d_p_clk.c },
4593 { TEST_MM_LS(0x0F), &hdmi_m_p_clk.c },
4594 { TEST_MM_LS(0x10), &hdmi_s_p_clk.c },
4595 { TEST_MM_LS(0x11), &ijpeg_p_clk.c },
4596 { TEST_MM_LS(0x12), &imem_p_clk.c },
4597 { TEST_MM_LS(0x13), &jpegd_p_clk.c },
4598 { TEST_MM_LS(0x14), &mdp_p_clk.c },
4599 { TEST_MM_LS(0x16), &rot_p_clk.c },
4600 { TEST_MM_LS(0x17), &dsi1_esc_clk.c },
4601 { TEST_MM_LS(0x18), &smmu_p_clk.c },
4602 { TEST_MM_LS(0x19), &tv_enc_p_clk.c },
4603 { TEST_MM_LS(0x1A), &vcodec_p_clk.c },
4604 { TEST_MM_LS(0x1B), &vfe_p_clk.c },
4605 { TEST_MM_LS(0x1C), &vpe_p_clk.c },
4606 { TEST_MM_LS(0x1D), &cam0_clk.c },
4607 { TEST_MM_LS(0x1F), &hdmi_app_clk.c },
4608 { TEST_MM_LS(0x20), &mdp_vsync_clk.c },
4609 { TEST_MM_LS(0x21), &tv_dac_clk.c },
4610 { TEST_MM_LS(0x22), &tv_enc_clk.c },
4611 { TEST_MM_LS(0x23), &dsi2_esc_clk.c },
4612 { TEST_MM_LS(0x25), &mmfpb_clk.c },
4613 { TEST_MM_LS(0x25), &mmfpb_a_clk.c },
4614 { TEST_MM_LS(0x26), &dsi2_m_p_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004615 { TEST_MM_LS(0x27), &cam2_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004616 { TEST_MM_LS(0x28), &vcap_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004617
4618 { TEST_MM_HS(0x00), &csi0_clk.c },
4619 { TEST_MM_HS(0x01), &csi1_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004620 { TEST_MM_HS(0x04), &csi_vfe_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004621 { TEST_MM_HS(0x05), &ijpeg_clk.c },
4622 { TEST_MM_HS(0x06), &vfe_clk.c },
4623 { TEST_MM_HS(0x07), &gfx2d0_clk.c },
4624 { TEST_MM_HS(0x08), &gfx2d1_clk.c },
4625 { TEST_MM_HS(0x09), &gfx3d_clk.c },
4626 { TEST_MM_HS(0x0A), &jpegd_clk.c },
4627 { TEST_MM_HS(0x0B), &vcodec_clk.c },
4628 { TEST_MM_HS(0x0F), &mmfab_clk.c },
4629 { TEST_MM_HS(0x0F), &mmfab_a_clk.c },
4630 { TEST_MM_HS(0x11), &gmem_axi_clk.c },
4631 { TEST_MM_HS(0x12), &ijpeg_axi_clk.c },
4632 { TEST_MM_HS(0x13), &imem_axi_clk.c },
4633 { TEST_MM_HS(0x14), &jpegd_axi_clk.c },
4634 { TEST_MM_HS(0x15), &mdp_axi_clk.c },
4635 { TEST_MM_HS(0x16), &rot_axi_clk.c },
4636 { TEST_MM_HS(0x17), &vcodec_axi_clk.c },
4637 { TEST_MM_HS(0x18), &vfe_axi_clk.c },
4638 { TEST_MM_HS(0x19), &vpe_axi_clk.c },
4639 { TEST_MM_HS(0x1A), &mdp_clk.c },
4640 { TEST_MM_HS(0x1B), &rot_clk.c },
4641 { TEST_MM_HS(0x1C), &vpe_clk.c },
4642 { TEST_MM_HS(0x1E), &hdmi_tv_clk.c },
4643 { TEST_MM_HS(0x1F), &mdp_tv_clk.c },
4644 { TEST_MM_HS(0x24), &csi0_phy_clk.c },
4645 { TEST_MM_HS(0x25), &csi1_phy_clk.c },
4646 { TEST_MM_HS(0x26), &csi_pix_clk.c },
4647 { TEST_MM_HS(0x27), &csi_rdi_clk.c },
4648 { TEST_MM_HS(0x28), &lut_mdp_clk.c },
4649 { TEST_MM_HS(0x29), &vcodec_axi_a_clk.c },
4650 { TEST_MM_HS(0x2A), &vcodec_axi_b_clk.c },
4651 { TEST_MM_HS(0x2B), &csi1phy_timer_clk.c },
4652 { TEST_MM_HS(0x2C), &csi0phy_timer_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004653 { TEST_MM_HS(0x2D), &csi2_clk.c },
4654 { TEST_MM_HS(0x2E), &csi2_phy_clk.c },
4655 { TEST_MM_HS(0x2F), &csi2phy_timer_clk.c },
4656 { TEST_MM_HS(0x30), &csi_pix1_clk.c },
4657 { TEST_MM_HS(0x31), &csi_rdi1_clk.c },
4658 { TEST_MM_HS(0x32), &csi_rdi2_clk.c },
Tianyi Gou621f8742011-09-01 21:45:01 -07004659 { TEST_MM_HS(0x33), &vcap_clk.c },
4660 { TEST_MM_HS(0x34), &vcap_npl_clk.c },
Tianyi Goue3d4f542012-03-15 17:06:45 -07004661 { TEST_MM_HS(0x34), &gfx3d_axi_clk_8930.c },
Tianyi Gou7747a962012-02-03 15:03:55 -08004662 { TEST_MM_HS(0x35), &vcap_axi_clk.c },
Tianyi Gou51918802012-01-26 14:05:43 -08004663 { TEST_MM_HS(0x36), &rgb_tv_clk.c },
4664 { TEST_MM_HS(0x37), &npl_tv_clk.c },
Tianyi Goue3d4f542012-03-15 17:06:45 -07004665 { TEST_MM_HS(0x38), &gfx3d_axi_clk_8064.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004666
4667 { TEST_LPA(0x0F), &mi2s_bit_clk.c },
4668 { TEST_LPA(0x10), &codec_i2s_mic_bit_clk.c },
4669 { TEST_LPA(0x11), &codec_i2s_spkr_bit_clk.c },
4670 { TEST_LPA(0x12), &spare_i2s_mic_bit_clk.c },
4671 { TEST_LPA(0x13), &spare_i2s_spkr_bit_clk.c },
4672 { TEST_LPA(0x14), &pcm_clk.c },
4673 { TEST_LPA(0x1D), &audio_slimbus_clk.c },
Matt Wagantall8b38f942011-08-02 18:23:18 -07004674
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004675 { TEST_LPA_HS(0x00), &q6_func_clk },
4676
Stephen Boyd46fdf0d2011-11-22 12:25:09 -08004677 { TEST_CPUL2(0x2), &l2_m_clk },
4678 { TEST_CPUL2(0x0), &krait0_m_clk },
4679 { TEST_CPUL2(0x1), &krait1_m_clk },
Tianyi Gou455c13c2012-02-02 16:33:24 -08004680 { TEST_CPUL2(0x4), &krait2_m_clk },
4681 { TEST_CPUL2(0x5), &krait3_m_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004682};
4683
4684static struct measure_sel *find_measure_sel(struct clk *clk)
4685{
4686 int i;
4687
4688 for (i = 0; i < ARRAY_SIZE(measure_mux); i++)
4689 if (measure_mux[i].clk == clk)
4690 return &measure_mux[i];
4691 return NULL;
4692}
4693
Matt Wagantall8b38f942011-08-02 18:23:18 -07004694static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004695{
4696 int ret = 0;
4697 u32 clk_sel;
4698 struct measure_sel *p;
Matt Wagantall8b38f942011-08-02 18:23:18 -07004699 struct measure_clk *clk = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004700 unsigned long flags;
4701
4702 if (!parent)
4703 return -EINVAL;
4704
4705 p = find_measure_sel(parent);
4706 if (!p)
4707 return -EINVAL;
4708
4709 spin_lock_irqsave(&local_clock_reg_lock, flags);
4710
Matt Wagantall8b38f942011-08-02 18:23:18 -07004711 /*
4712 * Program the test vector, measurement period (sample_ticks)
4713 * and scaling multiplier.
4714 */
4715 clk->sample_ticks = 0x10000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004716 clk_sel = p->test_vector & TEST_CLK_SEL_MASK;
Matt Wagantall8b38f942011-08-02 18:23:18 -07004717 clk->multiplier = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004718 switch (p->test_vector >> TEST_TYPE_SHIFT) {
4719 case TEST_TYPE_PER_LS:
4720 writel_relaxed(0x4030D00|BVAL(7, 0, clk_sel), CLK_TEST_REG);
4721 break;
4722 case TEST_TYPE_PER_HS:
4723 writel_relaxed(0x4020000|BVAL(16, 10, clk_sel), CLK_TEST_REG);
4724 break;
4725 case TEST_TYPE_MM_LS:
4726 writel_relaxed(0x4030D97, CLK_TEST_REG);
4727 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_LS_REG);
4728 break;
4729 case TEST_TYPE_MM_HS:
4730 writel_relaxed(0x402B800, CLK_TEST_REG);
4731 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_HS_REG);
4732 break;
4733 case TEST_TYPE_LPA:
4734 writel_relaxed(0x4030D98, CLK_TEST_REG);
4735 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0),
4736 LCC_CLK_LS_DEBUG_CFG_REG);
4737 break;
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004738 case TEST_TYPE_LPA_HS:
4739 writel_relaxed(0x402BC00, CLK_TEST_REG);
4740 writel_relaxed(BVAL(2, 1, clk_sel)|BIT(0),
4741 LCC_CLK_HS_DEBUG_CFG_REG);
4742 break;
Matt Wagantall8b38f942011-08-02 18:23:18 -07004743 case TEST_TYPE_CPUL2:
4744 writel_relaxed(0x4030400, CLK_TEST_REG);
4745 writel_relaxed(0x80|BVAL(5, 3, clk_sel), GCC_APCS_CLK_DIAG);
4746 clk->sample_ticks = 0x4000;
4747 clk->multiplier = 2;
4748 break;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004749 default:
4750 ret = -EPERM;
4751 }
4752 /* Make sure test vector is set before starting measurements. */
4753 mb();
4754
4755 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4756
4757 return ret;
4758}
4759
4760/* Sample clock for 'ticks' reference clock ticks. */
4761static u32 run_measurement(unsigned ticks)
4762{
4763 /* Stop counters and set the XO4 counter start value. */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004764 writel_relaxed(ticks, RINGOSC_TCXO_CTL_REG);
4765
4766 /* Wait for timer to become ready. */
4767 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) != 0)
4768 cpu_relax();
4769
4770 /* Run measurement and wait for completion. */
4771 writel_relaxed(BIT(20)|ticks, RINGOSC_TCXO_CTL_REG);
4772 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) == 0)
4773 cpu_relax();
4774
4775 /* Stop counters. */
4776 writel_relaxed(0x0, RINGOSC_TCXO_CTL_REG);
4777
4778 /* Return measured ticks. */
4779 return readl_relaxed(RINGOSC_STATUS_REG) & BM(24, 0);
4780}
4781
4782
4783/* Perform a hardware rate measurement for a given clock.
4784 FOR DEBUG USE ONLY: Measurements take ~15 ms! */
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07004785static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004786{
4787 unsigned long flags;
4788 u32 pdm_reg_backup, ringosc_reg_backup;
4789 u64 raw_count_short, raw_count_full;
Matt Wagantall8b38f942011-08-02 18:23:18 -07004790 struct measure_clk *clk = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004791 unsigned ret;
4792
Stephen Boyde334aeb2012-01-24 12:17:29 -08004793 ret = clk_prepare_enable(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08004794 if (ret) {
4795 pr_warning("CXO clock failed to enable. Can't measure\n");
4796 return 0;
4797 }
4798
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004799 spin_lock_irqsave(&local_clock_reg_lock, flags);
4800
4801 /* Enable CXO/4 and RINGOSC branch and root. */
4802 pdm_reg_backup = readl_relaxed(PDM_CLK_NS_REG);
4803 ringosc_reg_backup = readl_relaxed(RINGOSC_NS_REG);
4804 writel_relaxed(0x2898, PDM_CLK_NS_REG);
4805 writel_relaxed(0xA00, RINGOSC_NS_REG);
4806
4807 /*
4808 * The ring oscillator counter will not reset if the measured clock
4809 * is not running. To detect this, run a short measurement before
4810 * the full measurement. If the raw results of the two are the same
4811 * then the clock must be off.
4812 */
4813
4814 /* Run a short measurement. (~1 ms) */
4815 raw_count_short = run_measurement(0x1000);
4816 /* Run a full measurement. (~14 ms) */
Matt Wagantall8b38f942011-08-02 18:23:18 -07004817 raw_count_full = run_measurement(clk->sample_ticks);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004818
4819 writel_relaxed(ringosc_reg_backup, RINGOSC_NS_REG);
4820 writel_relaxed(pdm_reg_backup, PDM_CLK_NS_REG);
4821
4822 /* Return 0 if the clock is off. */
4823 if (raw_count_full == raw_count_short)
4824 ret = 0;
4825 else {
4826 /* Compute rate in Hz. */
4827 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
Matt Wagantall8b38f942011-08-02 18:23:18 -07004828 do_div(raw_count_full, ((clk->sample_ticks * 10) + 35));
4829 ret = (raw_count_full * clk->multiplier);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004830 }
4831
4832 /* Route dbg_hs_clk to PLLTEST. 300mV single-ended amplitude. */
Stephen Boyd69da8402011-07-14 17:45:31 -07004833 writel_relaxed(0x38F8, PLLTEST_PAD_CFG_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004834 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4835
Stephen Boyde334aeb2012-01-24 12:17:29 -08004836 clk_disable_unprepare(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08004837
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004838 return ret;
4839}
4840#else /* !CONFIG_DEBUG_FS */
4841static int measure_clk_set_parent(struct clk *clk, struct clk *parent)
4842{
4843 return -EINVAL;
4844}
4845
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07004846static unsigned long measure_clk_get_rate(struct clk *clk)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004847{
4848 return 0;
4849}
4850#endif /* CONFIG_DEBUG_FS */
4851
4852static struct clk_ops measure_clk_ops = {
4853 .set_parent = measure_clk_set_parent,
4854 .get_rate = measure_clk_get_rate,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004855};
4856
Matt Wagantall8b38f942011-08-02 18:23:18 -07004857static struct measure_clk measure_clk = {
4858 .c = {
4859 .dbg_name = "measure_clk",
4860 .ops = &measure_clk_ops,
4861 CLK_INIT(measure_clk.c),
4862 },
4863 .multiplier = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004864};
4865
Tianyi Goua8b3cce2011-11-08 14:37:26 -08004866static struct clk_lookup msm_clocks_8064[] = {
Stephen Boyd72a80352012-01-26 15:57:38 -08004867 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
4868 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Stephen Boyded630b02012-01-26 15:26:47 -08004869 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
4870 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
4871 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
4872 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
4873 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
Matt Wagantall292aace2012-01-26 19:12:34 -08004874 CLK_LOOKUP("xo", cxo_clk.c, "pil_gss"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08004875 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08004876 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Stephen Boyded630b02012-01-26 15:26:47 -08004877 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
4878 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
4879 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
4880 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Tianyi Gou41515e22011-09-01 19:37:43 -07004881
Tianyi Gou21a0e802012-02-04 22:34:10 -08004882 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
4883 CLK_LOOKUP("bus_a_clk", afab_a_clk.c, "msm_apps_fab"),
4884 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
4885 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
4886 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08004887 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08004888 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
4889 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
4890 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
4891 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
4892 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
4893 CLK_LOOKUP("mem_a_clk", ebi1_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06004894 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
4895 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08004896
Tianyi Gou21a0e802012-02-04 22:34:10 -08004897 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08004898 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, ""),
4899 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
4900 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Tianyi Gou41515e22011-09-01 19:37:43 -07004901
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004902 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
4903 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
4904 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08004905 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, "msm_serial_hsl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004906 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
4907 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
4908 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
4909 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, ""),
4910 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08004911 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, "msm_serial_hsl.0"),
David Keitel3c40fc52012-02-09 17:53:52 -08004912 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004913 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08004914 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08004915 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08004916 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07004917 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "qup_i2c.5"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004918 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
4919 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
4920 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Tianyi Gou50f23812012-02-06 16:04:19 -08004921 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Tianyi Gou05e01102012-02-08 22:15:49 -08004922 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Tianyi Gou43208a02011-09-27 15:35:13 -07004923 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
4924 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
4925 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
4926 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004927 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, ""),
4928 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08004929 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
4930 CLK_LOOKUP("alt_core_clk", usb_hs3_xcvr_clk.c, "msm_ehci_host.0"),
4931 CLK_LOOKUP("alt_core_clk", usb_hs4_xcvr_clk.c, "msm_ehci_host.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004932 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
4933 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
4934 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004935 CLK_LOOKUP("ref_clk", sata_phy_ref_clk.c, ""),
4936 CLK_LOOKUP("cfg_clk", sata_phy_cfg_clk.c, ""),
Ramesh Masavarapu28311912011-10-27 11:04:12 -07004937 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qce.0"),
4938 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qcrypto.0"),
4939 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qce.0"),
4940 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qcrypto.0"),
4941 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qce.0"),
4942 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qcrypto.0"),
Tianyi Gou41515e22011-09-01 19:37:43 -07004943 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Jin Hong4bbbfba2012-02-02 21:48:07 -08004944 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "msm_serial_hsl.1"),
David Keitel3c40fc52012-02-09 17:53:52 -08004945 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004946 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08004947 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08004948 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08004949 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07004950 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "qup_i2c.5"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004951 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08004952 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, "msm_serial_hsl.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004953 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
4954 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08004955 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Manu Gautam7483f172011-11-08 15:22:26 +05304956 CLK_LOOKUP("iface_clk", usb_hs3_p_clk.c, "msm_ehci_host.0"),
4957 CLK_LOOKUP("iface_clk", usb_hs4_p_clk.c, "msm_ehci_host.1"),
Tianyi Gou43208a02011-09-27 15:35:13 -07004958 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
4959 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
4960 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
4961 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004962 CLK_LOOKUP("iface_clk", pcie_p_clk.c, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07004963 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
4964 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08004965 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
4966 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
4967 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
4968 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chand07220e2012-02-13 15:52:22 -08004969 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08004970 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Sreesudhan Ramakrish Ramkumar8002a792012-04-09 17:42:58 -07004971 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -08004972 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Kevin Chand07220e2012-02-13 15:52:22 -08004973 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
4974 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
4975 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
4976 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
4977 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
4978 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
4979 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
4980 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
4981 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
4982 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
4983 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
4984 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
4985 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
4986 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
4987 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
4988 CLK_LOOKUP("csiphy_timer_src_clk",
4989 csiphy_timer_src_clk.c, "msm_csiphy.0"),
4990 CLK_LOOKUP("csiphy_timer_src_clk",
4991 csiphy_timer_src_clk.c, "msm_csiphy.1"),
4992 CLK_LOOKUP("csiphy_timer_src_clk",
4993 csiphy_timer_src_clk.c, "msm_csiphy.2"),
4994 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
4995 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
4996 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07004997 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
4998 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
4999 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5000 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Tianyi Gou51918802012-01-26 14:05:43 -08005001 CLK_LOOKUP("rgb_clk", rgb_tv_clk.c, ""),
5002 CLK_LOOKUP("npl_clk", npl_tv_clk.c, ""),
5003
Pu Chen86b4be92011-11-03 17:27:57 -07005004 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005005 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005006 CLK_LOOKUP("bus_clk",
5007 gfx3d_axi_clk_8064.c, "footswitch-8x60.2"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005008 CLK_LOOKUP("iface_clk", vcap_p_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005009 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005010 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "footswitch-8x60.10"),
5011 CLK_LOOKUP("bus_clk", vcap_axi_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005012 CLK_LOOKUP("core_clk", vcap_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005013 CLK_LOOKUP("core_clk", vcap_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005014 CLK_LOOKUP("core_clk", vcap_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005015 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005016 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005017 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005018 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5019 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005020 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005021 CLK_LOOKUP("core_clk", jpegd_clk.c, ""),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005022 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005023 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005024 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005025 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005026 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005027 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005028 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005029 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Matt Wagantall61286312012-02-22 15:55:09 -08005030 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005031 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5032 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
Greg Griscofa47b532011-11-11 10:32:06 -08005033 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005034 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005035 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
Tianyi Gou51918802012-01-26 14:05:43 -08005036 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005037 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005038 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Ujwal Pateld041f982012-03-27 19:51:44 -07005039 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005040 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chand07220e2012-02-13 15:52:22 -08005041 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005042 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chand07220e2012-02-13 15:52:22 -08005043 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005044 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5045 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5046 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5047 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5048 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5049 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5050 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005051 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5052 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chand07220e2012-02-13 15:52:22 -08005053 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5054 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
5055 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005056 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5057 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5058 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5059 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Pu Chen86b4be92011-11-03 17:27:57 -07005060 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005061 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005062 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5063 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005064 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005065 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005066 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005067 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005068 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005069 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005070 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005071 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005072 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Greg Griscofa47b532011-11-11 10:32:06 -08005073 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005074 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chand07220e2012-02-13 15:52:22 -08005075 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005076 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chanb20742b2012-02-27 15:47:35 -08005077 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall61286312012-02-22 15:55:09 -08005078 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005079
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005080 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.6"),
5081 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.6"),
Kuirong Wang4f4d1312012-03-31 12:50:10 -07005082 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.7"),
5083 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.7"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005084 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5085 "msm-dai-q6.1"),
5086 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5087 "msm-dai-q6.1"),
5088 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5089 "msm-dai-q6.5"),
5090 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5091 "msm-dai-q6.5"),
5092 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
5093 "msm-dai-q6.16384"),
5094 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5095 "msm-dai-q6.16384"),
5096 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5097 "msm-dai-q6.4"),
5098 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5099 "msm-dai-q6.4"),
5100 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005101 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005102 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, ""),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005103 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005104 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, ""),
5105 CLK_LOOKUP("core_clk", vpe_axi_clk.c, ""),
5106 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
5107 CLK_LOOKUP("core_clk", vcap_axi_clk.c, ""),
5108 CLK_LOOKUP("core_clk", rot_axi_clk.c, ""),
5109 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, ""),
5110 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
5111 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, ""),
5112 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005113 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8064.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005114
5115 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
5116 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
5117 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.0"),
5118 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.1"),
5119 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5120 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5121 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5122 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5123 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
5124 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
5125 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Ramesh Masavarapua1bc0e42012-03-05 07:42:48 -08005126 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
Ramesh Masavarapueb6e9342012-02-13 19:59:50 -08005127 CLK_LOOKUP("bus_clk", dfab_tzcom_clk.c, "tzcom"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005128
Manu Gautam5143b252012-01-05 19:25:23 -08005129 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5130 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5131 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5132 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5133 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005134
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005135 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5136 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5137 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5138 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5139 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5140 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5141 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5142 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5143 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005144 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8064.c, "msm_iommu.9"),
5145 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8064.c, "msm_iommu.10"),
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005146 CLK_LOOKUP("core_clk", vcap_axi_clk.c, "msm_iommu.11"),
5147
Deepak Kotur954b1782012-04-24 17:58:19 -07005148 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5149 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5150 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5151 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5152 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005153 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5154 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
5155
Jeff Ohlstein8c116c72011-10-27 17:34:48 -07005156 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005157
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005158 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5159 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5160 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
Tianyi Gou455c13c2012-02-02 16:33:24 -08005161 CLK_LOOKUP("krait2_mclk", krait2_m_clk, ""),
5162 CLK_LOOKUP("krait3_mclk", krait3_m_clk, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005163};
5164
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005165static struct clk_lookup msm_clocks_8960[] = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005166 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5167 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Stephen Boyded630b02012-01-26 15:26:47 -08005168 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5169 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5170 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5171 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5172 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005173 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005174 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Stephen Boyded630b02012-01-26 15:26:47 -08005175 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5176 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5177 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5178 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005179
Matt Wagantallb2710b82011-11-16 19:55:17 -08005180 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
5181 CLK_LOOKUP("bus_a_clk", afab_a_clk.c, "msm_apps_fab"),
5182 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5183 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5184 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005185 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005186 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5187 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5188 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5189 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5190 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
5191 CLK_LOOKUP("mem_a_clk", ebi1_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005192 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5193 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005194
5195 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005196 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5197 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5198 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005199
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005200 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5201 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5202 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5203 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5204 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5205 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5206 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
Matt Wagantalle2522372011-08-17 14:52:21 -07005207 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5208 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005209 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005210 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hsl.1"),
Mayank Ranae009c922012-03-22 03:02:06 +05305211 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, "msm_serial_hs.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005212 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5213 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5214 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005215 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005216 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005217 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5218 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005219 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5220 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5221 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5222 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005223 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005224 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005225 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005226 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005227 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Vikram Mulukutladd0a2372011-09-19 15:58:21 -07005228 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Matt Wagantallc1205292011-08-11 17:19:31 -07005229 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005230 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5231 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5232 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5233 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5234 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005235 CLK_LOOKUP("slimbus_xo_src_clk", slimbus_xo_src_clk.c, NULL),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005236 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, ""),
5237 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005238 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5239 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005240 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5241 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5242 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5243 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5244 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5245 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005246 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5247 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5248 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5249 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5250 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005251 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005252 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005253 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005254 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005255 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Matt Wagantallac294852011-08-17 15:44:58 -07005256 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005257 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005258 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
5259 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Matt Wagantalle2522372011-08-17 14:52:21 -07005260 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
5261 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005262 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005263 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hsl.1"),
Mayank Ranae009c922012-03-22 03:02:06 +05305264 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "msm_serial_hs.1"),
Matt Wagantallac294852011-08-17 15:44:58 -07005265 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005266 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005267 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005268 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
5269 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
5270 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005271 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005272 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5273 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5274 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5275 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
5276 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
Matt Wagantalle1a86062011-08-18 17:46:10 -07005277 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5278 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005279 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5280 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5281 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5282 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chan09f4e662011-12-16 08:17:02 -08005283 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
5284 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-006c"),
5285 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0048"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005286 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -08005287 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005288 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005289 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5290 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005291 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005292 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5293 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005294 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005295 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5296 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005297 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
Kevin Chane12c6672011-10-26 11:55:26 -07005298 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5299 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005300 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
5301 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
5302 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5303 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5304 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5305 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
5306 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
Kevin Chanf6216f22011-10-25 18:40:11 -07005307 CLK_LOOKUP("csiphy_timer_src_clk",
5308 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5309 CLK_LOOKUP("csiphy_timer_src_clk",
5310 csiphy_timer_src_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005311 CLK_LOOKUP("csiphy_timer_src_clk",
5312 csiphy_timer_src_clk.c, "msm_csiphy.2"),
Kevin Chanf6216f22011-10-25 18:40:11 -07005313 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5314 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005315 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005316 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5317 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5318 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5319 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005320 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "kgsl-2d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005321 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "footswitch-8x60.0"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005322 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "kgsl-2d1.1"),
Matt Wagantall49722712011-08-17 18:50:53 -07005323 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "footswitch-8x60.1"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005324 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005325 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
5326 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005327 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5328 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005329 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005330 CLK_LOOKUP("core_clk", jpegd_clk.c, ""),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005331 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005332 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005333 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005334 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005335 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005336 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005337 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005338 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005339 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5340 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005341 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005342 CLK_LOOKUP("enc_clk", tv_enc_clk.c, "tvenc.0"),
5343 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005344 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005345 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005346 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
5347 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005348 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005349 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005350 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Kevin Chana0853122011-11-07 19:48:44 -08005351 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005352 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chan5827c552011-10-28 18:36:32 -07005353 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005354 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chan5827c552011-10-28 18:36:32 -07005355 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005356 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5357 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5358 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5359 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5360 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5361 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5362 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005363 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5364 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005365 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5366 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005367 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005368 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5369 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5370 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5371 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005372 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "kgsl-2d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005373 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "footswitch-8x60.0"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005374 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "kgsl-2d1.1"),
Matt Wagantall49722712011-08-17 18:50:53 -07005375 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "footswitch-8x60.1"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005376 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005377 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005378 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5379 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005380 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005381 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005382 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005383 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005384 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005385 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005386 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005387 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005388 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005389 CLK_LOOKUP("iface_clk", tv_enc_p_clk.c, "tvenc.0"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005390 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005391 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chan5827c552011-10-28 18:36:32 -07005392 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005393 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chana0853122011-11-07 19:48:44 -08005394 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005395 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005396 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.6"),
5397 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.6"),
Kuirong Wang4f4d1312012-03-31 12:50:10 -07005398 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.7"),
5399 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.7"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005400 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5401 "msm-dai-q6.1"),
5402 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5403 "msm-dai-q6.1"),
5404 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5405 "msm-dai-q6.5"),
5406 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5407 "msm-dai-q6.5"),
5408 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
5409 "msm-dai-q6.16384"),
5410 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5411 "msm-dai-q6.16384"),
5412 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5413 "msm-dai-q6.4"),
5414 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5415 "msm-dai-q6.4"),
5416 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005417 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005418 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005419 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005420 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5421 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5422 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5423 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5424 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5425 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5426 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5427 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5428 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
5429 CLK_LOOKUP("core_clk", gfx3d_clk.c, "msm_iommu.9"),
5430 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "msm_iommu.10"),
5431 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "msm_iommu.11"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005432
5433 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5434 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5435 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5436 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5437 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005438 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5439 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005440
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005441 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
Manu Gautam5143b252012-01-05 19:25:23 -08005442 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005443 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5444 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5445 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5446 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5447 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
Yan He160633e2011-06-30 12:18:56 -07005448 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
Stephen Boyd1c51a492011-10-26 12:11:47 -07005449 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
Stephen Boydef5d1c42011-12-15 20:47:14 -08005450 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Ramesh Masavarapua1bc0e42012-03-05 07:42:48 -08005451 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
Ramesh Masavarapueb6e9342012-02-13 19:59:50 -08005452 CLK_LOOKUP("bus_clk", dfab_tzcom_clk.c, "tzcom"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005453
Matt Wagantalle1a86062011-08-18 17:46:10 -07005454 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall8b38f942011-08-02 18:23:18 -07005455
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005456 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5457 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5458 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
5459 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
5460 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
5461 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005462};
5463
Tianyi Goue3d4f542012-03-15 17:06:45 -07005464static struct clk_lookup msm_clocks_8930[] = {
Stephen Boydbe1a7392012-04-02 20:17:11 -07005465 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005466 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5467 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5468 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5469 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5470 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
5471 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
5472 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5473 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5474 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5475 CLK_LOOKUP("measure", measure_clk.c, "debug"),
5476
5477 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
5478 CLK_LOOKUP("bus_a_clk", afab_a_clk.c, "msm_apps_fab"),
5479 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5480 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5481 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
5482 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
5483 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5484 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5485 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5486 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5487 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
5488 CLK_LOOKUP("mem_a_clk", ebi1_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005489 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5490 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005491
5492 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005493 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5494 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5495 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
5496
5497 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5498 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5499 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5500 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5501 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5502 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5503 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5504 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5505 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
5506 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
5507 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, ""),
5508 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, ""),
5509 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5510 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5511 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
5512 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
5513 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
5514 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5515 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
5516 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5517 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5518 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5519 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
5520 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, "qup_i2c.0"),
5521 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
5522 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
5523 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
5524 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
5525 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
5526 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
5527 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5528 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5529 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5530 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5531 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
5532 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, ""),
5533 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
5534 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5535 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
5536 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5537 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5538 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5539 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5540 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5541 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
5542 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5543 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5544 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5545 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5546 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
5547 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
5548 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
5549 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
5550 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
5551 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
5552 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
5553 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
5554 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
5555 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
5556 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
5557 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
5558 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
5559 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, ""),
5560 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "qup_i2c.0"),
5561 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
5562 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
5563 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
5564 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
5565 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
5566 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
5567 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
5568 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5569 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5570 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5571 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
5572 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
5573 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5574 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
5575 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5576 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5577 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5578 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005579 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Hody Hung994f4622012-04-24 10:27:45 -07005580 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005581 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0048"),
5582 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
5583 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
5584 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5585 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
5586 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
5587 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5588 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
5589 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
5590 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5591 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
5592 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
5593 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5594 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
5595 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
5596 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
5597 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5598 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5599 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5600 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
5601 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
5602 CLK_LOOKUP("csiphy_timer_src_clk",
5603 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5604 CLK_LOOKUP("csiphy_timer_src_clk",
5605 csiphy_timer_src_clk.c, "msm_csiphy.1"),
5606 CLK_LOOKUP("csiphy_timer_src_clk",
5607 csiphy_timer_src_clk.c, "msm_csiphy.2"),
5608 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5609 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
5610 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005611 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5612 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005613 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
5614 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
5615 CLK_LOOKUP("bus_clk",
5616 gfx3d_axi_clk_8930.c, "footswitch-8x60.2"),
5617 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005618 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5619 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005620 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005621 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005622 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005623 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005624 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005625 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005626 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
5627 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
5628 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005629 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5630 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005631 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005632 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005633 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
5634 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005635 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
5636 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005637 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005638 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005639 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
5640 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
5641 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
5642 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
5643 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
5644 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
5645 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5646 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5647 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5648 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5649 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5650 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5651 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005652 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005653 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5654 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
5655 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005656 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5657 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005658 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
5659 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
5660 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5661 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005662 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005663 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
5664 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005665 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005666 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
5667 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
5668 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
5669 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
5670 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
5671 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
5672 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
5673 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
5674 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
5675 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
5676 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.6"),
5677 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.6"),
5678 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5679 "msm-dai-q6.1"),
5680 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5681 "msm-dai-q6.1"),
5682 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5683 "msm-dai-q6.5"),
5684 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5685 "msm-dai-q6.5"),
5686 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
5687 "msm-dai-q6.16384"),
5688 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5689 "msm-dai-q6.16384"),
5690 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5691 "msm-dai-q6.4"),
5692 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5693 "msm-dai-q6.4"),
5694 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
5695 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
5696 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
5697 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5698 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5699 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5700 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5701 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5702 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5703 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5704 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
5705 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.9"),
5706 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.10"),
5707
5708 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5709 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5710 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5711 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5712 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005713 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5714 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005715
5716 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
5717 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
5718 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5719 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5720 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5721 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5722 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
5723 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
5724 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
5725 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
5726 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
5727
5728 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
5729
5730 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5731 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5732 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
5733 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
5734 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
5735 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
5736};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005737/*
5738 * Miscellaneous clock register initializations
5739 */
5740
5741/* Read, modify, then write-back a register. */
5742static void __init rmwreg(uint32_t val, void *reg, uint32_t mask)
5743{
5744 uint32_t regval = readl_relaxed(reg);
5745 regval &= ~mask;
5746 regval |= val;
5747 writel_relaxed(regval, reg);
5748}
5749
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005750static struct pll_config_regs pll4_regs __initdata = {
5751 .l_reg = LCC_PLL0_L_VAL_REG,
5752 .m_reg = LCC_PLL0_M_VAL_REG,
5753 .n_reg = LCC_PLL0_N_VAL_REG,
5754 .config_reg = LCC_PLL0_CONFIG_REG,
5755 .mode_reg = LCC_PLL0_MODE_REG,
5756};
Tianyi Gou41515e22011-09-01 19:37:43 -07005757
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005758static struct pll_config pll4_config __initdata = {
5759 .l = 0xE,
5760 .m = 0x27A,
5761 .n = 0x465,
5762 .vco_val = 0x0,
5763 .vco_mask = BM(17, 16),
5764 .pre_div_val = 0x0,
5765 .pre_div_mask = BIT(19),
5766 .post_div_val = 0x0,
5767 .post_div_mask = BM(21, 20),
5768 .mn_ena_val = BIT(22),
5769 .mn_ena_mask = BIT(22),
5770 .main_output_val = BIT(23),
5771 .main_output_mask = BIT(23),
5772};
Tianyi Gou41515e22011-09-01 19:37:43 -07005773
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005774static struct pll_config_regs pll15_regs __initdata = {
5775 .l_reg = MM_PLL3_L_VAL_REG,
5776 .m_reg = MM_PLL3_M_VAL_REG,
5777 .n_reg = MM_PLL3_N_VAL_REG,
5778 .config_reg = MM_PLL3_CONFIG_REG,
5779 .mode_reg = MM_PLL3_MODE_REG,
5780};
Tianyi Gou358c3862011-10-18 17:03:41 -07005781
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005782static struct pll_config pll15_config __initdata = {
5783 .l = (0x24 | BVAL(31, 7, 0x620)),
5784 .m = 0x1,
5785 .n = 0x9,
5786 .vco_val = BVAL(17, 16, 0x2),
5787 .vco_mask = BM(17, 16),
5788 .pre_div_val = 0x0,
5789 .pre_div_mask = BIT(19),
5790 .post_div_val = 0x0,
5791 .post_div_mask = BM(21, 20),
5792 .mn_ena_val = BIT(22),
5793 .mn_ena_mask = BIT(22),
5794 .main_output_val = BIT(23),
5795 .main_output_mask = BIT(23),
5796};
Tianyi Gou41515e22011-09-01 19:37:43 -07005797
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005798static struct pll_config_regs pll14_regs __initdata = {
5799 .l_reg = BB_PLL14_L_VAL_REG,
5800 .m_reg = BB_PLL14_M_VAL_REG,
5801 .n_reg = BB_PLL14_N_VAL_REG,
5802 .config_reg = BB_PLL14_CONFIG_REG,
5803 .mode_reg = BB_PLL14_MODE_REG,
5804};
5805
5806static struct pll_config pll14_config __initdata = {
5807 .l = (0x11 | BVAL(31, 7, 0x620)),
5808 .m = 0x7,
5809 .n = 0x9,
5810 .vco_val = 0x0,
5811 .vco_mask = BM(17, 16),
5812 .pre_div_val = 0x0,
5813 .pre_div_mask = BIT(19),
5814 .post_div_val = 0x0,
5815 .post_div_mask = BM(21, 20),
5816 .mn_ena_val = BIT(22),
5817 .mn_ena_mask = BIT(22),
5818 .main_output_val = BIT(23),
5819 .main_output_mask = BIT(23),
5820};
Tianyi Gou41515e22011-09-01 19:37:43 -07005821
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005822static void __init reg_init(void)
5823{
Stephen Boydd471e7a2011-11-19 01:37:39 -08005824 void __iomem *imem_reg;
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005825
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005826 /* Deassert MM SW_RESET_ALL signal. */
5827 writel_relaxed(0, SW_RESET_ALL_REG);
5828
Tianyi Gou8c1a1182011-10-10 14:47:11 -07005829 /*
Tianyi Goue3d4f542012-03-15 17:06:45 -07005830 * Some bits are only used on 8960 or 8064 or 8930 and are marked as
5831 * reserved bits on the other SoCs. Writing to these reserved bits
Tianyi Gou8c1a1182011-10-10 14:47:11 -07005832 * should have no effect.
5833 */
Stephen Boydd471e7a2011-11-19 01:37:39 -08005834 /*
5835 * Initialize MM AHB registers: Enable the FPB clock and disable HW
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005836 * gating on non-8960 for all clocks. Also set VFE_AHB's
Stephen Boydd471e7a2011-11-19 01:37:39 -08005837 * FORCE_CORE_ON bit to prevent its memory from being collapsed when
5838 * the clock is halted. The sleep and wake-up delays are set to safe
5839 * values.
5840 */
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005841 if (cpu_is_msm8960()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08005842 rmwreg(0x44000000, AHB_EN_REG, 0x6C000103);
5843 writel_relaxed(0x3C7097F9, AHB_EN2_REG);
5844 } else {
5845 rmwreg(0x00000003, AHB_EN_REG, 0x6C000103);
5846 writel_relaxed(0x000007F9, AHB_EN2_REG);
5847 }
Tianyi Gou8c1a1182011-10-10 14:47:11 -07005848 if (cpu_is_apq8064())
5849 rmwreg(0x00000000, AHB_EN3_REG, 0x00000001);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005850
5851 /* Deassert all locally-owned MM AHB resets. */
5852 rmwreg(0, SW_RESET_AHB_REG, 0xFFF7DFFF);
Tianyi Gou41515e22011-09-01 19:37:43 -07005853 rmwreg(0, SW_RESET_AHB2_REG, 0x0000000F);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005854
5855 /* Initialize MM AXI registers: Enable HW gating for all clocks that
5856 * support it. Also set FORCE_CORE_ON bits, and any sleep and wake-up
5857 * delays to safe values. */
Stephen Boydd471e7a2011-11-19 01:37:39 -08005858 if (cpu_is_msm8960() &&
5859 SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 3) {
5860 rmwreg(0x0003AFF9, MAXI_EN_REG, 0x0803FFFF);
5861 rmwreg(0x3A27FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Gopikrishnaiah Anandan83b6e852012-01-05 17:47:02 -08005862 rmwreg(0x0027FCFF, MAXI_EN4_REG, 0x017FFFFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08005863 } else {
5864 rmwreg(0x000007F9, MAXI_EN_REG, 0x0803FFFF);
5865 rmwreg(0x3027FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
5866 rmwreg(0x0027FCFF, MAXI_EN4_REG, 0x017FFFFF);
5867 }
Matt Wagantall53d968f2011-07-19 13:22:53 -07005868 rmwreg(0x0027FCFF, MAXI_EN3_REG, 0x003FFFFF);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07005869 if (cpu_is_apq8064())
5870 rmwreg(0x009FE4FF, MAXI_EN5_REG, 0x01FFEFFF);
Tianyi Goue3d4f542012-03-15 17:06:45 -07005871 if (cpu_is_msm8930())
5872 rmwreg(0x000004FF, MAXI_EN5_REG, 0x00000FFF);
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005873 if (cpu_is_msm8960())
Stephen Boydd471e7a2011-11-19 01:37:39 -08005874 rmwreg(0x00003C38, SAXI_EN_REG, 0x00003FFF);
5875 else
5876 rmwreg(0x000003C7, SAXI_EN_REG, 0x00003FFF);
5877
5878 /* Enable IMEM's clk_on signal */
5879 imem_reg = ioremap(0x04b00040, 4);
5880 if (imem_reg) {
5881 writel_relaxed(0x3, imem_reg);
5882 iounmap(imem_reg);
5883 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005884
5885 /* Initialize MM CC registers: Set MM FORCE_CORE_ON bits so that core
5886 * memories retain state even when not clocked. Also, set sleep and
5887 * wake-up delays to safe values. */
Matt Wagantall53d968f2011-07-19 13:22:53 -07005888 rmwreg(0x00000000, CSI0_CC_REG, 0x00000410);
5889 rmwreg(0x00000000, CSI1_CC_REG, 0x00000410);
5890 rmwreg(0x80FF0000, DSI1_BYTE_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07005891 rmwreg(0x80FF0000, DSI_PIXEL_CC_REG, 0xE0FF0010);
Tarun Karra6fbc00a2011-12-13 09:23:47 -07005892 rmwreg(0xC0FF0000, GFX3D_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07005893 rmwreg(0x80FF0000, IJPEG_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07005894 rmwreg(0x80FF0000, MDP_CC_REG, 0xE1FF0010);
5895 rmwreg(0x80FF0000, MDP_LUT_CC_REG, 0xE0FF0010);
5896 rmwreg(0x80FF0000, ROT_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07005897 rmwreg(0x000004FF, TV_CC2_REG, 0x000007FF);
5898 rmwreg(0xC0FF0000, VCODEC_CC_REG, 0xE0FF0010);
5899 rmwreg(0x80FF0000, VFE_CC_REG, 0xE0FF4010);
Stephen Boyd94625ef2011-07-12 17:06:01 -07005900 rmwreg(0x800000FF, VFE_CC2_REG, 0xE00000FF);
Matt Wagantall53d968f2011-07-19 13:22:53 -07005901 rmwreg(0x80FF0000, VPE_CC_REG, 0xE0FF0010);
Tianyi Goue3d4f542012-03-15 17:06:45 -07005902 if (cpu_is_msm8960() || cpu_is_apq8064()) {
5903 rmwreg(0x80FF0000, DSI2_BYTE_CC_REG, 0xE0FF0010);
5904 rmwreg(0x80FF0000, DSI2_PIXEL_CC_REG, 0xE0FF0010);
5905 rmwreg(0x80FF0000, JPEGD_CC_REG, 0xE0FF0010);
5906 }
5907 if (cpu_is_msm8960() || cpu_is_msm8930())
5908 rmwreg(0x80FF0000, TV_CC_REG, 0xE1FFC010);
5909
5910 if (cpu_is_msm8960()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07005911 rmwreg(0x80FF0000, GFX2D0_CC_REG, 0xE0FF0010);
5912 rmwreg(0x80FF0000, GFX2D1_CC_REG, 0xE0FF0010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07005913 }
5914 if (cpu_is_apq8064()) {
5915 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Gou621f8742011-09-01 21:45:01 -07005916 rmwreg(0x80FF0000, VCAP_CC_REG, 0xE0FF1010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07005917 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005918
Tianyi Gou41515e22011-09-01 19:37:43 -07005919 /*
5920 * Initialize USB_HS_HCLK_FS registers: Set FORCE_C_ON bits so that
5921 * core remain active during halt state of the clk. Also, set sleep
5922 * and wake-up value to max.
5923 */
5924 rmwreg(0x0000004F, USB_HS1_HCLK_FS_REG, 0x0000007F);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07005925 if (cpu_is_apq8064()) {
5926 rmwreg(0x0000004F, USB_HS3_HCLK_FS_REG, 0x0000007F);
5927 rmwreg(0x0000004F, USB_HS4_HCLK_FS_REG, 0x0000007F);
5928 }
Tianyi Gou41515e22011-09-01 19:37:43 -07005929
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005930 /* De-assert MM AXI resets to all hardware blocks. */
5931 writel_relaxed(0, SW_RESET_AXI_REG);
5932
5933 /* Deassert all MM core resets. */
5934 writel_relaxed(0, SW_RESET_CORE_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07005935 writel_relaxed(0, SW_RESET_CORE2_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005936
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005937 /* Enable TSSC and PDM PXO sources. */
5938 writel_relaxed(BIT(11), TSSC_CLK_CTL_REG);
5939 writel_relaxed(BIT(15), PDM_CLK_NS_REG);
5940
5941 /* Source SLIMBus xo src from slimbus reference clock */
Tianyi Goue3d4f542012-03-15 17:06:45 -07005942 if (cpu_is_msm8960())
Tianyi Gou8c1a1182011-10-10 14:47:11 -07005943 writel_relaxed(0x3, SLIMBUS_XO_SRC_CLK_CTL_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005944
5945 /* Source the dsi_byte_clks from the DSI PHY PLLs */
5946 rmwreg(0x1, DSI1_BYTE_NS_REG, 0x7);
Tianyi Goue3d4f542012-03-15 17:06:45 -07005947 if (cpu_is_msm8960() || cpu_is_apq8064())
5948 rmwreg(0x2, DSI2_BYTE_NS_REG, 0x7);
Tianyi Gou41515e22011-09-01 19:37:43 -07005949
5950 /* Source the sata_phy_ref_clk from PXO */
5951 if (cpu_is_apq8064())
5952 rmwreg(0, SATA_PHY_REF_CLK_CTL_REG, 0x1);
5953
5954 /*
Tianyi Gou05e01102012-02-08 22:15:49 -08005955 * TODO: Programming below PLLs and prng_clk is temporary and
5956 * needs to be removed after bootloaders program them.
Tianyi Gou41515e22011-09-01 19:37:43 -07005957 */
5958 if (cpu_is_apq8064()) {
Tianyi Gou317aa862012-02-06 14:31:07 -08005959 u32 is_pll_enabled;
Tianyi Gou41515e22011-09-01 19:37:43 -07005960
5961 /* Program pxo_src_clk to source from PXO */
5962 rmwreg(0x1, PXO_SRC_CLK_CTL_REG, 0x7);
5963
Tianyi Gou41515e22011-09-01 19:37:43 -07005964 /* Check if PLL14 is active */
5965 is_pll_enabled = readl_relaxed(BB_PLL14_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005966 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07005967 /* Ref clk = 27MHz and program pll14 to 480MHz */
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005968 configure_pll(&pll14_config, &pll14_regs, 1);
Tianyi Gou621f8742011-09-01 21:45:01 -07005969
Tianyi Gou621f8742011-09-01 21:45:01 -07005970 /* Program PLL15 to 975MHz with ref clk = 27MHz */
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005971 configure_pll(&pll15_config, &pll15_regs, 0);
Tianyi Gouc29c3242011-10-12 21:02:15 -07005972
5973 /* Check if PLL4 is active */
5974 is_pll_enabled = readl_relaxed(LCC_PLL0_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005975 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07005976 /* Ref clk = 27MHz and program pll4 to 393.2160MHz */
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005977 configure_pll(&pll4_config, &pll4_regs, 1);
Tianyi Gouc29c3242011-10-12 21:02:15 -07005978
5979 /* Enable PLL4 source on the LPASS Primary PLL Mux */
5980 writel_relaxed(0x1, LCC_PRI_PLL_CLK_CTL_REG);
Tianyi Gou05e01102012-02-08 22:15:49 -08005981
5982 /* Program prng_clk to 64MHz if it isn't configured */
5983 if (!readl_relaxed(PRNG_CLK_NS_REG))
5984 writel_relaxed(0x2B, PRNG_CLK_NS_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07005985 }
Tianyi Gou65c536a2012-03-20 23:20:29 -07005986
5987 /*
5988 * Program PLL15 to 900MHz with ref clk = 27MHz and
5989 * only enable PLL main output.
5990 */
5991 if (cpu_is_msm8930()) {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07005992 pll15_config.l = 0x21 | BVAL(31, 7, 0x600);
5993 pll15_config.m = 0x1;
5994 pll15_config.n = 0x3;
5995 configure_pll(&pll15_config, &pll15_regs, 0);
5996 /* Disable AUX and BIST outputs */
5997 writel_relaxed(0, MM_PLL3_TEST_CTL_REG);
Tianyi Gou65c536a2012-03-20 23:20:29 -07005998 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005999}
6000
Matt Wagantallb64888f2012-04-02 21:35:07 -07006001static void __init msm8960_clock_pre_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006002{
Saravana Kannan298ec392012-02-08 19:21:47 -08006003 if (cpu_is_apq8064()) {
6004 vdd_sr2_pll.set_vdd = set_vdd_sr2_pll_8064;
Tianyi Goue1faaf22012-01-24 16:07:19 -08006005 } else if (cpu_is_msm8930() || cpu_is_msm8627()) {
Saravana Kannan298ec392012-02-08 19:21:47 -08006006 vdd_dig.set_vdd = set_vdd_dig_8930;
6007 vdd_sr2_pll.set_vdd = set_vdd_sr2_pll_8930;
Tianyi Goue1faaf22012-01-24 16:07:19 -08006008 }
Tianyi Goubf3d0b12012-01-23 14:37:28 -08006009
Tianyi Gou41515e22011-09-01 19:37:43 -07006010 /*
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006011 * Change the freq tables for and voltage requirements for
6012 * clocks which differ between 8960 and 8064.
Tianyi Gou41515e22011-09-01 19:37:43 -07006013 */
6014 if (cpu_is_apq8064()) {
6015 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8064;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006016
6017 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8064,
6018 sizeof(gfx3d_clk.c.fmax));
6019 memcpy(ijpeg_clk.c.fmax, fmax_ijpeg_8064,
6020 sizeof(ijpeg_clk.c.fmax));
6021 memcpy(mdp_clk.c.fmax, fmax_mdp_8064,
6022 sizeof(ijpeg_clk.c.fmax));
6023 memcpy(tv_src_clk.c.fmax, fmax_tv_src_8064,
6024 sizeof(tv_src_clk.c.fmax));
6025 memcpy(vfe_clk.c.fmax, fmax_vfe_8064,
6026 sizeof(vfe_clk.c.fmax));
6027
Tianyi Goue3d4f542012-03-15 17:06:45 -07006028 gmem_axi_clk.c.depends = &gfx3d_axi_clk_8064.c;
6029 }
6030
6031 /*
6032 * Change the freq tables and voltage requirements for
6033 * clocks which differ between 8960 and 8930.
6034 */
6035 if (cpu_is_msm8930()) {
6036 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8930;
6037
6038 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8930,
6039 sizeof(gfx3d_clk.c.fmax));
6040
6041 pll15_clk.c.rate = 900000000;
6042 gmem_axi_clk.c.depends = &gfx3d_axi_clk_8930.c;
Tianyi Gou41515e22011-09-01 19:37:43 -07006043 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07006044 if ((readl_relaxed(PRNG_CLK_NS_REG) & 0x7F) == 0x2B)
6045 prng_clk.freq_tbl = clk_tbl_prng_64;
Stephen Boyd94625ef2011-07-12 17:06:01 -07006046
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006047 vote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006048
Vikram Mulukutla681d8682012-03-09 23:56:20 -08006049 clk_ops_local_pll.enable = sr_pll_clk_enable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006050
6051 /* Initialize clock registers. */
6052 reg_init();
Matt Wagantallb64888f2012-04-02 21:35:07 -07006053}
6054
6055static void __init msm8960_clock_post_init(void)
6056{
6057 /* Keep PXO on whenever APPS cpu is active */
6058 clk_prepare_enable(&pxo_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006059
Matt Wagantalle655cd72012-04-09 10:15:03 -07006060 /* Reset 3D core while clocked to ensure it resets completely. */
6061 clk_set_rate(&gfx3d_clk.c, 27000000);
6062 clk_prepare_enable(&gfx3d_clk.c);
6063 clk_reset(&gfx3d_clk.c, CLK_RESET_ASSERT);
6064 udelay(5);
6065 clk_reset(&gfx3d_clk.c, CLK_RESET_DEASSERT);
6066 clk_disable_unprepare(&gfx3d_clk.c);
6067
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006068 /* Initialize rates for clocks that only support one. */
6069 clk_set_rate(&pdm_clk.c, 27000000);
Stephen Boyd842a1f62012-04-26 19:07:38 -07006070 clk_set_rate(&prng_clk.c, prng_clk.freq_tbl->freq_hz);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006071 clk_set_rate(&mdp_vsync_clk.c, 27000000);
6072 clk_set_rate(&tsif_ref_clk.c, 105000);
6073 clk_set_rate(&tssc_clk.c, 27000000);
6074 clk_set_rate(&usb_hs1_xcvr_clk.c, 60000000);
Tianyi Gou41515e22011-09-01 19:37:43 -07006075 if (cpu_is_apq8064()) {
6076 clk_set_rate(&usb_hs3_xcvr_clk.c, 60000000);
6077 clk_set_rate(&usb_hs4_xcvr_clk.c, 60000000);
6078 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006079 clk_set_rate(&usb_fs1_src_clk.c, 60000000);
Stepan Moskovchenko2429f152011-10-25 14:42:35 -07006080 if (cpu_is_msm8960() || cpu_is_msm8930())
Tianyi Gou41515e22011-09-01 19:37:43 -07006081 clk_set_rate(&usb_fs2_src_clk.c, 60000000);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006082 clk_set_rate(&usb_hsic_xcvr_fs_clk.c, 60000000);
6083 clk_set_rate(&usb_hsic_hsic_src_clk.c, 480000000);
6084 clk_set_rate(&usb_hsic_hsio_cal_clk.c, 9000000);
Lena Salman127823f2012-02-14 17:13:53 +02006085 clk_set_rate(&usb_hsic_system_clk.c, 60000000);
Stephen Boyd092fd182011-10-21 15:56:30 -07006086 /*
6087 * Set the CSI rates to a safe default to avoid warnings when
6088 * switching csi pix and rdi clocks.
6089 */
6090 clk_set_rate(&csi0_src_clk.c, 27000000);
6091 clk_set_rate(&csi1_src_clk.c, 27000000);
6092 clk_set_rate(&csi2_src_clk.c, 27000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006093
6094 /*
Stephen Boyd60496bb2011-10-17 13:51:37 -07006095 * The halt status bits for these clocks may be incorrect at boot.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006096 * Toggle these clocks on and off to refresh them.
6097 */
Stephen Boyd409b8b42012-04-10 12:12:56 -07006098 clk_prepare_enable(&pdm_clk.c);
6099 clk_disable_unprepare(&pdm_clk.c);
6100 clk_prepare_enable(&tssc_clk.c);
6101 clk_disable_unprepare(&tssc_clk.c);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006102 clk_prepare_enable(&usb_hsic_hsic_clk.c);
6103 clk_disable_unprepare(&usb_hsic_hsic_clk.c);
Stephen Boydd7a143a2012-02-16 17:59:26 -08006104
6105 /*
6106 * Keep sfab floor @ 54MHz so that Krait AHB is at least 27MHz at all
6107 * times when Apps CPU is active. This ensures the timer's requirement
6108 * of Krait AHB running 4 times as fast as the timer itself.
6109 */
6110 clk_set_rate(&sfab_tmr_a_clk.c, 54000000);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006111 clk_prepare_enable(&sfab_tmr_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006112}
6113
Stephen Boydbb600ae2011-08-02 20:11:40 -07006114static int __init msm8960_clock_late_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006115{
Stephen Boyda3787f32011-09-16 18:55:13 -07006116 int rc;
6117 struct clk *mmfpb_a_clk = clk_get_sys("clock-8960", "mmfpb_a_clk");
Stephen Boyd85436132011-09-16 18:55:13 -07006118 struct clk *cfpb_a_clk = clk_get_sys("clock-8960", "cfpb_a_clk");
Stephen Boyda3787f32011-09-16 18:55:13 -07006119
6120 /* Vote for MMFPB to be at least 76.8MHz when an Apps CPU is active. */
6121 if (WARN(IS_ERR(mmfpb_a_clk), "mmfpb_a_clk not found (%ld)\n",
6122 PTR_ERR(mmfpb_a_clk)))
6123 return PTR_ERR(mmfpb_a_clk);
Matt Wagantallde555f562011-11-08 14:18:07 -08006124 rc = clk_set_rate(mmfpb_a_clk, 76800000);
Stephen Boyda3787f32011-09-16 18:55:13 -07006125 if (WARN(rc, "mmfpb_a_clk rate was not set (%d)\n", rc))
6126 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006127 rc = clk_prepare_enable(mmfpb_a_clk);
Stephen Boyda3787f32011-09-16 18:55:13 -07006128 if (WARN(rc, "mmfpb_a_clk not enabled (%d)\n", rc))
6129 return rc;
6130
Stephen Boyd85436132011-09-16 18:55:13 -07006131 /* Vote for CFPB to be at least 64MHz when an Apps CPU is active. */
6132 if (WARN(IS_ERR(cfpb_a_clk), "cfpb_a_clk not found (%ld)\n",
6133 PTR_ERR(cfpb_a_clk)))
6134 return PTR_ERR(cfpb_a_clk);
Matt Wagantallde555f562011-11-08 14:18:07 -08006135 rc = clk_set_rate(cfpb_a_clk, 64000000);
Stephen Boyd85436132011-09-16 18:55:13 -07006136 if (WARN(rc, "cfpb_a_clk rate was not set (%d)\n", rc))
6137 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006138 rc = clk_prepare_enable(cfpb_a_clk);
Stephen Boyd85436132011-09-16 18:55:13 -07006139 if (WARN(rc, "cfpb_a_clk not enabled (%d)\n", rc))
6140 return rc;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006141
6142 return unvote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006143}
Stephen Boydbb600ae2011-08-02 20:11:40 -07006144
6145struct clock_init_data msm8960_clock_init_data __initdata = {
6146 .table = msm_clocks_8960,
6147 .size = ARRAY_SIZE(msm_clocks_8960),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006148 .pre_init = msm8960_clock_pre_init,
6149 .post_init = msm8960_clock_post_init,
Stephen Boydbb600ae2011-08-02 20:11:40 -07006150 .late_init = msm8960_clock_late_init,
6151};
Tianyi Gou41515e22011-09-01 19:37:43 -07006152
6153struct clock_init_data apq8064_clock_init_data __initdata = {
6154 .table = msm_clocks_8064,
6155 .size = ARRAY_SIZE(msm_clocks_8064),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006156 .pre_init = msm8960_clock_pre_init,
6157 .post_init = msm8960_clock_post_init,
Tianyi Gou41515e22011-09-01 19:37:43 -07006158 .late_init = msm8960_clock_late_init,
6159};
Tianyi Goue3d4f542012-03-15 17:06:45 -07006160
6161struct clock_init_data msm8930_clock_init_data __initdata = {
6162 .table = msm_clocks_8930,
6163 .size = ARRAY_SIZE(msm_clocks_8930),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006164 .pre_init = msm8960_clock_pre_init,
6165 .post_init = msm8960_clock_post_init,
Tianyi Goue3d4f542012-03-15 17:06:45 -07006166 .late_init = msm8960_clock_late_init,
6167};