blob: 3a72be3a93d5aa8c41becb3d73c9f2c43251d508 [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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027#include <mach/rpm-regulator.h>
Stephen Boyd94625ef2011-07-12 17:06:01 -070028#include <mach/socinfo.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029
Matt Wagantall33d01f52012-02-23 23:27:44 -080030#include "clock.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031#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),
522 },
523};
524
Stephen Boyd94625ef2011-07-12 17:06:01 -0700525static struct pll_clk pll3_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700526 .mode_reg = BB_MMCC_PLL2_MODE_REG,
527 .parent = &pxo_clk.c,
528 .c = {
529 .dbg_name = "pll3_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800530 .rate = 1200000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800531 .ops = &clk_ops_local_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -0700532 .vdd_class = &vdd_sr2_hdmi_pll,
533 .fmax[VDD_SR2_HDMI_PLL_ON] = ULONG_MAX,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700534 CLK_INIT(pll3_clk.c),
535 },
536};
537
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700538static struct pll_vote_clk pll4_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700539 .en_reg = BB_PLL_ENA_SC0_REG,
540 .en_mask = BIT(4),
541 .status_reg = LCC_PLL0_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800542 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700543 .parent = &pxo_clk.c,
544 .c = {
545 .dbg_name = "pll4_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800546 .rate = 393216000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700547 .ops = &clk_ops_pll_vote,
548 CLK_INIT(pll4_clk.c),
549 },
550};
551
552static struct pll_vote_clk pll8_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700553 .en_reg = BB_PLL_ENA_SC0_REG,
554 .en_mask = BIT(8),
555 .status_reg = BB_PLL8_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800556 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700557 .parent = &pxo_clk.c,
558 .c = {
559 .dbg_name = "pll8_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800560 .rate = 384000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700561 .ops = &clk_ops_pll_vote,
562 CLK_INIT(pll8_clk.c),
563 },
564};
565
Stephen Boyd94625ef2011-07-12 17:06:01 -0700566static struct pll_vote_clk pll14_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700567 .en_reg = BB_PLL_ENA_SC0_REG,
568 .en_mask = BIT(14),
569 .status_reg = BB_PLL14_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800570 .status_mask = BIT(16),
Stephen Boyd94625ef2011-07-12 17:06:01 -0700571 .parent = &pxo_clk.c,
572 .c = {
573 .dbg_name = "pll14_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800574 .rate = 480000000,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700575 .ops = &clk_ops_pll_vote,
576 CLK_INIT(pll14_clk.c),
577 },
578};
579
Tianyi Gou41515e22011-09-01 19:37:43 -0700580static struct pll_clk pll15_clk = {
Tianyi Gou41515e22011-09-01 19:37:43 -0700581 .mode_reg = MM_PLL3_MODE_REG,
582 .parent = &pxo_clk.c,
583 .c = {
584 .dbg_name = "pll15_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800585 .rate = 975000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800586 .ops = &clk_ops_local_pll,
Tianyi Gou41515e22011-09-01 19:37:43 -0700587 CLK_INIT(pll15_clk.c),
588 },
589};
590
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591/* AXI Interfaces */
592static struct branch_clk gmem_axi_clk = {
593 .b = {
594 .ctl_reg = MAXI_EN_REG,
595 .en_mask = BIT(24),
596 .halt_reg = DBG_BUS_VEC_E_REG,
597 .halt_bit = 6,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800598 .retain_reg = MAXI_EN2_REG,
599 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700600 },
601 .c = {
602 .dbg_name = "gmem_axi_clk",
603 .ops = &clk_ops_branch,
604 CLK_INIT(gmem_axi_clk.c),
605 },
606};
607
608static struct branch_clk ijpeg_axi_clk = {
609 .b = {
610 .ctl_reg = MAXI_EN_REG,
611 .en_mask = BIT(21),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800612 .hwcg_reg = MAXI_EN_REG,
613 .hwcg_mask = BIT(11),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700614 .reset_reg = SW_RESET_AXI_REG,
615 .reset_mask = BIT(14),
616 .halt_reg = DBG_BUS_VEC_E_REG,
617 .halt_bit = 4,
618 },
619 .c = {
620 .dbg_name = "ijpeg_axi_clk",
621 .ops = &clk_ops_branch,
622 CLK_INIT(ijpeg_axi_clk.c),
623 },
624};
625
626static struct branch_clk imem_axi_clk = {
627 .b = {
628 .ctl_reg = MAXI_EN_REG,
629 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800630 .hwcg_reg = MAXI_EN_REG,
631 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700632 .reset_reg = SW_RESET_CORE_REG,
633 .reset_mask = BIT(10),
634 .halt_reg = DBG_BUS_VEC_E_REG,
635 .halt_bit = 7,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800636 .retain_reg = MAXI_EN2_REG,
637 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700638 },
639 .c = {
640 .dbg_name = "imem_axi_clk",
641 .ops = &clk_ops_branch,
642 CLK_INIT(imem_axi_clk.c),
643 },
644};
645
646static struct branch_clk jpegd_axi_clk = {
647 .b = {
648 .ctl_reg = MAXI_EN_REG,
649 .en_mask = BIT(25),
650 .halt_reg = DBG_BUS_VEC_E_REG,
651 .halt_bit = 5,
652 },
653 .c = {
654 .dbg_name = "jpegd_axi_clk",
655 .ops = &clk_ops_branch,
656 CLK_INIT(jpegd_axi_clk.c),
657 },
658};
659
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700660static struct branch_clk vcodec_axi_b_clk = {
661 .b = {
662 .ctl_reg = MAXI_EN4_REG,
663 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800664 .hwcg_reg = MAXI_EN4_REG,
665 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700666 .halt_reg = DBG_BUS_VEC_I_REG,
667 .halt_bit = 25,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800668 .retain_reg = MAXI_EN4_REG,
669 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700670 },
671 .c = {
672 .dbg_name = "vcodec_axi_b_clk",
673 .ops = &clk_ops_branch,
674 CLK_INIT(vcodec_axi_b_clk.c),
675 },
676};
677
Matt Wagantall91f42702011-07-14 12:01:15 -0700678static struct branch_clk vcodec_axi_a_clk = {
679 .b = {
680 .ctl_reg = MAXI_EN4_REG,
681 .en_mask = BIT(25),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800682 .hwcg_reg = MAXI_EN4_REG,
683 .hwcg_mask = BIT(24),
Matt Wagantall91f42702011-07-14 12:01:15 -0700684 .halt_reg = DBG_BUS_VEC_I_REG,
685 .halt_bit = 26,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800686 .retain_reg = MAXI_EN4_REG,
687 .retain_mask = BIT(10),
Matt Wagantall91f42702011-07-14 12:01:15 -0700688 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700689 .c = {
690 .dbg_name = "vcodec_axi_a_clk",
691 .ops = &clk_ops_branch,
692 CLK_INIT(vcodec_axi_a_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700693 .depends = &vcodec_axi_b_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700694 },
695};
696
697static struct branch_clk vcodec_axi_clk = {
698 .b = {
699 .ctl_reg = MAXI_EN_REG,
700 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800701 .hwcg_reg = MAXI_EN_REG,
702 .hwcg_mask = BIT(13),
Matt Wagantall91f42702011-07-14 12:01:15 -0700703 .reset_reg = SW_RESET_AXI_REG,
Gopikrishnaiah Anandan83b6e852012-01-05 17:47:02 -0800704 .reset_mask = BIT(4)|BIT(5)|BIT(7),
Matt Wagantall91f42702011-07-14 12:01:15 -0700705 .halt_reg = DBG_BUS_VEC_E_REG,
706 .halt_bit = 3,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800707 .retain_reg = MAXI_EN2_REG,
708 .retain_mask = BIT(28),
Matt Wagantall91f42702011-07-14 12:01:15 -0700709 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700710 .c = {
711 .dbg_name = "vcodec_axi_clk",
712 .ops = &clk_ops_branch,
713 CLK_INIT(vcodec_axi_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700714 .depends = &vcodec_axi_a_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700715 },
716};
717
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700718static struct branch_clk vfe_axi_clk = {
719 .b = {
720 .ctl_reg = MAXI_EN_REG,
721 .en_mask = BIT(18),
722 .reset_reg = SW_RESET_AXI_REG,
723 .reset_mask = BIT(9),
724 .halt_reg = DBG_BUS_VEC_E_REG,
725 .halt_bit = 0,
726 },
727 .c = {
728 .dbg_name = "vfe_axi_clk",
729 .ops = &clk_ops_branch,
730 CLK_INIT(vfe_axi_clk.c),
731 },
732};
733
734static struct branch_clk mdp_axi_clk = {
735 .b = {
736 .ctl_reg = MAXI_EN_REG,
737 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800738 .hwcg_reg = MAXI_EN_REG,
739 .hwcg_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700740 .reset_reg = SW_RESET_AXI_REG,
741 .reset_mask = BIT(13),
742 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700743 .halt_bit = 8,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800744 .retain_reg = MAXI_EN_REG,
745 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700746 },
747 .c = {
748 .dbg_name = "mdp_axi_clk",
749 .ops = &clk_ops_branch,
750 CLK_INIT(mdp_axi_clk.c),
751 },
752};
753
754static struct branch_clk rot_axi_clk = {
755 .b = {
756 .ctl_reg = MAXI_EN2_REG,
757 .en_mask = BIT(24),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800758 .hwcg_reg = MAXI_EN2_REG,
759 .hwcg_mask = BIT(25),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700760 .reset_reg = SW_RESET_AXI_REG,
761 .reset_mask = BIT(6),
762 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700763 .halt_bit = 2,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800764 .retain_reg = MAXI_EN3_REG,
765 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700766 },
767 .c = {
768 .dbg_name = "rot_axi_clk",
769 .ops = &clk_ops_branch,
770 CLK_INIT(rot_axi_clk.c),
771 },
772};
773
774static struct branch_clk vpe_axi_clk = {
775 .b = {
776 .ctl_reg = MAXI_EN2_REG,
777 .en_mask = BIT(26),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800778 .hwcg_reg = MAXI_EN2_REG,
779 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700780 .reset_reg = SW_RESET_AXI_REG,
781 .reset_mask = BIT(15),
782 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700783 .halt_bit = 1,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800784 .retain_reg = MAXI_EN3_REG,
785 .retain_mask = BIT(21),
786
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700787 },
788 .c = {
789 .dbg_name = "vpe_axi_clk",
790 .ops = &clk_ops_branch,
791 CLK_INIT(vpe_axi_clk.c),
792 },
793};
794
Tianyi Gou41515e22011-09-01 19:37:43 -0700795static struct branch_clk vcap_axi_clk = {
796 .b = {
797 .ctl_reg = MAXI_EN5_REG,
798 .en_mask = BIT(12),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700799 .hwcg_reg = MAXI_EN5_REG,
800 .hwcg_mask = BIT(11),
Tianyi Gou41515e22011-09-01 19:37:43 -0700801 .reset_reg = SW_RESET_AXI_REG,
802 .reset_mask = BIT(16),
803 .halt_reg = DBG_BUS_VEC_J_REG,
804 .halt_bit = 20,
805 },
806 .c = {
807 .dbg_name = "vcap_axi_clk",
808 .ops = &clk_ops_branch,
809 CLK_INIT(vcap_axi_clk.c),
810 },
811};
812
Tianyi Goue3d4f542012-03-15 17:06:45 -0700813/* gfx3d_axi_clk is set as a dependency of gmem_axi_clk at runtime */
Patrick Dalye6f489042012-07-11 15:29:15 -0700814static struct branch_clk gfx3d_axi_clk = {
Tianyi Gou621f8742011-09-01 21:45:01 -0700815 .b = {
816 .ctl_reg = MAXI_EN5_REG,
817 .en_mask = BIT(25),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700818 .hwcg_reg = MAXI_EN5_REG,
819 .hwcg_mask = BIT(24),
Tianyi Gou621f8742011-09-01 21:45:01 -0700820 .reset_reg = SW_RESET_AXI_REG,
821 .reset_mask = BIT(17),
822 .halt_reg = DBG_BUS_VEC_J_REG,
823 .halt_bit = 30,
824 },
825 .c = {
826 .dbg_name = "gfx3d_axi_clk",
827 .ops = &clk_ops_branch,
Patrick Dalye6f489042012-07-11 15:29:15 -0700828 CLK_INIT(gfx3d_axi_clk.c),
Tianyi Goue3d4f542012-03-15 17:06:45 -0700829 },
830};
831
832static struct branch_clk gfx3d_axi_clk_8930 = {
833 .b = {
834 .ctl_reg = MAXI_EN5_REG,
835 .en_mask = BIT(12),
836 .reset_reg = SW_RESET_AXI_REG,
837 .reset_mask = BIT(16),
838 .halt_reg = DBG_BUS_VEC_J_REG,
839 .halt_bit = 12,
840 },
841 .c = {
842 .dbg_name = "gfx3d_axi_clk",
843 .ops = &clk_ops_branch,
844 CLK_INIT(gfx3d_axi_clk_8930.c),
Tianyi Gou621f8742011-09-01 21:45:01 -0700845 },
846};
847
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700848/* AHB Interfaces */
849static struct branch_clk amp_p_clk = {
850 .b = {
851 .ctl_reg = AHB_EN_REG,
852 .en_mask = BIT(24),
Matt Wagantalld40857a2012-04-10 19:15:43 -0700853 .reset_reg = SW_RESET_CORE_REG,
854 .reset_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700855 .halt_reg = DBG_BUS_VEC_F_REG,
856 .halt_bit = 18,
857 },
858 .c = {
859 .dbg_name = "amp_p_clk",
860 .ops = &clk_ops_branch,
861 CLK_INIT(amp_p_clk.c),
862 },
863};
864
Matt Wagantallc23eee92011-08-16 23:06:52 -0700865static struct branch_clk csi_p_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700866 .b = {
867 .ctl_reg = AHB_EN_REG,
868 .en_mask = BIT(7),
869 .reset_reg = SW_RESET_AHB_REG,
870 .reset_mask = BIT(17),
871 .halt_reg = DBG_BUS_VEC_F_REG,
872 .halt_bit = 16,
873 },
874 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -0700875 .dbg_name = "csi_p_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700876 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -0700877 CLK_INIT(csi_p_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700878 },
879};
880
881static struct branch_clk dsi1_m_p_clk = {
882 .b = {
883 .ctl_reg = AHB_EN_REG,
884 .en_mask = BIT(9),
885 .reset_reg = SW_RESET_AHB_REG,
886 .reset_mask = BIT(6),
887 .halt_reg = DBG_BUS_VEC_F_REG,
888 .halt_bit = 19,
889 },
890 .c = {
891 .dbg_name = "dsi1_m_p_clk",
892 .ops = &clk_ops_branch,
893 CLK_INIT(dsi1_m_p_clk.c),
894 },
895};
896
897static struct branch_clk dsi1_s_p_clk = {
898 .b = {
899 .ctl_reg = AHB_EN_REG,
900 .en_mask = BIT(18),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800901 .hwcg_reg = AHB_EN2_REG,
902 .hwcg_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700903 .reset_reg = SW_RESET_AHB_REG,
904 .reset_mask = BIT(5),
905 .halt_reg = DBG_BUS_VEC_F_REG,
906 .halt_bit = 21,
907 },
908 .c = {
909 .dbg_name = "dsi1_s_p_clk",
910 .ops = &clk_ops_branch,
911 CLK_INIT(dsi1_s_p_clk.c),
912 },
913};
914
915static struct branch_clk dsi2_m_p_clk = {
916 .b = {
917 .ctl_reg = AHB_EN_REG,
918 .en_mask = BIT(17),
919 .reset_reg = SW_RESET_AHB2_REG,
920 .reset_mask = BIT(1),
921 .halt_reg = DBG_BUS_VEC_E_REG,
922 .halt_bit = 18,
923 },
924 .c = {
925 .dbg_name = "dsi2_m_p_clk",
926 .ops = &clk_ops_branch,
927 CLK_INIT(dsi2_m_p_clk.c),
928 },
929};
930
931static struct branch_clk dsi2_s_p_clk = {
932 .b = {
933 .ctl_reg = AHB_EN_REG,
934 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800935 .hwcg_reg = AHB_EN2_REG,
936 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700937 .reset_reg = SW_RESET_AHB2_REG,
938 .reset_mask = BIT(0),
939 .halt_reg = DBG_BUS_VEC_F_REG,
940 .halt_bit = 20,
941 },
942 .c = {
943 .dbg_name = "dsi2_s_p_clk",
944 .ops = &clk_ops_branch,
945 CLK_INIT(dsi2_s_p_clk.c),
946 },
947};
948
949static struct branch_clk gfx2d0_p_clk = {
950 .b = {
951 .ctl_reg = AHB_EN_REG,
952 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800953 .hwcg_reg = AHB_EN2_REG,
954 .hwcg_mask = BIT(28),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700955 .reset_reg = SW_RESET_AHB_REG,
956 .reset_mask = BIT(12),
957 .halt_reg = DBG_BUS_VEC_F_REG,
958 .halt_bit = 2,
959 },
960 .c = {
961 .dbg_name = "gfx2d0_p_clk",
962 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700963 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700964 CLK_INIT(gfx2d0_p_clk.c),
965 },
966};
967
968static struct branch_clk gfx2d1_p_clk = {
969 .b = {
970 .ctl_reg = AHB_EN_REG,
971 .en_mask = BIT(2),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800972 .hwcg_reg = AHB_EN2_REG,
973 .hwcg_mask = BIT(29),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700974 .reset_reg = SW_RESET_AHB_REG,
975 .reset_mask = BIT(11),
976 .halt_reg = DBG_BUS_VEC_F_REG,
977 .halt_bit = 3,
978 },
979 .c = {
980 .dbg_name = "gfx2d1_p_clk",
981 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700982 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700983 CLK_INIT(gfx2d1_p_clk.c),
984 },
985};
986
987static struct branch_clk gfx3d_p_clk = {
988 .b = {
989 .ctl_reg = AHB_EN_REG,
990 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800991 .hwcg_reg = AHB_EN2_REG,
992 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700993 .reset_reg = SW_RESET_AHB_REG,
994 .reset_mask = BIT(10),
995 .halt_reg = DBG_BUS_VEC_F_REG,
996 .halt_bit = 4,
997 },
998 .c = {
999 .dbg_name = "gfx3d_p_clk",
1000 .ops = &clk_ops_branch,
1001 CLK_INIT(gfx3d_p_clk.c),
1002 },
1003};
1004
1005static struct branch_clk hdmi_m_p_clk = {
1006 .b = {
1007 .ctl_reg = AHB_EN_REG,
1008 .en_mask = BIT(14),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001009 .hwcg_reg = AHB_EN2_REG,
1010 .hwcg_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001011 .reset_reg = SW_RESET_AHB_REG,
1012 .reset_mask = BIT(9),
1013 .halt_reg = DBG_BUS_VEC_F_REG,
1014 .halt_bit = 5,
1015 },
1016 .c = {
1017 .dbg_name = "hdmi_m_p_clk",
1018 .ops = &clk_ops_branch,
1019 CLK_INIT(hdmi_m_p_clk.c),
1020 },
1021};
1022
1023static struct branch_clk hdmi_s_p_clk = {
1024 .b = {
1025 .ctl_reg = AHB_EN_REG,
1026 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001027 .hwcg_reg = AHB_EN2_REG,
1028 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001029 .reset_reg = SW_RESET_AHB_REG,
1030 .reset_mask = BIT(9),
1031 .halt_reg = DBG_BUS_VEC_F_REG,
1032 .halt_bit = 6,
1033 },
1034 .c = {
1035 .dbg_name = "hdmi_s_p_clk",
1036 .ops = &clk_ops_branch,
1037 CLK_INIT(hdmi_s_p_clk.c),
1038 },
1039};
1040
1041static struct branch_clk ijpeg_p_clk = {
1042 .b = {
1043 .ctl_reg = AHB_EN_REG,
1044 .en_mask = BIT(5),
1045 .reset_reg = SW_RESET_AHB_REG,
1046 .reset_mask = BIT(7),
1047 .halt_reg = DBG_BUS_VEC_F_REG,
1048 .halt_bit = 9,
1049 },
1050 .c = {
1051 .dbg_name = "ijpeg_p_clk",
1052 .ops = &clk_ops_branch,
1053 CLK_INIT(ijpeg_p_clk.c),
1054 },
1055};
1056
1057static struct branch_clk imem_p_clk = {
1058 .b = {
1059 .ctl_reg = AHB_EN_REG,
1060 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001061 .hwcg_reg = AHB_EN2_REG,
1062 .hwcg_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001063 .reset_reg = SW_RESET_AHB_REG,
1064 .reset_mask = BIT(8),
1065 .halt_reg = DBG_BUS_VEC_F_REG,
1066 .halt_bit = 10,
1067 },
1068 .c = {
1069 .dbg_name = "imem_p_clk",
1070 .ops = &clk_ops_branch,
1071 CLK_INIT(imem_p_clk.c),
1072 },
1073};
1074
1075static struct branch_clk jpegd_p_clk = {
1076 .b = {
1077 .ctl_reg = AHB_EN_REG,
1078 .en_mask = BIT(21),
1079 .reset_reg = SW_RESET_AHB_REG,
1080 .reset_mask = BIT(4),
1081 .halt_reg = DBG_BUS_VEC_F_REG,
1082 .halt_bit = 7,
1083 },
1084 .c = {
1085 .dbg_name = "jpegd_p_clk",
1086 .ops = &clk_ops_branch,
1087 CLK_INIT(jpegd_p_clk.c),
1088 },
1089};
1090
1091static struct branch_clk mdp_p_clk = {
1092 .b = {
1093 .ctl_reg = AHB_EN_REG,
1094 .en_mask = BIT(10),
1095 .reset_reg = SW_RESET_AHB_REG,
1096 .reset_mask = BIT(3),
1097 .halt_reg = DBG_BUS_VEC_F_REG,
1098 .halt_bit = 11,
1099 },
1100 .c = {
1101 .dbg_name = "mdp_p_clk",
1102 .ops = &clk_ops_branch,
1103 CLK_INIT(mdp_p_clk.c),
1104 },
1105};
1106
1107static struct branch_clk rot_p_clk = {
1108 .b = {
1109 .ctl_reg = AHB_EN_REG,
1110 .en_mask = BIT(12),
1111 .reset_reg = SW_RESET_AHB_REG,
1112 .reset_mask = BIT(2),
1113 .halt_reg = DBG_BUS_VEC_F_REG,
1114 .halt_bit = 13,
1115 },
1116 .c = {
1117 .dbg_name = "rot_p_clk",
1118 .ops = &clk_ops_branch,
1119 CLK_INIT(rot_p_clk.c),
1120 },
1121};
1122
1123static struct branch_clk smmu_p_clk = {
1124 .b = {
1125 .ctl_reg = AHB_EN_REG,
1126 .en_mask = BIT(15),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001127 .hwcg_reg = AHB_EN_REG,
1128 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001129 .halt_reg = DBG_BUS_VEC_F_REG,
1130 .halt_bit = 22,
1131 },
1132 .c = {
1133 .dbg_name = "smmu_p_clk",
1134 .ops = &clk_ops_branch,
1135 CLK_INIT(smmu_p_clk.c),
1136 },
1137};
1138
1139static struct branch_clk tv_enc_p_clk = {
1140 .b = {
1141 .ctl_reg = AHB_EN_REG,
1142 .en_mask = BIT(25),
1143 .reset_reg = SW_RESET_AHB_REG,
1144 .reset_mask = BIT(15),
1145 .halt_reg = DBG_BUS_VEC_F_REG,
1146 .halt_bit = 23,
1147 },
1148 .c = {
1149 .dbg_name = "tv_enc_p_clk",
1150 .ops = &clk_ops_branch,
1151 CLK_INIT(tv_enc_p_clk.c),
1152 },
1153};
1154
1155static struct branch_clk vcodec_p_clk = {
1156 .b = {
1157 .ctl_reg = AHB_EN_REG,
1158 .en_mask = BIT(11),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001159 .hwcg_reg = AHB_EN2_REG,
1160 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001161 .reset_reg = SW_RESET_AHB_REG,
1162 .reset_mask = BIT(1),
1163 .halt_reg = DBG_BUS_VEC_F_REG,
1164 .halt_bit = 12,
1165 },
1166 .c = {
1167 .dbg_name = "vcodec_p_clk",
1168 .ops = &clk_ops_branch,
1169 CLK_INIT(vcodec_p_clk.c),
1170 },
1171};
1172
1173static struct branch_clk vfe_p_clk = {
1174 .b = {
1175 .ctl_reg = AHB_EN_REG,
1176 .en_mask = BIT(13),
1177 .reset_reg = SW_RESET_AHB_REG,
1178 .reset_mask = BIT(0),
1179 .halt_reg = DBG_BUS_VEC_F_REG,
1180 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08001181 .retain_reg = AHB_EN2_REG,
1182 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001183 },
1184 .c = {
1185 .dbg_name = "vfe_p_clk",
1186 .ops = &clk_ops_branch,
1187 CLK_INIT(vfe_p_clk.c),
1188 },
1189};
1190
1191static struct branch_clk vpe_p_clk = {
1192 .b = {
1193 .ctl_reg = AHB_EN_REG,
1194 .en_mask = BIT(16),
1195 .reset_reg = SW_RESET_AHB_REG,
1196 .reset_mask = BIT(14),
1197 .halt_reg = DBG_BUS_VEC_F_REG,
1198 .halt_bit = 15,
1199 },
1200 .c = {
1201 .dbg_name = "vpe_p_clk",
1202 .ops = &clk_ops_branch,
1203 CLK_INIT(vpe_p_clk.c),
1204 },
1205};
1206
Tianyi Gou41515e22011-09-01 19:37:43 -07001207static struct branch_clk vcap_p_clk = {
1208 .b = {
1209 .ctl_reg = AHB_EN3_REG,
1210 .en_mask = BIT(1),
Tianyi Gouf3095ea2012-05-22 14:16:06 -07001211 .hwcg_reg = AHB_EN3_REG,
1212 .hwcg_mask = BIT(0),
Tianyi Gou41515e22011-09-01 19:37:43 -07001213 .reset_reg = SW_RESET_AHB2_REG,
1214 .reset_mask = BIT(2),
1215 .halt_reg = DBG_BUS_VEC_J_REG,
1216 .halt_bit = 23,
1217 },
1218 .c = {
1219 .dbg_name = "vcap_p_clk",
1220 .ops = &clk_ops_branch,
1221 CLK_INIT(vcap_p_clk.c),
1222 },
1223};
1224
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001225/*
1226 * Peripheral Clocks
1227 */
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001228#define CLK_GP(i, n, h_r, h_b) \
1229 struct rcg_clk i##_clk = { \
1230 .b = { \
1231 .ctl_reg = GPn_NS_REG(n), \
1232 .en_mask = BIT(9), \
1233 .halt_reg = h_r, \
1234 .halt_bit = h_b, \
1235 }, \
1236 .ns_reg = GPn_NS_REG(n), \
1237 .md_reg = GPn_MD_REG(n), \
1238 .root_en_mask = BIT(11), \
1239 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001240 .mnd_en_mask = BIT(8), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001241 .set_rate = set_rate_mnd, \
1242 .freq_tbl = clk_tbl_gp, \
1243 .current_freq = &rcg_dummy_freq, \
1244 .c = { \
1245 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001246 .ops = &clk_ops_rcg, \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001247 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), \
1248 CLK_INIT(i##_clk.c), \
1249 }, \
1250 }
1251#define F_GP(f, s, d, m, n) \
1252 { \
1253 .freq_hz = f, \
1254 .src_clk = &s##_clk.c, \
1255 .md_val = MD8(16, m, 0, n), \
1256 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001257 }
1258static struct clk_freq_tbl clk_tbl_gp[] = {
1259 F_GP( 0, gnd, 1, 0, 0),
1260 F_GP( 9600000, cxo, 2, 0, 0),
1261 F_GP( 13500000, pxo, 2, 0, 0),
1262 F_GP( 19200000, cxo, 1, 0, 0),
1263 F_GP( 27000000, pxo, 1, 0, 0),
1264 F_GP( 64000000, pll8, 2, 1, 3),
1265 F_GP( 76800000, pll8, 1, 1, 5),
1266 F_GP( 96000000, pll8, 4, 0, 0),
1267 F_GP(128000000, pll8, 3, 0, 0),
1268 F_GP(192000000, pll8, 2, 0, 0),
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001269 F_END
1270};
1271
1272static CLK_GP(gp0, 0, CLK_HALT_SFPB_MISC_STATE_REG, 7);
1273static CLK_GP(gp1, 1, CLK_HALT_SFPB_MISC_STATE_REG, 6);
1274static CLK_GP(gp2, 2, CLK_HALT_SFPB_MISC_STATE_REG, 5);
1275
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001276#define CLK_GSBI_UART(i, n, h_r, h_b) \
1277 struct rcg_clk i##_clk = { \
1278 .b = { \
1279 .ctl_reg = GSBIn_UART_APPS_NS_REG(n), \
1280 .en_mask = BIT(9), \
1281 .reset_reg = GSBIn_RESET_REG(n), \
1282 .reset_mask = BIT(0), \
1283 .halt_reg = h_r, \
1284 .halt_bit = h_b, \
1285 }, \
1286 .ns_reg = GSBIn_UART_APPS_NS_REG(n), \
1287 .md_reg = GSBIn_UART_APPS_MD_REG(n), \
1288 .root_en_mask = BIT(11), \
1289 .ns_mask = (BM(31, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001290 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001291 .set_rate = set_rate_mnd, \
1292 .freq_tbl = clk_tbl_gsbi_uart, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001293 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001294 .c = { \
1295 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001296 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001297 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001298 CLK_INIT(i##_clk.c), \
1299 }, \
1300 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001301#define F_GSBI_UART(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001302 { \
1303 .freq_hz = f, \
1304 .src_clk = &s##_clk.c, \
1305 .md_val = MD16(m, n), \
1306 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001307 }
1308static struct clk_freq_tbl clk_tbl_gsbi_uart[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001309 F_GSBI_UART( 0, gnd, 1, 0, 0),
Matt Wagantall9a561f72012-01-19 16:13:12 -08001310 F_GSBI_UART( 1843200, pll8, 2, 6, 625),
1311 F_GSBI_UART( 3686400, pll8, 2, 12, 625),
1312 F_GSBI_UART( 7372800, pll8, 2, 24, 625),
1313 F_GSBI_UART(14745600, pll8, 2, 48, 625),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001314 F_GSBI_UART(16000000, pll8, 4, 1, 6),
1315 F_GSBI_UART(24000000, pll8, 4, 1, 4),
1316 F_GSBI_UART(32000000, pll8, 4, 1, 3),
1317 F_GSBI_UART(40000000, pll8, 1, 5, 48),
1318 F_GSBI_UART(46400000, pll8, 1, 29, 240),
1319 F_GSBI_UART(48000000, pll8, 4, 1, 2),
1320 F_GSBI_UART(51200000, pll8, 1, 2, 15),
1321 F_GSBI_UART(56000000, pll8, 1, 7, 48),
1322 F_GSBI_UART(58982400, pll8, 1, 96, 625),
1323 F_GSBI_UART(64000000, pll8, 2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001324 F_END
1325};
1326
1327static CLK_GSBI_UART(gsbi1_uart, 1, CLK_HALT_CFPB_STATEA_REG, 10);
1328static CLK_GSBI_UART(gsbi2_uart, 2, CLK_HALT_CFPB_STATEA_REG, 6);
1329static CLK_GSBI_UART(gsbi3_uart, 3, CLK_HALT_CFPB_STATEA_REG, 2);
1330static CLK_GSBI_UART(gsbi4_uart, 4, CLK_HALT_CFPB_STATEB_REG, 26);
1331static CLK_GSBI_UART(gsbi5_uart, 5, CLK_HALT_CFPB_STATEB_REG, 22);
1332static CLK_GSBI_UART(gsbi6_uart, 6, CLK_HALT_CFPB_STATEB_REG, 18);
1333static CLK_GSBI_UART(gsbi7_uart, 7, CLK_HALT_CFPB_STATEB_REG, 14);
1334static CLK_GSBI_UART(gsbi8_uart, 8, CLK_HALT_CFPB_STATEB_REG, 10);
1335static CLK_GSBI_UART(gsbi9_uart, 9, CLK_HALT_CFPB_STATEB_REG, 6);
1336static CLK_GSBI_UART(gsbi10_uart, 10, CLK_HALT_CFPB_STATEB_REG, 2);
1337static CLK_GSBI_UART(gsbi11_uart, 11, CLK_HALT_CFPB_STATEC_REG, 17);
1338static CLK_GSBI_UART(gsbi12_uart, 12, CLK_HALT_CFPB_STATEC_REG, 13);
1339
1340#define CLK_GSBI_QUP(i, n, h_r, h_b) \
1341 struct rcg_clk i##_clk = { \
1342 .b = { \
1343 .ctl_reg = GSBIn_QUP_APPS_NS_REG(n), \
1344 .en_mask = BIT(9), \
1345 .reset_reg = GSBIn_RESET_REG(n), \
1346 .reset_mask = BIT(0), \
1347 .halt_reg = h_r, \
1348 .halt_bit = h_b, \
1349 }, \
1350 .ns_reg = GSBIn_QUP_APPS_NS_REG(n), \
1351 .md_reg = GSBIn_QUP_APPS_MD_REG(n), \
1352 .root_en_mask = BIT(11), \
1353 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001354 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001355 .set_rate = set_rate_mnd, \
1356 .freq_tbl = clk_tbl_gsbi_qup, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001357 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001358 .c = { \
1359 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001360 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001361 VDD_DIG_FMAX_MAP2(LOW, 24000000, NOMINAL, 52000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001362 CLK_INIT(i##_clk.c), \
1363 }, \
1364 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001365#define F_GSBI_QUP(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001366 { \
1367 .freq_hz = f, \
1368 .src_clk = &s##_clk.c, \
1369 .md_val = MD8(16, m, 0, n), \
1370 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001371 }
1372static struct clk_freq_tbl clk_tbl_gsbi_qup[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001373 F_GSBI_QUP( 0, gnd, 1, 0, 0),
1374 F_GSBI_QUP( 1100000, pxo, 1, 2, 49),
1375 F_GSBI_QUP( 5400000, pxo, 1, 1, 5),
1376 F_GSBI_QUP(10800000, pxo, 1, 2, 5),
1377 F_GSBI_QUP(15060000, pll8, 1, 2, 51),
1378 F_GSBI_QUP(24000000, pll8, 4, 1, 4),
1379 F_GSBI_QUP(25600000, pll8, 1, 1, 15),
1380 F_GSBI_QUP(27000000, pxo, 1, 0, 0),
1381 F_GSBI_QUP(48000000, pll8, 4, 1, 2),
1382 F_GSBI_QUP(51200000, pll8, 1, 2, 15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001383 F_END
1384};
1385
1386static CLK_GSBI_QUP(gsbi1_qup, 1, CLK_HALT_CFPB_STATEA_REG, 9);
1387static CLK_GSBI_QUP(gsbi2_qup, 2, CLK_HALT_CFPB_STATEA_REG, 4);
1388static CLK_GSBI_QUP(gsbi3_qup, 3, CLK_HALT_CFPB_STATEA_REG, 0);
1389static CLK_GSBI_QUP(gsbi4_qup, 4, CLK_HALT_CFPB_STATEB_REG, 24);
1390static CLK_GSBI_QUP(gsbi5_qup, 5, CLK_HALT_CFPB_STATEB_REG, 20);
1391static CLK_GSBI_QUP(gsbi6_qup, 6, CLK_HALT_CFPB_STATEB_REG, 16);
1392static CLK_GSBI_QUP(gsbi7_qup, 7, CLK_HALT_CFPB_STATEB_REG, 12);
1393static CLK_GSBI_QUP(gsbi8_qup, 8, CLK_HALT_CFPB_STATEB_REG, 8);
1394static CLK_GSBI_QUP(gsbi9_qup, 9, CLK_HALT_CFPB_STATEB_REG, 4);
1395static CLK_GSBI_QUP(gsbi10_qup, 10, CLK_HALT_CFPB_STATEB_REG, 0);
1396static CLK_GSBI_QUP(gsbi11_qup, 11, CLK_HALT_CFPB_STATEC_REG, 15);
1397static CLK_GSBI_QUP(gsbi12_qup, 12, CLK_HALT_CFPB_STATEC_REG, 11);
1398
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001399#define F_PDM(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001400 { \
1401 .freq_hz = f, \
1402 .src_clk = &s##_clk.c, \
1403 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001404 }
1405static struct clk_freq_tbl clk_tbl_pdm[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001406 F_PDM( 0, gnd, 1),
1407 F_PDM(27000000, pxo, 1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001408 F_END
1409};
1410
1411static struct rcg_clk pdm_clk = {
1412 .b = {
1413 .ctl_reg = PDM_CLK_NS_REG,
1414 .en_mask = BIT(9),
1415 .reset_reg = PDM_CLK_NS_REG,
1416 .reset_mask = BIT(12),
1417 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1418 .halt_bit = 3,
1419 },
1420 .ns_reg = PDM_CLK_NS_REG,
1421 .root_en_mask = BIT(11),
1422 .ns_mask = BM(1, 0),
1423 .set_rate = set_rate_nop,
1424 .freq_tbl = clk_tbl_pdm,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001425 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001426 .c = {
1427 .dbg_name = "pdm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001428 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001429 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001430 CLK_INIT(pdm_clk.c),
1431 },
1432};
1433
1434static struct branch_clk pmem_clk = {
1435 .b = {
1436 .ctl_reg = PMEM_ACLK_CTL_REG,
1437 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001438 .hwcg_reg = PMEM_ACLK_CTL_REG,
1439 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001440 .halt_reg = CLK_HALT_DFAB_STATE_REG,
1441 .halt_bit = 20,
1442 },
1443 .c = {
1444 .dbg_name = "pmem_clk",
1445 .ops = &clk_ops_branch,
1446 CLK_INIT(pmem_clk.c),
1447 },
1448};
1449
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001450#define F_PRNG(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001451 { \
1452 .freq_hz = f, \
1453 .src_clk = &s##_clk.c, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001454 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07001455static struct clk_freq_tbl clk_tbl_prng_32[] = {
1456 F_PRNG(32000000, pll8),
1457 F_END
1458};
1459
1460static struct clk_freq_tbl clk_tbl_prng_64[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001461 F_PRNG(64000000, pll8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001462 F_END
1463};
1464
1465static struct rcg_clk prng_clk = {
1466 .b = {
1467 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
1468 .en_mask = BIT(10),
1469 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
1470 .halt_check = HALT_VOTED,
1471 .halt_bit = 10,
1472 },
1473 .set_rate = set_rate_nop,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001474 .freq_tbl = clk_tbl_prng_32,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001475 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001476 .c = {
1477 .dbg_name = "prng_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001478 .ops = &clk_ops_rcg,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001479 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480 CLK_INIT(prng_clk.c),
1481 },
1482};
1483
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001484#define CLK_SDC(name, n, h_b, fmax_low, fmax_nom) \
Stephen Boyda78a7402011-08-02 11:23:39 -07001485 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001486 .b = { \
1487 .ctl_reg = SDCn_APPS_CLK_NS_REG(n), \
1488 .en_mask = BIT(9), \
1489 .reset_reg = SDCn_RESET_REG(n), \
1490 .reset_mask = BIT(0), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001491 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001492 .halt_bit = h_b, \
1493 }, \
1494 .ns_reg = SDCn_APPS_CLK_NS_REG(n), \
1495 .md_reg = SDCn_APPS_CLK_MD_REG(n), \
1496 .root_en_mask = BIT(11), \
1497 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001498 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001499 .set_rate = set_rate_mnd, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001500 .freq_tbl = clk_tbl_sdc, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001501 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001502 .c = { \
Stephen Boyda78a7402011-08-02 11:23:39 -07001503 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001504 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001505 VDD_DIG_FMAX_MAP2(LOW, fmax_low, NOMINAL, fmax_nom), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001506 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001507 }, \
1508 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001509#define F_SDC(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001510 { \
1511 .freq_hz = f, \
1512 .src_clk = &s##_clk.c, \
1513 .md_val = MD8(16, m, 0, n), \
1514 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001515 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001516static struct clk_freq_tbl clk_tbl_sdc[] = {
1517 F_SDC( 0, gnd, 1, 0, 0),
1518 F_SDC( 144000, pxo, 3, 2, 125),
1519 F_SDC( 400000, pll8, 4, 1, 240),
1520 F_SDC( 16000000, pll8, 4, 1, 6),
1521 F_SDC( 17070000, pll8, 1, 2, 45),
1522 F_SDC( 20210000, pll8, 1, 1, 19),
1523 F_SDC( 24000000, pll8, 4, 1, 4),
1524 F_SDC( 48000000, pll8, 4, 1, 2),
1525 F_SDC( 64000000, pll8, 3, 1, 2),
1526 F_SDC( 96000000, pll8, 4, 0, 0),
Subhash Jadavanibd238ba2011-11-24 15:12:39 +05301527 F_SDC(192000000, pll8, 2, 0, 0),
Stephen Boyda78a7402011-08-02 11:23:39 -07001528 F_END
1529};
1530
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001531static CLK_SDC(sdc1_clk, 1, 6, 52000000, 104000000);
1532static CLK_SDC(sdc2_clk, 2, 5, 52000000, 104000000);
1533static CLK_SDC(sdc3_clk, 3, 4, 104000000, 208000000);
1534static CLK_SDC(sdc4_clk, 4, 3, 33000000, 67000000);
1535static CLK_SDC(sdc5_clk, 5, 2, 33000000, 67000000);
Stephen Boyda78a7402011-08-02 11:23:39 -07001536
Patrick Dalyb7c777a2012-08-23 19:07:30 -07001537static unsigned long fmax_sdc1_8064v2[MAX_VDD_LEVELS] __initdata = {
1538 [VDD_DIG_LOW] = 100000000,
1539 [VDD_DIG_NOMINAL] = 200000000,
1540};
1541
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001542#define F_TSIF_REF(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001543 { \
1544 .freq_hz = f, \
1545 .src_clk = &s##_clk.c, \
1546 .md_val = MD16(m, n), \
1547 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001548 }
1549static struct clk_freq_tbl clk_tbl_tsif_ref[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001550 F_TSIF_REF( 0, gnd, 1, 0, 0),
1551 F_TSIF_REF(105000, pxo, 1, 1, 256),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001552 F_END
1553};
1554
1555static struct rcg_clk tsif_ref_clk = {
1556 .b = {
1557 .ctl_reg = TSIF_REF_CLK_NS_REG,
1558 .en_mask = BIT(9),
1559 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1560 .halt_bit = 5,
1561 },
1562 .ns_reg = TSIF_REF_CLK_NS_REG,
1563 .md_reg = TSIF_REF_CLK_MD_REG,
1564 .root_en_mask = BIT(11),
1565 .ns_mask = (BM(31, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001566 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001567 .set_rate = set_rate_mnd,
1568 .freq_tbl = clk_tbl_tsif_ref,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001569 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001570 .c = {
1571 .dbg_name = "tsif_ref_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001572 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001573 VDD_DIG_FMAX_MAP2(LOW, 27000000, NOMINAL, 54000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001574 CLK_INIT(tsif_ref_clk.c),
1575 },
1576};
1577
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001578#define F_TSSC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001579 { \
1580 .freq_hz = f, \
1581 .src_clk = &s##_clk.c, \
1582 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001583 }
1584static struct clk_freq_tbl clk_tbl_tssc[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001585 F_TSSC( 0, gnd),
1586 F_TSSC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001587 F_END
1588};
1589
1590static struct rcg_clk tssc_clk = {
1591 .b = {
1592 .ctl_reg = TSSC_CLK_CTL_REG,
1593 .en_mask = BIT(4),
1594 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1595 .halt_bit = 4,
1596 },
1597 .ns_reg = TSSC_CLK_CTL_REG,
1598 .ns_mask = BM(1, 0),
1599 .set_rate = set_rate_nop,
1600 .freq_tbl = clk_tbl_tssc,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001601 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001602 .c = {
1603 .dbg_name = "tssc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001604 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001605 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001606 CLK_INIT(tssc_clk.c),
1607 },
1608};
1609
Tianyi Gou41515e22011-09-01 19:37:43 -07001610#define CLK_USB_HS(name, n, h_b) \
1611 static struct rcg_clk name = { \
1612 .b = { \
1613 .ctl_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1614 .en_mask = BIT(9), \
1615 .reset_reg = USB_HS##n##_RESET_REG, \
1616 .reset_mask = BIT(0), \
1617 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
1618 .halt_bit = h_b, \
1619 }, \
1620 .ns_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1621 .md_reg = USB_HS##n##_XCVR_FS_CLK_MD_REG, \
1622 .root_en_mask = BIT(11), \
1623 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001624 .mnd_en_mask = BIT(8), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001625 .set_rate = set_rate_mnd, \
1626 .freq_tbl = clk_tbl_usb, \
1627 .current_freq = &rcg_dummy_freq, \
1628 .c = { \
1629 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001630 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001631 VDD_DIG_FMAX_MAP1(NOMINAL, 64000000), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001632 CLK_INIT(name.c), \
1633 }, \
1634}
1635
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001636#define F_USB(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001637 { \
1638 .freq_hz = f, \
1639 .src_clk = &s##_clk.c, \
1640 .md_val = MD8(16, m, 0, n), \
1641 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001642 }
1643static struct clk_freq_tbl clk_tbl_usb[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001644 F_USB( 0, gnd, 1, 0, 0),
1645 F_USB(60000000, pll8, 1, 5, 32),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001646 F_END
1647};
1648
Tianyi Gou41515e22011-09-01 19:37:43 -07001649CLK_USB_HS(usb_hs1_xcvr_clk, 1, 0);
1650CLK_USB_HS(usb_hs3_xcvr_clk, 3, 30);
1651CLK_USB_HS(usb_hs4_xcvr_clk, 4, 2);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001652
Stephen Boyd94625ef2011-07-12 17:06:01 -07001653static struct clk_freq_tbl clk_tbl_usb_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001654 F_USB( 0, gnd, 1, 0, 0),
1655 F_USB(60000000, pll8, 1, 5, 32),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001656 F_END
1657};
1658
1659static struct rcg_clk usb_hsic_xcvr_fs_clk = {
1660 .b = {
1661 .ctl_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1662 .en_mask = BIT(9),
1663 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1664 .halt_bit = 26,
1665 },
1666 .ns_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1667 .md_reg = USB_HSIC_XCVR_FS_CLK_MD_REG,
1668 .root_en_mask = BIT(11),
1669 .ns_mask = (BM(23, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001670 .mnd_en_mask = BIT(8),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001671 .set_rate = set_rate_mnd,
1672 .freq_tbl = clk_tbl_usb_hsic,
1673 .current_freq = &rcg_dummy_freq,
1674 .c = {
1675 .dbg_name = "usb_hsic_xcvr_fs_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001676 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001677 VDD_DIG_FMAX_MAP1(LOW, 60000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001678 CLK_INIT(usb_hsic_xcvr_fs_clk.c),
1679 },
1680};
1681
1682static struct branch_clk usb_hsic_system_clk = {
1683 .b = {
1684 .ctl_reg = USB_HSIC_SYSTEM_CLK_CTL_REG,
1685 .en_mask = BIT(4),
1686 .reset_reg = USB_HSIC_RESET_REG,
1687 .reset_mask = BIT(0),
1688 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1689 .halt_bit = 24,
1690 },
1691 .parent = &usb_hsic_xcvr_fs_clk.c,
1692 .c = {
1693 .dbg_name = "usb_hsic_system_clk",
1694 .ops = &clk_ops_branch,
1695 CLK_INIT(usb_hsic_system_clk.c),
1696 },
1697};
1698
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001699#define F_USB_HSIC(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001700 { \
1701 .freq_hz = f, \
1702 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001703 }
1704static struct clk_freq_tbl clk_tbl_usb2_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001705 F_USB_HSIC(480000000, pll14),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001706 F_END
1707};
1708
1709static struct rcg_clk usb_hsic_hsic_src_clk = {
1710 .b = {
1711 .ctl_reg = USB_HSIC_HSIC_CLK_SRC_CTL_REG,
1712 .halt_check = NOCHECK,
1713 },
1714 .root_en_mask = BIT(0),
1715 .set_rate = set_rate_nop,
1716 .freq_tbl = clk_tbl_usb2_hsic,
1717 .current_freq = &rcg_dummy_freq,
1718 .c = {
1719 .dbg_name = "usb_hsic_hsic_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001720 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001721 VDD_DIG_FMAX_MAP1(LOW, 480000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001722 CLK_INIT(usb_hsic_hsic_src_clk.c),
1723 },
1724};
1725
1726static struct branch_clk usb_hsic_hsic_clk = {
1727 .b = {
1728 .ctl_reg = USB_HSIC_HSIC_CLK_CTL_REG,
1729 .en_mask = BIT(0),
1730 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1731 .halt_bit = 19,
1732 },
1733 .parent = &usb_hsic_hsic_src_clk.c,
1734 .c = {
1735 .dbg_name = "usb_hsic_hsic_clk",
1736 .ops = &clk_ops_branch,
1737 CLK_INIT(usb_hsic_hsic_clk.c),
1738 },
1739};
1740
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001741#define F_USB_HSIO_CAL(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001742 { \
1743 .freq_hz = f, \
1744 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001745 }
1746static struct clk_freq_tbl clk_tbl_usb_hsio_cal[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001747 F_USB_HSIO_CAL(9000000, pxo),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001748 F_END
1749};
1750
1751static struct rcg_clk usb_hsic_hsio_cal_clk = {
1752 .b = {
1753 .ctl_reg = USB_HSIC_HSIO_CAL_CLK_CTL_REG,
1754 .en_mask = BIT(0),
1755 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1756 .halt_bit = 23,
1757 },
1758 .set_rate = set_rate_nop,
1759 .freq_tbl = clk_tbl_usb_hsio_cal,
1760 .current_freq = &rcg_dummy_freq,
1761 .c = {
1762 .dbg_name = "usb_hsic_hsio_cal_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001763 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001764 VDD_DIG_FMAX_MAP1(LOW, 10000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001765 CLK_INIT(usb_hsic_hsio_cal_clk.c),
1766 },
1767};
1768
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001769static struct branch_clk usb_phy0_clk = {
1770 .b = {
1771 .reset_reg = USB_PHY0_RESET_REG,
1772 .reset_mask = BIT(0),
1773 },
1774 .c = {
1775 .dbg_name = "usb_phy0_clk",
1776 .ops = &clk_ops_reset,
1777 CLK_INIT(usb_phy0_clk.c),
1778 },
1779};
1780
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001781#define CLK_USB_FS(i, n, fmax_nom) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001782 struct rcg_clk i##_clk = { \
1783 .ns_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1784 .b = { \
1785 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1786 .halt_check = NOCHECK, \
1787 }, \
1788 .md_reg = USB_FSn_XCVR_FS_CLK_MD_REG(n), \
1789 .root_en_mask = BIT(11), \
1790 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001791 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001792 .set_rate = set_rate_mnd, \
1793 .freq_tbl = clk_tbl_usb, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001794 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001795 .c = { \
1796 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001797 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001798 VDD_DIG_FMAX_MAP1(NOMINAL, fmax_nom), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001799 CLK_INIT(i##_clk.c), \
1800 }, \
1801 }
1802
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001803static CLK_USB_FS(usb_fs1_src, 1, 64000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001804static struct branch_clk usb_fs1_xcvr_clk = {
1805 .b = {
1806 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(1),
1807 .en_mask = BIT(9),
1808 .reset_reg = USB_FSn_RESET_REG(1),
1809 .reset_mask = BIT(1),
1810 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1811 .halt_bit = 15,
1812 },
1813 .parent = &usb_fs1_src_clk.c,
1814 .c = {
1815 .dbg_name = "usb_fs1_xcvr_clk",
1816 .ops = &clk_ops_branch,
1817 CLK_INIT(usb_fs1_xcvr_clk.c),
1818 },
1819};
1820
1821static struct branch_clk usb_fs1_sys_clk = {
1822 .b = {
1823 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(1),
1824 .en_mask = BIT(4),
1825 .reset_reg = USB_FSn_RESET_REG(1),
1826 .reset_mask = BIT(0),
1827 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1828 .halt_bit = 16,
1829 },
1830 .parent = &usb_fs1_src_clk.c,
1831 .c = {
1832 .dbg_name = "usb_fs1_sys_clk",
1833 .ops = &clk_ops_branch,
1834 CLK_INIT(usb_fs1_sys_clk.c),
1835 },
1836};
1837
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001838static CLK_USB_FS(usb_fs2_src, 2, 60000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001839static struct branch_clk usb_fs2_xcvr_clk = {
1840 .b = {
1841 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(2),
1842 .en_mask = BIT(9),
1843 .reset_reg = USB_FSn_RESET_REG(2),
1844 .reset_mask = BIT(1),
1845 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1846 .halt_bit = 12,
1847 },
1848 .parent = &usb_fs2_src_clk.c,
1849 .c = {
1850 .dbg_name = "usb_fs2_xcvr_clk",
1851 .ops = &clk_ops_branch,
1852 CLK_INIT(usb_fs2_xcvr_clk.c),
1853 },
1854};
1855
1856static struct branch_clk usb_fs2_sys_clk = {
1857 .b = {
1858 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(2),
1859 .en_mask = BIT(4),
1860 .reset_reg = USB_FSn_RESET_REG(2),
1861 .reset_mask = BIT(0),
1862 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1863 .halt_bit = 13,
1864 },
1865 .parent = &usb_fs2_src_clk.c,
1866 .c = {
1867 .dbg_name = "usb_fs2_sys_clk",
1868 .ops = &clk_ops_branch,
1869 CLK_INIT(usb_fs2_sys_clk.c),
1870 },
1871};
1872
1873/* Fast Peripheral Bus Clocks */
1874static struct branch_clk ce1_core_clk = {
1875 .b = {
1876 .ctl_reg = CE1_CORE_CLK_CTL_REG,
1877 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001878 .hwcg_reg = CE1_CORE_CLK_CTL_REG,
1879 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001880 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1881 .halt_bit = 27,
1882 },
1883 .c = {
1884 .dbg_name = "ce1_core_clk",
1885 .ops = &clk_ops_branch,
1886 CLK_INIT(ce1_core_clk.c),
1887 },
1888};
Tianyi Gou41515e22011-09-01 19:37:43 -07001889
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001890static struct branch_clk ce1_p_clk = {
1891 .b = {
1892 .ctl_reg = CE1_HCLK_CTL_REG,
1893 .en_mask = BIT(4),
1894 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1895 .halt_bit = 1,
1896 },
1897 .c = {
1898 .dbg_name = "ce1_p_clk",
1899 .ops = &clk_ops_branch,
1900 CLK_INIT(ce1_p_clk.c),
1901 },
1902};
1903
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001904#define F_CE3(f, s, d) \
Tianyi Gou41515e22011-09-01 19:37:43 -07001905 { \
1906 .freq_hz = f, \
1907 .src_clk = &s##_clk.c, \
1908 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001909 }
1910
1911static struct clk_freq_tbl clk_tbl_ce3[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001912 F_CE3( 0, gnd, 1),
1913 F_CE3( 48000000, pll8, 8),
1914 F_CE3(100000000, pll3, 12),
Patrick Dalyb7c777a2012-08-23 19:07:30 -07001915 F_CE3(120000000, pll3, 10),
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
Patrick Dalyb7c777a2012-08-23 19:07:30 -07001938static unsigned long fmax_ce3_8064v2[MAX_VDD_LEVELS] __initdata = {
1939 [VDD_DIG_LOW] = 57000000,
1940 [VDD_DIG_NOMINAL] = 120000000,
1941};
1942
Tianyi Gou41515e22011-09-01 19:37:43 -07001943static struct branch_clk ce3_core_clk = {
1944 .b = {
1945 .ctl_reg = CE3_CORE_CLK_CTL_REG,
1946 .en_mask = BIT(4),
1947 .reset_reg = CE3_CORE_CLK_CTL_REG,
1948 .reset_mask = BIT(7),
1949 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
1950 .halt_bit = 5,
1951 },
1952 .parent = &ce3_src_clk.c,
1953 .c = {
1954 .dbg_name = "ce3_core_clk",
1955 .ops = &clk_ops_branch,
1956 CLK_INIT(ce3_core_clk.c),
1957 }
1958};
1959
1960static struct branch_clk ce3_p_clk = {
1961 .b = {
1962 .ctl_reg = CE3_HCLK_CTL_REG,
1963 .en_mask = BIT(4),
1964 .reset_reg = CE3_HCLK_CTL_REG,
1965 .reset_mask = BIT(7),
1966 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
1967 .halt_bit = 16,
1968 },
1969 .parent = &ce3_src_clk.c,
1970 .c = {
1971 .dbg_name = "ce3_p_clk",
1972 .ops = &clk_ops_branch,
1973 CLK_INIT(ce3_p_clk.c),
1974 }
1975};
1976
Tianyi Gou352955d2012-05-18 19:44:01 -07001977#define F_SATA(f, s, d) \
1978 { \
1979 .freq_hz = f, \
1980 .src_clk = &s##_clk.c, \
1981 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
1982 }
1983
1984static struct clk_freq_tbl clk_tbl_sata[] = {
1985 F_SATA( 0, gnd, 1),
1986 F_SATA( 48000000, pll8, 8),
1987 F_SATA(100000000, pll3, 12),
1988 F_END
1989};
1990
1991static struct rcg_clk sata_src_clk = {
1992 .b = {
1993 .ctl_reg = SATA_CLK_SRC_NS_REG,
1994 .halt_check = NOCHECK,
1995 },
1996 .ns_reg = SATA_CLK_SRC_NS_REG,
1997 .root_en_mask = BIT(7),
1998 .ns_mask = BM(6, 0),
1999 .set_rate = set_rate_nop,
2000 .freq_tbl = clk_tbl_sata,
2001 .current_freq = &rcg_dummy_freq,
2002 .c = {
2003 .dbg_name = "sata_src_clk",
2004 .ops = &clk_ops_rcg,
2005 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
2006 CLK_INIT(sata_src_clk.c),
2007 },
2008};
2009
2010static struct branch_clk sata_rxoob_clk = {
2011 .b = {
2012 .ctl_reg = SATA_RXOOB_CLK_CTL_REG,
2013 .en_mask = BIT(4),
2014 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2015 .halt_bit = 26,
2016 },
2017 .parent = &sata_src_clk.c,
2018 .c = {
2019 .dbg_name = "sata_rxoob_clk",
2020 .ops = &clk_ops_branch,
2021 CLK_INIT(sata_rxoob_clk.c),
2022 },
2023};
2024
2025static struct branch_clk sata_pmalive_clk = {
2026 .b = {
2027 .ctl_reg = SATA_PMALIVE_CLK_CTL_REG,
2028 .en_mask = BIT(4),
2029 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2030 .halt_bit = 25,
2031 },
2032 .parent = &sata_src_clk.c,
2033 .c = {
2034 .dbg_name = "sata_pmalive_clk",
2035 .ops = &clk_ops_branch,
2036 CLK_INIT(sata_pmalive_clk.c),
2037 },
2038};
2039
Tianyi Gou41515e22011-09-01 19:37:43 -07002040static struct branch_clk sata_phy_ref_clk = {
2041 .b = {
2042 .ctl_reg = SATA_PHY_REF_CLK_CTL_REG,
2043 .en_mask = BIT(4),
2044 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2045 .halt_bit = 24,
2046 },
2047 .parent = &pxo_clk.c,
2048 .c = {
2049 .dbg_name = "sata_phy_ref_clk",
2050 .ops = &clk_ops_branch,
2051 CLK_INIT(sata_phy_ref_clk.c),
2052 },
2053};
2054
Tianyi Gou352955d2012-05-18 19:44:01 -07002055static struct branch_clk sata_a_clk = {
2056 .b = {
2057 .ctl_reg = SATA_ACLK_CTL_REG,
2058 .en_mask = BIT(4),
2059 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2060 .halt_bit = 12,
2061 },
2062 .c = {
2063 .dbg_name = "sata_a_clk",
2064 .ops = &clk_ops_branch,
2065 CLK_INIT(sata_a_clk.c),
2066 },
2067};
2068
2069static struct branch_clk sata_p_clk = {
2070 .b = {
2071 .ctl_reg = SATA_HCLK_CTL_REG,
2072 .en_mask = BIT(4),
2073 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2074 .halt_bit = 27,
2075 },
2076 .c = {
2077 .dbg_name = "sata_p_clk",
2078 .ops = &clk_ops_branch,
2079 CLK_INIT(sata_p_clk.c),
2080 },
2081};
2082
2083static struct branch_clk sfab_sata_s_p_clk = {
2084 .b = {
2085 .ctl_reg = SFAB_SATA_S_HCLK_CTL_REG,
2086 .en_mask = BIT(4),
2087 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
2088 .halt_bit = 14,
2089 },
2090 .c = {
2091 .dbg_name = "sfab_sata_s_p_clk",
2092 .ops = &clk_ops_branch,
2093 CLK_INIT(sfab_sata_s_p_clk.c),
2094 },
2095};
Tianyi Gou41515e22011-09-01 19:37:43 -07002096static struct branch_clk pcie_p_clk = {
2097 .b = {
2098 .ctl_reg = PCIE_HCLK_CTL_REG,
2099 .en_mask = BIT(4),
2100 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2101 .halt_bit = 8,
2102 },
2103 .c = {
2104 .dbg_name = "pcie_p_clk",
2105 .ops = &clk_ops_branch,
2106 CLK_INIT(pcie_p_clk.c),
2107 },
2108};
2109
Tianyi Gou6613de52012-01-27 17:57:53 -08002110static struct branch_clk pcie_phy_ref_clk = {
2111 .b = {
2112 .ctl_reg = PCIE_PCLK_CTL_REG,
2113 .en_mask = BIT(4),
2114 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2115 .halt_bit = 29,
2116 },
2117 .c = {
2118 .dbg_name = "pcie_phy_ref_clk",
2119 .ops = &clk_ops_branch,
2120 CLK_INIT(pcie_phy_ref_clk.c),
2121 },
2122};
2123
2124static struct branch_clk pcie_a_clk = {
2125 .b = {
2126 .ctl_reg = PCIE_ACLK_CTL_REG,
2127 .en_mask = BIT(4),
2128 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2129 .halt_bit = 13,
2130 },
2131 .c = {
2132 .dbg_name = "pcie_a_clk",
2133 .ops = &clk_ops_branch,
2134 CLK_INIT(pcie_a_clk.c),
2135 },
2136};
2137
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002138static struct branch_clk dma_bam_p_clk = {
2139 .b = {
2140 .ctl_reg = DMA_BAM_HCLK_CTL,
2141 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002142 .hwcg_reg = DMA_BAM_HCLK_CTL,
2143 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002144 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2145 .halt_bit = 12,
2146 },
2147 .c = {
2148 .dbg_name = "dma_bam_p_clk",
2149 .ops = &clk_ops_branch,
2150 CLK_INIT(dma_bam_p_clk.c),
2151 },
2152};
2153
2154static struct branch_clk gsbi1_p_clk = {
2155 .b = {
2156 .ctl_reg = GSBIn_HCLK_CTL_REG(1),
2157 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002158 .hwcg_reg = GSBIn_HCLK_CTL_REG(1),
2159 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002160 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2161 .halt_bit = 11,
2162 },
2163 .c = {
2164 .dbg_name = "gsbi1_p_clk",
2165 .ops = &clk_ops_branch,
2166 CLK_INIT(gsbi1_p_clk.c),
2167 },
2168};
2169
2170static struct branch_clk gsbi2_p_clk = {
2171 .b = {
2172 .ctl_reg = GSBIn_HCLK_CTL_REG(2),
2173 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002174 .hwcg_reg = GSBIn_HCLK_CTL_REG(2),
2175 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002176 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2177 .halt_bit = 7,
2178 },
2179 .c = {
2180 .dbg_name = "gsbi2_p_clk",
2181 .ops = &clk_ops_branch,
2182 CLK_INIT(gsbi2_p_clk.c),
2183 },
2184};
2185
2186static struct branch_clk gsbi3_p_clk = {
2187 .b = {
2188 .ctl_reg = GSBIn_HCLK_CTL_REG(3),
2189 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002190 .hwcg_reg = GSBIn_HCLK_CTL_REG(3),
2191 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002192 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2193 .halt_bit = 3,
2194 },
2195 .c = {
2196 .dbg_name = "gsbi3_p_clk",
2197 .ops = &clk_ops_branch,
2198 CLK_INIT(gsbi3_p_clk.c),
2199 },
2200};
2201
2202static struct branch_clk gsbi4_p_clk = {
2203 .b = {
2204 .ctl_reg = GSBIn_HCLK_CTL_REG(4),
2205 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002206 .hwcg_reg = GSBIn_HCLK_CTL_REG(4),
2207 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002208 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2209 .halt_bit = 27,
2210 },
2211 .c = {
2212 .dbg_name = "gsbi4_p_clk",
2213 .ops = &clk_ops_branch,
2214 CLK_INIT(gsbi4_p_clk.c),
2215 },
2216};
2217
2218static struct branch_clk gsbi5_p_clk = {
2219 .b = {
2220 .ctl_reg = GSBIn_HCLK_CTL_REG(5),
2221 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002222 .hwcg_reg = GSBIn_HCLK_CTL_REG(5),
2223 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002224 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2225 .halt_bit = 23,
2226 },
2227 .c = {
2228 .dbg_name = "gsbi5_p_clk",
2229 .ops = &clk_ops_branch,
2230 CLK_INIT(gsbi5_p_clk.c),
2231 },
2232};
2233
2234static struct branch_clk gsbi6_p_clk = {
2235 .b = {
2236 .ctl_reg = GSBIn_HCLK_CTL_REG(6),
2237 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002238 .hwcg_reg = GSBIn_HCLK_CTL_REG(6),
2239 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002240 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2241 .halt_bit = 19,
2242 },
2243 .c = {
2244 .dbg_name = "gsbi6_p_clk",
2245 .ops = &clk_ops_branch,
2246 CLK_INIT(gsbi6_p_clk.c),
2247 },
2248};
2249
2250static struct branch_clk gsbi7_p_clk = {
2251 .b = {
2252 .ctl_reg = GSBIn_HCLK_CTL_REG(7),
2253 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002254 .hwcg_reg = GSBIn_HCLK_CTL_REG(7),
2255 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002256 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2257 .halt_bit = 15,
2258 },
2259 .c = {
2260 .dbg_name = "gsbi7_p_clk",
2261 .ops = &clk_ops_branch,
2262 CLK_INIT(gsbi7_p_clk.c),
2263 },
2264};
2265
2266static struct branch_clk gsbi8_p_clk = {
2267 .b = {
2268 .ctl_reg = GSBIn_HCLK_CTL_REG(8),
2269 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002270 .hwcg_reg = GSBIn_HCLK_CTL_REG(8),
2271 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002272 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2273 .halt_bit = 11,
2274 },
2275 .c = {
2276 .dbg_name = "gsbi8_p_clk",
2277 .ops = &clk_ops_branch,
2278 CLK_INIT(gsbi8_p_clk.c),
2279 },
2280};
2281
2282static struct branch_clk gsbi9_p_clk = {
2283 .b = {
2284 .ctl_reg = GSBIn_HCLK_CTL_REG(9),
2285 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002286 .hwcg_reg = GSBIn_HCLK_CTL_REG(9),
2287 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002288 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2289 .halt_bit = 7,
2290 },
2291 .c = {
2292 .dbg_name = "gsbi9_p_clk",
2293 .ops = &clk_ops_branch,
2294 CLK_INIT(gsbi9_p_clk.c),
2295 },
2296};
2297
2298static struct branch_clk gsbi10_p_clk = {
2299 .b = {
2300 .ctl_reg = GSBIn_HCLK_CTL_REG(10),
2301 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002302 .hwcg_reg = GSBIn_HCLK_CTL_REG(10),
2303 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002304 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2305 .halt_bit = 3,
2306 },
2307 .c = {
2308 .dbg_name = "gsbi10_p_clk",
2309 .ops = &clk_ops_branch,
2310 CLK_INIT(gsbi10_p_clk.c),
2311 },
2312};
2313
2314static struct branch_clk gsbi11_p_clk = {
2315 .b = {
2316 .ctl_reg = GSBIn_HCLK_CTL_REG(11),
2317 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002318 .hwcg_reg = GSBIn_HCLK_CTL_REG(11),
2319 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002320 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2321 .halt_bit = 18,
2322 },
2323 .c = {
2324 .dbg_name = "gsbi11_p_clk",
2325 .ops = &clk_ops_branch,
2326 CLK_INIT(gsbi11_p_clk.c),
2327 },
2328};
2329
2330static struct branch_clk gsbi12_p_clk = {
2331 .b = {
2332 .ctl_reg = GSBIn_HCLK_CTL_REG(12),
2333 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002334 .hwcg_reg = GSBIn_HCLK_CTL_REG(12),
2335 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002336 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2337 .halt_bit = 14,
2338 },
2339 .c = {
2340 .dbg_name = "gsbi12_p_clk",
2341 .ops = &clk_ops_branch,
2342 CLK_INIT(gsbi12_p_clk.c),
2343 },
2344};
2345
Tianyi Gou41515e22011-09-01 19:37:43 -07002346static struct branch_clk sata_phy_cfg_clk = {
2347 .b = {
2348 .ctl_reg = SATA_PHY_CFG_CLK_CTL_REG,
2349 .en_mask = BIT(4),
2350 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2351 .halt_bit = 12,
2352 },
2353 .c = {
2354 .dbg_name = "sata_phy_cfg_clk",
2355 .ops = &clk_ops_branch,
2356 CLK_INIT(sata_phy_cfg_clk.c),
Stephen Boyd973e4ba2011-07-12 17:06:01 -07002357 },
2358};
2359
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002360static struct branch_clk tsif_p_clk = {
2361 .b = {
2362 .ctl_reg = TSIF_HCLK_CTL_REG,
2363 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002364 .hwcg_reg = TSIF_HCLK_CTL_REG,
2365 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002366 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2367 .halt_bit = 7,
2368 },
2369 .c = {
2370 .dbg_name = "tsif_p_clk",
2371 .ops = &clk_ops_branch,
2372 CLK_INIT(tsif_p_clk.c),
2373 },
2374};
2375
2376static struct branch_clk usb_fs1_p_clk = {
2377 .b = {
2378 .ctl_reg = USB_FSn_HCLK_CTL_REG(1),
2379 .en_mask = BIT(4),
2380 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2381 .halt_bit = 17,
2382 },
2383 .c = {
2384 .dbg_name = "usb_fs1_p_clk",
2385 .ops = &clk_ops_branch,
2386 CLK_INIT(usb_fs1_p_clk.c),
2387 },
2388};
2389
2390static struct branch_clk usb_fs2_p_clk = {
2391 .b = {
2392 .ctl_reg = USB_FSn_HCLK_CTL_REG(2),
2393 .en_mask = BIT(4),
2394 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2395 .halt_bit = 14,
2396 },
2397 .c = {
2398 .dbg_name = "usb_fs2_p_clk",
2399 .ops = &clk_ops_branch,
2400 CLK_INIT(usb_fs2_p_clk.c),
2401 },
2402};
2403
2404static struct branch_clk usb_hs1_p_clk = {
2405 .b = {
2406 .ctl_reg = USB_HS1_HCLK_CTL_REG,
2407 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002408 .hwcg_reg = USB_HS1_HCLK_CTL_REG,
2409 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002410 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2411 .halt_bit = 1,
2412 },
2413 .c = {
2414 .dbg_name = "usb_hs1_p_clk",
2415 .ops = &clk_ops_branch,
2416 CLK_INIT(usb_hs1_p_clk.c),
2417 },
2418};
2419
Tianyi Gou41515e22011-09-01 19:37:43 -07002420static struct branch_clk usb_hs3_p_clk = {
2421 .b = {
2422 .ctl_reg = USB_HS3_HCLK_CTL_REG,
2423 .en_mask = BIT(4),
2424 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2425 .halt_bit = 31,
2426 },
2427 .c = {
2428 .dbg_name = "usb_hs3_p_clk",
2429 .ops = &clk_ops_branch,
2430 CLK_INIT(usb_hs3_p_clk.c),
2431 },
2432};
2433
2434static struct branch_clk usb_hs4_p_clk = {
2435 .b = {
2436 .ctl_reg = USB_HS4_HCLK_CTL_REG,
2437 .en_mask = BIT(4),
2438 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2439 .halt_bit = 7,
2440 },
2441 .c = {
2442 .dbg_name = "usb_hs4_p_clk",
2443 .ops = &clk_ops_branch,
2444 CLK_INIT(usb_hs4_p_clk.c),
2445 },
2446};
2447
Stephen Boyd94625ef2011-07-12 17:06:01 -07002448static struct branch_clk usb_hsic_p_clk = {
2449 .b = {
2450 .ctl_reg = USB_HSIC_HCLK_CTL_REG,
2451 .en_mask = BIT(4),
2452 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2453 .halt_bit = 28,
2454 },
2455 .c = {
2456 .dbg_name = "usb_hsic_p_clk",
2457 .ops = &clk_ops_branch,
2458 CLK_INIT(usb_hsic_p_clk.c),
2459 },
2460};
2461
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002462static struct branch_clk sdc1_p_clk = {
2463 .b = {
2464 .ctl_reg = SDCn_HCLK_CTL_REG(1),
2465 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002466 .hwcg_reg = SDCn_HCLK_CTL_REG(1),
2467 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002468 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2469 .halt_bit = 11,
2470 },
2471 .c = {
2472 .dbg_name = "sdc1_p_clk",
2473 .ops = &clk_ops_branch,
2474 CLK_INIT(sdc1_p_clk.c),
2475 },
2476};
2477
2478static struct branch_clk sdc2_p_clk = {
2479 .b = {
2480 .ctl_reg = SDCn_HCLK_CTL_REG(2),
2481 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002482 .hwcg_reg = SDCn_HCLK_CTL_REG(2),
2483 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002484 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2485 .halt_bit = 10,
2486 },
2487 .c = {
2488 .dbg_name = "sdc2_p_clk",
2489 .ops = &clk_ops_branch,
2490 CLK_INIT(sdc2_p_clk.c),
2491 },
2492};
2493
2494static struct branch_clk sdc3_p_clk = {
2495 .b = {
2496 .ctl_reg = SDCn_HCLK_CTL_REG(3),
2497 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002498 .hwcg_reg = SDCn_HCLK_CTL_REG(3),
2499 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002500 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2501 .halt_bit = 9,
2502 },
2503 .c = {
2504 .dbg_name = "sdc3_p_clk",
2505 .ops = &clk_ops_branch,
2506 CLK_INIT(sdc3_p_clk.c),
2507 },
2508};
2509
2510static struct branch_clk sdc4_p_clk = {
2511 .b = {
2512 .ctl_reg = SDCn_HCLK_CTL_REG(4),
2513 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002514 .hwcg_reg = SDCn_HCLK_CTL_REG(4),
2515 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002516 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2517 .halt_bit = 8,
2518 },
2519 .c = {
2520 .dbg_name = "sdc4_p_clk",
2521 .ops = &clk_ops_branch,
2522 CLK_INIT(sdc4_p_clk.c),
2523 },
2524};
2525
2526static struct branch_clk sdc5_p_clk = {
2527 .b = {
2528 .ctl_reg = SDCn_HCLK_CTL_REG(5),
2529 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002530 .hwcg_reg = SDCn_HCLK_CTL_REG(5),
2531 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002532 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2533 .halt_bit = 7,
2534 },
2535 .c = {
2536 .dbg_name = "sdc5_p_clk",
2537 .ops = &clk_ops_branch,
2538 CLK_INIT(sdc5_p_clk.c),
2539 },
2540};
2541
2542/* HW-Voteable Clocks */
2543static struct branch_clk adm0_clk = {
2544 .b = {
2545 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2546 .en_mask = BIT(2),
2547 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2548 .halt_check = HALT_VOTED,
2549 .halt_bit = 14,
2550 },
2551 .c = {
2552 .dbg_name = "adm0_clk",
2553 .ops = &clk_ops_branch,
2554 CLK_INIT(adm0_clk.c),
2555 },
2556};
2557
2558static struct branch_clk adm0_p_clk = {
2559 .b = {
2560 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2561 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002562 .hwcg_reg = ADM0_PBUS_CLK_CTL_REG,
2563 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002564 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2565 .halt_check = HALT_VOTED,
2566 .halt_bit = 13,
2567 },
2568 .c = {
2569 .dbg_name = "adm0_p_clk",
2570 .ops = &clk_ops_branch,
2571 CLK_INIT(adm0_p_clk.c),
2572 },
2573};
2574
2575static struct branch_clk pmic_arb0_p_clk = {
2576 .b = {
2577 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2578 .en_mask = BIT(8),
2579 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2580 .halt_check = HALT_VOTED,
2581 .halt_bit = 22,
2582 },
2583 .c = {
2584 .dbg_name = "pmic_arb0_p_clk",
2585 .ops = &clk_ops_branch,
2586 CLK_INIT(pmic_arb0_p_clk.c),
2587 },
2588};
2589
2590static struct branch_clk pmic_arb1_p_clk = {
2591 .b = {
2592 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2593 .en_mask = BIT(9),
2594 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2595 .halt_check = HALT_VOTED,
2596 .halt_bit = 21,
2597 },
2598 .c = {
2599 .dbg_name = "pmic_arb1_p_clk",
2600 .ops = &clk_ops_branch,
2601 CLK_INIT(pmic_arb1_p_clk.c),
2602 },
2603};
2604
2605static struct branch_clk pmic_ssbi2_clk = {
2606 .b = {
2607 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2608 .en_mask = BIT(7),
2609 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2610 .halt_check = HALT_VOTED,
2611 .halt_bit = 23,
2612 },
2613 .c = {
2614 .dbg_name = "pmic_ssbi2_clk",
2615 .ops = &clk_ops_branch,
2616 CLK_INIT(pmic_ssbi2_clk.c),
2617 },
2618};
2619
2620static struct branch_clk rpm_msg_ram_p_clk = {
2621 .b = {
2622 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2623 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002624 .hwcg_reg = RPM_MSG_RAM_HCLK_CTL_REG,
2625 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002626 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2627 .halt_check = HALT_VOTED,
2628 .halt_bit = 12,
2629 },
2630 .c = {
2631 .dbg_name = "rpm_msg_ram_p_clk",
2632 .ops = &clk_ops_branch,
2633 CLK_INIT(rpm_msg_ram_p_clk.c),
2634 },
2635};
2636
2637/*
2638 * Multimedia Clocks
2639 */
2640
Stephen Boyd94625ef2011-07-12 17:06:01 -07002641#define CLK_CAM(name, n, hb) \
2642 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002643 .b = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002644 .ctl_reg = CAMCLK##n##_CC_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002645 .en_mask = BIT(0), \
2646 .halt_reg = DBG_BUS_VEC_I_REG, \
2647 .halt_bit = hb, \
2648 }, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002649 .ns_reg = CAMCLK##n##_NS_REG, \
2650 .md_reg = CAMCLK##n##_MD_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002651 .root_en_mask = BIT(2), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002652 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), \
Matt Wagantall07c45472012-02-10 23:27:24 -08002653 .mnd_en_mask = BIT(5), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002654 .ctl_mask = BM(7, 6), \
2655 .set_rate = set_rate_mnd_8, \
2656 .freq_tbl = clk_tbl_cam, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002657 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002658 .c = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002659 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07002660 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002661 VDD_DIG_FMAX_MAP2(LOW, 64000000, NOMINAL, 128000000), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002662 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002663 }, \
2664 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002665#define F_CAM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002666 { \
2667 .freq_hz = f, \
2668 .src_clk = &s##_clk.c, \
2669 .md_val = MD8(8, m, 0, n), \
2670 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2671 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002672 }
2673static struct clk_freq_tbl clk_tbl_cam[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002674 F_CAM( 0, gnd, 1, 0, 0),
2675 F_CAM( 6000000, pll8, 4, 1, 16),
2676 F_CAM( 8000000, pll8, 4, 1, 12),
2677 F_CAM( 12000000, pll8, 4, 1, 8),
2678 F_CAM( 16000000, pll8, 4, 1, 6),
2679 F_CAM( 19200000, pll8, 4, 1, 5),
2680 F_CAM( 24000000, pll8, 4, 1, 4),
2681 F_CAM( 32000000, pll8, 4, 1, 3),
2682 F_CAM( 48000000, pll8, 4, 1, 2),
2683 F_CAM( 64000000, pll8, 3, 1, 2),
2684 F_CAM( 96000000, pll8, 4, 0, 0),
2685 F_CAM(128000000, pll8, 3, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002686 F_END
2687};
2688
Stephen Boyd94625ef2011-07-12 17:06:01 -07002689static CLK_CAM(cam0_clk, 0, 15);
2690static CLK_CAM(cam1_clk, 1, 16);
2691static CLK_CAM(cam2_clk, 2, 31);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002692
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002693#define F_CSI(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002694 { \
2695 .freq_hz = f, \
2696 .src_clk = &s##_clk.c, \
2697 .md_val = MD8(8, m, 0, n), \
2698 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2699 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002700 }
2701static struct clk_freq_tbl clk_tbl_csi[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002702 F_CSI( 0, gnd, 1, 0, 0),
Stephen Boyd092fd182011-10-21 15:56:30 -07002703 F_CSI( 27000000, pxo, 1, 0, 0),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002704 F_CSI( 85330000, pll8, 1, 2, 9),
2705 F_CSI(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002706 F_END
2707};
2708
2709static struct rcg_clk csi0_src_clk = {
2710 .ns_reg = CSI0_NS_REG,
2711 .b = {
2712 .ctl_reg = CSI0_CC_REG,
2713 .halt_check = NOCHECK,
2714 },
2715 .md_reg = CSI0_MD_REG,
2716 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002717 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002718 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002719 .ctl_mask = BM(7, 6),
2720 .set_rate = set_rate_mnd,
2721 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002722 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002723 .c = {
2724 .dbg_name = "csi0_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002725 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002726 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002727 CLK_INIT(csi0_src_clk.c),
2728 },
2729};
2730
2731static struct branch_clk csi0_clk = {
2732 .b = {
2733 .ctl_reg = CSI0_CC_REG,
2734 .en_mask = BIT(0),
2735 .reset_reg = SW_RESET_CORE_REG,
2736 .reset_mask = BIT(8),
2737 .halt_reg = DBG_BUS_VEC_B_REG,
2738 .halt_bit = 13,
2739 },
2740 .parent = &csi0_src_clk.c,
2741 .c = {
2742 .dbg_name = "csi0_clk",
2743 .ops = &clk_ops_branch,
2744 CLK_INIT(csi0_clk.c),
2745 },
2746};
2747
2748static struct branch_clk csi0_phy_clk = {
2749 .b = {
2750 .ctl_reg = CSI0_CC_REG,
2751 .en_mask = BIT(8),
2752 .reset_reg = SW_RESET_CORE_REG,
2753 .reset_mask = BIT(29),
2754 .halt_reg = DBG_BUS_VEC_I_REG,
2755 .halt_bit = 9,
2756 },
2757 .parent = &csi0_src_clk.c,
2758 .c = {
2759 .dbg_name = "csi0_phy_clk",
2760 .ops = &clk_ops_branch,
2761 CLK_INIT(csi0_phy_clk.c),
2762 },
2763};
2764
2765static struct rcg_clk csi1_src_clk = {
2766 .ns_reg = CSI1_NS_REG,
2767 .b = {
2768 .ctl_reg = CSI1_CC_REG,
2769 .halt_check = NOCHECK,
2770 },
2771 .md_reg = CSI1_MD_REG,
2772 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002773 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002774 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002775 .ctl_mask = BM(7, 6),
2776 .set_rate = set_rate_mnd,
2777 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002778 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002779 .c = {
2780 .dbg_name = "csi1_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002781 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002782 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002783 CLK_INIT(csi1_src_clk.c),
2784 },
2785};
2786
2787static struct branch_clk csi1_clk = {
2788 .b = {
2789 .ctl_reg = CSI1_CC_REG,
2790 .en_mask = BIT(0),
2791 .reset_reg = SW_RESET_CORE_REG,
2792 .reset_mask = BIT(18),
2793 .halt_reg = DBG_BUS_VEC_B_REG,
2794 .halt_bit = 14,
2795 },
2796 .parent = &csi1_src_clk.c,
2797 .c = {
2798 .dbg_name = "csi1_clk",
2799 .ops = &clk_ops_branch,
2800 CLK_INIT(csi1_clk.c),
2801 },
2802};
2803
2804static struct branch_clk csi1_phy_clk = {
2805 .b = {
2806 .ctl_reg = CSI1_CC_REG,
2807 .en_mask = BIT(8),
2808 .reset_reg = SW_RESET_CORE_REG,
2809 .reset_mask = BIT(28),
2810 .halt_reg = DBG_BUS_VEC_I_REG,
2811 .halt_bit = 10,
2812 },
2813 .parent = &csi1_src_clk.c,
2814 .c = {
2815 .dbg_name = "csi1_phy_clk",
2816 .ops = &clk_ops_branch,
2817 CLK_INIT(csi1_phy_clk.c),
2818 },
2819};
2820
Stephen Boyd94625ef2011-07-12 17:06:01 -07002821static struct rcg_clk csi2_src_clk = {
2822 .ns_reg = CSI2_NS_REG,
2823 .b = {
2824 .ctl_reg = CSI2_CC_REG,
2825 .halt_check = NOCHECK,
2826 },
2827 .md_reg = CSI2_MD_REG,
2828 .root_en_mask = BIT(2),
2829 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002830 .mnd_en_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002831 .ctl_mask = BM(7, 6),
2832 .set_rate = set_rate_mnd,
2833 .freq_tbl = clk_tbl_csi,
2834 .current_freq = &rcg_dummy_freq,
2835 .c = {
2836 .dbg_name = "csi2_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002837 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002838 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002839 CLK_INIT(csi2_src_clk.c),
2840 },
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),
2857 },
2858};
2859
2860static struct branch_clk csi2_phy_clk = {
2861 .b = {
2862 .ctl_reg = CSI2_CC_REG,
2863 .en_mask = BIT(8),
2864 .reset_reg = SW_RESET_CORE_REG,
2865 .reset_mask = BIT(31),
2866 .halt_reg = DBG_BUS_VEC_I_REG,
2867 .halt_bit = 29,
2868 },
2869 .parent = &csi2_src_clk.c,
2870 .c = {
2871 .dbg_name = "csi2_phy_clk",
2872 .ops = &clk_ops_branch,
2873 CLK_INIT(csi2_phy_clk.c),
2874 },
2875};
2876
Stephen Boyd092fd182011-10-21 15:56:30 -07002877static struct clk *pix_rdi_mux_map[] = {
2878 [0] = &csi0_clk.c,
2879 [1] = &csi1_clk.c,
2880 [2] = &csi2_clk.c,
2881 NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002882};
2883
Stephen Boyd092fd182011-10-21 15:56:30 -07002884struct pix_rdi_clk {
Stephen Boydd86d1f22012-01-24 17:36:34 -08002885 bool prepared;
Stephen Boyd092fd182011-10-21 15:56:30 -07002886 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;
Stephen Boydd86d1f22012-01-24 17:36:34 -08002911 unsigned long old_rate = rdi->cur_rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002912
2913 /*
2914 * These clocks select three inputs via two muxes. One mux selects
2915 * between csi0 and csi1 and the second mux selects between that mux's
2916 * output and csi2. The source and destination selections for each
2917 * mux must be clocking for the switch to succeed so just turn on
2918 * all three sources because it's easier than figuring out what source
2919 * needs to be on at what time.
2920 */
2921 for (i = 0; mux_map[i]; i++) {
Stephen Boydd86d1f22012-01-24 17:36:34 -08002922 ret = clk_prepare_enable(mux_map[i]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002923 if (ret)
2924 goto err;
2925 }
2926 if (rate >= i) {
2927 ret = -EINVAL;
2928 goto err;
2929 }
2930 /* Keep the new source on when switching inputs of an enabled clock */
Stephen Boydd86d1f22012-01-24 17:36:34 -08002931 if (rdi->prepared) {
2932 ret = clk_prepare(mux_map[rate]);
2933 if (ret)
2934 goto err;
Stephen Boyd092fd182011-10-21 15:56:30 -07002935 }
Stephen Boydd86d1f22012-01-24 17:36:34 -08002936 spin_lock_irqsave(&c->lock, flags);
2937 if (rdi->enabled) {
2938 ret = clk_enable(mux_map[rate]);
2939 if (ret) {
2940 spin_unlock_irqrestore(&c->lock, flags);
2941 clk_unprepare(mux_map[rate]);
2942 goto err;
2943 }
2944 }
2945 spin_lock(&local_clock_reg_lock);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002946 reg = readl_relaxed(rdi->s2_reg);
2947 reg &= ~rdi->s2_mask;
2948 reg |= rate == 2 ? rdi->s2_mask : 0;
2949 writel_relaxed(reg, rdi->s2_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002950 /*
2951 * Wait at least 6 cycles of slowest clock
2952 * for the glitch-free MUX to fully switch sources.
2953 */
2954 mb();
2955 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002956 reg = readl_relaxed(rdi->s_reg);
2957 reg &= ~rdi->s_mask;
2958 reg |= rate == 1 ? rdi->s_mask : 0;
2959 writel_relaxed(reg, rdi->s_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002960 /*
2961 * Wait at least 6 cycles of slowest clock
2962 * for the glitch-free MUX to fully switch sources.
2963 */
2964 mb();
2965 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002966 rdi->cur_rate = rate;
Stephen Boydd86d1f22012-01-24 17:36:34 -08002967 spin_unlock(&local_clock_reg_lock);
2968
2969 if (rdi->enabled)
2970 clk_disable(mux_map[old_rate]);
2971 spin_unlock_irqrestore(&c->lock, flags);
2972 if (rdi->prepared)
2973 clk_unprepare(mux_map[old_rate]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002974err:
2975 for (i--; i >= 0; i--)
Stephen Boydd86d1f22012-01-24 17:36:34 -08002976 clk_disable_unprepare(mux_map[i]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002977
2978 return 0;
2979}
2980
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002981static unsigned long pix_rdi_clk_get_rate(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002982{
2983 return to_pix_rdi_clk(c)->cur_rate;
2984}
2985
Stephen Boydd86d1f22012-01-24 17:36:34 -08002986static int pix_rdi_clk_prepare(struct clk *c)
2987{
2988 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
2989 rdi->prepared = true;
2990 return 0;
2991}
2992
Stephen Boyd092fd182011-10-21 15:56:30 -07002993static int pix_rdi_clk_enable(struct clk *c)
2994{
2995 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002996 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002997
2998 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07002999 __branch_enable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07003000 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08003001 rdi->enabled = true;
Stephen Boyd092fd182011-10-21 15:56:30 -07003002
3003 return 0;
3004}
3005
3006static void pix_rdi_clk_disable(struct clk *c)
3007{
3008 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08003009 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07003010
3011 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07003012 __branch_disable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07003013 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08003014 rdi->enabled = false;
Stephen Boyd092fd182011-10-21 15:56:30 -07003015}
3016
Stephen Boydd86d1f22012-01-24 17:36:34 -08003017static void pix_rdi_clk_unprepare(struct clk *c)
3018{
3019 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
3020 rdi->prepared = false;
3021}
3022
Matt Wagantallf82f2942012-01-27 13:56:13 -08003023static int pix_rdi_clk_reset(struct clk *c, enum clk_reset_action action)
Stephen Boyd092fd182011-10-21 15:56:30 -07003024{
Matt Wagantallf82f2942012-01-27 13:56:13 -08003025 return branch_reset(&to_pix_rdi_clk(c)->b, action);
Stephen Boyd092fd182011-10-21 15:56:30 -07003026}
3027
3028static struct clk *pix_rdi_clk_get_parent(struct clk *c)
3029{
Matt Wagantallf82f2942012-01-27 13:56:13 -08003030 return pix_rdi_mux_map[to_pix_rdi_clk(c)->cur_rate];
Stephen Boyd092fd182011-10-21 15:56:30 -07003031}
3032
3033static int pix_rdi_clk_list_rate(struct clk *c, unsigned n)
3034{
3035 if (pix_rdi_mux_map[n])
3036 return n;
3037 return -ENXIO;
3038}
3039
Matt Wagantalla15833b2012-04-03 11:00:56 -07003040static enum handoff pix_rdi_clk_handoff(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07003041{
3042 u32 reg;
Matt Wagantallf82f2942012-01-27 13:56:13 -08003043 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07003044 enum handoff ret;
3045
Matt Wagantallf82f2942012-01-27 13:56:13 -08003046 ret = branch_handoff(&rdi->b, &rdi->c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07003047 if (ret == HANDOFF_DISABLED_CLK)
3048 return ret;
Stephen Boyd092fd182011-10-21 15:56:30 -07003049
Matt Wagantallf82f2942012-01-27 13:56:13 -08003050 reg = readl_relaxed(rdi->s_reg);
3051 rdi->cur_rate = reg & rdi->s_mask ? 1 : 0;
3052 reg = readl_relaxed(rdi->s2_reg);
3053 rdi->cur_rate = reg & rdi->s2_mask ? 2 : rdi->cur_rate;
Matt Wagantalla15833b2012-04-03 11:00:56 -07003054
3055 return HANDOFF_ENABLED_CLK;
Stephen Boyd092fd182011-10-21 15:56:30 -07003056}
3057
3058static struct clk_ops clk_ops_pix_rdi_8960 = {
Stephen Boydd86d1f22012-01-24 17:36:34 -08003059 .prepare = pix_rdi_clk_prepare,
Stephen Boyd092fd182011-10-21 15:56:30 -07003060 .enable = pix_rdi_clk_enable,
3061 .disable = pix_rdi_clk_disable,
Stephen Boydd86d1f22012-01-24 17:36:34 -08003062 .unprepare = pix_rdi_clk_unprepare,
Stephen Boyd092fd182011-10-21 15:56:30 -07003063 .handoff = pix_rdi_clk_handoff,
3064 .set_rate = pix_rdi_clk_set_rate,
3065 .get_rate = pix_rdi_clk_get_rate,
3066 .list_rate = pix_rdi_clk_list_rate,
3067 .reset = pix_rdi_clk_reset,
Stephen Boyd092fd182011-10-21 15:56:30 -07003068 .get_parent = pix_rdi_clk_get_parent,
3069};
3070
3071static struct pix_rdi_clk csi_pix_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003072 .b = {
3073 .ctl_reg = MISC_CC_REG,
3074 .en_mask = BIT(26),
3075 .halt_check = DELAY,
3076 .reset_reg = SW_RESET_CORE_REG,
3077 .reset_mask = BIT(26),
3078 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003079 .s_reg = MISC_CC_REG,
3080 .s_mask = BIT(25),
3081 .s2_reg = MISC_CC3_REG,
3082 .s2_mask = BIT(13),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003083 .c = {
3084 .dbg_name = "csi_pix_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003085 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003086 CLK_INIT(csi_pix_clk.c),
3087 },
3088};
3089
Stephen Boyd092fd182011-10-21 15:56:30 -07003090static struct pix_rdi_clk csi_pix1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003091 .b = {
3092 .ctl_reg = MISC_CC3_REG,
3093 .en_mask = BIT(10),
3094 .halt_check = DELAY,
3095 .reset_reg = SW_RESET_CORE_REG,
3096 .reset_mask = BIT(30),
3097 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003098 .s_reg = MISC_CC3_REG,
3099 .s_mask = BIT(8),
3100 .s2_reg = MISC_CC3_REG,
3101 .s2_mask = BIT(9),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003102 .c = {
3103 .dbg_name = "csi_pix1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003104 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003105 CLK_INIT(csi_pix1_clk.c),
3106 },
3107};
3108
Stephen Boyd092fd182011-10-21 15:56:30 -07003109static struct pix_rdi_clk csi_rdi_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003110 .b = {
3111 .ctl_reg = MISC_CC_REG,
3112 .en_mask = BIT(13),
3113 .halt_check = DELAY,
3114 .reset_reg = SW_RESET_CORE_REG,
3115 .reset_mask = BIT(27),
3116 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003117 .s_reg = MISC_CC_REG,
3118 .s_mask = BIT(12),
3119 .s2_reg = MISC_CC3_REG,
3120 .s2_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003121 .c = {
3122 .dbg_name = "csi_rdi_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003123 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003124 CLK_INIT(csi_rdi_clk.c),
3125 },
3126};
3127
Stephen Boyd092fd182011-10-21 15:56:30 -07003128static struct pix_rdi_clk csi_rdi1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003129 .b = {
3130 .ctl_reg = MISC_CC3_REG,
3131 .en_mask = BIT(2),
3132 .halt_check = DELAY,
3133 .reset_reg = SW_RESET_CORE2_REG,
3134 .reset_mask = BIT(1),
3135 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003136 .s_reg = MISC_CC3_REG,
3137 .s_mask = BIT(0),
3138 .s2_reg = MISC_CC3_REG,
3139 .s2_mask = BIT(1),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003140 .c = {
3141 .dbg_name = "csi_rdi1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003142 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003143 CLK_INIT(csi_rdi1_clk.c),
3144 },
3145};
3146
Stephen Boyd092fd182011-10-21 15:56:30 -07003147static struct pix_rdi_clk csi_rdi2_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003148 .b = {
3149 .ctl_reg = MISC_CC3_REG,
3150 .en_mask = BIT(6),
3151 .halt_check = DELAY,
3152 .reset_reg = SW_RESET_CORE2_REG,
3153 .reset_mask = BIT(0),
3154 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003155 .s_reg = MISC_CC3_REG,
3156 .s_mask = BIT(4),
3157 .s2_reg = MISC_CC3_REG,
3158 .s2_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003159 .c = {
3160 .dbg_name = "csi_rdi2_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003161 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003162 CLK_INIT(csi_rdi2_clk.c),
3163 },
3164};
3165
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003166#define F_CSI_PHYTIMER(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003167 { \
3168 .freq_hz = f, \
3169 .src_clk = &s##_clk.c, \
3170 .md_val = MD8(8, m, 0, n), \
3171 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
3172 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003173 }
3174static struct clk_freq_tbl clk_tbl_csi_phytimer[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003175 F_CSI_PHYTIMER( 0, gnd, 1, 0, 0),
3176 F_CSI_PHYTIMER( 85330000, pll8, 1, 2, 9),
3177 F_CSI_PHYTIMER(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003178 F_END
3179};
3180
3181static struct rcg_clk csiphy_timer_src_clk = {
3182 .ns_reg = CSIPHYTIMER_NS_REG,
3183 .b = {
3184 .ctl_reg = CSIPHYTIMER_CC_REG,
3185 .halt_check = NOCHECK,
3186 },
3187 .md_reg = CSIPHYTIMER_MD_REG,
3188 .root_en_mask = BIT(2),
3189 .ns_mask = (BM(31, 24) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003190 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003191 .ctl_mask = BM(7, 6),
3192 .set_rate = set_rate_mnd_8,
3193 .freq_tbl = clk_tbl_csi_phytimer,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003194 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003195 .c = {
3196 .dbg_name = "csiphy_timer_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003197 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003198 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003199 CLK_INIT(csiphy_timer_src_clk.c),
3200 },
3201};
3202
3203static struct branch_clk csi0phy_timer_clk = {
3204 .b = {
3205 .ctl_reg = CSIPHYTIMER_CC_REG,
3206 .en_mask = BIT(0),
3207 .halt_reg = DBG_BUS_VEC_I_REG,
3208 .halt_bit = 17,
3209 },
3210 .parent = &csiphy_timer_src_clk.c,
3211 .c = {
3212 .dbg_name = "csi0phy_timer_clk",
3213 .ops = &clk_ops_branch,
3214 CLK_INIT(csi0phy_timer_clk.c),
3215 },
3216};
3217
3218static struct branch_clk csi1phy_timer_clk = {
3219 .b = {
3220 .ctl_reg = CSIPHYTIMER_CC_REG,
3221 .en_mask = BIT(9),
3222 .halt_reg = DBG_BUS_VEC_I_REG,
3223 .halt_bit = 18,
3224 },
3225 .parent = &csiphy_timer_src_clk.c,
3226 .c = {
3227 .dbg_name = "csi1phy_timer_clk",
3228 .ops = &clk_ops_branch,
3229 CLK_INIT(csi1phy_timer_clk.c),
3230 },
3231};
3232
Stephen Boyd94625ef2011-07-12 17:06:01 -07003233static struct branch_clk csi2phy_timer_clk = {
3234 .b = {
3235 .ctl_reg = CSIPHYTIMER_CC_REG,
3236 .en_mask = BIT(11),
3237 .halt_reg = DBG_BUS_VEC_I_REG,
3238 .halt_bit = 30,
3239 },
3240 .parent = &csiphy_timer_src_clk.c,
3241 .c = {
3242 .dbg_name = "csi2phy_timer_clk",
3243 .ops = &clk_ops_branch,
3244 CLK_INIT(csi2phy_timer_clk.c),
3245 },
3246};
3247
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003248#define F_DSI(d) \
3249 { \
3250 .freq_hz = d, \
3251 .ns_val = BVAL(15, 12, (d-1)), \
3252 }
3253/*
3254 * The DSI_BYTE/ESC clock is sourced from the DSI PHY PLL, which may change rate
3255 * without this clock driver knowing. So, overload the clk_set_rate() to set
3256 * the divider (1 to 16) of the clock with respect to the PLL rate.
3257 */
3258static struct clk_freq_tbl clk_tbl_dsi_byte[] = {
3259 F_DSI(1), F_DSI(2), F_DSI(3), F_DSI(4),
3260 F_DSI(5), F_DSI(6), F_DSI(7), F_DSI(8),
3261 F_DSI(9), F_DSI(10), F_DSI(11), F_DSI(12),
3262 F_DSI(13), F_DSI(14), F_DSI(15), F_DSI(16),
3263 F_END
3264};
3265
Matt Wagantall735e41b2012-07-23 17:18:58 -07003266static struct branch_clk dsi1_reset_clk = {
3267 .b = {
3268 .reset_reg = SW_RESET_CORE_REG,
3269 .reset_mask = BIT(7),
3270 .halt_check = NOCHECK,
3271 },
3272 .c = {
3273 .dbg_name = "dsi1_reset_clk",
3274 .ops = &clk_ops_branch,
3275 CLK_INIT(dsi1_reset_clk.c),
3276 },
3277};
3278
3279static struct branch_clk dsi2_reset_clk = {
3280 .b = {
3281 .reset_reg = SW_RESET_CORE_REG,
3282 .reset_mask = BIT(25),
3283 .halt_check = NOCHECK,
3284 },
3285 .c = {
3286 .dbg_name = "dsi2_reset_clk",
3287 .ops = &clk_ops_branch,
3288 CLK_INIT(dsi2_reset_clk.c),
3289 },
3290};
3291
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003292static struct rcg_clk dsi1_byte_clk = {
3293 .b = {
3294 .ctl_reg = DSI1_BYTE_CC_REG,
3295 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003296 .halt_reg = DBG_BUS_VEC_B_REG,
3297 .halt_bit = 21,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003298 .retain_reg = DSI1_BYTE_CC_REG,
3299 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003300 },
3301 .ns_reg = DSI1_BYTE_NS_REG,
3302 .root_en_mask = BIT(2),
3303 .ns_mask = BM(15, 12),
3304 .set_rate = set_rate_nop,
3305 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003306 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003307 .c = {
3308 .dbg_name = "dsi1_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003309 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003310 CLK_INIT(dsi1_byte_clk.c),
3311 },
3312};
3313
3314static struct rcg_clk dsi2_byte_clk = {
3315 .b = {
3316 .ctl_reg = DSI2_BYTE_CC_REG,
3317 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003318 .halt_reg = DBG_BUS_VEC_B_REG,
3319 .halt_bit = 20,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003320 .retain_reg = DSI2_BYTE_CC_REG,
3321 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003322 },
3323 .ns_reg = DSI2_BYTE_NS_REG,
3324 .root_en_mask = BIT(2),
3325 .ns_mask = BM(15, 12),
3326 .set_rate = set_rate_nop,
3327 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003328 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003329 .c = {
3330 .dbg_name = "dsi2_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003331 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003332 CLK_INIT(dsi2_byte_clk.c),
3333 },
3334};
3335
3336static struct rcg_clk dsi1_esc_clk = {
3337 .b = {
3338 .ctl_reg = DSI1_ESC_CC_REG,
3339 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003340 .halt_reg = DBG_BUS_VEC_I_REG,
3341 .halt_bit = 1,
3342 },
3343 .ns_reg = DSI1_ESC_NS_REG,
3344 .root_en_mask = BIT(2),
3345 .ns_mask = BM(15, 12),
3346 .set_rate = set_rate_nop,
3347 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003348 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003349 .c = {
3350 .dbg_name = "dsi1_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003351 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003352 CLK_INIT(dsi1_esc_clk.c),
3353 },
3354};
3355
3356static struct rcg_clk dsi2_esc_clk = {
3357 .b = {
3358 .ctl_reg = DSI2_ESC_CC_REG,
3359 .en_mask = BIT(0),
3360 .halt_reg = DBG_BUS_VEC_I_REG,
3361 .halt_bit = 3,
3362 },
3363 .ns_reg = DSI2_ESC_NS_REG,
3364 .root_en_mask = BIT(2),
3365 .ns_mask = BM(15, 12),
3366 .set_rate = set_rate_nop,
3367 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003368 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003369 .c = {
3370 .dbg_name = "dsi2_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003371 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003372 CLK_INIT(dsi2_esc_clk.c),
3373 },
3374};
3375
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003376#define F_GFX2D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003377 { \
3378 .freq_hz = f, \
3379 .src_clk = &s##_clk.c, \
3380 .md_val = MD4(4, m, 0, n), \
3381 .ns_val = NS_MND_BANKED4(20, 16, n, m, 3, 0, s##_to_mm_mux), \
3382 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003383 }
3384static struct clk_freq_tbl clk_tbl_gfx2d[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003385 F_GFX2D( 0, gnd, 0, 0),
3386 F_GFX2D( 27000000, pxo, 0, 0),
3387 F_GFX2D( 48000000, pll8, 1, 8),
3388 F_GFX2D( 54857000, pll8, 1, 7),
3389 F_GFX2D( 64000000, pll8, 1, 6),
3390 F_GFX2D( 76800000, pll8, 1, 5),
3391 F_GFX2D( 96000000, pll8, 1, 4),
3392 F_GFX2D(128000000, pll8, 1, 3),
3393 F_GFX2D(145455000, pll2, 2, 11),
3394 F_GFX2D(160000000, pll2, 1, 5),
3395 F_GFX2D(177778000, pll2, 2, 9),
3396 F_GFX2D(200000000, pll2, 1, 4),
3397 F_GFX2D(228571000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003398 F_END
3399};
3400
3401static struct bank_masks bmnd_info_gfx2d0 = {
3402 .bank_sel_mask = BIT(11),
3403 .bank0_mask = {
3404 .md_reg = GFX2D0_MD0_REG,
3405 .ns_mask = BM(23, 20) | BM(5, 3),
3406 .rst_mask = BIT(25),
3407 .mnd_en_mask = BIT(8),
3408 .mode_mask = BM(10, 9),
3409 },
3410 .bank1_mask = {
3411 .md_reg = GFX2D0_MD1_REG,
3412 .ns_mask = BM(19, 16) | BM(2, 0),
3413 .rst_mask = BIT(24),
3414 .mnd_en_mask = BIT(5),
3415 .mode_mask = BM(7, 6),
3416 },
3417};
3418
3419static struct rcg_clk gfx2d0_clk = {
3420 .b = {
3421 .ctl_reg = GFX2D0_CC_REG,
3422 .en_mask = BIT(0),
3423 .reset_reg = SW_RESET_CORE_REG,
3424 .reset_mask = BIT(14),
3425 .halt_reg = DBG_BUS_VEC_A_REG,
3426 .halt_bit = 9,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003427 .retain_reg = GFX2D0_CC_REG,
3428 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003429 },
3430 .ns_reg = GFX2D0_NS_REG,
3431 .root_en_mask = BIT(2),
3432 .set_rate = set_rate_mnd_banked,
3433 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003434 .bank_info = &bmnd_info_gfx2d0,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003435 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003436 .c = {
3437 .dbg_name = "gfx2d0_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003438 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003439 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003440 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3441 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003442 CLK_INIT(gfx2d0_clk.c),
3443 },
3444};
3445
3446static struct bank_masks bmnd_info_gfx2d1 = {
3447 .bank_sel_mask = BIT(11),
3448 .bank0_mask = {
3449 .md_reg = GFX2D1_MD0_REG,
3450 .ns_mask = BM(23, 20) | BM(5, 3),
3451 .rst_mask = BIT(25),
3452 .mnd_en_mask = BIT(8),
3453 .mode_mask = BM(10, 9),
3454 },
3455 .bank1_mask = {
3456 .md_reg = GFX2D1_MD1_REG,
3457 .ns_mask = BM(19, 16) | BM(2, 0),
3458 .rst_mask = BIT(24),
3459 .mnd_en_mask = BIT(5),
3460 .mode_mask = BM(7, 6),
3461 },
3462};
3463
3464static struct rcg_clk gfx2d1_clk = {
3465 .b = {
3466 .ctl_reg = GFX2D1_CC_REG,
3467 .en_mask = BIT(0),
3468 .reset_reg = SW_RESET_CORE_REG,
3469 .reset_mask = BIT(13),
3470 .halt_reg = DBG_BUS_VEC_A_REG,
3471 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003472 .retain_reg = GFX2D1_CC_REG,
3473 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003474 },
3475 .ns_reg = GFX2D1_NS_REG,
3476 .root_en_mask = BIT(2),
3477 .set_rate = set_rate_mnd_banked,
3478 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003479 .bank_info = &bmnd_info_gfx2d1,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003480 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003481 .c = {
3482 .dbg_name = "gfx2d1_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003483 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003484 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003485 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3486 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003487 CLK_INIT(gfx2d1_clk.c),
3488 },
3489};
3490
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003491#define F_GFX3D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003492 { \
3493 .freq_hz = f, \
3494 .src_clk = &s##_clk.c, \
3495 .md_val = MD4(4, m, 0, n), \
3496 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3497 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003498 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003499
Patrick Dalye6f489042012-07-11 15:29:15 -07003500static struct clk_freq_tbl clk_tbl_gfx3d_8960ab[] = {
3501 F_GFX3D( 0, gnd, 0, 0),
3502 F_GFX3D( 27000000, pxo, 0, 0),
3503 F_GFX3D( 48000000, pll8, 1, 8),
3504 F_GFX3D( 54857000, pll8, 1, 7),
3505 F_GFX3D( 64000000, pll8, 1, 6),
3506 F_GFX3D( 76800000, pll8, 1, 5),
3507 F_GFX3D( 96000000, pll8, 1, 4),
3508 F_GFX3D(128000000, pll8, 1, 3),
3509 F_GFX3D(145455000, pll2, 2, 11),
3510 F_GFX3D(160000000, pll2, 1, 5),
3511 F_GFX3D(177778000, pll2, 2, 9),
3512 F_GFX3D(200000000, pll2, 1, 4),
3513 F_GFX3D(228571000, pll2, 2, 7),
3514 F_GFX3D(266667000, pll2, 1, 3),
3515 F_GFX3D(320000000, pll2, 2, 5),
3516 F_GFX3D(325000000, pll3, 1, 2),
3517 F_GFX3D(400000000, pll2, 1, 2),
3518 F_END
3519};
3520
Tianyi Gou41515e22011-09-01 19:37:43 -07003521static struct clk_freq_tbl clk_tbl_gfx3d_8960[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003522 F_GFX3D( 0, gnd, 0, 0),
3523 F_GFX3D( 27000000, pxo, 0, 0),
3524 F_GFX3D( 48000000, pll8, 1, 8),
3525 F_GFX3D( 54857000, pll8, 1, 7),
3526 F_GFX3D( 64000000, pll8, 1, 6),
3527 F_GFX3D( 76800000, pll8, 1, 5),
3528 F_GFX3D( 96000000, pll8, 1, 4),
3529 F_GFX3D(128000000, pll8, 1, 3),
3530 F_GFX3D(145455000, pll2, 2, 11),
3531 F_GFX3D(160000000, pll2, 1, 5),
3532 F_GFX3D(177778000, pll2, 2, 9),
3533 F_GFX3D(200000000, pll2, 1, 4),
3534 F_GFX3D(228571000, pll2, 2, 7),
3535 F_GFX3D(266667000, pll2, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003536 F_GFX3D(300000000, pll3, 1, 4),
3537 F_GFX3D(320000000, pll2, 2, 5),
3538 F_GFX3D(400000000, pll2, 1, 2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003539 F_END
3540};
3541
Tianyi Gou41515e22011-09-01 19:37:43 -07003542static struct clk_freq_tbl clk_tbl_gfx3d_8064[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003543 F_GFX3D( 0, gnd, 0, 0),
3544 F_GFX3D( 27000000, pxo, 0, 0),
3545 F_GFX3D( 48000000, pll8, 1, 8),
3546 F_GFX3D( 54857000, pll8, 1, 7),
3547 F_GFX3D( 64000000, pll8, 1, 6),
3548 F_GFX3D( 76800000, pll8, 1, 5),
3549 F_GFX3D( 96000000, pll8, 1, 4),
3550 F_GFX3D(128000000, pll8, 1, 3),
3551 F_GFX3D(145455000, pll2, 2, 11),
3552 F_GFX3D(160000000, pll2, 1, 5),
3553 F_GFX3D(177778000, pll2, 2, 9),
Patrick Dalyb7c777a2012-08-23 19:07:30 -07003554 F_GFX3D(192000000, pll8, 1, 2),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003555 F_GFX3D(200000000, pll2, 1, 4),
3556 F_GFX3D(228571000, pll2, 2, 7),
3557 F_GFX3D(266667000, pll2, 1, 3),
3558 F_GFX3D(400000000, pll2, 1, 2),
Patrick Dalyb7c777a2012-08-23 19:07:30 -07003559 F_GFX3D(450000000, pll15, 1, 2),
Tianyi Gou41515e22011-09-01 19:37:43 -07003560 F_END
3561};
3562
Tianyi Goue3d4f542012-03-15 17:06:45 -07003563static struct clk_freq_tbl clk_tbl_gfx3d_8930[] = {
3564 F_GFX3D( 0, gnd, 0, 0),
3565 F_GFX3D( 27000000, pxo, 0, 0),
3566 F_GFX3D( 48000000, pll8, 1, 8),
3567 F_GFX3D( 54857000, pll8, 1, 7),
3568 F_GFX3D( 64000000, pll8, 1, 6),
3569 F_GFX3D( 76800000, pll8, 1, 5),
3570 F_GFX3D( 96000000, pll8, 1, 4),
3571 F_GFX3D(128000000, pll8, 1, 3),
3572 F_GFX3D(145455000, pll2, 2, 11),
3573 F_GFX3D(160000000, pll2, 1, 5),
3574 F_GFX3D(177778000, pll2, 2, 9),
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003575 F_GFX3D(192000000, pll8, 1, 2),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003576 F_GFX3D(200000000, pll2, 1, 4),
3577 F_GFX3D(228571000, pll2, 2, 7),
3578 F_GFX3D(266667000, pll2, 1, 3),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003579 F_GFX3D(320000000, pll2, 2, 5),
3580 F_GFX3D(400000000, pll2, 1, 2),
3581 F_GFX3D(450000000, pll15, 1, 2),
3582 F_END
3583};
3584
Patrick Dalyb7c777a2012-08-23 19:07:30 -07003585static unsigned long fmax_gfx3d_8064ab[MAX_VDD_LEVELS] __initdata = {
3586 [VDD_DIG_LOW] = 128000000,
3587 [VDD_DIG_NOMINAL] = 325000000,
3588 [VDD_DIG_HIGH] = 450000000
3589};
3590
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003591static unsigned long fmax_gfx3d_8064[MAX_VDD_LEVELS] __initdata = {
3592 [VDD_DIG_LOW] = 128000000,
3593 [VDD_DIG_NOMINAL] = 325000000,
3594 [VDD_DIG_HIGH] = 400000000
3595};
3596
Tianyi Goue3d4f542012-03-15 17:06:45 -07003597static unsigned long fmax_gfx3d_8930[MAX_VDD_LEVELS] __initdata = {
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003598 [VDD_DIG_LOW] = 192000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003599 [VDD_DIG_NOMINAL] = 320000000,
Patrick Dalyebe63c52012-08-07 15:41:30 -07003600 [VDD_DIG_HIGH] = 400000000
3601};
3602
3603static unsigned long fmax_gfx3d_8930aa[MAX_VDD_LEVELS] __initdata = {
3604 [VDD_DIG_LOW] = 192000000,
3605 [VDD_DIG_NOMINAL] = 320000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003606 [VDD_DIG_HIGH] = 450000000
3607};
3608
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003609static struct bank_masks bmnd_info_gfx3d = {
3610 .bank_sel_mask = BIT(11),
3611 .bank0_mask = {
3612 .md_reg = GFX3D_MD0_REG,
3613 .ns_mask = BM(21, 18) | BM(5, 3),
3614 .rst_mask = BIT(23),
3615 .mnd_en_mask = BIT(8),
3616 .mode_mask = BM(10, 9),
3617 },
3618 .bank1_mask = {
3619 .md_reg = GFX3D_MD1_REG,
3620 .ns_mask = BM(17, 14) | BM(2, 0),
3621 .rst_mask = BIT(22),
3622 .mnd_en_mask = BIT(5),
3623 .mode_mask = BM(7, 6),
3624 },
3625};
3626
3627static struct rcg_clk gfx3d_clk = {
3628 .b = {
3629 .ctl_reg = GFX3D_CC_REG,
3630 .en_mask = BIT(0),
3631 .reset_reg = SW_RESET_CORE_REG,
3632 .reset_mask = BIT(12),
3633 .halt_reg = DBG_BUS_VEC_A_REG,
3634 .halt_bit = 4,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003635 .retain_reg = GFX3D_CC_REG,
3636 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003637 },
3638 .ns_reg = GFX3D_NS_REG,
3639 .root_en_mask = BIT(2),
3640 .set_rate = set_rate_mnd_banked,
Tianyi Gou41515e22011-09-01 19:37:43 -07003641 .freq_tbl = clk_tbl_gfx3d_8960,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003642 .bank_info = &bmnd_info_gfx3d,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003643 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003644 .c = {
3645 .dbg_name = "gfx3d_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003646 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003647 VDD_DIG_FMAX_MAP3(LOW, 128000000, NOMINAL, 300000000,
3648 HIGH, 400000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003649 CLK_INIT(gfx3d_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003650 .depends = &gmem_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003651 },
3652};
3653
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003654#define F_VCAP(f, s, m, n) \
Tianyi Gou621f8742011-09-01 21:45:01 -07003655 { \
3656 .freq_hz = f, \
3657 .src_clk = &s##_clk.c, \
3658 .md_val = MD4(4, m, 0, n), \
3659 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3660 .ctl_val = CC_BANKED(9, 6, n), \
Tianyi Gou621f8742011-09-01 21:45:01 -07003661 }
3662
3663static struct clk_freq_tbl clk_tbl_vcap[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003664 F_VCAP( 0, gnd, 0, 0),
3665 F_VCAP( 27000000, pxo, 0, 0),
3666 F_VCAP( 54860000, pll8, 1, 7),
3667 F_VCAP( 64000000, pll8, 1, 6),
3668 F_VCAP( 76800000, pll8, 1, 5),
3669 F_VCAP(128000000, pll8, 1, 3),
3670 F_VCAP(160000000, pll2, 1, 5),
3671 F_VCAP(200000000, pll2, 1, 4),
Tianyi Gou621f8742011-09-01 21:45:01 -07003672 F_END
3673};
3674
3675static struct bank_masks bmnd_info_vcap = {
3676 .bank_sel_mask = BIT(11),
3677 .bank0_mask = {
3678 .md_reg = VCAP_MD0_REG,
3679 .ns_mask = BM(21, 18) | BM(5, 3),
3680 .rst_mask = BIT(23),
3681 .mnd_en_mask = BIT(8),
3682 .mode_mask = BM(10, 9),
3683 },
3684 .bank1_mask = {
3685 .md_reg = VCAP_MD1_REG,
3686 .ns_mask = BM(17, 14) | BM(2, 0),
3687 .rst_mask = BIT(22),
3688 .mnd_en_mask = BIT(5),
3689 .mode_mask = BM(7, 6),
3690 },
3691};
3692
3693static struct rcg_clk vcap_clk = {
3694 .b = {
3695 .ctl_reg = VCAP_CC_REG,
3696 .en_mask = BIT(0),
3697 .halt_reg = DBG_BUS_VEC_J_REG,
3698 .halt_bit = 15,
3699 },
3700 .ns_reg = VCAP_NS_REG,
3701 .root_en_mask = BIT(2),
3702 .set_rate = set_rate_mnd_banked,
3703 .freq_tbl = clk_tbl_vcap,
3704 .bank_info = &bmnd_info_vcap,
3705 .current_freq = &rcg_dummy_freq,
3706 .c = {
3707 .dbg_name = "vcap_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003708 .ops = &clk_ops_rcg,
Tianyi Gou621f8742011-09-01 21:45:01 -07003709 .depends = &vcap_axi_clk.c,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003710 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
Tianyi Gou621f8742011-09-01 21:45:01 -07003711 CLK_INIT(vcap_clk.c),
3712 },
3713};
3714
3715static struct branch_clk vcap_npl_clk = {
3716 .b = {
3717 .ctl_reg = VCAP_CC_REG,
3718 .en_mask = BIT(13),
3719 .halt_reg = DBG_BUS_VEC_J_REG,
3720 .halt_bit = 25,
3721 },
3722 .parent = &vcap_clk.c,
3723 .c = {
3724 .dbg_name = "vcap_npl_clk",
3725 .ops = &clk_ops_branch,
3726 CLK_INIT(vcap_npl_clk.c),
3727 },
3728};
3729
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003730#define F_IJPEG(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003731 { \
3732 .freq_hz = f, \
3733 .src_clk = &s##_clk.c, \
3734 .md_val = MD8(8, m, 0, n), \
3735 .ns_val = NS_MM(23, 16, n, m, 15, 12, d, 2, 0, s##_to_mm_mux), \
3736 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003737 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003738
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003739static struct clk_freq_tbl clk_tbl_ijpeg[] = {
3740 F_IJPEG( 0, gnd, 1, 0, 0),
3741 F_IJPEG( 27000000, pxo, 1, 0, 0),
3742 F_IJPEG( 36570000, pll8, 1, 2, 21),
3743 F_IJPEG( 54860000, pll8, 7, 0, 0),
3744 F_IJPEG( 96000000, pll8, 4, 0, 0),
3745 F_IJPEG(109710000, pll8, 1, 2, 7),
3746 F_IJPEG(128000000, pll8, 3, 0, 0),
3747 F_IJPEG(153600000, pll8, 1, 2, 5),
3748 F_IJPEG(200000000, pll2, 4, 0, 0),
3749 F_IJPEG(228571000, pll2, 1, 2, 7),
3750 F_IJPEG(266667000, pll2, 1, 1, 3),
3751 F_IJPEG(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003752 F_END
3753};
3754
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003755static unsigned long fmax_ijpeg_8064[MAX_VDD_LEVELS] __initdata = {
3756 [VDD_DIG_LOW] = 128000000,
3757 [VDD_DIG_NOMINAL] = 266667000,
3758 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07003759};
3760
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003761static struct rcg_clk ijpeg_clk = {
3762 .b = {
3763 .ctl_reg = IJPEG_CC_REG,
3764 .en_mask = BIT(0),
3765 .reset_reg = SW_RESET_CORE_REG,
3766 .reset_mask = BIT(9),
3767 .halt_reg = DBG_BUS_VEC_A_REG,
3768 .halt_bit = 24,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003769 .retain_reg = IJPEG_CC_REG,
3770 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003771 },
3772 .ns_reg = IJPEG_NS_REG,
3773 .md_reg = IJPEG_MD_REG,
3774 .root_en_mask = BIT(2),
3775 .ns_mask = (BM(23, 16) | BM(15, 12) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003776 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003777 .ctl_mask = BM(7, 6),
3778 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003779 .freq_tbl = clk_tbl_ijpeg,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003780 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003781 .c = {
3782 .dbg_name = "ijpeg_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003783 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003784 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
3785 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003786 CLK_INIT(ijpeg_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003787 .depends = &ijpeg_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003788 },
3789};
3790
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003791#define F_JPEGD(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003792 { \
3793 .freq_hz = f, \
3794 .src_clk = &s##_clk.c, \
3795 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003796 }
3797static struct clk_freq_tbl clk_tbl_jpegd[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003798 F_JPEGD( 0, gnd, 1),
3799 F_JPEGD( 64000000, pll8, 6),
3800 F_JPEGD( 76800000, pll8, 5),
3801 F_JPEGD( 96000000, pll8, 4),
3802 F_JPEGD(160000000, pll2, 5),
3803 F_JPEGD(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003804 F_END
3805};
3806
3807static struct rcg_clk jpegd_clk = {
3808 .b = {
3809 .ctl_reg = JPEGD_CC_REG,
3810 .en_mask = BIT(0),
3811 .reset_reg = SW_RESET_CORE_REG,
3812 .reset_mask = BIT(19),
3813 .halt_reg = DBG_BUS_VEC_A_REG,
3814 .halt_bit = 19,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003815 .retain_reg = JPEGD_CC_REG,
3816 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003817 },
3818 .ns_reg = JPEGD_NS_REG,
3819 .root_en_mask = BIT(2),
3820 .ns_mask = (BM(15, 12) | BM(2, 0)),
3821 .set_rate = set_rate_nop,
3822 .freq_tbl = clk_tbl_jpegd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003823 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003824 .c = {
3825 .dbg_name = "jpegd_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003826 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003827 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003828 CLK_INIT(jpegd_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003829 .depends = &jpegd_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003830 },
3831};
3832
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003833#define F_MDP(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003834 { \
3835 .freq_hz = f, \
3836 .src_clk = &s##_clk.c, \
3837 .md_val = MD8(8, m, 0, n), \
3838 .ns_val = NS_MND_BANKED8(22, 14, n, m, 3, 0, s##_to_mm_mux), \
3839 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003840 }
Patrick Dalye6f489042012-07-11 15:29:15 -07003841static struct clk_freq_tbl clk_tbl_mdp_8960ab[] = {
3842 F_MDP( 0, gnd, 0, 0),
3843 F_MDP( 9600000, pll8, 1, 40),
3844 F_MDP( 13710000, pll8, 1, 28),
3845 F_MDP( 27000000, pxo, 0, 0),
3846 F_MDP( 29540000, pll8, 1, 13),
3847 F_MDP( 34910000, pll8, 1, 11),
3848 F_MDP( 38400000, pll8, 1, 10),
3849 F_MDP( 59080000, pll8, 2, 13),
3850 F_MDP( 76800000, pll8, 1, 5),
3851 F_MDP( 85330000, pll8, 2, 9),
3852 F_MDP( 96000000, pll8, 1, 4),
3853 F_MDP(128000000, pll8, 1, 3),
3854 F_MDP(160000000, pll2, 1, 5),
3855 F_MDP(177780000, pll2, 2, 9),
3856 F_MDP(200000000, pll2, 1, 4),
3857 F_MDP(228571000, pll2, 2, 7),
3858 F_MDP(266667000, pll2, 1, 3),
3859 F_END
3860};
3861
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003862static struct clk_freq_tbl clk_tbl_mdp[] = {
3863 F_MDP( 0, gnd, 0, 0),
3864 F_MDP( 9600000, pll8, 1, 40),
3865 F_MDP( 13710000, pll8, 1, 28),
3866 F_MDP( 27000000, pxo, 0, 0),
3867 F_MDP( 29540000, pll8, 1, 13),
3868 F_MDP( 34910000, pll8, 1, 11),
3869 F_MDP( 38400000, pll8, 1, 10),
3870 F_MDP( 59080000, pll8, 2, 13),
3871 F_MDP( 76800000, pll8, 1, 5),
3872 F_MDP( 85330000, pll8, 2, 9),
3873 F_MDP( 96000000, pll8, 1, 4),
3874 F_MDP(128000000, pll8, 1, 3),
3875 F_MDP(160000000, pll2, 1, 5),
3876 F_MDP(177780000, pll2, 2, 9),
3877 F_MDP(200000000, pll2, 1, 4),
3878 F_MDP(266667000, pll2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003879 F_END
3880};
3881
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003882static unsigned long fmax_mdp_8064[MAX_VDD_LEVELS] __initdata = {
3883 [VDD_DIG_LOW] = 128000000,
3884 [VDD_DIG_NOMINAL] = 266667000
Tianyi Gou621f8742011-09-01 21:45:01 -07003885};
3886
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003887static struct bank_masks bmnd_info_mdp = {
3888 .bank_sel_mask = BIT(11),
3889 .bank0_mask = {
3890 .md_reg = MDP_MD0_REG,
3891 .ns_mask = BM(29, 22) | BM(5, 3),
3892 .rst_mask = BIT(31),
3893 .mnd_en_mask = BIT(8),
3894 .mode_mask = BM(10, 9),
3895 },
3896 .bank1_mask = {
3897 .md_reg = MDP_MD1_REG,
3898 .ns_mask = BM(21, 14) | BM(2, 0),
3899 .rst_mask = BIT(30),
3900 .mnd_en_mask = BIT(5),
3901 .mode_mask = BM(7, 6),
3902 },
3903};
3904
3905static struct rcg_clk mdp_clk = {
3906 .b = {
3907 .ctl_reg = MDP_CC_REG,
3908 .en_mask = BIT(0),
3909 .reset_reg = SW_RESET_CORE_REG,
3910 .reset_mask = BIT(21),
3911 .halt_reg = DBG_BUS_VEC_C_REG,
3912 .halt_bit = 10,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003913 .retain_reg = MDP_CC_REG,
3914 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003915 },
3916 .ns_reg = MDP_NS_REG,
3917 .root_en_mask = BIT(2),
3918 .set_rate = set_rate_mnd_banked,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003919 .freq_tbl = clk_tbl_mdp,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003920 .bank_info = &bmnd_info_mdp,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003921 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003922 .c = {
3923 .dbg_name = "mdp_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003924 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003925 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003926 CLK_INIT(mdp_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003927 .depends = &mdp_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003928 },
3929};
3930
3931static struct branch_clk lut_mdp_clk = {
3932 .b = {
3933 .ctl_reg = MDP_LUT_CC_REG,
3934 .en_mask = BIT(0),
3935 .halt_reg = DBG_BUS_VEC_I_REG,
3936 .halt_bit = 13,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003937 .retain_reg = MDP_LUT_CC_REG,
3938 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003939 },
3940 .parent = &mdp_clk.c,
3941 .c = {
3942 .dbg_name = "lut_mdp_clk",
3943 .ops = &clk_ops_branch,
3944 CLK_INIT(lut_mdp_clk.c),
3945 },
3946};
3947
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003948#define F_MDP_VSYNC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003949 { \
3950 .freq_hz = f, \
3951 .src_clk = &s##_clk.c, \
3952 .ns_val = NS_SRC_SEL(13, 13, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003953 }
3954static struct clk_freq_tbl clk_tbl_mdp_vsync[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003955 F_MDP_VSYNC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003956 F_END
3957};
3958
3959static struct rcg_clk mdp_vsync_clk = {
3960 .b = {
3961 .ctl_reg = MISC_CC_REG,
3962 .en_mask = BIT(6),
3963 .reset_reg = SW_RESET_CORE_REG,
3964 .reset_mask = BIT(3),
3965 .halt_reg = DBG_BUS_VEC_B_REG,
3966 .halt_bit = 22,
3967 },
3968 .ns_reg = MISC_CC2_REG,
3969 .ns_mask = BIT(13),
3970 .set_rate = set_rate_nop,
3971 .freq_tbl = clk_tbl_mdp_vsync,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003972 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003973 .c = {
3974 .dbg_name = "mdp_vsync_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003975 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003976 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003977 CLK_INIT(mdp_vsync_clk.c),
3978 },
3979};
3980
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003981#define F_ROT(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003982 { \
3983 .freq_hz = f, \
3984 .src_clk = &s##_clk.c, \
3985 .ns_val = NS_DIVSRC_BANKED(29, 26, 25, 22, d, \
3986 21, 19, 18, 16, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003987 }
3988static struct clk_freq_tbl clk_tbl_rot[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003989 F_ROT( 0, gnd, 1),
3990 F_ROT( 27000000, pxo, 1),
3991 F_ROT( 29540000, pll8, 13),
3992 F_ROT( 32000000, pll8, 12),
3993 F_ROT( 38400000, pll8, 10),
3994 F_ROT( 48000000, pll8, 8),
3995 F_ROT( 54860000, pll8, 7),
3996 F_ROT( 64000000, pll8, 6),
3997 F_ROT( 76800000, pll8, 5),
3998 F_ROT( 96000000, pll8, 4),
3999 F_ROT(100000000, pll2, 8),
4000 F_ROT(114290000, pll2, 7),
4001 F_ROT(133330000, pll2, 6),
4002 F_ROT(160000000, pll2, 5),
4003 F_ROT(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004004 F_END
4005};
4006
4007static struct bank_masks bdiv_info_rot = {
4008 .bank_sel_mask = BIT(30),
4009 .bank0_mask = {
4010 .ns_mask = BM(25, 22) | BM(18, 16),
4011 },
4012 .bank1_mask = {
4013 .ns_mask = BM(29, 26) | BM(21, 19),
4014 },
4015};
4016
4017static struct rcg_clk rot_clk = {
4018 .b = {
4019 .ctl_reg = ROT_CC_REG,
4020 .en_mask = BIT(0),
4021 .reset_reg = SW_RESET_CORE_REG,
4022 .reset_mask = BIT(2),
4023 .halt_reg = DBG_BUS_VEC_C_REG,
4024 .halt_bit = 15,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004025 .retain_reg = ROT_CC_REG,
4026 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004027 },
4028 .ns_reg = ROT_NS_REG,
4029 .root_en_mask = BIT(2),
4030 .set_rate = set_rate_div_banked,
4031 .freq_tbl = clk_tbl_rot,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004032 .bank_info = &bdiv_info_rot,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004033 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004034 .c = {
4035 .dbg_name = "rot_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004036 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004037 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004038 CLK_INIT(rot_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004039 .depends = &rot_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004040 },
4041};
4042
Matt Wagantallf82f2942012-01-27 13:56:13 -08004043static int hdmi_pll_clk_enable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004044{
4045 int ret;
4046 unsigned long flags;
4047 spin_lock_irqsave(&local_clock_reg_lock, flags);
4048 ret = hdmi_pll_enable();
4049 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4050 return ret;
4051}
4052
Matt Wagantallf82f2942012-01-27 13:56:13 -08004053static void hdmi_pll_clk_disable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004054{
4055 unsigned long flags;
4056 spin_lock_irqsave(&local_clock_reg_lock, flags);
4057 hdmi_pll_disable();
4058 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4059}
4060
Matt Wagantallf82f2942012-01-27 13:56:13 -08004061static struct clk *hdmi_pll_clk_get_parent(struct clk *c)
Stephen Boyd5b35dee2011-09-21 12:17:38 -07004062{
4063 return &pxo_clk.c;
4064}
4065
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004066static struct clk_ops clk_ops_hdmi_pll = {
4067 .enable = hdmi_pll_clk_enable,
4068 .disable = hdmi_pll_clk_disable,
Stephen Boyd5b35dee2011-09-21 12:17:38 -07004069 .get_parent = hdmi_pll_clk_get_parent,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004070};
4071
4072static struct clk hdmi_pll_clk = {
4073 .dbg_name = "hdmi_pll_clk",
4074 .ops = &clk_ops_hdmi_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -07004075 .vdd_class = &vdd_sr2_hdmi_pll,
4076 .fmax[VDD_SR2_HDMI_PLL_ON] = ULONG_MAX,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004077 CLK_INIT(hdmi_pll_clk),
4078};
4079
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004080#define F_TV_GND(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004081 { \
4082 .freq_hz = f, \
4083 .src_clk = &s##_clk.c, \
4084 .md_val = MD8(8, m, 0, n), \
4085 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
4086 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004087 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004088#define F_TV(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004089 { \
4090 .freq_hz = f, \
4091 .src_clk = &s##_clk, \
4092 .md_val = MD8(8, m, 0, n), \
4093 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
4094 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004095 .extra_freq_data = (void *)p_r, \
4096 }
4097/* Switching TV freqs requires PLL reconfiguration. */
4098static struct clk_freq_tbl clk_tbl_tv[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004099 F_TV_GND( 0, gnd, 0, 1, 0, 0),
4100 F_TV( 25200000, hdmi_pll, 25200000, 1, 0, 0),
4101 F_TV( 27000000, hdmi_pll, 27000000, 1, 0, 0),
4102 F_TV( 27030000, hdmi_pll, 27030000, 1, 0, 0),
4103 F_TV( 74250000, hdmi_pll, 74250000, 1, 0, 0),
4104 F_TV(148500000, hdmi_pll, 148500000, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004105 F_END
4106};
4107
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004108static unsigned long fmax_tv_src_8064[MAX_VDD_LEVELS] __initdata = {
4109 [VDD_DIG_LOW] = 74250000,
4110 [VDD_DIG_NOMINAL] = 149000000
4111};
4112
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004113/*
4114 * Unlike other clocks, the TV rate is adjusted through PLL
4115 * re-programming. It is also routed through an MND divider.
4116 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08004117void set_rate_tv(struct rcg_clk *rcg, struct clk_freq_tbl *nf)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004118{
4119 unsigned long pll_rate = (unsigned long)nf->extra_freq_data;
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004120 if (pll_rate) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004121 hdmi_pll_set_rate(pll_rate);
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004122 hdmi_pll_clk.rate = pll_rate;
4123 }
Matt Wagantallf82f2942012-01-27 13:56:13 -08004124 set_rate_mnd(rcg, nf);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004125}
4126
4127static struct rcg_clk tv_src_clk = {
4128 .ns_reg = TV_NS_REG,
4129 .b = {
4130 .ctl_reg = TV_CC_REG,
4131 .halt_check = NOCHECK,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004132 .retain_reg = TV_CC_REG,
4133 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004134 },
4135 .md_reg = TV_MD_REG,
4136 .root_en_mask = BIT(2),
4137 .ns_mask = (BM(23, 16) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004138 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004139 .ctl_mask = BM(7, 6),
4140 .set_rate = set_rate_tv,
4141 .freq_tbl = clk_tbl_tv,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004142 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004143 .c = {
4144 .dbg_name = "tv_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004145 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004146 VDD_DIG_FMAX_MAP2(LOW, 27030000, NOMINAL, 149000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004147 CLK_INIT(tv_src_clk.c),
4148 },
4149};
4150
Tianyi Gou51918802012-01-26 14:05:43 -08004151static struct cdiv_clk tv_src_div_clk = {
4152 .b = {
4153 .ctl_reg = TV_NS_REG,
4154 .halt_check = NOCHECK,
4155 },
4156 .ns_reg = TV_NS_REG,
4157 .div_offset = 6,
4158 .max_div = 2,
4159 .c = {
4160 .dbg_name = "tv_src_div_clk",
4161 .ops = &clk_ops_cdiv,
4162 CLK_INIT(tv_src_div_clk.c),
Stephen Boydd51d5e82012-06-18 18:09:50 -07004163 .rate = ULONG_MAX,
Tianyi Gou51918802012-01-26 14:05:43 -08004164 },
4165};
4166
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004167static struct branch_clk tv_enc_clk = {
4168 .b = {
4169 .ctl_reg = TV_CC_REG,
4170 .en_mask = BIT(8),
4171 .reset_reg = SW_RESET_CORE_REG,
4172 .reset_mask = BIT(0),
4173 .halt_reg = DBG_BUS_VEC_D_REG,
4174 .halt_bit = 9,
4175 },
4176 .parent = &tv_src_clk.c,
4177 .c = {
4178 .dbg_name = "tv_enc_clk",
4179 .ops = &clk_ops_branch,
4180 CLK_INIT(tv_enc_clk.c),
4181 },
4182};
4183
4184static struct branch_clk tv_dac_clk = {
4185 .b = {
4186 .ctl_reg = TV_CC_REG,
4187 .en_mask = BIT(10),
4188 .halt_reg = DBG_BUS_VEC_D_REG,
4189 .halt_bit = 10,
4190 },
4191 .parent = &tv_src_clk.c,
4192 .c = {
4193 .dbg_name = "tv_dac_clk",
4194 .ops = &clk_ops_branch,
4195 CLK_INIT(tv_dac_clk.c),
4196 },
4197};
4198
4199static struct branch_clk mdp_tv_clk = {
4200 .b = {
4201 .ctl_reg = TV_CC_REG,
4202 .en_mask = BIT(0),
4203 .reset_reg = SW_RESET_CORE_REG,
4204 .reset_mask = BIT(4),
4205 .halt_reg = DBG_BUS_VEC_D_REG,
4206 .halt_bit = 12,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004207 .retain_reg = TV_CC2_REG,
4208 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004209 },
4210 .parent = &tv_src_clk.c,
4211 .c = {
4212 .dbg_name = "mdp_tv_clk",
4213 .ops = &clk_ops_branch,
4214 CLK_INIT(mdp_tv_clk.c),
4215 },
4216};
4217
4218static struct branch_clk hdmi_tv_clk = {
4219 .b = {
4220 .ctl_reg = TV_CC_REG,
4221 .en_mask = BIT(12),
4222 .reset_reg = SW_RESET_CORE_REG,
4223 .reset_mask = BIT(1),
4224 .halt_reg = DBG_BUS_VEC_D_REG,
4225 .halt_bit = 11,
4226 },
4227 .parent = &tv_src_clk.c,
4228 .c = {
4229 .dbg_name = "hdmi_tv_clk",
4230 .ops = &clk_ops_branch,
4231 CLK_INIT(hdmi_tv_clk.c),
4232 },
4233};
4234
Tianyi Gou51918802012-01-26 14:05:43 -08004235static struct branch_clk rgb_tv_clk = {
4236 .b = {
4237 .ctl_reg = TV_CC2_REG,
4238 .en_mask = BIT(14),
4239 .halt_reg = DBG_BUS_VEC_J_REG,
4240 .halt_bit = 27,
4241 },
4242 .parent = &tv_src_clk.c,
4243 .c = {
4244 .dbg_name = "rgb_tv_clk",
4245 .ops = &clk_ops_branch,
4246 CLK_INIT(rgb_tv_clk.c),
4247 },
4248};
4249
4250static struct branch_clk npl_tv_clk = {
4251 .b = {
4252 .ctl_reg = TV_CC2_REG,
4253 .en_mask = BIT(16),
4254 .halt_reg = DBG_BUS_VEC_J_REG,
4255 .halt_bit = 26,
4256 },
4257 .parent = &tv_src_clk.c,
4258 .c = {
4259 .dbg_name = "npl_tv_clk",
4260 .ops = &clk_ops_branch,
4261 CLK_INIT(npl_tv_clk.c),
4262 },
4263};
4264
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004265static struct branch_clk hdmi_app_clk = {
4266 .b = {
4267 .ctl_reg = MISC_CC2_REG,
4268 .en_mask = BIT(11),
4269 .reset_reg = SW_RESET_CORE_REG,
4270 .reset_mask = BIT(11),
4271 .halt_reg = DBG_BUS_VEC_B_REG,
4272 .halt_bit = 25,
4273 },
4274 .c = {
4275 .dbg_name = "hdmi_app_clk",
4276 .ops = &clk_ops_branch,
4277 CLK_INIT(hdmi_app_clk.c),
4278 },
4279};
4280
4281static struct bank_masks bmnd_info_vcodec = {
4282 .bank_sel_mask = BIT(13),
4283 .bank0_mask = {
4284 .md_reg = VCODEC_MD0_REG,
4285 .ns_mask = BM(18, 11) | BM(2, 0),
4286 .rst_mask = BIT(31),
4287 .mnd_en_mask = BIT(5),
4288 .mode_mask = BM(7, 6),
4289 },
4290 .bank1_mask = {
4291 .md_reg = VCODEC_MD1_REG,
4292 .ns_mask = BM(26, 19) | BM(29, 27),
4293 .rst_mask = BIT(30),
4294 .mnd_en_mask = BIT(10),
4295 .mode_mask = BM(12, 11),
4296 },
4297};
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004298#define F_VCODEC(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004299 { \
4300 .freq_hz = f, \
4301 .src_clk = &s##_clk.c, \
4302 .md_val = MD8(8, m, 0, n), \
4303 .ns_val = NS_MND_BANKED8(11, 19, n, m, 0, 27, s##_to_mm_mux), \
4304 .ctl_val = CC_BANKED(6, 11, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004305 }
4306static struct clk_freq_tbl clk_tbl_vcodec[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004307 F_VCODEC( 0, gnd, 0, 0),
4308 F_VCODEC( 27000000, pxo, 0, 0),
4309 F_VCODEC( 32000000, pll8, 1, 12),
4310 F_VCODEC( 48000000, pll8, 1, 8),
4311 F_VCODEC( 54860000, pll8, 1, 7),
4312 F_VCODEC( 96000000, pll8, 1, 4),
4313 F_VCODEC(133330000, pll2, 1, 6),
4314 F_VCODEC(200000000, pll2, 1, 4),
4315 F_VCODEC(228570000, pll2, 2, 7),
Patrick Dalyb7c777a2012-08-23 19:07:30 -07004316 F_VCODEC(266670000, pll2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004317 F_END
4318};
4319
4320static struct rcg_clk vcodec_clk = {
4321 .b = {
4322 .ctl_reg = VCODEC_CC_REG,
4323 .en_mask = BIT(0),
4324 .reset_reg = SW_RESET_CORE_REG,
4325 .reset_mask = BIT(6),
4326 .halt_reg = DBG_BUS_VEC_C_REG,
4327 .halt_bit = 29,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004328 .retain_reg = VCODEC_CC_REG,
4329 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004330 },
4331 .ns_reg = VCODEC_NS_REG,
4332 .root_en_mask = BIT(2),
4333 .set_rate = set_rate_mnd_banked,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004334 .bank_info = &bmnd_info_vcodec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004335 .freq_tbl = clk_tbl_vcodec,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004336 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004337 .c = {
4338 .dbg_name = "vcodec_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004339 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004340 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
4341 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004342 CLK_INIT(vcodec_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004343 .depends = &vcodec_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004344 },
4345};
4346
Patrick Dalyb7c777a2012-08-23 19:07:30 -07004347static unsigned long fmax_vcodec_8064v2[MAX_VDD_LEVELS] __initdata = {
4348 [VDD_DIG_LOW] = 100000000,
4349 [VDD_DIG_NOMINAL] = 200000000,
4350 [VDD_DIG_HIGH] = 266670000,
4351};
4352
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004353#define F_VPE(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004354 { \
4355 .freq_hz = f, \
4356 .src_clk = &s##_clk.c, \
4357 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004358 }
4359static struct clk_freq_tbl clk_tbl_vpe[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004360 F_VPE( 0, gnd, 1),
4361 F_VPE( 27000000, pxo, 1),
4362 F_VPE( 34909000, pll8, 11),
4363 F_VPE( 38400000, pll8, 10),
4364 F_VPE( 64000000, pll8, 6),
4365 F_VPE( 76800000, pll8, 5),
4366 F_VPE( 96000000, pll8, 4),
4367 F_VPE(100000000, pll2, 8),
4368 F_VPE(160000000, pll2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004369 F_END
4370};
4371
4372static struct rcg_clk vpe_clk = {
4373 .b = {
4374 .ctl_reg = VPE_CC_REG,
4375 .en_mask = BIT(0),
4376 .reset_reg = SW_RESET_CORE_REG,
4377 .reset_mask = BIT(17),
4378 .halt_reg = DBG_BUS_VEC_A_REG,
4379 .halt_bit = 28,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004380 .retain_reg = VPE_CC_REG,
4381 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004382 },
4383 .ns_reg = VPE_NS_REG,
4384 .root_en_mask = BIT(2),
4385 .ns_mask = (BM(15, 12) | BM(2, 0)),
4386 .set_rate = set_rate_nop,
4387 .freq_tbl = clk_tbl_vpe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004388 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004389 .c = {
4390 .dbg_name = "vpe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004391 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004392 VDD_DIG_FMAX_MAP2(LOW, 76800000, NOMINAL, 160000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004393 CLK_INIT(vpe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004394 .depends = &vpe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004395 },
4396};
4397
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004398#define F_VFE(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004399 { \
4400 .freq_hz = f, \
4401 .src_clk = &s##_clk.c, \
4402 .md_val = MD8(8, m, 0, n), \
4403 .ns_val = NS_MM(23, 16, n, m, 11, 10, d, 2, 0, s##_to_mm_mux), \
4404 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004405 }
Tianyi Gou41515e22011-09-01 19:37:43 -07004406
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004407static struct clk_freq_tbl clk_tbl_vfe[] = {
4408 F_VFE( 0, gnd, 1, 0, 0),
4409 F_VFE( 13960000, pll8, 1, 2, 55),
4410 F_VFE( 27000000, pxo, 1, 0, 0),
4411 F_VFE( 36570000, pll8, 1, 2, 21),
4412 F_VFE( 38400000, pll8, 2, 1, 5),
4413 F_VFE( 45180000, pll8, 1, 2, 17),
4414 F_VFE( 48000000, pll8, 2, 1, 4),
4415 F_VFE( 54860000, pll8, 1, 1, 7),
4416 F_VFE( 64000000, pll8, 2, 1, 3),
4417 F_VFE( 76800000, pll8, 1, 1, 5),
4418 F_VFE( 96000000, pll8, 2, 1, 2),
4419 F_VFE(109710000, pll8, 1, 2, 7),
4420 F_VFE(128000000, pll8, 1, 1, 3),
4421 F_VFE(153600000, pll8, 1, 2, 5),
4422 F_VFE(200000000, pll2, 2, 1, 2),
4423 F_VFE(228570000, pll2, 1, 2, 7),
4424 F_VFE(266667000, pll2, 1, 1, 3),
4425 F_VFE(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004426 F_END
4427};
4428
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004429static unsigned long fmax_vfe_8064[MAX_VDD_LEVELS] __initdata = {
4430 [VDD_DIG_LOW] = 128000000,
4431 [VDD_DIG_NOMINAL] = 266667000,
4432 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07004433};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004434
4435static struct rcg_clk vfe_clk = {
4436 .b = {
4437 .ctl_reg = VFE_CC_REG,
4438 .reset_reg = SW_RESET_CORE_REG,
4439 .reset_mask = BIT(15),
4440 .halt_reg = DBG_BUS_VEC_B_REG,
4441 .halt_bit = 6,
4442 .en_mask = BIT(0),
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004443 .retain_reg = VFE_CC2_REG,
4444 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004445 },
4446 .ns_reg = VFE_NS_REG,
4447 .md_reg = VFE_MD_REG,
4448 .root_en_mask = BIT(2),
4449 .ns_mask = (BM(23, 16) | BM(11, 10) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004450 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004451 .ctl_mask = BM(7, 6),
4452 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004453 .freq_tbl = clk_tbl_vfe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004454 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004455 .c = {
4456 .dbg_name = "vfe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004457 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08004458 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
4459 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004460 CLK_INIT(vfe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004461 .depends = &vfe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004462 },
4463};
4464
Matt Wagantallc23eee92011-08-16 23:06:52 -07004465static struct branch_clk csi_vfe_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004466 .b = {
4467 .ctl_reg = VFE_CC_REG,
4468 .en_mask = BIT(12),
4469 .reset_reg = SW_RESET_CORE_REG,
4470 .reset_mask = BIT(24),
4471 .halt_reg = DBG_BUS_VEC_B_REG,
4472 .halt_bit = 8,
4473 },
4474 .parent = &vfe_clk.c,
4475 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -07004476 .dbg_name = "csi_vfe_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004477 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -07004478 CLK_INIT(csi_vfe_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004479 },
4480};
4481
4482/*
4483 * Low Power Audio Clocks
4484 */
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004485#define F_AIF_OSR(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004486 { \
4487 .freq_hz = f, \
4488 .src_clk = &s##_clk.c, \
4489 .md_val = MD8(8, m, 0, n), \
4490 .ns_val = NS(31, 24, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004491 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004492static struct clk_freq_tbl clk_tbl_aif_osr_492[] = {
4493 F_AIF_OSR( 0, gnd, 1, 0, 0),
4494 F_AIF_OSR( 512000, pll4, 4, 1, 240),
4495 F_AIF_OSR( 768000, pll4, 4, 1, 160),
4496 F_AIF_OSR( 1024000, pll4, 4, 1, 120),
4497 F_AIF_OSR( 1536000, pll4, 4, 1, 80),
4498 F_AIF_OSR( 2048000, pll4, 4, 1, 60),
4499 F_AIF_OSR( 3072000, pll4, 4, 1, 40),
4500 F_AIF_OSR( 4096000, pll4, 4, 1, 30),
4501 F_AIF_OSR( 6144000, pll4, 4, 1, 20),
4502 F_AIF_OSR( 8192000, pll4, 4, 1, 15),
4503 F_AIF_OSR(12288000, pll4, 4, 1, 10),
4504 F_AIF_OSR(24576000, pll4, 4, 1, 5),
4505 F_END
4506};
4507
4508static struct clk_freq_tbl clk_tbl_aif_osr_393[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004509 F_AIF_OSR( 0, gnd, 1, 0, 0),
4510 F_AIF_OSR( 512000, pll4, 4, 1, 192),
4511 F_AIF_OSR( 768000, pll4, 4, 1, 128),
4512 F_AIF_OSR( 1024000, pll4, 4, 1, 96),
4513 F_AIF_OSR( 1536000, pll4, 4, 1, 64),
4514 F_AIF_OSR( 2048000, pll4, 4, 1, 48),
4515 F_AIF_OSR( 3072000, pll4, 4, 1, 32),
4516 F_AIF_OSR( 4096000, pll4, 4, 1, 24),
4517 F_AIF_OSR( 6144000, pll4, 4, 1, 16),
4518 F_AIF_OSR( 8192000, pll4, 4, 1, 12),
4519 F_AIF_OSR(12288000, pll4, 4, 1, 8),
4520 F_AIF_OSR(24576000, pll4, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004521 F_END
4522};
4523
4524#define CLK_AIF_OSR(i, ns, md, h_r) \
4525 struct rcg_clk i##_clk = { \
4526 .b = { \
4527 .ctl_reg = ns, \
4528 .en_mask = BIT(17), \
4529 .reset_reg = ns, \
4530 .reset_mask = BIT(19), \
4531 .halt_reg = h_r, \
4532 .halt_check = ENABLE, \
4533 .halt_bit = 1, \
4534 }, \
4535 .ns_reg = ns, \
4536 .md_reg = md, \
4537 .root_en_mask = BIT(9), \
4538 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004539 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004540 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004541 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004542 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004543 .c = { \
4544 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004545 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004546 VDD_DIG_FMAX_MAP1(LOW, 24576000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004547 CLK_INIT(i##_clk.c), \
4548 }, \
4549 }
4550#define CLK_AIF_OSR_DIV(i, ns, md, h_r) \
4551 struct rcg_clk i##_clk = { \
4552 .b = { \
4553 .ctl_reg = ns, \
4554 .en_mask = BIT(21), \
4555 .reset_reg = ns, \
4556 .reset_mask = BIT(23), \
4557 .halt_reg = h_r, \
4558 .halt_check = ENABLE, \
4559 .halt_bit = 1, \
4560 }, \
4561 .ns_reg = ns, \
4562 .md_reg = md, \
4563 .root_en_mask = BIT(9), \
4564 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004565 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004566 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004567 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004568 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004569 .c = { \
4570 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004571 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004572 VDD_DIG_FMAX_MAP1(LOW, 24576000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004573 CLK_INIT(i##_clk.c), \
4574 }, \
4575 }
4576
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004577#define CLK_AIF_BIT(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004578 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004579 .b = { \
4580 .ctl_reg = ns, \
4581 .en_mask = BIT(15), \
4582 .halt_reg = h_r, \
4583 .halt_check = DELAY, \
4584 }, \
4585 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004586 .ext_mask = BIT(14), \
4587 .div_offset = 10, \
4588 .max_div = 16, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004589 .c = { \
4590 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004591 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004592 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004593 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004594 }, \
4595 }
4596
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004597#define CLK_AIF_BIT_DIV(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004598 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004599 .b = { \
4600 .ctl_reg = ns, \
4601 .en_mask = BIT(19), \
4602 .halt_reg = h_r, \
Stephen Boyd7bb9cf82012-01-25 18:09:01 -08004603 .halt_check = DELAY, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004604 }, \
4605 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004606 .ext_mask = BIT(18), \
4607 .div_offset = 10, \
4608 .max_div = 256, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004609 .c = { \
4610 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004611 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004612 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004613 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004614 }, \
4615 }
4616
4617static CLK_AIF_OSR(mi2s_osr, LCC_MI2S_NS_REG, LCC_MI2S_MD_REG,
4618 LCC_MI2S_STATUS_REG);
4619static CLK_AIF_BIT(mi2s_bit, LCC_MI2S_NS_REG, LCC_MI2S_STATUS_REG);
4620
4621static CLK_AIF_OSR_DIV(codec_i2s_mic_osr, LCC_CODEC_I2S_MIC_NS_REG,
4622 LCC_CODEC_I2S_MIC_MD_REG, LCC_CODEC_I2S_MIC_STATUS_REG);
4623static CLK_AIF_BIT_DIV(codec_i2s_mic_bit, LCC_CODEC_I2S_MIC_NS_REG,
4624 LCC_CODEC_I2S_MIC_STATUS_REG);
4625
4626static CLK_AIF_OSR_DIV(spare_i2s_mic_osr, LCC_SPARE_I2S_MIC_NS_REG,
4627 LCC_SPARE_I2S_MIC_MD_REG, LCC_SPARE_I2S_MIC_STATUS_REG);
4628static CLK_AIF_BIT_DIV(spare_i2s_mic_bit, LCC_SPARE_I2S_MIC_NS_REG,
4629 LCC_SPARE_I2S_MIC_STATUS_REG);
4630
4631static CLK_AIF_OSR_DIV(codec_i2s_spkr_osr, LCC_CODEC_I2S_SPKR_NS_REG,
4632 LCC_CODEC_I2S_SPKR_MD_REG, LCC_CODEC_I2S_SPKR_STATUS_REG);
4633static CLK_AIF_BIT_DIV(codec_i2s_spkr_bit, LCC_CODEC_I2S_SPKR_NS_REG,
4634 LCC_CODEC_I2S_SPKR_STATUS_REG);
4635
4636static CLK_AIF_OSR_DIV(spare_i2s_spkr_osr, LCC_SPARE_I2S_SPKR_NS_REG,
4637 LCC_SPARE_I2S_SPKR_MD_REG, LCC_SPARE_I2S_SPKR_STATUS_REG);
4638static CLK_AIF_BIT_DIV(spare_i2s_spkr_bit, LCC_SPARE_I2S_SPKR_NS_REG,
4639 LCC_SPARE_I2S_SPKR_STATUS_REG);
4640
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004641#define F_PCM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004642 { \
4643 .freq_hz = f, \
4644 .src_clk = &s##_clk.c, \
4645 .md_val = MD16(m, n), \
4646 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004647 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004648static struct clk_freq_tbl clk_tbl_pcm_492[] = {
4649 { .ns_val = BIT(10) /* external input */ },
Stephen Boyde9ed94d2012-08-02 10:57:11 -07004650 F_PCM( 256000, pll4, 4, 1, 480),
Matt Wagantall86e03822011-12-12 10:59:24 -08004651 F_PCM( 512000, pll4, 4, 1, 240),
4652 F_PCM( 768000, pll4, 4, 1, 160),
4653 F_PCM( 1024000, pll4, 4, 1, 120),
4654 F_PCM( 1536000, pll4, 4, 1, 80),
4655 F_PCM( 2048000, pll4, 4, 1, 60),
4656 F_PCM( 3072000, pll4, 4, 1, 40),
4657 F_PCM( 4096000, pll4, 4, 1, 30),
4658 F_PCM( 6144000, pll4, 4, 1, 20),
4659 F_PCM( 8192000, pll4, 4, 1, 15),
4660 F_PCM(12288000, pll4, 4, 1, 10),
4661 F_PCM(24576000, pll4, 4, 1, 5),
4662 F_END
4663};
4664
4665static struct clk_freq_tbl clk_tbl_pcm_393[] = {
Stephen Boyd630f3252012-01-31 00:10:08 -08004666 { .ns_val = BIT(10) /* external input */ },
Stephen Boyde9ed94d2012-08-02 10:57:11 -07004667 F_PCM( 256000, pll4, 4, 1, 384),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004668 F_PCM( 512000, pll4, 4, 1, 192),
4669 F_PCM( 768000, pll4, 4, 1, 128),
4670 F_PCM( 1024000, pll4, 4, 1, 96),
4671 F_PCM( 1536000, pll4, 4, 1, 64),
4672 F_PCM( 2048000, pll4, 4, 1, 48),
4673 F_PCM( 3072000, pll4, 4, 1, 32),
4674 F_PCM( 4096000, pll4, 4, 1, 24),
4675 F_PCM( 6144000, pll4, 4, 1, 16),
4676 F_PCM( 8192000, pll4, 4, 1, 12),
4677 F_PCM(12288000, pll4, 4, 1, 8),
4678 F_PCM(24576000, pll4, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004679 F_END
4680};
4681
4682static struct rcg_clk pcm_clk = {
4683 .b = {
4684 .ctl_reg = LCC_PCM_NS_REG,
4685 .en_mask = BIT(11),
4686 .reset_reg = LCC_PCM_NS_REG,
4687 .reset_mask = BIT(13),
4688 .halt_reg = LCC_PCM_STATUS_REG,
4689 .halt_check = ENABLE,
4690 .halt_bit = 0,
4691 },
4692 .ns_reg = LCC_PCM_NS_REG,
4693 .md_reg = LCC_PCM_MD_REG,
4694 .root_en_mask = BIT(9),
Stephen Boyd630f3252012-01-31 00:10:08 -08004695 .ns_mask = BM(31, 16) | BIT(10) | BM(6, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08004696 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004697 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004698 .freq_tbl = clk_tbl_pcm_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004699 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004700 .c = {
4701 .dbg_name = "pcm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004702 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004703 VDD_DIG_FMAX_MAP1(LOW, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004704 CLK_INIT(pcm_clk.c),
Stephen Boydc5492fc2012-06-18 18:47:03 -07004705 .rate = ULONG_MAX,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004706 },
4707};
4708
4709static struct rcg_clk audio_slimbus_clk = {
4710 .b = {
4711 .ctl_reg = LCC_SLIMBUS_NS_REG,
4712 .en_mask = BIT(10),
4713 .reset_reg = LCC_AHBEX_BRANCH_CTL_REG,
4714 .reset_mask = BIT(5),
4715 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4716 .halt_check = ENABLE,
4717 .halt_bit = 0,
4718 },
4719 .ns_reg = LCC_SLIMBUS_NS_REG,
4720 .md_reg = LCC_SLIMBUS_MD_REG,
4721 .root_en_mask = BIT(9),
4722 .ns_mask = (BM(31, 24) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004723 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004724 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004725 .freq_tbl = clk_tbl_aif_osr_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004726 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004727 .c = {
4728 .dbg_name = "audio_slimbus_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004729 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004730 VDD_DIG_FMAX_MAP1(LOW, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004731 CLK_INIT(audio_slimbus_clk.c),
4732 },
4733};
4734
4735static struct branch_clk sps_slimbus_clk = {
4736 .b = {
4737 .ctl_reg = LCC_SLIMBUS_NS_REG,
4738 .en_mask = BIT(12),
4739 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4740 .halt_check = ENABLE,
4741 .halt_bit = 1,
4742 },
4743 .parent = &audio_slimbus_clk.c,
4744 .c = {
4745 .dbg_name = "sps_slimbus_clk",
4746 .ops = &clk_ops_branch,
4747 CLK_INIT(sps_slimbus_clk.c),
4748 },
4749};
4750
4751static struct branch_clk slimbus_xo_src_clk = {
4752 .b = {
4753 .ctl_reg = SLIMBUS_XO_SRC_CLK_CTL_REG,
4754 .en_mask = BIT(2),
4755 .halt_reg = CLK_HALT_DFAB_STATE_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004756 .halt_bit = 28,
4757 },
4758 .parent = &sps_slimbus_clk.c,
4759 .c = {
4760 .dbg_name = "slimbus_xo_src_clk",
4761 .ops = &clk_ops_branch,
4762 CLK_INIT(slimbus_xo_src_clk.c),
4763 },
4764};
4765
Matt Wagantall735f01a2011-08-12 12:40:28 -07004766DEFINE_CLK_RPM(afab_clk, afab_a_clk, APPS_FABRIC, NULL);
4767DEFINE_CLK_RPM(cfpb_clk, cfpb_a_clk, CFPB, NULL);
4768DEFINE_CLK_RPM(dfab_clk, dfab_a_clk, DAYTONA_FABRIC, NULL);
4769DEFINE_CLK_RPM(ebi1_clk, ebi1_a_clk, EBI1, NULL);
4770DEFINE_CLK_RPM(mmfab_clk, mmfab_a_clk, MM_FABRIC, NULL);
4771DEFINE_CLK_RPM(mmfpb_clk, mmfpb_a_clk, MMFPB, NULL);
4772DEFINE_CLK_RPM(sfab_clk, sfab_a_clk, SYSTEM_FABRIC, NULL);
4773DEFINE_CLK_RPM(sfpb_clk, sfpb_a_clk, SFPB, NULL);
Stephen Boydc7fc3b12012-05-17 14:42:46 -07004774DEFINE_CLK_RPM_QDSS(qdss_clk, qdss_a_clk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004775
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004776static DEFINE_CLK_VOTER(sfab_msmbus_a_clk, &sfab_a_clk.c, 0);
4777static DEFINE_CLK_VOTER(sfab_tmr_a_clk, &sfab_a_clk.c, 0);
Stephen Boydd7a143a2012-02-16 17:59:26 -08004778
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004779static DEFINE_CLK_VOTER(dfab_dsps_clk, &dfab_clk.c, 0);
4780static DEFINE_CLK_VOTER(dfab_usb_hs_clk, &dfab_clk.c, 0);
4781static DEFINE_CLK_VOTER(dfab_usb_hs3_clk, &dfab_clk.c, 0);
4782static DEFINE_CLK_VOTER(dfab_usb_hs4_clk, &dfab_clk.c, 0);
4783static DEFINE_CLK_VOTER(dfab_sdc1_clk, &dfab_clk.c, 0);
4784static DEFINE_CLK_VOTER(dfab_sdc2_clk, &dfab_clk.c, 0);
4785static DEFINE_CLK_VOTER(dfab_sdc3_clk, &dfab_clk.c, 0);
4786static DEFINE_CLK_VOTER(dfab_sdc4_clk, &dfab_clk.c, 0);
4787static DEFINE_CLK_VOTER(dfab_sdc5_clk, &dfab_clk.c, 0);
4788static DEFINE_CLK_VOTER(dfab_sps_clk, &dfab_clk.c, 0);
4789static DEFINE_CLK_VOTER(dfab_bam_dmux_clk, &dfab_clk.c, 0);
4790static DEFINE_CLK_VOTER(dfab_scm_clk, &dfab_clk.c, 0);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004791static DEFINE_CLK_VOTER(dfab_msmbus_clk, &dfab_clk.c, 0);
4792static DEFINE_CLK_VOTER(dfab_msmbus_a_clk, &dfab_a_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004793
Matt Wagantall42cd12a2012-03-30 18:02:40 -07004794static DEFINE_CLK_VOTER(ebi1_msmbus_clk, &ebi1_clk.c, LONG_MAX);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004795static DEFINE_CLK_VOTER(ebi1_adm_clk, &ebi1_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004796
Matt Wagantall33bac7e2012-05-22 14:59:05 -07004797static DEFINE_CLK_VOTER(ebi1_acpu_a_clk, &ebi1_a_clk.c, LONG_MAX);
4798static DEFINE_CLK_VOTER(ebi1_msmbus_a_clk, &ebi1_a_clk.c, LONG_MAX);
4799static DEFINE_CLK_VOTER(afab_acpu_a_clk, &afab_a_clk.c, LONG_MAX);
4800static DEFINE_CLK_VOTER(afab_msmbus_a_clk, &afab_a_clk.c, LONG_MAX);
4801
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004802#ifdef CONFIG_DEBUG_FS
4803struct measure_sel {
4804 u32 test_vector;
Matt Wagantallf82f2942012-01-27 13:56:13 -08004805 struct clk *c;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004806};
4807
Matt Wagantall8b38f942011-08-02 18:23:18 -07004808static DEFINE_CLK_MEASURE(l2_m_clk);
4809static DEFINE_CLK_MEASURE(krait0_m_clk);
4810static DEFINE_CLK_MEASURE(krait1_m_clk);
Tianyi Gou455c13c2012-02-02 16:33:24 -08004811static DEFINE_CLK_MEASURE(krait2_m_clk);
4812static DEFINE_CLK_MEASURE(krait3_m_clk);
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004813static DEFINE_CLK_MEASURE(q6sw_clk);
4814static DEFINE_CLK_MEASURE(q6fw_clk);
4815static DEFINE_CLK_MEASURE(q6_func_clk);
Matt Wagantall8b38f942011-08-02 18:23:18 -07004816
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004817static struct measure_sel measure_mux[] = {
4818 { TEST_PER_LS(0x08), &slimbus_xo_src_clk.c },
4819 { TEST_PER_LS(0x12), &sdc1_p_clk.c },
4820 { TEST_PER_LS(0x13), &sdc1_clk.c },
4821 { TEST_PER_LS(0x14), &sdc2_p_clk.c },
4822 { TEST_PER_LS(0x15), &sdc2_clk.c },
4823 { TEST_PER_LS(0x16), &sdc3_p_clk.c },
4824 { TEST_PER_LS(0x17), &sdc3_clk.c },
4825 { TEST_PER_LS(0x18), &sdc4_p_clk.c },
4826 { TEST_PER_LS(0x19), &sdc4_clk.c },
4827 { TEST_PER_LS(0x1A), &sdc5_p_clk.c },
4828 { TEST_PER_LS(0x1B), &sdc5_clk.c },
Matt Wagantall7625a4c2011-11-01 16:17:53 -07004829 { TEST_PER_LS(0x1F), &gp0_clk.c },
4830 { TEST_PER_LS(0x20), &gp1_clk.c },
4831 { TEST_PER_LS(0x21), &gp2_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004832 { TEST_PER_LS(0x25), &dfab_clk.c },
4833 { TEST_PER_LS(0x25), &dfab_a_clk.c },
4834 { TEST_PER_LS(0x26), &pmem_clk.c },
4835 { TEST_PER_LS(0x32), &dma_bam_p_clk.c },
4836 { TEST_PER_LS(0x33), &cfpb_clk.c },
4837 { TEST_PER_LS(0x33), &cfpb_a_clk.c },
4838 { TEST_PER_LS(0x3D), &gsbi1_p_clk.c },
4839 { TEST_PER_LS(0x3E), &gsbi1_uart_clk.c },
4840 { TEST_PER_LS(0x3F), &gsbi1_qup_clk.c },
4841 { TEST_PER_LS(0x41), &gsbi2_p_clk.c },
4842 { TEST_PER_LS(0x42), &gsbi2_uart_clk.c },
4843 { TEST_PER_LS(0x44), &gsbi2_qup_clk.c },
4844 { TEST_PER_LS(0x45), &gsbi3_p_clk.c },
4845 { TEST_PER_LS(0x46), &gsbi3_uart_clk.c },
4846 { TEST_PER_LS(0x48), &gsbi3_qup_clk.c },
4847 { TEST_PER_LS(0x49), &gsbi4_p_clk.c },
4848 { TEST_PER_LS(0x4A), &gsbi4_uart_clk.c },
4849 { TEST_PER_LS(0x4C), &gsbi4_qup_clk.c },
4850 { TEST_PER_LS(0x4D), &gsbi5_p_clk.c },
4851 { TEST_PER_LS(0x4E), &gsbi5_uart_clk.c },
4852 { TEST_PER_LS(0x50), &gsbi5_qup_clk.c },
4853 { TEST_PER_LS(0x51), &gsbi6_p_clk.c },
4854 { TEST_PER_LS(0x52), &gsbi6_uart_clk.c },
4855 { TEST_PER_LS(0x54), &gsbi6_qup_clk.c },
4856 { TEST_PER_LS(0x55), &gsbi7_p_clk.c },
4857 { TEST_PER_LS(0x56), &gsbi7_uart_clk.c },
4858 { TEST_PER_LS(0x58), &gsbi7_qup_clk.c },
4859 { TEST_PER_LS(0x59), &gsbi8_p_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004860 { TEST_PER_LS(0x59), &sfab_sata_s_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004861 { TEST_PER_LS(0x5A), &gsbi8_uart_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004862 { TEST_PER_LS(0x5A), &sata_p_clk.c },
4863 { TEST_PER_LS(0x5B), &sata_rxoob_clk.c },
4864 { TEST_PER_LS(0x5C), &sata_pmalive_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004865 { TEST_PER_LS(0x5C), &gsbi8_qup_clk.c },
4866 { TEST_PER_LS(0x5D), &gsbi9_p_clk.c },
4867 { TEST_PER_LS(0x5E), &gsbi9_uart_clk.c },
4868 { TEST_PER_LS(0x60), &gsbi9_qup_clk.c },
4869 { TEST_PER_LS(0x61), &gsbi10_p_clk.c },
4870 { TEST_PER_LS(0x62), &gsbi10_uart_clk.c },
4871 { TEST_PER_LS(0x64), &gsbi10_qup_clk.c },
4872 { TEST_PER_LS(0x65), &gsbi11_p_clk.c },
4873 { TEST_PER_LS(0x66), &gsbi11_uart_clk.c },
4874 { TEST_PER_LS(0x68), &gsbi11_qup_clk.c },
4875 { TEST_PER_LS(0x69), &gsbi12_p_clk.c },
4876 { TEST_PER_LS(0x6A), &gsbi12_uart_clk.c },
4877 { TEST_PER_LS(0x6C), &gsbi12_qup_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004878 { TEST_PER_LS(0x5E), &pcie_p_clk.c },
4879 { TEST_PER_LS(0x5F), &ce3_p_clk.c },
4880 { TEST_PER_LS(0x60), &ce3_core_clk.c },
4881 { TEST_PER_LS(0x63), &usb_hs3_p_clk.c },
4882 { TEST_PER_LS(0x64), &usb_hs3_xcvr_clk.c },
4883 { TEST_PER_LS(0x65), &usb_hs4_p_clk.c },
4884 { TEST_PER_LS(0x66), &usb_hs4_xcvr_clk.c },
4885 { TEST_PER_LS(0x6B), &sata_phy_ref_clk.c },
4886 { TEST_PER_LS(0x6C), &sata_phy_cfg_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004887 { TEST_PER_LS(0x78), &sfpb_clk.c },
4888 { TEST_PER_LS(0x78), &sfpb_a_clk.c },
4889 { TEST_PER_LS(0x7A), &pmic_ssbi2_clk.c },
4890 { TEST_PER_LS(0x7B), &pmic_arb0_p_clk.c },
4891 { TEST_PER_LS(0x7C), &pmic_arb1_p_clk.c },
4892 { TEST_PER_LS(0x7D), &prng_clk.c },
4893 { TEST_PER_LS(0x7F), &rpm_msg_ram_p_clk.c },
4894 { TEST_PER_LS(0x80), &adm0_p_clk.c },
4895 { TEST_PER_LS(0x84), &usb_hs1_p_clk.c },
4896 { TEST_PER_LS(0x85), &usb_hs1_xcvr_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004897 { TEST_PER_LS(0x86), &usb_hsic_p_clk.c },
4898 { TEST_PER_LS(0x87), &usb_hsic_system_clk.c },
4899 { TEST_PER_LS(0x88), &usb_hsic_xcvr_fs_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004900 { TEST_PER_LS(0x89), &usb_fs1_p_clk.c },
4901 { TEST_PER_LS(0x8A), &usb_fs1_sys_clk.c },
4902 { TEST_PER_LS(0x8B), &usb_fs1_xcvr_clk.c },
4903 { TEST_PER_LS(0x8C), &usb_fs2_p_clk.c },
4904 { TEST_PER_LS(0x8D), &usb_fs2_sys_clk.c },
4905 { TEST_PER_LS(0x8E), &usb_fs2_xcvr_clk.c },
4906 { TEST_PER_LS(0x8F), &tsif_p_clk.c },
4907 { TEST_PER_LS(0x91), &tsif_ref_clk.c },
4908 { TEST_PER_LS(0x92), &ce1_p_clk.c },
4909 { TEST_PER_LS(0x94), &tssc_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004910 { TEST_PER_LS(0x9D), &usb_hsic_hsio_cal_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004911 { TEST_PER_LS(0xA4), &ce1_core_clk.c },
4912
4913 { TEST_PER_HS(0x07), &afab_clk.c },
4914 { TEST_PER_HS(0x07), &afab_a_clk.c },
4915 { TEST_PER_HS(0x18), &sfab_clk.c },
4916 { TEST_PER_HS(0x18), &sfab_a_clk.c },
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004917 { TEST_PER_HS(0x26), &q6sw_clk },
4918 { TEST_PER_HS(0x27), &q6fw_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004919 { TEST_PER_HS(0x2A), &adm0_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004920 { TEST_PER_HS(0x31), &sata_a_clk.c },
Tianyi Gou6613de52012-01-27 17:57:53 -08004921 { TEST_PER_HS(0x2D), &pcie_phy_ref_clk.c },
4922 { TEST_PER_HS(0x32), &pcie_a_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004923 { TEST_PER_HS(0x34), &ebi1_clk.c },
4924 { TEST_PER_HS(0x34), &ebi1_a_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004925 { TEST_PER_HS(0x50), &usb_hsic_hsic_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004926
4927 { TEST_MM_LS(0x00), &dsi1_byte_clk.c },
4928 { TEST_MM_LS(0x01), &dsi2_byte_clk.c },
4929 { TEST_MM_LS(0x02), &cam1_clk.c },
4930 { TEST_MM_LS(0x06), &amp_p_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004931 { TEST_MM_LS(0x07), &csi_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004932 { TEST_MM_LS(0x08), &dsi2_s_p_clk.c },
4933 { TEST_MM_LS(0x09), &dsi1_m_p_clk.c },
4934 { TEST_MM_LS(0x0A), &dsi1_s_p_clk.c },
4935 { TEST_MM_LS(0x0C), &gfx2d0_p_clk.c },
4936 { TEST_MM_LS(0x0D), &gfx2d1_p_clk.c },
4937 { TEST_MM_LS(0x0E), &gfx3d_p_clk.c },
4938 { TEST_MM_LS(0x0F), &hdmi_m_p_clk.c },
4939 { TEST_MM_LS(0x10), &hdmi_s_p_clk.c },
4940 { TEST_MM_LS(0x11), &ijpeg_p_clk.c },
4941 { TEST_MM_LS(0x12), &imem_p_clk.c },
4942 { TEST_MM_LS(0x13), &jpegd_p_clk.c },
4943 { TEST_MM_LS(0x14), &mdp_p_clk.c },
4944 { TEST_MM_LS(0x16), &rot_p_clk.c },
4945 { TEST_MM_LS(0x17), &dsi1_esc_clk.c },
4946 { TEST_MM_LS(0x18), &smmu_p_clk.c },
4947 { TEST_MM_LS(0x19), &tv_enc_p_clk.c },
4948 { TEST_MM_LS(0x1A), &vcodec_p_clk.c },
4949 { TEST_MM_LS(0x1B), &vfe_p_clk.c },
4950 { TEST_MM_LS(0x1C), &vpe_p_clk.c },
4951 { TEST_MM_LS(0x1D), &cam0_clk.c },
4952 { TEST_MM_LS(0x1F), &hdmi_app_clk.c },
4953 { TEST_MM_LS(0x20), &mdp_vsync_clk.c },
4954 { TEST_MM_LS(0x21), &tv_dac_clk.c },
4955 { TEST_MM_LS(0x22), &tv_enc_clk.c },
4956 { TEST_MM_LS(0x23), &dsi2_esc_clk.c },
4957 { TEST_MM_LS(0x25), &mmfpb_clk.c },
4958 { TEST_MM_LS(0x25), &mmfpb_a_clk.c },
4959 { TEST_MM_LS(0x26), &dsi2_m_p_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004960 { TEST_MM_LS(0x27), &cam2_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004961 { TEST_MM_LS(0x28), &vcap_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004962
4963 { TEST_MM_HS(0x00), &csi0_clk.c },
4964 { TEST_MM_HS(0x01), &csi1_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004965 { TEST_MM_HS(0x04), &csi_vfe_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004966 { TEST_MM_HS(0x05), &ijpeg_clk.c },
4967 { TEST_MM_HS(0x06), &vfe_clk.c },
4968 { TEST_MM_HS(0x07), &gfx2d0_clk.c },
4969 { TEST_MM_HS(0x08), &gfx2d1_clk.c },
4970 { TEST_MM_HS(0x09), &gfx3d_clk.c },
4971 { TEST_MM_HS(0x0A), &jpegd_clk.c },
4972 { TEST_MM_HS(0x0B), &vcodec_clk.c },
4973 { TEST_MM_HS(0x0F), &mmfab_clk.c },
4974 { TEST_MM_HS(0x0F), &mmfab_a_clk.c },
4975 { TEST_MM_HS(0x11), &gmem_axi_clk.c },
4976 { TEST_MM_HS(0x12), &ijpeg_axi_clk.c },
4977 { TEST_MM_HS(0x13), &imem_axi_clk.c },
4978 { TEST_MM_HS(0x14), &jpegd_axi_clk.c },
4979 { TEST_MM_HS(0x15), &mdp_axi_clk.c },
4980 { TEST_MM_HS(0x16), &rot_axi_clk.c },
4981 { TEST_MM_HS(0x17), &vcodec_axi_clk.c },
4982 { TEST_MM_HS(0x18), &vfe_axi_clk.c },
4983 { TEST_MM_HS(0x19), &vpe_axi_clk.c },
4984 { TEST_MM_HS(0x1A), &mdp_clk.c },
4985 { TEST_MM_HS(0x1B), &rot_clk.c },
4986 { TEST_MM_HS(0x1C), &vpe_clk.c },
4987 { TEST_MM_HS(0x1E), &hdmi_tv_clk.c },
4988 { TEST_MM_HS(0x1F), &mdp_tv_clk.c },
4989 { TEST_MM_HS(0x24), &csi0_phy_clk.c },
4990 { TEST_MM_HS(0x25), &csi1_phy_clk.c },
4991 { TEST_MM_HS(0x26), &csi_pix_clk.c },
4992 { TEST_MM_HS(0x27), &csi_rdi_clk.c },
4993 { TEST_MM_HS(0x28), &lut_mdp_clk.c },
4994 { TEST_MM_HS(0x29), &vcodec_axi_a_clk.c },
4995 { TEST_MM_HS(0x2A), &vcodec_axi_b_clk.c },
4996 { TEST_MM_HS(0x2B), &csi1phy_timer_clk.c },
4997 { TEST_MM_HS(0x2C), &csi0phy_timer_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004998 { TEST_MM_HS(0x2D), &csi2_clk.c },
4999 { TEST_MM_HS(0x2E), &csi2_phy_clk.c },
5000 { TEST_MM_HS(0x2F), &csi2phy_timer_clk.c },
5001 { TEST_MM_HS(0x30), &csi_pix1_clk.c },
5002 { TEST_MM_HS(0x31), &csi_rdi1_clk.c },
5003 { TEST_MM_HS(0x32), &csi_rdi2_clk.c },
Tianyi Gou621f8742011-09-01 21:45:01 -07005004 { TEST_MM_HS(0x33), &vcap_clk.c },
5005 { TEST_MM_HS(0x34), &vcap_npl_clk.c },
Tianyi Goue3d4f542012-03-15 17:06:45 -07005006 { TEST_MM_HS(0x34), &gfx3d_axi_clk_8930.c },
Tianyi Gou7747a962012-02-03 15:03:55 -08005007 { TEST_MM_HS(0x35), &vcap_axi_clk.c },
Tianyi Gou51918802012-01-26 14:05:43 -08005008 { TEST_MM_HS(0x36), &rgb_tv_clk.c },
5009 { TEST_MM_HS(0x37), &npl_tv_clk.c },
Patrick Dalye6f489042012-07-11 15:29:15 -07005010 { TEST_MM_HS(0x38), &gfx3d_axi_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005011
5012 { TEST_LPA(0x0F), &mi2s_bit_clk.c },
5013 { TEST_LPA(0x10), &codec_i2s_mic_bit_clk.c },
5014 { TEST_LPA(0x11), &codec_i2s_spkr_bit_clk.c },
5015 { TEST_LPA(0x12), &spare_i2s_mic_bit_clk.c },
5016 { TEST_LPA(0x13), &spare_i2s_spkr_bit_clk.c },
5017 { TEST_LPA(0x14), &pcm_clk.c },
5018 { TEST_LPA(0x1D), &audio_slimbus_clk.c },
Matt Wagantall8b38f942011-08-02 18:23:18 -07005019
Stephen Boyd3939c8d2011-08-29 17:36:22 -07005020 { TEST_LPA_HS(0x00), &q6_func_clk },
5021
Stephen Boyd46fdf0d2011-11-22 12:25:09 -08005022 { TEST_CPUL2(0x2), &l2_m_clk },
5023 { TEST_CPUL2(0x0), &krait0_m_clk },
5024 { TEST_CPUL2(0x1), &krait1_m_clk },
Tianyi Gou455c13c2012-02-02 16:33:24 -08005025 { TEST_CPUL2(0x4), &krait2_m_clk },
5026 { TEST_CPUL2(0x5), &krait3_m_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005027};
5028
Matt Wagantallf82f2942012-01-27 13:56:13 -08005029static struct measure_sel *find_measure_sel(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005030{
5031 int i;
5032
5033 for (i = 0; i < ARRAY_SIZE(measure_mux); i++)
Matt Wagantallf82f2942012-01-27 13:56:13 -08005034 if (measure_mux[i].c == c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005035 return &measure_mux[i];
5036 return NULL;
5037}
5038
Matt Wagantall8b38f942011-08-02 18:23:18 -07005039static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005040{
5041 int ret = 0;
5042 u32 clk_sel;
5043 struct measure_sel *p;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005044 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005045 unsigned long flags;
5046
5047 if (!parent)
5048 return -EINVAL;
5049
5050 p = find_measure_sel(parent);
5051 if (!p)
5052 return -EINVAL;
5053
5054 spin_lock_irqsave(&local_clock_reg_lock, flags);
5055
Matt Wagantall8b38f942011-08-02 18:23:18 -07005056 /*
5057 * Program the test vector, measurement period (sample_ticks)
5058 * and scaling multiplier.
5059 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005060 measure->sample_ticks = 0x10000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005061 clk_sel = p->test_vector & TEST_CLK_SEL_MASK;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005062 measure->multiplier = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005063 switch (p->test_vector >> TEST_TYPE_SHIFT) {
5064 case TEST_TYPE_PER_LS:
5065 writel_relaxed(0x4030D00|BVAL(7, 0, clk_sel), CLK_TEST_REG);
5066 break;
5067 case TEST_TYPE_PER_HS:
5068 writel_relaxed(0x4020000|BVAL(16, 10, clk_sel), CLK_TEST_REG);
5069 break;
5070 case TEST_TYPE_MM_LS:
5071 writel_relaxed(0x4030D97, CLK_TEST_REG);
5072 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_LS_REG);
5073 break;
5074 case TEST_TYPE_MM_HS:
5075 writel_relaxed(0x402B800, CLK_TEST_REG);
5076 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_HS_REG);
5077 break;
5078 case TEST_TYPE_LPA:
5079 writel_relaxed(0x4030D98, CLK_TEST_REG);
5080 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0),
5081 LCC_CLK_LS_DEBUG_CFG_REG);
5082 break;
Stephen Boyd3939c8d2011-08-29 17:36:22 -07005083 case TEST_TYPE_LPA_HS:
5084 writel_relaxed(0x402BC00, CLK_TEST_REG);
5085 writel_relaxed(BVAL(2, 1, clk_sel)|BIT(0),
5086 LCC_CLK_HS_DEBUG_CFG_REG);
5087 break;
Matt Wagantall8b38f942011-08-02 18:23:18 -07005088 case TEST_TYPE_CPUL2:
5089 writel_relaxed(0x4030400, CLK_TEST_REG);
5090 writel_relaxed(0x80|BVAL(5, 3, clk_sel), GCC_APCS_CLK_DIAG);
Matt Wagantallf82f2942012-01-27 13:56:13 -08005091 measure->sample_ticks = 0x4000;
5092 measure->multiplier = 2;
Patrick Daly73db3ad2012-10-01 18:56:41 -07005093 if (cpu_is_krait_v3())
5094 measure->multiplier = 8;
Matt Wagantall8b38f942011-08-02 18:23:18 -07005095 break;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005096 default:
5097 ret = -EPERM;
5098 }
5099 /* Make sure test vector is set before starting measurements. */
5100 mb();
5101
5102 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5103
5104 return ret;
5105}
5106
5107/* Sample clock for 'ticks' reference clock ticks. */
5108static u32 run_measurement(unsigned ticks)
5109{
5110 /* Stop counters and set the XO4 counter start value. */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005111 writel_relaxed(ticks, RINGOSC_TCXO_CTL_REG);
5112
5113 /* Wait for timer to become ready. */
5114 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) != 0)
5115 cpu_relax();
5116
5117 /* Run measurement and wait for completion. */
5118 writel_relaxed(BIT(20)|ticks, RINGOSC_TCXO_CTL_REG);
5119 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) == 0)
5120 cpu_relax();
5121
5122 /* Stop counters. */
5123 writel_relaxed(0x0, RINGOSC_TCXO_CTL_REG);
5124
5125 /* Return measured ticks. */
5126 return readl_relaxed(RINGOSC_STATUS_REG) & BM(24, 0);
5127}
5128
5129
5130/* Perform a hardware rate measurement for a given clock.
5131 FOR DEBUG USE ONLY: Measurements take ~15 ms! */
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07005132static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005133{
5134 unsigned long flags;
5135 u32 pdm_reg_backup, ringosc_reg_backup;
5136 u64 raw_count_short, raw_count_full;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005137 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005138 unsigned ret;
5139
Stephen Boyde334aeb2012-01-24 12:17:29 -08005140 ret = clk_prepare_enable(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005141 if (ret) {
5142 pr_warning("CXO clock failed to enable. Can't measure\n");
5143 return 0;
5144 }
5145
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005146 spin_lock_irqsave(&local_clock_reg_lock, flags);
5147
5148 /* Enable CXO/4 and RINGOSC branch and root. */
5149 pdm_reg_backup = readl_relaxed(PDM_CLK_NS_REG);
5150 ringosc_reg_backup = readl_relaxed(RINGOSC_NS_REG);
5151 writel_relaxed(0x2898, PDM_CLK_NS_REG);
5152 writel_relaxed(0xA00, RINGOSC_NS_REG);
5153
5154 /*
5155 * The ring oscillator counter will not reset if the measured clock
5156 * is not running. To detect this, run a short measurement before
5157 * the full measurement. If the raw results of the two are the same
5158 * then the clock must be off.
5159 */
5160
5161 /* Run a short measurement. (~1 ms) */
5162 raw_count_short = run_measurement(0x1000);
5163 /* Run a full measurement. (~14 ms) */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005164 raw_count_full = run_measurement(measure->sample_ticks);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005165
5166 writel_relaxed(ringosc_reg_backup, RINGOSC_NS_REG);
5167 writel_relaxed(pdm_reg_backup, PDM_CLK_NS_REG);
5168
5169 /* Return 0 if the clock is off. */
5170 if (raw_count_full == raw_count_short)
5171 ret = 0;
5172 else {
5173 /* Compute rate in Hz. */
5174 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005175 do_div(raw_count_full, ((measure->sample_ticks * 10) + 35));
5176 ret = (raw_count_full * measure->multiplier);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005177 }
5178
5179 /* Route dbg_hs_clk to PLLTEST. 300mV single-ended amplitude. */
Stephen Boyd69da8402011-07-14 17:45:31 -07005180 writel_relaxed(0x38F8, PLLTEST_PAD_CFG_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005181 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5182
Stephen Boyde334aeb2012-01-24 12:17:29 -08005183 clk_disable_unprepare(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005184
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005185 return ret;
5186}
5187#else /* !CONFIG_DEBUG_FS */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005188static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005189{
5190 return -EINVAL;
5191}
5192
Matt Wagantallf82f2942012-01-27 13:56:13 -08005193static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005194{
5195 return 0;
5196}
5197#endif /* CONFIG_DEBUG_FS */
5198
Matt Wagantallae053222012-05-14 19:42:07 -07005199static struct clk_ops clk_ops_measure = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005200 .set_parent = measure_clk_set_parent,
5201 .get_rate = measure_clk_get_rate,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005202};
5203
Matt Wagantall8b38f942011-08-02 18:23:18 -07005204static struct measure_clk measure_clk = {
5205 .c = {
5206 .dbg_name = "measure_clk",
Matt Wagantallae053222012-05-14 19:42:07 -07005207 .ops = &clk_ops_measure,
Matt Wagantall8b38f942011-08-02 18:23:18 -07005208 CLK_INIT(measure_clk.c),
5209 },
5210 .multiplier = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005211};
5212
Tianyi Goua8b3cce2011-11-08 14:37:26 -08005213static struct clk_lookup msm_clocks_8064[] = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005214 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5215 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Mohan Pallaka804ca592012-06-14 14:37:38 +05305216 CLK_LOOKUP("pwm_clk", cxo_clk.c, "0-0048"),
Stephen Boyded630b02012-01-26 15:26:47 -08005217 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5218 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
Stephen Boydbdb53f32012-06-05 18:39:47 -07005219 CLK_LOOKUP("xo", pxo_clk.c, "pil-q6v4-lpass"),
Matt Wagantall292aace2012-01-26 19:12:34 -08005220 CLK_LOOKUP("xo", cxo_clk.c, "pil_gss"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005221 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005222 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
David Collinsa7d23532012-08-02 10:48:16 -07005223 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Stephen Boyded630b02012-01-26 15:26:47 -08005224 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5225 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5226 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5227 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005228
Matt Wagantalld75f1312012-05-23 16:17:35 -07005229 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5230 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5231 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5232 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5233 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5234 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5235 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5236 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5237 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5238 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5239 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5240 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5241 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5242 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5243 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5244 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5245
Tianyi Gou21a0e802012-02-04 22:34:10 -08005246 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005247 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005248 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5249 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5250 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005251 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005252 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5253 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5254 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5255 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5256 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005257 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005258 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5259 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005260 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005261 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5262 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5263 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5264 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5265 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5266 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5267 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005268
Tianyi Gou21a0e802012-02-04 22:34:10 -08005269 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005270 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, ""),
5271 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5272 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005273
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005274 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5275 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5276 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005277 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, "msm_serial_hsl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005278 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5279 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5280 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5281 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, ""),
Mayank Rana262e9032012-05-10 15:14:00 -07005282 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005283 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, "msm_serial_hsl.0"),
David Keitel3c40fc52012-02-09 17:53:52 -08005284 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005285 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005286 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005287 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005288 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005289 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "qup_i2c.5"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005290 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5291 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5292 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Tianyi Gou50f23812012-02-06 16:04:19 -08005293 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Tianyi Gou05e01102012-02-08 22:15:49 -08005294 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005295 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5296 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5297 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5298 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
Joel Nider6cbe66a2012-06-26 11:11:59 +03005299 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.0"),
5300 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.0"),
5301 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.1"),
5302 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005303 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005304 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5305 CLK_LOOKUP("alt_core_clk", usb_hs3_xcvr_clk.c, "msm_ehci_host.0"),
5306 CLK_LOOKUP("alt_core_clk", usb_hs4_xcvr_clk.c, "msm_ehci_host.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005307 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5308 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5309 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005310 CLK_LOOKUP("ref_clk", sata_phy_ref_clk.c, ""),
5311 CLK_LOOKUP("cfg_clk", sata_phy_cfg_clk.c, ""),
Tianyi Gou352955d2012-05-18 19:44:01 -07005312 CLK_LOOKUP("src_clk", sata_src_clk.c, ""),
5313 CLK_LOOKUP("core_rxoob_clk", sata_rxoob_clk.c, ""),
5314 CLK_LOOKUP("core_pmalive_clk", sata_pmalive_clk.c, ""),
5315 CLK_LOOKUP("bus_clk", sata_a_clk.c, ""),
5316 CLK_LOOKUP("iface_clk", sata_p_clk.c, ""),
5317 CLK_LOOKUP("slave_iface_clk", sfab_sata_s_p_clk.c, ""),
Ramesh Masavarapu28311912011-10-27 11:04:12 -07005318 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qce.0"),
5319 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qcrypto.0"),
5320 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qce.0"),
5321 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qcrypto.0"),
5322 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qce.0"),
5323 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qcrypto.0"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005324 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005325 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "msm_serial_hsl.1"),
David Keitel3c40fc52012-02-09 17:53:52 -08005326 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005327 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005328 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005329 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005330 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005331 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "qup_i2c.5"),
Mayank Rana262e9032012-05-10 15:14:00 -07005332 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005333 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, "msm_serial_hsl.0"),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005334 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5335 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005336 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005337 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Manu Gautam7483f172011-11-08 15:22:26 +05305338 CLK_LOOKUP("iface_clk", usb_hs3_p_clk.c, "msm_ehci_host.0"),
5339 CLK_LOOKUP("iface_clk", usb_hs4_p_clk.c, "msm_ehci_host.1"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005340 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5341 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5342 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5343 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06005344 CLK_LOOKUP("iface_clk", pcie_p_clk.c, "msm_pcie"),
5345 CLK_LOOKUP("ref_clk", pcie_phy_ref_clk.c, "msm_pcie"),
5346 CLK_LOOKUP("bus_clk", pcie_a_clk.c, "msm_pcie"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005347 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5348 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005349 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5350 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5351 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5352 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chand07220e2012-02-13 15:52:22 -08005353 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005354 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Sreesudhan Ramakrish Ramkumar8002a792012-04-09 17:42:58 -07005355 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -08005356 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Kevin Chand07220e2012-02-13 15:52:22 -08005357 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
Stephen Boyd85328b22012-09-19 17:07:16 -07005358 CLK_LOOKUP("cam_clk", cam2_clk.c, ""),
Kevin Chand07220e2012-02-13 15:52:22 -08005359 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5360 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
5361 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
5362 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5363 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
5364 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
5365 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5366 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
5367 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
5368 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5369 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5370 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
5371 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5372 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5373 CLK_LOOKUP("csiphy_timer_src_clk",
5374 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5375 CLK_LOOKUP("csiphy_timer_src_clk",
5376 csiphy_timer_src_clk.c, "msm_csiphy.1"),
5377 CLK_LOOKUP("csiphy_timer_src_clk",
5378 csiphy_timer_src_clk.c, "msm_csiphy.2"),
5379 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5380 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
5381 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005382 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5383 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5384 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5385 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Tianyi Gou51918802012-01-26 14:05:43 -08005386 CLK_LOOKUP("rgb_clk", rgb_tv_clk.c, ""),
5387 CLK_LOOKUP("npl_clk", npl_tv_clk.c, ""),
5388
Pu Chen86b4be92011-11-03 17:27:57 -07005389 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005390 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005391 CLK_LOOKUP("bus_clk",
Patrick Dalye6f489042012-07-11 15:29:15 -07005392 gfx3d_axi_clk.c, "footswitch-8x60.2"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005393 CLK_LOOKUP("iface_clk", vcap_p_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005394 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005395 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "footswitch-8x60.10"),
5396 CLK_LOOKUP("bus_clk", vcap_axi_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005397 CLK_LOOKUP("core_clk", vcap_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005398 CLK_LOOKUP("core_clk", vcap_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005399 CLK_LOOKUP("core_clk", vcap_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005400 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005401 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005402 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005403 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5404 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005405 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005406 CLK_LOOKUP("core_clk", jpegd_clk.c, ""),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005407 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005408 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005409 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005410 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005411 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005412 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005413 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005414 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Matt Wagantall61286312012-02-22 15:55:09 -08005415 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005416 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5417 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
Greg Griscofa47b532011-11-11 10:32:06 -08005418 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005419 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005420 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
Tianyi Gou51918802012-01-26 14:05:43 -08005421 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005422 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005423 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Ujwal Pateld041f982012-03-27 19:51:44 -07005424 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005425 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chand07220e2012-02-13 15:52:22 -08005426 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005427 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chand07220e2012-02-13 15:52:22 -08005428 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005429 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5430 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5431 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5432 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5433 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5434 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5435 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005436 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5437 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chand07220e2012-02-13 15:52:22 -08005438 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5439 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
5440 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005441 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5442 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5443 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5444 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Pu Chen86b4be92011-11-03 17:27:57 -07005445 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005446 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005447 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5448 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005449 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005450 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005451 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005452 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005453 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005454 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005455 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005456 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005457 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Greg Griscofa47b532011-11-11 10:32:06 -08005458 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005459 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chand07220e2012-02-13 15:52:22 -08005460 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005461 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chanb20742b2012-02-27 15:47:35 -08005462 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall61286312012-02-22 15:55:09 -08005463 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005464
Patrick Lai04baee942012-05-01 14:38:47 -07005465 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5466 "msm-dai-q6-mi2s"),
5467 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5468 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005469 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5470 "msm-dai-q6.1"),
5471 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5472 "msm-dai-q6.1"),
5473 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5474 "msm-dai-q6.5"),
5475 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5476 "msm-dai-q6.5"),
5477 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wangdea7c822012-08-20 20:52:42 -07005478 "msm-dai-q6.0"),
5479 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5480 "msm-dai-q6.0"),
5481 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005482 "msm-dai-q6.16384"),
5483 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5484 "msm-dai-q6.16384"),
5485 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5486 "msm-dai-q6.4"),
5487 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5488 "msm-dai-q6.4"),
5489 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005490 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005491 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, ""),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005492 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005493 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, ""),
5494 CLK_LOOKUP("core_clk", vpe_axi_clk.c, ""),
5495 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
5496 CLK_LOOKUP("core_clk", vcap_axi_clk.c, ""),
5497 CLK_LOOKUP("core_clk", rot_axi_clk.c, ""),
5498 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, ""),
5499 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
5500 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, ""),
5501 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, ""),
Patrick Dalye6f489042012-07-11 15:29:15 -07005502 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005503
5504 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
5505 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
5506 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.0"),
5507 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.1"),
5508 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5509 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5510 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5511 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5512 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
5513 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
5514 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
5515
Manu Gautam5143b252012-01-05 19:25:23 -08005516 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5517 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5518 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5519 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5520 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005521
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005522 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5523 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5524 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5525 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5526 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5527 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5528 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5529 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5530 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005531 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.9"),
5532 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.10"),
5533
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005534 CLK_LOOKUP("core_clk", vcap_axi_clk.c, "msm_iommu.11"),
5535
Deepak Kotur954b1782012-04-24 17:58:19 -07005536 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5537 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5538 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5539 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5540 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005541 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5542 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
5543
Jeff Ohlstein8c116c72011-10-27 17:34:48 -07005544 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005545 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5546 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005547
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07005548 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
5549 CLK_LOOKUP("reset2_clk", dsi2_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07005550
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005551 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5552 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5553 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
Tianyi Gou455c13c2012-02-02 16:33:24 -08005554 CLK_LOOKUP("krait2_mclk", krait2_m_clk, ""),
5555 CLK_LOOKUP("krait3_mclk", krait3_m_clk, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005556};
5557
Patrick Dalye6f489042012-07-11 15:29:15 -07005558static struct clk_lookup msm_clocks_8960_common[] __initdata = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005559 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5560 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Stephen Boyded630b02012-01-26 15:26:47 -08005561 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5562 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
Stephen Boydbdb53f32012-06-05 18:39:47 -07005563 CLK_LOOKUP("xo", pxo_clk.c, "pil-q6v4-lpass"),
5564 CLK_LOOKUP("xo", cxo_clk.c, "pil-q6v4-modem"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005565 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005566 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
David Collinsa7d23532012-08-02 10:48:16 -07005567 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Stephen Boyded630b02012-01-26 15:26:47 -08005568 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5569 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5570 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5571 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005572
Matt Wagantalld75f1312012-05-23 16:17:35 -07005573 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5574 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5575 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5576 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5577 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5578 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5579 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5580 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5581 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5582 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5583 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5584 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5585 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5586 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5587 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5588 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5589
Matt Wagantallb2710b82011-11-16 19:55:17 -08005590 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005591 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005592 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5593 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5594 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005595 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005596 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5597 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5598 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5599 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5600 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005601 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005602 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5603 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005604 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005605 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5606 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5607 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5608 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5609 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5610 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5611 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005612
5613 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005614 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5615 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5616 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005617
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005618 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5619 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5620 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5621 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5622 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5623 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5624 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
Matt Wagantalle2522372011-08-17 14:52:21 -07005625 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5626 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005627 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
Mayank Rana1f02d952012-07-04 19:11:20 +05305628 /* used on 8960 SGLTE for console */
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005629 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hsl.1"),
Mayank Rana1f02d952012-07-04 19:11:20 +05305630 /* used on 8960 standalone with Atheros Bluetooth */
5631 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hs.2"),
Mayank Ranae009c922012-03-22 03:02:06 +05305632 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, "msm_serial_hs.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005633 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5634 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5635 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005636 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005637 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005638 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5639 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005640 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5641 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5642 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5643 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005644 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005645 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005646 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005647 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005648 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Vikram Mulukutladd0a2372011-09-19 15:58:21 -07005649 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Matt Wagantallc1205292011-08-11 17:19:31 -07005650 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005651 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5652 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5653 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5654 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5655 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005656 CLK_LOOKUP("slimbus_xo_src_clk", slimbus_xo_src_clk.c, NULL),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005657 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005658 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5659 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005660 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5661 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5662 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5663 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5664 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5665 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005666 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5667 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5668 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5669 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5670 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005671 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005672 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005673 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005674 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005675 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Matt Wagantallac294852011-08-17 15:44:58 -07005676 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005677 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005678 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
5679 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Matt Wagantalle2522372011-08-17 14:52:21 -07005680 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
5681 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005682 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
Mayank Rana1f02d952012-07-04 19:11:20 +05305683 /* used on 8960 SGLTE for serial console */
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005684 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hsl.1"),
Mayank Rana1f02d952012-07-04 19:11:20 +05305685 /* used on 8960 standalone with Atheros Bluetooth */
5686 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hs.2"),
Mayank Ranae009c922012-03-22 03:02:06 +05305687 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "msm_serial_hs.1"),
Matt Wagantallac294852011-08-17 15:44:58 -07005688 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005689 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005690 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005691 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005692 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5693 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005694 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
5695 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005696 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005697 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5698 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5699 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5700 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
5701 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
Matt Wagantalle1a86062011-08-18 17:46:10 -07005702 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5703 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005704 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5705 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5706 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5707 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chan09f4e662011-12-16 08:17:02 -08005708 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
5709 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-006c"),
5710 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0048"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005711 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -08005712 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005713 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005714 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5715 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005716 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005717 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5718 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005719 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005720 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5721 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005722 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
Kevin Chane12c6672011-10-26 11:55:26 -07005723 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5724 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005725 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
5726 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
5727 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5728 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5729 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5730 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
5731 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
Kevin Chanf6216f22011-10-25 18:40:11 -07005732 CLK_LOOKUP("csiphy_timer_src_clk",
5733 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5734 CLK_LOOKUP("csiphy_timer_src_clk",
5735 csiphy_timer_src_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005736 CLK_LOOKUP("csiphy_timer_src_clk",
5737 csiphy_timer_src_clk.c, "msm_csiphy.2"),
Kevin Chanf6216f22011-10-25 18:40:11 -07005738 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5739 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005740 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005741 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5742 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5743 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5744 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005745 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005746 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
5747 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005748 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5749 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005750 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07005751 CLK_LOOKUP("core_clk", jpegd_clk.c, "msm_mercury.0"),
5752 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, "msm_mercury.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005753 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005754 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005755 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005756 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005757 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005758 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005759 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005760 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005761 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5762 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005763 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005764 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005765 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005766 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
5767 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005768 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005769 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005770 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Kevin Chana0853122011-11-07 19:48:44 -08005771 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005772 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chan5827c552011-10-28 18:36:32 -07005773 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005774 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chan5827c552011-10-28 18:36:32 -07005775 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005776 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5777 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5778 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5779 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5780 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5781 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5782 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005783 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5784 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005785 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5786 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005787 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005788 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5789 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5790 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5791 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005792 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005793 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005794 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5795 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005796 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005797 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005798 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005799 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005800 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005801 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005802 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005803 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005804 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005805 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005806 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chan5827c552011-10-28 18:36:32 -07005807 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005808 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chana0853122011-11-07 19:48:44 -08005809 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005810 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Patrick Lai04baee942012-05-01 14:38:47 -07005811 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5812 "msm-dai-q6-mi2s"),
5813 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5814 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005815 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5816 "msm-dai-q6.1"),
5817 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5818 "msm-dai-q6.1"),
5819 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5820 "msm-dai-q6.5"),
5821 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5822 "msm-dai-q6.5"),
5823 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wangdea7c822012-08-20 20:52:42 -07005824 "msm-dai-q6.0"),
5825 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5826 "msm-dai-q6.0"),
5827 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005828 "msm-dai-q6.16384"),
5829 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5830 "msm-dai-q6.16384"),
5831 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5832 "msm-dai-q6.4"),
5833 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5834 "msm-dai-q6.4"),
5835 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005836 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005837 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005838 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005839 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5840 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5841 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5842 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5843 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5844 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5845 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5846 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5847 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
5848 CLK_LOOKUP("core_clk", gfx3d_clk.c, "msm_iommu.9"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005849
5850 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5851 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5852 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5853 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5854 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005855 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5856 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005857
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005858 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
Manu Gautam5143b252012-01-05 19:25:23 -08005859 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005860 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5861 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5862 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5863 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5864 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
Yan He160633e2011-06-30 12:18:56 -07005865 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
Stephen Boyd1c51a492011-10-26 12:11:47 -07005866 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
Stephen Boydef5d1c42011-12-15 20:47:14 -08005867 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005868
Matt Wagantalle1a86062011-08-18 17:46:10 -07005869 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005870 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5871 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Matt Wagantall8b38f942011-08-02 18:23:18 -07005872
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07005873 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
5874 CLK_LOOKUP("reset2_clk", dsi2_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07005875
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005876 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5877 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5878 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
5879 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
5880 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
5881 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005882};
5883
Patrick Dalye6f489042012-07-11 15:29:15 -07005884static struct clk_lookup msm_clocks_8960_only[] __initdata = {
5885 CLK_LOOKUP("enc_clk", tv_enc_clk.c, "tvenc.0"),
5886 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
5887 CLK_LOOKUP("iface_clk", tv_enc_p_clk.c, "tvenc.0"),
5888
5889 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "kgsl-2d0.0"),
5890 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "footswitch-8x60.0"),
5891 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "kgsl-2d1.1"),
5892 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "footswitch-8x60.1"),
5893 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "kgsl-2d0.0"),
5894 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "footswitch-8x60.0"),
5895 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "kgsl-2d1.1"),
5896 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "footswitch-8x60.1"),
5897 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "msm_iommu.10"),
5898 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "msm_iommu.11"),
5899};
5900
5901static struct clk_lookup msm_clocks_8960ab_only[] __initdata = {
5902 CLK_LOOKUP("bus_clk", gfx3d_axi_clk.c, "footswitch-8x60.2"),
Joel King9af070b2012-08-19 22:32:14 -07005903 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.10"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005904 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
5905};
5906
5907static struct clk_lookup msm_clocks_8960[ARRAY_SIZE(msm_clocks_8960_common)
5908 + ARRAY_SIZE(msm_clocks_8960_only)
5909 + ARRAY_SIZE(msm_clocks_8960ab_only)];
5910
Tianyi Goue3d4f542012-03-15 17:06:45 -07005911static struct clk_lookup msm_clocks_8930[] = {
Stephen Boydbe1a7392012-04-02 20:17:11 -07005912 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005913 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5914 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
Stephen Boydbdb53f32012-06-05 18:39:47 -07005915 CLK_LOOKUP("xo", pxo_clk.c, "pil-q6v4-lpass"),
5916 CLK_LOOKUP("xo", cxo_clk.c, "pil-q6v4-modem"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005917 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
David Collinsa7d23532012-08-02 10:48:16 -07005918 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005919 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5920 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5921 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5922 CLK_LOOKUP("measure", measure_clk.c, "debug"),
5923
Matt Wagantalld75f1312012-05-23 16:17:35 -07005924 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5925 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5926 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5927 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5928 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5929 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5930 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5931 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5932 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5933 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5934 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5935 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5936 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5937 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5938 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5939 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5940
Tianyi Goue3d4f542012-03-15 17:06:45 -07005941 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005942 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005943 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5944 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5945 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
5946 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
5947 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5948 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5949 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5950 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5951 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005952 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005953 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5954 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005955 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005956 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5957 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5958 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5959 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5960 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5961 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5962 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005963
5964 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005965 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5966 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5967 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
5968
5969 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5970 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5971 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5972 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5973 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5974 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5975 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5976 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5977 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
5978 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
5979 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, ""),
5980 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, ""),
5981 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5982 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5983 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
5984 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
5985 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
5986 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5987 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
5988 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5989 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5990 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5991 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
5992 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, "qup_i2c.0"),
5993 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
5994 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
5995 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
5996 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
5997 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
5998 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
5999 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
6000 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
6001 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
6002 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
6003 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
6004 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, ""),
6005 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
6006 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
6007 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
6008 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
6009 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
6010 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
6011 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
6012 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
6013 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
6014 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
6015 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
6016 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
6017 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
6018 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
6019 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
6020 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
6021 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
6022 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
6023 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
6024 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
6025 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
6026 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
6027 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
6028 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
6029 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
6030 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
6031 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, ""),
6032 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "qup_i2c.0"),
6033 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
6034 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
6035 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
6036 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
6037 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
6038 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
6039 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
6040 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
6041 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
6042 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
6043 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
6044 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
6045 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
6046 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
6047 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
6048 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
6049 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
6050 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006051 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Hody Hung994f4622012-04-24 10:27:45 -07006052 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
Sreesudhan Ramakrish Ramkumar981c82c2012-04-30 17:31:37 -07006053 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006054 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
6055 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
6056 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
6057 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
6058 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
6059 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
6060 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
6061 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
6062 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
6063 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
6064 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
6065 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
6066 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
6067 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
6068 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
6069 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
6070 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
6071 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
6072 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
6073 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
6074 CLK_LOOKUP("csiphy_timer_src_clk",
6075 csiphy_timer_src_clk.c, "msm_csiphy.0"),
6076 CLK_LOOKUP("csiphy_timer_src_clk",
6077 csiphy_timer_src_clk.c, "msm_csiphy.1"),
6078 CLK_LOOKUP("csiphy_timer_src_clk",
6079 csiphy_timer_src_clk.c, "msm_csiphy.2"),
6080 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
6081 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
6082 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006083 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
6084 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006085 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
6086 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
6087 CLK_LOOKUP("bus_clk",
6088 gfx3d_axi_clk_8930.c, "footswitch-8x60.2"),
6089 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006090 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
6091 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006092 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006093 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006094 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006095 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006096 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006097 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006098 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
6099 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
6100 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006101 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
6102 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006103 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006104 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006105 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
6106 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006107 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
6108 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006109 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006110 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006111 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
6112 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
6113 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
6114 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
6115 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
6116 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
6117 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
6118 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
6119 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
6120 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
6121 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
6122 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
6123 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006124 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006125 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
6126 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
6127 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006128 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
6129 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006130 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
6131 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
6132 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
6133 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006134 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006135 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
6136 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006137 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006138 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
6139 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
6140 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
6141 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
6142 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
6143 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
6144 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
6145 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
6146 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
6147 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
6148 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.6"),
6149 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.6"),
6150 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
6151 "msm-dai-q6.1"),
6152 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
6153 "msm-dai-q6.1"),
6154 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
6155 "msm-dai-q6.5"),
6156 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
6157 "msm-dai-q6.5"),
6158 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wangdea7c822012-08-20 20:52:42 -07006159 "msm-dai-q6.0"),
6160 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
6161 "msm-dai-q6.0"),
6162 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Tianyi Goue3d4f542012-03-15 17:06:45 -07006163 "msm-dai-q6.16384"),
6164 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
6165 "msm-dai-q6.16384"),
6166 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
6167 "msm-dai-q6.4"),
6168 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
6169 "msm-dai-q6.4"),
6170 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
6171 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
6172 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
6173 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
6174 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
6175 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
6176 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
6177 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
6178 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
6179 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
6180 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
6181 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.9"),
6182 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.10"),
6183
6184 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
6185 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
6186 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
6187 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
6188 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08006189 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
6190 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006191
6192 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
6193 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
6194 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
6195 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
6196 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
6197 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
6198 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
6199 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
6200 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
6201 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006202
6203 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07006204 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
6205 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006206
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07006207 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07006208
Tianyi Goue3d4f542012-03-15 17:06:45 -07006209 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
6210 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
6211 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
6212 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
6213 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
6214 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
6215};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006216/*
6217 * Miscellaneous clock register initializations
6218 */
6219
6220/* Read, modify, then write-back a register. */
6221static void __init rmwreg(uint32_t val, void *reg, uint32_t mask)
6222{
6223 uint32_t regval = readl_relaxed(reg);
6224 regval &= ~mask;
6225 regval |= val;
6226 writel_relaxed(regval, reg);
6227}
6228
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006229static struct pll_config_regs pll4_regs __initdata = {
6230 .l_reg = LCC_PLL0_L_VAL_REG,
6231 .m_reg = LCC_PLL0_M_VAL_REG,
6232 .n_reg = LCC_PLL0_N_VAL_REG,
6233 .config_reg = LCC_PLL0_CONFIG_REG,
6234 .mode_reg = LCC_PLL0_MODE_REG,
6235};
Tianyi Gou41515e22011-09-01 19:37:43 -07006236
Matt Wagantall86e03822011-12-12 10:59:24 -08006237static struct pll_config pll4_config_393 __initdata = {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006238 .l = 0xE,
6239 .m = 0x27A,
6240 .n = 0x465,
6241 .vco_val = 0x0,
6242 .vco_mask = BM(17, 16),
6243 .pre_div_val = 0x0,
6244 .pre_div_mask = BIT(19),
6245 .post_div_val = 0x0,
6246 .post_div_mask = BM(21, 20),
6247 .mn_ena_val = BIT(22),
6248 .mn_ena_mask = BIT(22),
6249 .main_output_val = BIT(23),
6250 .main_output_mask = BIT(23),
6251};
Tianyi Gou41515e22011-09-01 19:37:43 -07006252
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006253static struct pll_config_regs pll15_regs __initdata = {
6254 .l_reg = MM_PLL3_L_VAL_REG,
6255 .m_reg = MM_PLL3_M_VAL_REG,
6256 .n_reg = MM_PLL3_N_VAL_REG,
6257 .config_reg = MM_PLL3_CONFIG_REG,
6258 .mode_reg = MM_PLL3_MODE_REG,
6259};
Tianyi Gou358c3862011-10-18 17:03:41 -07006260
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006261static struct pll_config pll15_config __initdata = {
6262 .l = (0x24 | BVAL(31, 7, 0x620)),
6263 .m = 0x1,
6264 .n = 0x9,
6265 .vco_val = BVAL(17, 16, 0x2),
6266 .vco_mask = BM(17, 16),
6267 .pre_div_val = 0x0,
6268 .pre_div_mask = BIT(19),
6269 .post_div_val = 0x0,
6270 .post_div_mask = BM(21, 20),
6271 .mn_ena_val = BIT(22),
6272 .mn_ena_mask = BIT(22),
6273 .main_output_val = BIT(23),
6274 .main_output_mask = BIT(23),
6275};
Tianyi Gou41515e22011-09-01 19:37:43 -07006276
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006277static struct pll_config_regs pll14_regs __initdata = {
6278 .l_reg = BB_PLL14_L_VAL_REG,
6279 .m_reg = BB_PLL14_M_VAL_REG,
6280 .n_reg = BB_PLL14_N_VAL_REG,
6281 .config_reg = BB_PLL14_CONFIG_REG,
6282 .mode_reg = BB_PLL14_MODE_REG,
6283};
6284
6285static struct pll_config pll14_config __initdata = {
6286 .l = (0x11 | BVAL(31, 7, 0x620)),
6287 .m = 0x7,
6288 .n = 0x9,
6289 .vco_val = 0x0,
6290 .vco_mask = BM(17, 16),
6291 .pre_div_val = 0x0,
6292 .pre_div_mask = BIT(19),
6293 .post_div_val = 0x0,
6294 .post_div_mask = BM(21, 20),
6295 .mn_ena_val = BIT(22),
6296 .mn_ena_mask = BIT(22),
6297 .main_output_val = BIT(23),
6298 .main_output_mask = BIT(23),
6299};
Tianyi Gou41515e22011-09-01 19:37:43 -07006300
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006301static void __init reg_init(void)
6302{
Stephen Boydd471e7a2011-11-19 01:37:39 -08006303 void __iomem *imem_reg;
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006304
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006305 /* Deassert MM SW_RESET_ALL signal. */
6306 writel_relaxed(0, SW_RESET_ALL_REG);
6307
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006308 /*
Tianyi Goue3d4f542012-03-15 17:06:45 -07006309 * Some bits are only used on 8960 or 8064 or 8930 and are marked as
6310 * reserved bits on the other SoCs. Writing to these reserved bits
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006311 * should have no effect.
6312 */
Stephen Boydd471e7a2011-11-19 01:37:39 -08006313 /*
6314 * Initialize MM AHB registers: Enable the FPB clock and disable HW
Patrick Dalye6f489042012-07-11 15:29:15 -07006315 * gating on 8627 and 8960 for all clocks. Also set VFE_AHB's
Stephen Boydd471e7a2011-11-19 01:37:39 -08006316 * FORCE_CORE_ON bit to prevent its memory from being collapsed when
6317 * the clock is halted. The sleep and wake-up delays are set to safe
6318 * values.
6319 */
Patrick Dalye6f489042012-07-11 15:29:15 -07006320 if (cpu_is_msm8627() || cpu_is_msm8960ab()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006321 rmwreg(0x00000003, AHB_EN_REG, 0x6C000103);
6322 writel_relaxed(0x000007F9, AHB_EN2_REG);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006323 } else {
David Garibaldif69836a2012-08-17 16:05:22 -07006324 rmwreg(0x40000000, AHB_EN_REG, 0x6C000103);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006325 writel_relaxed(0x3C7097F9, AHB_EN2_REG);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006326 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006327
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006328 if (cpu_is_apq8064() || cpu_is_apq8064ab())
Tianyi Gouf3095ea2012-05-22 14:16:06 -07006329 rmwreg(0x00000001, AHB_EN3_REG, 0x00000001);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006330
6331 /* Deassert all locally-owned MM AHB resets. */
6332 rmwreg(0, SW_RESET_AHB_REG, 0xFFF7DFFF);
Tianyi Gou41515e22011-09-01 19:37:43 -07006333 rmwreg(0, SW_RESET_AHB2_REG, 0x0000000F);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006334
6335 /* Initialize MM AXI registers: Enable HW gating for all clocks that
6336 * support it. Also set FORCE_CORE_ON bits, and any sleep and wake-up
6337 * delays to safe values. */
Patrick Dalye6f489042012-07-11 15:29:15 -07006338 if (cpu_is_msm8960ab() || (cpu_is_msm8960() &&
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006339 SOCINFO_VERSION_MAJOR(socinfo_get_version()) < 3) ||
6340 cpu_is_msm8627()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006341 rmwreg(0x000007F9, MAXI_EN_REG, 0x0803FFFF);
6342 rmwreg(0x3027FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006343 } else {
6344 rmwreg(0x0003AFF9, MAXI_EN_REG, 0x0803FFFF);
6345 rmwreg(0x3A27FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006346 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006347
Matt Wagantall53d968f2011-07-19 13:22:53 -07006348 rmwreg(0x0027FCFF, MAXI_EN3_REG, 0x003FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006349 rmwreg(0x0027FCFF, MAXI_EN4_REG, 0x017FFFFF);
6350
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006351 if (cpu_is_apq8064() || cpu_is_apq8064ab())
Tianyi Gouf3095ea2012-05-22 14:16:06 -07006352 rmwreg(0x019FECFF, MAXI_EN5_REG, 0x01FFEFFF);
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006353 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006354 rmwreg(0x000004FF, MAXI_EN5_REG, 0x00000FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006355 if (cpu_is_msm8960ab())
6356 rmwreg(0x009FE000, MAXI_EN5_REG, 0x01FFE000);
6357
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006358 if (cpu_is_msm8627())
Stephen Boydd471e7a2011-11-19 01:37:39 -08006359 rmwreg(0x000003C7, SAXI_EN_REG, 0x00003FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006360 else if (cpu_is_msm8960ab())
6361 rmwreg(0x000001C6, SAXI_EN_REG, 0x00001DF6);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006362 else
6363 rmwreg(0x00003C38, SAXI_EN_REG, 0x00003FFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006364
6365 /* Enable IMEM's clk_on signal */
6366 imem_reg = ioremap(0x04b00040, 4);
6367 if (imem_reg) {
6368 writel_relaxed(0x3, imem_reg);
6369 iounmap(imem_reg);
6370 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006371
6372 /* Initialize MM CC registers: Set MM FORCE_CORE_ON bits so that core
6373 * memories retain state even when not clocked. Also, set sleep and
6374 * wake-up delays to safe values. */
Matt Wagantall53d968f2011-07-19 13:22:53 -07006375 rmwreg(0x00000000, CSI0_CC_REG, 0x00000410);
6376 rmwreg(0x00000000, CSI1_CC_REG, 0x00000410);
6377 rmwreg(0x80FF0000, DSI1_BYTE_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006378 rmwreg(0x80FF0000, DSI_PIXEL_CC_REG, 0xE0FF0010);
Tarun Karra6fbc00a2011-12-13 09:23:47 -07006379 rmwreg(0xC0FF0000, GFX3D_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006380 rmwreg(0x80FF0000, IJPEG_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006381 rmwreg(0x80FF0000, MDP_CC_REG, 0xE1FF0010);
6382 rmwreg(0x80FF0000, MDP_LUT_CC_REG, 0xE0FF0010);
6383 rmwreg(0x80FF0000, ROT_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006384 rmwreg(0x000004FF, TV_CC2_REG, 0x000007FF);
6385 rmwreg(0xC0FF0000, VCODEC_CC_REG, 0xE0FF0010);
6386 rmwreg(0x80FF0000, VFE_CC_REG, 0xE0FF4010);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006387 rmwreg(0x800000FF, VFE_CC2_REG, 0xE00000FF);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006388 rmwreg(0x80FF0000, VPE_CC_REG, 0xE0FF0010);
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006389 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_apq8064()
6390 || cpu_is_apq8064ab()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006391 rmwreg(0x80FF0000, DSI2_BYTE_CC_REG, 0xE0FF0010);
6392 rmwreg(0x80FF0000, DSI2_PIXEL_CC_REG, 0xE0FF0010);
6393 rmwreg(0x80FF0000, JPEGD_CC_REG, 0xE0FF0010);
6394 }
Patrick Dalye6f489042012-07-11 15:29:15 -07006395 if (cpu_is_msm8960ab())
6396 rmwreg(0x00000001, DSI2_PIXEL_CC2_REG, 0x00000001);
6397
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006398 if (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm8930aa() ||
6399 cpu_is_msm8627())
Patrick Dalye6f489042012-07-11 15:29:15 -07006400 rmwreg(0x80FF0000, TV_CC_REG, 0xE1FFC010);
6401 if (cpu_is_msm8960ab())
6402 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Goue3d4f542012-03-15 17:06:45 -07006403
6404 if (cpu_is_msm8960()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006405 rmwreg(0x80FF0000, GFX2D0_CC_REG, 0xE0FF0010);
6406 rmwreg(0x80FF0000, GFX2D1_CC_REG, 0xE0FF0010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006407 }
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006408 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006409 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Gou621f8742011-09-01 21:45:01 -07006410 rmwreg(0x80FF0000, VCAP_CC_REG, 0xE0FF1010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006411 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006412
Tianyi Gou41515e22011-09-01 19:37:43 -07006413 /*
6414 * Initialize USB_HS_HCLK_FS registers: Set FORCE_C_ON bits so that
6415 * core remain active during halt state of the clk. Also, set sleep
6416 * and wake-up value to max.
6417 */
6418 rmwreg(0x0000004F, USB_HS1_HCLK_FS_REG, 0x0000007F);
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006419 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006420 rmwreg(0x0000004F, USB_HS3_HCLK_FS_REG, 0x0000007F);
6421 rmwreg(0x0000004F, USB_HS4_HCLK_FS_REG, 0x0000007F);
6422 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006423
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006424 /* De-assert MM AXI resets to all hardware blocks. */
6425 writel_relaxed(0, SW_RESET_AXI_REG);
6426
6427 /* Deassert all MM core resets. */
6428 writel_relaxed(0, SW_RESET_CORE_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006429 writel_relaxed(0, SW_RESET_CORE2_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006430
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006431 /* Enable TSSC and PDM PXO sources. */
6432 writel_relaxed(BIT(11), TSSC_CLK_CTL_REG);
6433 writel_relaxed(BIT(15), PDM_CLK_NS_REG);
6434
6435 /* Source SLIMBus xo src from slimbus reference clock */
Patrick Dalye6f489042012-07-11 15:29:15 -07006436 if (cpu_is_msm8960ab() || cpu_is_msm8960())
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006437 writel_relaxed(0x3, SLIMBUS_XO_SRC_CLK_CTL_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006438
6439 /* Source the dsi_byte_clks from the DSI PHY PLLs */
6440 rmwreg(0x1, DSI1_BYTE_NS_REG, 0x7);
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006441 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_apq8064()
6442 || cpu_is_apq8064ab())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006443 rmwreg(0x2, DSI2_BYTE_NS_REG, 0x7);
Tianyi Gou41515e22011-09-01 19:37:43 -07006444
Siddhartha Agrawal482459c2012-05-24 15:28:53 -07006445 /* Source the dsi1_esc_clk from the DSI1 PHY PLLs */
6446 rmwreg(0x1, DSI1_ESC_NS_REG, 0x7);
6447
Tianyi Gou352955d2012-05-18 19:44:01 -07006448 /*
6449 * Source the sata_phy_ref_clk from PXO and set predivider of
6450 * sata_pmalive_clk to 1.
6451 */
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006452 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Tianyi Gou41515e22011-09-01 19:37:43 -07006453 rmwreg(0, SATA_PHY_REF_CLK_CTL_REG, 0x1);
Tianyi Gou352955d2012-05-18 19:44:01 -07006454 rmwreg(0, SATA_PMALIVE_CLK_CTL_REG, 0x3);
6455 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006456
6457 /*
Tianyi Gou05e01102012-02-08 22:15:49 -08006458 * TODO: Programming below PLLs and prng_clk is temporary and
6459 * needs to be removed after bootloaders program them.
Tianyi Gou41515e22011-09-01 19:37:43 -07006460 */
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006461 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Tianyi Gou317aa862012-02-06 14:31:07 -08006462 u32 is_pll_enabled;
Tianyi Gou41515e22011-09-01 19:37:43 -07006463
6464 /* Program pxo_src_clk to source from PXO */
6465 rmwreg(0x1, PXO_SRC_CLK_CTL_REG, 0x7);
6466
Tianyi Gou41515e22011-09-01 19:37:43 -07006467 /* Check if PLL14 is active */
6468 is_pll_enabled = readl_relaxed(BB_PLL14_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006469 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006470 /* Ref clk = 27MHz and program pll14 to 480MHz */
Vikram Mulukutla6da35d32012-07-18 13:55:31 -07006471 configure_sr_pll(&pll14_config, &pll14_regs, 1);
Tianyi Gou621f8742011-09-01 21:45:01 -07006472
Tianyi Gouc29c3242011-10-12 21:02:15 -07006473 /* Check if PLL4 is active */
6474 is_pll_enabled = readl_relaxed(LCC_PLL0_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006475 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006476 /* Ref clk = 27MHz and program pll4 to 393.2160MHz */
Vikram Mulukutla6da35d32012-07-18 13:55:31 -07006477 configure_sr_pll(&pll4_config_393, &pll4_regs, 1);
Tianyi Gouc29c3242011-10-12 21:02:15 -07006478
6479 /* Enable PLL4 source on the LPASS Primary PLL Mux */
6480 writel_relaxed(0x1, LCC_PRI_PLL_CLK_CTL_REG);
Tianyi Gou05e01102012-02-08 22:15:49 -08006481
6482 /* Program prng_clk to 64MHz if it isn't configured */
6483 if (!readl_relaxed(PRNG_CLK_NS_REG))
6484 writel_relaxed(0x2B, PRNG_CLK_NS_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006485 }
Tianyi Gou65c536a2012-03-20 23:20:29 -07006486
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006487 if (cpu_is_apq8064()) {
6488 /* Program PLL15 to 975MHz with ref clk = 27MHz */
6489 configure_sr_pll(&pll15_config, &pll15_regs, 0);
6490 } else if (cpu_is_apq8064ab()) {
6491 /* Program PLL15 to 900MHZ */
6492 pll15_config.l = 0x21 | BVAL(31, 7, 0x620);
6493 pll15_config.m = 0x1;
6494 pll15_config.n = 0x3;
6495 configure_sr_pll(&pll15_config, &pll15_regs, 0);
6496 }
6497
Tianyi Gou65c536a2012-03-20 23:20:29 -07006498 /*
6499 * Program PLL15 to 900MHz with ref clk = 27MHz and
6500 * only enable PLL main output.
6501 */
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006502 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006503 pll15_config.l = 0x21 | BVAL(31, 7, 0x600);
6504 pll15_config.m = 0x1;
6505 pll15_config.n = 0x3;
Vikram Mulukutla6da35d32012-07-18 13:55:31 -07006506 configure_sr_pll(&pll15_config, &pll15_regs, 0);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006507 /* Disable AUX and BIST outputs */
6508 writel_relaxed(0, MM_PLL3_TEST_CTL_REG);
Tianyi Gou65c536a2012-03-20 23:20:29 -07006509 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006510}
6511
Patrick Dalye6f489042012-07-11 15:29:15 -07006512struct clock_init_data msm8960_clock_init_data __initdata;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006513static void __init msm8960_clock_pre_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006514{
Matt Wagantall86e03822011-12-12 10:59:24 -08006515 /* Initialize clock registers. */
6516 reg_init();
6517
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006518 if (cpu_is_apq8064() || cpu_is_apq8064ab())
Matt Wagantall82feaa12012-07-09 10:54:49 -07006519 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8064;
Tianyi Goubf3d0b12012-01-23 14:37:28 -08006520
Matt Wagantall86e03822011-12-12 10:59:24 -08006521 /* Detect PLL4 programmed for alternate 491.52MHz clock plan. */
6522 if (readl_relaxed(LCC_PLL0_L_VAL_REG) == 0x12) {
6523 pll4_clk.c.rate = 491520000;
6524 audio_slimbus_clk.freq_tbl = clk_tbl_aif_osr_492;
6525 mi2s_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6526 codec_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6527 spare_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6528 codec_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6529 spare_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6530 pcm_clk.freq_tbl = clk_tbl_pcm_492;
6531 }
6532
Patrick Dalye6f489042012-07-11 15:29:15 -07006533 if (cpu_is_msm8960() || cpu_is_msm8960ab())
6534 memcpy(msm_clocks_8960, msm_clocks_8960_common,
6535 sizeof(msm_clocks_8960_common));
6536 if (cpu_is_msm8960ab()) {
6537 pll3_clk.c.rate = 650000000;
6538 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8960ab;
6539 gfx3d_clk.c.fmax[VDD_DIG_LOW] = 192000000;
6540 gfx3d_clk.c.fmax[VDD_DIG_NOMINAL] = 325000000;
6541 gfx3d_clk.c.fmax[VDD_DIG_HIGH] = 400000000;
6542 mdp_clk.freq_tbl = clk_tbl_mdp_8960ab;
6543 mdp_clk.c.fmax[VDD_DIG_LOW] = 128000000;
6544 mdp_clk.c.fmax[VDD_DIG_NOMINAL] = 266667000;
6545
6546 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6547 msm_clocks_8960ab_only, sizeof(msm_clocks_8960ab_only));
6548 msm8960_clock_init_data.size -=
6549 ARRAY_SIZE(msm_clocks_8960_only);
Joel King9af070b2012-08-19 22:32:14 -07006550
6551 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Patrick Dalye6f489042012-07-11 15:29:15 -07006552 } else if (cpu_is_msm8960()) {
6553 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6554 msm_clocks_8960_only, sizeof(msm_clocks_8960_only));
6555 msm8960_clock_init_data.size -=
6556 ARRAY_SIZE(msm_clocks_8960ab_only);
6557 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006558 /*
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006559 * Change the freq tables for and voltage requirements for
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006560 * clocks which differ between chips.
Tianyi Gou41515e22011-09-01 19:37:43 -07006561 */
6562 if (cpu_is_apq8064()) {
6563 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8064;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006564
6565 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8064,
6566 sizeof(gfx3d_clk.c.fmax));
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006567 }
6568 if (cpu_is_apq8064ab()) {
6569 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8064;
6570
6571 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8064ab,
6572 sizeof(gfx3d_clk.c.fmax));
6573 }
6574 if ((cpu_is_apq8064() &&
6575 SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) ||
6576 cpu_is_apq8064ab()) {
6577
6578 memcpy(vcodec_clk.c.fmax, fmax_vcodec_8064v2,
6579 sizeof(vcodec_clk.c.fmax));
6580 memcpy(ce3_src_clk.c.fmax, fmax_ce3_8064v2,
6581 sizeof(ce3_src_clk.c.fmax));
6582 memcpy(sdc1_clk.c.fmax, fmax_sdc1_8064v2,
6583 sizeof(sdc1_clk.c.fmax));
6584 }
6585 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006586 memcpy(ijpeg_clk.c.fmax, fmax_ijpeg_8064,
6587 sizeof(ijpeg_clk.c.fmax));
6588 memcpy(mdp_clk.c.fmax, fmax_mdp_8064,
6589 sizeof(ijpeg_clk.c.fmax));
6590 memcpy(tv_src_clk.c.fmax, fmax_tv_src_8064,
6591 sizeof(tv_src_clk.c.fmax));
6592 memcpy(vfe_clk.c.fmax, fmax_vfe_8064,
6593 sizeof(vfe_clk.c.fmax));
6594
Patrick Dalye6f489042012-07-11 15:29:15 -07006595 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Tianyi Goue3d4f542012-03-15 17:06:45 -07006596 }
6597
6598 /*
6599 * Change the freq tables and voltage requirements for
6600 * clocks which differ between 8960 and 8930.
6601 */
Patrick Dalyebe63c52012-08-07 15:41:30 -07006602 if (cpu_is_msm8930() || cpu_is_msm8627()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006603 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8930,
6604 sizeof(gfx3d_clk.c.fmax));
Patrick Dalyebe63c52012-08-07 15:41:30 -07006605 } else if (cpu_is_msm8930aa()) {
6606 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8930aa,
6607 sizeof(gfx3d_clk.c.fmax));
6608 }
6609 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
6610 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8930;
Tianyi Goue3d4f542012-03-15 17:06:45 -07006611 pll15_clk.c.rate = 900000000;
6612 gmem_axi_clk.c.depends = &gfx3d_axi_clk_8930.c;
Tianyi Gou41515e22011-09-01 19:37:43 -07006613 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07006614 if ((readl_relaxed(PRNG_CLK_NS_REG) & 0x7F) == 0x2B)
6615 prng_clk.freq_tbl = clk_tbl_prng_64;
Stephen Boyd94625ef2011-07-12 17:06:01 -07006616
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006617 vote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006618
Vikram Mulukutla681d8682012-03-09 23:56:20 -08006619 clk_ops_local_pll.enable = sr_pll_clk_enable;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006620}
6621
Patrick Daly1a3859f2012-08-27 16:10:26 -07006622static void __init msm8930_pm8917_clock_pre_init(void)
6623{
6624 /* detect pmic8917 from board file, and call this init function */
6625
6626 vdd_dig.set_vdd = set_vdd_dig_8930;
6627 rpm_vreg_dig_8930 = RPM_VREG_ID_PM8917_VDD_DIG_CORNER;
6628 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930_pm8917;
6629
6630 msm8960_clock_pre_init();
6631}
6632
6633static void __init msm8930_clock_pre_init(void)
6634{
6635 vdd_dig.set_vdd = set_vdd_dig_8930;
6636 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930;
6637
6638 msm8960_clock_pre_init();
6639}
6640
Matt Wagantallb64888f2012-04-02 21:35:07 -07006641static void __init msm8960_clock_post_init(void)
6642{
6643 /* Keep PXO on whenever APPS cpu is active */
6644 clk_prepare_enable(&pxo_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006645
Matt Wagantalle655cd72012-04-09 10:15:03 -07006646 /* Reset 3D core while clocked to ensure it resets completely. */
6647 clk_set_rate(&gfx3d_clk.c, 27000000);
6648 clk_prepare_enable(&gfx3d_clk.c);
6649 clk_reset(&gfx3d_clk.c, CLK_RESET_ASSERT);
6650 udelay(5);
6651 clk_reset(&gfx3d_clk.c, CLK_RESET_DEASSERT);
6652 clk_disable_unprepare(&gfx3d_clk.c);
6653
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006654 /* Initialize rates for clocks that only support one. */
6655 clk_set_rate(&pdm_clk.c, 27000000);
Stephen Boyd842a1f62012-04-26 19:07:38 -07006656 clk_set_rate(&prng_clk.c, prng_clk.freq_tbl->freq_hz);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006657 clk_set_rate(&mdp_vsync_clk.c, 27000000);
6658 clk_set_rate(&tsif_ref_clk.c, 105000);
6659 clk_set_rate(&tssc_clk.c, 27000000);
6660 clk_set_rate(&usb_hs1_xcvr_clk.c, 60000000);
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006661 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Tianyi Gou41515e22011-09-01 19:37:43 -07006662 clk_set_rate(&usb_hs3_xcvr_clk.c, 60000000);
6663 clk_set_rate(&usb_hs4_xcvr_clk.c, 60000000);
6664 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006665 clk_set_rate(&usb_fs1_src_clk.c, 60000000);
Patrick Dalye6f489042012-07-11 15:29:15 -07006666 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_msm8930() ||
6667 cpu_is_msm8930aa() || cpu_is_msm8627())
Tianyi Gou41515e22011-09-01 19:37:43 -07006668 clk_set_rate(&usb_fs2_src_clk.c, 60000000);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006669 clk_set_rate(&usb_hsic_xcvr_fs_clk.c, 60000000);
6670 clk_set_rate(&usb_hsic_hsic_src_clk.c, 480000000);
6671 clk_set_rate(&usb_hsic_hsio_cal_clk.c, 9000000);
Lena Salman127823f2012-02-14 17:13:53 +02006672 clk_set_rate(&usb_hsic_system_clk.c, 60000000);
Stephen Boyd092fd182011-10-21 15:56:30 -07006673 /*
6674 * Set the CSI rates to a safe default to avoid warnings when
6675 * switching csi pix and rdi clocks.
6676 */
6677 clk_set_rate(&csi0_src_clk.c, 27000000);
6678 clk_set_rate(&csi1_src_clk.c, 27000000);
6679 clk_set_rate(&csi2_src_clk.c, 27000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006680
6681 /*
Stephen Boyd60496bb2011-10-17 13:51:37 -07006682 * The halt status bits for these clocks may be incorrect at boot.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006683 * Toggle these clocks on and off to refresh them.
6684 */
Stephen Boyd409b8b42012-04-10 12:12:56 -07006685 clk_prepare_enable(&pdm_clk.c);
6686 clk_disable_unprepare(&pdm_clk.c);
6687 clk_prepare_enable(&tssc_clk.c);
6688 clk_disable_unprepare(&tssc_clk.c);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006689 clk_prepare_enable(&usb_hsic_hsic_clk.c);
6690 clk_disable_unprepare(&usb_hsic_hsic_clk.c);
Stephen Boydd7a143a2012-02-16 17:59:26 -08006691
6692 /*
6693 * Keep sfab floor @ 54MHz so that Krait AHB is at least 27MHz at all
6694 * times when Apps CPU is active. This ensures the timer's requirement
6695 * of Krait AHB running 4 times as fast as the timer itself.
6696 */
6697 clk_set_rate(&sfab_tmr_a_clk.c, 54000000);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006698 clk_prepare_enable(&sfab_tmr_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006699}
6700
Stephen Boydbb600ae2011-08-02 20:11:40 -07006701static int __init msm8960_clock_late_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006702{
Stephen Boyda3787f32011-09-16 18:55:13 -07006703 int rc;
6704 struct clk *mmfpb_a_clk = clk_get_sys("clock-8960", "mmfpb_a_clk");
Stephen Boyd85436132011-09-16 18:55:13 -07006705 struct clk *cfpb_a_clk = clk_get_sys("clock-8960", "cfpb_a_clk");
Stephen Boyda3787f32011-09-16 18:55:13 -07006706
6707 /* Vote for MMFPB to be at least 76.8MHz when an Apps CPU is active. */
6708 if (WARN(IS_ERR(mmfpb_a_clk), "mmfpb_a_clk not found (%ld)\n",
6709 PTR_ERR(mmfpb_a_clk)))
6710 return PTR_ERR(mmfpb_a_clk);
Matt Wagantallde555f562011-11-08 14:18:07 -08006711 rc = clk_set_rate(mmfpb_a_clk, 76800000);
Stephen Boyda3787f32011-09-16 18:55:13 -07006712 if (WARN(rc, "mmfpb_a_clk rate was not set (%d)\n", rc))
6713 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006714 rc = clk_prepare_enable(mmfpb_a_clk);
Stephen Boyda3787f32011-09-16 18:55:13 -07006715 if (WARN(rc, "mmfpb_a_clk not enabled (%d)\n", rc))
6716 return rc;
6717
Stephen Boyd85436132011-09-16 18:55:13 -07006718 /* Vote for CFPB to be at least 64MHz when an Apps CPU is active. */
6719 if (WARN(IS_ERR(cfpb_a_clk), "cfpb_a_clk not found (%ld)\n",
6720 PTR_ERR(cfpb_a_clk)))
6721 return PTR_ERR(cfpb_a_clk);
Matt Wagantallde555f562011-11-08 14:18:07 -08006722 rc = clk_set_rate(cfpb_a_clk, 64000000);
Stephen Boyd85436132011-09-16 18:55:13 -07006723 if (WARN(rc, "cfpb_a_clk rate was not set (%d)\n", rc))
6724 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006725 rc = clk_prepare_enable(cfpb_a_clk);
Stephen Boyd85436132011-09-16 18:55:13 -07006726 if (WARN(rc, "cfpb_a_clk not enabled (%d)\n", rc))
6727 return rc;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006728
6729 return unvote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006730}
Stephen Boydbb600ae2011-08-02 20:11:40 -07006731
6732struct clock_init_data msm8960_clock_init_data __initdata = {
6733 .table = msm_clocks_8960,
6734 .size = ARRAY_SIZE(msm_clocks_8960),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006735 .pre_init = msm8960_clock_pre_init,
6736 .post_init = msm8960_clock_post_init,
Stephen Boydbb600ae2011-08-02 20:11:40 -07006737 .late_init = msm8960_clock_late_init,
6738};
Tianyi Gou41515e22011-09-01 19:37:43 -07006739
6740struct clock_init_data apq8064_clock_init_data __initdata = {
6741 .table = msm_clocks_8064,
6742 .size = ARRAY_SIZE(msm_clocks_8064),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006743 .pre_init = msm8960_clock_pre_init,
6744 .post_init = msm8960_clock_post_init,
Tianyi Gou41515e22011-09-01 19:37:43 -07006745 .late_init = msm8960_clock_late_init,
6746};
Tianyi Goue3d4f542012-03-15 17:06:45 -07006747
6748struct clock_init_data msm8930_clock_init_data __initdata = {
6749 .table = msm_clocks_8930,
6750 .size = ARRAY_SIZE(msm_clocks_8930),
Patrick Daly1a3859f2012-08-27 16:10:26 -07006751 .pre_init = msm8930_clock_pre_init,
6752 .post_init = msm8960_clock_post_init,
6753 .late_init = msm8960_clock_late_init,
6754};
6755
6756struct clock_init_data msm8930_pm8917_clock_init_data __initdata = {
6757 .table = msm_clocks_8930,
6758 .size = ARRAY_SIZE(msm_clocks_8930),
6759 .pre_init = msm8930_pm8917_clock_pre_init,
Matt Wagantallb64888f2012-04-02 21:35:07 -07006760 .post_init = msm8960_clock_post_init,
Tianyi Goue3d4f542012-03-15 17:06:45 -07006761 .late_init = msm8960_clock_late_init,
6762};