blob: 373cf47bfb867a5be7d396f330928d5503d579a7 [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)
Tianyi Gou352955d2012-05-18 19:44:01 -070045#define SFAB_SATA_S_HCLK_CTL_REG REG(0x2480)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#define CE1_HCLK_CTL_REG REG(0x2720)
47#define CE1_CORE_CLK_CTL_REG REG(0x2724)
Tianyi Gou05e01102012-02-08 22:15:49 -080048#define PRNG_CLK_NS_REG REG(0x2E80)
Tianyi Gou41515e22011-09-01 19:37:43 -070049#define CE3_HCLK_CTL_REG REG(0x36C4)
50#define CE3_CORE_CLK_CTL_REG REG(0x36CC)
51#define CE3_CLK_SRC_NS_REG REG(0x36C0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#define DMA_BAM_HCLK_CTL REG(0x25C0)
Tianyi Gou6613de52012-01-27 17:57:53 -080053#define CLK_HALT_AFAB_SFAB_STATEA_REG REG(0x2FC0)
Tianyi Gou41515e22011-09-01 19:37:43 -070054#define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070055#define CLK_HALT_CFPB_STATEA_REG REG(0x2FCC)
56#define CLK_HALT_CFPB_STATEB_REG REG(0x2FD0)
57#define CLK_HALT_CFPB_STATEC_REG REG(0x2FD4)
58#define CLK_HALT_DFAB_STATE_REG REG(0x2FC8)
Tianyi Gou41515e22011-09-01 19:37:43 -070059/* 8064 name CLK_HALT_GSS_KPSS_MISC_STATE_REG */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070060#define CLK_HALT_MSS_SMPSS_MISC_STATE_REG REG(0x2FDC)
61#define CLK_HALT_SFPB_MISC_STATE_REG REG(0x2FD8)
Stephen Boyd973e4ba2011-07-12 17:06:01 -070062#define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#define CLK_TEST_REG REG(0x2FA0)
Matt Wagantall7625a4c2011-11-01 16:17:53 -070064#define GPn_MD_REG(n) REG(0x2D00+(0x20*(n)))
65#define GPn_NS_REG(n) REG(0x2D24+(0x20*(n)))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070066#define GSBIn_HCLK_CTL_REG(n) REG(0x29C0+(0x20*((n)-1)))
67#define GSBIn_QUP_APPS_MD_REG(n) REG(0x29C8+(0x20*((n)-1)))
68#define GSBIn_QUP_APPS_NS_REG(n) REG(0x29CC+(0x20*((n)-1)))
69#define GSBIn_RESET_REG(n) REG(0x29DC+(0x20*((n)-1)))
70#define GSBIn_UART_APPS_MD_REG(n) REG(0x29D0+(0x20*((n)-1)))
71#define GSBIn_UART_APPS_NS_REG(n) REG(0x29D4+(0x20*((n)-1)))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072#define PDM_CLK_NS_REG REG(0x2CC0)
Tianyi Gou41515e22011-09-01 19:37:43 -070073/* 8064 name BB_PLL_ENA_APCS_REG */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074#define BB_PLL_ENA_SC0_REG REG(0x34C0)
Tianyi Gou59608a72012-01-31 22:19:30 -080075#define BB_PLL_ENA_RPM_REG REG(0x34A0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076#define BB_PLL0_STATUS_REG REG(0x30D8)
77#define BB_PLL5_STATUS_REG REG(0x30F8)
78#define BB_PLL6_STATUS_REG REG(0x3118)
79#define BB_PLL7_STATUS_REG REG(0x3138)
80#define BB_PLL8_L_VAL_REG REG(0x3144)
81#define BB_PLL8_M_VAL_REG REG(0x3148)
82#define BB_PLL8_MODE_REG REG(0x3140)
83#define BB_PLL8_N_VAL_REG REG(0x314C)
84#define BB_PLL8_STATUS_REG REG(0x3158)
85#define BB_PLL8_CONFIG_REG REG(0x3154)
86#define BB_PLL8_TEST_CTL_REG REG(0x3150)
Stephen Boyd94625ef2011-07-12 17:06:01 -070087#define BB_MMCC_PLL2_MODE_REG REG(0x3160)
88#define BB_MMCC_PLL2_TEST_CTL_REG REG(0x3170)
Tianyi Gou41515e22011-09-01 19:37:43 -070089#define BB_PLL14_MODE_REG REG(0x31C0)
90#define BB_PLL14_L_VAL_REG REG(0x31C4)
91#define BB_PLL14_M_VAL_REG REG(0x31C8)
92#define BB_PLL14_N_VAL_REG REG(0x31CC)
93#define BB_PLL14_TEST_CTL_REG REG(0x31D0)
94#define BB_PLL14_CONFIG_REG REG(0x31D4)
Stephen Boyd94625ef2011-07-12 17:06:01 -070095#define BB_PLL14_STATUS_REG REG(0x31D8)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096#define PLLTEST_PAD_CFG_REG REG(0x2FA4)
97#define PMEM_ACLK_CTL_REG REG(0x25A0)
98#define RINGOSC_NS_REG REG(0x2DC0)
99#define RINGOSC_STATUS_REG REG(0x2DCC)
100#define RINGOSC_TCXO_CTL_REG REG(0x2DC4)
Stephen Boyda52d7e32011-11-10 11:59:00 -0800101#define RPM_MSG_RAM_HCLK_CTL_REG REG(0x27E0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700102#define SC0_U_CLK_BRANCH_ENA_VOTE_REG REG(0x3080)
103#define SDCn_APPS_CLK_MD_REG(n) REG(0x2828+(0x20*((n)-1)))
104#define SDCn_APPS_CLK_NS_REG(n) REG(0x282C+(0x20*((n)-1)))
105#define SDCn_HCLK_CTL_REG(n) REG(0x2820+(0x20*((n)-1)))
106#define SDCn_RESET_REG(n) REG(0x2830+(0x20*((n)-1)))
107#define SLIMBUS_XO_SRC_CLK_CTL_REG REG(0x2628)
108#define TSIF_HCLK_CTL_REG REG(0x2700)
109#define TSIF_REF_CLK_MD_REG REG(0x270C)
110#define TSIF_REF_CLK_NS_REG REG(0x2710)
111#define TSSC_CLK_CTL_REG REG(0x2CA0)
Tianyi Gou352955d2012-05-18 19:44:01 -0700112#define SATA_HCLK_CTL_REG REG(0x2C00)
Tianyi Gou41515e22011-09-01 19:37:43 -0700113#define SATA_CLK_SRC_NS_REG REG(0x2C08)
114#define SATA_RXOOB_CLK_CTL_REG REG(0x2C0C)
115#define SATA_PMALIVE_CLK_CTL_REG REG(0x2C10)
116#define SATA_PHY_REF_CLK_CTL_REG REG(0x2C14)
Tianyi Gou352955d2012-05-18 19:44:01 -0700117#define SATA_ACLK_CTL_REG REG(0x2C20)
Tianyi Gou41515e22011-09-01 19:37:43 -0700118#define SATA_PHY_CFG_CLK_CTL_REG REG(0x2C40)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700119#define USB_FSn_HCLK_CTL_REG(n) REG(0x2960+(0x20*((n)-1)))
120#define USB_FSn_RESET_REG(n) REG(0x2974+(0x20*((n)-1)))
121#define USB_FSn_SYSTEM_CLK_CTL_REG(n) REG(0x296C+(0x20*((n)-1)))
122#define USB_FSn_XCVR_FS_CLK_MD_REG(n) REG(0x2964+(0x20*((n)-1)))
123#define USB_FSn_XCVR_FS_CLK_NS_REG(n) REG(0x2968+(0x20*((n)-1)))
124#define USB_HS1_HCLK_CTL_REG REG(0x2900)
Tianyi Gou41515e22011-09-01 19:37:43 -0700125#define USB_HS1_HCLK_FS_REG REG(0x2904)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700126#define USB_HS1_RESET_REG REG(0x2910)
127#define USB_HS1_XCVR_FS_CLK_MD_REG REG(0x2908)
128#define USB_HS1_XCVR_FS_CLK_NS_REG REG(0x290C)
Tianyi Gou41515e22011-09-01 19:37:43 -0700129#define USB_HS3_HCLK_CTL_REG REG(0x3700)
130#define USB_HS3_HCLK_FS_REG REG(0x3704)
131#define USB_HS3_RESET_REG REG(0x3710)
132#define USB_HS3_XCVR_FS_CLK_MD_REG REG(0X3708)
133#define USB_HS3_XCVR_FS_CLK_NS_REG REG(0X370C)
134#define USB_HS4_HCLK_CTL_REG REG(0x3720)
135#define USB_HS4_HCLK_FS_REG REG(0x3724)
136#define USB_HS4_RESET_REG REG(0x3730)
137#define USB_HS4_XCVR_FS_CLK_MD_REG REG(0X3728)
138#define USB_HS4_XCVR_FS_CLK_NS_REG REG(0X372C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700139#define USB_HSIC_HCLK_CTL_REG REG(0x2920)
140#define USB_HSIC_HSIC_CLK_CTL_REG REG(0x2B44)
141#define USB_HSIC_HSIC_CLK_SRC_CTL_REG REG(0x2B40)
142#define USB_HSIC_HSIO_CAL_CLK_CTL_REG REG(0x2B48)
143#define USB_HSIC_RESET_REG REG(0x2934)
144#define USB_HSIC_SYSTEM_CLK_CTL_REG REG(0x292C)
145#define USB_HSIC_XCVR_FS_CLK_MD_REG REG(0x2924)
146#define USB_HSIC_XCVR_FS_CLK_NS_REG REG(0x2928)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700147#define USB_PHY0_RESET_REG REG(0x2E20)
Tianyi Gou41515e22011-09-01 19:37:43 -0700148#define PCIE_ALT_REF_CLK_NS_REG REG(0x3860)
Tianyi Gou6613de52012-01-27 17:57:53 -0800149#define PCIE_ACLK_CTL_REG REG(0x22C0)
Tianyi Gou41515e22011-09-01 19:37:43 -0700150#define PCIE_HCLK_CTL_REG REG(0x22CC)
Tianyi Gou6613de52012-01-27 17:57:53 -0800151#define PCIE_PCLK_CTL_REG REG(0x22D0)
Tianyi Gou41515e22011-09-01 19:37:43 -0700152#define GPLL1_MODE_REG REG(0x3160)
153#define GPLL1_L_VAL_REG REG(0x3164)
154#define GPLL1_M_VAL_REG REG(0x3168)
155#define GPLL1_N_VAL_REG REG(0x316C)
156#define GPLL1_CONFIG_REG REG(0x3174)
157#define GPLL1_STATUS_REG REG(0x3178)
158#define PXO_SRC_CLK_CTL_REG REG(0x2EA0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700159
160/* Multimedia clock registers. */
161#define AHB_EN_REG REG_MM(0x0008)
162#define AHB_EN2_REG REG_MM(0x0038)
Tianyi Gou41515e22011-09-01 19:37:43 -0700163#define AHB_EN3_REG REG_MM(0x0248)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164#define AHB_NS_REG REG_MM(0x0004)
165#define AXI_NS_REG REG_MM(0x0014)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700166#define CAMCLK0_NS_REG REG_MM(0x0148)
167#define CAMCLK0_CC_REG REG_MM(0x0140)
168#define CAMCLK0_MD_REG REG_MM(0x0144)
169#define CAMCLK1_NS_REG REG_MM(0x015C)
170#define CAMCLK1_CC_REG REG_MM(0x0154)
171#define CAMCLK1_MD_REG REG_MM(0x0158)
172#define CAMCLK2_NS_REG REG_MM(0x0228)
173#define CAMCLK2_CC_REG REG_MM(0x0220)
174#define CAMCLK2_MD_REG REG_MM(0x0224)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175#define CSI0_NS_REG REG_MM(0x0048)
176#define CSI0_CC_REG REG_MM(0x0040)
177#define CSI0_MD_REG REG_MM(0x0044)
178#define CSI1_NS_REG REG_MM(0x0010)
179#define CSI1_CC_REG REG_MM(0x0024)
180#define CSI1_MD_REG REG_MM(0x0028)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700181#define CSI2_NS_REG REG_MM(0x0234)
182#define CSI2_CC_REG REG_MM(0x022C)
183#define CSI2_MD_REG REG_MM(0x0230)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700184#define CSIPHYTIMER_CC_REG REG_MM(0x0160)
185#define CSIPHYTIMER_MD_REG REG_MM(0x0164)
186#define CSIPHYTIMER_NS_REG REG_MM(0x0168)
187#define DSI1_BYTE_NS_REG REG_MM(0x00B0)
188#define DSI1_BYTE_CC_REG REG_MM(0x0090)
189#define DSI2_BYTE_NS_REG REG_MM(0x00BC)
190#define DSI2_BYTE_CC_REG REG_MM(0x00B4)
191#define DSI1_ESC_NS_REG REG_MM(0x011C)
192#define DSI1_ESC_CC_REG REG_MM(0x00CC)
193#define DSI2_ESC_NS_REG REG_MM(0x0150)
194#define DSI2_ESC_CC_REG REG_MM(0x013C)
195#define DSI_PIXEL_CC_REG REG_MM(0x0130)
196#define DSI2_PIXEL_CC_REG REG_MM(0x0094)
Patrick Dalye6f489042012-07-11 15:29:15 -0700197#define DSI2_PIXEL_CC2_REG REG_MM(0x0264)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700198#define DBG_BUS_VEC_A_REG REG_MM(0x01C8)
199#define DBG_BUS_VEC_B_REG REG_MM(0x01CC)
200#define DBG_BUS_VEC_C_REG REG_MM(0x01D0)
201#define DBG_BUS_VEC_D_REG REG_MM(0x01D4)
202#define DBG_BUS_VEC_E_REG REG_MM(0x01D8)
203#define DBG_BUS_VEC_F_REG REG_MM(0x01DC)
204#define DBG_BUS_VEC_G_REG REG_MM(0x01E0)
205#define DBG_BUS_VEC_H_REG REG_MM(0x01E4)
206#define DBG_BUS_VEC_I_REG REG_MM(0x01E8)
Tianyi Gou41515e22011-09-01 19:37:43 -0700207#define DBG_BUS_VEC_J_REG REG_MM(0x0240)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700208#define DBG_CFG_REG_HS_REG REG_MM(0x01B4)
209#define DBG_CFG_REG_LS_REG REG_MM(0x01B8)
210#define GFX2D0_CC_REG REG_MM(0x0060)
211#define GFX2D0_MD0_REG REG_MM(0x0064)
212#define GFX2D0_MD1_REG REG_MM(0x0068)
213#define GFX2D0_NS_REG REG_MM(0x0070)
214#define GFX2D1_CC_REG REG_MM(0x0074)
215#define GFX2D1_MD0_REG REG_MM(0x0078)
216#define GFX2D1_MD1_REG REG_MM(0x006C)
217#define GFX2D1_NS_REG REG_MM(0x007C)
218#define GFX3D_CC_REG REG_MM(0x0080)
219#define GFX3D_MD0_REG REG_MM(0x0084)
220#define GFX3D_MD1_REG REG_MM(0x0088)
221#define GFX3D_NS_REG REG_MM(0x008C)
222#define IJPEG_CC_REG REG_MM(0x0098)
223#define IJPEG_MD_REG REG_MM(0x009C)
224#define IJPEG_NS_REG REG_MM(0x00A0)
225#define JPEGD_CC_REG REG_MM(0x00A4)
226#define JPEGD_NS_REG REG_MM(0x00AC)
Tianyi Gou41515e22011-09-01 19:37:43 -0700227#define VCAP_CC_REG REG_MM(0x0178)
228#define VCAP_NS_REG REG_MM(0x021C)
229#define VCAP_MD0_REG REG_MM(0x01EC)
230#define VCAP_MD1_REG REG_MM(0x0218)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700231#define MAXI_EN_REG REG_MM(0x0018)
232#define MAXI_EN2_REG REG_MM(0x0020)
233#define MAXI_EN3_REG REG_MM(0x002C)
234#define MAXI_EN4_REG REG_MM(0x0114)
Tianyi Gou41515e22011-09-01 19:37:43 -0700235#define MAXI_EN5_REG REG_MM(0x0244)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236#define MDP_CC_REG REG_MM(0x00C0)
237#define MDP_LUT_CC_REG REG_MM(0x016C)
238#define MDP_MD0_REG REG_MM(0x00C4)
239#define MDP_MD1_REG REG_MM(0x00C8)
240#define MDP_NS_REG REG_MM(0x00D0)
241#define MISC_CC_REG REG_MM(0x0058)
242#define MISC_CC2_REG REG_MM(0x005C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700243#define MISC_CC3_REG REG_MM(0x0238)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700244#define MM_PLL1_MODE_REG REG_MM(0x031C)
Tianyi Gou41515e22011-09-01 19:37:43 -0700245#define MM_PLL1_L_VAL_REG REG_MM(0x0320)
246#define MM_PLL1_M_VAL_REG REG_MM(0x0324)
247#define MM_PLL1_N_VAL_REG REG_MM(0x0328)
248#define MM_PLL1_CONFIG_REG REG_MM(0x032C)
249#define MM_PLL1_TEST_CTL_REG REG_MM(0x0330)
250#define MM_PLL1_STATUS_REG REG_MM(0x0334)
251#define MM_PLL3_MODE_REG REG_MM(0x0338)
Tianyi Gou621f8742011-09-01 21:45:01 -0700252#define MM_PLL3_L_VAL_REG REG_MM(0x033C)
253#define MM_PLL3_M_VAL_REG REG_MM(0x0340)
254#define MM_PLL3_N_VAL_REG REG_MM(0x0344)
255#define MM_PLL3_CONFIG_REG REG_MM(0x0348)
256#define MM_PLL3_TEST_CTL_REG REG_MM(0x034C)
257#define MM_PLL3_STATUS_REG REG_MM(0x0350)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700258#define ROT_CC_REG REG_MM(0x00E0)
259#define ROT_NS_REG REG_MM(0x00E8)
260#define SAXI_EN_REG REG_MM(0x0030)
261#define SW_RESET_AHB_REG REG_MM(0x020C)
262#define SW_RESET_AHB2_REG REG_MM(0x0200)
263#define SW_RESET_ALL_REG REG_MM(0x0204)
264#define SW_RESET_AXI_REG REG_MM(0x0208)
265#define SW_RESET_CORE_REG REG_MM(0x0210)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700266#define SW_RESET_CORE2_REG REG_MM(0x0214)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267#define TV_CC_REG REG_MM(0x00EC)
268#define TV_CC2_REG REG_MM(0x0124)
269#define TV_MD_REG REG_MM(0x00F0)
270#define TV_NS_REG REG_MM(0x00F4)
271#define VCODEC_CC_REG REG_MM(0x00F8)
272#define VCODEC_MD0_REG REG_MM(0x00FC)
273#define VCODEC_MD1_REG REG_MM(0x0128)
274#define VCODEC_NS_REG REG_MM(0x0100)
275#define VFE_CC_REG REG_MM(0x0104)
276#define VFE_MD_REG REG_MM(0x0108)
277#define VFE_NS_REG REG_MM(0x010C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700278#define VFE_CC2_REG REG_MM(0x023C)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279#define VPE_CC_REG REG_MM(0x0110)
280#define VPE_NS_REG REG_MM(0x0118)
281
282/* Low-power Audio clock registers. */
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700283#define LCC_CLK_HS_DEBUG_CFG_REG REG_LPA(0x00A4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700284#define LCC_CLK_LS_DEBUG_CFG_REG REG_LPA(0x00A8)
285#define LCC_CODEC_I2S_MIC_MD_REG REG_LPA(0x0064)
286#define LCC_CODEC_I2S_MIC_NS_REG REG_LPA(0x0060)
287#define LCC_CODEC_I2S_MIC_STATUS_REG REG_LPA(0x0068)
288#define LCC_CODEC_I2S_SPKR_MD_REG REG_LPA(0x0070)
289#define LCC_CODEC_I2S_SPKR_NS_REG REG_LPA(0x006C)
290#define LCC_CODEC_I2S_SPKR_STATUS_REG REG_LPA(0x0074)
291#define LCC_MI2S_MD_REG REG_LPA(0x004C)
292#define LCC_MI2S_NS_REG REG_LPA(0x0048)
293#define LCC_MI2S_STATUS_REG REG_LPA(0x0050)
294#define LCC_PCM_MD_REG REG_LPA(0x0058)
295#define LCC_PCM_NS_REG REG_LPA(0x0054)
296#define LCC_PCM_STATUS_REG REG_LPA(0x005C)
Tianyi Gouc29c3242011-10-12 21:02:15 -0700297#define LCC_PLL0_MODE_REG REG_LPA(0x0000)
298#define LCC_PLL0_L_VAL_REG REG_LPA(0x0004)
299#define LCC_PLL0_M_VAL_REG REG_LPA(0x0008)
300#define LCC_PLL0_N_VAL_REG REG_LPA(0x000C)
301#define LCC_PLL0_CONFIG_REG REG_LPA(0x0014)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700302#define LCC_PLL0_STATUS_REG REG_LPA(0x0018)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700303#define LCC_SPARE_I2S_MIC_MD_REG REG_LPA(0x007C)
304#define LCC_SPARE_I2S_MIC_NS_REG REG_LPA(0x0078)
305#define LCC_SPARE_I2S_MIC_STATUS_REG REG_LPA(0x0080)
306#define LCC_SPARE_I2S_SPKR_MD_REG REG_LPA(0x0088)
307#define LCC_SPARE_I2S_SPKR_NS_REG REG_LPA(0x0084)
308#define LCC_SPARE_I2S_SPKR_STATUS_REG REG_LPA(0x008C)
309#define LCC_SLIMBUS_NS_REG REG_LPA(0x00CC)
310#define LCC_SLIMBUS_MD_REG REG_LPA(0x00D0)
311#define LCC_SLIMBUS_STATUS_REG REG_LPA(0x00D4)
312#define LCC_AHBEX_BRANCH_CTL_REG REG_LPA(0x00E4)
Tianyi Gouc29c3242011-10-12 21:02:15 -0700313#define LCC_PRI_PLL_CLK_CTL_REG REG_LPA(0x00C4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314
Matt Wagantall8b38f942011-08-02 18:23:18 -0700315#define GCC_APCS_CLK_DIAG REG_GCC(0x001C)
316
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700317/* MUX source input identifiers. */
318#define pxo_to_bb_mux 0
Matt Wagantall7625a4c2011-11-01 16:17:53 -0700319#define cxo_to_bb_mux 5
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320#define pll0_to_bb_mux 2
321#define pll8_to_bb_mux 3
322#define pll6_to_bb_mux 4
323#define gnd_to_bb_mux 5
Stephen Boyd94625ef2011-07-12 17:06:01 -0700324#define pll3_to_bb_mux 6
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700325#define pxo_to_mm_mux 0
326#define pll1_to_mm_mux 1
Tianyi Gou41515e22011-09-01 19:37:43 -0700327#define pll2_to_mm_mux 1 /* or MMCC_PLL1 */
328#define pll8_to_mm_mux 2 /* or GCC_PERF */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329#define pll0_to_mm_mux 3
Tianyi Gou41515e22011-09-01 19:37:43 -0700330#define pll15_to_mm_mux 3 /* or MM_PLL3 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331#define gnd_to_mm_mux 4
Stephen Boyd7a776cd2011-10-20 12:46:04 -0700332#define pll3_to_mm_mux 3 /* or MMCC_PLL2 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700333#define hdmi_pll_to_mm_mux 3
334#define cxo_to_xo_mux 0
335#define pxo_to_xo_mux 1
336#define gnd_to_xo_mux 3
337#define pxo_to_lpa_mux 0
338#define cxo_to_lpa_mux 1
339#define pll4_to_lpa_mux 2
340#define gnd_to_lpa_mux 6
Tianyi Gou41515e22011-09-01 19:37:43 -0700341#define pxo_to_pcie_mux 0
342#define pll3_to_pcie_mux 1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343
344/* Test Vector Macros */
345#define TEST_TYPE_PER_LS 1
346#define TEST_TYPE_PER_HS 2
347#define TEST_TYPE_MM_LS 3
348#define TEST_TYPE_MM_HS 4
349#define TEST_TYPE_LPA 5
Matt Wagantall8b38f942011-08-02 18:23:18 -0700350#define TEST_TYPE_CPUL2 6
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700351#define TEST_TYPE_LPA_HS 7
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352#define TEST_TYPE_SHIFT 24
353#define TEST_CLK_SEL_MASK BM(23, 0)
354#define TEST_VECTOR(s, t) (((t) << TEST_TYPE_SHIFT) | BVAL(23, 0, (s)))
355#define TEST_PER_LS(s) TEST_VECTOR((s), TEST_TYPE_PER_LS)
356#define TEST_PER_HS(s) TEST_VECTOR((s), TEST_TYPE_PER_HS)
357#define TEST_MM_LS(s) TEST_VECTOR((s), TEST_TYPE_MM_LS)
358#define TEST_MM_HS(s) TEST_VECTOR((s), TEST_TYPE_MM_HS)
359#define TEST_LPA(s) TEST_VECTOR((s), TEST_TYPE_LPA)
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700360#define TEST_LPA_HS(s) TEST_VECTOR((s), TEST_TYPE_LPA_HS)
Matt Wagantall8b38f942011-08-02 18:23:18 -0700361#define TEST_CPUL2(s) TEST_VECTOR((s), TEST_TYPE_CPUL2)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700362
363#define MN_MODE_DUAL_EDGE 0x2
364
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700365struct pll_rate {
366 const uint32_t l_val;
367 const uint32_t m_val;
368 const uint32_t n_val;
369 const uint32_t vco;
370 const uint32_t post_div;
371 const uint32_t i_bits;
372};
373#define PLL_RATE(l, m, n, v, d, i) { l, m, n, v, (d>>1), i }
374
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700375enum vdd_dig_levels {
376 VDD_DIG_NONE,
377 VDD_DIG_LOW,
378 VDD_DIG_NOMINAL,
379 VDD_DIG_HIGH
380};
381
Saravana Kannan298ec392012-02-08 19:21:47 -0800382static int set_vdd_dig_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700383{
384 static const int vdd_uv[] = {
385 [VDD_DIG_NONE] = 0,
386 [VDD_DIG_LOW] = 945000,
387 [VDD_DIG_NOMINAL] = 1050000,
388 [VDD_DIG_HIGH] = 1150000
389 };
Saravana Kannan298ec392012-02-08 19:21:47 -0800390 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S3, RPM_VREG_VOTER3,
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700391 vdd_uv[level], 1150000, 1);
392}
393
Saravana Kannan298ec392012-02-08 19:21:47 -0800394static DEFINE_VDD_CLASS(vdd_dig, set_vdd_dig_8960);
395
Patrick Daly1a3859f2012-08-27 16:10:26 -0700396static int rpm_vreg_dig_8930 = RPM_VREG_ID_PM8038_VDD_DIG_CORNER;
Saravana Kannan298ec392012-02-08 19:21:47 -0800397static int set_vdd_dig_8930(struct clk_vdd_class *vdd_class, int level)
398{
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800399 static const int vdd_corner[] = {
400 [VDD_DIG_NONE] = RPM_VREG_CORNER_NONE,
401 [VDD_DIG_LOW] = RPM_VREG_CORNER_LOW,
402 [VDD_DIG_NOMINAL] = RPM_VREG_CORNER_NOMINAL,
403 [VDD_DIG_HIGH] = RPM_VREG_CORNER_HIGH,
Saravana Kannan298ec392012-02-08 19:21:47 -0800404 };
Patrick Daly1a3859f2012-08-27 16:10:26 -0700405 return rpm_vreg_set_voltage(rpm_vreg_dig_8930,
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800406 RPM_VREG_VOTER3,
407 vdd_corner[level],
408 RPM_VREG_CORNER_HIGH, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800409}
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700410
411#define VDD_DIG_FMAX_MAP1(l1, f1) \
412 .vdd_class = &vdd_dig, \
413 .fmax[VDD_DIG_##l1] = (f1)
414#define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \
415 .vdd_class = &vdd_dig, \
416 .fmax[VDD_DIG_##l1] = (f1), \
417 .fmax[VDD_DIG_##l2] = (f2)
418#define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \
419 .vdd_class = &vdd_dig, \
420 .fmax[VDD_DIG_##l1] = (f1), \
421 .fmax[VDD_DIG_##l2] = (f2), \
422 .fmax[VDD_DIG_##l3] = (f3)
423
Matt Wagantall82feaa12012-07-09 10:54:49 -0700424enum vdd_sr2_hdmi_pll_levels {
425 VDD_SR2_HDMI_PLL_OFF,
426 VDD_SR2_HDMI_PLL_ON
Matt Wagantallc57577d2011-10-06 17:06:53 -0700427};
428
Matt Wagantall82feaa12012-07-09 10:54:49 -0700429static int set_vdd_sr2_hdmi_pll_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantallc57577d2011-10-06 17:06:53 -0700430{
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800431 int rc = 0;
Saravana Kannan298ec392012-02-08 19:21:47 -0800432
Matt Wagantall82feaa12012-07-09 10:54:49 -0700433 if (level == VDD_SR2_HDMI_PLL_OFF) {
Saravana Kannan298ec392012-02-08 19:21:47 -0800434 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
435 RPM_VREG_VOTER3, 0, 0, 1);
436 if (rc)
437 return rc;
438 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
439 RPM_VREG_VOTER3, 0, 0, 1);
440 if (rc)
441 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
442 RPM_VREG_VOTER3, 1800000, 1800000, 1);
Tianyi Goue1faaf22012-01-24 16:07:19 -0800443 } else {
Saravana Kannan298ec392012-02-08 19:21:47 -0800444 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
David Collins9a81d6c2012-03-29 15:11:33 -0700445 RPM_VREG_VOTER3, 2050000, 2100000, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800446 if (rc)
447 return rc;
448 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
449 RPM_VREG_VOTER3, 1800000, 1800000, 1);
450 if (rc)
451 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800452 RPM_VREG_VOTER3, 0, 0, 1);
Matt Wagantallc57577d2011-10-06 17:06:53 -0700453 }
454
455 return rc;
456}
457
Matt Wagantall82feaa12012-07-09 10:54:49 -0700458static DEFINE_VDD_CLASS(vdd_sr2_hdmi_pll, set_vdd_sr2_hdmi_pll_8960);
Saravana Kannan298ec392012-02-08 19:21:47 -0800459
460static int sr2_lreg_uv[] = {
Matt Wagantall82feaa12012-07-09 10:54:49 -0700461 [VDD_SR2_HDMI_PLL_OFF] = 0,
462 [VDD_SR2_HDMI_PLL_ON] = 1800000,
Saravana Kannan298ec392012-02-08 19:21:47 -0800463};
464
Matt Wagantall82feaa12012-07-09 10:54:49 -0700465static int set_vdd_sr2_hdmi_pll_8064(struct clk_vdd_class *vdd_class, int level)
Saravana Kannan298ec392012-02-08 19:21:47 -0800466{
467 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_LVS7, RPM_VREG_VOTER3,
468 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
469}
470
Patrick Daly1a3859f2012-08-27 16:10:26 -0700471static int set_vdd_sr2_hdmi_pll_8930_pm8917(struct clk_vdd_class *vdd_class,
472 int level)
473{
474 int rc = 0;
475
476 if (level == VDD_SR2_HDMI_PLL_OFF) {
477 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
478 RPM_VREG_VOTER3, 0, 0, 1);
479 if (rc)
480 return rc;
481 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
482 RPM_VREG_VOTER3, 0, 0, 1);
483 if (rc)
484 rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
485 RPM_VREG_VOTER3, 1800000, 1800000, 1);
486 } else {
487 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
488 RPM_VREG_VOTER3, 2050000, 2100000, 1);
489 if (rc)
490 return rc;
491 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
492 RPM_VREG_VOTER3, 1800000, 1800000, 1);
493 if (rc)
494 rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
495 RPM_VREG_VOTER3, 0, 0, 1);
496 }
497
498 return rc;
499}
500
Matt Wagantall82feaa12012-07-09 10:54:49 -0700501static int set_vdd_sr2_hdmi_pll_8930(struct clk_vdd_class *vdd_class, int level)
Saravana Kannan298ec392012-02-08 19:21:47 -0800502{
503 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8038_L23, RPM_VREG_VOTER3,
504 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
505}
Matt Wagantallc57577d2011-10-06 17:06:53 -0700506
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700507/*
508 * Clock Descriptions
509 */
510
Stephen Boyd72a80352012-01-26 15:57:38 -0800511DEFINE_CLK_RPM_BRANCH(pxo_clk, pxo_a_clk, PXO, 27000000);
512DEFINE_CLK_RPM_BRANCH(cxo_clk, cxo_a_clk, CXO, 19200000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700513
514static struct pll_clk pll2_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700515 .mode_reg = MM_PLL1_MODE_REG,
516 .parent = &pxo_clk.c,
517 .c = {
518 .dbg_name = "pll2_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800519 .rate = 800000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800520 .ops = &clk_ops_local_pll,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700521 CLK_INIT(pll2_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800522 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700523 },
524};
525
Stephen Boyd94625ef2011-07-12 17:06:01 -0700526static struct pll_clk pll3_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700527 .mode_reg = BB_MMCC_PLL2_MODE_REG,
528 .parent = &pxo_clk.c,
529 .c = {
530 .dbg_name = "pll3_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800531 .rate = 1200000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800532 .ops = &clk_ops_local_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -0700533 .vdd_class = &vdd_sr2_hdmi_pll,
534 .fmax[VDD_SR2_HDMI_PLL_ON] = ULONG_MAX,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700535 CLK_INIT(pll3_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800536 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700537 },
538};
539
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700540static struct pll_vote_clk pll4_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700541 .en_reg = BB_PLL_ENA_SC0_REG,
542 .en_mask = BIT(4),
543 .status_reg = LCC_PLL0_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800544 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700545 .parent = &pxo_clk.c,
546 .c = {
547 .dbg_name = "pll4_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800548 .rate = 393216000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700549 .ops = &clk_ops_pll_vote,
550 CLK_INIT(pll4_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800551 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700552 },
553};
554
555static struct pll_vote_clk pll8_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700556 .en_reg = BB_PLL_ENA_SC0_REG,
557 .en_mask = BIT(8),
558 .status_reg = BB_PLL8_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800559 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700560 .parent = &pxo_clk.c,
561 .c = {
562 .dbg_name = "pll8_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800563 .rate = 384000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700564 .ops = &clk_ops_pll_vote,
565 CLK_INIT(pll8_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800566 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700567 },
568};
569
Stephen Boyd94625ef2011-07-12 17:06:01 -0700570static struct pll_vote_clk pll14_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700571 .en_reg = BB_PLL_ENA_SC0_REG,
572 .en_mask = BIT(14),
573 .status_reg = BB_PLL14_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800574 .status_mask = BIT(16),
Stephen Boyd94625ef2011-07-12 17:06:01 -0700575 .parent = &pxo_clk.c,
576 .c = {
577 .dbg_name = "pll14_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800578 .rate = 480000000,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700579 .ops = &clk_ops_pll_vote,
580 CLK_INIT(pll14_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800581 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700582 },
583};
584
Tianyi Gou41515e22011-09-01 19:37:43 -0700585static struct pll_clk pll15_clk = {
Tianyi Gou41515e22011-09-01 19:37:43 -0700586 .mode_reg = MM_PLL3_MODE_REG,
587 .parent = &pxo_clk.c,
588 .c = {
589 .dbg_name = "pll15_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800590 .rate = 975000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800591 .ops = &clk_ops_local_pll,
Tianyi Gou41515e22011-09-01 19:37:43 -0700592 CLK_INIT(pll15_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800593 .warned = true,
Tianyi Gou41515e22011-09-01 19:37:43 -0700594 },
595};
596
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700597/* AXI Interfaces */
598static struct branch_clk gmem_axi_clk = {
599 .b = {
600 .ctl_reg = MAXI_EN_REG,
601 .en_mask = BIT(24),
602 .halt_reg = DBG_BUS_VEC_E_REG,
603 .halt_bit = 6,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800604 .retain_reg = MAXI_EN2_REG,
605 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 },
607 .c = {
608 .dbg_name = "gmem_axi_clk",
609 .ops = &clk_ops_branch,
610 CLK_INIT(gmem_axi_clk.c),
611 },
612};
613
614static struct branch_clk ijpeg_axi_clk = {
615 .b = {
616 .ctl_reg = MAXI_EN_REG,
617 .en_mask = BIT(21),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800618 .hwcg_reg = MAXI_EN_REG,
619 .hwcg_mask = BIT(11),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620 .reset_reg = SW_RESET_AXI_REG,
621 .reset_mask = BIT(14),
622 .halt_reg = DBG_BUS_VEC_E_REG,
623 .halt_bit = 4,
624 },
625 .c = {
626 .dbg_name = "ijpeg_axi_clk",
627 .ops = &clk_ops_branch,
628 CLK_INIT(ijpeg_axi_clk.c),
629 },
630};
631
632static struct branch_clk imem_axi_clk = {
633 .b = {
634 .ctl_reg = MAXI_EN_REG,
635 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800636 .hwcg_reg = MAXI_EN_REG,
637 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700638 .reset_reg = SW_RESET_CORE_REG,
639 .reset_mask = BIT(10),
640 .halt_reg = DBG_BUS_VEC_E_REG,
641 .halt_bit = 7,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800642 .retain_reg = MAXI_EN2_REG,
643 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700644 },
645 .c = {
646 .dbg_name = "imem_axi_clk",
647 .ops = &clk_ops_branch,
648 CLK_INIT(imem_axi_clk.c),
649 },
650};
651
652static struct branch_clk jpegd_axi_clk = {
653 .b = {
654 .ctl_reg = MAXI_EN_REG,
655 .en_mask = BIT(25),
656 .halt_reg = DBG_BUS_VEC_E_REG,
657 .halt_bit = 5,
658 },
659 .c = {
660 .dbg_name = "jpegd_axi_clk",
661 .ops = &clk_ops_branch,
662 CLK_INIT(jpegd_axi_clk.c),
663 },
664};
665
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700666static struct branch_clk vcodec_axi_b_clk = {
667 .b = {
668 .ctl_reg = MAXI_EN4_REG,
669 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800670 .hwcg_reg = MAXI_EN4_REG,
671 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700672 .halt_reg = DBG_BUS_VEC_I_REG,
673 .halt_bit = 25,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800674 .retain_reg = MAXI_EN4_REG,
675 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700676 },
677 .c = {
678 .dbg_name = "vcodec_axi_b_clk",
679 .ops = &clk_ops_branch,
680 CLK_INIT(vcodec_axi_b_clk.c),
681 },
682};
683
Matt Wagantall91f42702011-07-14 12:01:15 -0700684static struct branch_clk vcodec_axi_a_clk = {
685 .b = {
686 .ctl_reg = MAXI_EN4_REG,
687 .en_mask = BIT(25),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800688 .hwcg_reg = MAXI_EN4_REG,
689 .hwcg_mask = BIT(24),
Matt Wagantall91f42702011-07-14 12:01:15 -0700690 .halt_reg = DBG_BUS_VEC_I_REG,
691 .halt_bit = 26,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800692 .retain_reg = MAXI_EN4_REG,
693 .retain_mask = BIT(10),
Matt Wagantall91f42702011-07-14 12:01:15 -0700694 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700695 .c = {
696 .dbg_name = "vcodec_axi_a_clk",
697 .ops = &clk_ops_branch,
698 CLK_INIT(vcodec_axi_a_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700699 .depends = &vcodec_axi_b_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700700 },
701};
702
703static struct branch_clk vcodec_axi_clk = {
704 .b = {
705 .ctl_reg = MAXI_EN_REG,
706 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800707 .hwcg_reg = MAXI_EN_REG,
708 .hwcg_mask = BIT(13),
Matt Wagantall91f42702011-07-14 12:01:15 -0700709 .reset_reg = SW_RESET_AXI_REG,
Gopikrishnaiah Anandan83b6e852012-01-05 17:47:02 -0800710 .reset_mask = BIT(4)|BIT(5)|BIT(7),
Matt Wagantall91f42702011-07-14 12:01:15 -0700711 .halt_reg = DBG_BUS_VEC_E_REG,
712 .halt_bit = 3,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800713 .retain_reg = MAXI_EN2_REG,
714 .retain_mask = BIT(28),
Matt Wagantall91f42702011-07-14 12:01:15 -0700715 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700716 .c = {
717 .dbg_name = "vcodec_axi_clk",
718 .ops = &clk_ops_branch,
719 CLK_INIT(vcodec_axi_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700720 .depends = &vcodec_axi_a_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700721 },
722};
723
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700724static struct branch_clk vfe_axi_clk = {
725 .b = {
726 .ctl_reg = MAXI_EN_REG,
727 .en_mask = BIT(18),
728 .reset_reg = SW_RESET_AXI_REG,
729 .reset_mask = BIT(9),
730 .halt_reg = DBG_BUS_VEC_E_REG,
731 .halt_bit = 0,
732 },
733 .c = {
734 .dbg_name = "vfe_axi_clk",
735 .ops = &clk_ops_branch,
736 CLK_INIT(vfe_axi_clk.c),
737 },
738};
739
740static struct branch_clk mdp_axi_clk = {
741 .b = {
742 .ctl_reg = MAXI_EN_REG,
743 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800744 .hwcg_reg = MAXI_EN_REG,
745 .hwcg_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700746 .reset_reg = SW_RESET_AXI_REG,
747 .reset_mask = BIT(13),
748 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700749 .halt_bit = 8,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800750 .retain_reg = MAXI_EN_REG,
751 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700752 },
753 .c = {
754 .dbg_name = "mdp_axi_clk",
755 .ops = &clk_ops_branch,
756 CLK_INIT(mdp_axi_clk.c),
757 },
758};
759
760static struct branch_clk rot_axi_clk = {
761 .b = {
762 .ctl_reg = MAXI_EN2_REG,
763 .en_mask = BIT(24),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800764 .hwcg_reg = MAXI_EN2_REG,
765 .hwcg_mask = BIT(25),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700766 .reset_reg = SW_RESET_AXI_REG,
767 .reset_mask = BIT(6),
768 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700769 .halt_bit = 2,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800770 .retain_reg = MAXI_EN3_REG,
771 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700772 },
773 .c = {
774 .dbg_name = "rot_axi_clk",
775 .ops = &clk_ops_branch,
776 CLK_INIT(rot_axi_clk.c),
777 },
778};
779
780static struct branch_clk vpe_axi_clk = {
781 .b = {
782 .ctl_reg = MAXI_EN2_REG,
783 .en_mask = BIT(26),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800784 .hwcg_reg = MAXI_EN2_REG,
785 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700786 .reset_reg = SW_RESET_AXI_REG,
787 .reset_mask = BIT(15),
788 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700789 .halt_bit = 1,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800790 .retain_reg = MAXI_EN3_REG,
791 .retain_mask = BIT(21),
792
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700793 },
794 .c = {
795 .dbg_name = "vpe_axi_clk",
796 .ops = &clk_ops_branch,
797 CLK_INIT(vpe_axi_clk.c),
798 },
799};
800
Tianyi Gou41515e22011-09-01 19:37:43 -0700801static struct branch_clk vcap_axi_clk = {
802 .b = {
803 .ctl_reg = MAXI_EN5_REG,
804 .en_mask = BIT(12),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700805 .hwcg_reg = MAXI_EN5_REG,
806 .hwcg_mask = BIT(11),
Tianyi Gou41515e22011-09-01 19:37:43 -0700807 .reset_reg = SW_RESET_AXI_REG,
808 .reset_mask = BIT(16),
809 .halt_reg = DBG_BUS_VEC_J_REG,
810 .halt_bit = 20,
811 },
812 .c = {
813 .dbg_name = "vcap_axi_clk",
814 .ops = &clk_ops_branch,
815 CLK_INIT(vcap_axi_clk.c),
816 },
817};
818
Tianyi Goue3d4f542012-03-15 17:06:45 -0700819/* gfx3d_axi_clk is set as a dependency of gmem_axi_clk at runtime */
Patrick Dalye6f489042012-07-11 15:29:15 -0700820static struct branch_clk gfx3d_axi_clk = {
Tianyi Gou621f8742011-09-01 21:45:01 -0700821 .b = {
822 .ctl_reg = MAXI_EN5_REG,
823 .en_mask = BIT(25),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700824 .hwcg_reg = MAXI_EN5_REG,
825 .hwcg_mask = BIT(24),
Tianyi Gou621f8742011-09-01 21:45:01 -0700826 .reset_reg = SW_RESET_AXI_REG,
827 .reset_mask = BIT(17),
828 .halt_reg = DBG_BUS_VEC_J_REG,
829 .halt_bit = 30,
830 },
831 .c = {
832 .dbg_name = "gfx3d_axi_clk",
833 .ops = &clk_ops_branch,
Patrick Dalye6f489042012-07-11 15:29:15 -0700834 CLK_INIT(gfx3d_axi_clk.c),
Tianyi Goue3d4f542012-03-15 17:06:45 -0700835 },
836};
837
838static struct branch_clk gfx3d_axi_clk_8930 = {
839 .b = {
840 .ctl_reg = MAXI_EN5_REG,
841 .en_mask = BIT(12),
842 .reset_reg = SW_RESET_AXI_REG,
843 .reset_mask = BIT(16),
844 .halt_reg = DBG_BUS_VEC_J_REG,
845 .halt_bit = 12,
846 },
847 .c = {
848 .dbg_name = "gfx3d_axi_clk",
849 .ops = &clk_ops_branch,
850 CLK_INIT(gfx3d_axi_clk_8930.c),
Tianyi Gou621f8742011-09-01 21:45:01 -0700851 },
852};
853
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700854/* AHB Interfaces */
855static struct branch_clk amp_p_clk = {
856 .b = {
857 .ctl_reg = AHB_EN_REG,
858 .en_mask = BIT(24),
Matt Wagantalld40857a2012-04-10 19:15:43 -0700859 .reset_reg = SW_RESET_CORE_REG,
860 .reset_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700861 .halt_reg = DBG_BUS_VEC_F_REG,
862 .halt_bit = 18,
863 },
864 .c = {
865 .dbg_name = "amp_p_clk",
866 .ops = &clk_ops_branch,
867 CLK_INIT(amp_p_clk.c),
868 },
869};
870
Matt Wagantallc23eee92011-08-16 23:06:52 -0700871static struct branch_clk csi_p_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700872 .b = {
873 .ctl_reg = AHB_EN_REG,
874 .en_mask = BIT(7),
875 .reset_reg = SW_RESET_AHB_REG,
876 .reset_mask = BIT(17),
877 .halt_reg = DBG_BUS_VEC_F_REG,
878 .halt_bit = 16,
879 },
880 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -0700881 .dbg_name = "csi_p_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700882 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -0700883 CLK_INIT(csi_p_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700884 },
885};
886
887static struct branch_clk dsi1_m_p_clk = {
888 .b = {
889 .ctl_reg = AHB_EN_REG,
890 .en_mask = BIT(9),
891 .reset_reg = SW_RESET_AHB_REG,
892 .reset_mask = BIT(6),
893 .halt_reg = DBG_BUS_VEC_F_REG,
894 .halt_bit = 19,
895 },
896 .c = {
897 .dbg_name = "dsi1_m_p_clk",
898 .ops = &clk_ops_branch,
899 CLK_INIT(dsi1_m_p_clk.c),
900 },
901};
902
903static struct branch_clk dsi1_s_p_clk = {
904 .b = {
905 .ctl_reg = AHB_EN_REG,
906 .en_mask = BIT(18),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800907 .hwcg_reg = AHB_EN2_REG,
908 .hwcg_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909 .reset_reg = SW_RESET_AHB_REG,
910 .reset_mask = BIT(5),
911 .halt_reg = DBG_BUS_VEC_F_REG,
912 .halt_bit = 21,
913 },
914 .c = {
915 .dbg_name = "dsi1_s_p_clk",
916 .ops = &clk_ops_branch,
917 CLK_INIT(dsi1_s_p_clk.c),
918 },
919};
920
921static struct branch_clk dsi2_m_p_clk = {
922 .b = {
923 .ctl_reg = AHB_EN_REG,
924 .en_mask = BIT(17),
925 .reset_reg = SW_RESET_AHB2_REG,
926 .reset_mask = BIT(1),
927 .halt_reg = DBG_BUS_VEC_E_REG,
928 .halt_bit = 18,
929 },
930 .c = {
931 .dbg_name = "dsi2_m_p_clk",
932 .ops = &clk_ops_branch,
933 CLK_INIT(dsi2_m_p_clk.c),
934 },
935};
936
937static struct branch_clk dsi2_s_p_clk = {
938 .b = {
939 .ctl_reg = AHB_EN_REG,
940 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800941 .hwcg_reg = AHB_EN2_REG,
942 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700943 .reset_reg = SW_RESET_AHB2_REG,
944 .reset_mask = BIT(0),
945 .halt_reg = DBG_BUS_VEC_F_REG,
946 .halt_bit = 20,
947 },
948 .c = {
949 .dbg_name = "dsi2_s_p_clk",
950 .ops = &clk_ops_branch,
951 CLK_INIT(dsi2_s_p_clk.c),
952 },
953};
954
955static struct branch_clk gfx2d0_p_clk = {
956 .b = {
957 .ctl_reg = AHB_EN_REG,
958 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800959 .hwcg_reg = AHB_EN2_REG,
960 .hwcg_mask = BIT(28),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700961 .reset_reg = SW_RESET_AHB_REG,
962 .reset_mask = BIT(12),
963 .halt_reg = DBG_BUS_VEC_F_REG,
964 .halt_bit = 2,
965 },
966 .c = {
967 .dbg_name = "gfx2d0_p_clk",
968 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700969 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700970 CLK_INIT(gfx2d0_p_clk.c),
971 },
972};
973
974static struct branch_clk gfx2d1_p_clk = {
975 .b = {
976 .ctl_reg = AHB_EN_REG,
977 .en_mask = BIT(2),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800978 .hwcg_reg = AHB_EN2_REG,
979 .hwcg_mask = BIT(29),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700980 .reset_reg = SW_RESET_AHB_REG,
981 .reset_mask = BIT(11),
982 .halt_reg = DBG_BUS_VEC_F_REG,
983 .halt_bit = 3,
984 },
985 .c = {
986 .dbg_name = "gfx2d1_p_clk",
987 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700988 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700989 CLK_INIT(gfx2d1_p_clk.c),
990 },
991};
992
993static struct branch_clk gfx3d_p_clk = {
994 .b = {
995 .ctl_reg = AHB_EN_REG,
996 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800997 .hwcg_reg = AHB_EN2_REG,
998 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999 .reset_reg = SW_RESET_AHB_REG,
1000 .reset_mask = BIT(10),
1001 .halt_reg = DBG_BUS_VEC_F_REG,
1002 .halt_bit = 4,
1003 },
1004 .c = {
1005 .dbg_name = "gfx3d_p_clk",
1006 .ops = &clk_ops_branch,
1007 CLK_INIT(gfx3d_p_clk.c),
1008 },
1009};
1010
1011static struct branch_clk hdmi_m_p_clk = {
1012 .b = {
1013 .ctl_reg = AHB_EN_REG,
1014 .en_mask = BIT(14),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001015 .hwcg_reg = AHB_EN2_REG,
1016 .hwcg_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001017 .reset_reg = SW_RESET_AHB_REG,
1018 .reset_mask = BIT(9),
1019 .halt_reg = DBG_BUS_VEC_F_REG,
1020 .halt_bit = 5,
1021 },
1022 .c = {
1023 .dbg_name = "hdmi_m_p_clk",
1024 .ops = &clk_ops_branch,
1025 CLK_INIT(hdmi_m_p_clk.c),
1026 },
1027};
1028
1029static struct branch_clk hdmi_s_p_clk = {
1030 .b = {
1031 .ctl_reg = AHB_EN_REG,
1032 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001033 .hwcg_reg = AHB_EN2_REG,
1034 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001035 .reset_reg = SW_RESET_AHB_REG,
1036 .reset_mask = BIT(9),
1037 .halt_reg = DBG_BUS_VEC_F_REG,
1038 .halt_bit = 6,
1039 },
1040 .c = {
1041 .dbg_name = "hdmi_s_p_clk",
1042 .ops = &clk_ops_branch,
1043 CLK_INIT(hdmi_s_p_clk.c),
1044 },
1045};
1046
1047static struct branch_clk ijpeg_p_clk = {
1048 .b = {
1049 .ctl_reg = AHB_EN_REG,
1050 .en_mask = BIT(5),
1051 .reset_reg = SW_RESET_AHB_REG,
1052 .reset_mask = BIT(7),
1053 .halt_reg = DBG_BUS_VEC_F_REG,
1054 .halt_bit = 9,
1055 },
1056 .c = {
1057 .dbg_name = "ijpeg_p_clk",
1058 .ops = &clk_ops_branch,
1059 CLK_INIT(ijpeg_p_clk.c),
1060 },
1061};
1062
1063static struct branch_clk imem_p_clk = {
1064 .b = {
1065 .ctl_reg = AHB_EN_REG,
1066 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001067 .hwcg_reg = AHB_EN2_REG,
1068 .hwcg_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001069 .reset_reg = SW_RESET_AHB_REG,
1070 .reset_mask = BIT(8),
1071 .halt_reg = DBG_BUS_VEC_F_REG,
1072 .halt_bit = 10,
1073 },
1074 .c = {
1075 .dbg_name = "imem_p_clk",
1076 .ops = &clk_ops_branch,
1077 CLK_INIT(imem_p_clk.c),
1078 },
1079};
1080
1081static struct branch_clk jpegd_p_clk = {
1082 .b = {
1083 .ctl_reg = AHB_EN_REG,
1084 .en_mask = BIT(21),
1085 .reset_reg = SW_RESET_AHB_REG,
1086 .reset_mask = BIT(4),
1087 .halt_reg = DBG_BUS_VEC_F_REG,
1088 .halt_bit = 7,
1089 },
1090 .c = {
1091 .dbg_name = "jpegd_p_clk",
1092 .ops = &clk_ops_branch,
1093 CLK_INIT(jpegd_p_clk.c),
1094 },
1095};
1096
1097static struct branch_clk mdp_p_clk = {
1098 .b = {
1099 .ctl_reg = AHB_EN_REG,
1100 .en_mask = BIT(10),
1101 .reset_reg = SW_RESET_AHB_REG,
1102 .reset_mask = BIT(3),
1103 .halt_reg = DBG_BUS_VEC_F_REG,
1104 .halt_bit = 11,
1105 },
1106 .c = {
1107 .dbg_name = "mdp_p_clk",
1108 .ops = &clk_ops_branch,
1109 CLK_INIT(mdp_p_clk.c),
1110 },
1111};
1112
1113static struct branch_clk rot_p_clk = {
1114 .b = {
1115 .ctl_reg = AHB_EN_REG,
1116 .en_mask = BIT(12),
1117 .reset_reg = SW_RESET_AHB_REG,
1118 .reset_mask = BIT(2),
1119 .halt_reg = DBG_BUS_VEC_F_REG,
1120 .halt_bit = 13,
1121 },
1122 .c = {
1123 .dbg_name = "rot_p_clk",
1124 .ops = &clk_ops_branch,
1125 CLK_INIT(rot_p_clk.c),
1126 },
1127};
1128
1129static struct branch_clk smmu_p_clk = {
1130 .b = {
1131 .ctl_reg = AHB_EN_REG,
1132 .en_mask = BIT(15),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001133 .hwcg_reg = AHB_EN_REG,
1134 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001135 .halt_reg = DBG_BUS_VEC_F_REG,
1136 .halt_bit = 22,
1137 },
1138 .c = {
1139 .dbg_name = "smmu_p_clk",
1140 .ops = &clk_ops_branch,
1141 CLK_INIT(smmu_p_clk.c),
1142 },
1143};
1144
1145static struct branch_clk tv_enc_p_clk = {
1146 .b = {
1147 .ctl_reg = AHB_EN_REG,
1148 .en_mask = BIT(25),
1149 .reset_reg = SW_RESET_AHB_REG,
1150 .reset_mask = BIT(15),
1151 .halt_reg = DBG_BUS_VEC_F_REG,
1152 .halt_bit = 23,
1153 },
1154 .c = {
1155 .dbg_name = "tv_enc_p_clk",
1156 .ops = &clk_ops_branch,
1157 CLK_INIT(tv_enc_p_clk.c),
1158 },
1159};
1160
1161static struct branch_clk vcodec_p_clk = {
1162 .b = {
1163 .ctl_reg = AHB_EN_REG,
1164 .en_mask = BIT(11),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001165 .hwcg_reg = AHB_EN2_REG,
1166 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001167 .reset_reg = SW_RESET_AHB_REG,
1168 .reset_mask = BIT(1),
1169 .halt_reg = DBG_BUS_VEC_F_REG,
1170 .halt_bit = 12,
1171 },
1172 .c = {
1173 .dbg_name = "vcodec_p_clk",
1174 .ops = &clk_ops_branch,
1175 CLK_INIT(vcodec_p_clk.c),
1176 },
1177};
1178
1179static struct branch_clk vfe_p_clk = {
1180 .b = {
1181 .ctl_reg = AHB_EN_REG,
1182 .en_mask = BIT(13),
1183 .reset_reg = SW_RESET_AHB_REG,
1184 .reset_mask = BIT(0),
1185 .halt_reg = DBG_BUS_VEC_F_REG,
1186 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08001187 .retain_reg = AHB_EN2_REG,
1188 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001189 },
1190 .c = {
1191 .dbg_name = "vfe_p_clk",
1192 .ops = &clk_ops_branch,
1193 CLK_INIT(vfe_p_clk.c),
1194 },
1195};
1196
1197static struct branch_clk vpe_p_clk = {
1198 .b = {
1199 .ctl_reg = AHB_EN_REG,
1200 .en_mask = BIT(16),
1201 .reset_reg = SW_RESET_AHB_REG,
1202 .reset_mask = BIT(14),
1203 .halt_reg = DBG_BUS_VEC_F_REG,
1204 .halt_bit = 15,
1205 },
1206 .c = {
1207 .dbg_name = "vpe_p_clk",
1208 .ops = &clk_ops_branch,
1209 CLK_INIT(vpe_p_clk.c),
1210 },
1211};
1212
Tianyi Gou41515e22011-09-01 19:37:43 -07001213static struct branch_clk vcap_p_clk = {
1214 .b = {
1215 .ctl_reg = AHB_EN3_REG,
1216 .en_mask = BIT(1),
Tianyi Gouf3095ea2012-05-22 14:16:06 -07001217 .hwcg_reg = AHB_EN3_REG,
1218 .hwcg_mask = BIT(0),
Tianyi Gou41515e22011-09-01 19:37:43 -07001219 .reset_reg = SW_RESET_AHB2_REG,
1220 .reset_mask = BIT(2),
1221 .halt_reg = DBG_BUS_VEC_J_REG,
1222 .halt_bit = 23,
1223 },
1224 .c = {
1225 .dbg_name = "vcap_p_clk",
1226 .ops = &clk_ops_branch,
1227 CLK_INIT(vcap_p_clk.c),
1228 },
1229};
1230
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001231/*
1232 * Peripheral Clocks
1233 */
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001234#define CLK_GP(i, n, h_r, h_b) \
1235 struct rcg_clk i##_clk = { \
1236 .b = { \
1237 .ctl_reg = GPn_NS_REG(n), \
1238 .en_mask = BIT(9), \
1239 .halt_reg = h_r, \
1240 .halt_bit = h_b, \
1241 }, \
1242 .ns_reg = GPn_NS_REG(n), \
1243 .md_reg = GPn_MD_REG(n), \
1244 .root_en_mask = BIT(11), \
1245 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001246 .mnd_en_mask = BIT(8), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001247 .set_rate = set_rate_mnd, \
1248 .freq_tbl = clk_tbl_gp, \
1249 .current_freq = &rcg_dummy_freq, \
1250 .c = { \
1251 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001252 .ops = &clk_ops_rcg, \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001253 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), \
1254 CLK_INIT(i##_clk.c), \
1255 }, \
1256 }
1257#define F_GP(f, s, d, m, n) \
1258 { \
1259 .freq_hz = f, \
1260 .src_clk = &s##_clk.c, \
1261 .md_val = MD8(16, m, 0, n), \
1262 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001263 }
1264static struct clk_freq_tbl clk_tbl_gp[] = {
1265 F_GP( 0, gnd, 1, 0, 0),
1266 F_GP( 9600000, cxo, 2, 0, 0),
1267 F_GP( 13500000, pxo, 2, 0, 0),
1268 F_GP( 19200000, cxo, 1, 0, 0),
1269 F_GP( 27000000, pxo, 1, 0, 0),
1270 F_GP( 64000000, pll8, 2, 1, 3),
1271 F_GP( 76800000, pll8, 1, 1, 5),
1272 F_GP( 96000000, pll8, 4, 0, 0),
1273 F_GP(128000000, pll8, 3, 0, 0),
1274 F_GP(192000000, pll8, 2, 0, 0),
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001275 F_END
1276};
1277
1278static CLK_GP(gp0, 0, CLK_HALT_SFPB_MISC_STATE_REG, 7);
1279static CLK_GP(gp1, 1, CLK_HALT_SFPB_MISC_STATE_REG, 6);
1280static CLK_GP(gp2, 2, CLK_HALT_SFPB_MISC_STATE_REG, 5);
1281
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001282#define CLK_GSBI_UART(i, n, h_r, h_b) \
1283 struct rcg_clk i##_clk = { \
1284 .b = { \
1285 .ctl_reg = GSBIn_UART_APPS_NS_REG(n), \
1286 .en_mask = BIT(9), \
1287 .reset_reg = GSBIn_RESET_REG(n), \
1288 .reset_mask = BIT(0), \
1289 .halt_reg = h_r, \
1290 .halt_bit = h_b, \
1291 }, \
1292 .ns_reg = GSBIn_UART_APPS_NS_REG(n), \
1293 .md_reg = GSBIn_UART_APPS_MD_REG(n), \
1294 .root_en_mask = BIT(11), \
1295 .ns_mask = (BM(31, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001296 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001297 .set_rate = set_rate_mnd, \
1298 .freq_tbl = clk_tbl_gsbi_uart, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001299 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300 .c = { \
1301 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001302 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001303 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001304 CLK_INIT(i##_clk.c), \
1305 }, \
1306 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001307#define F_GSBI_UART(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001308 { \
1309 .freq_hz = f, \
1310 .src_clk = &s##_clk.c, \
1311 .md_val = MD16(m, n), \
1312 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001313 }
1314static struct clk_freq_tbl clk_tbl_gsbi_uart[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001315 F_GSBI_UART( 0, gnd, 1, 0, 0),
Matt Wagantall9a561f72012-01-19 16:13:12 -08001316 F_GSBI_UART( 1843200, pll8, 2, 6, 625),
1317 F_GSBI_UART( 3686400, pll8, 2, 12, 625),
1318 F_GSBI_UART( 7372800, pll8, 2, 24, 625),
1319 F_GSBI_UART(14745600, pll8, 2, 48, 625),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001320 F_GSBI_UART(16000000, pll8, 4, 1, 6),
1321 F_GSBI_UART(24000000, pll8, 4, 1, 4),
1322 F_GSBI_UART(32000000, pll8, 4, 1, 3),
1323 F_GSBI_UART(40000000, pll8, 1, 5, 48),
1324 F_GSBI_UART(46400000, pll8, 1, 29, 240),
1325 F_GSBI_UART(48000000, pll8, 4, 1, 2),
1326 F_GSBI_UART(51200000, pll8, 1, 2, 15),
1327 F_GSBI_UART(56000000, pll8, 1, 7, 48),
1328 F_GSBI_UART(58982400, pll8, 1, 96, 625),
1329 F_GSBI_UART(64000000, pll8, 2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001330 F_END
1331};
1332
1333static CLK_GSBI_UART(gsbi1_uart, 1, CLK_HALT_CFPB_STATEA_REG, 10);
1334static CLK_GSBI_UART(gsbi2_uart, 2, CLK_HALT_CFPB_STATEA_REG, 6);
1335static CLK_GSBI_UART(gsbi3_uart, 3, CLK_HALT_CFPB_STATEA_REG, 2);
1336static CLK_GSBI_UART(gsbi4_uart, 4, CLK_HALT_CFPB_STATEB_REG, 26);
1337static CLK_GSBI_UART(gsbi5_uart, 5, CLK_HALT_CFPB_STATEB_REG, 22);
1338static CLK_GSBI_UART(gsbi6_uart, 6, CLK_HALT_CFPB_STATEB_REG, 18);
1339static CLK_GSBI_UART(gsbi7_uart, 7, CLK_HALT_CFPB_STATEB_REG, 14);
1340static CLK_GSBI_UART(gsbi8_uart, 8, CLK_HALT_CFPB_STATEB_REG, 10);
1341static CLK_GSBI_UART(gsbi9_uart, 9, CLK_HALT_CFPB_STATEB_REG, 6);
1342static CLK_GSBI_UART(gsbi10_uart, 10, CLK_HALT_CFPB_STATEB_REG, 2);
1343static CLK_GSBI_UART(gsbi11_uart, 11, CLK_HALT_CFPB_STATEC_REG, 17);
1344static CLK_GSBI_UART(gsbi12_uart, 12, CLK_HALT_CFPB_STATEC_REG, 13);
1345
1346#define CLK_GSBI_QUP(i, n, h_r, h_b) \
1347 struct rcg_clk i##_clk = { \
1348 .b = { \
1349 .ctl_reg = GSBIn_QUP_APPS_NS_REG(n), \
1350 .en_mask = BIT(9), \
1351 .reset_reg = GSBIn_RESET_REG(n), \
1352 .reset_mask = BIT(0), \
1353 .halt_reg = h_r, \
1354 .halt_bit = h_b, \
1355 }, \
1356 .ns_reg = GSBIn_QUP_APPS_NS_REG(n), \
1357 .md_reg = GSBIn_QUP_APPS_MD_REG(n), \
1358 .root_en_mask = BIT(11), \
1359 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001360 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361 .set_rate = set_rate_mnd, \
1362 .freq_tbl = clk_tbl_gsbi_qup, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001363 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364 .c = { \
1365 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001366 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001367 VDD_DIG_FMAX_MAP2(LOW, 24000000, NOMINAL, 52000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001368 CLK_INIT(i##_clk.c), \
1369 }, \
1370 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001371#define F_GSBI_QUP(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001372 { \
1373 .freq_hz = f, \
1374 .src_clk = &s##_clk.c, \
1375 .md_val = MD8(16, m, 0, n), \
1376 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001377 }
1378static struct clk_freq_tbl clk_tbl_gsbi_qup[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001379 F_GSBI_QUP( 0, gnd, 1, 0, 0),
1380 F_GSBI_QUP( 1100000, pxo, 1, 2, 49),
1381 F_GSBI_QUP( 5400000, pxo, 1, 1, 5),
1382 F_GSBI_QUP(10800000, pxo, 1, 2, 5),
1383 F_GSBI_QUP(15060000, pll8, 1, 2, 51),
1384 F_GSBI_QUP(24000000, pll8, 4, 1, 4),
1385 F_GSBI_QUP(25600000, pll8, 1, 1, 15),
1386 F_GSBI_QUP(27000000, pxo, 1, 0, 0),
1387 F_GSBI_QUP(48000000, pll8, 4, 1, 2),
1388 F_GSBI_QUP(51200000, pll8, 1, 2, 15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001389 F_END
1390};
1391
1392static CLK_GSBI_QUP(gsbi1_qup, 1, CLK_HALT_CFPB_STATEA_REG, 9);
1393static CLK_GSBI_QUP(gsbi2_qup, 2, CLK_HALT_CFPB_STATEA_REG, 4);
1394static CLK_GSBI_QUP(gsbi3_qup, 3, CLK_HALT_CFPB_STATEA_REG, 0);
1395static CLK_GSBI_QUP(gsbi4_qup, 4, CLK_HALT_CFPB_STATEB_REG, 24);
1396static CLK_GSBI_QUP(gsbi5_qup, 5, CLK_HALT_CFPB_STATEB_REG, 20);
1397static CLK_GSBI_QUP(gsbi6_qup, 6, CLK_HALT_CFPB_STATEB_REG, 16);
1398static CLK_GSBI_QUP(gsbi7_qup, 7, CLK_HALT_CFPB_STATEB_REG, 12);
1399static CLK_GSBI_QUP(gsbi8_qup, 8, CLK_HALT_CFPB_STATEB_REG, 8);
1400static CLK_GSBI_QUP(gsbi9_qup, 9, CLK_HALT_CFPB_STATEB_REG, 4);
1401static CLK_GSBI_QUP(gsbi10_qup, 10, CLK_HALT_CFPB_STATEB_REG, 0);
1402static CLK_GSBI_QUP(gsbi11_qup, 11, CLK_HALT_CFPB_STATEC_REG, 15);
1403static CLK_GSBI_QUP(gsbi12_qup, 12, CLK_HALT_CFPB_STATEC_REG, 11);
1404
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001405#define F_PDM(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001406 { \
1407 .freq_hz = f, \
1408 .src_clk = &s##_clk.c, \
1409 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001410 }
1411static struct clk_freq_tbl clk_tbl_pdm[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001412 F_PDM( 0, gnd, 1),
1413 F_PDM(27000000, pxo, 1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001414 F_END
1415};
1416
1417static struct rcg_clk pdm_clk = {
1418 .b = {
1419 .ctl_reg = PDM_CLK_NS_REG,
1420 .en_mask = BIT(9),
1421 .reset_reg = PDM_CLK_NS_REG,
1422 .reset_mask = BIT(12),
1423 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1424 .halt_bit = 3,
1425 },
1426 .ns_reg = PDM_CLK_NS_REG,
1427 .root_en_mask = BIT(11),
1428 .ns_mask = BM(1, 0),
1429 .set_rate = set_rate_nop,
1430 .freq_tbl = clk_tbl_pdm,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001431 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001432 .c = {
1433 .dbg_name = "pdm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001434 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001435 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001436 CLK_INIT(pdm_clk.c),
1437 },
1438};
1439
1440static struct branch_clk pmem_clk = {
1441 .b = {
1442 .ctl_reg = PMEM_ACLK_CTL_REG,
1443 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001444 .hwcg_reg = PMEM_ACLK_CTL_REG,
1445 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001446 .halt_reg = CLK_HALT_DFAB_STATE_REG,
1447 .halt_bit = 20,
1448 },
1449 .c = {
1450 .dbg_name = "pmem_clk",
1451 .ops = &clk_ops_branch,
1452 CLK_INIT(pmem_clk.c),
1453 },
1454};
1455
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001456#define F_PRNG(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001457 { \
1458 .freq_hz = f, \
1459 .src_clk = &s##_clk.c, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001460 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07001461static struct clk_freq_tbl clk_tbl_prng_32[] = {
1462 F_PRNG(32000000, pll8),
1463 F_END
1464};
1465
1466static struct clk_freq_tbl clk_tbl_prng_64[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001467 F_PRNG(64000000, pll8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001468 F_END
1469};
1470
1471static struct rcg_clk prng_clk = {
1472 .b = {
1473 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
1474 .en_mask = BIT(10),
1475 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
1476 .halt_check = HALT_VOTED,
1477 .halt_bit = 10,
1478 },
1479 .set_rate = set_rate_nop,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001480 .freq_tbl = clk_tbl_prng_32,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001481 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001482 .c = {
1483 .dbg_name = "prng_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001484 .ops = &clk_ops_rcg,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001485 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001486 CLK_INIT(prng_clk.c),
1487 },
1488};
1489
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001490#define CLK_SDC(name, n, h_b, fmax_low, fmax_nom) \
Stephen Boyda78a7402011-08-02 11:23:39 -07001491 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001492 .b = { \
1493 .ctl_reg = SDCn_APPS_CLK_NS_REG(n), \
1494 .en_mask = BIT(9), \
1495 .reset_reg = SDCn_RESET_REG(n), \
1496 .reset_mask = BIT(0), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001497 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001498 .halt_bit = h_b, \
1499 }, \
1500 .ns_reg = SDCn_APPS_CLK_NS_REG(n), \
1501 .md_reg = SDCn_APPS_CLK_MD_REG(n), \
1502 .root_en_mask = BIT(11), \
1503 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001504 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001505 .set_rate = set_rate_mnd, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001506 .freq_tbl = clk_tbl_sdc, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001507 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001508 .c = { \
Stephen Boyda78a7402011-08-02 11:23:39 -07001509 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001510 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001511 VDD_DIG_FMAX_MAP2(LOW, fmax_low, NOMINAL, fmax_nom), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001512 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001513 }, \
1514 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001515#define F_SDC(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001516 { \
1517 .freq_hz = f, \
1518 .src_clk = &s##_clk.c, \
1519 .md_val = MD8(16, m, 0, n), \
1520 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001521 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001522static struct clk_freq_tbl clk_tbl_sdc[] = {
1523 F_SDC( 0, gnd, 1, 0, 0),
1524 F_SDC( 144000, pxo, 3, 2, 125),
1525 F_SDC( 400000, pll8, 4, 1, 240),
1526 F_SDC( 16000000, pll8, 4, 1, 6),
1527 F_SDC( 17070000, pll8, 1, 2, 45),
1528 F_SDC( 20210000, pll8, 1, 1, 19),
1529 F_SDC( 24000000, pll8, 4, 1, 4),
1530 F_SDC( 48000000, pll8, 4, 1, 2),
1531 F_SDC( 64000000, pll8, 3, 1, 2),
1532 F_SDC( 96000000, pll8, 4, 0, 0),
Subhash Jadavanibd238ba2011-11-24 15:12:39 +05301533 F_SDC(192000000, pll8, 2, 0, 0),
Stephen Boyda78a7402011-08-02 11:23:39 -07001534 F_END
1535};
1536
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001537static CLK_SDC(sdc1_clk, 1, 6, 52000000, 104000000);
1538static CLK_SDC(sdc2_clk, 2, 5, 52000000, 104000000);
1539static CLK_SDC(sdc3_clk, 3, 4, 104000000, 208000000);
1540static CLK_SDC(sdc4_clk, 4, 3, 33000000, 67000000);
1541static CLK_SDC(sdc5_clk, 5, 2, 33000000, 67000000);
Stephen Boyda78a7402011-08-02 11:23:39 -07001542
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001543#define F_TSIF_REF(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001544 { \
1545 .freq_hz = f, \
1546 .src_clk = &s##_clk.c, \
1547 .md_val = MD16(m, n), \
1548 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001549 }
1550static struct clk_freq_tbl clk_tbl_tsif_ref[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001551 F_TSIF_REF( 0, gnd, 1, 0, 0),
1552 F_TSIF_REF(105000, pxo, 1, 1, 256),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001553 F_END
1554};
1555
1556static struct rcg_clk tsif_ref_clk = {
1557 .b = {
1558 .ctl_reg = TSIF_REF_CLK_NS_REG,
1559 .en_mask = BIT(9),
1560 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1561 .halt_bit = 5,
1562 },
1563 .ns_reg = TSIF_REF_CLK_NS_REG,
1564 .md_reg = TSIF_REF_CLK_MD_REG,
1565 .root_en_mask = BIT(11),
1566 .ns_mask = (BM(31, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001567 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001568 .set_rate = set_rate_mnd,
1569 .freq_tbl = clk_tbl_tsif_ref,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001570 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001571 .c = {
1572 .dbg_name = "tsif_ref_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001573 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001574 VDD_DIG_FMAX_MAP2(LOW, 27000000, NOMINAL, 54000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001575 CLK_INIT(tsif_ref_clk.c),
1576 },
1577};
1578
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001579#define F_TSSC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001580 { \
1581 .freq_hz = f, \
1582 .src_clk = &s##_clk.c, \
1583 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001584 }
1585static struct clk_freq_tbl clk_tbl_tssc[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001586 F_TSSC( 0, gnd),
1587 F_TSSC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001588 F_END
1589};
1590
1591static struct rcg_clk tssc_clk = {
1592 .b = {
1593 .ctl_reg = TSSC_CLK_CTL_REG,
1594 .en_mask = BIT(4),
1595 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1596 .halt_bit = 4,
1597 },
1598 .ns_reg = TSSC_CLK_CTL_REG,
1599 .ns_mask = BM(1, 0),
1600 .set_rate = set_rate_nop,
1601 .freq_tbl = clk_tbl_tssc,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001602 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001603 .c = {
1604 .dbg_name = "tssc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001605 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001606 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001607 CLK_INIT(tssc_clk.c),
1608 },
1609};
1610
Tianyi Gou41515e22011-09-01 19:37:43 -07001611#define CLK_USB_HS(name, n, h_b) \
1612 static struct rcg_clk name = { \
1613 .b = { \
1614 .ctl_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1615 .en_mask = BIT(9), \
1616 .reset_reg = USB_HS##n##_RESET_REG, \
1617 .reset_mask = BIT(0), \
1618 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
1619 .halt_bit = h_b, \
1620 }, \
1621 .ns_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1622 .md_reg = USB_HS##n##_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), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001626 .set_rate = set_rate_mnd, \
1627 .freq_tbl = clk_tbl_usb, \
1628 .current_freq = &rcg_dummy_freq, \
1629 .c = { \
1630 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001631 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001632 VDD_DIG_FMAX_MAP1(NOMINAL, 64000000), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001633 CLK_INIT(name.c), \
1634 }, \
1635}
1636
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001637#define F_USB(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001638 { \
1639 .freq_hz = f, \
1640 .src_clk = &s##_clk.c, \
1641 .md_val = MD8(16, m, 0, n), \
1642 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001643 }
1644static struct clk_freq_tbl clk_tbl_usb[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001645 F_USB( 0, gnd, 1, 0, 0),
1646 F_USB(60000000, pll8, 1, 5, 32),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001647 F_END
1648};
1649
Tianyi Gou41515e22011-09-01 19:37:43 -07001650CLK_USB_HS(usb_hs1_xcvr_clk, 1, 0);
1651CLK_USB_HS(usb_hs3_xcvr_clk, 3, 30);
1652CLK_USB_HS(usb_hs4_xcvr_clk, 4, 2);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001653
Stephen Boyd94625ef2011-07-12 17:06:01 -07001654static struct clk_freq_tbl clk_tbl_usb_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001655 F_USB( 0, gnd, 1, 0, 0),
1656 F_USB(60000000, pll8, 1, 5, 32),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001657 F_END
1658};
1659
1660static struct rcg_clk usb_hsic_xcvr_fs_clk = {
1661 .b = {
1662 .ctl_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1663 .en_mask = BIT(9),
1664 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1665 .halt_bit = 26,
1666 },
1667 .ns_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1668 .md_reg = USB_HSIC_XCVR_FS_CLK_MD_REG,
1669 .root_en_mask = BIT(11),
1670 .ns_mask = (BM(23, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001671 .mnd_en_mask = BIT(8),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001672 .set_rate = set_rate_mnd,
1673 .freq_tbl = clk_tbl_usb_hsic,
1674 .current_freq = &rcg_dummy_freq,
1675 .c = {
1676 .dbg_name = "usb_hsic_xcvr_fs_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001677 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001678 VDD_DIG_FMAX_MAP1(LOW, 60000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001679 CLK_INIT(usb_hsic_xcvr_fs_clk.c),
1680 },
1681};
1682
1683static struct branch_clk usb_hsic_system_clk = {
1684 .b = {
1685 .ctl_reg = USB_HSIC_SYSTEM_CLK_CTL_REG,
1686 .en_mask = BIT(4),
1687 .reset_reg = USB_HSIC_RESET_REG,
1688 .reset_mask = BIT(0),
1689 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1690 .halt_bit = 24,
1691 },
1692 .parent = &usb_hsic_xcvr_fs_clk.c,
1693 .c = {
1694 .dbg_name = "usb_hsic_system_clk",
1695 .ops = &clk_ops_branch,
1696 CLK_INIT(usb_hsic_system_clk.c),
1697 },
1698};
1699
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001700#define F_USB_HSIC(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001701 { \
1702 .freq_hz = f, \
1703 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001704 }
1705static struct clk_freq_tbl clk_tbl_usb2_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001706 F_USB_HSIC(480000000, pll14),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001707 F_END
1708};
1709
1710static struct rcg_clk usb_hsic_hsic_src_clk = {
1711 .b = {
1712 .ctl_reg = USB_HSIC_HSIC_CLK_SRC_CTL_REG,
1713 .halt_check = NOCHECK,
1714 },
1715 .root_en_mask = BIT(0),
1716 .set_rate = set_rate_nop,
1717 .freq_tbl = clk_tbl_usb2_hsic,
1718 .current_freq = &rcg_dummy_freq,
1719 .c = {
1720 .dbg_name = "usb_hsic_hsic_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001721 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001722 VDD_DIG_FMAX_MAP1(LOW, 480000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001723 CLK_INIT(usb_hsic_hsic_src_clk.c),
1724 },
1725};
1726
1727static struct branch_clk usb_hsic_hsic_clk = {
1728 .b = {
1729 .ctl_reg = USB_HSIC_HSIC_CLK_CTL_REG,
1730 .en_mask = BIT(0),
1731 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1732 .halt_bit = 19,
1733 },
1734 .parent = &usb_hsic_hsic_src_clk.c,
1735 .c = {
1736 .dbg_name = "usb_hsic_hsic_clk",
1737 .ops = &clk_ops_branch,
1738 CLK_INIT(usb_hsic_hsic_clk.c),
1739 },
1740};
1741
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001742#define F_USB_HSIO_CAL(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001743 { \
1744 .freq_hz = f, \
1745 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001746 }
1747static struct clk_freq_tbl clk_tbl_usb_hsio_cal[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001748 F_USB_HSIO_CAL(9000000, pxo),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001749 F_END
1750};
1751
1752static struct rcg_clk usb_hsic_hsio_cal_clk = {
1753 .b = {
1754 .ctl_reg = USB_HSIC_HSIO_CAL_CLK_CTL_REG,
1755 .en_mask = BIT(0),
1756 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1757 .halt_bit = 23,
1758 },
1759 .set_rate = set_rate_nop,
1760 .freq_tbl = clk_tbl_usb_hsio_cal,
1761 .current_freq = &rcg_dummy_freq,
1762 .c = {
1763 .dbg_name = "usb_hsic_hsio_cal_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001764 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001765 VDD_DIG_FMAX_MAP1(LOW, 10000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001766 CLK_INIT(usb_hsic_hsio_cal_clk.c),
1767 },
1768};
1769
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001770static struct branch_clk usb_phy0_clk = {
1771 .b = {
1772 .reset_reg = USB_PHY0_RESET_REG,
1773 .reset_mask = BIT(0),
1774 },
1775 .c = {
1776 .dbg_name = "usb_phy0_clk",
1777 .ops = &clk_ops_reset,
1778 CLK_INIT(usb_phy0_clk.c),
1779 },
1780};
1781
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001782#define CLK_USB_FS(i, n, fmax_nom) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001783 struct rcg_clk i##_clk = { \
1784 .ns_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1785 .b = { \
1786 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1787 .halt_check = NOCHECK, \
1788 }, \
1789 .md_reg = USB_FSn_XCVR_FS_CLK_MD_REG(n), \
1790 .root_en_mask = BIT(11), \
1791 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001792 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001793 .set_rate = set_rate_mnd, \
1794 .freq_tbl = clk_tbl_usb, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001795 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001796 .c = { \
1797 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001798 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001799 VDD_DIG_FMAX_MAP1(NOMINAL, fmax_nom), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001800 CLK_INIT(i##_clk.c), \
1801 }, \
1802 }
1803
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001804static CLK_USB_FS(usb_fs1_src, 1, 64000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001805static struct branch_clk usb_fs1_xcvr_clk = {
1806 .b = {
1807 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(1),
1808 .en_mask = BIT(9),
1809 .reset_reg = USB_FSn_RESET_REG(1),
1810 .reset_mask = BIT(1),
1811 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1812 .halt_bit = 15,
1813 },
1814 .parent = &usb_fs1_src_clk.c,
1815 .c = {
1816 .dbg_name = "usb_fs1_xcvr_clk",
1817 .ops = &clk_ops_branch,
1818 CLK_INIT(usb_fs1_xcvr_clk.c),
1819 },
1820};
1821
1822static struct branch_clk usb_fs1_sys_clk = {
1823 .b = {
1824 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(1),
1825 .en_mask = BIT(4),
1826 .reset_reg = USB_FSn_RESET_REG(1),
1827 .reset_mask = BIT(0),
1828 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1829 .halt_bit = 16,
1830 },
1831 .parent = &usb_fs1_src_clk.c,
1832 .c = {
1833 .dbg_name = "usb_fs1_sys_clk",
1834 .ops = &clk_ops_branch,
1835 CLK_INIT(usb_fs1_sys_clk.c),
1836 },
1837};
1838
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001839static CLK_USB_FS(usb_fs2_src, 2, 60000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001840static struct branch_clk usb_fs2_xcvr_clk = {
1841 .b = {
1842 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(2),
1843 .en_mask = BIT(9),
1844 .reset_reg = USB_FSn_RESET_REG(2),
1845 .reset_mask = BIT(1),
1846 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1847 .halt_bit = 12,
1848 },
1849 .parent = &usb_fs2_src_clk.c,
1850 .c = {
1851 .dbg_name = "usb_fs2_xcvr_clk",
1852 .ops = &clk_ops_branch,
1853 CLK_INIT(usb_fs2_xcvr_clk.c),
1854 },
1855};
1856
1857static struct branch_clk usb_fs2_sys_clk = {
1858 .b = {
1859 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(2),
1860 .en_mask = BIT(4),
1861 .reset_reg = USB_FSn_RESET_REG(2),
1862 .reset_mask = BIT(0),
1863 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1864 .halt_bit = 13,
1865 },
1866 .parent = &usb_fs2_src_clk.c,
1867 .c = {
1868 .dbg_name = "usb_fs2_sys_clk",
1869 .ops = &clk_ops_branch,
1870 CLK_INIT(usb_fs2_sys_clk.c),
1871 },
1872};
1873
1874/* Fast Peripheral Bus Clocks */
1875static struct branch_clk ce1_core_clk = {
1876 .b = {
1877 .ctl_reg = CE1_CORE_CLK_CTL_REG,
1878 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001879 .hwcg_reg = CE1_CORE_CLK_CTL_REG,
1880 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001881 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1882 .halt_bit = 27,
1883 },
1884 .c = {
1885 .dbg_name = "ce1_core_clk",
1886 .ops = &clk_ops_branch,
1887 CLK_INIT(ce1_core_clk.c),
1888 },
1889};
Tianyi Gou41515e22011-09-01 19:37:43 -07001890
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001891static struct branch_clk ce1_p_clk = {
1892 .b = {
1893 .ctl_reg = CE1_HCLK_CTL_REG,
1894 .en_mask = BIT(4),
1895 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1896 .halt_bit = 1,
1897 },
1898 .c = {
1899 .dbg_name = "ce1_p_clk",
1900 .ops = &clk_ops_branch,
1901 CLK_INIT(ce1_p_clk.c),
1902 },
1903};
1904
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001905#define F_CE3(f, s, d) \
Tianyi Gou41515e22011-09-01 19:37:43 -07001906 { \
1907 .freq_hz = f, \
1908 .src_clk = &s##_clk.c, \
1909 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001910 }
1911
1912static struct clk_freq_tbl clk_tbl_ce3[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001913 F_CE3( 0, gnd, 1),
1914 F_CE3( 48000000, pll8, 8),
1915 F_CE3(100000000, pll3, 12),
Tianyi Gou41515e22011-09-01 19:37:43 -07001916 F_END
1917};
1918
1919static struct rcg_clk ce3_src_clk = {
1920 .b = {
1921 .ctl_reg = CE3_CLK_SRC_NS_REG,
1922 .halt_check = NOCHECK,
1923 },
1924 .ns_reg = CE3_CLK_SRC_NS_REG,
1925 .root_en_mask = BIT(7),
1926 .ns_mask = BM(6, 0),
1927 .set_rate = set_rate_nop,
1928 .freq_tbl = clk_tbl_ce3,
1929 .current_freq = &rcg_dummy_freq,
1930 .c = {
1931 .dbg_name = "ce3_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001932 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001933 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
Tianyi Gou41515e22011-09-01 19:37:43 -07001934 CLK_INIT(ce3_src_clk.c),
1935 },
1936};
1937
1938static struct branch_clk ce3_core_clk = {
1939 .b = {
1940 .ctl_reg = CE3_CORE_CLK_CTL_REG,
1941 .en_mask = BIT(4),
1942 .reset_reg = CE3_CORE_CLK_CTL_REG,
1943 .reset_mask = BIT(7),
1944 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
1945 .halt_bit = 5,
1946 },
1947 .parent = &ce3_src_clk.c,
1948 .c = {
1949 .dbg_name = "ce3_core_clk",
1950 .ops = &clk_ops_branch,
1951 CLK_INIT(ce3_core_clk.c),
1952 }
1953};
1954
1955static struct branch_clk ce3_p_clk = {
1956 .b = {
1957 .ctl_reg = CE3_HCLK_CTL_REG,
1958 .en_mask = BIT(4),
1959 .reset_reg = CE3_HCLK_CTL_REG,
1960 .reset_mask = BIT(7),
1961 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
1962 .halt_bit = 16,
1963 },
1964 .parent = &ce3_src_clk.c,
1965 .c = {
1966 .dbg_name = "ce3_p_clk",
1967 .ops = &clk_ops_branch,
1968 CLK_INIT(ce3_p_clk.c),
1969 }
1970};
1971
Tianyi Gou352955d2012-05-18 19:44:01 -07001972#define F_SATA(f, s, d) \
1973 { \
1974 .freq_hz = f, \
1975 .src_clk = &s##_clk.c, \
1976 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
1977 }
1978
1979static struct clk_freq_tbl clk_tbl_sata[] = {
1980 F_SATA( 0, gnd, 1),
1981 F_SATA( 48000000, pll8, 8),
1982 F_SATA(100000000, pll3, 12),
1983 F_END
1984};
1985
1986static struct rcg_clk sata_src_clk = {
1987 .b = {
1988 .ctl_reg = SATA_CLK_SRC_NS_REG,
1989 .halt_check = NOCHECK,
1990 },
1991 .ns_reg = SATA_CLK_SRC_NS_REG,
1992 .root_en_mask = BIT(7),
1993 .ns_mask = BM(6, 0),
1994 .set_rate = set_rate_nop,
1995 .freq_tbl = clk_tbl_sata,
1996 .current_freq = &rcg_dummy_freq,
1997 .c = {
1998 .dbg_name = "sata_src_clk",
1999 .ops = &clk_ops_rcg,
2000 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
2001 CLK_INIT(sata_src_clk.c),
2002 },
2003};
2004
2005static struct branch_clk sata_rxoob_clk = {
2006 .b = {
2007 .ctl_reg = SATA_RXOOB_CLK_CTL_REG,
2008 .en_mask = BIT(4),
2009 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2010 .halt_bit = 26,
2011 },
2012 .parent = &sata_src_clk.c,
2013 .c = {
2014 .dbg_name = "sata_rxoob_clk",
2015 .ops = &clk_ops_branch,
2016 CLK_INIT(sata_rxoob_clk.c),
2017 },
2018};
2019
2020static struct branch_clk sata_pmalive_clk = {
2021 .b = {
2022 .ctl_reg = SATA_PMALIVE_CLK_CTL_REG,
2023 .en_mask = BIT(4),
2024 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2025 .halt_bit = 25,
2026 },
2027 .parent = &sata_src_clk.c,
2028 .c = {
2029 .dbg_name = "sata_pmalive_clk",
2030 .ops = &clk_ops_branch,
2031 CLK_INIT(sata_pmalive_clk.c),
2032 },
2033};
2034
Tianyi Gou41515e22011-09-01 19:37:43 -07002035static struct branch_clk sata_phy_ref_clk = {
2036 .b = {
2037 .ctl_reg = SATA_PHY_REF_CLK_CTL_REG,
2038 .en_mask = BIT(4),
2039 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2040 .halt_bit = 24,
2041 },
2042 .parent = &pxo_clk.c,
2043 .c = {
2044 .dbg_name = "sata_phy_ref_clk",
2045 .ops = &clk_ops_branch,
2046 CLK_INIT(sata_phy_ref_clk.c),
2047 },
2048};
2049
Tianyi Gou352955d2012-05-18 19:44:01 -07002050static struct branch_clk sata_a_clk = {
2051 .b = {
2052 .ctl_reg = SATA_ACLK_CTL_REG,
2053 .en_mask = BIT(4),
2054 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2055 .halt_bit = 12,
2056 },
2057 .c = {
2058 .dbg_name = "sata_a_clk",
2059 .ops = &clk_ops_branch,
2060 CLK_INIT(sata_a_clk.c),
2061 },
2062};
2063
2064static struct branch_clk sata_p_clk = {
2065 .b = {
2066 .ctl_reg = SATA_HCLK_CTL_REG,
2067 .en_mask = BIT(4),
2068 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2069 .halt_bit = 27,
2070 },
2071 .c = {
2072 .dbg_name = "sata_p_clk",
2073 .ops = &clk_ops_branch,
2074 CLK_INIT(sata_p_clk.c),
2075 },
2076};
2077
2078static struct branch_clk sfab_sata_s_p_clk = {
2079 .b = {
2080 .ctl_reg = SFAB_SATA_S_HCLK_CTL_REG,
2081 .en_mask = BIT(4),
2082 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
2083 .halt_bit = 14,
2084 },
2085 .c = {
2086 .dbg_name = "sfab_sata_s_p_clk",
2087 .ops = &clk_ops_branch,
2088 CLK_INIT(sfab_sata_s_p_clk.c),
2089 },
2090};
Tianyi Gou41515e22011-09-01 19:37:43 -07002091static struct branch_clk pcie_p_clk = {
2092 .b = {
2093 .ctl_reg = PCIE_HCLK_CTL_REG,
2094 .en_mask = BIT(4),
2095 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2096 .halt_bit = 8,
2097 },
2098 .c = {
2099 .dbg_name = "pcie_p_clk",
2100 .ops = &clk_ops_branch,
2101 CLK_INIT(pcie_p_clk.c),
2102 },
2103};
2104
Tianyi Gou6613de52012-01-27 17:57:53 -08002105static struct branch_clk pcie_phy_ref_clk = {
2106 .b = {
2107 .ctl_reg = PCIE_PCLK_CTL_REG,
2108 .en_mask = BIT(4),
2109 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2110 .halt_bit = 29,
2111 },
2112 .c = {
2113 .dbg_name = "pcie_phy_ref_clk",
2114 .ops = &clk_ops_branch,
2115 CLK_INIT(pcie_phy_ref_clk.c),
2116 },
2117};
2118
2119static struct branch_clk pcie_a_clk = {
2120 .b = {
2121 .ctl_reg = PCIE_ACLK_CTL_REG,
2122 .en_mask = BIT(4),
2123 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2124 .halt_bit = 13,
2125 },
2126 .c = {
2127 .dbg_name = "pcie_a_clk",
2128 .ops = &clk_ops_branch,
2129 CLK_INIT(pcie_a_clk.c),
2130 },
2131};
2132
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002133static struct branch_clk dma_bam_p_clk = {
2134 .b = {
2135 .ctl_reg = DMA_BAM_HCLK_CTL,
2136 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002137 .hwcg_reg = DMA_BAM_HCLK_CTL,
2138 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002139 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2140 .halt_bit = 12,
2141 },
2142 .c = {
2143 .dbg_name = "dma_bam_p_clk",
2144 .ops = &clk_ops_branch,
2145 CLK_INIT(dma_bam_p_clk.c),
2146 },
2147};
2148
2149static struct branch_clk gsbi1_p_clk = {
2150 .b = {
2151 .ctl_reg = GSBIn_HCLK_CTL_REG(1),
2152 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002153 .hwcg_reg = GSBIn_HCLK_CTL_REG(1),
2154 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002155 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2156 .halt_bit = 11,
2157 },
2158 .c = {
2159 .dbg_name = "gsbi1_p_clk",
2160 .ops = &clk_ops_branch,
2161 CLK_INIT(gsbi1_p_clk.c),
2162 },
2163};
2164
2165static struct branch_clk gsbi2_p_clk = {
2166 .b = {
2167 .ctl_reg = GSBIn_HCLK_CTL_REG(2),
2168 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002169 .hwcg_reg = GSBIn_HCLK_CTL_REG(2),
2170 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002171 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2172 .halt_bit = 7,
2173 },
2174 .c = {
2175 .dbg_name = "gsbi2_p_clk",
2176 .ops = &clk_ops_branch,
2177 CLK_INIT(gsbi2_p_clk.c),
2178 },
2179};
2180
2181static struct branch_clk gsbi3_p_clk = {
2182 .b = {
2183 .ctl_reg = GSBIn_HCLK_CTL_REG(3),
2184 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002185 .hwcg_reg = GSBIn_HCLK_CTL_REG(3),
2186 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002187 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2188 .halt_bit = 3,
2189 },
2190 .c = {
2191 .dbg_name = "gsbi3_p_clk",
2192 .ops = &clk_ops_branch,
2193 CLK_INIT(gsbi3_p_clk.c),
2194 },
2195};
2196
2197static struct branch_clk gsbi4_p_clk = {
2198 .b = {
2199 .ctl_reg = GSBIn_HCLK_CTL_REG(4),
2200 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002201 .hwcg_reg = GSBIn_HCLK_CTL_REG(4),
2202 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002203 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2204 .halt_bit = 27,
2205 },
2206 .c = {
2207 .dbg_name = "gsbi4_p_clk",
2208 .ops = &clk_ops_branch,
2209 CLK_INIT(gsbi4_p_clk.c),
2210 },
2211};
2212
2213static struct branch_clk gsbi5_p_clk = {
2214 .b = {
2215 .ctl_reg = GSBIn_HCLK_CTL_REG(5),
2216 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002217 .hwcg_reg = GSBIn_HCLK_CTL_REG(5),
2218 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002219 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2220 .halt_bit = 23,
2221 },
2222 .c = {
2223 .dbg_name = "gsbi5_p_clk",
2224 .ops = &clk_ops_branch,
2225 CLK_INIT(gsbi5_p_clk.c),
2226 },
2227};
2228
2229static struct branch_clk gsbi6_p_clk = {
2230 .b = {
2231 .ctl_reg = GSBIn_HCLK_CTL_REG(6),
2232 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002233 .hwcg_reg = GSBIn_HCLK_CTL_REG(6),
2234 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002235 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2236 .halt_bit = 19,
2237 },
2238 .c = {
2239 .dbg_name = "gsbi6_p_clk",
2240 .ops = &clk_ops_branch,
2241 CLK_INIT(gsbi6_p_clk.c),
2242 },
2243};
2244
2245static struct branch_clk gsbi7_p_clk = {
2246 .b = {
2247 .ctl_reg = GSBIn_HCLK_CTL_REG(7),
2248 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002249 .hwcg_reg = GSBIn_HCLK_CTL_REG(7),
2250 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002251 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2252 .halt_bit = 15,
2253 },
2254 .c = {
2255 .dbg_name = "gsbi7_p_clk",
2256 .ops = &clk_ops_branch,
2257 CLK_INIT(gsbi7_p_clk.c),
2258 },
2259};
2260
2261static struct branch_clk gsbi8_p_clk = {
2262 .b = {
2263 .ctl_reg = GSBIn_HCLK_CTL_REG(8),
2264 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002265 .hwcg_reg = GSBIn_HCLK_CTL_REG(8),
2266 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002267 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2268 .halt_bit = 11,
2269 },
2270 .c = {
2271 .dbg_name = "gsbi8_p_clk",
2272 .ops = &clk_ops_branch,
2273 CLK_INIT(gsbi8_p_clk.c),
2274 },
2275};
2276
2277static struct branch_clk gsbi9_p_clk = {
2278 .b = {
2279 .ctl_reg = GSBIn_HCLK_CTL_REG(9),
2280 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002281 .hwcg_reg = GSBIn_HCLK_CTL_REG(9),
2282 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002283 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2284 .halt_bit = 7,
2285 },
2286 .c = {
2287 .dbg_name = "gsbi9_p_clk",
2288 .ops = &clk_ops_branch,
2289 CLK_INIT(gsbi9_p_clk.c),
2290 },
2291};
2292
2293static struct branch_clk gsbi10_p_clk = {
2294 .b = {
2295 .ctl_reg = GSBIn_HCLK_CTL_REG(10),
2296 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002297 .hwcg_reg = GSBIn_HCLK_CTL_REG(10),
2298 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002299 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2300 .halt_bit = 3,
2301 },
2302 .c = {
2303 .dbg_name = "gsbi10_p_clk",
2304 .ops = &clk_ops_branch,
2305 CLK_INIT(gsbi10_p_clk.c),
2306 },
2307};
2308
2309static struct branch_clk gsbi11_p_clk = {
2310 .b = {
2311 .ctl_reg = GSBIn_HCLK_CTL_REG(11),
2312 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002313 .hwcg_reg = GSBIn_HCLK_CTL_REG(11),
2314 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002315 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2316 .halt_bit = 18,
2317 },
2318 .c = {
2319 .dbg_name = "gsbi11_p_clk",
2320 .ops = &clk_ops_branch,
2321 CLK_INIT(gsbi11_p_clk.c),
2322 },
2323};
2324
2325static struct branch_clk gsbi12_p_clk = {
2326 .b = {
2327 .ctl_reg = GSBIn_HCLK_CTL_REG(12),
2328 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002329 .hwcg_reg = GSBIn_HCLK_CTL_REG(12),
2330 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002331 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2332 .halt_bit = 14,
2333 },
2334 .c = {
2335 .dbg_name = "gsbi12_p_clk",
2336 .ops = &clk_ops_branch,
2337 CLK_INIT(gsbi12_p_clk.c),
2338 },
2339};
2340
Tianyi Gou41515e22011-09-01 19:37:43 -07002341static struct branch_clk sata_phy_cfg_clk = {
2342 .b = {
2343 .ctl_reg = SATA_PHY_CFG_CLK_CTL_REG,
2344 .en_mask = BIT(4),
2345 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2346 .halt_bit = 12,
2347 },
2348 .c = {
2349 .dbg_name = "sata_phy_cfg_clk",
2350 .ops = &clk_ops_branch,
2351 CLK_INIT(sata_phy_cfg_clk.c),
Stephen Boyd973e4ba2011-07-12 17:06:01 -07002352 },
2353};
2354
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002355static struct branch_clk tsif_p_clk = {
2356 .b = {
2357 .ctl_reg = TSIF_HCLK_CTL_REG,
2358 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002359 .hwcg_reg = TSIF_HCLK_CTL_REG,
2360 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002361 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2362 .halt_bit = 7,
2363 },
2364 .c = {
2365 .dbg_name = "tsif_p_clk",
2366 .ops = &clk_ops_branch,
2367 CLK_INIT(tsif_p_clk.c),
2368 },
2369};
2370
2371static struct branch_clk usb_fs1_p_clk = {
2372 .b = {
2373 .ctl_reg = USB_FSn_HCLK_CTL_REG(1),
2374 .en_mask = BIT(4),
2375 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2376 .halt_bit = 17,
2377 },
2378 .c = {
2379 .dbg_name = "usb_fs1_p_clk",
2380 .ops = &clk_ops_branch,
2381 CLK_INIT(usb_fs1_p_clk.c),
2382 },
2383};
2384
2385static struct branch_clk usb_fs2_p_clk = {
2386 .b = {
2387 .ctl_reg = USB_FSn_HCLK_CTL_REG(2),
2388 .en_mask = BIT(4),
2389 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2390 .halt_bit = 14,
2391 },
2392 .c = {
2393 .dbg_name = "usb_fs2_p_clk",
2394 .ops = &clk_ops_branch,
2395 CLK_INIT(usb_fs2_p_clk.c),
2396 },
2397};
2398
2399static struct branch_clk usb_hs1_p_clk = {
2400 .b = {
2401 .ctl_reg = USB_HS1_HCLK_CTL_REG,
2402 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002403 .hwcg_reg = USB_HS1_HCLK_CTL_REG,
2404 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002405 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2406 .halt_bit = 1,
2407 },
2408 .c = {
2409 .dbg_name = "usb_hs1_p_clk",
2410 .ops = &clk_ops_branch,
2411 CLK_INIT(usb_hs1_p_clk.c),
2412 },
2413};
2414
Tianyi Gou41515e22011-09-01 19:37:43 -07002415static struct branch_clk usb_hs3_p_clk = {
2416 .b = {
2417 .ctl_reg = USB_HS3_HCLK_CTL_REG,
2418 .en_mask = BIT(4),
2419 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2420 .halt_bit = 31,
2421 },
2422 .c = {
2423 .dbg_name = "usb_hs3_p_clk",
2424 .ops = &clk_ops_branch,
2425 CLK_INIT(usb_hs3_p_clk.c),
2426 },
2427};
2428
2429static struct branch_clk usb_hs4_p_clk = {
2430 .b = {
2431 .ctl_reg = USB_HS4_HCLK_CTL_REG,
2432 .en_mask = BIT(4),
2433 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2434 .halt_bit = 7,
2435 },
2436 .c = {
2437 .dbg_name = "usb_hs4_p_clk",
2438 .ops = &clk_ops_branch,
2439 CLK_INIT(usb_hs4_p_clk.c),
2440 },
2441};
2442
Stephen Boyd94625ef2011-07-12 17:06:01 -07002443static struct branch_clk usb_hsic_p_clk = {
2444 .b = {
2445 .ctl_reg = USB_HSIC_HCLK_CTL_REG,
2446 .en_mask = BIT(4),
2447 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2448 .halt_bit = 28,
2449 },
2450 .c = {
2451 .dbg_name = "usb_hsic_p_clk",
2452 .ops = &clk_ops_branch,
2453 CLK_INIT(usb_hsic_p_clk.c),
2454 },
2455};
2456
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002457static struct branch_clk sdc1_p_clk = {
2458 .b = {
2459 .ctl_reg = SDCn_HCLK_CTL_REG(1),
2460 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002461 .hwcg_reg = SDCn_HCLK_CTL_REG(1),
2462 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002463 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2464 .halt_bit = 11,
2465 },
2466 .c = {
2467 .dbg_name = "sdc1_p_clk",
2468 .ops = &clk_ops_branch,
2469 CLK_INIT(sdc1_p_clk.c),
2470 },
2471};
2472
2473static struct branch_clk sdc2_p_clk = {
2474 .b = {
2475 .ctl_reg = SDCn_HCLK_CTL_REG(2),
2476 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002477 .hwcg_reg = SDCn_HCLK_CTL_REG(2),
2478 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002479 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2480 .halt_bit = 10,
2481 },
2482 .c = {
2483 .dbg_name = "sdc2_p_clk",
2484 .ops = &clk_ops_branch,
2485 CLK_INIT(sdc2_p_clk.c),
2486 },
2487};
2488
2489static struct branch_clk sdc3_p_clk = {
2490 .b = {
2491 .ctl_reg = SDCn_HCLK_CTL_REG(3),
2492 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002493 .hwcg_reg = SDCn_HCLK_CTL_REG(3),
2494 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002495 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2496 .halt_bit = 9,
2497 },
2498 .c = {
2499 .dbg_name = "sdc3_p_clk",
2500 .ops = &clk_ops_branch,
2501 CLK_INIT(sdc3_p_clk.c),
2502 },
2503};
2504
2505static struct branch_clk sdc4_p_clk = {
2506 .b = {
2507 .ctl_reg = SDCn_HCLK_CTL_REG(4),
2508 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002509 .hwcg_reg = SDCn_HCLK_CTL_REG(4),
2510 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002511 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2512 .halt_bit = 8,
2513 },
2514 .c = {
2515 .dbg_name = "sdc4_p_clk",
2516 .ops = &clk_ops_branch,
2517 CLK_INIT(sdc4_p_clk.c),
2518 },
2519};
2520
2521static struct branch_clk sdc5_p_clk = {
2522 .b = {
2523 .ctl_reg = SDCn_HCLK_CTL_REG(5),
2524 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002525 .hwcg_reg = SDCn_HCLK_CTL_REG(5),
2526 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002527 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2528 .halt_bit = 7,
2529 },
2530 .c = {
2531 .dbg_name = "sdc5_p_clk",
2532 .ops = &clk_ops_branch,
2533 CLK_INIT(sdc5_p_clk.c),
2534 },
2535};
2536
2537/* HW-Voteable Clocks */
2538static struct branch_clk adm0_clk = {
2539 .b = {
2540 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2541 .en_mask = BIT(2),
2542 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2543 .halt_check = HALT_VOTED,
2544 .halt_bit = 14,
2545 },
2546 .c = {
2547 .dbg_name = "adm0_clk",
2548 .ops = &clk_ops_branch,
2549 CLK_INIT(adm0_clk.c),
2550 },
2551};
2552
2553static struct branch_clk adm0_p_clk = {
2554 .b = {
2555 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2556 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002557 .hwcg_reg = ADM0_PBUS_CLK_CTL_REG,
2558 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002559 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2560 .halt_check = HALT_VOTED,
2561 .halt_bit = 13,
2562 },
2563 .c = {
2564 .dbg_name = "adm0_p_clk",
2565 .ops = &clk_ops_branch,
2566 CLK_INIT(adm0_p_clk.c),
2567 },
2568};
2569
2570static struct branch_clk pmic_arb0_p_clk = {
2571 .b = {
2572 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2573 .en_mask = BIT(8),
2574 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2575 .halt_check = HALT_VOTED,
2576 .halt_bit = 22,
2577 },
2578 .c = {
2579 .dbg_name = "pmic_arb0_p_clk",
2580 .ops = &clk_ops_branch,
2581 CLK_INIT(pmic_arb0_p_clk.c),
2582 },
2583};
2584
2585static struct branch_clk pmic_arb1_p_clk = {
2586 .b = {
2587 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2588 .en_mask = BIT(9),
2589 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2590 .halt_check = HALT_VOTED,
2591 .halt_bit = 21,
2592 },
2593 .c = {
2594 .dbg_name = "pmic_arb1_p_clk",
2595 .ops = &clk_ops_branch,
2596 CLK_INIT(pmic_arb1_p_clk.c),
2597 },
2598};
2599
2600static struct branch_clk pmic_ssbi2_clk = {
2601 .b = {
2602 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2603 .en_mask = BIT(7),
2604 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2605 .halt_check = HALT_VOTED,
2606 .halt_bit = 23,
2607 },
2608 .c = {
2609 .dbg_name = "pmic_ssbi2_clk",
2610 .ops = &clk_ops_branch,
2611 CLK_INIT(pmic_ssbi2_clk.c),
2612 },
2613};
2614
2615static struct branch_clk rpm_msg_ram_p_clk = {
2616 .b = {
2617 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2618 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002619 .hwcg_reg = RPM_MSG_RAM_HCLK_CTL_REG,
2620 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002621 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2622 .halt_check = HALT_VOTED,
2623 .halt_bit = 12,
2624 },
2625 .c = {
2626 .dbg_name = "rpm_msg_ram_p_clk",
2627 .ops = &clk_ops_branch,
2628 CLK_INIT(rpm_msg_ram_p_clk.c),
2629 },
2630};
2631
2632/*
2633 * Multimedia Clocks
2634 */
2635
Stephen Boyd94625ef2011-07-12 17:06:01 -07002636#define CLK_CAM(name, n, hb) \
2637 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002638 .b = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002639 .ctl_reg = CAMCLK##n##_CC_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002640 .en_mask = BIT(0), \
2641 .halt_reg = DBG_BUS_VEC_I_REG, \
2642 .halt_bit = hb, \
2643 }, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002644 .ns_reg = CAMCLK##n##_NS_REG, \
2645 .md_reg = CAMCLK##n##_MD_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002646 .root_en_mask = BIT(2), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002647 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), \
Matt Wagantall07c45472012-02-10 23:27:24 -08002648 .mnd_en_mask = BIT(5), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002649 .ctl_mask = BM(7, 6), \
2650 .set_rate = set_rate_mnd_8, \
2651 .freq_tbl = clk_tbl_cam, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002652 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002653 .c = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002654 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07002655 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002656 VDD_DIG_FMAX_MAP2(LOW, 64000000, NOMINAL, 128000000), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002657 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002658 }, \
2659 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002660#define F_CAM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002661 { \
2662 .freq_hz = f, \
2663 .src_clk = &s##_clk.c, \
2664 .md_val = MD8(8, m, 0, n), \
2665 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2666 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002667 }
2668static struct clk_freq_tbl clk_tbl_cam[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002669 F_CAM( 0, gnd, 1, 0, 0),
2670 F_CAM( 6000000, pll8, 4, 1, 16),
2671 F_CAM( 8000000, pll8, 4, 1, 12),
2672 F_CAM( 12000000, pll8, 4, 1, 8),
2673 F_CAM( 16000000, pll8, 4, 1, 6),
2674 F_CAM( 19200000, pll8, 4, 1, 5),
2675 F_CAM( 24000000, pll8, 4, 1, 4),
2676 F_CAM( 32000000, pll8, 4, 1, 3),
2677 F_CAM( 48000000, pll8, 4, 1, 2),
2678 F_CAM( 64000000, pll8, 3, 1, 2),
2679 F_CAM( 96000000, pll8, 4, 0, 0),
2680 F_CAM(128000000, pll8, 3, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002681 F_END
2682};
2683
Stephen Boyd94625ef2011-07-12 17:06:01 -07002684static CLK_CAM(cam0_clk, 0, 15);
2685static CLK_CAM(cam1_clk, 1, 16);
2686static CLK_CAM(cam2_clk, 2, 31);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002687
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002688#define F_CSI(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002689 { \
2690 .freq_hz = f, \
2691 .src_clk = &s##_clk.c, \
2692 .md_val = MD8(8, m, 0, n), \
2693 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2694 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002695 }
2696static struct clk_freq_tbl clk_tbl_csi[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002697 F_CSI( 0, gnd, 1, 0, 0),
Stephen Boyd092fd182011-10-21 15:56:30 -07002698 F_CSI( 27000000, pxo, 1, 0, 0),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002699 F_CSI( 85330000, pll8, 1, 2, 9),
2700 F_CSI(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002701 F_END
2702};
2703
2704static struct rcg_clk csi0_src_clk = {
2705 .ns_reg = CSI0_NS_REG,
2706 .b = {
2707 .ctl_reg = CSI0_CC_REG,
2708 .halt_check = NOCHECK,
2709 },
2710 .md_reg = CSI0_MD_REG,
2711 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002712 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002713 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002714 .ctl_mask = BM(7, 6),
2715 .set_rate = set_rate_mnd,
2716 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002717 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002718 .c = {
2719 .dbg_name = "csi0_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002720 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002721 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002722 CLK_INIT(csi0_src_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002723 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002724 },
2725};
2726
2727static struct branch_clk csi0_clk = {
2728 .b = {
2729 .ctl_reg = CSI0_CC_REG,
2730 .en_mask = BIT(0),
2731 .reset_reg = SW_RESET_CORE_REG,
2732 .reset_mask = BIT(8),
2733 .halt_reg = DBG_BUS_VEC_B_REG,
2734 .halt_bit = 13,
2735 },
2736 .parent = &csi0_src_clk.c,
2737 .c = {
2738 .dbg_name = "csi0_clk",
2739 .ops = &clk_ops_branch,
2740 CLK_INIT(csi0_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002741 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002742 },
2743};
2744
2745static struct branch_clk csi0_phy_clk = {
2746 .b = {
2747 .ctl_reg = CSI0_CC_REG,
2748 .en_mask = BIT(8),
2749 .reset_reg = SW_RESET_CORE_REG,
2750 .reset_mask = BIT(29),
2751 .halt_reg = DBG_BUS_VEC_I_REG,
2752 .halt_bit = 9,
2753 },
2754 .parent = &csi0_src_clk.c,
2755 .c = {
2756 .dbg_name = "csi0_phy_clk",
2757 .ops = &clk_ops_branch,
2758 CLK_INIT(csi0_phy_clk.c),
2759 },
2760};
2761
2762static struct rcg_clk csi1_src_clk = {
2763 .ns_reg = CSI1_NS_REG,
2764 .b = {
2765 .ctl_reg = CSI1_CC_REG,
2766 .halt_check = NOCHECK,
2767 },
2768 .md_reg = CSI1_MD_REG,
2769 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002770 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002771 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002772 .ctl_mask = BM(7, 6),
2773 .set_rate = set_rate_mnd,
2774 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002775 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002776 .c = {
2777 .dbg_name = "csi1_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002778 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002779 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002780 CLK_INIT(csi1_src_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002781 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002782 },
2783};
2784
2785static struct branch_clk csi1_clk = {
2786 .b = {
2787 .ctl_reg = CSI1_CC_REG,
2788 .en_mask = BIT(0),
2789 .reset_reg = SW_RESET_CORE_REG,
2790 .reset_mask = BIT(18),
2791 .halt_reg = DBG_BUS_VEC_B_REG,
2792 .halt_bit = 14,
2793 },
2794 .parent = &csi1_src_clk.c,
2795 .c = {
2796 .dbg_name = "csi1_clk",
2797 .ops = &clk_ops_branch,
2798 CLK_INIT(csi1_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002799 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002800 },
2801};
2802
2803static struct branch_clk csi1_phy_clk = {
2804 .b = {
2805 .ctl_reg = CSI1_CC_REG,
2806 .en_mask = BIT(8),
2807 .reset_reg = SW_RESET_CORE_REG,
2808 .reset_mask = BIT(28),
2809 .halt_reg = DBG_BUS_VEC_I_REG,
2810 .halt_bit = 10,
2811 },
2812 .parent = &csi1_src_clk.c,
2813 .c = {
2814 .dbg_name = "csi1_phy_clk",
2815 .ops = &clk_ops_branch,
2816 CLK_INIT(csi1_phy_clk.c),
2817 },
2818};
2819
Stephen Boyd94625ef2011-07-12 17:06:01 -07002820static struct rcg_clk csi2_src_clk = {
2821 .ns_reg = CSI2_NS_REG,
2822 .b = {
2823 .ctl_reg = CSI2_CC_REG,
2824 .halt_check = NOCHECK,
2825 },
2826 .md_reg = CSI2_MD_REG,
2827 .root_en_mask = BIT(2),
2828 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002829 .mnd_en_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002830 .ctl_mask = BM(7, 6),
2831 .set_rate = set_rate_mnd,
2832 .freq_tbl = clk_tbl_csi,
2833 .current_freq = &rcg_dummy_freq,
2834 .c = {
2835 .dbg_name = "csi2_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002836 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002837 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002838 CLK_INIT(csi2_src_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002839 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002840 },
2841};
2842
2843static struct branch_clk csi2_clk = {
2844 .b = {
2845 .ctl_reg = CSI2_CC_REG,
2846 .en_mask = BIT(0),
2847 .reset_reg = SW_RESET_CORE2_REG,
2848 .reset_mask = BIT(2),
2849 .halt_reg = DBG_BUS_VEC_B_REG,
2850 .halt_bit = 29,
2851 },
2852 .parent = &csi2_src_clk.c,
2853 .c = {
2854 .dbg_name = "csi2_clk",
2855 .ops = &clk_ops_branch,
2856 CLK_INIT(csi2_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002857 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002858 },
2859};
2860
2861static struct branch_clk csi2_phy_clk = {
2862 .b = {
2863 .ctl_reg = CSI2_CC_REG,
2864 .en_mask = BIT(8),
2865 .reset_reg = SW_RESET_CORE_REG,
2866 .reset_mask = BIT(31),
2867 .halt_reg = DBG_BUS_VEC_I_REG,
2868 .halt_bit = 29,
2869 },
2870 .parent = &csi2_src_clk.c,
2871 .c = {
2872 .dbg_name = "csi2_phy_clk",
2873 .ops = &clk_ops_branch,
2874 CLK_INIT(csi2_phy_clk.c),
2875 },
2876};
2877
Stephen Boyd092fd182011-10-21 15:56:30 -07002878static struct clk *pix_rdi_mux_map[] = {
2879 [0] = &csi0_clk.c,
2880 [1] = &csi1_clk.c,
2881 [2] = &csi2_clk.c,
2882 NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002883};
2884
Stephen Boyd092fd182011-10-21 15:56:30 -07002885struct pix_rdi_clk {
2886 bool enabled;
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002887 unsigned long cur_rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002888
2889 void __iomem *const s_reg;
2890 u32 s_mask;
2891
2892 void __iomem *const s2_reg;
2893 u32 s2_mask;
2894
2895 struct branch b;
2896 struct clk c;
2897};
2898
Matt Wagantallf82f2942012-01-27 13:56:13 -08002899static inline struct pix_rdi_clk *to_pix_rdi_clk(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002900{
Matt Wagantallf82f2942012-01-27 13:56:13 -08002901 return container_of(c, struct pix_rdi_clk, c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002902}
2903
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002904static int pix_rdi_clk_set_rate(struct clk *c, unsigned long rate)
Stephen Boyd092fd182011-10-21 15:56:30 -07002905{
2906 int ret, i;
2907 u32 reg;
2908 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002909 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002910 struct clk **mux_map = pix_rdi_mux_map;
2911
2912 /*
2913 * These clocks select three inputs via two muxes. One mux selects
2914 * between csi0 and csi1 and the second mux selects between that mux's
2915 * output and csi2. The source and destination selections for each
2916 * mux must be clocking for the switch to succeed so just turn on
2917 * all three sources because it's easier than figuring out what source
2918 * needs to be on at what time.
2919 */
2920 for (i = 0; mux_map[i]; i++) {
2921 ret = clk_enable(mux_map[i]);
2922 if (ret)
2923 goto err;
2924 }
2925 if (rate >= i) {
2926 ret = -EINVAL;
2927 goto err;
2928 }
2929 /* Keep the new source on when switching inputs of an enabled clock */
Matt Wagantallf82f2942012-01-27 13:56:13 -08002930 if (rdi->enabled) {
2931 clk_disable(mux_map[rdi->cur_rate]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002932 clk_enable(mux_map[rate]);
2933 }
2934 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002935 reg = readl_relaxed(rdi->s2_reg);
2936 reg &= ~rdi->s2_mask;
2937 reg |= rate == 2 ? rdi->s2_mask : 0;
2938 writel_relaxed(reg, rdi->s2_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002939 /*
2940 * Wait at least 6 cycles of slowest clock
2941 * for the glitch-free MUX to fully switch sources.
2942 */
2943 mb();
2944 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002945 reg = readl_relaxed(rdi->s_reg);
2946 reg &= ~rdi->s_mask;
2947 reg |= rate == 1 ? rdi->s_mask : 0;
2948 writel_relaxed(reg, rdi->s_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002949 /*
2950 * Wait at least 6 cycles of slowest clock
2951 * for the glitch-free MUX to fully switch sources.
2952 */
2953 mb();
2954 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002955 rdi->cur_rate = rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002956 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2957err:
2958 for (i--; i >= 0; i--)
2959 clk_disable(mux_map[i]);
2960
2961 return 0;
2962}
2963
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002964static unsigned long pix_rdi_clk_get_rate(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002965{
2966 return to_pix_rdi_clk(c)->cur_rate;
2967}
2968
2969static int pix_rdi_clk_enable(struct clk *c)
2970{
2971 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002972 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002973
2974 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07002975 __branch_enable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07002976 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002977 rdi->enabled = true;
Stephen Boyd092fd182011-10-21 15:56:30 -07002978
2979 return 0;
2980}
2981
2982static void pix_rdi_clk_disable(struct clk *c)
2983{
2984 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002985 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002986
2987 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07002988 __branch_disable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07002989 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002990 rdi->enabled = false;
Stephen Boyd092fd182011-10-21 15:56:30 -07002991}
2992
Matt Wagantallf82f2942012-01-27 13:56:13 -08002993static int pix_rdi_clk_reset(struct clk *c, enum clk_reset_action action)
Stephen Boyd092fd182011-10-21 15:56:30 -07002994{
Matt Wagantallf82f2942012-01-27 13:56:13 -08002995 return branch_reset(&to_pix_rdi_clk(c)->b, action);
Stephen Boyd092fd182011-10-21 15:56:30 -07002996}
2997
2998static struct clk *pix_rdi_clk_get_parent(struct clk *c)
2999{
Matt Wagantallf82f2942012-01-27 13:56:13 -08003000 return pix_rdi_mux_map[to_pix_rdi_clk(c)->cur_rate];
Stephen Boyd092fd182011-10-21 15:56:30 -07003001}
3002
3003static int pix_rdi_clk_list_rate(struct clk *c, unsigned n)
3004{
3005 if (pix_rdi_mux_map[n])
3006 return n;
3007 return -ENXIO;
3008}
3009
Matt Wagantalla15833b2012-04-03 11:00:56 -07003010static enum handoff pix_rdi_clk_handoff(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07003011{
3012 u32 reg;
Matt Wagantallf82f2942012-01-27 13:56:13 -08003013 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07003014 enum handoff ret;
3015
Matt Wagantallf82f2942012-01-27 13:56:13 -08003016 ret = branch_handoff(&rdi->b, &rdi->c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07003017 if (ret == HANDOFF_DISABLED_CLK)
3018 return ret;
Stephen Boyd092fd182011-10-21 15:56:30 -07003019
Matt Wagantallf82f2942012-01-27 13:56:13 -08003020 reg = readl_relaxed(rdi->s_reg);
3021 rdi->cur_rate = reg & rdi->s_mask ? 1 : 0;
3022 reg = readl_relaxed(rdi->s2_reg);
3023 rdi->cur_rate = reg & rdi->s2_mask ? 2 : rdi->cur_rate;
Matt Wagantalla15833b2012-04-03 11:00:56 -07003024
3025 return HANDOFF_ENABLED_CLK;
Stephen Boyd092fd182011-10-21 15:56:30 -07003026}
3027
3028static struct clk_ops clk_ops_pix_rdi_8960 = {
3029 .enable = pix_rdi_clk_enable,
3030 .disable = pix_rdi_clk_disable,
Stephen Boyd092fd182011-10-21 15:56:30 -07003031 .handoff = pix_rdi_clk_handoff,
3032 .set_rate = pix_rdi_clk_set_rate,
3033 .get_rate = pix_rdi_clk_get_rate,
3034 .list_rate = pix_rdi_clk_list_rate,
3035 .reset = pix_rdi_clk_reset,
Stephen Boyd092fd182011-10-21 15:56:30 -07003036 .get_parent = pix_rdi_clk_get_parent,
3037};
3038
3039static struct pix_rdi_clk csi_pix_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003040 .b = {
3041 .ctl_reg = MISC_CC_REG,
3042 .en_mask = BIT(26),
3043 .halt_check = DELAY,
3044 .reset_reg = SW_RESET_CORE_REG,
3045 .reset_mask = BIT(26),
3046 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003047 .s_reg = MISC_CC_REG,
3048 .s_mask = BIT(25),
3049 .s2_reg = MISC_CC3_REG,
3050 .s2_mask = BIT(13),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003051 .c = {
3052 .dbg_name = "csi_pix_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003053 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003054 CLK_INIT(csi_pix_clk.c),
3055 },
3056};
3057
Stephen Boyd092fd182011-10-21 15:56:30 -07003058static struct pix_rdi_clk csi_pix1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003059 .b = {
3060 .ctl_reg = MISC_CC3_REG,
3061 .en_mask = BIT(10),
3062 .halt_check = DELAY,
3063 .reset_reg = SW_RESET_CORE_REG,
3064 .reset_mask = BIT(30),
3065 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003066 .s_reg = MISC_CC3_REG,
3067 .s_mask = BIT(8),
3068 .s2_reg = MISC_CC3_REG,
3069 .s2_mask = BIT(9),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003070 .c = {
3071 .dbg_name = "csi_pix1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003072 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003073 CLK_INIT(csi_pix1_clk.c),
3074 },
3075};
3076
Stephen Boyd092fd182011-10-21 15:56:30 -07003077static struct pix_rdi_clk csi_rdi_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003078 .b = {
3079 .ctl_reg = MISC_CC_REG,
3080 .en_mask = BIT(13),
3081 .halt_check = DELAY,
3082 .reset_reg = SW_RESET_CORE_REG,
3083 .reset_mask = BIT(27),
3084 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003085 .s_reg = MISC_CC_REG,
3086 .s_mask = BIT(12),
3087 .s2_reg = MISC_CC3_REG,
3088 .s2_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003089 .c = {
3090 .dbg_name = "csi_rdi_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003091 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003092 CLK_INIT(csi_rdi_clk.c),
3093 },
3094};
3095
Stephen Boyd092fd182011-10-21 15:56:30 -07003096static struct pix_rdi_clk csi_rdi1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003097 .b = {
3098 .ctl_reg = MISC_CC3_REG,
3099 .en_mask = BIT(2),
3100 .halt_check = DELAY,
3101 .reset_reg = SW_RESET_CORE2_REG,
3102 .reset_mask = BIT(1),
3103 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003104 .s_reg = MISC_CC3_REG,
3105 .s_mask = BIT(0),
3106 .s2_reg = MISC_CC3_REG,
3107 .s2_mask = BIT(1),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003108 .c = {
3109 .dbg_name = "csi_rdi1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003110 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003111 CLK_INIT(csi_rdi1_clk.c),
3112 },
3113};
3114
Stephen Boyd092fd182011-10-21 15:56:30 -07003115static struct pix_rdi_clk csi_rdi2_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003116 .b = {
3117 .ctl_reg = MISC_CC3_REG,
3118 .en_mask = BIT(6),
3119 .halt_check = DELAY,
3120 .reset_reg = SW_RESET_CORE2_REG,
3121 .reset_mask = BIT(0),
3122 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003123 .s_reg = MISC_CC3_REG,
3124 .s_mask = BIT(4),
3125 .s2_reg = MISC_CC3_REG,
3126 .s2_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003127 .c = {
3128 .dbg_name = "csi_rdi2_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003129 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003130 CLK_INIT(csi_rdi2_clk.c),
3131 },
3132};
3133
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003134#define F_CSI_PHYTIMER(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003135 { \
3136 .freq_hz = f, \
3137 .src_clk = &s##_clk.c, \
3138 .md_val = MD8(8, m, 0, n), \
3139 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
3140 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003141 }
3142static struct clk_freq_tbl clk_tbl_csi_phytimer[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003143 F_CSI_PHYTIMER( 0, gnd, 1, 0, 0),
3144 F_CSI_PHYTIMER( 85330000, pll8, 1, 2, 9),
3145 F_CSI_PHYTIMER(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003146 F_END
3147};
3148
3149static struct rcg_clk csiphy_timer_src_clk = {
3150 .ns_reg = CSIPHYTIMER_NS_REG,
3151 .b = {
3152 .ctl_reg = CSIPHYTIMER_CC_REG,
3153 .halt_check = NOCHECK,
3154 },
3155 .md_reg = CSIPHYTIMER_MD_REG,
3156 .root_en_mask = BIT(2),
3157 .ns_mask = (BM(31, 24) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003158 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003159 .ctl_mask = BM(7, 6),
3160 .set_rate = set_rate_mnd_8,
3161 .freq_tbl = clk_tbl_csi_phytimer,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003162 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003163 .c = {
3164 .dbg_name = "csiphy_timer_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003165 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003166 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003167 CLK_INIT(csiphy_timer_src_clk.c),
3168 },
3169};
3170
3171static struct branch_clk csi0phy_timer_clk = {
3172 .b = {
3173 .ctl_reg = CSIPHYTIMER_CC_REG,
3174 .en_mask = BIT(0),
3175 .halt_reg = DBG_BUS_VEC_I_REG,
3176 .halt_bit = 17,
3177 },
3178 .parent = &csiphy_timer_src_clk.c,
3179 .c = {
3180 .dbg_name = "csi0phy_timer_clk",
3181 .ops = &clk_ops_branch,
3182 CLK_INIT(csi0phy_timer_clk.c),
3183 },
3184};
3185
3186static struct branch_clk csi1phy_timer_clk = {
3187 .b = {
3188 .ctl_reg = CSIPHYTIMER_CC_REG,
3189 .en_mask = BIT(9),
3190 .halt_reg = DBG_BUS_VEC_I_REG,
3191 .halt_bit = 18,
3192 },
3193 .parent = &csiphy_timer_src_clk.c,
3194 .c = {
3195 .dbg_name = "csi1phy_timer_clk",
3196 .ops = &clk_ops_branch,
3197 CLK_INIT(csi1phy_timer_clk.c),
3198 },
3199};
3200
Stephen Boyd94625ef2011-07-12 17:06:01 -07003201static struct branch_clk csi2phy_timer_clk = {
3202 .b = {
3203 .ctl_reg = CSIPHYTIMER_CC_REG,
3204 .en_mask = BIT(11),
3205 .halt_reg = DBG_BUS_VEC_I_REG,
3206 .halt_bit = 30,
3207 },
3208 .parent = &csiphy_timer_src_clk.c,
3209 .c = {
3210 .dbg_name = "csi2phy_timer_clk",
3211 .ops = &clk_ops_branch,
3212 CLK_INIT(csi2phy_timer_clk.c),
3213 },
3214};
3215
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003216#define F_DSI(d) \
3217 { \
3218 .freq_hz = d, \
3219 .ns_val = BVAL(15, 12, (d-1)), \
3220 }
3221/*
3222 * The DSI_BYTE/ESC clock is sourced from the DSI PHY PLL, which may change rate
3223 * without this clock driver knowing. So, overload the clk_set_rate() to set
3224 * the divider (1 to 16) of the clock with respect to the PLL rate.
3225 */
3226static struct clk_freq_tbl clk_tbl_dsi_byte[] = {
3227 F_DSI(1), F_DSI(2), F_DSI(3), F_DSI(4),
3228 F_DSI(5), F_DSI(6), F_DSI(7), F_DSI(8),
3229 F_DSI(9), F_DSI(10), F_DSI(11), F_DSI(12),
3230 F_DSI(13), F_DSI(14), F_DSI(15), F_DSI(16),
3231 F_END
3232};
3233
Matt Wagantall735e41b2012-07-23 17:18:58 -07003234static struct branch_clk dsi1_reset_clk = {
3235 .b = {
3236 .reset_reg = SW_RESET_CORE_REG,
3237 .reset_mask = BIT(7),
3238 .halt_check = NOCHECK,
3239 },
3240 .c = {
3241 .dbg_name = "dsi1_reset_clk",
3242 .ops = &clk_ops_branch,
3243 CLK_INIT(dsi1_reset_clk.c),
3244 },
3245};
3246
3247static struct branch_clk dsi2_reset_clk = {
3248 .b = {
3249 .reset_reg = SW_RESET_CORE_REG,
3250 .reset_mask = BIT(25),
3251 .halt_check = NOCHECK,
3252 },
3253 .c = {
3254 .dbg_name = "dsi2_reset_clk",
3255 .ops = &clk_ops_branch,
3256 CLK_INIT(dsi2_reset_clk.c),
3257 },
3258};
3259
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003260static struct rcg_clk dsi1_byte_clk = {
3261 .b = {
3262 .ctl_reg = DSI1_BYTE_CC_REG,
3263 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003264 .halt_reg = DBG_BUS_VEC_B_REG,
3265 .halt_bit = 21,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003266 .retain_reg = DSI1_BYTE_CC_REG,
3267 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003268 },
3269 .ns_reg = DSI1_BYTE_NS_REG,
3270 .root_en_mask = BIT(2),
3271 .ns_mask = BM(15, 12),
3272 .set_rate = set_rate_nop,
3273 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003274 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003275 .c = {
3276 .dbg_name = "dsi1_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003277 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003278 CLK_INIT(dsi1_byte_clk.c),
3279 },
3280};
3281
3282static struct rcg_clk dsi2_byte_clk = {
3283 .b = {
3284 .ctl_reg = DSI2_BYTE_CC_REG,
3285 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003286 .halt_reg = DBG_BUS_VEC_B_REG,
3287 .halt_bit = 20,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003288 .retain_reg = DSI2_BYTE_CC_REG,
3289 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003290 },
3291 .ns_reg = DSI2_BYTE_NS_REG,
3292 .root_en_mask = BIT(2),
3293 .ns_mask = BM(15, 12),
3294 .set_rate = set_rate_nop,
3295 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003296 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003297 .c = {
3298 .dbg_name = "dsi2_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003299 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003300 CLK_INIT(dsi2_byte_clk.c),
3301 },
3302};
3303
3304static struct rcg_clk dsi1_esc_clk = {
3305 .b = {
3306 .ctl_reg = DSI1_ESC_CC_REG,
3307 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003308 .halt_reg = DBG_BUS_VEC_I_REG,
3309 .halt_bit = 1,
3310 },
3311 .ns_reg = DSI1_ESC_NS_REG,
3312 .root_en_mask = BIT(2),
3313 .ns_mask = BM(15, 12),
3314 .set_rate = set_rate_nop,
3315 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003316 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003317 .c = {
3318 .dbg_name = "dsi1_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003319 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003320 CLK_INIT(dsi1_esc_clk.c),
3321 },
3322};
3323
3324static struct rcg_clk dsi2_esc_clk = {
3325 .b = {
3326 .ctl_reg = DSI2_ESC_CC_REG,
3327 .en_mask = BIT(0),
3328 .halt_reg = DBG_BUS_VEC_I_REG,
3329 .halt_bit = 3,
3330 },
3331 .ns_reg = DSI2_ESC_NS_REG,
3332 .root_en_mask = BIT(2),
3333 .ns_mask = BM(15, 12),
3334 .set_rate = set_rate_nop,
3335 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003336 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003337 .c = {
3338 .dbg_name = "dsi2_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003339 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003340 CLK_INIT(dsi2_esc_clk.c),
3341 },
3342};
3343
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003344#define F_GFX2D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003345 { \
3346 .freq_hz = f, \
3347 .src_clk = &s##_clk.c, \
3348 .md_val = MD4(4, m, 0, n), \
3349 .ns_val = NS_MND_BANKED4(20, 16, n, m, 3, 0, s##_to_mm_mux), \
3350 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003351 }
3352static struct clk_freq_tbl clk_tbl_gfx2d[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003353 F_GFX2D( 0, gnd, 0, 0),
3354 F_GFX2D( 27000000, pxo, 0, 0),
3355 F_GFX2D( 48000000, pll8, 1, 8),
3356 F_GFX2D( 54857000, pll8, 1, 7),
3357 F_GFX2D( 64000000, pll8, 1, 6),
3358 F_GFX2D( 76800000, pll8, 1, 5),
3359 F_GFX2D( 96000000, pll8, 1, 4),
3360 F_GFX2D(128000000, pll8, 1, 3),
3361 F_GFX2D(145455000, pll2, 2, 11),
3362 F_GFX2D(160000000, pll2, 1, 5),
3363 F_GFX2D(177778000, pll2, 2, 9),
3364 F_GFX2D(200000000, pll2, 1, 4),
3365 F_GFX2D(228571000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003366 F_END
3367};
3368
3369static struct bank_masks bmnd_info_gfx2d0 = {
3370 .bank_sel_mask = BIT(11),
3371 .bank0_mask = {
3372 .md_reg = GFX2D0_MD0_REG,
3373 .ns_mask = BM(23, 20) | BM(5, 3),
3374 .rst_mask = BIT(25),
3375 .mnd_en_mask = BIT(8),
3376 .mode_mask = BM(10, 9),
3377 },
3378 .bank1_mask = {
3379 .md_reg = GFX2D0_MD1_REG,
3380 .ns_mask = BM(19, 16) | BM(2, 0),
3381 .rst_mask = BIT(24),
3382 .mnd_en_mask = BIT(5),
3383 .mode_mask = BM(7, 6),
3384 },
3385};
3386
3387static struct rcg_clk gfx2d0_clk = {
3388 .b = {
3389 .ctl_reg = GFX2D0_CC_REG,
3390 .en_mask = BIT(0),
3391 .reset_reg = SW_RESET_CORE_REG,
3392 .reset_mask = BIT(14),
3393 .halt_reg = DBG_BUS_VEC_A_REG,
3394 .halt_bit = 9,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003395 .retain_reg = GFX2D0_CC_REG,
3396 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003397 },
3398 .ns_reg = GFX2D0_NS_REG,
3399 .root_en_mask = BIT(2),
3400 .set_rate = set_rate_mnd_banked,
3401 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003402 .bank_info = &bmnd_info_gfx2d0,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003403 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003404 .c = {
3405 .dbg_name = "gfx2d0_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003406 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003407 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003408 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3409 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003410 CLK_INIT(gfx2d0_clk.c),
3411 },
3412};
3413
3414static struct bank_masks bmnd_info_gfx2d1 = {
3415 .bank_sel_mask = BIT(11),
3416 .bank0_mask = {
3417 .md_reg = GFX2D1_MD0_REG,
3418 .ns_mask = BM(23, 20) | BM(5, 3),
3419 .rst_mask = BIT(25),
3420 .mnd_en_mask = BIT(8),
3421 .mode_mask = BM(10, 9),
3422 },
3423 .bank1_mask = {
3424 .md_reg = GFX2D1_MD1_REG,
3425 .ns_mask = BM(19, 16) | BM(2, 0),
3426 .rst_mask = BIT(24),
3427 .mnd_en_mask = BIT(5),
3428 .mode_mask = BM(7, 6),
3429 },
3430};
3431
3432static struct rcg_clk gfx2d1_clk = {
3433 .b = {
3434 .ctl_reg = GFX2D1_CC_REG,
3435 .en_mask = BIT(0),
3436 .reset_reg = SW_RESET_CORE_REG,
3437 .reset_mask = BIT(13),
3438 .halt_reg = DBG_BUS_VEC_A_REG,
3439 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003440 .retain_reg = GFX2D1_CC_REG,
3441 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003442 },
3443 .ns_reg = GFX2D1_NS_REG,
3444 .root_en_mask = BIT(2),
3445 .set_rate = set_rate_mnd_banked,
3446 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003447 .bank_info = &bmnd_info_gfx2d1,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003448 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003449 .c = {
3450 .dbg_name = "gfx2d1_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003451 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003452 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003453 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3454 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003455 CLK_INIT(gfx2d1_clk.c),
3456 },
3457};
3458
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003459#define F_GFX3D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003460 { \
3461 .freq_hz = f, \
3462 .src_clk = &s##_clk.c, \
3463 .md_val = MD4(4, m, 0, n), \
3464 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3465 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003466 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003467
Patrick Dalye6f489042012-07-11 15:29:15 -07003468static struct clk_freq_tbl clk_tbl_gfx3d_8960ab[] = {
3469 F_GFX3D( 0, gnd, 0, 0),
3470 F_GFX3D( 27000000, pxo, 0, 0),
3471 F_GFX3D( 48000000, pll8, 1, 8),
3472 F_GFX3D( 54857000, pll8, 1, 7),
3473 F_GFX3D( 64000000, pll8, 1, 6),
3474 F_GFX3D( 76800000, pll8, 1, 5),
3475 F_GFX3D( 96000000, pll8, 1, 4),
3476 F_GFX3D(128000000, pll8, 1, 3),
3477 F_GFX3D(145455000, pll2, 2, 11),
3478 F_GFX3D(160000000, pll2, 1, 5),
3479 F_GFX3D(177778000, pll2, 2, 9),
3480 F_GFX3D(200000000, pll2, 1, 4),
3481 F_GFX3D(228571000, pll2, 2, 7),
3482 F_GFX3D(266667000, pll2, 1, 3),
3483 F_GFX3D(320000000, pll2, 2, 5),
3484 F_GFX3D(325000000, pll3, 1, 2),
3485 F_GFX3D(400000000, pll2, 1, 2),
3486 F_END
3487};
3488
Tianyi Gou41515e22011-09-01 19:37:43 -07003489static struct clk_freq_tbl clk_tbl_gfx3d_8960[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003490 F_GFX3D( 0, gnd, 0, 0),
3491 F_GFX3D( 27000000, pxo, 0, 0),
3492 F_GFX3D( 48000000, pll8, 1, 8),
3493 F_GFX3D( 54857000, pll8, 1, 7),
3494 F_GFX3D( 64000000, pll8, 1, 6),
3495 F_GFX3D( 76800000, pll8, 1, 5),
3496 F_GFX3D( 96000000, pll8, 1, 4),
3497 F_GFX3D(128000000, pll8, 1, 3),
3498 F_GFX3D(145455000, pll2, 2, 11),
3499 F_GFX3D(160000000, pll2, 1, 5),
3500 F_GFX3D(177778000, pll2, 2, 9),
3501 F_GFX3D(200000000, pll2, 1, 4),
3502 F_GFX3D(228571000, pll2, 2, 7),
3503 F_GFX3D(266667000, pll2, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003504 F_GFX3D(300000000, pll3, 1, 4),
3505 F_GFX3D(320000000, pll2, 2, 5),
3506 F_GFX3D(400000000, pll2, 1, 2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003507 F_END
3508};
3509
Tianyi Gou41515e22011-09-01 19:37:43 -07003510static struct clk_freq_tbl clk_tbl_gfx3d_8064[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003511 F_GFX3D( 0, gnd, 0, 0),
3512 F_GFX3D( 27000000, pxo, 0, 0),
3513 F_GFX3D( 48000000, pll8, 1, 8),
3514 F_GFX3D( 54857000, pll8, 1, 7),
3515 F_GFX3D( 64000000, pll8, 1, 6),
3516 F_GFX3D( 76800000, pll8, 1, 5),
3517 F_GFX3D( 96000000, pll8, 1, 4),
3518 F_GFX3D(128000000, pll8, 1, 3),
3519 F_GFX3D(145455000, pll2, 2, 11),
3520 F_GFX3D(160000000, pll2, 1, 5),
3521 F_GFX3D(177778000, pll2, 2, 9),
3522 F_GFX3D(200000000, pll2, 1, 4),
3523 F_GFX3D(228571000, pll2, 2, 7),
3524 F_GFX3D(266667000, pll2, 1, 3),
Tianyi Gou0c50fe32011-10-19 15:50:35 -07003525 F_GFX3D(325000000, pll15, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003526 F_GFX3D(400000000, pll2, 1, 2),
Tianyi Gou41515e22011-09-01 19:37:43 -07003527 F_END
3528};
3529
Tianyi Goue3d4f542012-03-15 17:06:45 -07003530static struct clk_freq_tbl clk_tbl_gfx3d_8930[] = {
3531 F_GFX3D( 0, gnd, 0, 0),
3532 F_GFX3D( 27000000, pxo, 0, 0),
3533 F_GFX3D( 48000000, pll8, 1, 8),
3534 F_GFX3D( 54857000, pll8, 1, 7),
3535 F_GFX3D( 64000000, pll8, 1, 6),
3536 F_GFX3D( 76800000, pll8, 1, 5),
3537 F_GFX3D( 96000000, pll8, 1, 4),
3538 F_GFX3D(128000000, pll8, 1, 3),
3539 F_GFX3D(145455000, pll2, 2, 11),
3540 F_GFX3D(160000000, pll2, 1, 5),
3541 F_GFX3D(177778000, pll2, 2, 9),
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003542 F_GFX3D(192000000, pll8, 1, 2),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003543 F_GFX3D(200000000, pll2, 1, 4),
3544 F_GFX3D(228571000, pll2, 2, 7),
3545 F_GFX3D(266667000, pll2, 1, 3),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003546 F_GFX3D(320000000, pll2, 2, 5),
3547 F_GFX3D(400000000, pll2, 1, 2),
3548 F_GFX3D(450000000, pll15, 1, 2),
3549 F_END
3550};
3551
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003552static unsigned long fmax_gfx3d_8064[MAX_VDD_LEVELS] __initdata = {
3553 [VDD_DIG_LOW] = 128000000,
3554 [VDD_DIG_NOMINAL] = 325000000,
3555 [VDD_DIG_HIGH] = 400000000
3556};
3557
Tianyi Goue3d4f542012-03-15 17:06:45 -07003558static unsigned long fmax_gfx3d_8930[MAX_VDD_LEVELS] __initdata = {
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003559 [VDD_DIG_LOW] = 192000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003560 [VDD_DIG_NOMINAL] = 320000000,
Patrick Dalyebe63c52012-08-07 15:41:30 -07003561 [VDD_DIG_HIGH] = 400000000
3562};
3563
3564static unsigned long fmax_gfx3d_8930aa[MAX_VDD_LEVELS] __initdata = {
3565 [VDD_DIG_LOW] = 192000000,
3566 [VDD_DIG_NOMINAL] = 320000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003567 [VDD_DIG_HIGH] = 450000000
3568};
3569
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003570static struct bank_masks bmnd_info_gfx3d = {
3571 .bank_sel_mask = BIT(11),
3572 .bank0_mask = {
3573 .md_reg = GFX3D_MD0_REG,
3574 .ns_mask = BM(21, 18) | BM(5, 3),
3575 .rst_mask = BIT(23),
3576 .mnd_en_mask = BIT(8),
3577 .mode_mask = BM(10, 9),
3578 },
3579 .bank1_mask = {
3580 .md_reg = GFX3D_MD1_REG,
3581 .ns_mask = BM(17, 14) | BM(2, 0),
3582 .rst_mask = BIT(22),
3583 .mnd_en_mask = BIT(5),
3584 .mode_mask = BM(7, 6),
3585 },
3586};
3587
3588static struct rcg_clk gfx3d_clk = {
3589 .b = {
3590 .ctl_reg = GFX3D_CC_REG,
3591 .en_mask = BIT(0),
3592 .reset_reg = SW_RESET_CORE_REG,
3593 .reset_mask = BIT(12),
3594 .halt_reg = DBG_BUS_VEC_A_REG,
3595 .halt_bit = 4,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003596 .retain_reg = GFX3D_CC_REG,
3597 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003598 },
3599 .ns_reg = GFX3D_NS_REG,
3600 .root_en_mask = BIT(2),
3601 .set_rate = set_rate_mnd_banked,
Tianyi Gou41515e22011-09-01 19:37:43 -07003602 .freq_tbl = clk_tbl_gfx3d_8960,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003603 .bank_info = &bmnd_info_gfx3d,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003604 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003605 .c = {
3606 .dbg_name = "gfx3d_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003607 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003608 VDD_DIG_FMAX_MAP3(LOW, 128000000, NOMINAL, 300000000,
3609 HIGH, 400000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003610 CLK_INIT(gfx3d_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003611 .depends = &gmem_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003612 },
3613};
3614
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003615#define F_VCAP(f, s, m, n) \
Tianyi Gou621f8742011-09-01 21:45:01 -07003616 { \
3617 .freq_hz = f, \
3618 .src_clk = &s##_clk.c, \
3619 .md_val = MD4(4, m, 0, n), \
3620 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3621 .ctl_val = CC_BANKED(9, 6, n), \
Tianyi Gou621f8742011-09-01 21:45:01 -07003622 }
3623
3624static struct clk_freq_tbl clk_tbl_vcap[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003625 F_VCAP( 0, gnd, 0, 0),
3626 F_VCAP( 27000000, pxo, 0, 0),
3627 F_VCAP( 54860000, pll8, 1, 7),
3628 F_VCAP( 64000000, pll8, 1, 6),
3629 F_VCAP( 76800000, pll8, 1, 5),
3630 F_VCAP(128000000, pll8, 1, 3),
3631 F_VCAP(160000000, pll2, 1, 5),
3632 F_VCAP(200000000, pll2, 1, 4),
Tianyi Gou621f8742011-09-01 21:45:01 -07003633 F_END
3634};
3635
3636static struct bank_masks bmnd_info_vcap = {
3637 .bank_sel_mask = BIT(11),
3638 .bank0_mask = {
3639 .md_reg = VCAP_MD0_REG,
3640 .ns_mask = BM(21, 18) | BM(5, 3),
3641 .rst_mask = BIT(23),
3642 .mnd_en_mask = BIT(8),
3643 .mode_mask = BM(10, 9),
3644 },
3645 .bank1_mask = {
3646 .md_reg = VCAP_MD1_REG,
3647 .ns_mask = BM(17, 14) | BM(2, 0),
3648 .rst_mask = BIT(22),
3649 .mnd_en_mask = BIT(5),
3650 .mode_mask = BM(7, 6),
3651 },
3652};
3653
3654static struct rcg_clk vcap_clk = {
3655 .b = {
3656 .ctl_reg = VCAP_CC_REG,
3657 .en_mask = BIT(0),
3658 .halt_reg = DBG_BUS_VEC_J_REG,
3659 .halt_bit = 15,
3660 },
3661 .ns_reg = VCAP_NS_REG,
3662 .root_en_mask = BIT(2),
3663 .set_rate = set_rate_mnd_banked,
3664 .freq_tbl = clk_tbl_vcap,
3665 .bank_info = &bmnd_info_vcap,
3666 .current_freq = &rcg_dummy_freq,
3667 .c = {
3668 .dbg_name = "vcap_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003669 .ops = &clk_ops_rcg,
Tianyi Gou621f8742011-09-01 21:45:01 -07003670 .depends = &vcap_axi_clk.c,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003671 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
Tianyi Gou621f8742011-09-01 21:45:01 -07003672 CLK_INIT(vcap_clk.c),
3673 },
3674};
3675
3676static struct branch_clk vcap_npl_clk = {
3677 .b = {
3678 .ctl_reg = VCAP_CC_REG,
3679 .en_mask = BIT(13),
3680 .halt_reg = DBG_BUS_VEC_J_REG,
3681 .halt_bit = 25,
3682 },
3683 .parent = &vcap_clk.c,
3684 .c = {
3685 .dbg_name = "vcap_npl_clk",
3686 .ops = &clk_ops_branch,
3687 CLK_INIT(vcap_npl_clk.c),
3688 },
3689};
3690
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003691#define F_IJPEG(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003692 { \
3693 .freq_hz = f, \
3694 .src_clk = &s##_clk.c, \
3695 .md_val = MD8(8, m, 0, n), \
3696 .ns_val = NS_MM(23, 16, n, m, 15, 12, d, 2, 0, s##_to_mm_mux), \
3697 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003698 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003699
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003700static struct clk_freq_tbl clk_tbl_ijpeg[] = {
3701 F_IJPEG( 0, gnd, 1, 0, 0),
3702 F_IJPEG( 27000000, pxo, 1, 0, 0),
3703 F_IJPEG( 36570000, pll8, 1, 2, 21),
3704 F_IJPEG( 54860000, pll8, 7, 0, 0),
3705 F_IJPEG( 96000000, pll8, 4, 0, 0),
3706 F_IJPEG(109710000, pll8, 1, 2, 7),
3707 F_IJPEG(128000000, pll8, 3, 0, 0),
3708 F_IJPEG(153600000, pll8, 1, 2, 5),
3709 F_IJPEG(200000000, pll2, 4, 0, 0),
3710 F_IJPEG(228571000, pll2, 1, 2, 7),
3711 F_IJPEG(266667000, pll2, 1, 1, 3),
3712 F_IJPEG(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003713 F_END
3714};
3715
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003716static unsigned long fmax_ijpeg_8064[MAX_VDD_LEVELS] __initdata = {
3717 [VDD_DIG_LOW] = 128000000,
3718 [VDD_DIG_NOMINAL] = 266667000,
3719 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07003720};
3721
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003722static struct rcg_clk ijpeg_clk = {
3723 .b = {
3724 .ctl_reg = IJPEG_CC_REG,
3725 .en_mask = BIT(0),
3726 .reset_reg = SW_RESET_CORE_REG,
3727 .reset_mask = BIT(9),
3728 .halt_reg = DBG_BUS_VEC_A_REG,
3729 .halt_bit = 24,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003730 .retain_reg = IJPEG_CC_REG,
3731 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003732 },
3733 .ns_reg = IJPEG_NS_REG,
3734 .md_reg = IJPEG_MD_REG,
3735 .root_en_mask = BIT(2),
3736 .ns_mask = (BM(23, 16) | BM(15, 12) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003737 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003738 .ctl_mask = BM(7, 6),
3739 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003740 .freq_tbl = clk_tbl_ijpeg,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003741 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003742 .c = {
3743 .dbg_name = "ijpeg_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003744 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003745 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
3746 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003747 CLK_INIT(ijpeg_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003748 .depends = &ijpeg_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003749 },
3750};
3751
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003752#define F_JPEGD(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003753 { \
3754 .freq_hz = f, \
3755 .src_clk = &s##_clk.c, \
3756 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003757 }
3758static struct clk_freq_tbl clk_tbl_jpegd[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003759 F_JPEGD( 0, gnd, 1),
3760 F_JPEGD( 64000000, pll8, 6),
3761 F_JPEGD( 76800000, pll8, 5),
3762 F_JPEGD( 96000000, pll8, 4),
3763 F_JPEGD(160000000, pll2, 5),
3764 F_JPEGD(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003765 F_END
3766};
3767
3768static struct rcg_clk jpegd_clk = {
3769 .b = {
3770 .ctl_reg = JPEGD_CC_REG,
3771 .en_mask = BIT(0),
3772 .reset_reg = SW_RESET_CORE_REG,
3773 .reset_mask = BIT(19),
3774 .halt_reg = DBG_BUS_VEC_A_REG,
3775 .halt_bit = 19,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003776 .retain_reg = JPEGD_CC_REG,
3777 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003778 },
3779 .ns_reg = JPEGD_NS_REG,
3780 .root_en_mask = BIT(2),
3781 .ns_mask = (BM(15, 12) | BM(2, 0)),
3782 .set_rate = set_rate_nop,
3783 .freq_tbl = clk_tbl_jpegd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003784 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003785 .c = {
3786 .dbg_name = "jpegd_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003787 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003788 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003789 CLK_INIT(jpegd_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003790 .depends = &jpegd_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003791 },
3792};
3793
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003794#define F_MDP(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003795 { \
3796 .freq_hz = f, \
3797 .src_clk = &s##_clk.c, \
3798 .md_val = MD8(8, m, 0, n), \
3799 .ns_val = NS_MND_BANKED8(22, 14, n, m, 3, 0, s##_to_mm_mux), \
3800 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003801 }
Patrick Dalye6f489042012-07-11 15:29:15 -07003802static struct clk_freq_tbl clk_tbl_mdp_8960ab[] = {
3803 F_MDP( 0, gnd, 0, 0),
3804 F_MDP( 9600000, pll8, 1, 40),
3805 F_MDP( 13710000, pll8, 1, 28),
3806 F_MDP( 27000000, pxo, 0, 0),
3807 F_MDP( 29540000, pll8, 1, 13),
3808 F_MDP( 34910000, pll8, 1, 11),
3809 F_MDP( 38400000, pll8, 1, 10),
3810 F_MDP( 59080000, pll8, 2, 13),
3811 F_MDP( 76800000, pll8, 1, 5),
3812 F_MDP( 85330000, pll8, 2, 9),
3813 F_MDP( 96000000, pll8, 1, 4),
3814 F_MDP(128000000, pll8, 1, 3),
3815 F_MDP(160000000, pll2, 1, 5),
3816 F_MDP(177780000, pll2, 2, 9),
3817 F_MDP(200000000, pll2, 1, 4),
3818 F_MDP(228571000, pll2, 2, 7),
3819 F_MDP(266667000, pll2, 1, 3),
3820 F_END
3821};
3822
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003823static struct clk_freq_tbl clk_tbl_mdp[] = {
3824 F_MDP( 0, gnd, 0, 0),
3825 F_MDP( 9600000, pll8, 1, 40),
3826 F_MDP( 13710000, pll8, 1, 28),
3827 F_MDP( 27000000, pxo, 0, 0),
3828 F_MDP( 29540000, pll8, 1, 13),
3829 F_MDP( 34910000, pll8, 1, 11),
3830 F_MDP( 38400000, pll8, 1, 10),
3831 F_MDP( 59080000, pll8, 2, 13),
3832 F_MDP( 76800000, pll8, 1, 5),
3833 F_MDP( 85330000, pll8, 2, 9),
3834 F_MDP( 96000000, pll8, 1, 4),
3835 F_MDP(128000000, pll8, 1, 3),
3836 F_MDP(160000000, pll2, 1, 5),
3837 F_MDP(177780000, pll2, 2, 9),
3838 F_MDP(200000000, pll2, 1, 4),
3839 F_MDP(266667000, pll2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003840 F_END
3841};
3842
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003843static unsigned long fmax_mdp_8064[MAX_VDD_LEVELS] __initdata = {
3844 [VDD_DIG_LOW] = 128000000,
3845 [VDD_DIG_NOMINAL] = 266667000
Tianyi Gou621f8742011-09-01 21:45:01 -07003846};
3847
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003848static struct bank_masks bmnd_info_mdp = {
3849 .bank_sel_mask = BIT(11),
3850 .bank0_mask = {
3851 .md_reg = MDP_MD0_REG,
3852 .ns_mask = BM(29, 22) | BM(5, 3),
3853 .rst_mask = BIT(31),
3854 .mnd_en_mask = BIT(8),
3855 .mode_mask = BM(10, 9),
3856 },
3857 .bank1_mask = {
3858 .md_reg = MDP_MD1_REG,
3859 .ns_mask = BM(21, 14) | BM(2, 0),
3860 .rst_mask = BIT(30),
3861 .mnd_en_mask = BIT(5),
3862 .mode_mask = BM(7, 6),
3863 },
3864};
3865
3866static struct rcg_clk mdp_clk = {
3867 .b = {
3868 .ctl_reg = MDP_CC_REG,
3869 .en_mask = BIT(0),
3870 .reset_reg = SW_RESET_CORE_REG,
3871 .reset_mask = BIT(21),
3872 .halt_reg = DBG_BUS_VEC_C_REG,
3873 .halt_bit = 10,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003874 .retain_reg = MDP_CC_REG,
3875 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003876 },
3877 .ns_reg = MDP_NS_REG,
3878 .root_en_mask = BIT(2),
3879 .set_rate = set_rate_mnd_banked,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003880 .freq_tbl = clk_tbl_mdp,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003881 .bank_info = &bmnd_info_mdp,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003882 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003883 .c = {
3884 .dbg_name = "mdp_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003885 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003886 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003887 CLK_INIT(mdp_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003888 .depends = &mdp_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003889 },
3890};
3891
3892static struct branch_clk lut_mdp_clk = {
3893 .b = {
3894 .ctl_reg = MDP_LUT_CC_REG,
3895 .en_mask = BIT(0),
3896 .halt_reg = DBG_BUS_VEC_I_REG,
3897 .halt_bit = 13,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003898 .retain_reg = MDP_LUT_CC_REG,
3899 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003900 },
3901 .parent = &mdp_clk.c,
3902 .c = {
3903 .dbg_name = "lut_mdp_clk",
3904 .ops = &clk_ops_branch,
3905 CLK_INIT(lut_mdp_clk.c),
3906 },
3907};
3908
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003909#define F_MDP_VSYNC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003910 { \
3911 .freq_hz = f, \
3912 .src_clk = &s##_clk.c, \
3913 .ns_val = NS_SRC_SEL(13, 13, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003914 }
3915static struct clk_freq_tbl clk_tbl_mdp_vsync[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003916 F_MDP_VSYNC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003917 F_END
3918};
3919
3920static struct rcg_clk mdp_vsync_clk = {
3921 .b = {
3922 .ctl_reg = MISC_CC_REG,
3923 .en_mask = BIT(6),
3924 .reset_reg = SW_RESET_CORE_REG,
3925 .reset_mask = BIT(3),
3926 .halt_reg = DBG_BUS_VEC_B_REG,
3927 .halt_bit = 22,
3928 },
3929 .ns_reg = MISC_CC2_REG,
3930 .ns_mask = BIT(13),
3931 .set_rate = set_rate_nop,
3932 .freq_tbl = clk_tbl_mdp_vsync,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003933 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003934 .c = {
3935 .dbg_name = "mdp_vsync_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003936 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003937 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003938 CLK_INIT(mdp_vsync_clk.c),
3939 },
3940};
3941
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003942#define F_ROT(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003943 { \
3944 .freq_hz = f, \
3945 .src_clk = &s##_clk.c, \
3946 .ns_val = NS_DIVSRC_BANKED(29, 26, 25, 22, d, \
3947 21, 19, 18, 16, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003948 }
3949static struct clk_freq_tbl clk_tbl_rot[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003950 F_ROT( 0, gnd, 1),
3951 F_ROT( 27000000, pxo, 1),
3952 F_ROT( 29540000, pll8, 13),
3953 F_ROT( 32000000, pll8, 12),
3954 F_ROT( 38400000, pll8, 10),
3955 F_ROT( 48000000, pll8, 8),
3956 F_ROT( 54860000, pll8, 7),
3957 F_ROT( 64000000, pll8, 6),
3958 F_ROT( 76800000, pll8, 5),
3959 F_ROT( 96000000, pll8, 4),
3960 F_ROT(100000000, pll2, 8),
3961 F_ROT(114290000, pll2, 7),
3962 F_ROT(133330000, pll2, 6),
3963 F_ROT(160000000, pll2, 5),
3964 F_ROT(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003965 F_END
3966};
3967
3968static struct bank_masks bdiv_info_rot = {
3969 .bank_sel_mask = BIT(30),
3970 .bank0_mask = {
3971 .ns_mask = BM(25, 22) | BM(18, 16),
3972 },
3973 .bank1_mask = {
3974 .ns_mask = BM(29, 26) | BM(21, 19),
3975 },
3976};
3977
3978static struct rcg_clk rot_clk = {
3979 .b = {
3980 .ctl_reg = ROT_CC_REG,
3981 .en_mask = BIT(0),
3982 .reset_reg = SW_RESET_CORE_REG,
3983 .reset_mask = BIT(2),
3984 .halt_reg = DBG_BUS_VEC_C_REG,
3985 .halt_bit = 15,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003986 .retain_reg = ROT_CC_REG,
3987 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003988 },
3989 .ns_reg = ROT_NS_REG,
3990 .root_en_mask = BIT(2),
3991 .set_rate = set_rate_div_banked,
3992 .freq_tbl = clk_tbl_rot,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003993 .bank_info = &bdiv_info_rot,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003994 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003995 .c = {
3996 .dbg_name = "rot_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003997 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003998 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003999 CLK_INIT(rot_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004000 .depends = &rot_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004001 },
4002};
4003
Matt Wagantallf82f2942012-01-27 13:56:13 -08004004static int hdmi_pll_clk_enable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004005{
4006 int ret;
4007 unsigned long flags;
4008 spin_lock_irqsave(&local_clock_reg_lock, flags);
4009 ret = hdmi_pll_enable();
4010 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4011 return ret;
4012}
4013
Matt Wagantallf82f2942012-01-27 13:56:13 -08004014static void hdmi_pll_clk_disable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004015{
4016 unsigned long flags;
4017 spin_lock_irqsave(&local_clock_reg_lock, flags);
4018 hdmi_pll_disable();
4019 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4020}
4021
Matt Wagantallf82f2942012-01-27 13:56:13 -08004022static struct clk *hdmi_pll_clk_get_parent(struct clk *c)
Stephen Boyd5b35dee2011-09-21 12:17:38 -07004023{
4024 return &pxo_clk.c;
4025}
4026
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004027static struct clk_ops clk_ops_hdmi_pll = {
4028 .enable = hdmi_pll_clk_enable,
4029 .disable = hdmi_pll_clk_disable,
Stephen Boyd5b35dee2011-09-21 12:17:38 -07004030 .get_parent = hdmi_pll_clk_get_parent,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004031};
4032
4033static struct clk hdmi_pll_clk = {
4034 .dbg_name = "hdmi_pll_clk",
4035 .ops = &clk_ops_hdmi_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -07004036 .vdd_class = &vdd_sr2_hdmi_pll,
4037 .fmax[VDD_SR2_HDMI_PLL_ON] = ULONG_MAX,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004038 CLK_INIT(hdmi_pll_clk),
4039};
4040
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004041#define F_TV_GND(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004042 { \
4043 .freq_hz = f, \
4044 .src_clk = &s##_clk.c, \
4045 .md_val = MD8(8, m, 0, n), \
4046 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
4047 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004048 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004049#define F_TV(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004050 { \
4051 .freq_hz = f, \
4052 .src_clk = &s##_clk, \
4053 .md_val = MD8(8, m, 0, n), \
4054 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
4055 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004056 .extra_freq_data = (void *)p_r, \
4057 }
4058/* Switching TV freqs requires PLL reconfiguration. */
4059static struct clk_freq_tbl clk_tbl_tv[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004060 F_TV_GND( 0, gnd, 0, 1, 0, 0),
4061 F_TV( 25200000, hdmi_pll, 25200000, 1, 0, 0),
4062 F_TV( 27000000, hdmi_pll, 27000000, 1, 0, 0),
4063 F_TV( 27030000, hdmi_pll, 27030000, 1, 0, 0),
4064 F_TV( 74250000, hdmi_pll, 74250000, 1, 0, 0),
4065 F_TV(148500000, hdmi_pll, 148500000, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004066 F_END
4067};
4068
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004069static unsigned long fmax_tv_src_8064[MAX_VDD_LEVELS] __initdata = {
4070 [VDD_DIG_LOW] = 74250000,
4071 [VDD_DIG_NOMINAL] = 149000000
4072};
4073
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004074/*
4075 * Unlike other clocks, the TV rate is adjusted through PLL
4076 * re-programming. It is also routed through an MND divider.
4077 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08004078void set_rate_tv(struct rcg_clk *rcg, struct clk_freq_tbl *nf)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004079{
4080 unsigned long pll_rate = (unsigned long)nf->extra_freq_data;
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004081 if (pll_rate) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004082 hdmi_pll_set_rate(pll_rate);
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004083 hdmi_pll_clk.rate = pll_rate;
4084 }
Matt Wagantallf82f2942012-01-27 13:56:13 -08004085 set_rate_mnd(rcg, nf);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004086}
4087
4088static struct rcg_clk tv_src_clk = {
4089 .ns_reg = TV_NS_REG,
4090 .b = {
4091 .ctl_reg = TV_CC_REG,
4092 .halt_check = NOCHECK,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004093 .retain_reg = TV_CC_REG,
4094 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004095 },
4096 .md_reg = TV_MD_REG,
4097 .root_en_mask = BIT(2),
4098 .ns_mask = (BM(23, 16) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004099 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004100 .ctl_mask = BM(7, 6),
4101 .set_rate = set_rate_tv,
4102 .freq_tbl = clk_tbl_tv,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004103 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004104 .c = {
4105 .dbg_name = "tv_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004106 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004107 VDD_DIG_FMAX_MAP2(LOW, 27030000, NOMINAL, 149000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004108 CLK_INIT(tv_src_clk.c),
4109 },
4110};
4111
Tianyi Gou51918802012-01-26 14:05:43 -08004112static struct cdiv_clk tv_src_div_clk = {
4113 .b = {
4114 .ctl_reg = TV_NS_REG,
4115 .halt_check = NOCHECK,
4116 },
4117 .ns_reg = TV_NS_REG,
4118 .div_offset = 6,
4119 .max_div = 2,
4120 .c = {
4121 .dbg_name = "tv_src_div_clk",
4122 .ops = &clk_ops_cdiv,
4123 CLK_INIT(tv_src_div_clk.c),
Stephen Boydd51d5e82012-06-18 18:09:50 -07004124 .rate = ULONG_MAX,
Tianyi Gou51918802012-01-26 14:05:43 -08004125 },
4126};
4127
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004128static struct branch_clk tv_enc_clk = {
4129 .b = {
4130 .ctl_reg = TV_CC_REG,
4131 .en_mask = BIT(8),
4132 .reset_reg = SW_RESET_CORE_REG,
4133 .reset_mask = BIT(0),
4134 .halt_reg = DBG_BUS_VEC_D_REG,
4135 .halt_bit = 9,
4136 },
4137 .parent = &tv_src_clk.c,
4138 .c = {
4139 .dbg_name = "tv_enc_clk",
4140 .ops = &clk_ops_branch,
4141 CLK_INIT(tv_enc_clk.c),
4142 },
4143};
4144
4145static struct branch_clk tv_dac_clk = {
4146 .b = {
4147 .ctl_reg = TV_CC_REG,
4148 .en_mask = BIT(10),
4149 .halt_reg = DBG_BUS_VEC_D_REG,
4150 .halt_bit = 10,
4151 },
4152 .parent = &tv_src_clk.c,
4153 .c = {
4154 .dbg_name = "tv_dac_clk",
4155 .ops = &clk_ops_branch,
4156 CLK_INIT(tv_dac_clk.c),
4157 },
4158};
4159
4160static struct branch_clk mdp_tv_clk = {
4161 .b = {
4162 .ctl_reg = TV_CC_REG,
4163 .en_mask = BIT(0),
4164 .reset_reg = SW_RESET_CORE_REG,
4165 .reset_mask = BIT(4),
4166 .halt_reg = DBG_BUS_VEC_D_REG,
4167 .halt_bit = 12,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004168 .retain_reg = TV_CC2_REG,
4169 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004170 },
4171 .parent = &tv_src_clk.c,
4172 .c = {
4173 .dbg_name = "mdp_tv_clk",
4174 .ops = &clk_ops_branch,
4175 CLK_INIT(mdp_tv_clk.c),
4176 },
4177};
4178
4179static struct branch_clk hdmi_tv_clk = {
4180 .b = {
4181 .ctl_reg = TV_CC_REG,
4182 .en_mask = BIT(12),
4183 .reset_reg = SW_RESET_CORE_REG,
4184 .reset_mask = BIT(1),
4185 .halt_reg = DBG_BUS_VEC_D_REG,
4186 .halt_bit = 11,
4187 },
4188 .parent = &tv_src_clk.c,
4189 .c = {
4190 .dbg_name = "hdmi_tv_clk",
4191 .ops = &clk_ops_branch,
4192 CLK_INIT(hdmi_tv_clk.c),
4193 },
4194};
4195
Tianyi Gou51918802012-01-26 14:05:43 -08004196static struct branch_clk rgb_tv_clk = {
4197 .b = {
4198 .ctl_reg = TV_CC2_REG,
4199 .en_mask = BIT(14),
4200 .halt_reg = DBG_BUS_VEC_J_REG,
4201 .halt_bit = 27,
4202 },
4203 .parent = &tv_src_clk.c,
4204 .c = {
4205 .dbg_name = "rgb_tv_clk",
4206 .ops = &clk_ops_branch,
4207 CLK_INIT(rgb_tv_clk.c),
4208 },
4209};
4210
4211static struct branch_clk npl_tv_clk = {
4212 .b = {
4213 .ctl_reg = TV_CC2_REG,
4214 .en_mask = BIT(16),
4215 .halt_reg = DBG_BUS_VEC_J_REG,
4216 .halt_bit = 26,
4217 },
4218 .parent = &tv_src_clk.c,
4219 .c = {
4220 .dbg_name = "npl_tv_clk",
4221 .ops = &clk_ops_branch,
4222 CLK_INIT(npl_tv_clk.c),
4223 },
4224};
4225
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004226static struct branch_clk hdmi_app_clk = {
4227 .b = {
4228 .ctl_reg = MISC_CC2_REG,
4229 .en_mask = BIT(11),
4230 .reset_reg = SW_RESET_CORE_REG,
4231 .reset_mask = BIT(11),
4232 .halt_reg = DBG_BUS_VEC_B_REG,
4233 .halt_bit = 25,
4234 },
4235 .c = {
4236 .dbg_name = "hdmi_app_clk",
4237 .ops = &clk_ops_branch,
4238 CLK_INIT(hdmi_app_clk.c),
4239 },
4240};
4241
4242static struct bank_masks bmnd_info_vcodec = {
4243 .bank_sel_mask = BIT(13),
4244 .bank0_mask = {
4245 .md_reg = VCODEC_MD0_REG,
4246 .ns_mask = BM(18, 11) | BM(2, 0),
4247 .rst_mask = BIT(31),
4248 .mnd_en_mask = BIT(5),
4249 .mode_mask = BM(7, 6),
4250 },
4251 .bank1_mask = {
4252 .md_reg = VCODEC_MD1_REG,
4253 .ns_mask = BM(26, 19) | BM(29, 27),
4254 .rst_mask = BIT(30),
4255 .mnd_en_mask = BIT(10),
4256 .mode_mask = BM(12, 11),
4257 },
4258};
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004259#define F_VCODEC(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004260 { \
4261 .freq_hz = f, \
4262 .src_clk = &s##_clk.c, \
4263 .md_val = MD8(8, m, 0, n), \
4264 .ns_val = NS_MND_BANKED8(11, 19, n, m, 0, 27, s##_to_mm_mux), \
4265 .ctl_val = CC_BANKED(6, 11, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004266 }
4267static struct clk_freq_tbl clk_tbl_vcodec[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004268 F_VCODEC( 0, gnd, 0, 0),
4269 F_VCODEC( 27000000, pxo, 0, 0),
4270 F_VCODEC( 32000000, pll8, 1, 12),
4271 F_VCODEC( 48000000, pll8, 1, 8),
4272 F_VCODEC( 54860000, pll8, 1, 7),
4273 F_VCODEC( 96000000, pll8, 1, 4),
4274 F_VCODEC(133330000, pll2, 1, 6),
4275 F_VCODEC(200000000, pll2, 1, 4),
4276 F_VCODEC(228570000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004277 F_END
4278};
4279
4280static struct rcg_clk vcodec_clk = {
4281 .b = {
4282 .ctl_reg = VCODEC_CC_REG,
4283 .en_mask = BIT(0),
4284 .reset_reg = SW_RESET_CORE_REG,
4285 .reset_mask = BIT(6),
4286 .halt_reg = DBG_BUS_VEC_C_REG,
4287 .halt_bit = 29,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004288 .retain_reg = VCODEC_CC_REG,
4289 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004290 },
4291 .ns_reg = VCODEC_NS_REG,
4292 .root_en_mask = BIT(2),
4293 .set_rate = set_rate_mnd_banked,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004294 .bank_info = &bmnd_info_vcodec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004295 .freq_tbl = clk_tbl_vcodec,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004296 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004297 .c = {
4298 .dbg_name = "vcodec_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004299 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004300 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
4301 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004302 CLK_INIT(vcodec_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004303 .depends = &vcodec_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004304 },
4305};
4306
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004307#define F_VPE(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004308 { \
4309 .freq_hz = f, \
4310 .src_clk = &s##_clk.c, \
4311 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004312 }
4313static struct clk_freq_tbl clk_tbl_vpe[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004314 F_VPE( 0, gnd, 1),
4315 F_VPE( 27000000, pxo, 1),
4316 F_VPE( 34909000, pll8, 11),
4317 F_VPE( 38400000, pll8, 10),
4318 F_VPE( 64000000, pll8, 6),
4319 F_VPE( 76800000, pll8, 5),
4320 F_VPE( 96000000, pll8, 4),
4321 F_VPE(100000000, pll2, 8),
4322 F_VPE(160000000, pll2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004323 F_END
4324};
4325
4326static struct rcg_clk vpe_clk = {
4327 .b = {
4328 .ctl_reg = VPE_CC_REG,
4329 .en_mask = BIT(0),
4330 .reset_reg = SW_RESET_CORE_REG,
4331 .reset_mask = BIT(17),
4332 .halt_reg = DBG_BUS_VEC_A_REG,
4333 .halt_bit = 28,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004334 .retain_reg = VPE_CC_REG,
4335 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004336 },
4337 .ns_reg = VPE_NS_REG,
4338 .root_en_mask = BIT(2),
4339 .ns_mask = (BM(15, 12) | BM(2, 0)),
4340 .set_rate = set_rate_nop,
4341 .freq_tbl = clk_tbl_vpe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004342 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004343 .c = {
4344 .dbg_name = "vpe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004345 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004346 VDD_DIG_FMAX_MAP2(LOW, 76800000, NOMINAL, 160000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004347 CLK_INIT(vpe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004348 .depends = &vpe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004349 },
4350};
4351
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004352#define F_VFE(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004353 { \
4354 .freq_hz = f, \
4355 .src_clk = &s##_clk.c, \
4356 .md_val = MD8(8, m, 0, n), \
4357 .ns_val = NS_MM(23, 16, n, m, 11, 10, d, 2, 0, s##_to_mm_mux), \
4358 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004359 }
Tianyi Gou41515e22011-09-01 19:37:43 -07004360
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004361static struct clk_freq_tbl clk_tbl_vfe[] = {
4362 F_VFE( 0, gnd, 1, 0, 0),
4363 F_VFE( 13960000, pll8, 1, 2, 55),
4364 F_VFE( 27000000, pxo, 1, 0, 0),
4365 F_VFE( 36570000, pll8, 1, 2, 21),
4366 F_VFE( 38400000, pll8, 2, 1, 5),
4367 F_VFE( 45180000, pll8, 1, 2, 17),
4368 F_VFE( 48000000, pll8, 2, 1, 4),
4369 F_VFE( 54860000, pll8, 1, 1, 7),
4370 F_VFE( 64000000, pll8, 2, 1, 3),
4371 F_VFE( 76800000, pll8, 1, 1, 5),
4372 F_VFE( 96000000, pll8, 2, 1, 2),
4373 F_VFE(109710000, pll8, 1, 2, 7),
4374 F_VFE(128000000, pll8, 1, 1, 3),
4375 F_VFE(153600000, pll8, 1, 2, 5),
4376 F_VFE(200000000, pll2, 2, 1, 2),
4377 F_VFE(228570000, pll2, 1, 2, 7),
4378 F_VFE(266667000, pll2, 1, 1, 3),
4379 F_VFE(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004380 F_END
4381};
4382
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004383static unsigned long fmax_vfe_8064[MAX_VDD_LEVELS] __initdata = {
4384 [VDD_DIG_LOW] = 128000000,
4385 [VDD_DIG_NOMINAL] = 266667000,
4386 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07004387};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004388
4389static struct rcg_clk vfe_clk = {
4390 .b = {
4391 .ctl_reg = VFE_CC_REG,
4392 .reset_reg = SW_RESET_CORE_REG,
4393 .reset_mask = BIT(15),
4394 .halt_reg = DBG_BUS_VEC_B_REG,
4395 .halt_bit = 6,
4396 .en_mask = BIT(0),
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004397 .retain_reg = VFE_CC2_REG,
4398 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004399 },
4400 .ns_reg = VFE_NS_REG,
4401 .md_reg = VFE_MD_REG,
4402 .root_en_mask = BIT(2),
4403 .ns_mask = (BM(23, 16) | BM(11, 10) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004404 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004405 .ctl_mask = BM(7, 6),
4406 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004407 .freq_tbl = clk_tbl_vfe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004408 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004409 .c = {
4410 .dbg_name = "vfe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004411 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08004412 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
4413 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004414 CLK_INIT(vfe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004415 .depends = &vfe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004416 },
4417};
4418
Matt Wagantallc23eee92011-08-16 23:06:52 -07004419static struct branch_clk csi_vfe_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004420 .b = {
4421 .ctl_reg = VFE_CC_REG,
4422 .en_mask = BIT(12),
4423 .reset_reg = SW_RESET_CORE_REG,
4424 .reset_mask = BIT(24),
4425 .halt_reg = DBG_BUS_VEC_B_REG,
4426 .halt_bit = 8,
4427 },
4428 .parent = &vfe_clk.c,
4429 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -07004430 .dbg_name = "csi_vfe_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004431 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -07004432 CLK_INIT(csi_vfe_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004433 },
4434};
4435
4436/*
4437 * Low Power Audio Clocks
4438 */
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004439#define F_AIF_OSR(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004440 { \
4441 .freq_hz = f, \
4442 .src_clk = &s##_clk.c, \
4443 .md_val = MD8(8, m, 0, n), \
4444 .ns_val = NS(31, 24, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004445 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004446static struct clk_freq_tbl clk_tbl_aif_osr_492[] = {
4447 F_AIF_OSR( 0, gnd, 1, 0, 0),
4448 F_AIF_OSR( 512000, pll4, 4, 1, 240),
4449 F_AIF_OSR( 768000, pll4, 4, 1, 160),
4450 F_AIF_OSR( 1024000, pll4, 4, 1, 120),
4451 F_AIF_OSR( 1536000, pll4, 4, 1, 80),
4452 F_AIF_OSR( 2048000, pll4, 4, 1, 60),
4453 F_AIF_OSR( 3072000, pll4, 4, 1, 40),
4454 F_AIF_OSR( 4096000, pll4, 4, 1, 30),
4455 F_AIF_OSR( 6144000, pll4, 4, 1, 20),
4456 F_AIF_OSR( 8192000, pll4, 4, 1, 15),
4457 F_AIF_OSR(12288000, pll4, 4, 1, 10),
4458 F_AIF_OSR(24576000, pll4, 4, 1, 5),
4459 F_END
4460};
4461
4462static struct clk_freq_tbl clk_tbl_aif_osr_393[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004463 F_AIF_OSR( 0, gnd, 1, 0, 0),
4464 F_AIF_OSR( 512000, pll4, 4, 1, 192),
4465 F_AIF_OSR( 768000, pll4, 4, 1, 128),
4466 F_AIF_OSR( 1024000, pll4, 4, 1, 96),
4467 F_AIF_OSR( 1536000, pll4, 4, 1, 64),
4468 F_AIF_OSR( 2048000, pll4, 4, 1, 48),
4469 F_AIF_OSR( 3072000, pll4, 4, 1, 32),
4470 F_AIF_OSR( 4096000, pll4, 4, 1, 24),
4471 F_AIF_OSR( 6144000, pll4, 4, 1, 16),
4472 F_AIF_OSR( 8192000, pll4, 4, 1, 12),
4473 F_AIF_OSR(12288000, pll4, 4, 1, 8),
4474 F_AIF_OSR(24576000, pll4, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004475 F_END
4476};
4477
4478#define CLK_AIF_OSR(i, ns, md, h_r) \
4479 struct rcg_clk i##_clk = { \
4480 .b = { \
4481 .ctl_reg = ns, \
4482 .en_mask = BIT(17), \
4483 .reset_reg = ns, \
4484 .reset_mask = BIT(19), \
4485 .halt_reg = h_r, \
4486 .halt_check = ENABLE, \
4487 .halt_bit = 1, \
4488 }, \
4489 .ns_reg = ns, \
4490 .md_reg = md, \
4491 .root_en_mask = BIT(9), \
4492 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004493 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004494 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004495 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004496 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004497 .c = { \
4498 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004499 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004500 VDD_DIG_FMAX_MAP1(LOW, 24576000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004501 CLK_INIT(i##_clk.c), \
4502 }, \
4503 }
4504#define CLK_AIF_OSR_DIV(i, ns, md, h_r) \
4505 struct rcg_clk i##_clk = { \
4506 .b = { \
4507 .ctl_reg = ns, \
4508 .en_mask = BIT(21), \
4509 .reset_reg = ns, \
4510 .reset_mask = BIT(23), \
4511 .halt_reg = h_r, \
4512 .halt_check = ENABLE, \
4513 .halt_bit = 1, \
4514 }, \
4515 .ns_reg = ns, \
4516 .md_reg = md, \
4517 .root_en_mask = BIT(9), \
4518 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004519 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004520 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004521 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004522 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004523 .c = { \
4524 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004525 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004526 VDD_DIG_FMAX_MAP1(LOW, 24576000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004527 CLK_INIT(i##_clk.c), \
4528 }, \
4529 }
4530
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004531#define CLK_AIF_BIT(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004532 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004533 .b = { \
4534 .ctl_reg = ns, \
4535 .en_mask = BIT(15), \
4536 .halt_reg = h_r, \
4537 .halt_check = DELAY, \
4538 }, \
4539 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004540 .ext_mask = BIT(14), \
4541 .div_offset = 10, \
4542 .max_div = 16, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004543 .c = { \
4544 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004545 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004546 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004547 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004548 }, \
4549 }
4550
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004551#define CLK_AIF_BIT_DIV(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004552 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004553 .b = { \
4554 .ctl_reg = ns, \
4555 .en_mask = BIT(19), \
4556 .halt_reg = h_r, \
Stephen Boyd7bb9cf82012-01-25 18:09:01 -08004557 .halt_check = DELAY, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004558 }, \
4559 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004560 .ext_mask = BIT(18), \
4561 .div_offset = 10, \
4562 .max_div = 256, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004563 .c = { \
4564 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004565 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004566 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004567 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004568 }, \
4569 }
4570
4571static CLK_AIF_OSR(mi2s_osr, LCC_MI2S_NS_REG, LCC_MI2S_MD_REG,
4572 LCC_MI2S_STATUS_REG);
4573static CLK_AIF_BIT(mi2s_bit, LCC_MI2S_NS_REG, LCC_MI2S_STATUS_REG);
4574
4575static CLK_AIF_OSR_DIV(codec_i2s_mic_osr, LCC_CODEC_I2S_MIC_NS_REG,
4576 LCC_CODEC_I2S_MIC_MD_REG, LCC_CODEC_I2S_MIC_STATUS_REG);
4577static CLK_AIF_BIT_DIV(codec_i2s_mic_bit, LCC_CODEC_I2S_MIC_NS_REG,
4578 LCC_CODEC_I2S_MIC_STATUS_REG);
4579
4580static CLK_AIF_OSR_DIV(spare_i2s_mic_osr, LCC_SPARE_I2S_MIC_NS_REG,
4581 LCC_SPARE_I2S_MIC_MD_REG, LCC_SPARE_I2S_MIC_STATUS_REG);
4582static CLK_AIF_BIT_DIV(spare_i2s_mic_bit, LCC_SPARE_I2S_MIC_NS_REG,
4583 LCC_SPARE_I2S_MIC_STATUS_REG);
4584
4585static CLK_AIF_OSR_DIV(codec_i2s_spkr_osr, LCC_CODEC_I2S_SPKR_NS_REG,
4586 LCC_CODEC_I2S_SPKR_MD_REG, LCC_CODEC_I2S_SPKR_STATUS_REG);
4587static CLK_AIF_BIT_DIV(codec_i2s_spkr_bit, LCC_CODEC_I2S_SPKR_NS_REG,
4588 LCC_CODEC_I2S_SPKR_STATUS_REG);
4589
4590static CLK_AIF_OSR_DIV(spare_i2s_spkr_osr, LCC_SPARE_I2S_SPKR_NS_REG,
4591 LCC_SPARE_I2S_SPKR_MD_REG, LCC_SPARE_I2S_SPKR_STATUS_REG);
4592static CLK_AIF_BIT_DIV(spare_i2s_spkr_bit, LCC_SPARE_I2S_SPKR_NS_REG,
4593 LCC_SPARE_I2S_SPKR_STATUS_REG);
4594
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004595#define F_PCM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004596 { \
4597 .freq_hz = f, \
4598 .src_clk = &s##_clk.c, \
4599 .md_val = MD16(m, n), \
4600 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004601 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004602static struct clk_freq_tbl clk_tbl_pcm_492[] = {
4603 { .ns_val = BIT(10) /* external input */ },
Stephen Boyde9ed94d2012-08-02 10:57:11 -07004604 F_PCM( 256000, pll4, 4, 1, 480),
Matt Wagantall86e03822011-12-12 10:59:24 -08004605 F_PCM( 512000, pll4, 4, 1, 240),
4606 F_PCM( 768000, pll4, 4, 1, 160),
4607 F_PCM( 1024000, pll4, 4, 1, 120),
4608 F_PCM( 1536000, pll4, 4, 1, 80),
4609 F_PCM( 2048000, pll4, 4, 1, 60),
4610 F_PCM( 3072000, pll4, 4, 1, 40),
4611 F_PCM( 4096000, pll4, 4, 1, 30),
4612 F_PCM( 6144000, pll4, 4, 1, 20),
4613 F_PCM( 8192000, pll4, 4, 1, 15),
4614 F_PCM(12288000, pll4, 4, 1, 10),
4615 F_PCM(24576000, pll4, 4, 1, 5),
4616 F_END
4617};
4618
4619static struct clk_freq_tbl clk_tbl_pcm_393[] = {
Stephen Boyd630f3252012-01-31 00:10:08 -08004620 { .ns_val = BIT(10) /* external input */ },
Stephen Boyde9ed94d2012-08-02 10:57:11 -07004621 F_PCM( 256000, pll4, 4, 1, 384),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004622 F_PCM( 512000, pll4, 4, 1, 192),
4623 F_PCM( 768000, pll4, 4, 1, 128),
4624 F_PCM( 1024000, pll4, 4, 1, 96),
4625 F_PCM( 1536000, pll4, 4, 1, 64),
4626 F_PCM( 2048000, pll4, 4, 1, 48),
4627 F_PCM( 3072000, pll4, 4, 1, 32),
4628 F_PCM( 4096000, pll4, 4, 1, 24),
4629 F_PCM( 6144000, pll4, 4, 1, 16),
4630 F_PCM( 8192000, pll4, 4, 1, 12),
4631 F_PCM(12288000, pll4, 4, 1, 8),
4632 F_PCM(24576000, pll4, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004633 F_END
4634};
4635
4636static struct rcg_clk pcm_clk = {
4637 .b = {
4638 .ctl_reg = LCC_PCM_NS_REG,
4639 .en_mask = BIT(11),
4640 .reset_reg = LCC_PCM_NS_REG,
4641 .reset_mask = BIT(13),
4642 .halt_reg = LCC_PCM_STATUS_REG,
4643 .halt_check = ENABLE,
4644 .halt_bit = 0,
4645 },
4646 .ns_reg = LCC_PCM_NS_REG,
4647 .md_reg = LCC_PCM_MD_REG,
4648 .root_en_mask = BIT(9),
Stephen Boyd630f3252012-01-31 00:10:08 -08004649 .ns_mask = BM(31, 16) | BIT(10) | BM(6, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08004650 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004651 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004652 .freq_tbl = clk_tbl_pcm_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004653 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004654 .c = {
4655 .dbg_name = "pcm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004656 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004657 VDD_DIG_FMAX_MAP1(LOW, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004658 CLK_INIT(pcm_clk.c),
Stephen Boydc5492fc2012-06-18 18:47:03 -07004659 .rate = ULONG_MAX,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004660 },
4661};
4662
4663static struct rcg_clk audio_slimbus_clk = {
4664 .b = {
4665 .ctl_reg = LCC_SLIMBUS_NS_REG,
4666 .en_mask = BIT(10),
4667 .reset_reg = LCC_AHBEX_BRANCH_CTL_REG,
4668 .reset_mask = BIT(5),
4669 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4670 .halt_check = ENABLE,
4671 .halt_bit = 0,
4672 },
4673 .ns_reg = LCC_SLIMBUS_NS_REG,
4674 .md_reg = LCC_SLIMBUS_MD_REG,
4675 .root_en_mask = BIT(9),
4676 .ns_mask = (BM(31, 24) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004677 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004678 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004679 .freq_tbl = clk_tbl_aif_osr_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004680 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004681 .c = {
4682 .dbg_name = "audio_slimbus_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004683 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004684 VDD_DIG_FMAX_MAP1(LOW, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004685 CLK_INIT(audio_slimbus_clk.c),
4686 },
4687};
4688
4689static struct branch_clk sps_slimbus_clk = {
4690 .b = {
4691 .ctl_reg = LCC_SLIMBUS_NS_REG,
4692 .en_mask = BIT(12),
4693 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4694 .halt_check = ENABLE,
4695 .halt_bit = 1,
4696 },
4697 .parent = &audio_slimbus_clk.c,
4698 .c = {
4699 .dbg_name = "sps_slimbus_clk",
4700 .ops = &clk_ops_branch,
4701 CLK_INIT(sps_slimbus_clk.c),
4702 },
4703};
4704
4705static struct branch_clk slimbus_xo_src_clk = {
4706 .b = {
4707 .ctl_reg = SLIMBUS_XO_SRC_CLK_CTL_REG,
4708 .en_mask = BIT(2),
4709 .halt_reg = CLK_HALT_DFAB_STATE_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004710 .halt_bit = 28,
4711 },
4712 .parent = &sps_slimbus_clk.c,
4713 .c = {
4714 .dbg_name = "slimbus_xo_src_clk",
4715 .ops = &clk_ops_branch,
4716 CLK_INIT(slimbus_xo_src_clk.c),
4717 },
4718};
4719
Matt Wagantall735f01a2011-08-12 12:40:28 -07004720DEFINE_CLK_RPM(afab_clk, afab_a_clk, APPS_FABRIC, NULL);
4721DEFINE_CLK_RPM(cfpb_clk, cfpb_a_clk, CFPB, NULL);
4722DEFINE_CLK_RPM(dfab_clk, dfab_a_clk, DAYTONA_FABRIC, NULL);
4723DEFINE_CLK_RPM(ebi1_clk, ebi1_a_clk, EBI1, NULL);
4724DEFINE_CLK_RPM(mmfab_clk, mmfab_a_clk, MM_FABRIC, NULL);
4725DEFINE_CLK_RPM(mmfpb_clk, mmfpb_a_clk, MMFPB, NULL);
4726DEFINE_CLK_RPM(sfab_clk, sfab_a_clk, SYSTEM_FABRIC, NULL);
4727DEFINE_CLK_RPM(sfpb_clk, sfpb_a_clk, SFPB, NULL);
Stephen Boydc7fc3b12012-05-17 14:42:46 -07004728DEFINE_CLK_RPM_QDSS(qdss_clk, qdss_a_clk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004729
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004730static DEFINE_CLK_VOTER(sfab_msmbus_a_clk, &sfab_a_clk.c, 0);
4731static DEFINE_CLK_VOTER(sfab_tmr_a_clk, &sfab_a_clk.c, 0);
Stephen Boydd7a143a2012-02-16 17:59:26 -08004732
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004733static DEFINE_CLK_VOTER(dfab_dsps_clk, &dfab_clk.c, 0);
4734static DEFINE_CLK_VOTER(dfab_usb_hs_clk, &dfab_clk.c, 0);
4735static DEFINE_CLK_VOTER(dfab_usb_hs3_clk, &dfab_clk.c, 0);
4736static DEFINE_CLK_VOTER(dfab_usb_hs4_clk, &dfab_clk.c, 0);
4737static DEFINE_CLK_VOTER(dfab_sdc1_clk, &dfab_clk.c, 0);
4738static DEFINE_CLK_VOTER(dfab_sdc2_clk, &dfab_clk.c, 0);
4739static DEFINE_CLK_VOTER(dfab_sdc3_clk, &dfab_clk.c, 0);
4740static DEFINE_CLK_VOTER(dfab_sdc4_clk, &dfab_clk.c, 0);
4741static DEFINE_CLK_VOTER(dfab_sdc5_clk, &dfab_clk.c, 0);
4742static DEFINE_CLK_VOTER(dfab_sps_clk, &dfab_clk.c, 0);
4743static DEFINE_CLK_VOTER(dfab_bam_dmux_clk, &dfab_clk.c, 0);
4744static DEFINE_CLK_VOTER(dfab_scm_clk, &dfab_clk.c, 0);
4745static DEFINE_CLK_VOTER(dfab_qseecom_clk, &dfab_clk.c, 0);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004746static DEFINE_CLK_VOTER(dfab_msmbus_clk, &dfab_clk.c, 0);
4747static DEFINE_CLK_VOTER(dfab_msmbus_a_clk, &dfab_a_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004748
Matt Wagantall42cd12a2012-03-30 18:02:40 -07004749static DEFINE_CLK_VOTER(ebi1_msmbus_clk, &ebi1_clk.c, LONG_MAX);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004750static DEFINE_CLK_VOTER(ebi1_adm_clk, &ebi1_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004751
Matt Wagantall33bac7e2012-05-22 14:59:05 -07004752static DEFINE_CLK_VOTER(ebi1_acpu_a_clk, &ebi1_a_clk.c, LONG_MAX);
4753static DEFINE_CLK_VOTER(ebi1_msmbus_a_clk, &ebi1_a_clk.c, LONG_MAX);
4754static DEFINE_CLK_VOTER(afab_acpu_a_clk, &afab_a_clk.c, LONG_MAX);
4755static DEFINE_CLK_VOTER(afab_msmbus_a_clk, &afab_a_clk.c, LONG_MAX);
4756
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004757#ifdef CONFIG_DEBUG_FS
4758struct measure_sel {
4759 u32 test_vector;
Matt Wagantallf82f2942012-01-27 13:56:13 -08004760 struct clk *c;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004761};
4762
Matt Wagantall8b38f942011-08-02 18:23:18 -07004763static DEFINE_CLK_MEASURE(l2_m_clk);
4764static DEFINE_CLK_MEASURE(krait0_m_clk);
4765static DEFINE_CLK_MEASURE(krait1_m_clk);
Tianyi Gou455c13c2012-02-02 16:33:24 -08004766static DEFINE_CLK_MEASURE(krait2_m_clk);
4767static DEFINE_CLK_MEASURE(krait3_m_clk);
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004768static DEFINE_CLK_MEASURE(q6sw_clk);
4769static DEFINE_CLK_MEASURE(q6fw_clk);
4770static DEFINE_CLK_MEASURE(q6_func_clk);
Matt Wagantall8b38f942011-08-02 18:23:18 -07004771
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004772static struct measure_sel measure_mux[] = {
4773 { TEST_PER_LS(0x08), &slimbus_xo_src_clk.c },
4774 { TEST_PER_LS(0x12), &sdc1_p_clk.c },
4775 { TEST_PER_LS(0x13), &sdc1_clk.c },
4776 { TEST_PER_LS(0x14), &sdc2_p_clk.c },
4777 { TEST_PER_LS(0x15), &sdc2_clk.c },
4778 { TEST_PER_LS(0x16), &sdc3_p_clk.c },
4779 { TEST_PER_LS(0x17), &sdc3_clk.c },
4780 { TEST_PER_LS(0x18), &sdc4_p_clk.c },
4781 { TEST_PER_LS(0x19), &sdc4_clk.c },
4782 { TEST_PER_LS(0x1A), &sdc5_p_clk.c },
4783 { TEST_PER_LS(0x1B), &sdc5_clk.c },
Matt Wagantall7625a4c2011-11-01 16:17:53 -07004784 { TEST_PER_LS(0x1F), &gp0_clk.c },
4785 { TEST_PER_LS(0x20), &gp1_clk.c },
4786 { TEST_PER_LS(0x21), &gp2_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004787 { TEST_PER_LS(0x25), &dfab_clk.c },
4788 { TEST_PER_LS(0x25), &dfab_a_clk.c },
4789 { TEST_PER_LS(0x26), &pmem_clk.c },
4790 { TEST_PER_LS(0x32), &dma_bam_p_clk.c },
4791 { TEST_PER_LS(0x33), &cfpb_clk.c },
4792 { TEST_PER_LS(0x33), &cfpb_a_clk.c },
4793 { TEST_PER_LS(0x3D), &gsbi1_p_clk.c },
4794 { TEST_PER_LS(0x3E), &gsbi1_uart_clk.c },
4795 { TEST_PER_LS(0x3F), &gsbi1_qup_clk.c },
4796 { TEST_PER_LS(0x41), &gsbi2_p_clk.c },
4797 { TEST_PER_LS(0x42), &gsbi2_uart_clk.c },
4798 { TEST_PER_LS(0x44), &gsbi2_qup_clk.c },
4799 { TEST_PER_LS(0x45), &gsbi3_p_clk.c },
4800 { TEST_PER_LS(0x46), &gsbi3_uart_clk.c },
4801 { TEST_PER_LS(0x48), &gsbi3_qup_clk.c },
4802 { TEST_PER_LS(0x49), &gsbi4_p_clk.c },
4803 { TEST_PER_LS(0x4A), &gsbi4_uart_clk.c },
4804 { TEST_PER_LS(0x4C), &gsbi4_qup_clk.c },
4805 { TEST_PER_LS(0x4D), &gsbi5_p_clk.c },
4806 { TEST_PER_LS(0x4E), &gsbi5_uart_clk.c },
4807 { TEST_PER_LS(0x50), &gsbi5_qup_clk.c },
4808 { TEST_PER_LS(0x51), &gsbi6_p_clk.c },
4809 { TEST_PER_LS(0x52), &gsbi6_uart_clk.c },
4810 { TEST_PER_LS(0x54), &gsbi6_qup_clk.c },
4811 { TEST_PER_LS(0x55), &gsbi7_p_clk.c },
4812 { TEST_PER_LS(0x56), &gsbi7_uart_clk.c },
4813 { TEST_PER_LS(0x58), &gsbi7_qup_clk.c },
4814 { TEST_PER_LS(0x59), &gsbi8_p_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004815 { TEST_PER_LS(0x59), &sfab_sata_s_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004816 { TEST_PER_LS(0x5A), &gsbi8_uart_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004817 { TEST_PER_LS(0x5A), &sata_p_clk.c },
4818 { TEST_PER_LS(0x5B), &sata_rxoob_clk.c },
4819 { TEST_PER_LS(0x5C), &sata_pmalive_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004820 { TEST_PER_LS(0x5C), &gsbi8_qup_clk.c },
4821 { TEST_PER_LS(0x5D), &gsbi9_p_clk.c },
4822 { TEST_PER_LS(0x5E), &gsbi9_uart_clk.c },
4823 { TEST_PER_LS(0x60), &gsbi9_qup_clk.c },
4824 { TEST_PER_LS(0x61), &gsbi10_p_clk.c },
4825 { TEST_PER_LS(0x62), &gsbi10_uart_clk.c },
4826 { TEST_PER_LS(0x64), &gsbi10_qup_clk.c },
4827 { TEST_PER_LS(0x65), &gsbi11_p_clk.c },
4828 { TEST_PER_LS(0x66), &gsbi11_uart_clk.c },
4829 { TEST_PER_LS(0x68), &gsbi11_qup_clk.c },
4830 { TEST_PER_LS(0x69), &gsbi12_p_clk.c },
4831 { TEST_PER_LS(0x6A), &gsbi12_uart_clk.c },
4832 { TEST_PER_LS(0x6C), &gsbi12_qup_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004833 { TEST_PER_LS(0x5E), &pcie_p_clk.c },
4834 { TEST_PER_LS(0x5F), &ce3_p_clk.c },
4835 { TEST_PER_LS(0x60), &ce3_core_clk.c },
4836 { TEST_PER_LS(0x63), &usb_hs3_p_clk.c },
4837 { TEST_PER_LS(0x64), &usb_hs3_xcvr_clk.c },
4838 { TEST_PER_LS(0x65), &usb_hs4_p_clk.c },
4839 { TEST_PER_LS(0x66), &usb_hs4_xcvr_clk.c },
4840 { TEST_PER_LS(0x6B), &sata_phy_ref_clk.c },
4841 { TEST_PER_LS(0x6C), &sata_phy_cfg_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004842 { TEST_PER_LS(0x78), &sfpb_clk.c },
4843 { TEST_PER_LS(0x78), &sfpb_a_clk.c },
4844 { TEST_PER_LS(0x7A), &pmic_ssbi2_clk.c },
4845 { TEST_PER_LS(0x7B), &pmic_arb0_p_clk.c },
4846 { TEST_PER_LS(0x7C), &pmic_arb1_p_clk.c },
4847 { TEST_PER_LS(0x7D), &prng_clk.c },
4848 { TEST_PER_LS(0x7F), &rpm_msg_ram_p_clk.c },
4849 { TEST_PER_LS(0x80), &adm0_p_clk.c },
4850 { TEST_PER_LS(0x84), &usb_hs1_p_clk.c },
4851 { TEST_PER_LS(0x85), &usb_hs1_xcvr_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004852 { TEST_PER_LS(0x86), &usb_hsic_p_clk.c },
4853 { TEST_PER_LS(0x87), &usb_hsic_system_clk.c },
4854 { TEST_PER_LS(0x88), &usb_hsic_xcvr_fs_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004855 { TEST_PER_LS(0x89), &usb_fs1_p_clk.c },
4856 { TEST_PER_LS(0x8A), &usb_fs1_sys_clk.c },
4857 { TEST_PER_LS(0x8B), &usb_fs1_xcvr_clk.c },
4858 { TEST_PER_LS(0x8C), &usb_fs2_p_clk.c },
4859 { TEST_PER_LS(0x8D), &usb_fs2_sys_clk.c },
4860 { TEST_PER_LS(0x8E), &usb_fs2_xcvr_clk.c },
4861 { TEST_PER_LS(0x8F), &tsif_p_clk.c },
4862 { TEST_PER_LS(0x91), &tsif_ref_clk.c },
4863 { TEST_PER_LS(0x92), &ce1_p_clk.c },
4864 { TEST_PER_LS(0x94), &tssc_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004865 { TEST_PER_LS(0x9D), &usb_hsic_hsio_cal_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004866 { TEST_PER_LS(0xA4), &ce1_core_clk.c },
4867
4868 { TEST_PER_HS(0x07), &afab_clk.c },
4869 { TEST_PER_HS(0x07), &afab_a_clk.c },
4870 { TEST_PER_HS(0x18), &sfab_clk.c },
4871 { TEST_PER_HS(0x18), &sfab_a_clk.c },
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004872 { TEST_PER_HS(0x26), &q6sw_clk },
4873 { TEST_PER_HS(0x27), &q6fw_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004874 { TEST_PER_HS(0x2A), &adm0_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004875 { TEST_PER_HS(0x31), &sata_a_clk.c },
Tianyi Gou6613de52012-01-27 17:57:53 -08004876 { TEST_PER_HS(0x2D), &pcie_phy_ref_clk.c },
4877 { TEST_PER_HS(0x32), &pcie_a_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004878 { TEST_PER_HS(0x34), &ebi1_clk.c },
4879 { TEST_PER_HS(0x34), &ebi1_a_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004880 { TEST_PER_HS(0x50), &usb_hsic_hsic_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004881
4882 { TEST_MM_LS(0x00), &dsi1_byte_clk.c },
4883 { TEST_MM_LS(0x01), &dsi2_byte_clk.c },
4884 { TEST_MM_LS(0x02), &cam1_clk.c },
4885 { TEST_MM_LS(0x06), &amp_p_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004886 { TEST_MM_LS(0x07), &csi_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004887 { TEST_MM_LS(0x08), &dsi2_s_p_clk.c },
4888 { TEST_MM_LS(0x09), &dsi1_m_p_clk.c },
4889 { TEST_MM_LS(0x0A), &dsi1_s_p_clk.c },
4890 { TEST_MM_LS(0x0C), &gfx2d0_p_clk.c },
4891 { TEST_MM_LS(0x0D), &gfx2d1_p_clk.c },
4892 { TEST_MM_LS(0x0E), &gfx3d_p_clk.c },
4893 { TEST_MM_LS(0x0F), &hdmi_m_p_clk.c },
4894 { TEST_MM_LS(0x10), &hdmi_s_p_clk.c },
4895 { TEST_MM_LS(0x11), &ijpeg_p_clk.c },
4896 { TEST_MM_LS(0x12), &imem_p_clk.c },
4897 { TEST_MM_LS(0x13), &jpegd_p_clk.c },
4898 { TEST_MM_LS(0x14), &mdp_p_clk.c },
4899 { TEST_MM_LS(0x16), &rot_p_clk.c },
4900 { TEST_MM_LS(0x17), &dsi1_esc_clk.c },
4901 { TEST_MM_LS(0x18), &smmu_p_clk.c },
4902 { TEST_MM_LS(0x19), &tv_enc_p_clk.c },
4903 { TEST_MM_LS(0x1A), &vcodec_p_clk.c },
4904 { TEST_MM_LS(0x1B), &vfe_p_clk.c },
4905 { TEST_MM_LS(0x1C), &vpe_p_clk.c },
4906 { TEST_MM_LS(0x1D), &cam0_clk.c },
4907 { TEST_MM_LS(0x1F), &hdmi_app_clk.c },
4908 { TEST_MM_LS(0x20), &mdp_vsync_clk.c },
4909 { TEST_MM_LS(0x21), &tv_dac_clk.c },
4910 { TEST_MM_LS(0x22), &tv_enc_clk.c },
4911 { TEST_MM_LS(0x23), &dsi2_esc_clk.c },
4912 { TEST_MM_LS(0x25), &mmfpb_clk.c },
4913 { TEST_MM_LS(0x25), &mmfpb_a_clk.c },
4914 { TEST_MM_LS(0x26), &dsi2_m_p_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004915 { TEST_MM_LS(0x27), &cam2_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004916 { TEST_MM_LS(0x28), &vcap_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004917
4918 { TEST_MM_HS(0x00), &csi0_clk.c },
4919 { TEST_MM_HS(0x01), &csi1_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004920 { TEST_MM_HS(0x04), &csi_vfe_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004921 { TEST_MM_HS(0x05), &ijpeg_clk.c },
4922 { TEST_MM_HS(0x06), &vfe_clk.c },
4923 { TEST_MM_HS(0x07), &gfx2d0_clk.c },
4924 { TEST_MM_HS(0x08), &gfx2d1_clk.c },
4925 { TEST_MM_HS(0x09), &gfx3d_clk.c },
4926 { TEST_MM_HS(0x0A), &jpegd_clk.c },
4927 { TEST_MM_HS(0x0B), &vcodec_clk.c },
4928 { TEST_MM_HS(0x0F), &mmfab_clk.c },
4929 { TEST_MM_HS(0x0F), &mmfab_a_clk.c },
4930 { TEST_MM_HS(0x11), &gmem_axi_clk.c },
4931 { TEST_MM_HS(0x12), &ijpeg_axi_clk.c },
4932 { TEST_MM_HS(0x13), &imem_axi_clk.c },
4933 { TEST_MM_HS(0x14), &jpegd_axi_clk.c },
4934 { TEST_MM_HS(0x15), &mdp_axi_clk.c },
4935 { TEST_MM_HS(0x16), &rot_axi_clk.c },
4936 { TEST_MM_HS(0x17), &vcodec_axi_clk.c },
4937 { TEST_MM_HS(0x18), &vfe_axi_clk.c },
4938 { TEST_MM_HS(0x19), &vpe_axi_clk.c },
4939 { TEST_MM_HS(0x1A), &mdp_clk.c },
4940 { TEST_MM_HS(0x1B), &rot_clk.c },
4941 { TEST_MM_HS(0x1C), &vpe_clk.c },
4942 { TEST_MM_HS(0x1E), &hdmi_tv_clk.c },
4943 { TEST_MM_HS(0x1F), &mdp_tv_clk.c },
4944 { TEST_MM_HS(0x24), &csi0_phy_clk.c },
4945 { TEST_MM_HS(0x25), &csi1_phy_clk.c },
4946 { TEST_MM_HS(0x26), &csi_pix_clk.c },
4947 { TEST_MM_HS(0x27), &csi_rdi_clk.c },
4948 { TEST_MM_HS(0x28), &lut_mdp_clk.c },
4949 { TEST_MM_HS(0x29), &vcodec_axi_a_clk.c },
4950 { TEST_MM_HS(0x2A), &vcodec_axi_b_clk.c },
4951 { TEST_MM_HS(0x2B), &csi1phy_timer_clk.c },
4952 { TEST_MM_HS(0x2C), &csi0phy_timer_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004953 { TEST_MM_HS(0x2D), &csi2_clk.c },
4954 { TEST_MM_HS(0x2E), &csi2_phy_clk.c },
4955 { TEST_MM_HS(0x2F), &csi2phy_timer_clk.c },
4956 { TEST_MM_HS(0x30), &csi_pix1_clk.c },
4957 { TEST_MM_HS(0x31), &csi_rdi1_clk.c },
4958 { TEST_MM_HS(0x32), &csi_rdi2_clk.c },
Tianyi Gou621f8742011-09-01 21:45:01 -07004959 { TEST_MM_HS(0x33), &vcap_clk.c },
4960 { TEST_MM_HS(0x34), &vcap_npl_clk.c },
Tianyi Goue3d4f542012-03-15 17:06:45 -07004961 { TEST_MM_HS(0x34), &gfx3d_axi_clk_8930.c },
Tianyi Gou7747a962012-02-03 15:03:55 -08004962 { TEST_MM_HS(0x35), &vcap_axi_clk.c },
Tianyi Gou51918802012-01-26 14:05:43 -08004963 { TEST_MM_HS(0x36), &rgb_tv_clk.c },
4964 { TEST_MM_HS(0x37), &npl_tv_clk.c },
Patrick Dalye6f489042012-07-11 15:29:15 -07004965 { TEST_MM_HS(0x38), &gfx3d_axi_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004966
4967 { TEST_LPA(0x0F), &mi2s_bit_clk.c },
4968 { TEST_LPA(0x10), &codec_i2s_mic_bit_clk.c },
4969 { TEST_LPA(0x11), &codec_i2s_spkr_bit_clk.c },
4970 { TEST_LPA(0x12), &spare_i2s_mic_bit_clk.c },
4971 { TEST_LPA(0x13), &spare_i2s_spkr_bit_clk.c },
4972 { TEST_LPA(0x14), &pcm_clk.c },
4973 { TEST_LPA(0x1D), &audio_slimbus_clk.c },
Matt Wagantall8b38f942011-08-02 18:23:18 -07004974
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004975 { TEST_LPA_HS(0x00), &q6_func_clk },
4976
Stephen Boyd46fdf0d2011-11-22 12:25:09 -08004977 { TEST_CPUL2(0x2), &l2_m_clk },
4978 { TEST_CPUL2(0x0), &krait0_m_clk },
4979 { TEST_CPUL2(0x1), &krait1_m_clk },
Tianyi Gou455c13c2012-02-02 16:33:24 -08004980 { TEST_CPUL2(0x4), &krait2_m_clk },
4981 { TEST_CPUL2(0x5), &krait3_m_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004982};
4983
Matt Wagantallf82f2942012-01-27 13:56:13 -08004984static struct measure_sel *find_measure_sel(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004985{
4986 int i;
4987
4988 for (i = 0; i < ARRAY_SIZE(measure_mux); i++)
Matt Wagantallf82f2942012-01-27 13:56:13 -08004989 if (measure_mux[i].c == c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004990 return &measure_mux[i];
4991 return NULL;
4992}
4993
Matt Wagantall8b38f942011-08-02 18:23:18 -07004994static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004995{
4996 int ret = 0;
4997 u32 clk_sel;
4998 struct measure_sel *p;
Matt Wagantallf82f2942012-01-27 13:56:13 -08004999 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005000 unsigned long flags;
5001
5002 if (!parent)
5003 return -EINVAL;
5004
5005 p = find_measure_sel(parent);
5006 if (!p)
5007 return -EINVAL;
5008
5009 spin_lock_irqsave(&local_clock_reg_lock, flags);
5010
Matt Wagantall8b38f942011-08-02 18:23:18 -07005011 /*
5012 * Program the test vector, measurement period (sample_ticks)
5013 * and scaling multiplier.
5014 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005015 measure->sample_ticks = 0x10000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005016 clk_sel = p->test_vector & TEST_CLK_SEL_MASK;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005017 measure->multiplier = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005018 switch (p->test_vector >> TEST_TYPE_SHIFT) {
5019 case TEST_TYPE_PER_LS:
5020 writel_relaxed(0x4030D00|BVAL(7, 0, clk_sel), CLK_TEST_REG);
5021 break;
5022 case TEST_TYPE_PER_HS:
5023 writel_relaxed(0x4020000|BVAL(16, 10, clk_sel), CLK_TEST_REG);
5024 break;
5025 case TEST_TYPE_MM_LS:
5026 writel_relaxed(0x4030D97, CLK_TEST_REG);
5027 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_LS_REG);
5028 break;
5029 case TEST_TYPE_MM_HS:
5030 writel_relaxed(0x402B800, CLK_TEST_REG);
5031 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_HS_REG);
5032 break;
5033 case TEST_TYPE_LPA:
5034 writel_relaxed(0x4030D98, CLK_TEST_REG);
5035 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0),
5036 LCC_CLK_LS_DEBUG_CFG_REG);
5037 break;
Stephen Boyd3939c8d2011-08-29 17:36:22 -07005038 case TEST_TYPE_LPA_HS:
5039 writel_relaxed(0x402BC00, CLK_TEST_REG);
5040 writel_relaxed(BVAL(2, 1, clk_sel)|BIT(0),
5041 LCC_CLK_HS_DEBUG_CFG_REG);
5042 break;
Matt Wagantall8b38f942011-08-02 18:23:18 -07005043 case TEST_TYPE_CPUL2:
5044 writel_relaxed(0x4030400, CLK_TEST_REG);
5045 writel_relaxed(0x80|BVAL(5, 3, clk_sel), GCC_APCS_CLK_DIAG);
Matt Wagantallf82f2942012-01-27 13:56:13 -08005046 measure->sample_ticks = 0x4000;
5047 measure->multiplier = 2;
Matt Wagantall8b38f942011-08-02 18:23:18 -07005048 break;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005049 default:
5050 ret = -EPERM;
5051 }
5052 /* Make sure test vector is set before starting measurements. */
5053 mb();
5054
5055 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5056
5057 return ret;
5058}
5059
5060/* Sample clock for 'ticks' reference clock ticks. */
5061static u32 run_measurement(unsigned ticks)
5062{
5063 /* Stop counters and set the XO4 counter start value. */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005064 writel_relaxed(ticks, RINGOSC_TCXO_CTL_REG);
5065
5066 /* Wait for timer to become ready. */
5067 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) != 0)
5068 cpu_relax();
5069
5070 /* Run measurement and wait for completion. */
5071 writel_relaxed(BIT(20)|ticks, RINGOSC_TCXO_CTL_REG);
5072 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) == 0)
5073 cpu_relax();
5074
5075 /* Stop counters. */
5076 writel_relaxed(0x0, RINGOSC_TCXO_CTL_REG);
5077
5078 /* Return measured ticks. */
5079 return readl_relaxed(RINGOSC_STATUS_REG) & BM(24, 0);
5080}
5081
5082
5083/* Perform a hardware rate measurement for a given clock.
5084 FOR DEBUG USE ONLY: Measurements take ~15 ms! */
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07005085static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005086{
5087 unsigned long flags;
5088 u32 pdm_reg_backup, ringosc_reg_backup;
5089 u64 raw_count_short, raw_count_full;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005090 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005091 unsigned ret;
5092
Stephen Boyde334aeb2012-01-24 12:17:29 -08005093 ret = clk_prepare_enable(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005094 if (ret) {
5095 pr_warning("CXO clock failed to enable. Can't measure\n");
5096 return 0;
5097 }
5098
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005099 spin_lock_irqsave(&local_clock_reg_lock, flags);
5100
5101 /* Enable CXO/4 and RINGOSC branch and root. */
5102 pdm_reg_backup = readl_relaxed(PDM_CLK_NS_REG);
5103 ringosc_reg_backup = readl_relaxed(RINGOSC_NS_REG);
5104 writel_relaxed(0x2898, PDM_CLK_NS_REG);
5105 writel_relaxed(0xA00, RINGOSC_NS_REG);
5106
5107 /*
5108 * The ring oscillator counter will not reset if the measured clock
5109 * is not running. To detect this, run a short measurement before
5110 * the full measurement. If the raw results of the two are the same
5111 * then the clock must be off.
5112 */
5113
5114 /* Run a short measurement. (~1 ms) */
5115 raw_count_short = run_measurement(0x1000);
5116 /* Run a full measurement. (~14 ms) */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005117 raw_count_full = run_measurement(measure->sample_ticks);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005118
5119 writel_relaxed(ringosc_reg_backup, RINGOSC_NS_REG);
5120 writel_relaxed(pdm_reg_backup, PDM_CLK_NS_REG);
5121
5122 /* Return 0 if the clock is off. */
5123 if (raw_count_full == raw_count_short)
5124 ret = 0;
5125 else {
5126 /* Compute rate in Hz. */
5127 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005128 do_div(raw_count_full, ((measure->sample_ticks * 10) + 35));
5129 ret = (raw_count_full * measure->multiplier);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005130 }
5131
5132 /* Route dbg_hs_clk to PLLTEST. 300mV single-ended amplitude. */
Stephen Boyd69da8402011-07-14 17:45:31 -07005133 writel_relaxed(0x38F8, PLLTEST_PAD_CFG_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005134 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5135
Stephen Boyde334aeb2012-01-24 12:17:29 -08005136 clk_disable_unprepare(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005137
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005138 return ret;
5139}
5140#else /* !CONFIG_DEBUG_FS */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005141static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005142{
5143 return -EINVAL;
5144}
5145
Matt Wagantallf82f2942012-01-27 13:56:13 -08005146static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005147{
5148 return 0;
5149}
5150#endif /* CONFIG_DEBUG_FS */
5151
Matt Wagantallae053222012-05-14 19:42:07 -07005152static struct clk_ops clk_ops_measure = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005153 .set_parent = measure_clk_set_parent,
5154 .get_rate = measure_clk_get_rate,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005155};
5156
Matt Wagantall8b38f942011-08-02 18:23:18 -07005157static struct measure_clk measure_clk = {
5158 .c = {
5159 .dbg_name = "measure_clk",
Matt Wagantallae053222012-05-14 19:42:07 -07005160 .ops = &clk_ops_measure,
Matt Wagantall8b38f942011-08-02 18:23:18 -07005161 CLK_INIT(measure_clk.c),
5162 },
5163 .multiplier = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005164};
5165
Tianyi Goua8b3cce2011-11-08 14:37:26 -08005166static struct clk_lookup msm_clocks_8064[] = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005167 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5168 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Mohan Pallaka804ca592012-06-14 14:37:38 +05305169 CLK_LOOKUP("pwm_clk", cxo_clk.c, "0-0048"),
Stephen Boyded630b02012-01-26 15:26:47 -08005170 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5171 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5172 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5173 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5174 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
Matt Wagantall292aace2012-01-26 19:12:34 -08005175 CLK_LOOKUP("xo", cxo_clk.c, "pil_gss"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005176 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005177 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
David Collinsa7d23532012-08-02 10:48:16 -07005178 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Stephen Boyded630b02012-01-26 15:26:47 -08005179 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5180 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5181 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5182 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005183
Matt Wagantalld75f1312012-05-23 16:17:35 -07005184 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5185 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5186 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5187 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5188 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5189 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5190 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5191 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5192 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5193 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5194 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5195 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5196 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5197 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5198 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5199 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5200
Tianyi Gou21a0e802012-02-04 22:34:10 -08005201 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005202 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005203 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5204 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5205 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005206 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005207 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5208 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5209 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5210 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5211 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005212 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005213 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5214 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005215 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005216 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5217 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5218 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5219 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5220 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5221 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5222 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005223
Tianyi Gou21a0e802012-02-04 22:34:10 -08005224 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005225 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, ""),
5226 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5227 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005228
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005229 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5230 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5231 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005232 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, "msm_serial_hsl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005233 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5234 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5235 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5236 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, ""),
Mayank Rana262e9032012-05-10 15:14:00 -07005237 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005238 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, "msm_serial_hsl.0"),
David Keitel3c40fc52012-02-09 17:53:52 -08005239 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005240 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005241 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005242 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005243 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005244 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "qup_i2c.5"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005245 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5246 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5247 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Tianyi Gou50f23812012-02-06 16:04:19 -08005248 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Tianyi Gou05e01102012-02-08 22:15:49 -08005249 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005250 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5251 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5252 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5253 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
Joel Nider6cbe66a2012-06-26 11:11:59 +03005254 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.0"),
5255 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.0"),
5256 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.1"),
5257 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005258 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005259 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5260 CLK_LOOKUP("alt_core_clk", usb_hs3_xcvr_clk.c, "msm_ehci_host.0"),
5261 CLK_LOOKUP("alt_core_clk", usb_hs4_xcvr_clk.c, "msm_ehci_host.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005262 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5263 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5264 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005265 CLK_LOOKUP("ref_clk", sata_phy_ref_clk.c, ""),
5266 CLK_LOOKUP("cfg_clk", sata_phy_cfg_clk.c, ""),
Tianyi Gou352955d2012-05-18 19:44:01 -07005267 CLK_LOOKUP("src_clk", sata_src_clk.c, ""),
5268 CLK_LOOKUP("core_rxoob_clk", sata_rxoob_clk.c, ""),
5269 CLK_LOOKUP("core_pmalive_clk", sata_pmalive_clk.c, ""),
5270 CLK_LOOKUP("bus_clk", sata_a_clk.c, ""),
5271 CLK_LOOKUP("iface_clk", sata_p_clk.c, ""),
5272 CLK_LOOKUP("slave_iface_clk", sfab_sata_s_p_clk.c, ""),
Ramesh Masavarapu28311912011-10-27 11:04:12 -07005273 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qce.0"),
5274 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qcrypto.0"),
5275 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qce.0"),
5276 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qcrypto.0"),
5277 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qce.0"),
5278 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qcrypto.0"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005279 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005280 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "msm_serial_hsl.1"),
David Keitel3c40fc52012-02-09 17:53:52 -08005281 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005282 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005283 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005284 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005285 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005286 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "qup_i2c.5"),
Mayank Rana262e9032012-05-10 15:14:00 -07005287 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005288 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, "msm_serial_hsl.0"),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005289 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5290 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005291 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005292 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Manu Gautam7483f172011-11-08 15:22:26 +05305293 CLK_LOOKUP("iface_clk", usb_hs3_p_clk.c, "msm_ehci_host.0"),
5294 CLK_LOOKUP("iface_clk", usb_hs4_p_clk.c, "msm_ehci_host.1"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005295 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5296 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5297 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5298 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06005299 CLK_LOOKUP("iface_clk", pcie_p_clk.c, "msm_pcie"),
5300 CLK_LOOKUP("ref_clk", pcie_phy_ref_clk.c, "msm_pcie"),
5301 CLK_LOOKUP("bus_clk", pcie_a_clk.c, "msm_pcie"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005302 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5303 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005304 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5305 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5306 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5307 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chand07220e2012-02-13 15:52:22 -08005308 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005309 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Sreesudhan Ramakrish Ramkumar8002a792012-04-09 17:42:58 -07005310 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -08005311 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Kevin Chand07220e2012-02-13 15:52:22 -08005312 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
5313 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5314 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
5315 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
5316 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5317 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
5318 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
5319 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5320 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
5321 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
5322 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5323 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5324 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
5325 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5326 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5327 CLK_LOOKUP("csiphy_timer_src_clk",
5328 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5329 CLK_LOOKUP("csiphy_timer_src_clk",
5330 csiphy_timer_src_clk.c, "msm_csiphy.1"),
5331 CLK_LOOKUP("csiphy_timer_src_clk",
5332 csiphy_timer_src_clk.c, "msm_csiphy.2"),
5333 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5334 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
5335 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005336 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5337 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5338 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5339 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Tianyi Gou51918802012-01-26 14:05:43 -08005340 CLK_LOOKUP("rgb_clk", rgb_tv_clk.c, ""),
5341 CLK_LOOKUP("npl_clk", npl_tv_clk.c, ""),
5342
Pu Chen86b4be92011-11-03 17:27:57 -07005343 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005344 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005345 CLK_LOOKUP("bus_clk",
Patrick Dalye6f489042012-07-11 15:29:15 -07005346 gfx3d_axi_clk.c, "footswitch-8x60.2"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005347 CLK_LOOKUP("iface_clk", vcap_p_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005348 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005349 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "footswitch-8x60.10"),
5350 CLK_LOOKUP("bus_clk", vcap_axi_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005351 CLK_LOOKUP("core_clk", vcap_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005352 CLK_LOOKUP("core_clk", vcap_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005353 CLK_LOOKUP("core_clk", vcap_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005354 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005355 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005356 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005357 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5358 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005359 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005360 CLK_LOOKUP("core_clk", jpegd_clk.c, ""),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005361 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005362 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005363 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005364 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005365 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005366 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005367 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005368 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Matt Wagantall61286312012-02-22 15:55:09 -08005369 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005370 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5371 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
Greg Griscofa47b532011-11-11 10:32:06 -08005372 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005373 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005374 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
Tianyi Gou51918802012-01-26 14:05:43 -08005375 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005376 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005377 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Ujwal Pateld041f982012-03-27 19:51:44 -07005378 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005379 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chand07220e2012-02-13 15:52:22 -08005380 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005381 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chand07220e2012-02-13 15:52:22 -08005382 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005383 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5384 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5385 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5386 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5387 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5388 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5389 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005390 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5391 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chand07220e2012-02-13 15:52:22 -08005392 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5393 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
5394 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005395 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5396 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5397 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5398 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Pu Chen86b4be92011-11-03 17:27:57 -07005399 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005400 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005401 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5402 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005403 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005404 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005405 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005406 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005407 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005408 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005409 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005410 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005411 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Greg Griscofa47b532011-11-11 10:32:06 -08005412 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005413 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chand07220e2012-02-13 15:52:22 -08005414 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005415 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chanb20742b2012-02-27 15:47:35 -08005416 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall61286312012-02-22 15:55:09 -08005417 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005418
Patrick Lai04baee942012-05-01 14:38:47 -07005419 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5420 "msm-dai-q6-mi2s"),
5421 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5422 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005423 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5424 "msm-dai-q6.1"),
5425 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5426 "msm-dai-q6.1"),
5427 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5428 "msm-dai-q6.5"),
5429 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5430 "msm-dai-q6.5"),
5431 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
5432 "msm-dai-q6.16384"),
5433 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5434 "msm-dai-q6.16384"),
5435 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5436 "msm-dai-q6.4"),
5437 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5438 "msm-dai-q6.4"),
5439 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005440 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005441 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, ""),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005442 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005443 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, ""),
5444 CLK_LOOKUP("core_clk", vpe_axi_clk.c, ""),
5445 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
5446 CLK_LOOKUP("core_clk", vcap_axi_clk.c, ""),
5447 CLK_LOOKUP("core_clk", rot_axi_clk.c, ""),
5448 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, ""),
5449 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
5450 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, ""),
5451 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, ""),
Patrick Dalye6f489042012-07-11 15:29:15 -07005452 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005453
5454 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
5455 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
5456 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.0"),
5457 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.1"),
5458 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5459 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5460 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5461 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5462 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
5463 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
5464 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Ramesh Masavarapua1bc0e42012-03-05 07:42:48 -08005465 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005466
Manu Gautam5143b252012-01-05 19:25:23 -08005467 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5468 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5469 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5470 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5471 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005472
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005473 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5474 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5475 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5476 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5477 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5478 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5479 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5480 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5481 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005482 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.9"),
5483 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.10"),
5484
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005485 CLK_LOOKUP("core_clk", vcap_axi_clk.c, "msm_iommu.11"),
5486
Deepak Kotur954b1782012-04-24 17:58:19 -07005487 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5488 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5489 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5490 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5491 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005492 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5493 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
5494
Jeff Ohlstein8c116c72011-10-27 17:34:48 -07005495 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005496 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5497 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005498
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07005499 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
5500 CLK_LOOKUP("reset2_clk", dsi2_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07005501
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005502 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5503 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5504 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
Tianyi Gou455c13c2012-02-02 16:33:24 -08005505 CLK_LOOKUP("krait2_mclk", krait2_m_clk, ""),
5506 CLK_LOOKUP("krait3_mclk", krait3_m_clk, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005507};
5508
Patrick Dalye6f489042012-07-11 15:29:15 -07005509static struct clk_lookup msm_clocks_8960_common[] __initdata = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005510 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5511 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Stephen Boyded630b02012-01-26 15:26:47 -08005512 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5513 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5514 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5515 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5516 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005517 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005518 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
David Collinsa7d23532012-08-02 10:48:16 -07005519 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Stephen Boyded630b02012-01-26 15:26:47 -08005520 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5521 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5522 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5523 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005524
Matt Wagantalld75f1312012-05-23 16:17:35 -07005525 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5526 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5527 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5528 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5529 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5530 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5531 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5532 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5533 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5534 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5535 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5536 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5537 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5538 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5539 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5540 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5541
Matt Wagantallb2710b82011-11-16 19:55:17 -08005542 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005543 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005544 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5545 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5546 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005547 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005548 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5549 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5550 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5551 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5552 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005553 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005554 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5555 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005556 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005557 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5558 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5559 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5560 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5561 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5562 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5563 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005564
5565 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005566 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5567 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5568 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005569
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005570 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5571 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5572 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5573 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5574 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5575 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5576 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
Matt Wagantalle2522372011-08-17 14:52:21 -07005577 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5578 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005579 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
Mayank Rana1f02d952012-07-04 19:11:20 +05305580 /* used on 8960 SGLTE for console */
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005581 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hsl.1"),
Mayank Rana1f02d952012-07-04 19:11:20 +05305582 /* used on 8960 standalone with Atheros Bluetooth */
5583 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hs.2"),
Mayank Ranae009c922012-03-22 03:02:06 +05305584 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, "msm_serial_hs.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005585 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5586 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5587 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005588 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005589 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005590 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5591 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005592 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5593 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5594 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5595 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005596 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005597 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005598 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005599 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005600 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Vikram Mulukutladd0a2372011-09-19 15:58:21 -07005601 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Matt Wagantallc1205292011-08-11 17:19:31 -07005602 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005603 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5604 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5605 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5606 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5607 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005608 CLK_LOOKUP("slimbus_xo_src_clk", slimbus_xo_src_clk.c, NULL),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005609 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005610 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5611 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005612 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5613 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5614 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5615 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5616 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5617 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005618 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5619 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5620 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5621 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5622 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005623 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005624 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005625 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005626 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005627 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Matt Wagantallac294852011-08-17 15:44:58 -07005628 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005629 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005630 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
5631 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Matt Wagantalle2522372011-08-17 14:52:21 -07005632 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
5633 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005634 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
Mayank Rana1f02d952012-07-04 19:11:20 +05305635 /* used on 8960 SGLTE for serial console */
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005636 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hsl.1"),
Mayank Rana1f02d952012-07-04 19:11:20 +05305637 /* used on 8960 standalone with Atheros Bluetooth */
5638 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hs.2"),
Mayank Ranae009c922012-03-22 03:02:06 +05305639 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "msm_serial_hs.1"),
Matt Wagantallac294852011-08-17 15:44:58 -07005640 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005641 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005642 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005643 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005644 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5645 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005646 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
5647 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005648 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005649 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5650 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5651 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5652 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
5653 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
Matt Wagantalle1a86062011-08-18 17:46:10 -07005654 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5655 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005656 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5657 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5658 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5659 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chan09f4e662011-12-16 08:17:02 -08005660 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
5661 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-006c"),
5662 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0048"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005663 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -08005664 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005665 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005666 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5667 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005668 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005669 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5670 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005671 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005672 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5673 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005674 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
Kevin Chane12c6672011-10-26 11:55:26 -07005675 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5676 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005677 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
5678 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
5679 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5680 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5681 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5682 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
5683 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
Kevin Chanf6216f22011-10-25 18:40:11 -07005684 CLK_LOOKUP("csiphy_timer_src_clk",
5685 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5686 CLK_LOOKUP("csiphy_timer_src_clk",
5687 csiphy_timer_src_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005688 CLK_LOOKUP("csiphy_timer_src_clk",
5689 csiphy_timer_src_clk.c, "msm_csiphy.2"),
Kevin Chanf6216f22011-10-25 18:40:11 -07005690 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5691 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005692 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005693 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5694 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5695 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5696 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005697 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005698 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
5699 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005700 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5701 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005702 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07005703 CLK_LOOKUP("core_clk", jpegd_clk.c, "msm_mercury.0"),
5704 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, "msm_mercury.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005705 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005706 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005707 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005708 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005709 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005710 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005711 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005712 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005713 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5714 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005715 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005716 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005717 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005718 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
5719 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005720 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005721 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005722 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Kevin Chana0853122011-11-07 19:48:44 -08005723 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005724 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chan5827c552011-10-28 18:36:32 -07005725 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005726 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chan5827c552011-10-28 18:36:32 -07005727 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005728 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5729 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5730 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5731 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5732 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5733 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5734 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005735 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5736 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005737 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5738 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005739 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005740 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5741 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5742 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5743 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005744 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005745 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005746 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5747 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005748 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005749 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005750 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005751 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005752 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005753 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005754 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005755 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005756 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005757 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005758 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chan5827c552011-10-28 18:36:32 -07005759 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005760 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chana0853122011-11-07 19:48:44 -08005761 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005762 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Patrick Lai04baee942012-05-01 14:38:47 -07005763 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5764 "msm-dai-q6-mi2s"),
5765 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5766 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005767 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5768 "msm-dai-q6.1"),
5769 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5770 "msm-dai-q6.1"),
5771 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5772 "msm-dai-q6.5"),
5773 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5774 "msm-dai-q6.5"),
5775 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
5776 "msm-dai-q6.16384"),
5777 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5778 "msm-dai-q6.16384"),
5779 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5780 "msm-dai-q6.4"),
5781 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5782 "msm-dai-q6.4"),
5783 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005784 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005785 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005786 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005787 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5788 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5789 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5790 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5791 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5792 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5793 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5794 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5795 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
5796 CLK_LOOKUP("core_clk", gfx3d_clk.c, "msm_iommu.9"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005797
5798 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5799 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5800 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5801 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5802 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005803 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5804 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005805
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005806 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
Manu Gautam5143b252012-01-05 19:25:23 -08005807 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005808 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5809 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5810 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5811 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5812 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
Yan He160633e2011-06-30 12:18:56 -07005813 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
Stephen Boyd1c51a492011-10-26 12:11:47 -07005814 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
Stephen Boydef5d1c42011-12-15 20:47:14 -08005815 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Ramesh Masavarapua1bc0e42012-03-05 07:42:48 -08005816 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005817
Matt Wagantalle1a86062011-08-18 17:46:10 -07005818 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005819 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5820 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Matt Wagantall8b38f942011-08-02 18:23:18 -07005821
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07005822 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
5823 CLK_LOOKUP("reset2_clk", dsi2_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07005824
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005825 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5826 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5827 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
5828 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
5829 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
5830 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005831};
5832
Patrick Dalye6f489042012-07-11 15:29:15 -07005833static struct clk_lookup msm_clocks_8960_only[] __initdata = {
5834 CLK_LOOKUP("enc_clk", tv_enc_clk.c, "tvenc.0"),
5835 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
5836 CLK_LOOKUP("iface_clk", tv_enc_p_clk.c, "tvenc.0"),
5837
5838 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "kgsl-2d0.0"),
5839 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "footswitch-8x60.0"),
5840 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "kgsl-2d1.1"),
5841 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "footswitch-8x60.1"),
5842 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "kgsl-2d0.0"),
5843 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "footswitch-8x60.0"),
5844 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "kgsl-2d1.1"),
5845 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "footswitch-8x60.1"),
5846 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "msm_iommu.10"),
5847 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "msm_iommu.11"),
5848};
5849
5850static struct clk_lookup msm_clocks_8960ab_only[] __initdata = {
5851 CLK_LOOKUP("bus_clk", gfx3d_axi_clk.c, "footswitch-8x60.2"),
Joel King9af070b2012-08-19 22:32:14 -07005852 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.10"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005853 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
5854};
5855
5856static struct clk_lookup msm_clocks_8960[ARRAY_SIZE(msm_clocks_8960_common)
5857 + ARRAY_SIZE(msm_clocks_8960_only)
5858 + ARRAY_SIZE(msm_clocks_8960ab_only)];
5859
Tianyi Goue3d4f542012-03-15 17:06:45 -07005860static struct clk_lookup msm_clocks_8930[] = {
Stephen Boydbe1a7392012-04-02 20:17:11 -07005861 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005862 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5863 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5864 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5865 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5866 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
5867 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
David Collinsa7d23532012-08-02 10:48:16 -07005868 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005869 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5870 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5871 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5872 CLK_LOOKUP("measure", measure_clk.c, "debug"),
5873
Matt Wagantalld75f1312012-05-23 16:17:35 -07005874 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5875 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5876 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5877 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5878 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5879 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5880 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5881 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5882 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5883 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5884 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5885 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5886 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5887 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5888 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5889 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5890
Tianyi Goue3d4f542012-03-15 17:06:45 -07005891 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005892 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005893 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5894 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5895 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
5896 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
5897 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5898 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5899 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5900 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5901 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005902 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005903 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5904 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005905 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005906 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5907 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5908 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5909 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5910 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5911 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5912 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005913
5914 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005915 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5916 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5917 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
5918
5919 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5920 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5921 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5922 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5923 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5924 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5925 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5926 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5927 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
5928 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
5929 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, ""),
5930 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, ""),
5931 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5932 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5933 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
5934 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
5935 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
5936 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5937 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
5938 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5939 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5940 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5941 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
5942 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, "qup_i2c.0"),
5943 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
5944 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
5945 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
5946 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
5947 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
5948 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
5949 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5950 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5951 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5952 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5953 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
5954 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, ""),
5955 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
5956 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5957 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
5958 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5959 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5960 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5961 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5962 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5963 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
5964 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5965 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5966 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5967 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5968 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
5969 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
5970 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
5971 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
5972 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
5973 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
5974 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
5975 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
5976 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
5977 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
5978 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
5979 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
5980 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
5981 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, ""),
5982 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "qup_i2c.0"),
5983 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
5984 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
5985 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
5986 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
5987 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
5988 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
5989 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
5990 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5991 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5992 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5993 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
5994 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
5995 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5996 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
5997 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5998 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5999 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
6000 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006001 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Hody Hung994f4622012-04-24 10:27:45 -07006002 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
Sreesudhan Ramakrish Ramkumar981c82c2012-04-30 17:31:37 -07006003 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006004 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
6005 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
6006 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
6007 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
6008 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
6009 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
6010 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
6011 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
6012 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
6013 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
6014 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
6015 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
6016 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
6017 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
6018 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
6019 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
6020 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
6021 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
6022 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
6023 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
6024 CLK_LOOKUP("csiphy_timer_src_clk",
6025 csiphy_timer_src_clk.c, "msm_csiphy.0"),
6026 CLK_LOOKUP("csiphy_timer_src_clk",
6027 csiphy_timer_src_clk.c, "msm_csiphy.1"),
6028 CLK_LOOKUP("csiphy_timer_src_clk",
6029 csiphy_timer_src_clk.c, "msm_csiphy.2"),
6030 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
6031 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
6032 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006033 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
6034 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006035 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
6036 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
6037 CLK_LOOKUP("bus_clk",
6038 gfx3d_axi_clk_8930.c, "footswitch-8x60.2"),
6039 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006040 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
6041 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006042 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006043 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006044 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006045 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006046 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006047 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006048 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
6049 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
6050 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006051 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
6052 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006053 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006054 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006055 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
6056 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006057 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
6058 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006059 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006060 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006061 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
6062 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
6063 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
6064 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
6065 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
6066 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
6067 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
6068 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
6069 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
6070 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
6071 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
6072 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
6073 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006074 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006075 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
6076 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
6077 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006078 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
6079 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006080 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
6081 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
6082 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
6083 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006084 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006085 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
6086 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006087 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006088 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
6089 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
6090 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
6091 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
6092 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
6093 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
6094 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
6095 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
6096 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
6097 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
6098 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.6"),
6099 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.6"),
6100 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
6101 "msm-dai-q6.1"),
6102 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
6103 "msm-dai-q6.1"),
6104 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
6105 "msm-dai-q6.5"),
6106 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
6107 "msm-dai-q6.5"),
6108 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
6109 "msm-dai-q6.16384"),
6110 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
6111 "msm-dai-q6.16384"),
6112 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
6113 "msm-dai-q6.4"),
6114 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
6115 "msm-dai-q6.4"),
6116 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
6117 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
6118 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
6119 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
6120 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
6121 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
6122 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
6123 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
6124 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
6125 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
6126 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
6127 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.9"),
6128 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.10"),
6129
6130 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
6131 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
6132 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
6133 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
6134 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08006135 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
6136 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006137
6138 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
6139 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
6140 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
6141 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
6142 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
6143 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
6144 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
6145 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
6146 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
6147 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
6148 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
6149
6150 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07006151 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
6152 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006153
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07006154 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07006155
Tianyi Goue3d4f542012-03-15 17:06:45 -07006156 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
6157 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
6158 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
6159 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
6160 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
6161 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
6162};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006163/*
6164 * Miscellaneous clock register initializations
6165 */
6166
6167/* Read, modify, then write-back a register. */
6168static void __init rmwreg(uint32_t val, void *reg, uint32_t mask)
6169{
6170 uint32_t regval = readl_relaxed(reg);
6171 regval &= ~mask;
6172 regval |= val;
6173 writel_relaxed(regval, reg);
6174}
6175
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006176static struct pll_config_regs pll4_regs __initdata = {
6177 .l_reg = LCC_PLL0_L_VAL_REG,
6178 .m_reg = LCC_PLL0_M_VAL_REG,
6179 .n_reg = LCC_PLL0_N_VAL_REG,
6180 .config_reg = LCC_PLL0_CONFIG_REG,
6181 .mode_reg = LCC_PLL0_MODE_REG,
6182};
Tianyi Gou41515e22011-09-01 19:37:43 -07006183
Matt Wagantall86e03822011-12-12 10:59:24 -08006184static struct pll_config pll4_config_393 __initdata = {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006185 .l = 0xE,
6186 .m = 0x27A,
6187 .n = 0x465,
6188 .vco_val = 0x0,
6189 .vco_mask = BM(17, 16),
6190 .pre_div_val = 0x0,
6191 .pre_div_mask = BIT(19),
6192 .post_div_val = 0x0,
6193 .post_div_mask = BM(21, 20),
6194 .mn_ena_val = BIT(22),
6195 .mn_ena_mask = BIT(22),
6196 .main_output_val = BIT(23),
6197 .main_output_mask = BIT(23),
6198};
Tianyi Gou41515e22011-09-01 19:37:43 -07006199
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006200static struct pll_config_regs pll15_regs __initdata = {
6201 .l_reg = MM_PLL3_L_VAL_REG,
6202 .m_reg = MM_PLL3_M_VAL_REG,
6203 .n_reg = MM_PLL3_N_VAL_REG,
6204 .config_reg = MM_PLL3_CONFIG_REG,
6205 .mode_reg = MM_PLL3_MODE_REG,
6206};
Tianyi Gou358c3862011-10-18 17:03:41 -07006207
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006208static struct pll_config pll15_config __initdata = {
6209 .l = (0x24 | BVAL(31, 7, 0x620)),
6210 .m = 0x1,
6211 .n = 0x9,
6212 .vco_val = BVAL(17, 16, 0x2),
6213 .vco_mask = BM(17, 16),
6214 .pre_div_val = 0x0,
6215 .pre_div_mask = BIT(19),
6216 .post_div_val = 0x0,
6217 .post_div_mask = BM(21, 20),
6218 .mn_ena_val = BIT(22),
6219 .mn_ena_mask = BIT(22),
6220 .main_output_val = BIT(23),
6221 .main_output_mask = BIT(23),
6222};
Tianyi Gou41515e22011-09-01 19:37:43 -07006223
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006224static struct pll_config_regs pll14_regs __initdata = {
6225 .l_reg = BB_PLL14_L_VAL_REG,
6226 .m_reg = BB_PLL14_M_VAL_REG,
6227 .n_reg = BB_PLL14_N_VAL_REG,
6228 .config_reg = BB_PLL14_CONFIG_REG,
6229 .mode_reg = BB_PLL14_MODE_REG,
6230};
6231
6232static struct pll_config pll14_config __initdata = {
6233 .l = (0x11 | BVAL(31, 7, 0x620)),
6234 .m = 0x7,
6235 .n = 0x9,
6236 .vco_val = 0x0,
6237 .vco_mask = BM(17, 16),
6238 .pre_div_val = 0x0,
6239 .pre_div_mask = BIT(19),
6240 .post_div_val = 0x0,
6241 .post_div_mask = BM(21, 20),
6242 .mn_ena_val = BIT(22),
6243 .mn_ena_mask = BIT(22),
6244 .main_output_val = BIT(23),
6245 .main_output_mask = BIT(23),
6246};
Tianyi Gou41515e22011-09-01 19:37:43 -07006247
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006248static void __init reg_init(void)
6249{
Stephen Boydd471e7a2011-11-19 01:37:39 -08006250 void __iomem *imem_reg;
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006251
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006252 /* Deassert MM SW_RESET_ALL signal. */
6253 writel_relaxed(0, SW_RESET_ALL_REG);
6254
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006255 /*
Tianyi Goue3d4f542012-03-15 17:06:45 -07006256 * Some bits are only used on 8960 or 8064 or 8930 and are marked as
6257 * reserved bits on the other SoCs. Writing to these reserved bits
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006258 * should have no effect.
6259 */
Stephen Boydd471e7a2011-11-19 01:37:39 -08006260 /*
6261 * Initialize MM AHB registers: Enable the FPB clock and disable HW
Patrick Dalye6f489042012-07-11 15:29:15 -07006262 * gating on 8627 and 8960 for all clocks. Also set VFE_AHB's
Stephen Boydd471e7a2011-11-19 01:37:39 -08006263 * FORCE_CORE_ON bit to prevent its memory from being collapsed when
6264 * the clock is halted. The sleep and wake-up delays are set to safe
6265 * values.
6266 */
Patrick Dalye6f489042012-07-11 15:29:15 -07006267 if (cpu_is_msm8627() || cpu_is_msm8960ab()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006268 rmwreg(0x00000003, AHB_EN_REG, 0x6C000103);
6269 writel_relaxed(0x000007F9, AHB_EN2_REG);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006270 } else {
David Garibaldif69836a2012-08-17 16:05:22 -07006271 rmwreg(0x40000000, AHB_EN_REG, 0x6C000103);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006272 writel_relaxed(0x3C7097F9, AHB_EN2_REG);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006273 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006274
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006275 if (cpu_is_apq8064())
Tianyi Gouf3095ea2012-05-22 14:16:06 -07006276 rmwreg(0x00000001, AHB_EN3_REG, 0x00000001);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006277
6278 /* Deassert all locally-owned MM AHB resets. */
6279 rmwreg(0, SW_RESET_AHB_REG, 0xFFF7DFFF);
Tianyi Gou41515e22011-09-01 19:37:43 -07006280 rmwreg(0, SW_RESET_AHB2_REG, 0x0000000F);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006281
6282 /* Initialize MM AXI registers: Enable HW gating for all clocks that
6283 * support it. Also set FORCE_CORE_ON bits, and any sleep and wake-up
6284 * delays to safe values. */
Patrick Dalye6f489042012-07-11 15:29:15 -07006285 if (cpu_is_msm8960ab() || (cpu_is_msm8960() &&
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006286 SOCINFO_VERSION_MAJOR(socinfo_get_version()) < 3) ||
6287 cpu_is_msm8627()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006288 rmwreg(0x000007F9, MAXI_EN_REG, 0x0803FFFF);
6289 rmwreg(0x3027FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006290 } else {
6291 rmwreg(0x0003AFF9, MAXI_EN_REG, 0x0803FFFF);
6292 rmwreg(0x3A27FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006293 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006294
Matt Wagantall53d968f2011-07-19 13:22:53 -07006295 rmwreg(0x0027FCFF, MAXI_EN3_REG, 0x003FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006296 rmwreg(0x0027FCFF, MAXI_EN4_REG, 0x017FFFFF);
6297
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006298 if (cpu_is_apq8064())
Tianyi Gouf3095ea2012-05-22 14:16:06 -07006299 rmwreg(0x019FECFF, MAXI_EN5_REG, 0x01FFEFFF);
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006300 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006301 rmwreg(0x000004FF, MAXI_EN5_REG, 0x00000FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006302 if (cpu_is_msm8960ab())
6303 rmwreg(0x009FE000, MAXI_EN5_REG, 0x01FFE000);
6304
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006305 if (cpu_is_msm8627())
Stephen Boydd471e7a2011-11-19 01:37:39 -08006306 rmwreg(0x000003C7, SAXI_EN_REG, 0x00003FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006307 else if (cpu_is_msm8960ab())
6308 rmwreg(0x000001C6, SAXI_EN_REG, 0x00001DF6);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006309 else
6310 rmwreg(0x00003C38, SAXI_EN_REG, 0x00003FFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006311
6312 /* Enable IMEM's clk_on signal */
6313 imem_reg = ioremap(0x04b00040, 4);
6314 if (imem_reg) {
6315 writel_relaxed(0x3, imem_reg);
6316 iounmap(imem_reg);
6317 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006318
6319 /* Initialize MM CC registers: Set MM FORCE_CORE_ON bits so that core
6320 * memories retain state even when not clocked. Also, set sleep and
6321 * wake-up delays to safe values. */
Matt Wagantall53d968f2011-07-19 13:22:53 -07006322 rmwreg(0x00000000, CSI0_CC_REG, 0x00000410);
6323 rmwreg(0x00000000, CSI1_CC_REG, 0x00000410);
6324 rmwreg(0x80FF0000, DSI1_BYTE_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006325 rmwreg(0x80FF0000, DSI_PIXEL_CC_REG, 0xE0FF0010);
Tarun Karra6fbc00a2011-12-13 09:23:47 -07006326 rmwreg(0xC0FF0000, GFX3D_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006327 rmwreg(0x80FF0000, IJPEG_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006328 rmwreg(0x80FF0000, MDP_CC_REG, 0xE1FF0010);
6329 rmwreg(0x80FF0000, MDP_LUT_CC_REG, 0xE0FF0010);
6330 rmwreg(0x80FF0000, ROT_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006331 rmwreg(0x000004FF, TV_CC2_REG, 0x000007FF);
6332 rmwreg(0xC0FF0000, VCODEC_CC_REG, 0xE0FF0010);
6333 rmwreg(0x80FF0000, VFE_CC_REG, 0xE0FF4010);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006334 rmwreg(0x800000FF, VFE_CC2_REG, 0xE00000FF);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006335 rmwreg(0x80FF0000, VPE_CC_REG, 0xE0FF0010);
Patrick Dalye6f489042012-07-11 15:29:15 -07006336 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_apq8064()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006337 rmwreg(0x80FF0000, DSI2_BYTE_CC_REG, 0xE0FF0010);
6338 rmwreg(0x80FF0000, DSI2_PIXEL_CC_REG, 0xE0FF0010);
6339 rmwreg(0x80FF0000, JPEGD_CC_REG, 0xE0FF0010);
6340 }
Patrick Dalye6f489042012-07-11 15:29:15 -07006341 if (cpu_is_msm8960ab())
6342 rmwreg(0x00000001, DSI2_PIXEL_CC2_REG, 0x00000001);
6343
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006344 if (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm8930aa() ||
6345 cpu_is_msm8627())
Patrick Dalye6f489042012-07-11 15:29:15 -07006346 rmwreg(0x80FF0000, TV_CC_REG, 0xE1FFC010);
6347 if (cpu_is_msm8960ab())
6348 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Goue3d4f542012-03-15 17:06:45 -07006349
6350 if (cpu_is_msm8960()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006351 rmwreg(0x80FF0000, GFX2D0_CC_REG, 0xE0FF0010);
6352 rmwreg(0x80FF0000, GFX2D1_CC_REG, 0xE0FF0010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006353 }
6354 if (cpu_is_apq8064()) {
6355 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Gou621f8742011-09-01 21:45:01 -07006356 rmwreg(0x80FF0000, VCAP_CC_REG, 0xE0FF1010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006357 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006358
Tianyi Gou41515e22011-09-01 19:37:43 -07006359 /*
6360 * Initialize USB_HS_HCLK_FS registers: Set FORCE_C_ON bits so that
6361 * core remain active during halt state of the clk. Also, set sleep
6362 * and wake-up value to max.
6363 */
6364 rmwreg(0x0000004F, USB_HS1_HCLK_FS_REG, 0x0000007F);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006365 if (cpu_is_apq8064()) {
6366 rmwreg(0x0000004F, USB_HS3_HCLK_FS_REG, 0x0000007F);
6367 rmwreg(0x0000004F, USB_HS4_HCLK_FS_REG, 0x0000007F);
6368 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006369
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006370 /* De-assert MM AXI resets to all hardware blocks. */
6371 writel_relaxed(0, SW_RESET_AXI_REG);
6372
6373 /* Deassert all MM core resets. */
6374 writel_relaxed(0, SW_RESET_CORE_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006375 writel_relaxed(0, SW_RESET_CORE2_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006376
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006377 /* Enable TSSC and PDM PXO sources. */
6378 writel_relaxed(BIT(11), TSSC_CLK_CTL_REG);
6379 writel_relaxed(BIT(15), PDM_CLK_NS_REG);
6380
6381 /* Source SLIMBus xo src from slimbus reference clock */
Patrick Dalye6f489042012-07-11 15:29:15 -07006382 if (cpu_is_msm8960ab() || cpu_is_msm8960())
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006383 writel_relaxed(0x3, SLIMBUS_XO_SRC_CLK_CTL_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006384
6385 /* Source the dsi_byte_clks from the DSI PHY PLLs */
6386 rmwreg(0x1, DSI1_BYTE_NS_REG, 0x7);
Patrick Dalye6f489042012-07-11 15:29:15 -07006387 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_apq8064())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006388 rmwreg(0x2, DSI2_BYTE_NS_REG, 0x7);
Tianyi Gou41515e22011-09-01 19:37:43 -07006389
Siddhartha Agrawal482459c2012-05-24 15:28:53 -07006390 /* Source the dsi1_esc_clk from the DSI1 PHY PLLs */
6391 rmwreg(0x1, DSI1_ESC_NS_REG, 0x7);
6392
Tianyi Gou352955d2012-05-18 19:44:01 -07006393 /*
6394 * Source the sata_phy_ref_clk from PXO and set predivider of
6395 * sata_pmalive_clk to 1.
6396 */
6397 if (cpu_is_apq8064()) {
Tianyi Gou41515e22011-09-01 19:37:43 -07006398 rmwreg(0, SATA_PHY_REF_CLK_CTL_REG, 0x1);
Tianyi Gou352955d2012-05-18 19:44:01 -07006399 rmwreg(0, SATA_PMALIVE_CLK_CTL_REG, 0x3);
6400 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006401
6402 /*
Tianyi Gou05e01102012-02-08 22:15:49 -08006403 * TODO: Programming below PLLs and prng_clk is temporary and
6404 * needs to be removed after bootloaders program them.
Tianyi Gou41515e22011-09-01 19:37:43 -07006405 */
6406 if (cpu_is_apq8064()) {
Tianyi Gou317aa862012-02-06 14:31:07 -08006407 u32 is_pll_enabled;
Tianyi Gou41515e22011-09-01 19:37:43 -07006408
6409 /* Program pxo_src_clk to source from PXO */
6410 rmwreg(0x1, PXO_SRC_CLK_CTL_REG, 0x7);
6411
Tianyi Gou41515e22011-09-01 19:37:43 -07006412 /* Check if PLL14 is active */
6413 is_pll_enabled = readl_relaxed(BB_PLL14_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006414 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006415 /* Ref clk = 27MHz and program pll14 to 480MHz */
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006416 configure_pll(&pll14_config, &pll14_regs, 1);
Tianyi Gou621f8742011-09-01 21:45:01 -07006417
Tianyi Gou621f8742011-09-01 21:45:01 -07006418 /* Program PLL15 to 975MHz with ref clk = 27MHz */
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006419 configure_pll(&pll15_config, &pll15_regs, 0);
Tianyi Gouc29c3242011-10-12 21:02:15 -07006420
6421 /* Check if PLL4 is active */
6422 is_pll_enabled = readl_relaxed(LCC_PLL0_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006423 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006424 /* Ref clk = 27MHz and program pll4 to 393.2160MHz */
Matt Wagantall86e03822011-12-12 10:59:24 -08006425 configure_pll(&pll4_config_393, &pll4_regs, 1);
Tianyi Gouc29c3242011-10-12 21:02:15 -07006426
6427 /* Enable PLL4 source on the LPASS Primary PLL Mux */
6428 writel_relaxed(0x1, LCC_PRI_PLL_CLK_CTL_REG);
Tianyi Gou05e01102012-02-08 22:15:49 -08006429
6430 /* Program prng_clk to 64MHz if it isn't configured */
6431 if (!readl_relaxed(PRNG_CLK_NS_REG))
6432 writel_relaxed(0x2B, PRNG_CLK_NS_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006433 }
Tianyi Gou65c536a2012-03-20 23:20:29 -07006434
6435 /*
6436 * Program PLL15 to 900MHz with ref clk = 27MHz and
6437 * only enable PLL main output.
6438 */
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006439 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006440 pll15_config.l = 0x21 | BVAL(31, 7, 0x600);
6441 pll15_config.m = 0x1;
6442 pll15_config.n = 0x3;
6443 configure_pll(&pll15_config, &pll15_regs, 0);
6444 /* Disable AUX and BIST outputs */
6445 writel_relaxed(0, MM_PLL3_TEST_CTL_REG);
Tianyi Gou65c536a2012-03-20 23:20:29 -07006446 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006447}
6448
Patrick Dalye6f489042012-07-11 15:29:15 -07006449struct clock_init_data msm8960_clock_init_data __initdata;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006450static void __init msm8960_clock_pre_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006451{
Matt Wagantall86e03822011-12-12 10:59:24 -08006452 /* Initialize clock registers. */
6453 reg_init();
6454
Patrick Daly1a3859f2012-08-27 16:10:26 -07006455 if (cpu_is_apq8064())
Matt Wagantall82feaa12012-07-09 10:54:49 -07006456 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8064;
Tianyi Goubf3d0b12012-01-23 14:37:28 -08006457
Matt Wagantall86e03822011-12-12 10:59:24 -08006458 /* Detect PLL4 programmed for alternate 491.52MHz clock plan. */
6459 if (readl_relaxed(LCC_PLL0_L_VAL_REG) == 0x12) {
6460 pll4_clk.c.rate = 491520000;
6461 audio_slimbus_clk.freq_tbl = clk_tbl_aif_osr_492;
6462 mi2s_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6463 codec_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6464 spare_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6465 codec_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6466 spare_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6467 pcm_clk.freq_tbl = clk_tbl_pcm_492;
6468 }
6469
Patrick Dalye6f489042012-07-11 15:29:15 -07006470 if (cpu_is_msm8960() || cpu_is_msm8960ab())
6471 memcpy(msm_clocks_8960, msm_clocks_8960_common,
6472 sizeof(msm_clocks_8960_common));
6473 if (cpu_is_msm8960ab()) {
6474 pll3_clk.c.rate = 650000000;
6475 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8960ab;
6476 gfx3d_clk.c.fmax[VDD_DIG_LOW] = 192000000;
6477 gfx3d_clk.c.fmax[VDD_DIG_NOMINAL] = 325000000;
6478 gfx3d_clk.c.fmax[VDD_DIG_HIGH] = 400000000;
6479 mdp_clk.freq_tbl = clk_tbl_mdp_8960ab;
6480 mdp_clk.c.fmax[VDD_DIG_LOW] = 128000000;
6481 mdp_clk.c.fmax[VDD_DIG_NOMINAL] = 266667000;
6482
6483 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6484 msm_clocks_8960ab_only, sizeof(msm_clocks_8960ab_only));
6485 msm8960_clock_init_data.size -=
6486 ARRAY_SIZE(msm_clocks_8960_only);
Joel King9af070b2012-08-19 22:32:14 -07006487
6488 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Patrick Dalye6f489042012-07-11 15:29:15 -07006489 } else if (cpu_is_msm8960()) {
6490 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6491 msm_clocks_8960_only, sizeof(msm_clocks_8960_only));
6492 msm8960_clock_init_data.size -=
6493 ARRAY_SIZE(msm_clocks_8960ab_only);
6494 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006495 /*
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006496 * Change the freq tables for and voltage requirements for
6497 * clocks which differ between 8960 and 8064.
Tianyi Gou41515e22011-09-01 19:37:43 -07006498 */
6499 if (cpu_is_apq8064()) {
6500 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8064;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006501
6502 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8064,
6503 sizeof(gfx3d_clk.c.fmax));
6504 memcpy(ijpeg_clk.c.fmax, fmax_ijpeg_8064,
6505 sizeof(ijpeg_clk.c.fmax));
6506 memcpy(mdp_clk.c.fmax, fmax_mdp_8064,
6507 sizeof(ijpeg_clk.c.fmax));
6508 memcpy(tv_src_clk.c.fmax, fmax_tv_src_8064,
6509 sizeof(tv_src_clk.c.fmax));
6510 memcpy(vfe_clk.c.fmax, fmax_vfe_8064,
6511 sizeof(vfe_clk.c.fmax));
6512
Patrick Dalye6f489042012-07-11 15:29:15 -07006513 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Tianyi Goue3d4f542012-03-15 17:06:45 -07006514 }
6515
6516 /*
6517 * Change the freq tables and voltage requirements for
6518 * clocks which differ between 8960 and 8930.
6519 */
Patrick Dalyebe63c52012-08-07 15:41:30 -07006520 if (cpu_is_msm8930() || cpu_is_msm8627()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006521 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8930,
6522 sizeof(gfx3d_clk.c.fmax));
Patrick Dalyebe63c52012-08-07 15:41:30 -07006523 } else if (cpu_is_msm8930aa()) {
6524 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8930aa,
6525 sizeof(gfx3d_clk.c.fmax));
6526 }
6527 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
6528 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8930;
Tianyi Goue3d4f542012-03-15 17:06:45 -07006529 pll15_clk.c.rate = 900000000;
6530 gmem_axi_clk.c.depends = &gfx3d_axi_clk_8930.c;
Tianyi Gou41515e22011-09-01 19:37:43 -07006531 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07006532 if ((readl_relaxed(PRNG_CLK_NS_REG) & 0x7F) == 0x2B)
6533 prng_clk.freq_tbl = clk_tbl_prng_64;
Stephen Boyd94625ef2011-07-12 17:06:01 -07006534
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006535 vote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006536
Vikram Mulukutla681d8682012-03-09 23:56:20 -08006537 clk_ops_local_pll.enable = sr_pll_clk_enable;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006538}
6539
Patrick Daly1a3859f2012-08-27 16:10:26 -07006540static void __init msm8930_pm8917_clock_pre_init(void)
6541{
6542 /* detect pmic8917 from board file, and call this init function */
6543
6544 vdd_dig.set_vdd = set_vdd_dig_8930;
6545 rpm_vreg_dig_8930 = RPM_VREG_ID_PM8917_VDD_DIG_CORNER;
6546 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930_pm8917;
6547
6548 msm8960_clock_pre_init();
6549}
6550
6551static void __init msm8930_clock_pre_init(void)
6552{
6553 vdd_dig.set_vdd = set_vdd_dig_8930;
6554 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930;
6555
6556 msm8960_clock_pre_init();
6557}
6558
Matt Wagantallb64888f2012-04-02 21:35:07 -07006559static void __init msm8960_clock_post_init(void)
6560{
6561 /* Keep PXO on whenever APPS cpu is active */
6562 clk_prepare_enable(&pxo_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006563
Matt Wagantalle655cd72012-04-09 10:15:03 -07006564 /* Reset 3D core while clocked to ensure it resets completely. */
6565 clk_set_rate(&gfx3d_clk.c, 27000000);
6566 clk_prepare_enable(&gfx3d_clk.c);
6567 clk_reset(&gfx3d_clk.c, CLK_RESET_ASSERT);
6568 udelay(5);
6569 clk_reset(&gfx3d_clk.c, CLK_RESET_DEASSERT);
6570 clk_disable_unprepare(&gfx3d_clk.c);
6571
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006572 /* Initialize rates for clocks that only support one. */
6573 clk_set_rate(&pdm_clk.c, 27000000);
Stephen Boyd842a1f62012-04-26 19:07:38 -07006574 clk_set_rate(&prng_clk.c, prng_clk.freq_tbl->freq_hz);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006575 clk_set_rate(&mdp_vsync_clk.c, 27000000);
6576 clk_set_rate(&tsif_ref_clk.c, 105000);
6577 clk_set_rate(&tssc_clk.c, 27000000);
6578 clk_set_rate(&usb_hs1_xcvr_clk.c, 60000000);
Tianyi Gou41515e22011-09-01 19:37:43 -07006579 if (cpu_is_apq8064()) {
6580 clk_set_rate(&usb_hs3_xcvr_clk.c, 60000000);
6581 clk_set_rate(&usb_hs4_xcvr_clk.c, 60000000);
6582 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006583 clk_set_rate(&usb_fs1_src_clk.c, 60000000);
Patrick Dalye6f489042012-07-11 15:29:15 -07006584 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_msm8930() ||
6585 cpu_is_msm8930aa() || cpu_is_msm8627())
Tianyi Gou41515e22011-09-01 19:37:43 -07006586 clk_set_rate(&usb_fs2_src_clk.c, 60000000);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006587 clk_set_rate(&usb_hsic_xcvr_fs_clk.c, 60000000);
6588 clk_set_rate(&usb_hsic_hsic_src_clk.c, 480000000);
6589 clk_set_rate(&usb_hsic_hsio_cal_clk.c, 9000000);
Lena Salman127823f2012-02-14 17:13:53 +02006590 clk_set_rate(&usb_hsic_system_clk.c, 60000000);
Stephen Boyd092fd182011-10-21 15:56:30 -07006591 /*
6592 * Set the CSI rates to a safe default to avoid warnings when
6593 * switching csi pix and rdi clocks.
6594 */
6595 clk_set_rate(&csi0_src_clk.c, 27000000);
6596 clk_set_rate(&csi1_src_clk.c, 27000000);
6597 clk_set_rate(&csi2_src_clk.c, 27000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006598
6599 /*
Stephen Boyd60496bb2011-10-17 13:51:37 -07006600 * The halt status bits for these clocks may be incorrect at boot.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006601 * Toggle these clocks on and off to refresh them.
6602 */
Stephen Boyd409b8b42012-04-10 12:12:56 -07006603 clk_prepare_enable(&pdm_clk.c);
6604 clk_disable_unprepare(&pdm_clk.c);
6605 clk_prepare_enable(&tssc_clk.c);
6606 clk_disable_unprepare(&tssc_clk.c);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006607 clk_prepare_enable(&usb_hsic_hsic_clk.c);
6608 clk_disable_unprepare(&usb_hsic_hsic_clk.c);
Stephen Boydd7a143a2012-02-16 17:59:26 -08006609
6610 /*
6611 * Keep sfab floor @ 54MHz so that Krait AHB is at least 27MHz at all
6612 * times when Apps CPU is active. This ensures the timer's requirement
6613 * of Krait AHB running 4 times as fast as the timer itself.
6614 */
6615 clk_set_rate(&sfab_tmr_a_clk.c, 54000000);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006616 clk_prepare_enable(&sfab_tmr_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006617}
6618
Stephen Boydbb600ae2011-08-02 20:11:40 -07006619static int __init msm8960_clock_late_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006620{
Stephen Boyda3787f32011-09-16 18:55:13 -07006621 int rc;
6622 struct clk *mmfpb_a_clk = clk_get_sys("clock-8960", "mmfpb_a_clk");
Stephen Boyd85436132011-09-16 18:55:13 -07006623 struct clk *cfpb_a_clk = clk_get_sys("clock-8960", "cfpb_a_clk");
Stephen Boyda3787f32011-09-16 18:55:13 -07006624
6625 /* Vote for MMFPB to be at least 76.8MHz when an Apps CPU is active. */
6626 if (WARN(IS_ERR(mmfpb_a_clk), "mmfpb_a_clk not found (%ld)\n",
6627 PTR_ERR(mmfpb_a_clk)))
6628 return PTR_ERR(mmfpb_a_clk);
Matt Wagantallde555f562011-11-08 14:18:07 -08006629 rc = clk_set_rate(mmfpb_a_clk, 76800000);
Stephen Boyda3787f32011-09-16 18:55:13 -07006630 if (WARN(rc, "mmfpb_a_clk rate was not set (%d)\n", rc))
6631 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006632 rc = clk_prepare_enable(mmfpb_a_clk);
Stephen Boyda3787f32011-09-16 18:55:13 -07006633 if (WARN(rc, "mmfpb_a_clk not enabled (%d)\n", rc))
6634 return rc;
6635
Stephen Boyd85436132011-09-16 18:55:13 -07006636 /* Vote for CFPB to be at least 64MHz when an Apps CPU is active. */
6637 if (WARN(IS_ERR(cfpb_a_clk), "cfpb_a_clk not found (%ld)\n",
6638 PTR_ERR(cfpb_a_clk)))
6639 return PTR_ERR(cfpb_a_clk);
Matt Wagantallde555f562011-11-08 14:18:07 -08006640 rc = clk_set_rate(cfpb_a_clk, 64000000);
Stephen Boyd85436132011-09-16 18:55:13 -07006641 if (WARN(rc, "cfpb_a_clk rate was not set (%d)\n", rc))
6642 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006643 rc = clk_prepare_enable(cfpb_a_clk);
Stephen Boyd85436132011-09-16 18:55:13 -07006644 if (WARN(rc, "cfpb_a_clk not enabled (%d)\n", rc))
6645 return rc;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006646
6647 return unvote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006648}
Stephen Boydbb600ae2011-08-02 20:11:40 -07006649
6650struct clock_init_data msm8960_clock_init_data __initdata = {
6651 .table = msm_clocks_8960,
6652 .size = ARRAY_SIZE(msm_clocks_8960),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006653 .pre_init = msm8960_clock_pre_init,
6654 .post_init = msm8960_clock_post_init,
Stephen Boydbb600ae2011-08-02 20:11:40 -07006655 .late_init = msm8960_clock_late_init,
6656};
Tianyi Gou41515e22011-09-01 19:37:43 -07006657
6658struct clock_init_data apq8064_clock_init_data __initdata = {
6659 .table = msm_clocks_8064,
6660 .size = ARRAY_SIZE(msm_clocks_8064),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006661 .pre_init = msm8960_clock_pre_init,
6662 .post_init = msm8960_clock_post_init,
Tianyi Gou41515e22011-09-01 19:37:43 -07006663 .late_init = msm8960_clock_late_init,
6664};
Tianyi Goue3d4f542012-03-15 17:06:45 -07006665
6666struct clock_init_data msm8930_clock_init_data __initdata = {
6667 .table = msm_clocks_8930,
6668 .size = ARRAY_SIZE(msm_clocks_8930),
Patrick Daly1a3859f2012-08-27 16:10:26 -07006669 .pre_init = msm8930_clock_pre_init,
6670 .post_init = msm8960_clock_post_init,
6671 .late_init = msm8960_clock_late_init,
6672};
6673
6674struct clock_init_data msm8930_pm8917_clock_init_data __initdata = {
6675 .table = msm_clocks_8930,
6676 .size = ARRAY_SIZE(msm_clocks_8930),
6677 .pre_init = msm8930_pm8917_clock_pre_init,
Matt Wagantallb64888f2012-04-02 21:35:07 -07006678 .post_init = msm8960_clock_post_init,
Tianyi Goue3d4f542012-03-15 17:06:45 -07006679 .late_init = msm8960_clock_late_init,
6680};