blob: 3c417c32e433fd5d6b17c4aa193ab62cbd0c2739 [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,
Saravana Kannan55e959d2012-10-15 22:16:04 -0700379 VDD_DIG_HIGH,
380 VDD_DIG_NUM
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700381};
382
Saravana Kannan298ec392012-02-08 19:21:47 -0800383static int set_vdd_dig_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700384{
385 static const int vdd_uv[] = {
386 [VDD_DIG_NONE] = 0,
387 [VDD_DIG_LOW] = 945000,
388 [VDD_DIG_NOMINAL] = 1050000,
389 [VDD_DIG_HIGH] = 1150000
390 };
Saravana Kannan298ec392012-02-08 19:21:47 -0800391 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S3, RPM_VREG_VOTER3,
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700392 vdd_uv[level], 1150000, 1);
393}
394
Saravana Kannan55e959d2012-10-15 22:16:04 -0700395static DEFINE_VDD_CLASS(vdd_dig, set_vdd_dig_8960, VDD_DIG_NUM);
Saravana Kannan298ec392012-02-08 19:21:47 -0800396
Patrick Daly1a3859f2012-08-27 16:10:26 -0700397static int rpm_vreg_dig_8930 = RPM_VREG_ID_PM8038_VDD_DIG_CORNER;
Saravana Kannan298ec392012-02-08 19:21:47 -0800398static int set_vdd_dig_8930(struct clk_vdd_class *vdd_class, int level)
399{
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800400 static const int vdd_corner[] = {
401 [VDD_DIG_NONE] = RPM_VREG_CORNER_NONE,
402 [VDD_DIG_LOW] = RPM_VREG_CORNER_LOW,
403 [VDD_DIG_NOMINAL] = RPM_VREG_CORNER_NOMINAL,
404 [VDD_DIG_HIGH] = RPM_VREG_CORNER_HIGH,
Saravana Kannan298ec392012-02-08 19:21:47 -0800405 };
Patrick Daly1a3859f2012-08-27 16:10:26 -0700406 return rpm_vreg_set_voltage(rpm_vreg_dig_8930,
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800407 RPM_VREG_VOTER3,
408 vdd_corner[level],
409 RPM_VREG_CORNER_HIGH, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800410}
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700411
412#define VDD_DIG_FMAX_MAP1(l1, f1) \
Saravana Kannan55e959d2012-10-15 22:16:04 -0700413 .vdd_class = &vdd_dig, \
414 .fmax = (unsigned long[VDD_DIG_NUM]) { \
415 [VDD_DIG_##l1] = (f1), \
416 }, \
417 .num_fmax = VDD_DIG_NUM
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700418#define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \
Saravana Kannan55e959d2012-10-15 22:16:04 -0700419 .vdd_class = &vdd_dig, \
420 .fmax = (unsigned long[VDD_DIG_NUM]) { \
421 [VDD_DIG_##l1] = (f1), \
422 [VDD_DIG_##l2] = (f2), \
423 }, \
424 .num_fmax = VDD_DIG_NUM
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700425#define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \
Saravana Kannan55e959d2012-10-15 22:16:04 -0700426 .vdd_class = &vdd_dig, \
427 .fmax = (unsigned long[VDD_DIG_NUM]) { \
428 [VDD_DIG_##l1] = (f1), \
429 [VDD_DIG_##l2] = (f2), \
430 [VDD_DIG_##l3] = (f3), \
431 }, \
432 .num_fmax = VDD_DIG_NUM
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700433
Matt Wagantall82feaa12012-07-09 10:54:49 -0700434enum vdd_sr2_hdmi_pll_levels {
435 VDD_SR2_HDMI_PLL_OFF,
Saravana Kannan55e959d2012-10-15 22:16:04 -0700436 VDD_SR2_HDMI_PLL_ON,
437 VDD_SR2_HDMI_PLL_NUM
Matt Wagantallc57577d2011-10-06 17:06:53 -0700438};
439
Matt Wagantall82feaa12012-07-09 10:54:49 -0700440static int set_vdd_sr2_hdmi_pll_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantallc57577d2011-10-06 17:06:53 -0700441{
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800442 int rc = 0;
Saravana Kannan298ec392012-02-08 19:21:47 -0800443
Matt Wagantall82feaa12012-07-09 10:54:49 -0700444 if (level == VDD_SR2_HDMI_PLL_OFF) {
Saravana Kannan298ec392012-02-08 19:21:47 -0800445 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
446 RPM_VREG_VOTER3, 0, 0, 1);
447 if (rc)
448 return rc;
449 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
450 RPM_VREG_VOTER3, 0, 0, 1);
451 if (rc)
452 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
453 RPM_VREG_VOTER3, 1800000, 1800000, 1);
Tianyi Goue1faaf22012-01-24 16:07:19 -0800454 } else {
Saravana Kannan298ec392012-02-08 19:21:47 -0800455 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
David Collins9a81d6c2012-03-29 15:11:33 -0700456 RPM_VREG_VOTER3, 2050000, 2100000, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800457 if (rc)
458 return rc;
459 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
460 RPM_VREG_VOTER3, 1800000, 1800000, 1);
461 if (rc)
462 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800463 RPM_VREG_VOTER3, 0, 0, 1);
Matt Wagantallc57577d2011-10-06 17:06:53 -0700464 }
465
466 return rc;
467}
468
Saravana Kannan55e959d2012-10-15 22:16:04 -0700469static DEFINE_VDD_CLASS(vdd_sr2_hdmi_pll, set_vdd_sr2_hdmi_pll_8960,
470 VDD_SR2_HDMI_PLL_NUM);
Saravana Kannan298ec392012-02-08 19:21:47 -0800471
472static int sr2_lreg_uv[] = {
Matt Wagantall82feaa12012-07-09 10:54:49 -0700473 [VDD_SR2_HDMI_PLL_OFF] = 0,
474 [VDD_SR2_HDMI_PLL_ON] = 1800000,
Saravana Kannan298ec392012-02-08 19:21:47 -0800475};
476
Matt Wagantall82feaa12012-07-09 10:54:49 -0700477static int set_vdd_sr2_hdmi_pll_8064(struct clk_vdd_class *vdd_class, int level)
Saravana Kannan298ec392012-02-08 19:21:47 -0800478{
479 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_LVS7, RPM_VREG_VOTER3,
480 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
481}
482
Patrick Daly1a3859f2012-08-27 16:10:26 -0700483static int set_vdd_sr2_hdmi_pll_8930_pm8917(struct clk_vdd_class *vdd_class,
484 int level)
485{
486 int rc = 0;
487
488 if (level == VDD_SR2_HDMI_PLL_OFF) {
489 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
490 RPM_VREG_VOTER3, 0, 0, 1);
491 if (rc)
492 return rc;
493 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
494 RPM_VREG_VOTER3, 0, 0, 1);
495 if (rc)
496 rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
497 RPM_VREG_VOTER3, 1800000, 1800000, 1);
498 } else {
499 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
500 RPM_VREG_VOTER3, 2050000, 2100000, 1);
501 if (rc)
502 return rc;
503 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
504 RPM_VREG_VOTER3, 1800000, 1800000, 1);
505 if (rc)
506 rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
507 RPM_VREG_VOTER3, 0, 0, 1);
508 }
509
510 return rc;
511}
512
Matt Wagantall82feaa12012-07-09 10:54:49 -0700513static int set_vdd_sr2_hdmi_pll_8930(struct clk_vdd_class *vdd_class, int level)
Saravana Kannan298ec392012-02-08 19:21:47 -0800514{
515 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8038_L23, RPM_VREG_VOTER3,
516 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
517}
Matt Wagantallc57577d2011-10-06 17:06:53 -0700518
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700519/*
520 * Clock Descriptions
521 */
522
Stephen Boyd72a80352012-01-26 15:57:38 -0800523DEFINE_CLK_RPM_BRANCH(pxo_clk, pxo_a_clk, PXO, 27000000);
524DEFINE_CLK_RPM_BRANCH(cxo_clk, cxo_a_clk, CXO, 19200000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700525
526static struct pll_clk pll2_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700527 .mode_reg = MM_PLL1_MODE_REG,
528 .parent = &pxo_clk.c,
529 .c = {
530 .dbg_name = "pll2_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800531 .rate = 800000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800532 .ops = &clk_ops_local_pll,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700533 CLK_INIT(pll2_clk.c),
534 },
535};
536
Stephen Boyd94625ef2011-07-12 17:06:01 -0700537static struct pll_clk pll3_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700538 .mode_reg = BB_MMCC_PLL2_MODE_REG,
539 .parent = &pxo_clk.c,
540 .c = {
541 .dbg_name = "pll3_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800542 .rate = 1200000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800543 .ops = &clk_ops_local_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -0700544 .vdd_class = &vdd_sr2_hdmi_pll,
Saravana Kannan55e959d2012-10-15 22:16:04 -0700545 .fmax = (unsigned long[VDD_SR2_HDMI_PLL_NUM]) {
546 [VDD_SR2_HDMI_PLL_ON] = ULONG_MAX
547 },
548 .num_fmax = VDD_SR2_HDMI_PLL_NUM,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700549 CLK_INIT(pll3_clk.c),
550 },
551};
552
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700553static struct pll_vote_clk pll4_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700554 .en_reg = BB_PLL_ENA_SC0_REG,
555 .en_mask = BIT(4),
556 .status_reg = LCC_PLL0_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800557 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700558 .parent = &pxo_clk.c,
559 .c = {
560 .dbg_name = "pll4_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800561 .rate = 393216000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700562 .ops = &clk_ops_pll_vote,
563 CLK_INIT(pll4_clk.c),
564 },
565};
566
567static struct pll_vote_clk pll8_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568 .en_reg = BB_PLL_ENA_SC0_REG,
569 .en_mask = BIT(8),
570 .status_reg = BB_PLL8_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800571 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700572 .parent = &pxo_clk.c,
573 .c = {
574 .dbg_name = "pll8_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800575 .rate = 384000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576 .ops = &clk_ops_pll_vote,
577 CLK_INIT(pll8_clk.c),
578 },
579};
580
Stephen Boyd94625ef2011-07-12 17:06:01 -0700581static struct pll_vote_clk pll14_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700582 .en_reg = BB_PLL_ENA_SC0_REG,
583 .en_mask = BIT(14),
584 .status_reg = BB_PLL14_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800585 .status_mask = BIT(16),
Stephen Boyd94625ef2011-07-12 17:06:01 -0700586 .parent = &pxo_clk.c,
587 .c = {
588 .dbg_name = "pll14_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800589 .rate = 480000000,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700590 .ops = &clk_ops_pll_vote,
591 CLK_INIT(pll14_clk.c),
592 },
593};
594
Tianyi Gou41515e22011-09-01 19:37:43 -0700595static struct pll_clk pll15_clk = {
Tianyi Gou41515e22011-09-01 19:37:43 -0700596 .mode_reg = MM_PLL3_MODE_REG,
597 .parent = &pxo_clk.c,
598 .c = {
599 .dbg_name = "pll15_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800600 .rate = 975000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800601 .ops = &clk_ops_local_pll,
Tianyi Gou41515e22011-09-01 19:37:43 -0700602 CLK_INIT(pll15_clk.c),
603 },
604};
605
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606/* AXI Interfaces */
607static struct branch_clk gmem_axi_clk = {
608 .b = {
609 .ctl_reg = MAXI_EN_REG,
610 .en_mask = BIT(24),
611 .halt_reg = DBG_BUS_VEC_E_REG,
612 .halt_bit = 6,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800613 .retain_reg = MAXI_EN2_REG,
614 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700615 },
616 .c = {
617 .dbg_name = "gmem_axi_clk",
618 .ops = &clk_ops_branch,
619 CLK_INIT(gmem_axi_clk.c),
620 },
621};
622
623static struct branch_clk ijpeg_axi_clk = {
624 .b = {
625 .ctl_reg = MAXI_EN_REG,
626 .en_mask = BIT(21),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800627 .hwcg_reg = MAXI_EN_REG,
628 .hwcg_mask = BIT(11),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700629 .reset_reg = SW_RESET_AXI_REG,
630 .reset_mask = BIT(14),
631 .halt_reg = DBG_BUS_VEC_E_REG,
632 .halt_bit = 4,
633 },
634 .c = {
635 .dbg_name = "ijpeg_axi_clk",
636 .ops = &clk_ops_branch,
637 CLK_INIT(ijpeg_axi_clk.c),
638 },
639};
640
641static struct branch_clk imem_axi_clk = {
642 .b = {
643 .ctl_reg = MAXI_EN_REG,
644 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800645 .hwcg_reg = MAXI_EN_REG,
646 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700647 .reset_reg = SW_RESET_CORE_REG,
648 .reset_mask = BIT(10),
649 .halt_reg = DBG_BUS_VEC_E_REG,
650 .halt_bit = 7,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800651 .retain_reg = MAXI_EN2_REG,
652 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700653 },
654 .c = {
655 .dbg_name = "imem_axi_clk",
656 .ops = &clk_ops_branch,
657 CLK_INIT(imem_axi_clk.c),
658 },
659};
660
661static struct branch_clk jpegd_axi_clk = {
662 .b = {
663 .ctl_reg = MAXI_EN_REG,
664 .en_mask = BIT(25),
665 .halt_reg = DBG_BUS_VEC_E_REG,
666 .halt_bit = 5,
667 },
668 .c = {
669 .dbg_name = "jpegd_axi_clk",
670 .ops = &clk_ops_branch,
671 CLK_INIT(jpegd_axi_clk.c),
672 },
673};
674
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700675static struct branch_clk vcodec_axi_b_clk = {
676 .b = {
677 .ctl_reg = MAXI_EN4_REG,
678 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800679 .hwcg_reg = MAXI_EN4_REG,
680 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700681 .halt_reg = DBG_BUS_VEC_I_REG,
682 .halt_bit = 25,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800683 .retain_reg = MAXI_EN4_REG,
684 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700685 },
686 .c = {
687 .dbg_name = "vcodec_axi_b_clk",
688 .ops = &clk_ops_branch,
689 CLK_INIT(vcodec_axi_b_clk.c),
690 },
691};
692
Matt Wagantall91f42702011-07-14 12:01:15 -0700693static struct branch_clk vcodec_axi_a_clk = {
694 .b = {
695 .ctl_reg = MAXI_EN4_REG,
696 .en_mask = BIT(25),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800697 .hwcg_reg = MAXI_EN4_REG,
698 .hwcg_mask = BIT(24),
Matt Wagantall91f42702011-07-14 12:01:15 -0700699 .halt_reg = DBG_BUS_VEC_I_REG,
700 .halt_bit = 26,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800701 .retain_reg = MAXI_EN4_REG,
702 .retain_mask = BIT(10),
Matt Wagantall91f42702011-07-14 12:01:15 -0700703 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700704 .c = {
705 .dbg_name = "vcodec_axi_a_clk",
706 .ops = &clk_ops_branch,
707 CLK_INIT(vcodec_axi_a_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700708 .depends = &vcodec_axi_b_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700709 },
710};
711
712static struct branch_clk vcodec_axi_clk = {
713 .b = {
714 .ctl_reg = MAXI_EN_REG,
715 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800716 .hwcg_reg = MAXI_EN_REG,
717 .hwcg_mask = BIT(13),
Matt Wagantall91f42702011-07-14 12:01:15 -0700718 .reset_reg = SW_RESET_AXI_REG,
Gopikrishnaiah Anandan83b6e852012-01-05 17:47:02 -0800719 .reset_mask = BIT(4)|BIT(5)|BIT(7),
Matt Wagantall91f42702011-07-14 12:01:15 -0700720 .halt_reg = DBG_BUS_VEC_E_REG,
721 .halt_bit = 3,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800722 .retain_reg = MAXI_EN2_REG,
723 .retain_mask = BIT(28),
Matt Wagantall91f42702011-07-14 12:01:15 -0700724 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700725 .c = {
726 .dbg_name = "vcodec_axi_clk",
727 .ops = &clk_ops_branch,
728 CLK_INIT(vcodec_axi_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700729 .depends = &vcodec_axi_a_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700730 },
731};
732
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700733static struct branch_clk vfe_axi_clk = {
734 .b = {
735 .ctl_reg = MAXI_EN_REG,
736 .en_mask = BIT(18),
737 .reset_reg = SW_RESET_AXI_REG,
738 .reset_mask = BIT(9),
739 .halt_reg = DBG_BUS_VEC_E_REG,
740 .halt_bit = 0,
741 },
742 .c = {
743 .dbg_name = "vfe_axi_clk",
744 .ops = &clk_ops_branch,
745 CLK_INIT(vfe_axi_clk.c),
746 },
747};
748
749static struct branch_clk mdp_axi_clk = {
750 .b = {
751 .ctl_reg = MAXI_EN_REG,
752 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800753 .hwcg_reg = MAXI_EN_REG,
754 .hwcg_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700755 .reset_reg = SW_RESET_AXI_REG,
756 .reset_mask = BIT(13),
757 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700758 .halt_bit = 8,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800759 .retain_reg = MAXI_EN_REG,
760 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700761 },
762 .c = {
763 .dbg_name = "mdp_axi_clk",
764 .ops = &clk_ops_branch,
765 CLK_INIT(mdp_axi_clk.c),
766 },
767};
768
769static struct branch_clk rot_axi_clk = {
770 .b = {
771 .ctl_reg = MAXI_EN2_REG,
772 .en_mask = BIT(24),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800773 .hwcg_reg = MAXI_EN2_REG,
774 .hwcg_mask = BIT(25),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700775 .reset_reg = SW_RESET_AXI_REG,
776 .reset_mask = BIT(6),
777 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700778 .halt_bit = 2,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800779 .retain_reg = MAXI_EN3_REG,
780 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700781 },
782 .c = {
783 .dbg_name = "rot_axi_clk",
784 .ops = &clk_ops_branch,
785 CLK_INIT(rot_axi_clk.c),
786 },
787};
788
789static struct branch_clk vpe_axi_clk = {
790 .b = {
791 .ctl_reg = MAXI_EN2_REG,
792 .en_mask = BIT(26),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800793 .hwcg_reg = MAXI_EN2_REG,
794 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700795 .reset_reg = SW_RESET_AXI_REG,
796 .reset_mask = BIT(15),
797 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700798 .halt_bit = 1,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800799 .retain_reg = MAXI_EN3_REG,
800 .retain_mask = BIT(21),
801
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700802 },
803 .c = {
804 .dbg_name = "vpe_axi_clk",
805 .ops = &clk_ops_branch,
806 CLK_INIT(vpe_axi_clk.c),
807 },
808};
809
Tianyi Gou41515e22011-09-01 19:37:43 -0700810static struct branch_clk vcap_axi_clk = {
811 .b = {
812 .ctl_reg = MAXI_EN5_REG,
813 .en_mask = BIT(12),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700814 .hwcg_reg = MAXI_EN5_REG,
815 .hwcg_mask = BIT(11),
Tianyi Gou41515e22011-09-01 19:37:43 -0700816 .reset_reg = SW_RESET_AXI_REG,
817 .reset_mask = BIT(16),
818 .halt_reg = DBG_BUS_VEC_J_REG,
819 .halt_bit = 20,
820 },
821 .c = {
822 .dbg_name = "vcap_axi_clk",
823 .ops = &clk_ops_branch,
824 CLK_INIT(vcap_axi_clk.c),
825 },
826};
827
Tianyi Goue3d4f542012-03-15 17:06:45 -0700828/* gfx3d_axi_clk is set as a dependency of gmem_axi_clk at runtime */
Patrick Dalye6f489042012-07-11 15:29:15 -0700829static struct branch_clk gfx3d_axi_clk = {
Tianyi Gou621f8742011-09-01 21:45:01 -0700830 .b = {
831 .ctl_reg = MAXI_EN5_REG,
832 .en_mask = BIT(25),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700833 .hwcg_reg = MAXI_EN5_REG,
834 .hwcg_mask = BIT(24),
Tianyi Gou621f8742011-09-01 21:45:01 -0700835 .reset_reg = SW_RESET_AXI_REG,
836 .reset_mask = BIT(17),
837 .halt_reg = DBG_BUS_VEC_J_REG,
838 .halt_bit = 30,
839 },
840 .c = {
841 .dbg_name = "gfx3d_axi_clk",
842 .ops = &clk_ops_branch,
Patrick Dalye6f489042012-07-11 15:29:15 -0700843 CLK_INIT(gfx3d_axi_clk.c),
Tianyi Goue3d4f542012-03-15 17:06:45 -0700844 },
845};
846
847static struct branch_clk gfx3d_axi_clk_8930 = {
848 .b = {
849 .ctl_reg = MAXI_EN5_REG,
850 .en_mask = BIT(12),
851 .reset_reg = SW_RESET_AXI_REG,
852 .reset_mask = BIT(16),
853 .halt_reg = DBG_BUS_VEC_J_REG,
854 .halt_bit = 12,
855 },
856 .c = {
857 .dbg_name = "gfx3d_axi_clk",
858 .ops = &clk_ops_branch,
859 CLK_INIT(gfx3d_axi_clk_8930.c),
Tianyi Gou621f8742011-09-01 21:45:01 -0700860 },
861};
862
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700863/* AHB Interfaces */
864static struct branch_clk amp_p_clk = {
865 .b = {
866 .ctl_reg = AHB_EN_REG,
867 .en_mask = BIT(24),
Matt Wagantalld40857a2012-04-10 19:15:43 -0700868 .reset_reg = SW_RESET_CORE_REG,
869 .reset_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700870 .halt_reg = DBG_BUS_VEC_F_REG,
871 .halt_bit = 18,
872 },
873 .c = {
874 .dbg_name = "amp_p_clk",
875 .ops = &clk_ops_branch,
876 CLK_INIT(amp_p_clk.c),
877 },
878};
879
Matt Wagantallc23eee92011-08-16 23:06:52 -0700880static struct branch_clk csi_p_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700881 .b = {
882 .ctl_reg = AHB_EN_REG,
883 .en_mask = BIT(7),
884 .reset_reg = SW_RESET_AHB_REG,
885 .reset_mask = BIT(17),
886 .halt_reg = DBG_BUS_VEC_F_REG,
887 .halt_bit = 16,
888 },
889 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -0700890 .dbg_name = "csi_p_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700891 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -0700892 CLK_INIT(csi_p_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700893 },
894};
895
896static struct branch_clk dsi1_m_p_clk = {
897 .b = {
898 .ctl_reg = AHB_EN_REG,
899 .en_mask = BIT(9),
900 .reset_reg = SW_RESET_AHB_REG,
901 .reset_mask = BIT(6),
902 .halt_reg = DBG_BUS_VEC_F_REG,
903 .halt_bit = 19,
904 },
905 .c = {
906 .dbg_name = "dsi1_m_p_clk",
907 .ops = &clk_ops_branch,
908 CLK_INIT(dsi1_m_p_clk.c),
909 },
910};
911
912static struct branch_clk dsi1_s_p_clk = {
913 .b = {
914 .ctl_reg = AHB_EN_REG,
915 .en_mask = BIT(18),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800916 .hwcg_reg = AHB_EN2_REG,
917 .hwcg_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700918 .reset_reg = SW_RESET_AHB_REG,
919 .reset_mask = BIT(5),
920 .halt_reg = DBG_BUS_VEC_F_REG,
921 .halt_bit = 21,
922 },
923 .c = {
924 .dbg_name = "dsi1_s_p_clk",
925 .ops = &clk_ops_branch,
926 CLK_INIT(dsi1_s_p_clk.c),
927 },
928};
929
930static struct branch_clk dsi2_m_p_clk = {
931 .b = {
932 .ctl_reg = AHB_EN_REG,
933 .en_mask = BIT(17),
934 .reset_reg = SW_RESET_AHB2_REG,
935 .reset_mask = BIT(1),
936 .halt_reg = DBG_BUS_VEC_E_REG,
937 .halt_bit = 18,
938 },
939 .c = {
940 .dbg_name = "dsi2_m_p_clk",
941 .ops = &clk_ops_branch,
942 CLK_INIT(dsi2_m_p_clk.c),
943 },
944};
945
946static struct branch_clk dsi2_s_p_clk = {
947 .b = {
948 .ctl_reg = AHB_EN_REG,
949 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800950 .hwcg_reg = AHB_EN2_REG,
951 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700952 .reset_reg = SW_RESET_AHB2_REG,
953 .reset_mask = BIT(0),
954 .halt_reg = DBG_BUS_VEC_F_REG,
955 .halt_bit = 20,
956 },
957 .c = {
958 .dbg_name = "dsi2_s_p_clk",
959 .ops = &clk_ops_branch,
960 CLK_INIT(dsi2_s_p_clk.c),
961 },
962};
963
964static struct branch_clk gfx2d0_p_clk = {
965 .b = {
966 .ctl_reg = AHB_EN_REG,
967 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800968 .hwcg_reg = AHB_EN2_REG,
969 .hwcg_mask = BIT(28),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700970 .reset_reg = SW_RESET_AHB_REG,
971 .reset_mask = BIT(12),
972 .halt_reg = DBG_BUS_VEC_F_REG,
973 .halt_bit = 2,
974 },
975 .c = {
976 .dbg_name = "gfx2d0_p_clk",
977 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700978 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700979 CLK_INIT(gfx2d0_p_clk.c),
980 },
981};
982
983static struct branch_clk gfx2d1_p_clk = {
984 .b = {
985 .ctl_reg = AHB_EN_REG,
986 .en_mask = BIT(2),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800987 .hwcg_reg = AHB_EN2_REG,
988 .hwcg_mask = BIT(29),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700989 .reset_reg = SW_RESET_AHB_REG,
990 .reset_mask = BIT(11),
991 .halt_reg = DBG_BUS_VEC_F_REG,
992 .halt_bit = 3,
993 },
994 .c = {
995 .dbg_name = "gfx2d1_p_clk",
996 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700997 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700998 CLK_INIT(gfx2d1_p_clk.c),
999 },
1000};
1001
1002static struct branch_clk gfx3d_p_clk = {
1003 .b = {
1004 .ctl_reg = AHB_EN_REG,
1005 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001006 .hwcg_reg = AHB_EN2_REG,
1007 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001008 .reset_reg = SW_RESET_AHB_REG,
1009 .reset_mask = BIT(10),
1010 .halt_reg = DBG_BUS_VEC_F_REG,
1011 .halt_bit = 4,
1012 },
1013 .c = {
1014 .dbg_name = "gfx3d_p_clk",
1015 .ops = &clk_ops_branch,
1016 CLK_INIT(gfx3d_p_clk.c),
1017 },
1018};
1019
1020static struct branch_clk hdmi_m_p_clk = {
1021 .b = {
1022 .ctl_reg = AHB_EN_REG,
1023 .en_mask = BIT(14),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001024 .hwcg_reg = AHB_EN2_REG,
1025 .hwcg_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001026 .reset_reg = SW_RESET_AHB_REG,
1027 .reset_mask = BIT(9),
1028 .halt_reg = DBG_BUS_VEC_F_REG,
1029 .halt_bit = 5,
1030 },
1031 .c = {
1032 .dbg_name = "hdmi_m_p_clk",
1033 .ops = &clk_ops_branch,
1034 CLK_INIT(hdmi_m_p_clk.c),
1035 },
1036};
1037
1038static struct branch_clk hdmi_s_p_clk = {
1039 .b = {
1040 .ctl_reg = AHB_EN_REG,
1041 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001042 .hwcg_reg = AHB_EN2_REG,
1043 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001044 .reset_reg = SW_RESET_AHB_REG,
1045 .reset_mask = BIT(9),
1046 .halt_reg = DBG_BUS_VEC_F_REG,
1047 .halt_bit = 6,
1048 },
1049 .c = {
1050 .dbg_name = "hdmi_s_p_clk",
1051 .ops = &clk_ops_branch,
1052 CLK_INIT(hdmi_s_p_clk.c),
1053 },
1054};
1055
1056static struct branch_clk ijpeg_p_clk = {
1057 .b = {
1058 .ctl_reg = AHB_EN_REG,
1059 .en_mask = BIT(5),
1060 .reset_reg = SW_RESET_AHB_REG,
1061 .reset_mask = BIT(7),
1062 .halt_reg = DBG_BUS_VEC_F_REG,
1063 .halt_bit = 9,
1064 },
1065 .c = {
1066 .dbg_name = "ijpeg_p_clk",
1067 .ops = &clk_ops_branch,
1068 CLK_INIT(ijpeg_p_clk.c),
1069 },
1070};
1071
1072static struct branch_clk imem_p_clk = {
1073 .b = {
1074 .ctl_reg = AHB_EN_REG,
1075 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001076 .hwcg_reg = AHB_EN2_REG,
1077 .hwcg_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001078 .reset_reg = SW_RESET_AHB_REG,
1079 .reset_mask = BIT(8),
1080 .halt_reg = DBG_BUS_VEC_F_REG,
1081 .halt_bit = 10,
1082 },
1083 .c = {
1084 .dbg_name = "imem_p_clk",
1085 .ops = &clk_ops_branch,
1086 CLK_INIT(imem_p_clk.c),
1087 },
1088};
1089
1090static struct branch_clk jpegd_p_clk = {
1091 .b = {
1092 .ctl_reg = AHB_EN_REG,
1093 .en_mask = BIT(21),
1094 .reset_reg = SW_RESET_AHB_REG,
1095 .reset_mask = BIT(4),
1096 .halt_reg = DBG_BUS_VEC_F_REG,
1097 .halt_bit = 7,
1098 },
1099 .c = {
1100 .dbg_name = "jpegd_p_clk",
1101 .ops = &clk_ops_branch,
1102 CLK_INIT(jpegd_p_clk.c),
1103 },
1104};
1105
1106static struct branch_clk mdp_p_clk = {
1107 .b = {
1108 .ctl_reg = AHB_EN_REG,
1109 .en_mask = BIT(10),
1110 .reset_reg = SW_RESET_AHB_REG,
1111 .reset_mask = BIT(3),
1112 .halt_reg = DBG_BUS_VEC_F_REG,
1113 .halt_bit = 11,
1114 },
1115 .c = {
1116 .dbg_name = "mdp_p_clk",
1117 .ops = &clk_ops_branch,
1118 CLK_INIT(mdp_p_clk.c),
1119 },
1120};
1121
1122static struct branch_clk rot_p_clk = {
1123 .b = {
1124 .ctl_reg = AHB_EN_REG,
1125 .en_mask = BIT(12),
1126 .reset_reg = SW_RESET_AHB_REG,
1127 .reset_mask = BIT(2),
1128 .halt_reg = DBG_BUS_VEC_F_REG,
1129 .halt_bit = 13,
1130 },
1131 .c = {
1132 .dbg_name = "rot_p_clk",
1133 .ops = &clk_ops_branch,
1134 CLK_INIT(rot_p_clk.c),
1135 },
1136};
1137
1138static struct branch_clk smmu_p_clk = {
1139 .b = {
1140 .ctl_reg = AHB_EN_REG,
1141 .en_mask = BIT(15),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001142 .hwcg_reg = AHB_EN_REG,
1143 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001144 .halt_reg = DBG_BUS_VEC_F_REG,
1145 .halt_bit = 22,
1146 },
1147 .c = {
1148 .dbg_name = "smmu_p_clk",
1149 .ops = &clk_ops_branch,
1150 CLK_INIT(smmu_p_clk.c),
1151 },
1152};
1153
1154static struct branch_clk tv_enc_p_clk = {
1155 .b = {
1156 .ctl_reg = AHB_EN_REG,
1157 .en_mask = BIT(25),
1158 .reset_reg = SW_RESET_AHB_REG,
1159 .reset_mask = BIT(15),
1160 .halt_reg = DBG_BUS_VEC_F_REG,
1161 .halt_bit = 23,
1162 },
1163 .c = {
1164 .dbg_name = "tv_enc_p_clk",
1165 .ops = &clk_ops_branch,
1166 CLK_INIT(tv_enc_p_clk.c),
1167 },
1168};
1169
1170static struct branch_clk vcodec_p_clk = {
1171 .b = {
1172 .ctl_reg = AHB_EN_REG,
1173 .en_mask = BIT(11),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001174 .hwcg_reg = AHB_EN2_REG,
1175 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001176 .reset_reg = SW_RESET_AHB_REG,
1177 .reset_mask = BIT(1),
1178 .halt_reg = DBG_BUS_VEC_F_REG,
1179 .halt_bit = 12,
1180 },
1181 .c = {
1182 .dbg_name = "vcodec_p_clk",
1183 .ops = &clk_ops_branch,
1184 CLK_INIT(vcodec_p_clk.c),
1185 },
1186};
1187
1188static struct branch_clk vfe_p_clk = {
1189 .b = {
1190 .ctl_reg = AHB_EN_REG,
1191 .en_mask = BIT(13),
1192 .reset_reg = SW_RESET_AHB_REG,
1193 .reset_mask = BIT(0),
1194 .halt_reg = DBG_BUS_VEC_F_REG,
1195 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08001196 .retain_reg = AHB_EN2_REG,
1197 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001198 },
1199 .c = {
1200 .dbg_name = "vfe_p_clk",
1201 .ops = &clk_ops_branch,
1202 CLK_INIT(vfe_p_clk.c),
1203 },
1204};
1205
1206static struct branch_clk vpe_p_clk = {
1207 .b = {
1208 .ctl_reg = AHB_EN_REG,
1209 .en_mask = BIT(16),
1210 .reset_reg = SW_RESET_AHB_REG,
1211 .reset_mask = BIT(14),
1212 .halt_reg = DBG_BUS_VEC_F_REG,
1213 .halt_bit = 15,
1214 },
1215 .c = {
1216 .dbg_name = "vpe_p_clk",
1217 .ops = &clk_ops_branch,
1218 CLK_INIT(vpe_p_clk.c),
1219 },
1220};
1221
Tianyi Gou41515e22011-09-01 19:37:43 -07001222static struct branch_clk vcap_p_clk = {
1223 .b = {
1224 .ctl_reg = AHB_EN3_REG,
1225 .en_mask = BIT(1),
1226 .reset_reg = SW_RESET_AHB2_REG,
1227 .reset_mask = BIT(2),
1228 .halt_reg = DBG_BUS_VEC_J_REG,
1229 .halt_bit = 23,
1230 },
1231 .c = {
1232 .dbg_name = "vcap_p_clk",
1233 .ops = &clk_ops_branch,
1234 CLK_INIT(vcap_p_clk.c),
1235 },
1236};
1237
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001238/*
1239 * Peripheral Clocks
1240 */
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001241#define CLK_GP(i, n, h_r, h_b) \
1242 struct rcg_clk i##_clk = { \
1243 .b = { \
1244 .ctl_reg = GPn_NS_REG(n), \
1245 .en_mask = BIT(9), \
1246 .halt_reg = h_r, \
1247 .halt_bit = h_b, \
1248 }, \
1249 .ns_reg = GPn_NS_REG(n), \
1250 .md_reg = GPn_MD_REG(n), \
1251 .root_en_mask = BIT(11), \
1252 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001253 .mnd_en_mask = BIT(8), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001254 .set_rate = set_rate_mnd, \
1255 .freq_tbl = clk_tbl_gp, \
1256 .current_freq = &rcg_dummy_freq, \
1257 .c = { \
1258 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001259 .ops = &clk_ops_rcg, \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001260 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), \
1261 CLK_INIT(i##_clk.c), \
1262 }, \
1263 }
1264#define F_GP(f, s, d, m, n) \
1265 { \
1266 .freq_hz = f, \
1267 .src_clk = &s##_clk.c, \
1268 .md_val = MD8(16, m, 0, n), \
1269 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001270 }
1271static struct clk_freq_tbl clk_tbl_gp[] = {
1272 F_GP( 0, gnd, 1, 0, 0),
1273 F_GP( 9600000, cxo, 2, 0, 0),
1274 F_GP( 13500000, pxo, 2, 0, 0),
1275 F_GP( 19200000, cxo, 1, 0, 0),
1276 F_GP( 27000000, pxo, 1, 0, 0),
1277 F_GP( 64000000, pll8, 2, 1, 3),
1278 F_GP( 76800000, pll8, 1, 1, 5),
1279 F_GP( 96000000, pll8, 4, 0, 0),
1280 F_GP(128000000, pll8, 3, 0, 0),
1281 F_GP(192000000, pll8, 2, 0, 0),
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001282 F_END
1283};
1284
1285static CLK_GP(gp0, 0, CLK_HALT_SFPB_MISC_STATE_REG, 7);
1286static CLK_GP(gp1, 1, CLK_HALT_SFPB_MISC_STATE_REG, 6);
1287static CLK_GP(gp2, 2, CLK_HALT_SFPB_MISC_STATE_REG, 5);
1288
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001289#define CLK_GSBI_UART(i, n, h_r, h_b) \
1290 struct rcg_clk i##_clk = { \
1291 .b = { \
1292 .ctl_reg = GSBIn_UART_APPS_NS_REG(n), \
1293 .en_mask = BIT(9), \
1294 .reset_reg = GSBIn_RESET_REG(n), \
1295 .reset_mask = BIT(0), \
1296 .halt_reg = h_r, \
1297 .halt_bit = h_b, \
1298 }, \
1299 .ns_reg = GSBIn_UART_APPS_NS_REG(n), \
1300 .md_reg = GSBIn_UART_APPS_MD_REG(n), \
1301 .root_en_mask = BIT(11), \
1302 .ns_mask = (BM(31, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001303 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001304 .set_rate = set_rate_mnd, \
1305 .freq_tbl = clk_tbl_gsbi_uart, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001306 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001307 .c = { \
1308 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001309 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001310 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001311 CLK_INIT(i##_clk.c), \
1312 }, \
1313 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001314#define F_GSBI_UART(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001315 { \
1316 .freq_hz = f, \
1317 .src_clk = &s##_clk.c, \
1318 .md_val = MD16(m, n), \
1319 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001320 }
1321static struct clk_freq_tbl clk_tbl_gsbi_uart[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001322 F_GSBI_UART( 0, gnd, 1, 0, 0),
Matt Wagantall9a561f72012-01-19 16:13:12 -08001323 F_GSBI_UART( 1843200, pll8, 2, 6, 625),
1324 F_GSBI_UART( 3686400, pll8, 2, 12, 625),
1325 F_GSBI_UART( 7372800, pll8, 2, 24, 625),
1326 F_GSBI_UART(14745600, pll8, 2, 48, 625),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001327 F_GSBI_UART(16000000, pll8, 4, 1, 6),
1328 F_GSBI_UART(24000000, pll8, 4, 1, 4),
1329 F_GSBI_UART(32000000, pll8, 4, 1, 3),
1330 F_GSBI_UART(40000000, pll8, 1, 5, 48),
1331 F_GSBI_UART(46400000, pll8, 1, 29, 240),
1332 F_GSBI_UART(48000000, pll8, 4, 1, 2),
1333 F_GSBI_UART(51200000, pll8, 1, 2, 15),
1334 F_GSBI_UART(56000000, pll8, 1, 7, 48),
1335 F_GSBI_UART(58982400, pll8, 1, 96, 625),
1336 F_GSBI_UART(64000000, pll8, 2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001337 F_END
1338};
1339
1340static CLK_GSBI_UART(gsbi1_uart, 1, CLK_HALT_CFPB_STATEA_REG, 10);
1341static CLK_GSBI_UART(gsbi2_uart, 2, CLK_HALT_CFPB_STATEA_REG, 6);
1342static CLK_GSBI_UART(gsbi3_uart, 3, CLK_HALT_CFPB_STATEA_REG, 2);
1343static CLK_GSBI_UART(gsbi4_uart, 4, CLK_HALT_CFPB_STATEB_REG, 26);
1344static CLK_GSBI_UART(gsbi5_uart, 5, CLK_HALT_CFPB_STATEB_REG, 22);
1345static CLK_GSBI_UART(gsbi6_uart, 6, CLK_HALT_CFPB_STATEB_REG, 18);
1346static CLK_GSBI_UART(gsbi7_uart, 7, CLK_HALT_CFPB_STATEB_REG, 14);
1347static CLK_GSBI_UART(gsbi8_uart, 8, CLK_HALT_CFPB_STATEB_REG, 10);
1348static CLK_GSBI_UART(gsbi9_uart, 9, CLK_HALT_CFPB_STATEB_REG, 6);
1349static CLK_GSBI_UART(gsbi10_uart, 10, CLK_HALT_CFPB_STATEB_REG, 2);
1350static CLK_GSBI_UART(gsbi11_uart, 11, CLK_HALT_CFPB_STATEC_REG, 17);
1351static CLK_GSBI_UART(gsbi12_uart, 12, CLK_HALT_CFPB_STATEC_REG, 13);
1352
1353#define CLK_GSBI_QUP(i, n, h_r, h_b) \
1354 struct rcg_clk i##_clk = { \
1355 .b = { \
1356 .ctl_reg = GSBIn_QUP_APPS_NS_REG(n), \
1357 .en_mask = BIT(9), \
1358 .reset_reg = GSBIn_RESET_REG(n), \
1359 .reset_mask = BIT(0), \
1360 .halt_reg = h_r, \
1361 .halt_bit = h_b, \
1362 }, \
1363 .ns_reg = GSBIn_QUP_APPS_NS_REG(n), \
1364 .md_reg = GSBIn_QUP_APPS_MD_REG(n), \
1365 .root_en_mask = BIT(11), \
1366 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001367 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001368 .set_rate = set_rate_mnd, \
1369 .freq_tbl = clk_tbl_gsbi_qup, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001370 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001371 .c = { \
1372 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001373 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001374 VDD_DIG_FMAX_MAP2(LOW, 24000000, NOMINAL, 52000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001375 CLK_INIT(i##_clk.c), \
1376 }, \
1377 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001378#define F_GSBI_QUP(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001379 { \
1380 .freq_hz = f, \
1381 .src_clk = &s##_clk.c, \
1382 .md_val = MD8(16, m, 0, n), \
1383 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001384 }
1385static struct clk_freq_tbl clk_tbl_gsbi_qup[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001386 F_GSBI_QUP( 0, gnd, 1, 0, 0),
1387 F_GSBI_QUP( 1100000, pxo, 1, 2, 49),
1388 F_GSBI_QUP( 5400000, pxo, 1, 1, 5),
1389 F_GSBI_QUP(10800000, pxo, 1, 2, 5),
1390 F_GSBI_QUP(15060000, pll8, 1, 2, 51),
1391 F_GSBI_QUP(24000000, pll8, 4, 1, 4),
1392 F_GSBI_QUP(25600000, pll8, 1, 1, 15),
1393 F_GSBI_QUP(27000000, pxo, 1, 0, 0),
1394 F_GSBI_QUP(48000000, pll8, 4, 1, 2),
1395 F_GSBI_QUP(51200000, pll8, 1, 2, 15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001396 F_END
1397};
1398
1399static CLK_GSBI_QUP(gsbi1_qup, 1, CLK_HALT_CFPB_STATEA_REG, 9);
1400static CLK_GSBI_QUP(gsbi2_qup, 2, CLK_HALT_CFPB_STATEA_REG, 4);
1401static CLK_GSBI_QUP(gsbi3_qup, 3, CLK_HALT_CFPB_STATEA_REG, 0);
1402static CLK_GSBI_QUP(gsbi4_qup, 4, CLK_HALT_CFPB_STATEB_REG, 24);
1403static CLK_GSBI_QUP(gsbi5_qup, 5, CLK_HALT_CFPB_STATEB_REG, 20);
1404static CLK_GSBI_QUP(gsbi6_qup, 6, CLK_HALT_CFPB_STATEB_REG, 16);
1405static CLK_GSBI_QUP(gsbi7_qup, 7, CLK_HALT_CFPB_STATEB_REG, 12);
1406static CLK_GSBI_QUP(gsbi8_qup, 8, CLK_HALT_CFPB_STATEB_REG, 8);
1407static CLK_GSBI_QUP(gsbi9_qup, 9, CLK_HALT_CFPB_STATEB_REG, 4);
1408static CLK_GSBI_QUP(gsbi10_qup, 10, CLK_HALT_CFPB_STATEB_REG, 0);
1409static CLK_GSBI_QUP(gsbi11_qup, 11, CLK_HALT_CFPB_STATEC_REG, 15);
1410static CLK_GSBI_QUP(gsbi12_qup, 12, CLK_HALT_CFPB_STATEC_REG, 11);
1411
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001412#define F_PDM(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001413 { \
1414 .freq_hz = f, \
1415 .src_clk = &s##_clk.c, \
1416 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001417 }
1418static struct clk_freq_tbl clk_tbl_pdm[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001419 F_PDM( 0, gnd, 1),
1420 F_PDM(27000000, pxo, 1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001421 F_END
1422};
1423
1424static struct rcg_clk pdm_clk = {
1425 .b = {
1426 .ctl_reg = PDM_CLK_NS_REG,
1427 .en_mask = BIT(9),
1428 .reset_reg = PDM_CLK_NS_REG,
1429 .reset_mask = BIT(12),
1430 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1431 .halt_bit = 3,
1432 },
1433 .ns_reg = PDM_CLK_NS_REG,
1434 .root_en_mask = BIT(11),
1435 .ns_mask = BM(1, 0),
1436 .set_rate = set_rate_nop,
1437 .freq_tbl = clk_tbl_pdm,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001438 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001439 .c = {
1440 .dbg_name = "pdm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001441 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001442 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001443 CLK_INIT(pdm_clk.c),
1444 },
1445};
1446
1447static struct branch_clk pmem_clk = {
1448 .b = {
1449 .ctl_reg = PMEM_ACLK_CTL_REG,
1450 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001451 .hwcg_reg = PMEM_ACLK_CTL_REG,
1452 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001453 .halt_reg = CLK_HALT_DFAB_STATE_REG,
1454 .halt_bit = 20,
1455 },
1456 .c = {
1457 .dbg_name = "pmem_clk",
1458 .ops = &clk_ops_branch,
1459 CLK_INIT(pmem_clk.c),
1460 },
1461};
1462
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001463#define F_PRNG(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001464 { \
1465 .freq_hz = f, \
1466 .src_clk = &s##_clk.c, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001467 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07001468static struct clk_freq_tbl clk_tbl_prng_32[] = {
1469 F_PRNG(32000000, pll8),
1470 F_END
1471};
1472
1473static struct clk_freq_tbl clk_tbl_prng_64[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001474 F_PRNG(64000000, pll8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001475 F_END
1476};
1477
1478static struct rcg_clk prng_clk = {
1479 .b = {
1480 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
1481 .en_mask = BIT(10),
1482 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
1483 .halt_check = HALT_VOTED,
1484 .halt_bit = 10,
1485 },
1486 .set_rate = set_rate_nop,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001487 .freq_tbl = clk_tbl_prng_32,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001488 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001489 .c = {
1490 .dbg_name = "prng_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001491 .ops = &clk_ops_rcg,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001492 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001493 CLK_INIT(prng_clk.c),
1494 },
1495};
1496
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001497#define CLK_SDC(name, n, h_b, fmax_low, fmax_nom) \
Stephen Boyda78a7402011-08-02 11:23:39 -07001498 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001499 .b = { \
1500 .ctl_reg = SDCn_APPS_CLK_NS_REG(n), \
1501 .en_mask = BIT(9), \
1502 .reset_reg = SDCn_RESET_REG(n), \
1503 .reset_mask = BIT(0), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001504 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001505 .halt_bit = h_b, \
1506 }, \
1507 .ns_reg = SDCn_APPS_CLK_NS_REG(n), \
1508 .md_reg = SDCn_APPS_CLK_MD_REG(n), \
1509 .root_en_mask = BIT(11), \
1510 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001511 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001512 .set_rate = set_rate_mnd, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001513 .freq_tbl = clk_tbl_sdc, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001514 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001515 .c = { \
Stephen Boyda78a7402011-08-02 11:23:39 -07001516 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001517 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001518 VDD_DIG_FMAX_MAP2(LOW, fmax_low, NOMINAL, fmax_nom), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001519 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001520 }, \
1521 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001522#define F_SDC(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001523 { \
1524 .freq_hz = f, \
1525 .src_clk = &s##_clk.c, \
1526 .md_val = MD8(16, m, 0, n), \
1527 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001528 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001529static struct clk_freq_tbl clk_tbl_sdc[] = {
1530 F_SDC( 0, gnd, 1, 0, 0),
1531 F_SDC( 144000, pxo, 3, 2, 125),
1532 F_SDC( 400000, pll8, 4, 1, 240),
1533 F_SDC( 16000000, pll8, 4, 1, 6),
1534 F_SDC( 17070000, pll8, 1, 2, 45),
1535 F_SDC( 20210000, pll8, 1, 1, 19),
1536 F_SDC( 24000000, pll8, 4, 1, 4),
1537 F_SDC( 48000000, pll8, 4, 1, 2),
1538 F_SDC( 64000000, pll8, 3, 1, 2),
1539 F_SDC( 96000000, pll8, 4, 0, 0),
Subhash Jadavanibd238ba2011-11-24 15:12:39 +05301540 F_SDC(192000000, pll8, 2, 0, 0),
Stephen Boyda78a7402011-08-02 11:23:39 -07001541 F_END
1542};
1543
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001544static CLK_SDC(sdc1_clk, 1, 6, 52000000, 104000000);
1545static CLK_SDC(sdc2_clk, 2, 5, 52000000, 104000000);
1546static CLK_SDC(sdc3_clk, 3, 4, 104000000, 208000000);
1547static CLK_SDC(sdc4_clk, 4, 3, 33000000, 67000000);
1548static CLK_SDC(sdc5_clk, 5, 2, 33000000, 67000000);
Stephen Boyda78a7402011-08-02 11:23:39 -07001549
Saravana Kannan55e959d2012-10-15 22:16:04 -07001550static unsigned long fmax_sdc1_8064v2[VDD_DIG_NUM] = {
Patrick Dalyb7c777a2012-08-23 19:07:30 -07001551 [VDD_DIG_LOW] = 100000000,
1552 [VDD_DIG_NOMINAL] = 200000000,
1553};
1554
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001555#define F_TSIF_REF(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001556 { \
1557 .freq_hz = f, \
1558 .src_clk = &s##_clk.c, \
1559 .md_val = MD16(m, n), \
1560 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001561 }
1562static struct clk_freq_tbl clk_tbl_tsif_ref[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001563 F_TSIF_REF( 0, gnd, 1, 0, 0),
1564 F_TSIF_REF(105000, pxo, 1, 1, 256),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001565 F_END
1566};
1567
1568static struct rcg_clk tsif_ref_clk = {
1569 .b = {
1570 .ctl_reg = TSIF_REF_CLK_NS_REG,
1571 .en_mask = BIT(9),
1572 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1573 .halt_bit = 5,
1574 },
1575 .ns_reg = TSIF_REF_CLK_NS_REG,
1576 .md_reg = TSIF_REF_CLK_MD_REG,
1577 .root_en_mask = BIT(11),
1578 .ns_mask = (BM(31, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001579 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001580 .set_rate = set_rate_mnd,
1581 .freq_tbl = clk_tbl_tsif_ref,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001582 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001583 .c = {
1584 .dbg_name = "tsif_ref_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001585 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001586 VDD_DIG_FMAX_MAP2(LOW, 27000000, NOMINAL, 54000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001587 CLK_INIT(tsif_ref_clk.c),
1588 },
1589};
1590
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001591#define F_TSSC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001592 { \
1593 .freq_hz = f, \
1594 .src_clk = &s##_clk.c, \
1595 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001596 }
1597static struct clk_freq_tbl clk_tbl_tssc[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001598 F_TSSC( 0, gnd),
1599 F_TSSC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001600 F_END
1601};
1602
1603static struct rcg_clk tssc_clk = {
1604 .b = {
1605 .ctl_reg = TSSC_CLK_CTL_REG,
1606 .en_mask = BIT(4),
1607 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1608 .halt_bit = 4,
1609 },
1610 .ns_reg = TSSC_CLK_CTL_REG,
1611 .ns_mask = BM(1, 0),
1612 .set_rate = set_rate_nop,
1613 .freq_tbl = clk_tbl_tssc,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001614 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001615 .c = {
1616 .dbg_name = "tssc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001617 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001618 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001619 CLK_INIT(tssc_clk.c),
1620 },
1621};
1622
Tianyi Gou41515e22011-09-01 19:37:43 -07001623#define CLK_USB_HS(name, n, h_b) \
1624 static struct rcg_clk name = { \
1625 .b = { \
1626 .ctl_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1627 .en_mask = BIT(9), \
1628 .reset_reg = USB_HS##n##_RESET_REG, \
1629 .reset_mask = BIT(0), \
1630 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
1631 .halt_bit = h_b, \
1632 }, \
1633 .ns_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1634 .md_reg = USB_HS##n##_XCVR_FS_CLK_MD_REG, \
1635 .root_en_mask = BIT(11), \
1636 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001637 .mnd_en_mask = BIT(8), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001638 .set_rate = set_rate_mnd, \
1639 .freq_tbl = clk_tbl_usb, \
1640 .current_freq = &rcg_dummy_freq, \
1641 .c = { \
1642 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001643 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001644 VDD_DIG_FMAX_MAP1(NOMINAL, 64000000), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001645 CLK_INIT(name.c), \
1646 }, \
1647}
1648
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001649#define F_USB(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001650 { \
1651 .freq_hz = f, \
1652 .src_clk = &s##_clk.c, \
1653 .md_val = MD8(16, m, 0, n), \
1654 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001655 }
1656static struct clk_freq_tbl clk_tbl_usb[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001657 F_USB( 0, gnd, 1, 0, 0),
1658 F_USB(60000000, pll8, 1, 5, 32),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001659 F_END
1660};
1661
Tianyi Gou41515e22011-09-01 19:37:43 -07001662CLK_USB_HS(usb_hs1_xcvr_clk, 1, 0);
1663CLK_USB_HS(usb_hs3_xcvr_clk, 3, 30);
1664CLK_USB_HS(usb_hs4_xcvr_clk, 4, 2);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001665
Stephen Boyd94625ef2011-07-12 17:06:01 -07001666static struct clk_freq_tbl clk_tbl_usb_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001667 F_USB( 0, gnd, 1, 0, 0),
1668 F_USB(60000000, pll8, 1, 5, 32),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001669 F_END
1670};
1671
1672static struct rcg_clk usb_hsic_xcvr_fs_clk = {
1673 .b = {
1674 .ctl_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1675 .en_mask = BIT(9),
1676 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1677 .halt_bit = 26,
1678 },
1679 .ns_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1680 .md_reg = USB_HSIC_XCVR_FS_CLK_MD_REG,
1681 .root_en_mask = BIT(11),
1682 .ns_mask = (BM(23, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001683 .mnd_en_mask = BIT(8),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001684 .set_rate = set_rate_mnd,
1685 .freq_tbl = clk_tbl_usb_hsic,
1686 .current_freq = &rcg_dummy_freq,
1687 .c = {
1688 .dbg_name = "usb_hsic_xcvr_fs_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001689 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001690 VDD_DIG_FMAX_MAP1(LOW, 60000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001691 CLK_INIT(usb_hsic_xcvr_fs_clk.c),
1692 },
1693};
1694
1695static struct branch_clk usb_hsic_system_clk = {
1696 .b = {
1697 .ctl_reg = USB_HSIC_SYSTEM_CLK_CTL_REG,
1698 .en_mask = BIT(4),
1699 .reset_reg = USB_HSIC_RESET_REG,
1700 .reset_mask = BIT(0),
1701 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1702 .halt_bit = 24,
1703 },
1704 .parent = &usb_hsic_xcvr_fs_clk.c,
1705 .c = {
1706 .dbg_name = "usb_hsic_system_clk",
1707 .ops = &clk_ops_branch,
1708 CLK_INIT(usb_hsic_system_clk.c),
1709 },
1710};
1711
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001712#define F_USB_HSIC(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001713 { \
1714 .freq_hz = f, \
1715 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001716 }
1717static struct clk_freq_tbl clk_tbl_usb2_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001718 F_USB_HSIC(480000000, pll14),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001719 F_END
1720};
1721
1722static struct rcg_clk usb_hsic_hsic_src_clk = {
1723 .b = {
1724 .ctl_reg = USB_HSIC_HSIC_CLK_SRC_CTL_REG,
1725 .halt_check = NOCHECK,
1726 },
1727 .root_en_mask = BIT(0),
1728 .set_rate = set_rate_nop,
1729 .freq_tbl = clk_tbl_usb2_hsic,
1730 .current_freq = &rcg_dummy_freq,
1731 .c = {
1732 .dbg_name = "usb_hsic_hsic_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001733 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001734 VDD_DIG_FMAX_MAP1(LOW, 480000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001735 CLK_INIT(usb_hsic_hsic_src_clk.c),
1736 },
1737};
1738
1739static struct branch_clk usb_hsic_hsic_clk = {
1740 .b = {
1741 .ctl_reg = USB_HSIC_HSIC_CLK_CTL_REG,
1742 .en_mask = BIT(0),
1743 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1744 .halt_bit = 19,
1745 },
1746 .parent = &usb_hsic_hsic_src_clk.c,
1747 .c = {
1748 .dbg_name = "usb_hsic_hsic_clk",
1749 .ops = &clk_ops_branch,
1750 CLK_INIT(usb_hsic_hsic_clk.c),
1751 },
1752};
1753
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001754#define F_USB_HSIO_CAL(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001755 { \
1756 .freq_hz = f, \
1757 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001758 }
1759static struct clk_freq_tbl clk_tbl_usb_hsio_cal[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001760 F_USB_HSIO_CAL(9000000, pxo),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001761 F_END
1762};
1763
1764static struct rcg_clk usb_hsic_hsio_cal_clk = {
1765 .b = {
1766 .ctl_reg = USB_HSIC_HSIO_CAL_CLK_CTL_REG,
1767 .en_mask = BIT(0),
1768 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1769 .halt_bit = 23,
1770 },
1771 .set_rate = set_rate_nop,
1772 .freq_tbl = clk_tbl_usb_hsio_cal,
1773 .current_freq = &rcg_dummy_freq,
1774 .c = {
1775 .dbg_name = "usb_hsic_hsio_cal_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001776 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001777 VDD_DIG_FMAX_MAP1(LOW, 10000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001778 CLK_INIT(usb_hsic_hsio_cal_clk.c),
1779 },
1780};
1781
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001782static struct branch_clk usb_phy0_clk = {
1783 .b = {
1784 .reset_reg = USB_PHY0_RESET_REG,
1785 .reset_mask = BIT(0),
1786 },
1787 .c = {
1788 .dbg_name = "usb_phy0_clk",
1789 .ops = &clk_ops_reset,
1790 CLK_INIT(usb_phy0_clk.c),
1791 },
1792};
1793
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001794#define CLK_USB_FS(i, n, fmax_nom) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001795 struct rcg_clk i##_clk = { \
1796 .ns_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1797 .b = { \
1798 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1799 .halt_check = NOCHECK, \
1800 }, \
1801 .md_reg = USB_FSn_XCVR_FS_CLK_MD_REG(n), \
1802 .root_en_mask = BIT(11), \
1803 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001804 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001805 .set_rate = set_rate_mnd, \
1806 .freq_tbl = clk_tbl_usb, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001807 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001808 .c = { \
1809 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001810 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001811 VDD_DIG_FMAX_MAP1(NOMINAL, fmax_nom), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001812 CLK_INIT(i##_clk.c), \
1813 }, \
1814 }
1815
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001816static CLK_USB_FS(usb_fs1_src, 1, 64000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001817static struct branch_clk usb_fs1_xcvr_clk = {
1818 .b = {
1819 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(1),
1820 .en_mask = BIT(9),
1821 .reset_reg = USB_FSn_RESET_REG(1),
1822 .reset_mask = BIT(1),
1823 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1824 .halt_bit = 15,
1825 },
1826 .parent = &usb_fs1_src_clk.c,
1827 .c = {
1828 .dbg_name = "usb_fs1_xcvr_clk",
1829 .ops = &clk_ops_branch,
1830 CLK_INIT(usb_fs1_xcvr_clk.c),
1831 },
1832};
1833
1834static struct branch_clk usb_fs1_sys_clk = {
1835 .b = {
1836 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(1),
1837 .en_mask = BIT(4),
1838 .reset_reg = USB_FSn_RESET_REG(1),
1839 .reset_mask = BIT(0),
1840 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1841 .halt_bit = 16,
1842 },
1843 .parent = &usb_fs1_src_clk.c,
1844 .c = {
1845 .dbg_name = "usb_fs1_sys_clk",
1846 .ops = &clk_ops_branch,
1847 CLK_INIT(usb_fs1_sys_clk.c),
1848 },
1849};
1850
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001851static CLK_USB_FS(usb_fs2_src, 2, 60000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001852static struct branch_clk usb_fs2_xcvr_clk = {
1853 .b = {
1854 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(2),
1855 .en_mask = BIT(9),
1856 .reset_reg = USB_FSn_RESET_REG(2),
1857 .reset_mask = BIT(1),
1858 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1859 .halt_bit = 12,
1860 },
1861 .parent = &usb_fs2_src_clk.c,
1862 .c = {
1863 .dbg_name = "usb_fs2_xcvr_clk",
1864 .ops = &clk_ops_branch,
1865 CLK_INIT(usb_fs2_xcvr_clk.c),
1866 },
1867};
1868
1869static struct branch_clk usb_fs2_sys_clk = {
1870 .b = {
1871 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(2),
1872 .en_mask = BIT(4),
1873 .reset_reg = USB_FSn_RESET_REG(2),
1874 .reset_mask = BIT(0),
1875 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1876 .halt_bit = 13,
1877 },
1878 .parent = &usb_fs2_src_clk.c,
1879 .c = {
1880 .dbg_name = "usb_fs2_sys_clk",
1881 .ops = &clk_ops_branch,
1882 CLK_INIT(usb_fs2_sys_clk.c),
1883 },
1884};
1885
1886/* Fast Peripheral Bus Clocks */
1887static struct branch_clk ce1_core_clk = {
1888 .b = {
1889 .ctl_reg = CE1_CORE_CLK_CTL_REG,
1890 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001891 .hwcg_reg = CE1_CORE_CLK_CTL_REG,
1892 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001893 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1894 .halt_bit = 27,
1895 },
1896 .c = {
1897 .dbg_name = "ce1_core_clk",
1898 .ops = &clk_ops_branch,
1899 CLK_INIT(ce1_core_clk.c),
1900 },
1901};
Tianyi Gou41515e22011-09-01 19:37:43 -07001902
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903static struct branch_clk ce1_p_clk = {
1904 .b = {
1905 .ctl_reg = CE1_HCLK_CTL_REG,
1906 .en_mask = BIT(4),
1907 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1908 .halt_bit = 1,
1909 },
1910 .c = {
1911 .dbg_name = "ce1_p_clk",
1912 .ops = &clk_ops_branch,
1913 CLK_INIT(ce1_p_clk.c),
1914 },
1915};
1916
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001917#define F_CE3(f, s, d) \
Tianyi Gou41515e22011-09-01 19:37:43 -07001918 { \
1919 .freq_hz = f, \
1920 .src_clk = &s##_clk.c, \
1921 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001922 }
1923
1924static struct clk_freq_tbl clk_tbl_ce3[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001925 F_CE3( 0, gnd, 1),
1926 F_CE3( 48000000, pll8, 8),
1927 F_CE3(100000000, pll3, 12),
Patrick Dalyb7c777a2012-08-23 19:07:30 -07001928 F_CE3(120000000, pll3, 10),
Tianyi Gou41515e22011-09-01 19:37:43 -07001929 F_END
1930};
1931
1932static struct rcg_clk ce3_src_clk = {
1933 .b = {
1934 .ctl_reg = CE3_CLK_SRC_NS_REG,
1935 .halt_check = NOCHECK,
1936 },
1937 .ns_reg = CE3_CLK_SRC_NS_REG,
1938 .root_en_mask = BIT(7),
1939 .ns_mask = BM(6, 0),
1940 .set_rate = set_rate_nop,
1941 .freq_tbl = clk_tbl_ce3,
1942 .current_freq = &rcg_dummy_freq,
1943 .c = {
1944 .dbg_name = "ce3_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001945 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001946 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
Tianyi Gou41515e22011-09-01 19:37:43 -07001947 CLK_INIT(ce3_src_clk.c),
1948 },
1949};
1950
Saravana Kannan55e959d2012-10-15 22:16:04 -07001951static unsigned long fmax_ce3_8064v2[VDD_DIG_NUM] = {
Patrick Dalyb7c777a2012-08-23 19:07:30 -07001952 [VDD_DIG_LOW] = 57000000,
1953 [VDD_DIG_NOMINAL] = 120000000,
1954};
1955
Tianyi Gou41515e22011-09-01 19:37:43 -07001956static struct branch_clk ce3_core_clk = {
1957 .b = {
1958 .ctl_reg = CE3_CORE_CLK_CTL_REG,
1959 .en_mask = BIT(4),
1960 .reset_reg = CE3_CORE_CLK_CTL_REG,
1961 .reset_mask = BIT(7),
1962 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
1963 .halt_bit = 5,
1964 },
1965 .parent = &ce3_src_clk.c,
1966 .c = {
1967 .dbg_name = "ce3_core_clk",
1968 .ops = &clk_ops_branch,
1969 CLK_INIT(ce3_core_clk.c),
1970 }
1971};
1972
1973static struct branch_clk ce3_p_clk = {
1974 .b = {
1975 .ctl_reg = CE3_HCLK_CTL_REG,
1976 .en_mask = BIT(4),
1977 .reset_reg = CE3_HCLK_CTL_REG,
1978 .reset_mask = BIT(7),
1979 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
1980 .halt_bit = 16,
1981 },
1982 .parent = &ce3_src_clk.c,
1983 .c = {
1984 .dbg_name = "ce3_p_clk",
1985 .ops = &clk_ops_branch,
1986 CLK_INIT(ce3_p_clk.c),
1987 }
1988};
1989
Tianyi Gou352955d2012-05-18 19:44:01 -07001990#define F_SATA(f, s, d) \
1991 { \
1992 .freq_hz = f, \
1993 .src_clk = &s##_clk.c, \
1994 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
1995 }
1996
1997static struct clk_freq_tbl clk_tbl_sata[] = {
1998 F_SATA( 0, gnd, 1),
1999 F_SATA( 48000000, pll8, 8),
2000 F_SATA(100000000, pll3, 12),
2001 F_END
2002};
2003
2004static struct rcg_clk sata_src_clk = {
2005 .b = {
2006 .ctl_reg = SATA_CLK_SRC_NS_REG,
2007 .halt_check = NOCHECK,
2008 },
2009 .ns_reg = SATA_CLK_SRC_NS_REG,
2010 .root_en_mask = BIT(7),
2011 .ns_mask = BM(6, 0),
2012 .set_rate = set_rate_nop,
2013 .freq_tbl = clk_tbl_sata,
2014 .current_freq = &rcg_dummy_freq,
2015 .c = {
2016 .dbg_name = "sata_src_clk",
2017 .ops = &clk_ops_rcg,
2018 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
2019 CLK_INIT(sata_src_clk.c),
2020 },
2021};
2022
2023static struct branch_clk sata_rxoob_clk = {
2024 .b = {
2025 .ctl_reg = SATA_RXOOB_CLK_CTL_REG,
2026 .en_mask = BIT(4),
2027 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2028 .halt_bit = 26,
2029 },
2030 .parent = &sata_src_clk.c,
2031 .c = {
2032 .dbg_name = "sata_rxoob_clk",
2033 .ops = &clk_ops_branch,
2034 CLK_INIT(sata_rxoob_clk.c),
2035 },
2036};
2037
2038static struct branch_clk sata_pmalive_clk = {
2039 .b = {
2040 .ctl_reg = SATA_PMALIVE_CLK_CTL_REG,
2041 .en_mask = BIT(4),
2042 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2043 .halt_bit = 25,
2044 },
2045 .parent = &sata_src_clk.c,
2046 .c = {
2047 .dbg_name = "sata_pmalive_clk",
2048 .ops = &clk_ops_branch,
2049 CLK_INIT(sata_pmalive_clk.c),
2050 },
2051};
2052
Tianyi Gou41515e22011-09-01 19:37:43 -07002053static struct branch_clk sata_phy_ref_clk = {
2054 .b = {
2055 .ctl_reg = SATA_PHY_REF_CLK_CTL_REG,
2056 .en_mask = BIT(4),
2057 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2058 .halt_bit = 24,
2059 },
2060 .parent = &pxo_clk.c,
2061 .c = {
2062 .dbg_name = "sata_phy_ref_clk",
2063 .ops = &clk_ops_branch,
2064 CLK_INIT(sata_phy_ref_clk.c),
2065 },
2066};
2067
Tianyi Gou352955d2012-05-18 19:44:01 -07002068static struct branch_clk sata_a_clk = {
2069 .b = {
2070 .ctl_reg = SATA_ACLK_CTL_REG,
2071 .en_mask = BIT(4),
2072 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2073 .halt_bit = 12,
2074 },
2075 .c = {
2076 .dbg_name = "sata_a_clk",
2077 .ops = &clk_ops_branch,
2078 CLK_INIT(sata_a_clk.c),
2079 },
2080};
2081
2082static struct branch_clk sata_p_clk = {
2083 .b = {
2084 .ctl_reg = SATA_HCLK_CTL_REG,
2085 .en_mask = BIT(4),
2086 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2087 .halt_bit = 27,
2088 },
2089 .c = {
2090 .dbg_name = "sata_p_clk",
2091 .ops = &clk_ops_branch,
2092 CLK_INIT(sata_p_clk.c),
2093 },
2094};
2095
2096static struct branch_clk sfab_sata_s_p_clk = {
2097 .b = {
2098 .ctl_reg = SFAB_SATA_S_HCLK_CTL_REG,
2099 .en_mask = BIT(4),
2100 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
2101 .halt_bit = 14,
2102 },
2103 .c = {
2104 .dbg_name = "sfab_sata_s_p_clk",
2105 .ops = &clk_ops_branch,
2106 CLK_INIT(sfab_sata_s_p_clk.c),
2107 },
2108};
Tianyi Gou41515e22011-09-01 19:37:43 -07002109static struct branch_clk pcie_p_clk = {
2110 .b = {
2111 .ctl_reg = PCIE_HCLK_CTL_REG,
2112 .en_mask = BIT(4),
2113 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2114 .halt_bit = 8,
2115 },
2116 .c = {
2117 .dbg_name = "pcie_p_clk",
2118 .ops = &clk_ops_branch,
2119 CLK_INIT(pcie_p_clk.c),
2120 },
2121};
2122
Tianyi Gou6613de52012-01-27 17:57:53 -08002123static struct branch_clk pcie_phy_ref_clk = {
2124 .b = {
2125 .ctl_reg = PCIE_PCLK_CTL_REG,
2126 .en_mask = BIT(4),
2127 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2128 .halt_bit = 29,
2129 },
2130 .c = {
2131 .dbg_name = "pcie_phy_ref_clk",
2132 .ops = &clk_ops_branch,
2133 CLK_INIT(pcie_phy_ref_clk.c),
2134 },
2135};
2136
2137static struct branch_clk pcie_a_clk = {
2138 .b = {
2139 .ctl_reg = PCIE_ACLK_CTL_REG,
2140 .en_mask = BIT(4),
2141 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2142 .halt_bit = 13,
2143 },
2144 .c = {
2145 .dbg_name = "pcie_a_clk",
2146 .ops = &clk_ops_branch,
2147 CLK_INIT(pcie_a_clk.c),
2148 },
2149};
2150
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002151static struct branch_clk dma_bam_p_clk = {
2152 .b = {
2153 .ctl_reg = DMA_BAM_HCLK_CTL,
2154 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002155 .hwcg_reg = DMA_BAM_HCLK_CTL,
2156 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002157 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2158 .halt_bit = 12,
2159 },
2160 .c = {
2161 .dbg_name = "dma_bam_p_clk",
2162 .ops = &clk_ops_branch,
2163 CLK_INIT(dma_bam_p_clk.c),
2164 },
2165};
2166
2167static struct branch_clk gsbi1_p_clk = {
2168 .b = {
2169 .ctl_reg = GSBIn_HCLK_CTL_REG(1),
2170 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002171 .hwcg_reg = GSBIn_HCLK_CTL_REG(1),
2172 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002173 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2174 .halt_bit = 11,
2175 },
2176 .c = {
2177 .dbg_name = "gsbi1_p_clk",
2178 .ops = &clk_ops_branch,
2179 CLK_INIT(gsbi1_p_clk.c),
2180 },
2181};
2182
2183static struct branch_clk gsbi2_p_clk = {
2184 .b = {
2185 .ctl_reg = GSBIn_HCLK_CTL_REG(2),
2186 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002187 .hwcg_reg = GSBIn_HCLK_CTL_REG(2),
2188 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002189 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2190 .halt_bit = 7,
2191 },
2192 .c = {
2193 .dbg_name = "gsbi2_p_clk",
2194 .ops = &clk_ops_branch,
2195 CLK_INIT(gsbi2_p_clk.c),
2196 },
2197};
2198
2199static struct branch_clk gsbi3_p_clk = {
2200 .b = {
2201 .ctl_reg = GSBIn_HCLK_CTL_REG(3),
2202 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002203 .hwcg_reg = GSBIn_HCLK_CTL_REG(3),
2204 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002205 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2206 .halt_bit = 3,
2207 },
2208 .c = {
2209 .dbg_name = "gsbi3_p_clk",
2210 .ops = &clk_ops_branch,
2211 CLK_INIT(gsbi3_p_clk.c),
2212 },
2213};
2214
2215static struct branch_clk gsbi4_p_clk = {
2216 .b = {
2217 .ctl_reg = GSBIn_HCLK_CTL_REG(4),
2218 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002219 .hwcg_reg = GSBIn_HCLK_CTL_REG(4),
2220 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002221 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2222 .halt_bit = 27,
2223 },
2224 .c = {
2225 .dbg_name = "gsbi4_p_clk",
2226 .ops = &clk_ops_branch,
2227 CLK_INIT(gsbi4_p_clk.c),
2228 },
2229};
2230
2231static struct branch_clk gsbi5_p_clk = {
2232 .b = {
2233 .ctl_reg = GSBIn_HCLK_CTL_REG(5),
2234 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002235 .hwcg_reg = GSBIn_HCLK_CTL_REG(5),
2236 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002237 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2238 .halt_bit = 23,
2239 },
2240 .c = {
2241 .dbg_name = "gsbi5_p_clk",
2242 .ops = &clk_ops_branch,
2243 CLK_INIT(gsbi5_p_clk.c),
2244 },
2245};
2246
2247static struct branch_clk gsbi6_p_clk = {
2248 .b = {
2249 .ctl_reg = GSBIn_HCLK_CTL_REG(6),
2250 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002251 .hwcg_reg = GSBIn_HCLK_CTL_REG(6),
2252 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002253 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2254 .halt_bit = 19,
2255 },
2256 .c = {
2257 .dbg_name = "gsbi6_p_clk",
2258 .ops = &clk_ops_branch,
2259 CLK_INIT(gsbi6_p_clk.c),
2260 },
2261};
2262
2263static struct branch_clk gsbi7_p_clk = {
2264 .b = {
2265 .ctl_reg = GSBIn_HCLK_CTL_REG(7),
2266 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002267 .hwcg_reg = GSBIn_HCLK_CTL_REG(7),
2268 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002269 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2270 .halt_bit = 15,
2271 },
2272 .c = {
2273 .dbg_name = "gsbi7_p_clk",
2274 .ops = &clk_ops_branch,
2275 CLK_INIT(gsbi7_p_clk.c),
2276 },
2277};
2278
2279static struct branch_clk gsbi8_p_clk = {
2280 .b = {
2281 .ctl_reg = GSBIn_HCLK_CTL_REG(8),
2282 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002283 .hwcg_reg = GSBIn_HCLK_CTL_REG(8),
2284 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002285 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2286 .halt_bit = 11,
2287 },
2288 .c = {
2289 .dbg_name = "gsbi8_p_clk",
2290 .ops = &clk_ops_branch,
2291 CLK_INIT(gsbi8_p_clk.c),
2292 },
2293};
2294
2295static struct branch_clk gsbi9_p_clk = {
2296 .b = {
2297 .ctl_reg = GSBIn_HCLK_CTL_REG(9),
2298 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002299 .hwcg_reg = GSBIn_HCLK_CTL_REG(9),
2300 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002301 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2302 .halt_bit = 7,
2303 },
2304 .c = {
2305 .dbg_name = "gsbi9_p_clk",
2306 .ops = &clk_ops_branch,
2307 CLK_INIT(gsbi9_p_clk.c),
2308 },
2309};
2310
2311static struct branch_clk gsbi10_p_clk = {
2312 .b = {
2313 .ctl_reg = GSBIn_HCLK_CTL_REG(10),
2314 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002315 .hwcg_reg = GSBIn_HCLK_CTL_REG(10),
2316 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002317 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2318 .halt_bit = 3,
2319 },
2320 .c = {
2321 .dbg_name = "gsbi10_p_clk",
2322 .ops = &clk_ops_branch,
2323 CLK_INIT(gsbi10_p_clk.c),
2324 },
2325};
2326
2327static struct branch_clk gsbi11_p_clk = {
2328 .b = {
2329 .ctl_reg = GSBIn_HCLK_CTL_REG(11),
2330 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002331 .hwcg_reg = GSBIn_HCLK_CTL_REG(11),
2332 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002333 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2334 .halt_bit = 18,
2335 },
2336 .c = {
2337 .dbg_name = "gsbi11_p_clk",
2338 .ops = &clk_ops_branch,
2339 CLK_INIT(gsbi11_p_clk.c),
2340 },
2341};
2342
2343static struct branch_clk gsbi12_p_clk = {
2344 .b = {
2345 .ctl_reg = GSBIn_HCLK_CTL_REG(12),
2346 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002347 .hwcg_reg = GSBIn_HCLK_CTL_REG(12),
2348 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002349 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2350 .halt_bit = 14,
2351 },
2352 .c = {
2353 .dbg_name = "gsbi12_p_clk",
2354 .ops = &clk_ops_branch,
2355 CLK_INIT(gsbi12_p_clk.c),
2356 },
2357};
2358
Tianyi Gou41515e22011-09-01 19:37:43 -07002359static struct branch_clk sata_phy_cfg_clk = {
2360 .b = {
2361 .ctl_reg = SATA_PHY_CFG_CLK_CTL_REG,
2362 .en_mask = BIT(4),
2363 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2364 .halt_bit = 12,
2365 },
2366 .c = {
2367 .dbg_name = "sata_phy_cfg_clk",
2368 .ops = &clk_ops_branch,
2369 CLK_INIT(sata_phy_cfg_clk.c),
Stephen Boyd973e4ba2011-07-12 17:06:01 -07002370 },
2371};
2372
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002373static struct branch_clk tsif_p_clk = {
2374 .b = {
2375 .ctl_reg = TSIF_HCLK_CTL_REG,
2376 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002377 .hwcg_reg = TSIF_HCLK_CTL_REG,
2378 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002379 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2380 .halt_bit = 7,
2381 },
2382 .c = {
2383 .dbg_name = "tsif_p_clk",
2384 .ops = &clk_ops_branch,
2385 CLK_INIT(tsif_p_clk.c),
2386 },
2387};
2388
2389static struct branch_clk usb_fs1_p_clk = {
2390 .b = {
2391 .ctl_reg = USB_FSn_HCLK_CTL_REG(1),
2392 .en_mask = BIT(4),
2393 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2394 .halt_bit = 17,
2395 },
2396 .c = {
2397 .dbg_name = "usb_fs1_p_clk",
2398 .ops = &clk_ops_branch,
2399 CLK_INIT(usb_fs1_p_clk.c),
2400 },
2401};
2402
2403static struct branch_clk usb_fs2_p_clk = {
2404 .b = {
2405 .ctl_reg = USB_FSn_HCLK_CTL_REG(2),
2406 .en_mask = BIT(4),
2407 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2408 .halt_bit = 14,
2409 },
2410 .c = {
2411 .dbg_name = "usb_fs2_p_clk",
2412 .ops = &clk_ops_branch,
2413 CLK_INIT(usb_fs2_p_clk.c),
2414 },
2415};
2416
2417static struct branch_clk usb_hs1_p_clk = {
2418 .b = {
2419 .ctl_reg = USB_HS1_HCLK_CTL_REG,
2420 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002421 .hwcg_reg = USB_HS1_HCLK_CTL_REG,
2422 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002423 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2424 .halt_bit = 1,
2425 },
2426 .c = {
2427 .dbg_name = "usb_hs1_p_clk",
2428 .ops = &clk_ops_branch,
2429 CLK_INIT(usb_hs1_p_clk.c),
2430 },
2431};
2432
Tianyi Gou41515e22011-09-01 19:37:43 -07002433static struct branch_clk usb_hs3_p_clk = {
2434 .b = {
2435 .ctl_reg = USB_HS3_HCLK_CTL_REG,
2436 .en_mask = BIT(4),
2437 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2438 .halt_bit = 31,
2439 },
2440 .c = {
2441 .dbg_name = "usb_hs3_p_clk",
2442 .ops = &clk_ops_branch,
2443 CLK_INIT(usb_hs3_p_clk.c),
2444 },
2445};
2446
2447static struct branch_clk usb_hs4_p_clk = {
2448 .b = {
2449 .ctl_reg = USB_HS4_HCLK_CTL_REG,
2450 .en_mask = BIT(4),
2451 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2452 .halt_bit = 7,
2453 },
2454 .c = {
2455 .dbg_name = "usb_hs4_p_clk",
2456 .ops = &clk_ops_branch,
2457 CLK_INIT(usb_hs4_p_clk.c),
2458 },
2459};
2460
Stephen Boyd94625ef2011-07-12 17:06:01 -07002461static struct branch_clk usb_hsic_p_clk = {
2462 .b = {
2463 .ctl_reg = USB_HSIC_HCLK_CTL_REG,
2464 .en_mask = BIT(4),
2465 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2466 .halt_bit = 28,
2467 },
2468 .c = {
2469 .dbg_name = "usb_hsic_p_clk",
2470 .ops = &clk_ops_branch,
2471 CLK_INIT(usb_hsic_p_clk.c),
2472 },
2473};
2474
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002475static struct branch_clk sdc1_p_clk = {
2476 .b = {
2477 .ctl_reg = SDCn_HCLK_CTL_REG(1),
2478 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002479 .hwcg_reg = SDCn_HCLK_CTL_REG(1),
2480 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002481 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2482 .halt_bit = 11,
2483 },
2484 .c = {
2485 .dbg_name = "sdc1_p_clk",
2486 .ops = &clk_ops_branch,
2487 CLK_INIT(sdc1_p_clk.c),
2488 },
2489};
2490
2491static struct branch_clk sdc2_p_clk = {
2492 .b = {
2493 .ctl_reg = SDCn_HCLK_CTL_REG(2),
2494 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002495 .hwcg_reg = SDCn_HCLK_CTL_REG(2),
2496 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002497 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2498 .halt_bit = 10,
2499 },
2500 .c = {
2501 .dbg_name = "sdc2_p_clk",
2502 .ops = &clk_ops_branch,
2503 CLK_INIT(sdc2_p_clk.c),
2504 },
2505};
2506
2507static struct branch_clk sdc3_p_clk = {
2508 .b = {
2509 .ctl_reg = SDCn_HCLK_CTL_REG(3),
2510 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002511 .hwcg_reg = SDCn_HCLK_CTL_REG(3),
2512 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002513 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2514 .halt_bit = 9,
2515 },
2516 .c = {
2517 .dbg_name = "sdc3_p_clk",
2518 .ops = &clk_ops_branch,
2519 CLK_INIT(sdc3_p_clk.c),
2520 },
2521};
2522
2523static struct branch_clk sdc4_p_clk = {
2524 .b = {
2525 .ctl_reg = SDCn_HCLK_CTL_REG(4),
2526 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002527 .hwcg_reg = SDCn_HCLK_CTL_REG(4),
2528 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002529 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2530 .halt_bit = 8,
2531 },
2532 .c = {
2533 .dbg_name = "sdc4_p_clk",
2534 .ops = &clk_ops_branch,
2535 CLK_INIT(sdc4_p_clk.c),
2536 },
2537};
2538
2539static struct branch_clk sdc5_p_clk = {
2540 .b = {
2541 .ctl_reg = SDCn_HCLK_CTL_REG(5),
2542 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002543 .hwcg_reg = SDCn_HCLK_CTL_REG(5),
2544 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002545 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2546 .halt_bit = 7,
2547 },
2548 .c = {
2549 .dbg_name = "sdc5_p_clk",
2550 .ops = &clk_ops_branch,
2551 CLK_INIT(sdc5_p_clk.c),
2552 },
2553};
2554
2555/* HW-Voteable Clocks */
2556static struct branch_clk adm0_clk = {
2557 .b = {
2558 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2559 .en_mask = BIT(2),
2560 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2561 .halt_check = HALT_VOTED,
2562 .halt_bit = 14,
2563 },
2564 .c = {
2565 .dbg_name = "adm0_clk",
2566 .ops = &clk_ops_branch,
2567 CLK_INIT(adm0_clk.c),
2568 },
2569};
2570
2571static struct branch_clk adm0_p_clk = {
2572 .b = {
2573 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2574 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002575 .hwcg_reg = ADM0_PBUS_CLK_CTL_REG,
2576 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002577 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2578 .halt_check = HALT_VOTED,
2579 .halt_bit = 13,
2580 },
2581 .c = {
2582 .dbg_name = "adm0_p_clk",
2583 .ops = &clk_ops_branch,
2584 CLK_INIT(adm0_p_clk.c),
2585 },
2586};
2587
2588static struct branch_clk pmic_arb0_p_clk = {
2589 .b = {
2590 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2591 .en_mask = BIT(8),
2592 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2593 .halt_check = HALT_VOTED,
2594 .halt_bit = 22,
2595 },
2596 .c = {
2597 .dbg_name = "pmic_arb0_p_clk",
2598 .ops = &clk_ops_branch,
2599 CLK_INIT(pmic_arb0_p_clk.c),
2600 },
2601};
2602
2603static struct branch_clk pmic_arb1_p_clk = {
2604 .b = {
2605 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2606 .en_mask = BIT(9),
2607 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2608 .halt_check = HALT_VOTED,
2609 .halt_bit = 21,
2610 },
2611 .c = {
2612 .dbg_name = "pmic_arb1_p_clk",
2613 .ops = &clk_ops_branch,
2614 CLK_INIT(pmic_arb1_p_clk.c),
2615 },
2616};
2617
2618static struct branch_clk pmic_ssbi2_clk = {
2619 .b = {
2620 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2621 .en_mask = BIT(7),
2622 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2623 .halt_check = HALT_VOTED,
2624 .halt_bit = 23,
2625 },
2626 .c = {
2627 .dbg_name = "pmic_ssbi2_clk",
2628 .ops = &clk_ops_branch,
2629 CLK_INIT(pmic_ssbi2_clk.c),
2630 },
2631};
2632
2633static struct branch_clk rpm_msg_ram_p_clk = {
2634 .b = {
2635 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2636 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002637 .hwcg_reg = RPM_MSG_RAM_HCLK_CTL_REG,
2638 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002639 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2640 .halt_check = HALT_VOTED,
2641 .halt_bit = 12,
2642 },
2643 .c = {
2644 .dbg_name = "rpm_msg_ram_p_clk",
2645 .ops = &clk_ops_branch,
2646 CLK_INIT(rpm_msg_ram_p_clk.c),
2647 },
2648};
2649
2650/*
2651 * Multimedia Clocks
2652 */
2653
Stephen Boyd94625ef2011-07-12 17:06:01 -07002654#define CLK_CAM(name, n, hb) \
2655 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002656 .b = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002657 .ctl_reg = CAMCLK##n##_CC_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002658 .en_mask = BIT(0), \
2659 .halt_reg = DBG_BUS_VEC_I_REG, \
2660 .halt_bit = hb, \
2661 }, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002662 .ns_reg = CAMCLK##n##_NS_REG, \
2663 .md_reg = CAMCLK##n##_MD_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002664 .root_en_mask = BIT(2), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002665 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), \
Matt Wagantall07c45472012-02-10 23:27:24 -08002666 .mnd_en_mask = BIT(5), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002667 .ctl_mask = BM(7, 6), \
2668 .set_rate = set_rate_mnd_8, \
2669 .freq_tbl = clk_tbl_cam, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002670 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002671 .c = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002672 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07002673 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002674 VDD_DIG_FMAX_MAP2(LOW, 64000000, NOMINAL, 128000000), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002675 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002676 }, \
2677 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002678#define F_CAM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002679 { \
2680 .freq_hz = f, \
2681 .src_clk = &s##_clk.c, \
2682 .md_val = MD8(8, m, 0, n), \
2683 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2684 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002685 }
2686static struct clk_freq_tbl clk_tbl_cam[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002687 F_CAM( 0, gnd, 1, 0, 0),
2688 F_CAM( 6000000, pll8, 4, 1, 16),
2689 F_CAM( 8000000, pll8, 4, 1, 12),
2690 F_CAM( 12000000, pll8, 4, 1, 8),
2691 F_CAM( 16000000, pll8, 4, 1, 6),
2692 F_CAM( 19200000, pll8, 4, 1, 5),
2693 F_CAM( 24000000, pll8, 4, 1, 4),
2694 F_CAM( 32000000, pll8, 4, 1, 3),
2695 F_CAM( 48000000, pll8, 4, 1, 2),
2696 F_CAM( 64000000, pll8, 3, 1, 2),
2697 F_CAM( 96000000, pll8, 4, 0, 0),
2698 F_CAM(128000000, pll8, 3, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002699 F_END
2700};
2701
Stephen Boyd94625ef2011-07-12 17:06:01 -07002702static CLK_CAM(cam0_clk, 0, 15);
2703static CLK_CAM(cam1_clk, 1, 16);
2704static CLK_CAM(cam2_clk, 2, 31);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002705
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002706#define F_CSI(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002707 { \
2708 .freq_hz = f, \
2709 .src_clk = &s##_clk.c, \
2710 .md_val = MD8(8, m, 0, n), \
2711 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2712 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002713 }
2714static struct clk_freq_tbl clk_tbl_csi[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002715 F_CSI( 0, gnd, 1, 0, 0),
Stephen Boyd092fd182011-10-21 15:56:30 -07002716 F_CSI( 27000000, pxo, 1, 0, 0),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002717 F_CSI( 85330000, pll8, 1, 2, 9),
2718 F_CSI(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002719 F_END
2720};
2721
2722static struct rcg_clk csi0_src_clk = {
2723 .ns_reg = CSI0_NS_REG,
2724 .b = {
2725 .ctl_reg = CSI0_CC_REG,
2726 .halt_check = NOCHECK,
2727 },
2728 .md_reg = CSI0_MD_REG,
2729 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002730 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002731 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002732 .ctl_mask = BM(7, 6),
2733 .set_rate = set_rate_mnd,
2734 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002735 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002736 .c = {
2737 .dbg_name = "csi0_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002738 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002739 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002740 CLK_INIT(csi0_src_clk.c),
2741 },
2742};
2743
2744static struct branch_clk csi0_clk = {
2745 .b = {
2746 .ctl_reg = CSI0_CC_REG,
2747 .en_mask = BIT(0),
2748 .reset_reg = SW_RESET_CORE_REG,
2749 .reset_mask = BIT(8),
2750 .halt_reg = DBG_BUS_VEC_B_REG,
2751 .halt_bit = 13,
2752 },
2753 .parent = &csi0_src_clk.c,
2754 .c = {
2755 .dbg_name = "csi0_clk",
2756 .ops = &clk_ops_branch,
2757 CLK_INIT(csi0_clk.c),
2758 },
2759};
2760
2761static struct branch_clk csi0_phy_clk = {
2762 .b = {
2763 .ctl_reg = CSI0_CC_REG,
2764 .en_mask = BIT(8),
2765 .reset_reg = SW_RESET_CORE_REG,
2766 .reset_mask = BIT(29),
2767 .halt_reg = DBG_BUS_VEC_I_REG,
2768 .halt_bit = 9,
2769 },
2770 .parent = &csi0_src_clk.c,
2771 .c = {
2772 .dbg_name = "csi0_phy_clk",
2773 .ops = &clk_ops_branch,
2774 CLK_INIT(csi0_phy_clk.c),
2775 },
2776};
2777
2778static struct rcg_clk csi1_src_clk = {
2779 .ns_reg = CSI1_NS_REG,
2780 .b = {
2781 .ctl_reg = CSI1_CC_REG,
2782 .halt_check = NOCHECK,
2783 },
2784 .md_reg = CSI1_MD_REG,
2785 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002786 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002787 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002788 .ctl_mask = BM(7, 6),
2789 .set_rate = set_rate_mnd,
2790 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002791 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002792 .c = {
2793 .dbg_name = "csi1_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002794 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002795 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002796 CLK_INIT(csi1_src_clk.c),
2797 },
2798};
2799
2800static struct branch_clk csi1_clk = {
2801 .b = {
2802 .ctl_reg = CSI1_CC_REG,
2803 .en_mask = BIT(0),
2804 .reset_reg = SW_RESET_CORE_REG,
2805 .reset_mask = BIT(18),
2806 .halt_reg = DBG_BUS_VEC_B_REG,
2807 .halt_bit = 14,
2808 },
2809 .parent = &csi1_src_clk.c,
2810 .c = {
2811 .dbg_name = "csi1_clk",
2812 .ops = &clk_ops_branch,
2813 CLK_INIT(csi1_clk.c),
2814 },
2815};
2816
2817static struct branch_clk csi1_phy_clk = {
2818 .b = {
2819 .ctl_reg = CSI1_CC_REG,
2820 .en_mask = BIT(8),
2821 .reset_reg = SW_RESET_CORE_REG,
2822 .reset_mask = BIT(28),
2823 .halt_reg = DBG_BUS_VEC_I_REG,
2824 .halt_bit = 10,
2825 },
2826 .parent = &csi1_src_clk.c,
2827 .c = {
2828 .dbg_name = "csi1_phy_clk",
2829 .ops = &clk_ops_branch,
2830 CLK_INIT(csi1_phy_clk.c),
2831 },
2832};
2833
Stephen Boyd94625ef2011-07-12 17:06:01 -07002834static struct rcg_clk csi2_src_clk = {
2835 .ns_reg = CSI2_NS_REG,
2836 .b = {
2837 .ctl_reg = CSI2_CC_REG,
2838 .halt_check = NOCHECK,
2839 },
2840 .md_reg = CSI2_MD_REG,
2841 .root_en_mask = BIT(2),
2842 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002843 .mnd_en_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002844 .ctl_mask = BM(7, 6),
2845 .set_rate = set_rate_mnd,
2846 .freq_tbl = clk_tbl_csi,
2847 .current_freq = &rcg_dummy_freq,
2848 .c = {
2849 .dbg_name = "csi2_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002850 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002851 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002852 CLK_INIT(csi2_src_clk.c),
2853 },
2854};
2855
2856static struct branch_clk csi2_clk = {
2857 .b = {
2858 .ctl_reg = CSI2_CC_REG,
2859 .en_mask = BIT(0),
2860 .reset_reg = SW_RESET_CORE2_REG,
2861 .reset_mask = BIT(2),
2862 .halt_reg = DBG_BUS_VEC_B_REG,
2863 .halt_bit = 29,
2864 },
2865 .parent = &csi2_src_clk.c,
2866 .c = {
2867 .dbg_name = "csi2_clk",
2868 .ops = &clk_ops_branch,
2869 CLK_INIT(csi2_clk.c),
2870 },
2871};
2872
2873static struct branch_clk csi2_phy_clk = {
2874 .b = {
2875 .ctl_reg = CSI2_CC_REG,
2876 .en_mask = BIT(8),
2877 .reset_reg = SW_RESET_CORE_REG,
2878 .reset_mask = BIT(31),
2879 .halt_reg = DBG_BUS_VEC_I_REG,
2880 .halt_bit = 29,
2881 },
2882 .parent = &csi2_src_clk.c,
2883 .c = {
2884 .dbg_name = "csi2_phy_clk",
2885 .ops = &clk_ops_branch,
2886 CLK_INIT(csi2_phy_clk.c),
2887 },
2888};
2889
Stephen Boyd092fd182011-10-21 15:56:30 -07002890static struct clk *pix_rdi_mux_map[] = {
2891 [0] = &csi0_clk.c,
2892 [1] = &csi1_clk.c,
2893 [2] = &csi2_clk.c,
2894 NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002895};
2896
Stephen Boyd092fd182011-10-21 15:56:30 -07002897struct pix_rdi_clk {
Stephen Boydd86d1f22012-01-24 17:36:34 -08002898 bool prepared;
Stephen Boyd092fd182011-10-21 15:56:30 -07002899 bool enabled;
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002900 unsigned long cur_rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002901
2902 void __iomem *const s_reg;
2903 u32 s_mask;
2904
2905 void __iomem *const s2_reg;
2906 u32 s2_mask;
2907
2908 struct branch b;
2909 struct clk c;
2910};
2911
Matt Wagantallf82f2942012-01-27 13:56:13 -08002912static inline struct pix_rdi_clk *to_pix_rdi_clk(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002913{
Matt Wagantallf82f2942012-01-27 13:56:13 -08002914 return container_of(c, struct pix_rdi_clk, c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002915}
2916
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002917static int pix_rdi_clk_set_rate(struct clk *c, unsigned long rate)
Stephen Boyd092fd182011-10-21 15:56:30 -07002918{
2919 int ret, i;
2920 u32 reg;
2921 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002922 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002923 struct clk **mux_map = pix_rdi_mux_map;
Stephen Boydd86d1f22012-01-24 17:36:34 -08002924 unsigned long old_rate = rdi->cur_rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002925
2926 /*
2927 * These clocks select three inputs via two muxes. One mux selects
2928 * between csi0 and csi1 and the second mux selects between that mux's
2929 * output and csi2. The source and destination selections for each
2930 * mux must be clocking for the switch to succeed so just turn on
2931 * all three sources because it's easier than figuring out what source
2932 * needs to be on at what time.
2933 */
2934 for (i = 0; mux_map[i]; i++) {
Stephen Boydd86d1f22012-01-24 17:36:34 -08002935 ret = clk_prepare_enable(mux_map[i]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002936 if (ret)
2937 goto err;
2938 }
2939 if (rate >= i) {
2940 ret = -EINVAL;
2941 goto err;
2942 }
2943 /* Keep the new source on when switching inputs of an enabled clock */
Stephen Boydd86d1f22012-01-24 17:36:34 -08002944 if (rdi->prepared) {
2945 ret = clk_prepare(mux_map[rate]);
2946 if (ret)
2947 goto err;
Stephen Boyd092fd182011-10-21 15:56:30 -07002948 }
Stephen Boydd86d1f22012-01-24 17:36:34 -08002949 spin_lock_irqsave(&c->lock, flags);
2950 if (rdi->enabled) {
2951 ret = clk_enable(mux_map[rate]);
2952 if (ret) {
2953 spin_unlock_irqrestore(&c->lock, flags);
2954 clk_unprepare(mux_map[rate]);
2955 goto err;
2956 }
2957 }
2958 spin_lock(&local_clock_reg_lock);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002959 reg = readl_relaxed(rdi->s2_reg);
2960 reg &= ~rdi->s2_mask;
2961 reg |= rate == 2 ? rdi->s2_mask : 0;
2962 writel_relaxed(reg, rdi->s2_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002963 /*
2964 * Wait at least 6 cycles of slowest clock
2965 * for the glitch-free MUX to fully switch sources.
2966 */
2967 mb();
2968 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002969 reg = readl_relaxed(rdi->s_reg);
2970 reg &= ~rdi->s_mask;
2971 reg |= rate == 1 ? rdi->s_mask : 0;
2972 writel_relaxed(reg, rdi->s_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002973 /*
2974 * Wait at least 6 cycles of slowest clock
2975 * for the glitch-free MUX to fully switch sources.
2976 */
2977 mb();
2978 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002979 rdi->cur_rate = rate;
Stephen Boydd86d1f22012-01-24 17:36:34 -08002980 spin_unlock(&local_clock_reg_lock);
2981
2982 if (rdi->enabled)
2983 clk_disable(mux_map[old_rate]);
2984 spin_unlock_irqrestore(&c->lock, flags);
2985 if (rdi->prepared)
2986 clk_unprepare(mux_map[old_rate]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002987err:
2988 for (i--; i >= 0; i--)
Stephen Boydd86d1f22012-01-24 17:36:34 -08002989 clk_disable_unprepare(mux_map[i]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002990
2991 return 0;
2992}
2993
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002994static unsigned long pix_rdi_clk_get_rate(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002995{
2996 return to_pix_rdi_clk(c)->cur_rate;
2997}
2998
Stephen Boydd86d1f22012-01-24 17:36:34 -08002999static int pix_rdi_clk_prepare(struct clk *c)
3000{
3001 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
3002 rdi->prepared = true;
3003 return 0;
3004}
3005
Stephen Boyd092fd182011-10-21 15:56:30 -07003006static int pix_rdi_clk_enable(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_enable_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 = true;
Stephen Boyd092fd182011-10-21 15:56:30 -07003015
3016 return 0;
3017}
3018
3019static void pix_rdi_clk_disable(struct clk *c)
3020{
3021 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08003022 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07003023
3024 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07003025 __branch_disable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07003026 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08003027 rdi->enabled = false;
Stephen Boyd092fd182011-10-21 15:56:30 -07003028}
3029
Stephen Boydd86d1f22012-01-24 17:36:34 -08003030static void pix_rdi_clk_unprepare(struct clk *c)
3031{
3032 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
3033 rdi->prepared = false;
3034}
3035
Matt Wagantallf82f2942012-01-27 13:56:13 -08003036static int pix_rdi_clk_reset(struct clk *c, enum clk_reset_action action)
Stephen Boyd092fd182011-10-21 15:56:30 -07003037{
Matt Wagantallf82f2942012-01-27 13:56:13 -08003038 return branch_reset(&to_pix_rdi_clk(c)->b, action);
Stephen Boyd092fd182011-10-21 15:56:30 -07003039}
3040
3041static struct clk *pix_rdi_clk_get_parent(struct clk *c)
3042{
Matt Wagantallf82f2942012-01-27 13:56:13 -08003043 return pix_rdi_mux_map[to_pix_rdi_clk(c)->cur_rate];
Stephen Boyd092fd182011-10-21 15:56:30 -07003044}
3045
3046static int pix_rdi_clk_list_rate(struct clk *c, unsigned n)
3047{
3048 if (pix_rdi_mux_map[n])
3049 return n;
3050 return -ENXIO;
3051}
3052
Matt Wagantalla15833b2012-04-03 11:00:56 -07003053static enum handoff pix_rdi_clk_handoff(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07003054{
3055 u32 reg;
Matt Wagantallf82f2942012-01-27 13:56:13 -08003056 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07003057 enum handoff ret;
3058
Matt Wagantallf82f2942012-01-27 13:56:13 -08003059 ret = branch_handoff(&rdi->b, &rdi->c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07003060 if (ret == HANDOFF_DISABLED_CLK)
3061 return ret;
Stephen Boyd092fd182011-10-21 15:56:30 -07003062
Matt Wagantallf82f2942012-01-27 13:56:13 -08003063 reg = readl_relaxed(rdi->s_reg);
3064 rdi->cur_rate = reg & rdi->s_mask ? 1 : 0;
3065 reg = readl_relaxed(rdi->s2_reg);
3066 rdi->cur_rate = reg & rdi->s2_mask ? 2 : rdi->cur_rate;
Matt Wagantalla15833b2012-04-03 11:00:56 -07003067
3068 return HANDOFF_ENABLED_CLK;
Stephen Boyd092fd182011-10-21 15:56:30 -07003069}
3070
3071static struct clk_ops clk_ops_pix_rdi_8960 = {
Stephen Boydd86d1f22012-01-24 17:36:34 -08003072 .prepare = pix_rdi_clk_prepare,
Stephen Boyd092fd182011-10-21 15:56:30 -07003073 .enable = pix_rdi_clk_enable,
3074 .disable = pix_rdi_clk_disable,
Stephen Boydd86d1f22012-01-24 17:36:34 -08003075 .unprepare = pix_rdi_clk_unprepare,
Stephen Boyd092fd182011-10-21 15:56:30 -07003076 .handoff = pix_rdi_clk_handoff,
3077 .set_rate = pix_rdi_clk_set_rate,
3078 .get_rate = pix_rdi_clk_get_rate,
3079 .list_rate = pix_rdi_clk_list_rate,
3080 .reset = pix_rdi_clk_reset,
Stephen Boyd092fd182011-10-21 15:56:30 -07003081 .get_parent = pix_rdi_clk_get_parent,
3082};
3083
3084static struct pix_rdi_clk csi_pix_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003085 .b = {
3086 .ctl_reg = MISC_CC_REG,
3087 .en_mask = BIT(26),
3088 .halt_check = DELAY,
3089 .reset_reg = SW_RESET_CORE_REG,
3090 .reset_mask = BIT(26),
3091 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003092 .s_reg = MISC_CC_REG,
3093 .s_mask = BIT(25),
3094 .s2_reg = MISC_CC3_REG,
3095 .s2_mask = BIT(13),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003096 .c = {
3097 .dbg_name = "csi_pix_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003098 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003099 CLK_INIT(csi_pix_clk.c),
3100 },
3101};
3102
Stephen Boyd092fd182011-10-21 15:56:30 -07003103static struct pix_rdi_clk csi_pix1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003104 .b = {
3105 .ctl_reg = MISC_CC3_REG,
3106 .en_mask = BIT(10),
3107 .halt_check = DELAY,
3108 .reset_reg = SW_RESET_CORE_REG,
3109 .reset_mask = BIT(30),
3110 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003111 .s_reg = MISC_CC3_REG,
3112 .s_mask = BIT(8),
3113 .s2_reg = MISC_CC3_REG,
3114 .s2_mask = BIT(9),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003115 .c = {
3116 .dbg_name = "csi_pix1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003117 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003118 CLK_INIT(csi_pix1_clk.c),
3119 },
3120};
3121
Stephen Boyd092fd182011-10-21 15:56:30 -07003122static struct pix_rdi_clk csi_rdi_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003123 .b = {
3124 .ctl_reg = MISC_CC_REG,
3125 .en_mask = BIT(13),
3126 .halt_check = DELAY,
3127 .reset_reg = SW_RESET_CORE_REG,
3128 .reset_mask = BIT(27),
3129 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003130 .s_reg = MISC_CC_REG,
3131 .s_mask = BIT(12),
3132 .s2_reg = MISC_CC3_REG,
3133 .s2_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003134 .c = {
3135 .dbg_name = "csi_rdi_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003136 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003137 CLK_INIT(csi_rdi_clk.c),
3138 },
3139};
3140
Stephen Boyd092fd182011-10-21 15:56:30 -07003141static struct pix_rdi_clk csi_rdi1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003142 .b = {
3143 .ctl_reg = MISC_CC3_REG,
3144 .en_mask = BIT(2),
3145 .halt_check = DELAY,
3146 .reset_reg = SW_RESET_CORE2_REG,
3147 .reset_mask = BIT(1),
3148 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003149 .s_reg = MISC_CC3_REG,
3150 .s_mask = BIT(0),
3151 .s2_reg = MISC_CC3_REG,
3152 .s2_mask = BIT(1),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003153 .c = {
3154 .dbg_name = "csi_rdi1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003155 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003156 CLK_INIT(csi_rdi1_clk.c),
3157 },
3158};
3159
Stephen Boyd092fd182011-10-21 15:56:30 -07003160static struct pix_rdi_clk csi_rdi2_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003161 .b = {
3162 .ctl_reg = MISC_CC3_REG,
3163 .en_mask = BIT(6),
3164 .halt_check = DELAY,
3165 .reset_reg = SW_RESET_CORE2_REG,
3166 .reset_mask = BIT(0),
3167 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003168 .s_reg = MISC_CC3_REG,
3169 .s_mask = BIT(4),
3170 .s2_reg = MISC_CC3_REG,
3171 .s2_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003172 .c = {
3173 .dbg_name = "csi_rdi2_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003174 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003175 CLK_INIT(csi_rdi2_clk.c),
3176 },
3177};
3178
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003179#define F_CSI_PHYTIMER(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003180 { \
3181 .freq_hz = f, \
3182 .src_clk = &s##_clk.c, \
3183 .md_val = MD8(8, m, 0, n), \
3184 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
3185 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003186 }
3187static struct clk_freq_tbl clk_tbl_csi_phytimer[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003188 F_CSI_PHYTIMER( 0, gnd, 1, 0, 0),
3189 F_CSI_PHYTIMER( 85330000, pll8, 1, 2, 9),
3190 F_CSI_PHYTIMER(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003191 F_END
3192};
3193
3194static struct rcg_clk csiphy_timer_src_clk = {
3195 .ns_reg = CSIPHYTIMER_NS_REG,
3196 .b = {
3197 .ctl_reg = CSIPHYTIMER_CC_REG,
3198 .halt_check = NOCHECK,
3199 },
3200 .md_reg = CSIPHYTIMER_MD_REG,
3201 .root_en_mask = BIT(2),
3202 .ns_mask = (BM(31, 24) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003203 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003204 .ctl_mask = BM(7, 6),
3205 .set_rate = set_rate_mnd_8,
3206 .freq_tbl = clk_tbl_csi_phytimer,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003207 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003208 .c = {
3209 .dbg_name = "csiphy_timer_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003210 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003211 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003212 CLK_INIT(csiphy_timer_src_clk.c),
3213 },
3214};
3215
3216static struct branch_clk csi0phy_timer_clk = {
3217 .b = {
3218 .ctl_reg = CSIPHYTIMER_CC_REG,
3219 .en_mask = BIT(0),
3220 .halt_reg = DBG_BUS_VEC_I_REG,
3221 .halt_bit = 17,
3222 },
3223 .parent = &csiphy_timer_src_clk.c,
3224 .c = {
3225 .dbg_name = "csi0phy_timer_clk",
3226 .ops = &clk_ops_branch,
3227 CLK_INIT(csi0phy_timer_clk.c),
3228 },
3229};
3230
3231static struct branch_clk csi1phy_timer_clk = {
3232 .b = {
3233 .ctl_reg = CSIPHYTIMER_CC_REG,
3234 .en_mask = BIT(9),
3235 .halt_reg = DBG_BUS_VEC_I_REG,
3236 .halt_bit = 18,
3237 },
3238 .parent = &csiphy_timer_src_clk.c,
3239 .c = {
3240 .dbg_name = "csi1phy_timer_clk",
3241 .ops = &clk_ops_branch,
3242 CLK_INIT(csi1phy_timer_clk.c),
3243 },
3244};
3245
Stephen Boyd94625ef2011-07-12 17:06:01 -07003246static struct branch_clk csi2phy_timer_clk = {
3247 .b = {
3248 .ctl_reg = CSIPHYTIMER_CC_REG,
3249 .en_mask = BIT(11),
3250 .halt_reg = DBG_BUS_VEC_I_REG,
3251 .halt_bit = 30,
3252 },
3253 .parent = &csiphy_timer_src_clk.c,
3254 .c = {
3255 .dbg_name = "csi2phy_timer_clk",
3256 .ops = &clk_ops_branch,
3257 CLK_INIT(csi2phy_timer_clk.c),
3258 },
3259};
3260
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003261#define F_DSI(d) \
3262 { \
3263 .freq_hz = d, \
3264 .ns_val = BVAL(15, 12, (d-1)), \
3265 }
3266/*
3267 * The DSI_BYTE/ESC clock is sourced from the DSI PHY PLL, which may change rate
3268 * without this clock driver knowing. So, overload the clk_set_rate() to set
3269 * the divider (1 to 16) of the clock with respect to the PLL rate.
3270 */
3271static struct clk_freq_tbl clk_tbl_dsi_byte[] = {
3272 F_DSI(1), F_DSI(2), F_DSI(3), F_DSI(4),
3273 F_DSI(5), F_DSI(6), F_DSI(7), F_DSI(8),
3274 F_DSI(9), F_DSI(10), F_DSI(11), F_DSI(12),
3275 F_DSI(13), F_DSI(14), F_DSI(15), F_DSI(16),
3276 F_END
3277};
3278
Matt Wagantall735e41b2012-07-23 17:18:58 -07003279static struct branch_clk dsi1_reset_clk = {
3280 .b = {
3281 .reset_reg = SW_RESET_CORE_REG,
3282 .reset_mask = BIT(7),
3283 .halt_check = NOCHECK,
3284 },
3285 .c = {
3286 .dbg_name = "dsi1_reset_clk",
3287 .ops = &clk_ops_branch,
3288 CLK_INIT(dsi1_reset_clk.c),
3289 },
3290};
3291
3292static struct branch_clk dsi2_reset_clk = {
3293 .b = {
3294 .reset_reg = SW_RESET_CORE_REG,
3295 .reset_mask = BIT(25),
3296 .halt_check = NOCHECK,
3297 },
3298 .c = {
3299 .dbg_name = "dsi2_reset_clk",
3300 .ops = &clk_ops_branch,
3301 CLK_INIT(dsi2_reset_clk.c),
3302 },
3303};
3304
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003305static struct rcg_clk dsi1_byte_clk = {
3306 .b = {
3307 .ctl_reg = DSI1_BYTE_CC_REG,
3308 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003309 .halt_reg = DBG_BUS_VEC_B_REG,
3310 .halt_bit = 21,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003311 .retain_reg = DSI1_BYTE_CC_REG,
3312 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003313 },
3314 .ns_reg = DSI1_BYTE_NS_REG,
3315 .root_en_mask = BIT(2),
3316 .ns_mask = BM(15, 12),
3317 .set_rate = set_rate_nop,
3318 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003319 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003320 .c = {
3321 .dbg_name = "dsi1_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003322 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003323 CLK_INIT(dsi1_byte_clk.c),
3324 },
3325};
3326
3327static struct rcg_clk dsi2_byte_clk = {
3328 .b = {
3329 .ctl_reg = DSI2_BYTE_CC_REG,
3330 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003331 .halt_reg = DBG_BUS_VEC_B_REG,
3332 .halt_bit = 20,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003333 .retain_reg = DSI2_BYTE_CC_REG,
3334 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003335 },
3336 .ns_reg = DSI2_BYTE_NS_REG,
3337 .root_en_mask = BIT(2),
3338 .ns_mask = BM(15, 12),
3339 .set_rate = set_rate_nop,
3340 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003341 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003342 .c = {
3343 .dbg_name = "dsi2_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003344 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003345 CLK_INIT(dsi2_byte_clk.c),
3346 },
3347};
3348
3349static struct rcg_clk dsi1_esc_clk = {
3350 .b = {
3351 .ctl_reg = DSI1_ESC_CC_REG,
3352 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003353 .halt_reg = DBG_BUS_VEC_I_REG,
3354 .halt_bit = 1,
3355 },
3356 .ns_reg = DSI1_ESC_NS_REG,
3357 .root_en_mask = BIT(2),
3358 .ns_mask = BM(15, 12),
3359 .set_rate = set_rate_nop,
3360 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003361 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003362 .c = {
3363 .dbg_name = "dsi1_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003364 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003365 CLK_INIT(dsi1_esc_clk.c),
3366 },
3367};
3368
3369static struct rcg_clk dsi2_esc_clk = {
3370 .b = {
3371 .ctl_reg = DSI2_ESC_CC_REG,
3372 .en_mask = BIT(0),
3373 .halt_reg = DBG_BUS_VEC_I_REG,
3374 .halt_bit = 3,
3375 },
3376 .ns_reg = DSI2_ESC_NS_REG,
3377 .root_en_mask = BIT(2),
3378 .ns_mask = BM(15, 12),
3379 .set_rate = set_rate_nop,
3380 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003381 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003382 .c = {
3383 .dbg_name = "dsi2_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003384 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003385 CLK_INIT(dsi2_esc_clk.c),
3386 },
3387};
3388
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003389#define F_GFX2D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003390 { \
3391 .freq_hz = f, \
3392 .src_clk = &s##_clk.c, \
3393 .md_val = MD4(4, m, 0, n), \
3394 .ns_val = NS_MND_BANKED4(20, 16, n, m, 3, 0, s##_to_mm_mux), \
3395 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003396 }
3397static struct clk_freq_tbl clk_tbl_gfx2d[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003398 F_GFX2D( 0, gnd, 0, 0),
3399 F_GFX2D( 27000000, pxo, 0, 0),
3400 F_GFX2D( 48000000, pll8, 1, 8),
3401 F_GFX2D( 54857000, pll8, 1, 7),
3402 F_GFX2D( 64000000, pll8, 1, 6),
3403 F_GFX2D( 76800000, pll8, 1, 5),
3404 F_GFX2D( 96000000, pll8, 1, 4),
3405 F_GFX2D(128000000, pll8, 1, 3),
3406 F_GFX2D(145455000, pll2, 2, 11),
3407 F_GFX2D(160000000, pll2, 1, 5),
3408 F_GFX2D(177778000, pll2, 2, 9),
3409 F_GFX2D(200000000, pll2, 1, 4),
3410 F_GFX2D(228571000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003411 F_END
3412};
3413
3414static struct bank_masks bmnd_info_gfx2d0 = {
3415 .bank_sel_mask = BIT(11),
3416 .bank0_mask = {
3417 .md_reg = GFX2D0_MD0_REG,
3418 .ns_mask = BM(23, 20) | BM(5, 3),
3419 .rst_mask = BIT(25),
3420 .mnd_en_mask = BIT(8),
3421 .mode_mask = BM(10, 9),
3422 },
3423 .bank1_mask = {
3424 .md_reg = GFX2D0_MD1_REG,
3425 .ns_mask = BM(19, 16) | BM(2, 0),
3426 .rst_mask = BIT(24),
3427 .mnd_en_mask = BIT(5),
3428 .mode_mask = BM(7, 6),
3429 },
3430};
3431
3432static struct rcg_clk gfx2d0_clk = {
3433 .b = {
3434 .ctl_reg = GFX2D0_CC_REG,
3435 .en_mask = BIT(0),
3436 .reset_reg = SW_RESET_CORE_REG,
3437 .reset_mask = BIT(14),
3438 .halt_reg = DBG_BUS_VEC_A_REG,
3439 .halt_bit = 9,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003440 .retain_reg = GFX2D0_CC_REG,
3441 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003442 },
3443 .ns_reg = GFX2D0_NS_REG,
3444 .root_en_mask = BIT(2),
3445 .set_rate = set_rate_mnd_banked,
3446 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003447 .bank_info = &bmnd_info_gfx2d0,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003448 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003449 .c = {
3450 .dbg_name = "gfx2d0_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003451 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003452 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003453 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3454 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003455 CLK_INIT(gfx2d0_clk.c),
3456 },
3457};
3458
3459static struct bank_masks bmnd_info_gfx2d1 = {
3460 .bank_sel_mask = BIT(11),
3461 .bank0_mask = {
3462 .md_reg = GFX2D1_MD0_REG,
3463 .ns_mask = BM(23, 20) | BM(5, 3),
3464 .rst_mask = BIT(25),
3465 .mnd_en_mask = BIT(8),
3466 .mode_mask = BM(10, 9),
3467 },
3468 .bank1_mask = {
3469 .md_reg = GFX2D1_MD1_REG,
3470 .ns_mask = BM(19, 16) | BM(2, 0),
3471 .rst_mask = BIT(24),
3472 .mnd_en_mask = BIT(5),
3473 .mode_mask = BM(7, 6),
3474 },
3475};
3476
3477static struct rcg_clk gfx2d1_clk = {
3478 .b = {
3479 .ctl_reg = GFX2D1_CC_REG,
3480 .en_mask = BIT(0),
3481 .reset_reg = SW_RESET_CORE_REG,
3482 .reset_mask = BIT(13),
3483 .halt_reg = DBG_BUS_VEC_A_REG,
3484 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003485 .retain_reg = GFX2D1_CC_REG,
3486 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003487 },
3488 .ns_reg = GFX2D1_NS_REG,
3489 .root_en_mask = BIT(2),
3490 .set_rate = set_rate_mnd_banked,
3491 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003492 .bank_info = &bmnd_info_gfx2d1,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003493 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003494 .c = {
3495 .dbg_name = "gfx2d1_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003496 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003497 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003498 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3499 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003500 CLK_INIT(gfx2d1_clk.c),
3501 },
3502};
3503
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003504#define F_GFX3D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003505 { \
3506 .freq_hz = f, \
3507 .src_clk = &s##_clk.c, \
3508 .md_val = MD4(4, m, 0, n), \
3509 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3510 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003511 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003512
Patrick Dalye6f489042012-07-11 15:29:15 -07003513static struct clk_freq_tbl clk_tbl_gfx3d_8960ab[] = {
3514 F_GFX3D( 0, gnd, 0, 0),
3515 F_GFX3D( 27000000, pxo, 0, 0),
3516 F_GFX3D( 48000000, pll8, 1, 8),
3517 F_GFX3D( 54857000, pll8, 1, 7),
3518 F_GFX3D( 64000000, pll8, 1, 6),
3519 F_GFX3D( 76800000, pll8, 1, 5),
3520 F_GFX3D( 96000000, pll8, 1, 4),
3521 F_GFX3D(128000000, pll8, 1, 3),
3522 F_GFX3D(145455000, pll2, 2, 11),
3523 F_GFX3D(160000000, pll2, 1, 5),
3524 F_GFX3D(177778000, pll2, 2, 9),
3525 F_GFX3D(200000000, pll2, 1, 4),
3526 F_GFX3D(228571000, pll2, 2, 7),
3527 F_GFX3D(266667000, pll2, 1, 3),
3528 F_GFX3D(320000000, pll2, 2, 5),
3529 F_GFX3D(325000000, pll3, 1, 2),
3530 F_GFX3D(400000000, pll2, 1, 2),
3531 F_END
3532};
3533
Tianyi Gou41515e22011-09-01 19:37:43 -07003534static struct clk_freq_tbl clk_tbl_gfx3d_8960[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003535 F_GFX3D( 0, gnd, 0, 0),
3536 F_GFX3D( 27000000, pxo, 0, 0),
3537 F_GFX3D( 48000000, pll8, 1, 8),
3538 F_GFX3D( 54857000, pll8, 1, 7),
3539 F_GFX3D( 64000000, pll8, 1, 6),
3540 F_GFX3D( 76800000, pll8, 1, 5),
3541 F_GFX3D( 96000000, pll8, 1, 4),
3542 F_GFX3D(128000000, pll8, 1, 3),
3543 F_GFX3D(145455000, pll2, 2, 11),
3544 F_GFX3D(160000000, pll2, 1, 5),
3545 F_GFX3D(177778000, pll2, 2, 9),
3546 F_GFX3D(200000000, pll2, 1, 4),
3547 F_GFX3D(228571000, pll2, 2, 7),
3548 F_GFX3D(266667000, pll2, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003549 F_GFX3D(300000000, pll3, 1, 4),
3550 F_GFX3D(320000000, pll2, 2, 5),
3551 F_GFX3D(400000000, pll2, 1, 2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003552 F_END
3553};
3554
Tianyi Gou41515e22011-09-01 19:37:43 -07003555static struct clk_freq_tbl clk_tbl_gfx3d_8064[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003556 F_GFX3D( 0, gnd, 0, 0),
3557 F_GFX3D( 27000000, pxo, 0, 0),
3558 F_GFX3D( 48000000, pll8, 1, 8),
3559 F_GFX3D( 54857000, pll8, 1, 7),
3560 F_GFX3D( 64000000, pll8, 1, 6),
3561 F_GFX3D( 76800000, pll8, 1, 5),
3562 F_GFX3D( 96000000, pll8, 1, 4),
3563 F_GFX3D(128000000, pll8, 1, 3),
3564 F_GFX3D(145455000, pll2, 2, 11),
3565 F_GFX3D(160000000, pll2, 1, 5),
3566 F_GFX3D(177778000, pll2, 2, 9),
Patrick Dalyb7c777a2012-08-23 19:07:30 -07003567 F_GFX3D(192000000, pll8, 1, 2),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003568 F_GFX3D(200000000, pll2, 1, 4),
3569 F_GFX3D(228571000, pll2, 2, 7),
3570 F_GFX3D(266667000, pll2, 1, 3),
3571 F_GFX3D(400000000, pll2, 1, 2),
Patrick Dalyb7c777a2012-08-23 19:07:30 -07003572 F_GFX3D(450000000, pll15, 1, 2),
Tianyi Gou41515e22011-09-01 19:37:43 -07003573 F_END
3574};
3575
Tianyi Goue3d4f542012-03-15 17:06:45 -07003576static struct clk_freq_tbl clk_tbl_gfx3d_8930[] = {
3577 F_GFX3D( 0, gnd, 0, 0),
3578 F_GFX3D( 27000000, pxo, 0, 0),
3579 F_GFX3D( 48000000, pll8, 1, 8),
3580 F_GFX3D( 54857000, pll8, 1, 7),
3581 F_GFX3D( 64000000, pll8, 1, 6),
3582 F_GFX3D( 76800000, pll8, 1, 5),
3583 F_GFX3D( 96000000, pll8, 1, 4),
3584 F_GFX3D(128000000, pll8, 1, 3),
3585 F_GFX3D(145455000, pll2, 2, 11),
3586 F_GFX3D(160000000, pll2, 1, 5),
3587 F_GFX3D(177778000, pll2, 2, 9),
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003588 F_GFX3D(192000000, pll8, 1, 2),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003589 F_GFX3D(200000000, pll2, 1, 4),
3590 F_GFX3D(228571000, pll2, 2, 7),
3591 F_GFX3D(266667000, pll2, 1, 3),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003592 F_GFX3D(320000000, pll2, 2, 5),
3593 F_GFX3D(400000000, pll2, 1, 2),
3594 F_GFX3D(450000000, pll15, 1, 2),
3595 F_END
3596};
3597
Saravana Kannan55e959d2012-10-15 22:16:04 -07003598static unsigned long fmax_gfx3d_8064ab[VDD_DIG_NUM] = {
Patrick Dalyb7c777a2012-08-23 19:07:30 -07003599 [VDD_DIG_LOW] = 128000000,
3600 [VDD_DIG_NOMINAL] = 325000000,
3601 [VDD_DIG_HIGH] = 450000000
3602};
3603
Saravana Kannan55e959d2012-10-15 22:16:04 -07003604static unsigned long fmax_gfx3d_8064[VDD_DIG_NUM] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003605 [VDD_DIG_LOW] = 128000000,
3606 [VDD_DIG_NOMINAL] = 325000000,
3607 [VDD_DIG_HIGH] = 400000000
3608};
3609
Saravana Kannan55e959d2012-10-15 22:16:04 -07003610static unsigned long fmax_gfx3d_8930[VDD_DIG_NUM] = {
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003611 [VDD_DIG_LOW] = 192000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003612 [VDD_DIG_NOMINAL] = 320000000,
Patrick Dalyebe63c52012-08-07 15:41:30 -07003613 [VDD_DIG_HIGH] = 400000000
3614};
3615
Saravana Kannan55e959d2012-10-15 22:16:04 -07003616static unsigned long fmax_gfx3d_8930aa[VDD_DIG_NUM] = {
Patrick Dalyebe63c52012-08-07 15:41:30 -07003617 [VDD_DIG_LOW] = 192000000,
3618 [VDD_DIG_NOMINAL] = 320000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003619 [VDD_DIG_HIGH] = 450000000
3620};
3621
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003622static struct bank_masks bmnd_info_gfx3d = {
3623 .bank_sel_mask = BIT(11),
3624 .bank0_mask = {
3625 .md_reg = GFX3D_MD0_REG,
3626 .ns_mask = BM(21, 18) | BM(5, 3),
3627 .rst_mask = BIT(23),
3628 .mnd_en_mask = BIT(8),
3629 .mode_mask = BM(10, 9),
3630 },
3631 .bank1_mask = {
3632 .md_reg = GFX3D_MD1_REG,
3633 .ns_mask = BM(17, 14) | BM(2, 0),
3634 .rst_mask = BIT(22),
3635 .mnd_en_mask = BIT(5),
3636 .mode_mask = BM(7, 6),
3637 },
3638};
3639
3640static struct rcg_clk gfx3d_clk = {
3641 .b = {
3642 .ctl_reg = GFX3D_CC_REG,
3643 .en_mask = BIT(0),
3644 .reset_reg = SW_RESET_CORE_REG,
3645 .reset_mask = BIT(12),
3646 .halt_reg = DBG_BUS_VEC_A_REG,
3647 .halt_bit = 4,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003648 .retain_reg = GFX3D_CC_REG,
3649 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003650 },
3651 .ns_reg = GFX3D_NS_REG,
3652 .root_en_mask = BIT(2),
3653 .set_rate = set_rate_mnd_banked,
Tianyi Gou41515e22011-09-01 19:37:43 -07003654 .freq_tbl = clk_tbl_gfx3d_8960,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003655 .bank_info = &bmnd_info_gfx3d,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003656 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003657 .c = {
3658 .dbg_name = "gfx3d_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003659 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003660 VDD_DIG_FMAX_MAP3(LOW, 128000000, NOMINAL, 300000000,
3661 HIGH, 400000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003662 CLK_INIT(gfx3d_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003663 .depends = &gmem_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003664 },
3665};
3666
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003667#define F_VCAP(f, s, m, n) \
Tianyi Gou621f8742011-09-01 21:45:01 -07003668 { \
3669 .freq_hz = f, \
3670 .src_clk = &s##_clk.c, \
3671 .md_val = MD4(4, m, 0, n), \
3672 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3673 .ctl_val = CC_BANKED(9, 6, n), \
Tianyi Gou621f8742011-09-01 21:45:01 -07003674 }
3675
3676static struct clk_freq_tbl clk_tbl_vcap[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003677 F_VCAP( 0, gnd, 0, 0),
3678 F_VCAP( 27000000, pxo, 0, 0),
3679 F_VCAP( 54860000, pll8, 1, 7),
3680 F_VCAP( 64000000, pll8, 1, 6),
3681 F_VCAP( 76800000, pll8, 1, 5),
3682 F_VCAP(128000000, pll8, 1, 3),
3683 F_VCAP(160000000, pll2, 1, 5),
3684 F_VCAP(200000000, pll2, 1, 4),
Tianyi Gou621f8742011-09-01 21:45:01 -07003685 F_END
3686};
3687
3688static struct bank_masks bmnd_info_vcap = {
3689 .bank_sel_mask = BIT(11),
3690 .bank0_mask = {
3691 .md_reg = VCAP_MD0_REG,
3692 .ns_mask = BM(21, 18) | BM(5, 3),
3693 .rst_mask = BIT(23),
3694 .mnd_en_mask = BIT(8),
3695 .mode_mask = BM(10, 9),
3696 },
3697 .bank1_mask = {
3698 .md_reg = VCAP_MD1_REG,
3699 .ns_mask = BM(17, 14) | BM(2, 0),
3700 .rst_mask = BIT(22),
3701 .mnd_en_mask = BIT(5),
3702 .mode_mask = BM(7, 6),
3703 },
3704};
3705
3706static struct rcg_clk vcap_clk = {
3707 .b = {
3708 .ctl_reg = VCAP_CC_REG,
3709 .en_mask = BIT(0),
3710 .halt_reg = DBG_BUS_VEC_J_REG,
3711 .halt_bit = 15,
3712 },
3713 .ns_reg = VCAP_NS_REG,
3714 .root_en_mask = BIT(2),
3715 .set_rate = set_rate_mnd_banked,
3716 .freq_tbl = clk_tbl_vcap,
3717 .bank_info = &bmnd_info_vcap,
3718 .current_freq = &rcg_dummy_freq,
3719 .c = {
3720 .dbg_name = "vcap_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003721 .ops = &clk_ops_rcg,
Tianyi Gou621f8742011-09-01 21:45:01 -07003722 .depends = &vcap_axi_clk.c,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003723 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
Tianyi Gou621f8742011-09-01 21:45:01 -07003724 CLK_INIT(vcap_clk.c),
3725 },
3726};
3727
3728static struct branch_clk vcap_npl_clk = {
3729 .b = {
3730 .ctl_reg = VCAP_CC_REG,
3731 .en_mask = BIT(13),
3732 .halt_reg = DBG_BUS_VEC_J_REG,
3733 .halt_bit = 25,
3734 },
3735 .parent = &vcap_clk.c,
3736 .c = {
3737 .dbg_name = "vcap_npl_clk",
3738 .ops = &clk_ops_branch,
3739 CLK_INIT(vcap_npl_clk.c),
3740 },
3741};
3742
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003743#define F_IJPEG(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003744 { \
3745 .freq_hz = f, \
3746 .src_clk = &s##_clk.c, \
3747 .md_val = MD8(8, m, 0, n), \
3748 .ns_val = NS_MM(23, 16, n, m, 15, 12, d, 2, 0, s##_to_mm_mux), \
3749 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003750 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003751
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003752static struct clk_freq_tbl clk_tbl_ijpeg[] = {
3753 F_IJPEG( 0, gnd, 1, 0, 0),
3754 F_IJPEG( 27000000, pxo, 1, 0, 0),
3755 F_IJPEG( 36570000, pll8, 1, 2, 21),
3756 F_IJPEG( 54860000, pll8, 7, 0, 0),
3757 F_IJPEG( 96000000, pll8, 4, 0, 0),
3758 F_IJPEG(109710000, pll8, 1, 2, 7),
3759 F_IJPEG(128000000, pll8, 3, 0, 0),
3760 F_IJPEG(153600000, pll8, 1, 2, 5),
3761 F_IJPEG(200000000, pll2, 4, 0, 0),
3762 F_IJPEG(228571000, pll2, 1, 2, 7),
3763 F_IJPEG(266667000, pll2, 1, 1, 3),
3764 F_IJPEG(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003765 F_END
3766};
3767
Saravana Kannan55e959d2012-10-15 22:16:04 -07003768static unsigned long fmax_ijpeg_8064[VDD_DIG_NUM] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003769 [VDD_DIG_LOW] = 128000000,
3770 [VDD_DIG_NOMINAL] = 266667000,
3771 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07003772};
3773
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003774static struct rcg_clk ijpeg_clk = {
3775 .b = {
3776 .ctl_reg = IJPEG_CC_REG,
3777 .en_mask = BIT(0),
3778 .reset_reg = SW_RESET_CORE_REG,
3779 .reset_mask = BIT(9),
3780 .halt_reg = DBG_BUS_VEC_A_REG,
3781 .halt_bit = 24,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003782 .retain_reg = IJPEG_CC_REG,
3783 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003784 },
3785 .ns_reg = IJPEG_NS_REG,
3786 .md_reg = IJPEG_MD_REG,
3787 .root_en_mask = BIT(2),
3788 .ns_mask = (BM(23, 16) | BM(15, 12) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003789 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003790 .ctl_mask = BM(7, 6),
3791 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003792 .freq_tbl = clk_tbl_ijpeg,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003793 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003794 .c = {
3795 .dbg_name = "ijpeg_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003796 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003797 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
3798 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003799 CLK_INIT(ijpeg_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003800 .depends = &ijpeg_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003801 },
3802};
3803
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003804#define F_JPEGD(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003805 { \
3806 .freq_hz = f, \
3807 .src_clk = &s##_clk.c, \
3808 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003809 }
3810static struct clk_freq_tbl clk_tbl_jpegd[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003811 F_JPEGD( 0, gnd, 1),
3812 F_JPEGD( 64000000, pll8, 6),
3813 F_JPEGD( 76800000, pll8, 5),
3814 F_JPEGD( 96000000, pll8, 4),
3815 F_JPEGD(160000000, pll2, 5),
3816 F_JPEGD(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003817 F_END
3818};
3819
3820static struct rcg_clk jpegd_clk = {
3821 .b = {
3822 .ctl_reg = JPEGD_CC_REG,
3823 .en_mask = BIT(0),
3824 .reset_reg = SW_RESET_CORE_REG,
3825 .reset_mask = BIT(19),
3826 .halt_reg = DBG_BUS_VEC_A_REG,
3827 .halt_bit = 19,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003828 .retain_reg = JPEGD_CC_REG,
3829 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003830 },
3831 .ns_reg = JPEGD_NS_REG,
3832 .root_en_mask = BIT(2),
3833 .ns_mask = (BM(15, 12) | BM(2, 0)),
3834 .set_rate = set_rate_nop,
3835 .freq_tbl = clk_tbl_jpegd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003836 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003837 .c = {
3838 .dbg_name = "jpegd_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003839 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003840 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003841 CLK_INIT(jpegd_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003842 .depends = &jpegd_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003843 },
3844};
3845
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003846#define F_MDP(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003847 { \
3848 .freq_hz = f, \
3849 .src_clk = &s##_clk.c, \
3850 .md_val = MD8(8, m, 0, n), \
3851 .ns_val = NS_MND_BANKED8(22, 14, n, m, 3, 0, s##_to_mm_mux), \
3852 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003853 }
Patrick Dalye6f489042012-07-11 15:29:15 -07003854static struct clk_freq_tbl clk_tbl_mdp_8960ab[] = {
3855 F_MDP( 0, gnd, 0, 0),
3856 F_MDP( 9600000, pll8, 1, 40),
3857 F_MDP( 13710000, pll8, 1, 28),
3858 F_MDP( 27000000, pxo, 0, 0),
3859 F_MDP( 29540000, pll8, 1, 13),
3860 F_MDP( 34910000, pll8, 1, 11),
3861 F_MDP( 38400000, pll8, 1, 10),
3862 F_MDP( 59080000, pll8, 2, 13),
3863 F_MDP( 76800000, pll8, 1, 5),
3864 F_MDP( 85330000, pll8, 2, 9),
3865 F_MDP( 96000000, pll8, 1, 4),
3866 F_MDP(128000000, pll8, 1, 3),
3867 F_MDP(160000000, pll2, 1, 5),
3868 F_MDP(177780000, pll2, 2, 9),
3869 F_MDP(200000000, pll2, 1, 4),
3870 F_MDP(228571000, pll2, 2, 7),
3871 F_MDP(266667000, pll2, 1, 3),
3872 F_END
3873};
3874
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003875static struct clk_freq_tbl clk_tbl_mdp[] = {
3876 F_MDP( 0, gnd, 0, 0),
3877 F_MDP( 9600000, pll8, 1, 40),
3878 F_MDP( 13710000, pll8, 1, 28),
3879 F_MDP( 27000000, pxo, 0, 0),
3880 F_MDP( 29540000, pll8, 1, 13),
3881 F_MDP( 34910000, pll8, 1, 11),
3882 F_MDP( 38400000, pll8, 1, 10),
3883 F_MDP( 59080000, pll8, 2, 13),
3884 F_MDP( 76800000, pll8, 1, 5),
3885 F_MDP( 85330000, pll8, 2, 9),
3886 F_MDP( 96000000, pll8, 1, 4),
3887 F_MDP(128000000, pll8, 1, 3),
3888 F_MDP(160000000, pll2, 1, 5),
3889 F_MDP(177780000, pll2, 2, 9),
3890 F_MDP(200000000, pll2, 1, 4),
3891 F_MDP(266667000, pll2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003892 F_END
3893};
3894
Saravana Kannan55e959d2012-10-15 22:16:04 -07003895static unsigned long fmax_mdp_8064[VDD_DIG_NUM] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003896 [VDD_DIG_LOW] = 128000000,
3897 [VDD_DIG_NOMINAL] = 266667000
Tianyi Gou621f8742011-09-01 21:45:01 -07003898};
3899
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003900static struct bank_masks bmnd_info_mdp = {
3901 .bank_sel_mask = BIT(11),
3902 .bank0_mask = {
3903 .md_reg = MDP_MD0_REG,
3904 .ns_mask = BM(29, 22) | BM(5, 3),
3905 .rst_mask = BIT(31),
3906 .mnd_en_mask = BIT(8),
3907 .mode_mask = BM(10, 9),
3908 },
3909 .bank1_mask = {
3910 .md_reg = MDP_MD1_REG,
3911 .ns_mask = BM(21, 14) | BM(2, 0),
3912 .rst_mask = BIT(30),
3913 .mnd_en_mask = BIT(5),
3914 .mode_mask = BM(7, 6),
3915 },
3916};
3917
3918static struct rcg_clk mdp_clk = {
3919 .b = {
3920 .ctl_reg = MDP_CC_REG,
3921 .en_mask = BIT(0),
3922 .reset_reg = SW_RESET_CORE_REG,
3923 .reset_mask = BIT(21),
3924 .halt_reg = DBG_BUS_VEC_C_REG,
3925 .halt_bit = 10,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003926 .retain_reg = MDP_CC_REG,
3927 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003928 },
3929 .ns_reg = MDP_NS_REG,
3930 .root_en_mask = BIT(2),
3931 .set_rate = set_rate_mnd_banked,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003932 .freq_tbl = clk_tbl_mdp,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003933 .bank_info = &bmnd_info_mdp,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003934 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003935 .c = {
3936 .dbg_name = "mdp_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003937 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003938 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003939 CLK_INIT(mdp_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003940 .depends = &mdp_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003941 },
3942};
3943
3944static struct branch_clk lut_mdp_clk = {
3945 .b = {
3946 .ctl_reg = MDP_LUT_CC_REG,
3947 .en_mask = BIT(0),
3948 .halt_reg = DBG_BUS_VEC_I_REG,
3949 .halt_bit = 13,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003950 .retain_reg = MDP_LUT_CC_REG,
3951 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003952 },
3953 .parent = &mdp_clk.c,
3954 .c = {
3955 .dbg_name = "lut_mdp_clk",
3956 .ops = &clk_ops_branch,
3957 CLK_INIT(lut_mdp_clk.c),
3958 },
3959};
3960
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003961#define F_MDP_VSYNC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003962 { \
3963 .freq_hz = f, \
3964 .src_clk = &s##_clk.c, \
3965 .ns_val = NS_SRC_SEL(13, 13, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003966 }
3967static struct clk_freq_tbl clk_tbl_mdp_vsync[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003968 F_MDP_VSYNC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003969 F_END
3970};
3971
3972static struct rcg_clk mdp_vsync_clk = {
3973 .b = {
3974 .ctl_reg = MISC_CC_REG,
3975 .en_mask = BIT(6),
3976 .reset_reg = SW_RESET_CORE_REG,
3977 .reset_mask = BIT(3),
3978 .halt_reg = DBG_BUS_VEC_B_REG,
3979 .halt_bit = 22,
3980 },
3981 .ns_reg = MISC_CC2_REG,
3982 .ns_mask = BIT(13),
3983 .set_rate = set_rate_nop,
3984 .freq_tbl = clk_tbl_mdp_vsync,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003985 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003986 .c = {
3987 .dbg_name = "mdp_vsync_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003988 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003989 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003990 CLK_INIT(mdp_vsync_clk.c),
3991 },
3992};
3993
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003994#define F_ROT(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003995 { \
3996 .freq_hz = f, \
3997 .src_clk = &s##_clk.c, \
3998 .ns_val = NS_DIVSRC_BANKED(29, 26, 25, 22, d, \
3999 21, 19, 18, 16, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004000 }
4001static struct clk_freq_tbl clk_tbl_rot[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004002 F_ROT( 0, gnd, 1),
4003 F_ROT( 27000000, pxo, 1),
4004 F_ROT( 29540000, pll8, 13),
4005 F_ROT( 32000000, pll8, 12),
4006 F_ROT( 38400000, pll8, 10),
4007 F_ROT( 48000000, pll8, 8),
4008 F_ROT( 54860000, pll8, 7),
4009 F_ROT( 64000000, pll8, 6),
4010 F_ROT( 76800000, pll8, 5),
4011 F_ROT( 96000000, pll8, 4),
4012 F_ROT(100000000, pll2, 8),
4013 F_ROT(114290000, pll2, 7),
4014 F_ROT(133330000, pll2, 6),
4015 F_ROT(160000000, pll2, 5),
4016 F_ROT(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004017 F_END
4018};
4019
4020static struct bank_masks bdiv_info_rot = {
4021 .bank_sel_mask = BIT(30),
4022 .bank0_mask = {
4023 .ns_mask = BM(25, 22) | BM(18, 16),
4024 },
4025 .bank1_mask = {
4026 .ns_mask = BM(29, 26) | BM(21, 19),
4027 },
4028};
4029
4030static struct rcg_clk rot_clk = {
4031 .b = {
4032 .ctl_reg = ROT_CC_REG,
4033 .en_mask = BIT(0),
4034 .reset_reg = SW_RESET_CORE_REG,
4035 .reset_mask = BIT(2),
4036 .halt_reg = DBG_BUS_VEC_C_REG,
4037 .halt_bit = 15,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004038 .retain_reg = ROT_CC_REG,
4039 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004040 },
4041 .ns_reg = ROT_NS_REG,
4042 .root_en_mask = BIT(2),
4043 .set_rate = set_rate_div_banked,
4044 .freq_tbl = clk_tbl_rot,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004045 .bank_info = &bdiv_info_rot,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004046 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004047 .c = {
4048 .dbg_name = "rot_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004049 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004050 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004051 CLK_INIT(rot_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004052 .depends = &rot_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004053 },
4054};
4055
Matt Wagantallf82f2942012-01-27 13:56:13 -08004056static int hdmi_pll_clk_enable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004057{
4058 int ret;
4059 unsigned long flags;
4060 spin_lock_irqsave(&local_clock_reg_lock, flags);
4061 ret = hdmi_pll_enable();
4062 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4063 return ret;
4064}
4065
Matt Wagantallf82f2942012-01-27 13:56:13 -08004066static void hdmi_pll_clk_disable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004067{
4068 unsigned long flags;
4069 spin_lock_irqsave(&local_clock_reg_lock, flags);
4070 hdmi_pll_disable();
4071 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4072}
4073
Matt Wagantallf82f2942012-01-27 13:56:13 -08004074static struct clk *hdmi_pll_clk_get_parent(struct clk *c)
Stephen Boyd5b35dee2011-09-21 12:17:38 -07004075{
4076 return &pxo_clk.c;
4077}
4078
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004079static struct clk_ops clk_ops_hdmi_pll = {
4080 .enable = hdmi_pll_clk_enable,
4081 .disable = hdmi_pll_clk_disable,
Stephen Boyd5b35dee2011-09-21 12:17:38 -07004082 .get_parent = hdmi_pll_clk_get_parent,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004083};
4084
4085static struct clk hdmi_pll_clk = {
4086 .dbg_name = "hdmi_pll_clk",
4087 .ops = &clk_ops_hdmi_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -07004088 .vdd_class = &vdd_sr2_hdmi_pll,
Saravana Kannan55e959d2012-10-15 22:16:04 -07004089 .fmax = (unsigned long [VDD_SR2_HDMI_PLL_NUM]) {
4090 [VDD_SR2_HDMI_PLL_ON] = ULONG_MAX,
4091 },
4092 .num_fmax = VDD_SR2_HDMI_PLL_NUM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004093 CLK_INIT(hdmi_pll_clk),
4094};
4095
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004096#define F_TV_GND(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004097 { \
4098 .freq_hz = f, \
4099 .src_clk = &s##_clk.c, \
4100 .md_val = MD8(8, m, 0, n), \
4101 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
4102 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004103 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004104#define F_TV(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004105 { \
4106 .freq_hz = f, \
4107 .src_clk = &s##_clk, \
4108 .md_val = MD8(8, m, 0, n), \
4109 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
4110 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004111 .extra_freq_data = (void *)p_r, \
4112 }
4113/* Switching TV freqs requires PLL reconfiguration. */
4114static struct clk_freq_tbl clk_tbl_tv[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004115 F_TV_GND( 0, gnd, 0, 1, 0, 0),
4116 F_TV( 25200000, hdmi_pll, 25200000, 1, 0, 0),
4117 F_TV( 27000000, hdmi_pll, 27000000, 1, 0, 0),
4118 F_TV( 27030000, hdmi_pll, 27030000, 1, 0, 0),
4119 F_TV( 74250000, hdmi_pll, 74250000, 1, 0, 0),
4120 F_TV(148500000, hdmi_pll, 148500000, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004121 F_END
4122};
4123
Saravana Kannan55e959d2012-10-15 22:16:04 -07004124static unsigned long fmax_tv_src_8064[VDD_DIG_NUM] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004125 [VDD_DIG_LOW] = 74250000,
4126 [VDD_DIG_NOMINAL] = 149000000
4127};
4128
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004129/*
4130 * Unlike other clocks, the TV rate is adjusted through PLL
4131 * re-programming. It is also routed through an MND divider.
4132 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08004133void set_rate_tv(struct rcg_clk *rcg, struct clk_freq_tbl *nf)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004134{
4135 unsigned long pll_rate = (unsigned long)nf->extra_freq_data;
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004136 if (pll_rate) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004137 hdmi_pll_set_rate(pll_rate);
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004138 hdmi_pll_clk.rate = pll_rate;
4139 }
Matt Wagantallf82f2942012-01-27 13:56:13 -08004140 set_rate_mnd(rcg, nf);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004141}
4142
4143static struct rcg_clk tv_src_clk = {
4144 .ns_reg = TV_NS_REG,
4145 .b = {
4146 .ctl_reg = TV_CC_REG,
4147 .halt_check = NOCHECK,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004148 .retain_reg = TV_CC_REG,
4149 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004150 },
4151 .md_reg = TV_MD_REG,
4152 .root_en_mask = BIT(2),
4153 .ns_mask = (BM(23, 16) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004154 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004155 .ctl_mask = BM(7, 6),
4156 .set_rate = set_rate_tv,
4157 .freq_tbl = clk_tbl_tv,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004158 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004159 .c = {
4160 .dbg_name = "tv_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004161 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004162 VDD_DIG_FMAX_MAP2(LOW, 27030000, NOMINAL, 149000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004163 CLK_INIT(tv_src_clk.c),
4164 },
4165};
4166
Tianyi Gou51918802012-01-26 14:05:43 -08004167static struct cdiv_clk tv_src_div_clk = {
4168 .b = {
4169 .ctl_reg = TV_NS_REG,
4170 .halt_check = NOCHECK,
4171 },
4172 .ns_reg = TV_NS_REG,
4173 .div_offset = 6,
4174 .max_div = 2,
4175 .c = {
4176 .dbg_name = "tv_src_div_clk",
4177 .ops = &clk_ops_cdiv,
4178 CLK_INIT(tv_src_div_clk.c),
Stephen Boydd51d5e82012-06-18 18:09:50 -07004179 .rate = ULONG_MAX,
Tianyi Gou51918802012-01-26 14:05:43 -08004180 },
4181};
4182
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004183static struct branch_clk tv_enc_clk = {
4184 .b = {
4185 .ctl_reg = TV_CC_REG,
4186 .en_mask = BIT(8),
4187 .reset_reg = SW_RESET_CORE_REG,
4188 .reset_mask = BIT(0),
4189 .halt_reg = DBG_BUS_VEC_D_REG,
4190 .halt_bit = 9,
4191 },
4192 .parent = &tv_src_clk.c,
4193 .c = {
4194 .dbg_name = "tv_enc_clk",
4195 .ops = &clk_ops_branch,
4196 CLK_INIT(tv_enc_clk.c),
4197 },
4198};
4199
4200static struct branch_clk tv_dac_clk = {
4201 .b = {
4202 .ctl_reg = TV_CC_REG,
4203 .en_mask = BIT(10),
4204 .halt_reg = DBG_BUS_VEC_D_REG,
4205 .halt_bit = 10,
4206 },
4207 .parent = &tv_src_clk.c,
4208 .c = {
4209 .dbg_name = "tv_dac_clk",
4210 .ops = &clk_ops_branch,
4211 CLK_INIT(tv_dac_clk.c),
4212 },
4213};
4214
4215static struct branch_clk mdp_tv_clk = {
4216 .b = {
4217 .ctl_reg = TV_CC_REG,
4218 .en_mask = BIT(0),
4219 .reset_reg = SW_RESET_CORE_REG,
4220 .reset_mask = BIT(4),
4221 .halt_reg = DBG_BUS_VEC_D_REG,
4222 .halt_bit = 12,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004223 .retain_reg = TV_CC2_REG,
4224 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004225 },
4226 .parent = &tv_src_clk.c,
4227 .c = {
4228 .dbg_name = "mdp_tv_clk",
4229 .ops = &clk_ops_branch,
4230 CLK_INIT(mdp_tv_clk.c),
4231 },
4232};
4233
4234static struct branch_clk hdmi_tv_clk = {
4235 .b = {
4236 .ctl_reg = TV_CC_REG,
4237 .en_mask = BIT(12),
4238 .reset_reg = SW_RESET_CORE_REG,
4239 .reset_mask = BIT(1),
4240 .halt_reg = DBG_BUS_VEC_D_REG,
4241 .halt_bit = 11,
4242 },
4243 .parent = &tv_src_clk.c,
4244 .c = {
4245 .dbg_name = "hdmi_tv_clk",
4246 .ops = &clk_ops_branch,
4247 CLK_INIT(hdmi_tv_clk.c),
4248 },
4249};
4250
Tianyi Gou51918802012-01-26 14:05:43 -08004251static struct branch_clk rgb_tv_clk = {
4252 .b = {
4253 .ctl_reg = TV_CC2_REG,
4254 .en_mask = BIT(14),
4255 .halt_reg = DBG_BUS_VEC_J_REG,
4256 .halt_bit = 27,
4257 },
4258 .parent = &tv_src_clk.c,
4259 .c = {
4260 .dbg_name = "rgb_tv_clk",
4261 .ops = &clk_ops_branch,
4262 CLK_INIT(rgb_tv_clk.c),
4263 },
4264};
4265
4266static struct branch_clk npl_tv_clk = {
4267 .b = {
4268 .ctl_reg = TV_CC2_REG,
4269 .en_mask = BIT(16),
4270 .halt_reg = DBG_BUS_VEC_J_REG,
4271 .halt_bit = 26,
4272 },
4273 .parent = &tv_src_clk.c,
4274 .c = {
4275 .dbg_name = "npl_tv_clk",
4276 .ops = &clk_ops_branch,
4277 CLK_INIT(npl_tv_clk.c),
4278 },
4279};
4280
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004281static struct branch_clk hdmi_app_clk = {
4282 .b = {
4283 .ctl_reg = MISC_CC2_REG,
4284 .en_mask = BIT(11),
4285 .reset_reg = SW_RESET_CORE_REG,
4286 .reset_mask = BIT(11),
4287 .halt_reg = DBG_BUS_VEC_B_REG,
4288 .halt_bit = 25,
4289 },
4290 .c = {
4291 .dbg_name = "hdmi_app_clk",
4292 .ops = &clk_ops_branch,
4293 CLK_INIT(hdmi_app_clk.c),
4294 },
4295};
4296
4297static struct bank_masks bmnd_info_vcodec = {
4298 .bank_sel_mask = BIT(13),
4299 .bank0_mask = {
4300 .md_reg = VCODEC_MD0_REG,
4301 .ns_mask = BM(18, 11) | BM(2, 0),
4302 .rst_mask = BIT(31),
4303 .mnd_en_mask = BIT(5),
4304 .mode_mask = BM(7, 6),
4305 },
4306 .bank1_mask = {
4307 .md_reg = VCODEC_MD1_REG,
4308 .ns_mask = BM(26, 19) | BM(29, 27),
4309 .rst_mask = BIT(30),
4310 .mnd_en_mask = BIT(10),
4311 .mode_mask = BM(12, 11),
4312 },
4313};
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004314#define F_VCODEC(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004315 { \
4316 .freq_hz = f, \
4317 .src_clk = &s##_clk.c, \
4318 .md_val = MD8(8, m, 0, n), \
4319 .ns_val = NS_MND_BANKED8(11, 19, n, m, 0, 27, s##_to_mm_mux), \
4320 .ctl_val = CC_BANKED(6, 11, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004321 }
4322static struct clk_freq_tbl clk_tbl_vcodec[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004323 F_VCODEC( 0, gnd, 0, 0),
4324 F_VCODEC( 27000000, pxo, 0, 0),
4325 F_VCODEC( 32000000, pll8, 1, 12),
4326 F_VCODEC( 48000000, pll8, 1, 8),
4327 F_VCODEC( 54860000, pll8, 1, 7),
4328 F_VCODEC( 96000000, pll8, 1, 4),
4329 F_VCODEC(133330000, pll2, 1, 6),
4330 F_VCODEC(200000000, pll2, 1, 4),
4331 F_VCODEC(228570000, pll2, 2, 7),
Patrick Dalyb7c777a2012-08-23 19:07:30 -07004332 F_VCODEC(266670000, pll2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004333 F_END
4334};
4335
4336static struct rcg_clk vcodec_clk = {
4337 .b = {
4338 .ctl_reg = VCODEC_CC_REG,
4339 .en_mask = BIT(0),
4340 .reset_reg = SW_RESET_CORE_REG,
4341 .reset_mask = BIT(6),
4342 .halt_reg = DBG_BUS_VEC_C_REG,
4343 .halt_bit = 29,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004344 .retain_reg = VCODEC_CC_REG,
4345 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004346 },
4347 .ns_reg = VCODEC_NS_REG,
4348 .root_en_mask = BIT(2),
4349 .set_rate = set_rate_mnd_banked,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004350 .bank_info = &bmnd_info_vcodec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004351 .freq_tbl = clk_tbl_vcodec,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004352 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004353 .c = {
4354 .dbg_name = "vcodec_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004355 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004356 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
4357 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004358 CLK_INIT(vcodec_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004359 .depends = &vcodec_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004360 },
4361};
4362
Saravana Kannan55e959d2012-10-15 22:16:04 -07004363static unsigned long fmax_vcodec_8064v2[VDD_DIG_NUM] = {
Patrick Dalyb7c777a2012-08-23 19:07:30 -07004364 [VDD_DIG_LOW] = 100000000,
4365 [VDD_DIG_NOMINAL] = 200000000,
4366 [VDD_DIG_HIGH] = 266670000,
4367};
4368
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004369#define F_VPE(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004370 { \
4371 .freq_hz = f, \
4372 .src_clk = &s##_clk.c, \
4373 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004374 }
4375static struct clk_freq_tbl clk_tbl_vpe[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004376 F_VPE( 0, gnd, 1),
4377 F_VPE( 27000000, pxo, 1),
4378 F_VPE( 34909000, pll8, 11),
4379 F_VPE( 38400000, pll8, 10),
4380 F_VPE( 64000000, pll8, 6),
4381 F_VPE( 76800000, pll8, 5),
4382 F_VPE( 96000000, pll8, 4),
4383 F_VPE(100000000, pll2, 8),
4384 F_VPE(160000000, pll2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004385 F_END
4386};
4387
4388static struct rcg_clk vpe_clk = {
4389 .b = {
4390 .ctl_reg = VPE_CC_REG,
4391 .en_mask = BIT(0),
4392 .reset_reg = SW_RESET_CORE_REG,
4393 .reset_mask = BIT(17),
4394 .halt_reg = DBG_BUS_VEC_A_REG,
4395 .halt_bit = 28,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004396 .retain_reg = VPE_CC_REG,
4397 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004398 },
4399 .ns_reg = VPE_NS_REG,
4400 .root_en_mask = BIT(2),
4401 .ns_mask = (BM(15, 12) | BM(2, 0)),
4402 .set_rate = set_rate_nop,
4403 .freq_tbl = clk_tbl_vpe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004404 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004405 .c = {
4406 .dbg_name = "vpe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004407 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004408 VDD_DIG_FMAX_MAP2(LOW, 76800000, NOMINAL, 160000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004409 CLK_INIT(vpe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004410 .depends = &vpe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004411 },
4412};
4413
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004414#define F_VFE(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004415 { \
4416 .freq_hz = f, \
4417 .src_clk = &s##_clk.c, \
4418 .md_val = MD8(8, m, 0, n), \
4419 .ns_val = NS_MM(23, 16, n, m, 11, 10, d, 2, 0, s##_to_mm_mux), \
4420 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004421 }
Tianyi Gou41515e22011-09-01 19:37:43 -07004422
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004423static struct clk_freq_tbl clk_tbl_vfe[] = {
4424 F_VFE( 0, gnd, 1, 0, 0),
4425 F_VFE( 13960000, pll8, 1, 2, 55),
4426 F_VFE( 27000000, pxo, 1, 0, 0),
4427 F_VFE( 36570000, pll8, 1, 2, 21),
4428 F_VFE( 38400000, pll8, 2, 1, 5),
4429 F_VFE( 45180000, pll8, 1, 2, 17),
4430 F_VFE( 48000000, pll8, 2, 1, 4),
4431 F_VFE( 54860000, pll8, 1, 1, 7),
4432 F_VFE( 64000000, pll8, 2, 1, 3),
4433 F_VFE( 76800000, pll8, 1, 1, 5),
4434 F_VFE( 96000000, pll8, 2, 1, 2),
4435 F_VFE(109710000, pll8, 1, 2, 7),
4436 F_VFE(128000000, pll8, 1, 1, 3),
4437 F_VFE(153600000, pll8, 1, 2, 5),
4438 F_VFE(200000000, pll2, 2, 1, 2),
4439 F_VFE(228570000, pll2, 1, 2, 7),
4440 F_VFE(266667000, pll2, 1, 1, 3),
4441 F_VFE(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004442 F_END
4443};
4444
Saravana Kannan55e959d2012-10-15 22:16:04 -07004445static unsigned long fmax_vfe_8064[VDD_DIG_NUM] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004446 [VDD_DIG_LOW] = 128000000,
4447 [VDD_DIG_NOMINAL] = 266667000,
4448 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07004449};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004450
4451static struct rcg_clk vfe_clk = {
4452 .b = {
4453 .ctl_reg = VFE_CC_REG,
4454 .reset_reg = SW_RESET_CORE_REG,
4455 .reset_mask = BIT(15),
4456 .halt_reg = DBG_BUS_VEC_B_REG,
4457 .halt_bit = 6,
4458 .en_mask = BIT(0),
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004459 .retain_reg = VFE_CC2_REG,
4460 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004461 },
4462 .ns_reg = VFE_NS_REG,
4463 .md_reg = VFE_MD_REG,
4464 .root_en_mask = BIT(2),
4465 .ns_mask = (BM(23, 16) | BM(11, 10) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004466 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004467 .ctl_mask = BM(7, 6),
4468 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004469 .freq_tbl = clk_tbl_vfe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004470 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004471 .c = {
4472 .dbg_name = "vfe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004473 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08004474 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
4475 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004476 CLK_INIT(vfe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004477 .depends = &vfe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004478 },
4479};
4480
Matt Wagantallc23eee92011-08-16 23:06:52 -07004481static struct branch_clk csi_vfe_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004482 .b = {
4483 .ctl_reg = VFE_CC_REG,
4484 .en_mask = BIT(12),
4485 .reset_reg = SW_RESET_CORE_REG,
4486 .reset_mask = BIT(24),
4487 .halt_reg = DBG_BUS_VEC_B_REG,
4488 .halt_bit = 8,
4489 },
4490 .parent = &vfe_clk.c,
4491 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -07004492 .dbg_name = "csi_vfe_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004493 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -07004494 CLK_INIT(csi_vfe_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004495 },
4496};
4497
4498/*
4499 * Low Power Audio Clocks
4500 */
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004501#define F_AIF_OSR(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004502 { \
4503 .freq_hz = f, \
4504 .src_clk = &s##_clk.c, \
4505 .md_val = MD8(8, m, 0, n), \
4506 .ns_val = NS(31, 24, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004507 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004508static struct clk_freq_tbl clk_tbl_aif_osr_492[] = {
4509 F_AIF_OSR( 0, gnd, 1, 0, 0),
4510 F_AIF_OSR( 512000, pll4, 4, 1, 240),
4511 F_AIF_OSR( 768000, pll4, 4, 1, 160),
4512 F_AIF_OSR( 1024000, pll4, 4, 1, 120),
4513 F_AIF_OSR( 1536000, pll4, 4, 1, 80),
4514 F_AIF_OSR( 2048000, pll4, 4, 1, 60),
4515 F_AIF_OSR( 3072000, pll4, 4, 1, 40),
4516 F_AIF_OSR( 4096000, pll4, 4, 1, 30),
4517 F_AIF_OSR( 6144000, pll4, 4, 1, 20),
4518 F_AIF_OSR( 8192000, pll4, 4, 1, 15),
4519 F_AIF_OSR(12288000, pll4, 4, 1, 10),
4520 F_AIF_OSR(24576000, pll4, 4, 1, 5),
Matt Wagantallac15a372012-10-10 23:36:20 -07004521 F_AIF_OSR(27000000, pxo, 1, 0, 0),
Matt Wagantall86e03822011-12-12 10:59:24 -08004522 F_END
4523};
4524
4525static struct clk_freq_tbl clk_tbl_aif_osr_393[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004526 F_AIF_OSR( 0, gnd, 1, 0, 0),
4527 F_AIF_OSR( 512000, pll4, 4, 1, 192),
4528 F_AIF_OSR( 768000, pll4, 4, 1, 128),
4529 F_AIF_OSR( 1024000, pll4, 4, 1, 96),
4530 F_AIF_OSR( 1536000, pll4, 4, 1, 64),
4531 F_AIF_OSR( 2048000, pll4, 4, 1, 48),
4532 F_AIF_OSR( 3072000, pll4, 4, 1, 32),
4533 F_AIF_OSR( 4096000, pll4, 4, 1, 24),
4534 F_AIF_OSR( 6144000, pll4, 4, 1, 16),
4535 F_AIF_OSR( 8192000, pll4, 4, 1, 12),
4536 F_AIF_OSR(12288000, pll4, 4, 1, 8),
4537 F_AIF_OSR(24576000, pll4, 4, 1, 4),
Matt Wagantallac15a372012-10-10 23:36:20 -07004538 F_AIF_OSR(27000000, pxo, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004539 F_END
4540};
4541
4542#define CLK_AIF_OSR(i, ns, md, h_r) \
4543 struct rcg_clk i##_clk = { \
4544 .b = { \
4545 .ctl_reg = ns, \
4546 .en_mask = BIT(17), \
4547 .reset_reg = ns, \
4548 .reset_mask = BIT(19), \
4549 .halt_reg = h_r, \
4550 .halt_check = ENABLE, \
4551 .halt_bit = 1, \
4552 }, \
4553 .ns_reg = ns, \
4554 .md_reg = md, \
4555 .root_en_mask = BIT(9), \
4556 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004557 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004558 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004559 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004560 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004561 .c = { \
4562 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004563 .ops = &clk_ops_rcg, \
Matt Wagantallac15a372012-10-10 23:36:20 -07004564 VDD_DIG_FMAX_MAP1(LOW, 27000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004565 CLK_INIT(i##_clk.c), \
4566 }, \
4567 }
4568#define CLK_AIF_OSR_DIV(i, ns, md, h_r) \
4569 struct rcg_clk i##_clk = { \
4570 .b = { \
4571 .ctl_reg = ns, \
4572 .en_mask = BIT(21), \
4573 .reset_reg = ns, \
4574 .reset_mask = BIT(23), \
4575 .halt_reg = h_r, \
4576 .halt_check = ENABLE, \
4577 .halt_bit = 1, \
4578 }, \
4579 .ns_reg = ns, \
4580 .md_reg = md, \
4581 .root_en_mask = BIT(9), \
4582 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004583 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004584 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004585 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004586 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004587 .c = { \
4588 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004589 .ops = &clk_ops_rcg, \
Matt Wagantallac15a372012-10-10 23:36:20 -07004590 VDD_DIG_FMAX_MAP1(LOW, 27000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004591 CLK_INIT(i##_clk.c), \
4592 }, \
4593 }
4594
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004595#define CLK_AIF_BIT(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004596 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004597 .b = { \
4598 .ctl_reg = ns, \
4599 .en_mask = BIT(15), \
4600 .halt_reg = h_r, \
4601 .halt_check = DELAY, \
4602 }, \
4603 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004604 .ext_mask = BIT(14), \
4605 .div_offset = 10, \
4606 .max_div = 16, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004607 .c = { \
4608 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004609 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004610 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004611 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004612 }, \
4613 }
4614
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004615#define CLK_AIF_BIT_DIV(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004616 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004617 .b = { \
4618 .ctl_reg = ns, \
4619 .en_mask = BIT(19), \
4620 .halt_reg = h_r, \
Stephen Boyd7bb9cf82012-01-25 18:09:01 -08004621 .halt_check = DELAY, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004622 }, \
4623 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004624 .ext_mask = BIT(18), \
4625 .div_offset = 10, \
4626 .max_div = 256, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004627 .c = { \
4628 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004629 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004630 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004631 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004632 }, \
4633 }
4634
4635static CLK_AIF_OSR(mi2s_osr, LCC_MI2S_NS_REG, LCC_MI2S_MD_REG,
4636 LCC_MI2S_STATUS_REG);
4637static CLK_AIF_BIT(mi2s_bit, LCC_MI2S_NS_REG, LCC_MI2S_STATUS_REG);
4638
4639static CLK_AIF_OSR_DIV(codec_i2s_mic_osr, LCC_CODEC_I2S_MIC_NS_REG,
4640 LCC_CODEC_I2S_MIC_MD_REG, LCC_CODEC_I2S_MIC_STATUS_REG);
4641static CLK_AIF_BIT_DIV(codec_i2s_mic_bit, LCC_CODEC_I2S_MIC_NS_REG,
4642 LCC_CODEC_I2S_MIC_STATUS_REG);
4643
4644static CLK_AIF_OSR_DIV(spare_i2s_mic_osr, LCC_SPARE_I2S_MIC_NS_REG,
4645 LCC_SPARE_I2S_MIC_MD_REG, LCC_SPARE_I2S_MIC_STATUS_REG);
4646static CLK_AIF_BIT_DIV(spare_i2s_mic_bit, LCC_SPARE_I2S_MIC_NS_REG,
4647 LCC_SPARE_I2S_MIC_STATUS_REG);
4648
4649static CLK_AIF_OSR_DIV(codec_i2s_spkr_osr, LCC_CODEC_I2S_SPKR_NS_REG,
4650 LCC_CODEC_I2S_SPKR_MD_REG, LCC_CODEC_I2S_SPKR_STATUS_REG);
4651static CLK_AIF_BIT_DIV(codec_i2s_spkr_bit, LCC_CODEC_I2S_SPKR_NS_REG,
4652 LCC_CODEC_I2S_SPKR_STATUS_REG);
4653
4654static CLK_AIF_OSR_DIV(spare_i2s_spkr_osr, LCC_SPARE_I2S_SPKR_NS_REG,
4655 LCC_SPARE_I2S_SPKR_MD_REG, LCC_SPARE_I2S_SPKR_STATUS_REG);
4656static CLK_AIF_BIT_DIV(spare_i2s_spkr_bit, LCC_SPARE_I2S_SPKR_NS_REG,
4657 LCC_SPARE_I2S_SPKR_STATUS_REG);
4658
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004659#define F_PCM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004660 { \
4661 .freq_hz = f, \
4662 .src_clk = &s##_clk.c, \
4663 .md_val = MD16(m, n), \
4664 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004665 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004666static struct clk_freq_tbl clk_tbl_pcm_492[] = {
4667 { .ns_val = BIT(10) /* external input */ },
Stephen Boyde9ed94d2012-08-02 10:57:11 -07004668 F_PCM( 256000, pll4, 4, 1, 480),
Matt Wagantall86e03822011-12-12 10:59:24 -08004669 F_PCM( 512000, pll4, 4, 1, 240),
4670 F_PCM( 768000, pll4, 4, 1, 160),
4671 F_PCM( 1024000, pll4, 4, 1, 120),
4672 F_PCM( 1536000, pll4, 4, 1, 80),
4673 F_PCM( 2048000, pll4, 4, 1, 60),
4674 F_PCM( 3072000, pll4, 4, 1, 40),
4675 F_PCM( 4096000, pll4, 4, 1, 30),
4676 F_PCM( 6144000, pll4, 4, 1, 20),
4677 F_PCM( 8192000, pll4, 4, 1, 15),
4678 F_PCM(12288000, pll4, 4, 1, 10),
4679 F_PCM(24576000, pll4, 4, 1, 5),
Matt Wagantallac15a372012-10-10 23:36:20 -07004680 F_PCM(27000000, pxo, 1, 0, 0),
Matt Wagantall86e03822011-12-12 10:59:24 -08004681 F_END
4682};
4683
4684static struct clk_freq_tbl clk_tbl_pcm_393[] = {
Stephen Boyd630f3252012-01-31 00:10:08 -08004685 { .ns_val = BIT(10) /* external input */ },
Stephen Boyde9ed94d2012-08-02 10:57:11 -07004686 F_PCM( 256000, pll4, 4, 1, 384),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004687 F_PCM( 512000, pll4, 4, 1, 192),
4688 F_PCM( 768000, pll4, 4, 1, 128),
4689 F_PCM( 1024000, pll4, 4, 1, 96),
4690 F_PCM( 1536000, pll4, 4, 1, 64),
4691 F_PCM( 2048000, pll4, 4, 1, 48),
4692 F_PCM( 3072000, pll4, 4, 1, 32),
4693 F_PCM( 4096000, pll4, 4, 1, 24),
4694 F_PCM( 6144000, pll4, 4, 1, 16),
4695 F_PCM( 8192000, pll4, 4, 1, 12),
4696 F_PCM(12288000, pll4, 4, 1, 8),
4697 F_PCM(24576000, pll4, 4, 1, 4),
Matt Wagantallac15a372012-10-10 23:36:20 -07004698 F_PCM(27000000, pxo, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004699 F_END
4700};
4701
4702static struct rcg_clk pcm_clk = {
4703 .b = {
4704 .ctl_reg = LCC_PCM_NS_REG,
4705 .en_mask = BIT(11),
4706 .reset_reg = LCC_PCM_NS_REG,
4707 .reset_mask = BIT(13),
4708 .halt_reg = LCC_PCM_STATUS_REG,
4709 .halt_check = ENABLE,
4710 .halt_bit = 0,
4711 },
4712 .ns_reg = LCC_PCM_NS_REG,
4713 .md_reg = LCC_PCM_MD_REG,
4714 .root_en_mask = BIT(9),
Stephen Boyd630f3252012-01-31 00:10:08 -08004715 .ns_mask = BM(31, 16) | BIT(10) | BM(6, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08004716 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004717 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004718 .freq_tbl = clk_tbl_pcm_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004719 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004720 .c = {
4721 .dbg_name = "pcm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004722 .ops = &clk_ops_rcg,
Matt Wagantallac15a372012-10-10 23:36:20 -07004723 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004724 CLK_INIT(pcm_clk.c),
Stephen Boydc5492fc2012-06-18 18:47:03 -07004725 .rate = ULONG_MAX,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004726 },
4727};
4728
4729static struct rcg_clk audio_slimbus_clk = {
4730 .b = {
4731 .ctl_reg = LCC_SLIMBUS_NS_REG,
4732 .en_mask = BIT(10),
4733 .reset_reg = LCC_AHBEX_BRANCH_CTL_REG,
4734 .reset_mask = BIT(5),
4735 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4736 .halt_check = ENABLE,
4737 .halt_bit = 0,
4738 },
4739 .ns_reg = LCC_SLIMBUS_NS_REG,
4740 .md_reg = LCC_SLIMBUS_MD_REG,
4741 .root_en_mask = BIT(9),
4742 .ns_mask = (BM(31, 24) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004743 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004744 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004745 .freq_tbl = clk_tbl_aif_osr_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004746 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004747 .c = {
4748 .dbg_name = "audio_slimbus_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004749 .ops = &clk_ops_rcg,
Matt Wagantallac15a372012-10-10 23:36:20 -07004750 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004751 CLK_INIT(audio_slimbus_clk.c),
4752 },
4753};
4754
4755static struct branch_clk sps_slimbus_clk = {
4756 .b = {
4757 .ctl_reg = LCC_SLIMBUS_NS_REG,
4758 .en_mask = BIT(12),
4759 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4760 .halt_check = ENABLE,
4761 .halt_bit = 1,
4762 },
4763 .parent = &audio_slimbus_clk.c,
4764 .c = {
4765 .dbg_name = "sps_slimbus_clk",
4766 .ops = &clk_ops_branch,
4767 CLK_INIT(sps_slimbus_clk.c),
4768 },
4769};
4770
4771static struct branch_clk slimbus_xo_src_clk = {
4772 .b = {
4773 .ctl_reg = SLIMBUS_XO_SRC_CLK_CTL_REG,
4774 .en_mask = BIT(2),
4775 .halt_reg = CLK_HALT_DFAB_STATE_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004776 .halt_bit = 28,
4777 },
4778 .parent = &sps_slimbus_clk.c,
4779 .c = {
4780 .dbg_name = "slimbus_xo_src_clk",
4781 .ops = &clk_ops_branch,
4782 CLK_INIT(slimbus_xo_src_clk.c),
4783 },
4784};
4785
Matt Wagantall735f01a2011-08-12 12:40:28 -07004786DEFINE_CLK_RPM(afab_clk, afab_a_clk, APPS_FABRIC, NULL);
4787DEFINE_CLK_RPM(cfpb_clk, cfpb_a_clk, CFPB, NULL);
4788DEFINE_CLK_RPM(dfab_clk, dfab_a_clk, DAYTONA_FABRIC, NULL);
4789DEFINE_CLK_RPM(ebi1_clk, ebi1_a_clk, EBI1, NULL);
4790DEFINE_CLK_RPM(mmfab_clk, mmfab_a_clk, MM_FABRIC, NULL);
4791DEFINE_CLK_RPM(mmfpb_clk, mmfpb_a_clk, MMFPB, NULL);
4792DEFINE_CLK_RPM(sfab_clk, sfab_a_clk, SYSTEM_FABRIC, NULL);
4793DEFINE_CLK_RPM(sfpb_clk, sfpb_a_clk, SFPB, NULL);
Stephen Boydc7fc3b12012-05-17 14:42:46 -07004794DEFINE_CLK_RPM_QDSS(qdss_clk, qdss_a_clk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004795
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004796static DEFINE_CLK_VOTER(sfab_msmbus_a_clk, &sfab_a_clk.c, 0);
4797static DEFINE_CLK_VOTER(sfab_tmr_a_clk, &sfab_a_clk.c, 0);
Stephen Boydd7a143a2012-02-16 17:59:26 -08004798
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004799static DEFINE_CLK_VOTER(dfab_dsps_clk, &dfab_clk.c, 0);
4800static DEFINE_CLK_VOTER(dfab_usb_hs_clk, &dfab_clk.c, 0);
4801static DEFINE_CLK_VOTER(dfab_usb_hs3_clk, &dfab_clk.c, 0);
4802static DEFINE_CLK_VOTER(dfab_usb_hs4_clk, &dfab_clk.c, 0);
4803static DEFINE_CLK_VOTER(dfab_sdc1_clk, &dfab_clk.c, 0);
4804static DEFINE_CLK_VOTER(dfab_sdc2_clk, &dfab_clk.c, 0);
4805static DEFINE_CLK_VOTER(dfab_sdc3_clk, &dfab_clk.c, 0);
4806static DEFINE_CLK_VOTER(dfab_sdc4_clk, &dfab_clk.c, 0);
4807static DEFINE_CLK_VOTER(dfab_sdc5_clk, &dfab_clk.c, 0);
4808static DEFINE_CLK_VOTER(dfab_sps_clk, &dfab_clk.c, 0);
4809static DEFINE_CLK_VOTER(dfab_bam_dmux_clk, &dfab_clk.c, 0);
4810static DEFINE_CLK_VOTER(dfab_scm_clk, &dfab_clk.c, 0);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004811static DEFINE_CLK_VOTER(dfab_msmbus_clk, &dfab_clk.c, 0);
4812static DEFINE_CLK_VOTER(dfab_msmbus_a_clk, &dfab_a_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004813
Matt Wagantall42cd12a2012-03-30 18:02:40 -07004814static DEFINE_CLK_VOTER(ebi1_msmbus_clk, &ebi1_clk.c, LONG_MAX);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004815static DEFINE_CLK_VOTER(ebi1_adm_clk, &ebi1_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004816
Matt Wagantall33bac7e2012-05-22 14:59:05 -07004817static DEFINE_CLK_VOTER(ebi1_acpu_a_clk, &ebi1_a_clk.c, LONG_MAX);
4818static DEFINE_CLK_VOTER(ebi1_msmbus_a_clk, &ebi1_a_clk.c, LONG_MAX);
4819static DEFINE_CLK_VOTER(afab_acpu_a_clk, &afab_a_clk.c, LONG_MAX);
4820static DEFINE_CLK_VOTER(afab_msmbus_a_clk, &afab_a_clk.c, LONG_MAX);
4821
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004822#ifdef CONFIG_DEBUG_FS
4823struct measure_sel {
4824 u32 test_vector;
Matt Wagantallf82f2942012-01-27 13:56:13 -08004825 struct clk *c;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004826};
4827
Matt Wagantall8b38f942011-08-02 18:23:18 -07004828static DEFINE_CLK_MEASURE(l2_m_clk);
4829static DEFINE_CLK_MEASURE(krait0_m_clk);
4830static DEFINE_CLK_MEASURE(krait1_m_clk);
Tianyi Gou455c13c2012-02-02 16:33:24 -08004831static DEFINE_CLK_MEASURE(krait2_m_clk);
4832static DEFINE_CLK_MEASURE(krait3_m_clk);
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004833static DEFINE_CLK_MEASURE(q6sw_clk);
4834static DEFINE_CLK_MEASURE(q6fw_clk);
4835static DEFINE_CLK_MEASURE(q6_func_clk);
Matt Wagantall8b38f942011-08-02 18:23:18 -07004836
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004837static struct measure_sel measure_mux[] = {
4838 { TEST_PER_LS(0x08), &slimbus_xo_src_clk.c },
4839 { TEST_PER_LS(0x12), &sdc1_p_clk.c },
4840 { TEST_PER_LS(0x13), &sdc1_clk.c },
4841 { TEST_PER_LS(0x14), &sdc2_p_clk.c },
4842 { TEST_PER_LS(0x15), &sdc2_clk.c },
4843 { TEST_PER_LS(0x16), &sdc3_p_clk.c },
4844 { TEST_PER_LS(0x17), &sdc3_clk.c },
4845 { TEST_PER_LS(0x18), &sdc4_p_clk.c },
4846 { TEST_PER_LS(0x19), &sdc4_clk.c },
4847 { TEST_PER_LS(0x1A), &sdc5_p_clk.c },
4848 { TEST_PER_LS(0x1B), &sdc5_clk.c },
Matt Wagantall7625a4c2011-11-01 16:17:53 -07004849 { TEST_PER_LS(0x1F), &gp0_clk.c },
4850 { TEST_PER_LS(0x20), &gp1_clk.c },
4851 { TEST_PER_LS(0x21), &gp2_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004852 { TEST_PER_LS(0x25), &dfab_clk.c },
4853 { TEST_PER_LS(0x25), &dfab_a_clk.c },
4854 { TEST_PER_LS(0x26), &pmem_clk.c },
4855 { TEST_PER_LS(0x32), &dma_bam_p_clk.c },
4856 { TEST_PER_LS(0x33), &cfpb_clk.c },
4857 { TEST_PER_LS(0x33), &cfpb_a_clk.c },
4858 { TEST_PER_LS(0x3D), &gsbi1_p_clk.c },
4859 { TEST_PER_LS(0x3E), &gsbi1_uart_clk.c },
4860 { TEST_PER_LS(0x3F), &gsbi1_qup_clk.c },
4861 { TEST_PER_LS(0x41), &gsbi2_p_clk.c },
4862 { TEST_PER_LS(0x42), &gsbi2_uart_clk.c },
4863 { TEST_PER_LS(0x44), &gsbi2_qup_clk.c },
4864 { TEST_PER_LS(0x45), &gsbi3_p_clk.c },
4865 { TEST_PER_LS(0x46), &gsbi3_uart_clk.c },
4866 { TEST_PER_LS(0x48), &gsbi3_qup_clk.c },
4867 { TEST_PER_LS(0x49), &gsbi4_p_clk.c },
4868 { TEST_PER_LS(0x4A), &gsbi4_uart_clk.c },
4869 { TEST_PER_LS(0x4C), &gsbi4_qup_clk.c },
4870 { TEST_PER_LS(0x4D), &gsbi5_p_clk.c },
4871 { TEST_PER_LS(0x4E), &gsbi5_uart_clk.c },
4872 { TEST_PER_LS(0x50), &gsbi5_qup_clk.c },
4873 { TEST_PER_LS(0x51), &gsbi6_p_clk.c },
4874 { TEST_PER_LS(0x52), &gsbi6_uart_clk.c },
4875 { TEST_PER_LS(0x54), &gsbi6_qup_clk.c },
4876 { TEST_PER_LS(0x55), &gsbi7_p_clk.c },
4877 { TEST_PER_LS(0x56), &gsbi7_uart_clk.c },
4878 { TEST_PER_LS(0x58), &gsbi7_qup_clk.c },
4879 { TEST_PER_LS(0x59), &gsbi8_p_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004880 { TEST_PER_LS(0x59), &sfab_sata_s_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004881 { TEST_PER_LS(0x5A), &gsbi8_uart_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004882 { TEST_PER_LS(0x5A), &sata_p_clk.c },
4883 { TEST_PER_LS(0x5B), &sata_rxoob_clk.c },
4884 { TEST_PER_LS(0x5C), &sata_pmalive_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004885 { TEST_PER_LS(0x5C), &gsbi8_qup_clk.c },
4886 { TEST_PER_LS(0x5D), &gsbi9_p_clk.c },
4887 { TEST_PER_LS(0x5E), &gsbi9_uart_clk.c },
4888 { TEST_PER_LS(0x60), &gsbi9_qup_clk.c },
4889 { TEST_PER_LS(0x61), &gsbi10_p_clk.c },
4890 { TEST_PER_LS(0x62), &gsbi10_uart_clk.c },
4891 { TEST_PER_LS(0x64), &gsbi10_qup_clk.c },
4892 { TEST_PER_LS(0x65), &gsbi11_p_clk.c },
4893 { TEST_PER_LS(0x66), &gsbi11_uart_clk.c },
4894 { TEST_PER_LS(0x68), &gsbi11_qup_clk.c },
4895 { TEST_PER_LS(0x69), &gsbi12_p_clk.c },
4896 { TEST_PER_LS(0x6A), &gsbi12_uart_clk.c },
4897 { TEST_PER_LS(0x6C), &gsbi12_qup_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004898 { TEST_PER_LS(0x5E), &pcie_p_clk.c },
4899 { TEST_PER_LS(0x5F), &ce3_p_clk.c },
4900 { TEST_PER_LS(0x60), &ce3_core_clk.c },
4901 { TEST_PER_LS(0x63), &usb_hs3_p_clk.c },
4902 { TEST_PER_LS(0x64), &usb_hs3_xcvr_clk.c },
4903 { TEST_PER_LS(0x65), &usb_hs4_p_clk.c },
4904 { TEST_PER_LS(0x66), &usb_hs4_xcvr_clk.c },
4905 { TEST_PER_LS(0x6B), &sata_phy_ref_clk.c },
4906 { TEST_PER_LS(0x6C), &sata_phy_cfg_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004907 { TEST_PER_LS(0x78), &sfpb_clk.c },
4908 { TEST_PER_LS(0x78), &sfpb_a_clk.c },
4909 { TEST_PER_LS(0x7A), &pmic_ssbi2_clk.c },
4910 { TEST_PER_LS(0x7B), &pmic_arb0_p_clk.c },
4911 { TEST_PER_LS(0x7C), &pmic_arb1_p_clk.c },
4912 { TEST_PER_LS(0x7D), &prng_clk.c },
4913 { TEST_PER_LS(0x7F), &rpm_msg_ram_p_clk.c },
4914 { TEST_PER_LS(0x80), &adm0_p_clk.c },
4915 { TEST_PER_LS(0x84), &usb_hs1_p_clk.c },
4916 { TEST_PER_LS(0x85), &usb_hs1_xcvr_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004917 { TEST_PER_LS(0x86), &usb_hsic_p_clk.c },
4918 { TEST_PER_LS(0x87), &usb_hsic_system_clk.c },
4919 { TEST_PER_LS(0x88), &usb_hsic_xcvr_fs_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004920 { TEST_PER_LS(0x89), &usb_fs1_p_clk.c },
4921 { TEST_PER_LS(0x8A), &usb_fs1_sys_clk.c },
4922 { TEST_PER_LS(0x8B), &usb_fs1_xcvr_clk.c },
4923 { TEST_PER_LS(0x8C), &usb_fs2_p_clk.c },
4924 { TEST_PER_LS(0x8D), &usb_fs2_sys_clk.c },
4925 { TEST_PER_LS(0x8E), &usb_fs2_xcvr_clk.c },
4926 { TEST_PER_LS(0x8F), &tsif_p_clk.c },
4927 { TEST_PER_LS(0x91), &tsif_ref_clk.c },
4928 { TEST_PER_LS(0x92), &ce1_p_clk.c },
4929 { TEST_PER_LS(0x94), &tssc_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004930 { TEST_PER_LS(0x9D), &usb_hsic_hsio_cal_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004931 { TEST_PER_LS(0xA4), &ce1_core_clk.c },
4932
4933 { TEST_PER_HS(0x07), &afab_clk.c },
4934 { TEST_PER_HS(0x07), &afab_a_clk.c },
4935 { TEST_PER_HS(0x18), &sfab_clk.c },
4936 { TEST_PER_HS(0x18), &sfab_a_clk.c },
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004937 { TEST_PER_HS(0x26), &q6sw_clk },
4938 { TEST_PER_HS(0x27), &q6fw_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004939 { TEST_PER_HS(0x2A), &adm0_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004940 { TEST_PER_HS(0x31), &sata_a_clk.c },
Tianyi Gou6613de52012-01-27 17:57:53 -08004941 { TEST_PER_HS(0x2D), &pcie_phy_ref_clk.c },
4942 { TEST_PER_HS(0x32), &pcie_a_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004943 { TEST_PER_HS(0x34), &ebi1_clk.c },
4944 { TEST_PER_HS(0x34), &ebi1_a_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004945 { TEST_PER_HS(0x50), &usb_hsic_hsic_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004946
4947 { TEST_MM_LS(0x00), &dsi1_byte_clk.c },
4948 { TEST_MM_LS(0x01), &dsi2_byte_clk.c },
4949 { TEST_MM_LS(0x02), &cam1_clk.c },
4950 { TEST_MM_LS(0x06), &amp_p_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004951 { TEST_MM_LS(0x07), &csi_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004952 { TEST_MM_LS(0x08), &dsi2_s_p_clk.c },
4953 { TEST_MM_LS(0x09), &dsi1_m_p_clk.c },
4954 { TEST_MM_LS(0x0A), &dsi1_s_p_clk.c },
4955 { TEST_MM_LS(0x0C), &gfx2d0_p_clk.c },
4956 { TEST_MM_LS(0x0D), &gfx2d1_p_clk.c },
4957 { TEST_MM_LS(0x0E), &gfx3d_p_clk.c },
4958 { TEST_MM_LS(0x0F), &hdmi_m_p_clk.c },
4959 { TEST_MM_LS(0x10), &hdmi_s_p_clk.c },
4960 { TEST_MM_LS(0x11), &ijpeg_p_clk.c },
4961 { TEST_MM_LS(0x12), &imem_p_clk.c },
4962 { TEST_MM_LS(0x13), &jpegd_p_clk.c },
4963 { TEST_MM_LS(0x14), &mdp_p_clk.c },
4964 { TEST_MM_LS(0x16), &rot_p_clk.c },
4965 { TEST_MM_LS(0x17), &dsi1_esc_clk.c },
4966 { TEST_MM_LS(0x18), &smmu_p_clk.c },
4967 { TEST_MM_LS(0x19), &tv_enc_p_clk.c },
4968 { TEST_MM_LS(0x1A), &vcodec_p_clk.c },
4969 { TEST_MM_LS(0x1B), &vfe_p_clk.c },
4970 { TEST_MM_LS(0x1C), &vpe_p_clk.c },
4971 { TEST_MM_LS(0x1D), &cam0_clk.c },
4972 { TEST_MM_LS(0x1F), &hdmi_app_clk.c },
4973 { TEST_MM_LS(0x20), &mdp_vsync_clk.c },
4974 { TEST_MM_LS(0x21), &tv_dac_clk.c },
4975 { TEST_MM_LS(0x22), &tv_enc_clk.c },
4976 { TEST_MM_LS(0x23), &dsi2_esc_clk.c },
4977 { TEST_MM_LS(0x25), &mmfpb_clk.c },
4978 { TEST_MM_LS(0x25), &mmfpb_a_clk.c },
4979 { TEST_MM_LS(0x26), &dsi2_m_p_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004980 { TEST_MM_LS(0x27), &cam2_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004981 { TEST_MM_LS(0x28), &vcap_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004982
4983 { TEST_MM_HS(0x00), &csi0_clk.c },
4984 { TEST_MM_HS(0x01), &csi1_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004985 { TEST_MM_HS(0x04), &csi_vfe_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004986 { TEST_MM_HS(0x05), &ijpeg_clk.c },
4987 { TEST_MM_HS(0x06), &vfe_clk.c },
4988 { TEST_MM_HS(0x07), &gfx2d0_clk.c },
4989 { TEST_MM_HS(0x08), &gfx2d1_clk.c },
4990 { TEST_MM_HS(0x09), &gfx3d_clk.c },
4991 { TEST_MM_HS(0x0A), &jpegd_clk.c },
4992 { TEST_MM_HS(0x0B), &vcodec_clk.c },
4993 { TEST_MM_HS(0x0F), &mmfab_clk.c },
4994 { TEST_MM_HS(0x0F), &mmfab_a_clk.c },
4995 { TEST_MM_HS(0x11), &gmem_axi_clk.c },
4996 { TEST_MM_HS(0x12), &ijpeg_axi_clk.c },
4997 { TEST_MM_HS(0x13), &imem_axi_clk.c },
4998 { TEST_MM_HS(0x14), &jpegd_axi_clk.c },
4999 { TEST_MM_HS(0x15), &mdp_axi_clk.c },
5000 { TEST_MM_HS(0x16), &rot_axi_clk.c },
5001 { TEST_MM_HS(0x17), &vcodec_axi_clk.c },
5002 { TEST_MM_HS(0x18), &vfe_axi_clk.c },
5003 { TEST_MM_HS(0x19), &vpe_axi_clk.c },
5004 { TEST_MM_HS(0x1A), &mdp_clk.c },
5005 { TEST_MM_HS(0x1B), &rot_clk.c },
5006 { TEST_MM_HS(0x1C), &vpe_clk.c },
5007 { TEST_MM_HS(0x1E), &hdmi_tv_clk.c },
5008 { TEST_MM_HS(0x1F), &mdp_tv_clk.c },
5009 { TEST_MM_HS(0x24), &csi0_phy_clk.c },
5010 { TEST_MM_HS(0x25), &csi1_phy_clk.c },
5011 { TEST_MM_HS(0x26), &csi_pix_clk.c },
5012 { TEST_MM_HS(0x27), &csi_rdi_clk.c },
5013 { TEST_MM_HS(0x28), &lut_mdp_clk.c },
5014 { TEST_MM_HS(0x29), &vcodec_axi_a_clk.c },
5015 { TEST_MM_HS(0x2A), &vcodec_axi_b_clk.c },
5016 { TEST_MM_HS(0x2B), &csi1phy_timer_clk.c },
5017 { TEST_MM_HS(0x2C), &csi0phy_timer_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07005018 { TEST_MM_HS(0x2D), &csi2_clk.c },
5019 { TEST_MM_HS(0x2E), &csi2_phy_clk.c },
5020 { TEST_MM_HS(0x2F), &csi2phy_timer_clk.c },
5021 { TEST_MM_HS(0x30), &csi_pix1_clk.c },
5022 { TEST_MM_HS(0x31), &csi_rdi1_clk.c },
5023 { TEST_MM_HS(0x32), &csi_rdi2_clk.c },
Tianyi Gou621f8742011-09-01 21:45:01 -07005024 { TEST_MM_HS(0x33), &vcap_clk.c },
5025 { TEST_MM_HS(0x34), &vcap_npl_clk.c },
Tianyi Goue3d4f542012-03-15 17:06:45 -07005026 { TEST_MM_HS(0x34), &gfx3d_axi_clk_8930.c },
Tianyi Gou7747a962012-02-03 15:03:55 -08005027 { TEST_MM_HS(0x35), &vcap_axi_clk.c },
Tianyi Gou51918802012-01-26 14:05:43 -08005028 { TEST_MM_HS(0x36), &rgb_tv_clk.c },
5029 { TEST_MM_HS(0x37), &npl_tv_clk.c },
Patrick Dalye6f489042012-07-11 15:29:15 -07005030 { TEST_MM_HS(0x38), &gfx3d_axi_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005031
5032 { TEST_LPA(0x0F), &mi2s_bit_clk.c },
5033 { TEST_LPA(0x10), &codec_i2s_mic_bit_clk.c },
5034 { TEST_LPA(0x11), &codec_i2s_spkr_bit_clk.c },
5035 { TEST_LPA(0x12), &spare_i2s_mic_bit_clk.c },
5036 { TEST_LPA(0x13), &spare_i2s_spkr_bit_clk.c },
5037 { TEST_LPA(0x14), &pcm_clk.c },
5038 { TEST_LPA(0x1D), &audio_slimbus_clk.c },
Matt Wagantall8b38f942011-08-02 18:23:18 -07005039
Stephen Boyd3939c8d2011-08-29 17:36:22 -07005040 { TEST_LPA_HS(0x00), &q6_func_clk },
5041
Stephen Boyd46fdf0d2011-11-22 12:25:09 -08005042 { TEST_CPUL2(0x2), &l2_m_clk },
5043 { TEST_CPUL2(0x0), &krait0_m_clk },
5044 { TEST_CPUL2(0x1), &krait1_m_clk },
Tianyi Gou455c13c2012-02-02 16:33:24 -08005045 { TEST_CPUL2(0x4), &krait2_m_clk },
5046 { TEST_CPUL2(0x5), &krait3_m_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005047};
5048
Matt Wagantallf82f2942012-01-27 13:56:13 -08005049static struct measure_sel *find_measure_sel(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005050{
5051 int i;
5052
5053 for (i = 0; i < ARRAY_SIZE(measure_mux); i++)
Matt Wagantallf82f2942012-01-27 13:56:13 -08005054 if (measure_mux[i].c == c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005055 return &measure_mux[i];
5056 return NULL;
5057}
5058
Matt Wagantall8b38f942011-08-02 18:23:18 -07005059static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005060{
5061 int ret = 0;
5062 u32 clk_sel;
5063 struct measure_sel *p;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005064 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005065 unsigned long flags;
5066
5067 if (!parent)
5068 return -EINVAL;
5069
5070 p = find_measure_sel(parent);
5071 if (!p)
5072 return -EINVAL;
5073
5074 spin_lock_irqsave(&local_clock_reg_lock, flags);
5075
Matt Wagantall8b38f942011-08-02 18:23:18 -07005076 /*
5077 * Program the test vector, measurement period (sample_ticks)
5078 * and scaling multiplier.
5079 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005080 measure->sample_ticks = 0x10000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005081 clk_sel = p->test_vector & TEST_CLK_SEL_MASK;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005082 measure->multiplier = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005083 switch (p->test_vector >> TEST_TYPE_SHIFT) {
5084 case TEST_TYPE_PER_LS:
5085 writel_relaxed(0x4030D00|BVAL(7, 0, clk_sel), CLK_TEST_REG);
5086 break;
5087 case TEST_TYPE_PER_HS:
5088 writel_relaxed(0x4020000|BVAL(16, 10, clk_sel), CLK_TEST_REG);
5089 break;
5090 case TEST_TYPE_MM_LS:
5091 writel_relaxed(0x4030D97, CLK_TEST_REG);
5092 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_LS_REG);
5093 break;
5094 case TEST_TYPE_MM_HS:
5095 writel_relaxed(0x402B800, CLK_TEST_REG);
5096 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_HS_REG);
5097 break;
5098 case TEST_TYPE_LPA:
5099 writel_relaxed(0x4030D98, CLK_TEST_REG);
5100 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0),
5101 LCC_CLK_LS_DEBUG_CFG_REG);
5102 break;
Stephen Boyd3939c8d2011-08-29 17:36:22 -07005103 case TEST_TYPE_LPA_HS:
5104 writel_relaxed(0x402BC00, CLK_TEST_REG);
5105 writel_relaxed(BVAL(2, 1, clk_sel)|BIT(0),
5106 LCC_CLK_HS_DEBUG_CFG_REG);
5107 break;
Matt Wagantall8b38f942011-08-02 18:23:18 -07005108 case TEST_TYPE_CPUL2:
5109 writel_relaxed(0x4030400, CLK_TEST_REG);
5110 writel_relaxed(0x80|BVAL(5, 3, clk_sel), GCC_APCS_CLK_DIAG);
Matt Wagantallf82f2942012-01-27 13:56:13 -08005111 measure->sample_ticks = 0x4000;
5112 measure->multiplier = 2;
Patrick Daly73db3ad2012-10-01 18:56:41 -07005113 if (cpu_is_krait_v3())
5114 measure->multiplier = 8;
Matt Wagantall8b38f942011-08-02 18:23:18 -07005115 break;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005116 default:
5117 ret = -EPERM;
5118 }
5119 /* Make sure test vector is set before starting measurements. */
5120 mb();
5121
5122 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5123
5124 return ret;
5125}
5126
5127/* Sample clock for 'ticks' reference clock ticks. */
5128static u32 run_measurement(unsigned ticks)
5129{
5130 /* Stop counters and set the XO4 counter start value. */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005131 writel_relaxed(ticks, RINGOSC_TCXO_CTL_REG);
5132
5133 /* Wait for timer to become ready. */
5134 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) != 0)
5135 cpu_relax();
5136
5137 /* Run measurement and wait for completion. */
5138 writel_relaxed(BIT(20)|ticks, RINGOSC_TCXO_CTL_REG);
5139 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) == 0)
5140 cpu_relax();
5141
5142 /* Stop counters. */
5143 writel_relaxed(0x0, RINGOSC_TCXO_CTL_REG);
5144
5145 /* Return measured ticks. */
5146 return readl_relaxed(RINGOSC_STATUS_REG) & BM(24, 0);
5147}
5148
5149
5150/* Perform a hardware rate measurement for a given clock.
5151 FOR DEBUG USE ONLY: Measurements take ~15 ms! */
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07005152static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005153{
5154 unsigned long flags;
5155 u32 pdm_reg_backup, ringosc_reg_backup;
5156 u64 raw_count_short, raw_count_full;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005157 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005158 unsigned ret;
5159
Stephen Boyde334aeb2012-01-24 12:17:29 -08005160 ret = clk_prepare_enable(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005161 if (ret) {
5162 pr_warning("CXO clock failed to enable. Can't measure\n");
5163 return 0;
5164 }
5165
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005166 spin_lock_irqsave(&local_clock_reg_lock, flags);
5167
5168 /* Enable CXO/4 and RINGOSC branch and root. */
5169 pdm_reg_backup = readl_relaxed(PDM_CLK_NS_REG);
5170 ringosc_reg_backup = readl_relaxed(RINGOSC_NS_REG);
5171 writel_relaxed(0x2898, PDM_CLK_NS_REG);
5172 writel_relaxed(0xA00, RINGOSC_NS_REG);
5173
5174 /*
5175 * The ring oscillator counter will not reset if the measured clock
5176 * is not running. To detect this, run a short measurement before
5177 * the full measurement. If the raw results of the two are the same
5178 * then the clock must be off.
5179 */
5180
5181 /* Run a short measurement. (~1 ms) */
5182 raw_count_short = run_measurement(0x1000);
5183 /* Run a full measurement. (~14 ms) */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005184 raw_count_full = run_measurement(measure->sample_ticks);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005185
5186 writel_relaxed(ringosc_reg_backup, RINGOSC_NS_REG);
5187 writel_relaxed(pdm_reg_backup, PDM_CLK_NS_REG);
5188
5189 /* Return 0 if the clock is off. */
5190 if (raw_count_full == raw_count_short)
5191 ret = 0;
5192 else {
5193 /* Compute rate in Hz. */
5194 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005195 do_div(raw_count_full, ((measure->sample_ticks * 10) + 35));
5196 ret = (raw_count_full * measure->multiplier);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005197 }
5198
5199 /* Route dbg_hs_clk to PLLTEST. 300mV single-ended amplitude. */
Stephen Boyd69da8402011-07-14 17:45:31 -07005200 writel_relaxed(0x38F8, PLLTEST_PAD_CFG_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005201 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5202
Stephen Boyde334aeb2012-01-24 12:17:29 -08005203 clk_disable_unprepare(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005204
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005205 return ret;
5206}
5207#else /* !CONFIG_DEBUG_FS */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005208static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005209{
5210 return -EINVAL;
5211}
5212
Matt Wagantallf82f2942012-01-27 13:56:13 -08005213static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005214{
5215 return 0;
5216}
5217#endif /* CONFIG_DEBUG_FS */
5218
Matt Wagantallae053222012-05-14 19:42:07 -07005219static struct clk_ops clk_ops_measure = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005220 .set_parent = measure_clk_set_parent,
5221 .get_rate = measure_clk_get_rate,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005222};
5223
Matt Wagantall8b38f942011-08-02 18:23:18 -07005224static struct measure_clk measure_clk = {
5225 .c = {
5226 .dbg_name = "measure_clk",
Matt Wagantallae053222012-05-14 19:42:07 -07005227 .ops = &clk_ops_measure,
Matt Wagantall8b38f942011-08-02 18:23:18 -07005228 CLK_INIT(measure_clk.c),
5229 },
5230 .multiplier = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005231};
5232
Tianyi Goua8b3cce2011-11-08 14:37:26 -08005233static struct clk_lookup msm_clocks_8064[] = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005234 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5235 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Mohan Pallaka804ca592012-06-14 14:37:38 +05305236 CLK_LOOKUP("pwm_clk", cxo_clk.c, "0-0048"),
Stephen Boyded630b02012-01-26 15:26:47 -08005237 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5238 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
Stephen Boydbdb53f32012-06-05 18:39:47 -07005239 CLK_LOOKUP("xo", pxo_clk.c, "pil-q6v4-lpass"),
Matt Wagantall292aace2012-01-26 19:12:34 -08005240 CLK_LOOKUP("xo", cxo_clk.c, "pil_gss"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005241 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005242 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
David Collinsa7d23532012-08-02 10:48:16 -07005243 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Stephen Boyded630b02012-01-26 15:26:47 -08005244 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5245 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5246 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5247 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005248
Matt Wagantalld75f1312012-05-23 16:17:35 -07005249 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5250 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5251 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5252 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5253 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5254 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5255 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5256 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5257 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5258 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5259 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5260 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5261 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5262 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5263 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5264 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5265
Tianyi Gou21a0e802012-02-04 22:34:10 -08005266 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005267 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005268 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5269 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5270 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005271 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005272 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5273 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5274 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5275 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5276 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005277 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005278 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5279 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005280 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005281 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5282 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5283 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5284 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5285 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5286 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5287 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005288
Tianyi Gou21a0e802012-02-04 22:34:10 -08005289 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005290 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, ""),
5291 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5292 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005293
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005294 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5295 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5296 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005297 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, "msm_serial_hsl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005298 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5299 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5300 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5301 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, ""),
Mayank Rana262e9032012-05-10 15:14:00 -07005302 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005303 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, "msm_serial_hsl.0"),
David Keitel3c40fc52012-02-09 17:53:52 -08005304 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005305 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005306 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005307 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005308 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005309 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "qup_i2c.5"),
Bar Weinerf82c5872012-10-23 14:31:26 +02005310 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, "spi_qsd.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005311 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5312 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Tianyi Gou50f23812012-02-06 16:04:19 -08005313 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Tianyi Gou05e01102012-02-08 22:15:49 -08005314 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005315 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5316 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5317 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5318 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
Joel Nider6cbe66a2012-06-26 11:11:59 +03005319 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.0"),
5320 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.0"),
5321 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.1"),
5322 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005323 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005324 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5325 CLK_LOOKUP("alt_core_clk", usb_hs3_xcvr_clk.c, "msm_ehci_host.0"),
5326 CLK_LOOKUP("alt_core_clk", usb_hs4_xcvr_clk.c, "msm_ehci_host.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005327 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5328 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5329 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005330 CLK_LOOKUP("ref_clk", sata_phy_ref_clk.c, ""),
5331 CLK_LOOKUP("cfg_clk", sata_phy_cfg_clk.c, ""),
Tianyi Gou352955d2012-05-18 19:44:01 -07005332 CLK_LOOKUP("src_clk", sata_src_clk.c, ""),
5333 CLK_LOOKUP("core_rxoob_clk", sata_rxoob_clk.c, ""),
5334 CLK_LOOKUP("core_pmalive_clk", sata_pmalive_clk.c, ""),
5335 CLK_LOOKUP("bus_clk", sata_a_clk.c, ""),
5336 CLK_LOOKUP("iface_clk", sata_p_clk.c, ""),
5337 CLK_LOOKUP("slave_iface_clk", sfab_sata_s_p_clk.c, ""),
Ramesh Masavarapu28311912011-10-27 11:04:12 -07005338 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qce.0"),
5339 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qcrypto.0"),
5340 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qce.0"),
5341 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qcrypto.0"),
5342 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qce.0"),
5343 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qcrypto.0"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005344 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005345 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "msm_serial_hsl.1"),
David Keitel3c40fc52012-02-09 17:53:52 -08005346 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005347 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005348 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005349 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005350 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005351 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "qup_i2c.5"),
Mayank Rana262e9032012-05-10 15:14:00 -07005352 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Bar Weinerf82c5872012-10-23 14:31:26 +02005353 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "spi_qsd.1"),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005354 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, "msm_serial_hsl.0"),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005355 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5356 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005357 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005358 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Manu Gautam7483f172011-11-08 15:22:26 +05305359 CLK_LOOKUP("iface_clk", usb_hs3_p_clk.c, "msm_ehci_host.0"),
5360 CLK_LOOKUP("iface_clk", usb_hs4_p_clk.c, "msm_ehci_host.1"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005361 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5362 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5363 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5364 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06005365 CLK_LOOKUP("iface_clk", pcie_p_clk.c, "msm_pcie"),
5366 CLK_LOOKUP("ref_clk", pcie_phy_ref_clk.c, "msm_pcie"),
5367 CLK_LOOKUP("bus_clk", pcie_a_clk.c, "msm_pcie"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005368 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5369 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005370 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5371 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5372 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5373 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chand07220e2012-02-13 15:52:22 -08005374 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Punit Soni57850102012-09-26 11:31:27 -07005375 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0010"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005376 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Sreesudhan Ramakrish Ramkumar8002a792012-04-09 17:42:58 -07005377 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -08005378 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Kevin Chand07220e2012-02-13 15:52:22 -08005379 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
Stephen Boyd85328b22012-09-19 17:07:16 -07005380 CLK_LOOKUP("cam_clk", cam2_clk.c, ""),
Kevin Chand07220e2012-02-13 15:52:22 -08005381 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5382 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
5383 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
5384 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5385 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
5386 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
5387 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5388 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
5389 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
5390 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5391 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5392 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
5393 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5394 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5395 CLK_LOOKUP("csiphy_timer_src_clk",
5396 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5397 CLK_LOOKUP("csiphy_timer_src_clk",
5398 csiphy_timer_src_clk.c, "msm_csiphy.1"),
5399 CLK_LOOKUP("csiphy_timer_src_clk",
5400 csiphy_timer_src_clk.c, "msm_csiphy.2"),
5401 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5402 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
5403 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005404 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5405 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5406 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5407 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Tianyi Gou51918802012-01-26 14:05:43 -08005408 CLK_LOOKUP("rgb_clk", rgb_tv_clk.c, ""),
5409 CLK_LOOKUP("npl_clk", npl_tv_clk.c, ""),
5410
Pu Chen86b4be92011-11-03 17:27:57 -07005411 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005412 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005413 CLK_LOOKUP("bus_clk",
Patrick Dalye6f489042012-07-11 15:29:15 -07005414 gfx3d_axi_clk.c, "footswitch-8x60.2"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005415 CLK_LOOKUP("iface_clk", vcap_p_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005416 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005417 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "footswitch-8x60.10"),
5418 CLK_LOOKUP("bus_clk", vcap_axi_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005419 CLK_LOOKUP("core_clk", vcap_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005420 CLK_LOOKUP("core_clk", vcap_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005421 CLK_LOOKUP("core_clk", vcap_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005422 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005423 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005424 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005425 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5426 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005427 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005428 CLK_LOOKUP("core_clk", jpegd_clk.c, ""),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005429 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005430 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005431 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005432 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005433 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005434 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005435 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005436 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Matt Wagantall61286312012-02-22 15:55:09 -08005437 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005438 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5439 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
Greg Griscofa47b532011-11-11 10:32:06 -08005440 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005441 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005442 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
Tianyi Gou51918802012-01-26 14:05:43 -08005443 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005444 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005445 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Ujwal Pateld041f982012-03-27 19:51:44 -07005446 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005447 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chand07220e2012-02-13 15:52:22 -08005448 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005449 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chand07220e2012-02-13 15:52:22 -08005450 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005451 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5452 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5453 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5454 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5455 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5456 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5457 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005458 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5459 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chand07220e2012-02-13 15:52:22 -08005460 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5461 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
5462 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005463 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5464 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5465 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5466 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Pu Chen86b4be92011-11-03 17:27:57 -07005467 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005468 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005469 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5470 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005471 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005472 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005473 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005474 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005475 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005476 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005477 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005478 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005479 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Greg Griscofa47b532011-11-11 10:32:06 -08005480 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005481 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chand07220e2012-02-13 15:52:22 -08005482 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005483 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chanb20742b2012-02-27 15:47:35 -08005484 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall61286312012-02-22 15:55:09 -08005485 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005486
Patrick Lai04baee942012-05-01 14:38:47 -07005487 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5488 "msm-dai-q6-mi2s"),
5489 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5490 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005491 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5492 "msm-dai-q6.1"),
5493 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5494 "msm-dai-q6.1"),
5495 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5496 "msm-dai-q6.5"),
5497 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5498 "msm-dai-q6.5"),
5499 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wangdea7c822012-08-20 20:52:42 -07005500 "msm-dai-q6.0"),
5501 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5502 "msm-dai-q6.0"),
5503 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005504 "msm-dai-q6.16384"),
5505 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5506 "msm-dai-q6.16384"),
5507 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5508 "msm-dai-q6.4"),
5509 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5510 "msm-dai-q6.4"),
5511 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005512 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005513 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, ""),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005514 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005515 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, ""),
5516 CLK_LOOKUP("core_clk", vpe_axi_clk.c, ""),
5517 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
5518 CLK_LOOKUP("core_clk", vcap_axi_clk.c, ""),
5519 CLK_LOOKUP("core_clk", rot_axi_clk.c, ""),
5520 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, ""),
5521 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
5522 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, ""),
5523 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, ""),
Patrick Dalye6f489042012-07-11 15:29:15 -07005524 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005525
5526 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
5527 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
5528 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.0"),
5529 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.1"),
5530 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5531 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5532 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5533 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5534 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
5535 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
5536 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
5537
Manu Gautam5143b252012-01-05 19:25:23 -08005538 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5539 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5540 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5541 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5542 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005543
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005544 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5545 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5546 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5547 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5548 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5549 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5550 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5551 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5552 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005553 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.9"),
5554 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.10"),
5555
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005556 CLK_LOOKUP("core_clk", vcap_axi_clk.c, "msm_iommu.11"),
5557
Deepak Kotur954b1782012-04-24 17:58:19 -07005558 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5559 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5560 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5561 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5562 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005563 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5564 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
5565
Jeff Ohlstein8c116c72011-10-27 17:34:48 -07005566 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005567 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5568 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005569
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07005570 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
5571 CLK_LOOKUP("reset2_clk", dsi2_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07005572
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005573 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5574 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5575 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
Tianyi Gou455c13c2012-02-02 16:33:24 -08005576 CLK_LOOKUP("krait2_mclk", krait2_m_clk, ""),
5577 CLK_LOOKUP("krait3_mclk", krait3_m_clk, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005578};
5579
Patrick Dalye6f489042012-07-11 15:29:15 -07005580static struct clk_lookup msm_clocks_8960_common[] __initdata = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005581 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5582 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Stephen Boyded630b02012-01-26 15:26:47 -08005583 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5584 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
Stephen Boydbdb53f32012-06-05 18:39:47 -07005585 CLK_LOOKUP("xo", pxo_clk.c, "pil-q6v4-lpass"),
5586 CLK_LOOKUP("xo", cxo_clk.c, "pil-q6v4-modem"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005587 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005588 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
David Collinsa7d23532012-08-02 10:48:16 -07005589 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Stephen Boyded630b02012-01-26 15:26:47 -08005590 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5591 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5592 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5593 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005594
Matt Wagantalld75f1312012-05-23 16:17:35 -07005595 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5596 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5597 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5598 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5599 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5600 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5601 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5602 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5603 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5604 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5605 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5606 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5607 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5608 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5609 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5610 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5611
Matt Wagantallb2710b82011-11-16 19:55:17 -08005612 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005613 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005614 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5615 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5616 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005617 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005618 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5619 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5620 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5621 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5622 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005623 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005624 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5625 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005626 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005627 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5628 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5629 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5630 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5631 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5632 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5633 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005634
5635 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005636 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5637 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5638 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005639
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005640 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5641 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5642 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5643 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5644 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5645 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5646 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
Matt Wagantalle2522372011-08-17 14:52:21 -07005647 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5648 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005649 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
Mayank Rana1f02d952012-07-04 19:11:20 +05305650 /* used on 8960 SGLTE for console */
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005651 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hsl.1"),
Mayank Rana1f02d952012-07-04 19:11:20 +05305652 /* used on 8960 standalone with Atheros Bluetooth */
5653 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hs.2"),
Mayank Ranae009c922012-03-22 03:02:06 +05305654 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, "msm_serial_hs.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005655 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5656 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5657 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005658 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005659 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005660 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5661 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005662 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5663 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5664 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5665 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005666 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005667 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005668 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005669 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005670 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Vikram Mulukutladd0a2372011-09-19 15:58:21 -07005671 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Matt Wagantallc1205292011-08-11 17:19:31 -07005672 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005673 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5674 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5675 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5676 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5677 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005678 CLK_LOOKUP("slimbus_xo_src_clk", slimbus_xo_src_clk.c, NULL),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005679 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005680 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5681 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005682 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5683 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5684 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5685 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5686 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5687 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005688 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5689 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5690 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5691 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5692 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005693 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005694 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005695 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005696 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005697 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Matt Wagantallac294852011-08-17 15:44:58 -07005698 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005699 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005700 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
5701 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Matt Wagantalle2522372011-08-17 14:52:21 -07005702 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
5703 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005704 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
Mayank Rana1f02d952012-07-04 19:11:20 +05305705 /* used on 8960 SGLTE for serial console */
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005706 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hsl.1"),
Mayank Rana1f02d952012-07-04 19:11:20 +05305707 /* used on 8960 standalone with Atheros Bluetooth */
5708 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hs.2"),
Mayank Ranae009c922012-03-22 03:02:06 +05305709 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "msm_serial_hs.1"),
Matt Wagantallac294852011-08-17 15:44:58 -07005710 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005711 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005712 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005713 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005714 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5715 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005716 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
5717 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005718 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005719 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5720 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5721 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5722 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
5723 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
Matt Wagantalle1a86062011-08-18 17:46:10 -07005724 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5725 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005726 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5727 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5728 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5729 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chan09f4e662011-12-16 08:17:02 -08005730 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
5731 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-006c"),
5732 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0048"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005733 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -08005734 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005735 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Punit Soni57850102012-09-26 11:31:27 -07005736 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0010"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005737 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5738 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005739 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005740 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5741 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005742 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005743 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5744 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005745 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
Kevin Chane12c6672011-10-26 11:55:26 -07005746 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5747 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005748 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
5749 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
5750 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5751 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5752 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5753 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
5754 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
Kevin Chanf6216f22011-10-25 18:40:11 -07005755 CLK_LOOKUP("csiphy_timer_src_clk",
5756 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5757 CLK_LOOKUP("csiphy_timer_src_clk",
5758 csiphy_timer_src_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005759 CLK_LOOKUP("csiphy_timer_src_clk",
5760 csiphy_timer_src_clk.c, "msm_csiphy.2"),
Kevin Chanf6216f22011-10-25 18:40:11 -07005761 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5762 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005763 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005764 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5765 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5766 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5767 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005768 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005769 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
5770 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005771 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5772 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005773 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07005774 CLK_LOOKUP("core_clk", jpegd_clk.c, "msm_mercury.0"),
5775 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, "msm_mercury.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005776 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005777 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005778 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005779 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005780 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005781 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005782 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005783 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005784 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5785 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005786 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005787 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005788 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005789 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
5790 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005791 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005792 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005793 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Kevin Chana0853122011-11-07 19:48:44 -08005794 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005795 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chan5827c552011-10-28 18:36:32 -07005796 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005797 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chan5827c552011-10-28 18:36:32 -07005798 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005799 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5800 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5801 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5802 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5803 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5804 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5805 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005806 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5807 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005808 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5809 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005810 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005811 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5812 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5813 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5814 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005815 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005816 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005817 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5818 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005819 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005820 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005821 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005822 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005823 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005824 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005825 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005826 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005827 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005828 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005829 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chan5827c552011-10-28 18:36:32 -07005830 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005831 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chana0853122011-11-07 19:48:44 -08005832 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005833 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Patrick Lai04baee942012-05-01 14:38:47 -07005834 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5835 "msm-dai-q6-mi2s"),
5836 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5837 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005838 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5839 "msm-dai-q6.1"),
5840 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5841 "msm-dai-q6.1"),
5842 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5843 "msm-dai-q6.5"),
5844 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5845 "msm-dai-q6.5"),
5846 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wangdea7c822012-08-20 20:52:42 -07005847 "msm-dai-q6.0"),
5848 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5849 "msm-dai-q6.0"),
5850 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005851 "msm-dai-q6.16384"),
5852 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5853 "msm-dai-q6.16384"),
5854 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5855 "msm-dai-q6.4"),
5856 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5857 "msm-dai-q6.4"),
5858 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005859 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005860 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005861 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005862 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5863 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5864 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5865 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5866 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5867 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5868 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5869 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5870 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
5871 CLK_LOOKUP("core_clk", gfx3d_clk.c, "msm_iommu.9"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005872
5873 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5874 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5875 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5876 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5877 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005878 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5879 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005880
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005881 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
Manu Gautam5143b252012-01-05 19:25:23 -08005882 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005883 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5884 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5885 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5886 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5887 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
Yan He160633e2011-06-30 12:18:56 -07005888 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
Stephen Boyd1c51a492011-10-26 12:11:47 -07005889 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
Stephen Boydef5d1c42011-12-15 20:47:14 -08005890 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005891
Matt Wagantalle1a86062011-08-18 17:46:10 -07005892 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005893 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5894 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Matt Wagantall8b38f942011-08-02 18:23:18 -07005895
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07005896 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
5897 CLK_LOOKUP("reset2_clk", dsi2_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07005898
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005899 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5900 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5901 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
5902 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
5903 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
5904 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005905};
5906
Patrick Dalye6f489042012-07-11 15:29:15 -07005907static struct clk_lookup msm_clocks_8960_only[] __initdata = {
5908 CLK_LOOKUP("enc_clk", tv_enc_clk.c, "tvenc.0"),
5909 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
5910 CLK_LOOKUP("iface_clk", tv_enc_p_clk.c, "tvenc.0"),
5911
5912 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "kgsl-2d0.0"),
5913 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "footswitch-8x60.0"),
5914 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "kgsl-2d1.1"),
5915 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "footswitch-8x60.1"),
5916 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "kgsl-2d0.0"),
5917 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "footswitch-8x60.0"),
5918 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "kgsl-2d1.1"),
5919 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "footswitch-8x60.1"),
5920 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "msm_iommu.10"),
5921 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "msm_iommu.11"),
5922};
5923
5924static struct clk_lookup msm_clocks_8960ab_only[] __initdata = {
5925 CLK_LOOKUP("bus_clk", gfx3d_axi_clk.c, "footswitch-8x60.2"),
Joel King9af070b2012-08-19 22:32:14 -07005926 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.10"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005927 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
5928};
5929
5930static struct clk_lookup msm_clocks_8960[ARRAY_SIZE(msm_clocks_8960_common)
5931 + ARRAY_SIZE(msm_clocks_8960_only)
5932 + ARRAY_SIZE(msm_clocks_8960ab_only)];
5933
Tianyi Goue3d4f542012-03-15 17:06:45 -07005934static struct clk_lookup msm_clocks_8930[] = {
Stephen Boydbe1a7392012-04-02 20:17:11 -07005935 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005936 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5937 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
Stephen Boydbdb53f32012-06-05 18:39:47 -07005938 CLK_LOOKUP("xo", pxo_clk.c, "pil-q6v4-lpass"),
5939 CLK_LOOKUP("xo", cxo_clk.c, "pil-q6v4-modem"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005940 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
David Collinsa7d23532012-08-02 10:48:16 -07005941 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005942 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5943 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5944 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5945 CLK_LOOKUP("measure", measure_clk.c, "debug"),
5946
Matt Wagantalld75f1312012-05-23 16:17:35 -07005947 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5948 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5949 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5950 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5951 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5952 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5953 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5954 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5955 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5956 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5957 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5958 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5959 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5960 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5961 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5962 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5963
Tianyi Goue3d4f542012-03-15 17:06:45 -07005964 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005965 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005966 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5967 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5968 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
5969 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
5970 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5971 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5972 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5973 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5974 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005975 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005976 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5977 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005978 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005979 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5980 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5981 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5982 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5983 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5984 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5985 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005986
5987 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005988 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5989 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5990 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
5991
5992 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5993 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5994 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5995 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5996 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5997 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5998 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5999 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
6000 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
6001 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
6002 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, ""),
6003 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, ""),
6004 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
6005 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
6006 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
6007 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
6008 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
6009 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
6010 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
6011 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
6012 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
6013 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
6014 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
6015 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, "qup_i2c.0"),
6016 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
6017 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
6018 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
6019 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
6020 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
6021 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
6022 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
6023 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
6024 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
6025 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
6026 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
6027 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, ""),
6028 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
6029 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
6030 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
6031 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
6032 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
6033 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
6034 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
6035 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
6036 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
6037 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
6038 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
6039 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
6040 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
6041 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
6042 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
6043 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
6044 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
6045 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
6046 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
6047 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
6048 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
6049 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
6050 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
6051 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
6052 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
6053 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
6054 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, ""),
6055 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "qup_i2c.0"),
6056 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
6057 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
6058 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
6059 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
6060 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
6061 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
6062 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
6063 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
6064 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
6065 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
6066 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
6067 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
6068 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
6069 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
6070 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
6071 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
6072 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
6073 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006074 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Hody Hung994f4622012-04-24 10:27:45 -07006075 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
Sreesudhan Ramakrish Ramkumar981c82c2012-04-30 17:31:37 -07006076 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006077 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
6078 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
6079 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
6080 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
6081 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
6082 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
6083 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
6084 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
6085 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
6086 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
6087 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
6088 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
6089 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
6090 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
6091 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
6092 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
6093 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
6094 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
6095 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
6096 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
6097 CLK_LOOKUP("csiphy_timer_src_clk",
6098 csiphy_timer_src_clk.c, "msm_csiphy.0"),
6099 CLK_LOOKUP("csiphy_timer_src_clk",
6100 csiphy_timer_src_clk.c, "msm_csiphy.1"),
6101 CLK_LOOKUP("csiphy_timer_src_clk",
6102 csiphy_timer_src_clk.c, "msm_csiphy.2"),
6103 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
6104 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
6105 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006106 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
6107 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006108 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
6109 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
6110 CLK_LOOKUP("bus_clk",
6111 gfx3d_axi_clk_8930.c, "footswitch-8x60.2"),
6112 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006113 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
6114 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006115 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006116 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006117 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006118 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006119 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006120 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006121 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
6122 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
6123 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006124 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
6125 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006126 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006127 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006128 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
6129 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006130 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
6131 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006132 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006133 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006134 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
6135 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
6136 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
6137 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
6138 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
6139 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
6140 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
6141 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
6142 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
6143 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
6144 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
6145 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
6146 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006147 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006148 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
6149 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
6150 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006151 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
6152 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006153 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
6154 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
6155 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
6156 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006157 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006158 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
6159 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006160 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006161 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
6162 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
6163 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
6164 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
6165 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
6166 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
6167 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
6168 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
6169 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
6170 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
6171 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.6"),
6172 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.6"),
6173 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
6174 "msm-dai-q6.1"),
6175 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
6176 "msm-dai-q6.1"),
6177 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
6178 "msm-dai-q6.5"),
6179 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
6180 "msm-dai-q6.5"),
6181 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wangdea7c822012-08-20 20:52:42 -07006182 "msm-dai-q6.0"),
6183 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
6184 "msm-dai-q6.0"),
6185 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Tianyi Goue3d4f542012-03-15 17:06:45 -07006186 "msm-dai-q6.16384"),
6187 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
6188 "msm-dai-q6.16384"),
6189 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
6190 "msm-dai-q6.4"),
6191 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
6192 "msm-dai-q6.4"),
6193 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
6194 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
6195 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
6196 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
6197 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
6198 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
6199 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
6200 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
6201 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
6202 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
6203 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
6204 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.9"),
6205 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.10"),
6206
6207 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
6208 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
6209 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
6210 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
6211 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08006212 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
6213 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006214
6215 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
6216 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
6217 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
6218 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
6219 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
6220 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
6221 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
6222 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
6223 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
6224 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006225
6226 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07006227 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
6228 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006229
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07006230 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07006231
Tianyi Goue3d4f542012-03-15 17:06:45 -07006232 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
6233 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
6234 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
6235 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
6236 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
6237 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
6238};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006239/*
6240 * Miscellaneous clock register initializations
6241 */
6242
6243/* Read, modify, then write-back a register. */
6244static void __init rmwreg(uint32_t val, void *reg, uint32_t mask)
6245{
6246 uint32_t regval = readl_relaxed(reg);
6247 regval &= ~mask;
6248 regval |= val;
6249 writel_relaxed(regval, reg);
6250}
6251
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006252static struct pll_config_regs pll4_regs __initdata = {
6253 .l_reg = LCC_PLL0_L_VAL_REG,
6254 .m_reg = LCC_PLL0_M_VAL_REG,
6255 .n_reg = LCC_PLL0_N_VAL_REG,
6256 .config_reg = LCC_PLL0_CONFIG_REG,
6257 .mode_reg = LCC_PLL0_MODE_REG,
6258};
Tianyi Gou41515e22011-09-01 19:37:43 -07006259
Matt Wagantall86e03822011-12-12 10:59:24 -08006260static struct pll_config pll4_config_393 __initdata = {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006261 .l = 0xE,
6262 .m = 0x27A,
6263 .n = 0x465,
6264 .vco_val = 0x0,
6265 .vco_mask = BM(17, 16),
6266 .pre_div_val = 0x0,
6267 .pre_div_mask = BIT(19),
6268 .post_div_val = 0x0,
6269 .post_div_mask = BM(21, 20),
6270 .mn_ena_val = BIT(22),
6271 .mn_ena_mask = BIT(22),
6272 .main_output_val = BIT(23),
6273 .main_output_mask = BIT(23),
6274};
Tianyi Gou41515e22011-09-01 19:37:43 -07006275
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006276static struct pll_config_regs pll15_regs __initdata = {
6277 .l_reg = MM_PLL3_L_VAL_REG,
6278 .m_reg = MM_PLL3_M_VAL_REG,
6279 .n_reg = MM_PLL3_N_VAL_REG,
6280 .config_reg = MM_PLL3_CONFIG_REG,
6281 .mode_reg = MM_PLL3_MODE_REG,
6282};
Tianyi Gou358c3862011-10-18 17:03:41 -07006283
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006284static struct pll_config pll15_config __initdata = {
6285 .l = (0x24 | BVAL(31, 7, 0x620)),
6286 .m = 0x1,
6287 .n = 0x9,
6288 .vco_val = BVAL(17, 16, 0x2),
6289 .vco_mask = BM(17, 16),
6290 .pre_div_val = 0x0,
6291 .pre_div_mask = BIT(19),
6292 .post_div_val = 0x0,
6293 .post_div_mask = BM(21, 20),
6294 .mn_ena_val = BIT(22),
6295 .mn_ena_mask = BIT(22),
6296 .main_output_val = BIT(23),
6297 .main_output_mask = BIT(23),
6298};
Tianyi Gou41515e22011-09-01 19:37:43 -07006299
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006300static struct pll_config_regs pll14_regs __initdata = {
6301 .l_reg = BB_PLL14_L_VAL_REG,
6302 .m_reg = BB_PLL14_M_VAL_REG,
6303 .n_reg = BB_PLL14_N_VAL_REG,
6304 .config_reg = BB_PLL14_CONFIG_REG,
6305 .mode_reg = BB_PLL14_MODE_REG,
6306};
6307
6308static struct pll_config pll14_config __initdata = {
6309 .l = (0x11 | BVAL(31, 7, 0x620)),
6310 .m = 0x7,
6311 .n = 0x9,
6312 .vco_val = 0x0,
6313 .vco_mask = BM(17, 16),
6314 .pre_div_val = 0x0,
6315 .pre_div_mask = BIT(19),
6316 .post_div_val = 0x0,
6317 .post_div_mask = BM(21, 20),
6318 .mn_ena_val = BIT(22),
6319 .mn_ena_mask = BIT(22),
6320 .main_output_val = BIT(23),
6321 .main_output_mask = BIT(23),
6322};
Tianyi Gou41515e22011-09-01 19:37:43 -07006323
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006324static void __init reg_init(void)
6325{
Stephen Boydd471e7a2011-11-19 01:37:39 -08006326 void __iomem *imem_reg;
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006327
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006328 /* Deassert MM SW_RESET_ALL signal. */
6329 writel_relaxed(0, SW_RESET_ALL_REG);
6330
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006331 /*
Tianyi Goue3d4f542012-03-15 17:06:45 -07006332 * Some bits are only used on 8960 or 8064 or 8930 and are marked as
6333 * reserved bits on the other SoCs. Writing to these reserved bits
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006334 * should have no effect.
6335 */
Stephen Boydd471e7a2011-11-19 01:37:39 -08006336 /*
6337 * Initialize MM AHB registers: Enable the FPB clock and disable HW
Patrick Dalye6f489042012-07-11 15:29:15 -07006338 * gating on 8627 and 8960 for all clocks. Also set VFE_AHB's
Stephen Boydd471e7a2011-11-19 01:37:39 -08006339 * FORCE_CORE_ON bit to prevent its memory from being collapsed when
6340 * the clock is halted. The sleep and wake-up delays are set to safe
6341 * values.
6342 */
Patrick Dalye6f489042012-07-11 15:29:15 -07006343 if (cpu_is_msm8627() || cpu_is_msm8960ab()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006344 rmwreg(0x00000003, AHB_EN_REG, 0x6C000103);
6345 writel_relaxed(0x000007F9, AHB_EN2_REG);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006346 } else {
David Garibaldif69836a2012-08-17 16:05:22 -07006347 rmwreg(0x40000000, AHB_EN_REG, 0x6C000103);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006348 writel_relaxed(0x3C7097F9, AHB_EN2_REG);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006349 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006350
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006351 if (cpu_is_apq8064() || cpu_is_apq8064ab())
Tianyi Gou64daed52012-08-23 11:00:47 -07006352 rmwreg(0x00000000, AHB_EN3_REG, 0x00000001);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006353
6354 /* Deassert all locally-owned MM AHB resets. */
6355 rmwreg(0, SW_RESET_AHB_REG, 0xFFF7DFFF);
Tianyi Gou41515e22011-09-01 19:37:43 -07006356 rmwreg(0, SW_RESET_AHB2_REG, 0x0000000F);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006357
6358 /* Initialize MM AXI registers: Enable HW gating for all clocks that
6359 * support it. Also set FORCE_CORE_ON bits, and any sleep and wake-up
6360 * delays to safe values. */
Patrick Dalye6f489042012-07-11 15:29:15 -07006361 if (cpu_is_msm8960ab() || (cpu_is_msm8960() &&
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006362 SOCINFO_VERSION_MAJOR(socinfo_get_version()) < 3) ||
6363 cpu_is_msm8627()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006364 rmwreg(0x000007F9, MAXI_EN_REG, 0x0803FFFF);
6365 rmwreg(0x3027FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006366 } else {
6367 rmwreg(0x0003AFF9, MAXI_EN_REG, 0x0803FFFF);
6368 rmwreg(0x3A27FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006369 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006370
Matt Wagantall53d968f2011-07-19 13:22:53 -07006371 rmwreg(0x0027FCFF, MAXI_EN3_REG, 0x003FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006372 rmwreg(0x0027FCFF, MAXI_EN4_REG, 0x017FFFFF);
6373
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006374 if (cpu_is_apq8064() || cpu_is_apq8064ab())
Tianyi Gouf3095ea2012-05-22 14:16:06 -07006375 rmwreg(0x019FECFF, MAXI_EN5_REG, 0x01FFEFFF);
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006376 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006377 rmwreg(0x000004FF, MAXI_EN5_REG, 0x00000FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006378 if (cpu_is_msm8960ab())
6379 rmwreg(0x009FE000, MAXI_EN5_REG, 0x01FFE000);
6380
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006381 if (cpu_is_msm8627())
Stephen Boydd471e7a2011-11-19 01:37:39 -08006382 rmwreg(0x000003C7, SAXI_EN_REG, 0x00003FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006383 else if (cpu_is_msm8960ab())
6384 rmwreg(0x000001C6, SAXI_EN_REG, 0x00001DF6);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006385 else
6386 rmwreg(0x00003C38, SAXI_EN_REG, 0x00003FFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006387
6388 /* Enable IMEM's clk_on signal */
6389 imem_reg = ioremap(0x04b00040, 4);
6390 if (imem_reg) {
6391 writel_relaxed(0x3, imem_reg);
6392 iounmap(imem_reg);
6393 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006394
6395 /* Initialize MM CC registers: Set MM FORCE_CORE_ON bits so that core
6396 * memories retain state even when not clocked. Also, set sleep and
6397 * wake-up delays to safe values. */
Matt Wagantall53d968f2011-07-19 13:22:53 -07006398 rmwreg(0x00000000, CSI0_CC_REG, 0x00000410);
6399 rmwreg(0x00000000, CSI1_CC_REG, 0x00000410);
6400 rmwreg(0x80FF0000, DSI1_BYTE_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006401 rmwreg(0x80FF0000, DSI_PIXEL_CC_REG, 0xE0FF0010);
Tarun Karra6fbc00a2011-12-13 09:23:47 -07006402 rmwreg(0xC0FF0000, GFX3D_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006403 rmwreg(0x80FF0000, IJPEG_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006404 rmwreg(0x80FF0000, MDP_CC_REG, 0xE1FF0010);
6405 rmwreg(0x80FF0000, MDP_LUT_CC_REG, 0xE0FF0010);
6406 rmwreg(0x80FF0000, ROT_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006407 rmwreg(0x000004FF, TV_CC2_REG, 0x000007FF);
6408 rmwreg(0xC0FF0000, VCODEC_CC_REG, 0xE0FF0010);
6409 rmwreg(0x80FF0000, VFE_CC_REG, 0xE0FF4010);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006410 rmwreg(0x800000FF, VFE_CC2_REG, 0xE00000FF);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006411 rmwreg(0x80FF0000, VPE_CC_REG, 0xE0FF0010);
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006412 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_apq8064()
6413 || cpu_is_apq8064ab()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006414 rmwreg(0x80FF0000, DSI2_BYTE_CC_REG, 0xE0FF0010);
6415 rmwreg(0x80FF0000, DSI2_PIXEL_CC_REG, 0xE0FF0010);
6416 rmwreg(0x80FF0000, JPEGD_CC_REG, 0xE0FF0010);
6417 }
Patrick Dalye6f489042012-07-11 15:29:15 -07006418 if (cpu_is_msm8960ab())
6419 rmwreg(0x00000001, DSI2_PIXEL_CC2_REG, 0x00000001);
6420
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006421 if (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm8930aa() ||
6422 cpu_is_msm8627())
Patrick Dalye6f489042012-07-11 15:29:15 -07006423 rmwreg(0x80FF0000, TV_CC_REG, 0xE1FFC010);
6424 if (cpu_is_msm8960ab())
6425 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Goue3d4f542012-03-15 17:06:45 -07006426
6427 if (cpu_is_msm8960()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006428 rmwreg(0x80FF0000, GFX2D0_CC_REG, 0xE0FF0010);
6429 rmwreg(0x80FF0000, GFX2D1_CC_REG, 0xE0FF0010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006430 }
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006431 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006432 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Gou621f8742011-09-01 21:45:01 -07006433 rmwreg(0x80FF0000, VCAP_CC_REG, 0xE0FF1010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006434 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006435
Tianyi Gou41515e22011-09-01 19:37:43 -07006436 /*
6437 * Initialize USB_HS_HCLK_FS registers: Set FORCE_C_ON bits so that
6438 * core remain active during halt state of the clk. Also, set sleep
6439 * and wake-up value to max.
6440 */
6441 rmwreg(0x0000004F, USB_HS1_HCLK_FS_REG, 0x0000007F);
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006442 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006443 rmwreg(0x0000004F, USB_HS3_HCLK_FS_REG, 0x0000007F);
6444 rmwreg(0x0000004F, USB_HS4_HCLK_FS_REG, 0x0000007F);
6445 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006446
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006447 /* De-assert MM AXI resets to all hardware blocks. */
6448 writel_relaxed(0, SW_RESET_AXI_REG);
6449
6450 /* Deassert all MM core resets. */
6451 writel_relaxed(0, SW_RESET_CORE_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006452 writel_relaxed(0, SW_RESET_CORE2_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006453
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006454 /* Enable TSSC and PDM PXO sources. */
6455 writel_relaxed(BIT(11), TSSC_CLK_CTL_REG);
6456 writel_relaxed(BIT(15), PDM_CLK_NS_REG);
6457
6458 /* Source SLIMBus xo src from slimbus reference clock */
Patrick Dalye6f489042012-07-11 15:29:15 -07006459 if (cpu_is_msm8960ab() || cpu_is_msm8960())
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006460 writel_relaxed(0x3, SLIMBUS_XO_SRC_CLK_CTL_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006461
6462 /* Source the dsi_byte_clks from the DSI PHY PLLs */
6463 rmwreg(0x1, DSI1_BYTE_NS_REG, 0x7);
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006464 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_apq8064()
6465 || cpu_is_apq8064ab())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006466 rmwreg(0x2, DSI2_BYTE_NS_REG, 0x7);
Tianyi Gou41515e22011-09-01 19:37:43 -07006467
Siddhartha Agrawal482459c2012-05-24 15:28:53 -07006468 /* Source the dsi1_esc_clk from the DSI1 PHY PLLs */
6469 rmwreg(0x1, DSI1_ESC_NS_REG, 0x7);
6470
Tianyi Gou352955d2012-05-18 19:44:01 -07006471 /*
6472 * Source the sata_phy_ref_clk from PXO and set predivider of
6473 * sata_pmalive_clk to 1.
6474 */
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006475 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Tianyi Gou41515e22011-09-01 19:37:43 -07006476 rmwreg(0, SATA_PHY_REF_CLK_CTL_REG, 0x1);
Tianyi Gou352955d2012-05-18 19:44:01 -07006477 rmwreg(0, SATA_PMALIVE_CLK_CTL_REG, 0x3);
6478 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006479
6480 /*
Tianyi Gou05e01102012-02-08 22:15:49 -08006481 * TODO: Programming below PLLs and prng_clk is temporary and
6482 * needs to be removed after bootloaders program them.
Tianyi Gou41515e22011-09-01 19:37:43 -07006483 */
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006484 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Tianyi Gou317aa862012-02-06 14:31:07 -08006485 u32 is_pll_enabled;
Tianyi Gou41515e22011-09-01 19:37:43 -07006486
6487 /* Program pxo_src_clk to source from PXO */
6488 rmwreg(0x1, PXO_SRC_CLK_CTL_REG, 0x7);
6489
Tianyi Gou41515e22011-09-01 19:37:43 -07006490 /* Check if PLL14 is active */
6491 is_pll_enabled = readl_relaxed(BB_PLL14_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006492 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006493 /* Ref clk = 27MHz and program pll14 to 480MHz */
Vikram Mulukutla6da35d32012-07-18 13:55:31 -07006494 configure_sr_pll(&pll14_config, &pll14_regs, 1);
Tianyi Gou621f8742011-09-01 21:45:01 -07006495
Tianyi Gouc29c3242011-10-12 21:02:15 -07006496 /* Check if PLL4 is active */
6497 is_pll_enabled = readl_relaxed(LCC_PLL0_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006498 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006499 /* Ref clk = 27MHz and program pll4 to 393.2160MHz */
Vikram Mulukutla6da35d32012-07-18 13:55:31 -07006500 configure_sr_pll(&pll4_config_393, &pll4_regs, 1);
Tianyi Gouc29c3242011-10-12 21:02:15 -07006501
6502 /* Enable PLL4 source on the LPASS Primary PLL Mux */
6503 writel_relaxed(0x1, LCC_PRI_PLL_CLK_CTL_REG);
Tianyi Gou05e01102012-02-08 22:15:49 -08006504
6505 /* Program prng_clk to 64MHz if it isn't configured */
6506 if (!readl_relaxed(PRNG_CLK_NS_REG))
6507 writel_relaxed(0x2B, PRNG_CLK_NS_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006508 }
Tianyi Gou65c536a2012-03-20 23:20:29 -07006509
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006510 if (cpu_is_apq8064()) {
6511 /* Program PLL15 to 975MHz with ref clk = 27MHz */
6512 configure_sr_pll(&pll15_config, &pll15_regs, 0);
6513 } else if (cpu_is_apq8064ab()) {
6514 /* Program PLL15 to 900MHZ */
6515 pll15_config.l = 0x21 | BVAL(31, 7, 0x620);
6516 pll15_config.m = 0x1;
6517 pll15_config.n = 0x3;
6518 configure_sr_pll(&pll15_config, &pll15_regs, 0);
6519 }
6520
Tianyi Gou65c536a2012-03-20 23:20:29 -07006521 /*
6522 * Program PLL15 to 900MHz with ref clk = 27MHz and
6523 * only enable PLL main output.
6524 */
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006525 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006526 pll15_config.l = 0x21 | BVAL(31, 7, 0x600);
6527 pll15_config.m = 0x1;
6528 pll15_config.n = 0x3;
Vikram Mulukutla6da35d32012-07-18 13:55:31 -07006529 configure_sr_pll(&pll15_config, &pll15_regs, 0);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006530 /* Disable AUX and BIST outputs */
6531 writel_relaxed(0, MM_PLL3_TEST_CTL_REG);
Tianyi Gou65c536a2012-03-20 23:20:29 -07006532 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006533}
6534
Patrick Dalye6f489042012-07-11 15:29:15 -07006535struct clock_init_data msm8960_clock_init_data __initdata;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006536static void __init msm8960_clock_pre_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006537{
Matt Wagantall86e03822011-12-12 10:59:24 -08006538 /* Initialize clock registers. */
6539 reg_init();
6540
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006541 if (cpu_is_apq8064() || cpu_is_apq8064ab())
Matt Wagantall82feaa12012-07-09 10:54:49 -07006542 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8064;
Tianyi Goubf3d0b12012-01-23 14:37:28 -08006543
Matt Wagantall86e03822011-12-12 10:59:24 -08006544 /* Detect PLL4 programmed for alternate 491.52MHz clock plan. */
6545 if (readl_relaxed(LCC_PLL0_L_VAL_REG) == 0x12) {
6546 pll4_clk.c.rate = 491520000;
6547 audio_slimbus_clk.freq_tbl = clk_tbl_aif_osr_492;
6548 mi2s_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6549 codec_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6550 spare_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6551 codec_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6552 spare_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6553 pcm_clk.freq_tbl = clk_tbl_pcm_492;
6554 }
6555
Patrick Dalye6f489042012-07-11 15:29:15 -07006556 if (cpu_is_msm8960() || cpu_is_msm8960ab())
6557 memcpy(msm_clocks_8960, msm_clocks_8960_common,
6558 sizeof(msm_clocks_8960_common));
6559 if (cpu_is_msm8960ab()) {
6560 pll3_clk.c.rate = 650000000;
6561 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8960ab;
6562 gfx3d_clk.c.fmax[VDD_DIG_LOW] = 192000000;
6563 gfx3d_clk.c.fmax[VDD_DIG_NOMINAL] = 325000000;
6564 gfx3d_clk.c.fmax[VDD_DIG_HIGH] = 400000000;
6565 mdp_clk.freq_tbl = clk_tbl_mdp_8960ab;
6566 mdp_clk.c.fmax[VDD_DIG_LOW] = 128000000;
6567 mdp_clk.c.fmax[VDD_DIG_NOMINAL] = 266667000;
6568
6569 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6570 msm_clocks_8960ab_only, sizeof(msm_clocks_8960ab_only));
6571 msm8960_clock_init_data.size -=
6572 ARRAY_SIZE(msm_clocks_8960_only);
Joel King9af070b2012-08-19 22:32:14 -07006573
6574 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Patrick Dalye6f489042012-07-11 15:29:15 -07006575 } else if (cpu_is_msm8960()) {
6576 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6577 msm_clocks_8960_only, sizeof(msm_clocks_8960_only));
6578 msm8960_clock_init_data.size -=
6579 ARRAY_SIZE(msm_clocks_8960ab_only);
6580 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006581 /*
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006582 * Change the freq tables for and voltage requirements for
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006583 * clocks which differ between chips.
Tianyi Gou41515e22011-09-01 19:37:43 -07006584 */
6585 if (cpu_is_apq8064()) {
6586 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8064;
Saravana Kannan55e959d2012-10-15 22:16:04 -07006587 gfx3d_clk.c.fmax = fmax_gfx3d_8064;
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006588 }
6589 if (cpu_is_apq8064ab()) {
6590 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8064;
Saravana Kannan55e959d2012-10-15 22:16:04 -07006591 gfx3d_clk.c.fmax = fmax_gfx3d_8064ab;
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006592 }
6593 if ((cpu_is_apq8064() &&
6594 SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) ||
6595 cpu_is_apq8064ab()) {
6596
Saravana Kannan55e959d2012-10-15 22:16:04 -07006597 vcodec_clk.c.fmax = fmax_vcodec_8064v2;
6598 ce3_src_clk.c.fmax = fmax_ce3_8064v2;
6599 sdc1_clk.c.fmax = fmax_sdc1_8064v2;
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006600 }
6601 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Saravana Kannan55e959d2012-10-15 22:16:04 -07006602 ijpeg_clk.c.fmax = fmax_ijpeg_8064;
6603 mdp_clk.c.fmax = fmax_mdp_8064;
6604 tv_src_clk.c.fmax = fmax_tv_src_8064;
6605 vfe_clk.c.fmax = fmax_vfe_8064;
Patrick Dalye6f489042012-07-11 15:29:15 -07006606 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Tianyi Goue3d4f542012-03-15 17:06:45 -07006607 }
6608
6609 /*
6610 * Change the freq tables and voltage requirements for
6611 * clocks which differ between 8960 and 8930.
6612 */
Patrick Dalyebe63c52012-08-07 15:41:30 -07006613 if (cpu_is_msm8930() || cpu_is_msm8627()) {
Saravana Kannan55e959d2012-10-15 22:16:04 -07006614 gfx3d_clk.c.fmax = fmax_gfx3d_8930;
Patrick Dalyebe63c52012-08-07 15:41:30 -07006615 } else if (cpu_is_msm8930aa()) {
Saravana Kannan55e959d2012-10-15 22:16:04 -07006616 gfx3d_clk.c.fmax = fmax_gfx3d_8930aa;
Patrick Dalyebe63c52012-08-07 15:41:30 -07006617 }
6618 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
6619 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8930;
Tianyi Goue3d4f542012-03-15 17:06:45 -07006620 pll15_clk.c.rate = 900000000;
6621 gmem_axi_clk.c.depends = &gfx3d_axi_clk_8930.c;
Tianyi Gou41515e22011-09-01 19:37:43 -07006622 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07006623 if ((readl_relaxed(PRNG_CLK_NS_REG) & 0x7F) == 0x2B)
6624 prng_clk.freq_tbl = clk_tbl_prng_64;
Stephen Boyd94625ef2011-07-12 17:06:01 -07006625
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006626 vote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006627
Vikram Mulukutla681d8682012-03-09 23:56:20 -08006628 clk_ops_local_pll.enable = sr_pll_clk_enable;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006629}
6630
Patrick Daly1a3859f2012-08-27 16:10:26 -07006631static void __init msm8930_pm8917_clock_pre_init(void)
6632{
6633 /* detect pmic8917 from board file, and call this init function */
6634
6635 vdd_dig.set_vdd = set_vdd_dig_8930;
6636 rpm_vreg_dig_8930 = RPM_VREG_ID_PM8917_VDD_DIG_CORNER;
6637 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930_pm8917;
6638
6639 msm8960_clock_pre_init();
6640}
6641
6642static void __init msm8930_clock_pre_init(void)
6643{
6644 vdd_dig.set_vdd = set_vdd_dig_8930;
6645 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930;
6646
6647 msm8960_clock_pre_init();
6648}
6649
Matt Wagantallb64888f2012-04-02 21:35:07 -07006650static void __init msm8960_clock_post_init(void)
6651{
6652 /* Keep PXO on whenever APPS cpu is active */
6653 clk_prepare_enable(&pxo_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006654
Matt Wagantalle655cd72012-04-09 10:15:03 -07006655 /* Reset 3D core while clocked to ensure it resets completely. */
6656 clk_set_rate(&gfx3d_clk.c, 27000000);
6657 clk_prepare_enable(&gfx3d_clk.c);
6658 clk_reset(&gfx3d_clk.c, CLK_RESET_ASSERT);
6659 udelay(5);
6660 clk_reset(&gfx3d_clk.c, CLK_RESET_DEASSERT);
6661 clk_disable_unprepare(&gfx3d_clk.c);
6662
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006663 /* Initialize rates for clocks that only support one. */
6664 clk_set_rate(&pdm_clk.c, 27000000);
Stephen Boyd842a1f62012-04-26 19:07:38 -07006665 clk_set_rate(&prng_clk.c, prng_clk.freq_tbl->freq_hz);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006666 clk_set_rate(&mdp_vsync_clk.c, 27000000);
6667 clk_set_rate(&tsif_ref_clk.c, 105000);
6668 clk_set_rate(&tssc_clk.c, 27000000);
6669 clk_set_rate(&usb_hs1_xcvr_clk.c, 60000000);
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006670 if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
Tianyi Gou41515e22011-09-01 19:37:43 -07006671 clk_set_rate(&usb_hs3_xcvr_clk.c, 60000000);
6672 clk_set_rate(&usb_hs4_xcvr_clk.c, 60000000);
6673 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006674 clk_set_rate(&usb_fs1_src_clk.c, 60000000);
Patrick Dalye6f489042012-07-11 15:29:15 -07006675 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_msm8930() ||
6676 cpu_is_msm8930aa() || cpu_is_msm8627())
Tianyi Gou41515e22011-09-01 19:37:43 -07006677 clk_set_rate(&usb_fs2_src_clk.c, 60000000);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006678 clk_set_rate(&usb_hsic_xcvr_fs_clk.c, 60000000);
6679 clk_set_rate(&usb_hsic_hsic_src_clk.c, 480000000);
6680 clk_set_rate(&usb_hsic_hsio_cal_clk.c, 9000000);
Lena Salman127823f2012-02-14 17:13:53 +02006681 clk_set_rate(&usb_hsic_system_clk.c, 60000000);
Stephen Boyd092fd182011-10-21 15:56:30 -07006682 /*
6683 * Set the CSI rates to a safe default to avoid warnings when
6684 * switching csi pix and rdi clocks.
6685 */
6686 clk_set_rate(&csi0_src_clk.c, 27000000);
6687 clk_set_rate(&csi1_src_clk.c, 27000000);
6688 clk_set_rate(&csi2_src_clk.c, 27000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006689
6690 /*
Stephen Boyd60496bb2011-10-17 13:51:37 -07006691 * The halt status bits for these clocks may be incorrect at boot.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006692 * Toggle these clocks on and off to refresh them.
6693 */
Stephen Boyd409b8b42012-04-10 12:12:56 -07006694 clk_prepare_enable(&pdm_clk.c);
6695 clk_disable_unprepare(&pdm_clk.c);
6696 clk_prepare_enable(&tssc_clk.c);
6697 clk_disable_unprepare(&tssc_clk.c);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006698 clk_prepare_enable(&usb_hsic_hsic_clk.c);
6699 clk_disable_unprepare(&usb_hsic_hsic_clk.c);
Stephen Boydd7a143a2012-02-16 17:59:26 -08006700
6701 /*
6702 * Keep sfab floor @ 54MHz so that Krait AHB is at least 27MHz at all
6703 * times when Apps CPU is active. This ensures the timer's requirement
6704 * of Krait AHB running 4 times as fast as the timer itself.
6705 */
6706 clk_set_rate(&sfab_tmr_a_clk.c, 54000000);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006707 clk_prepare_enable(&sfab_tmr_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006708}
6709
Stephen Boydbb600ae2011-08-02 20:11:40 -07006710static int __init msm8960_clock_late_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006711{
Stephen Boyda3787f32011-09-16 18:55:13 -07006712 int rc;
6713 struct clk *mmfpb_a_clk = clk_get_sys("clock-8960", "mmfpb_a_clk");
Stephen Boyd85436132011-09-16 18:55:13 -07006714 struct clk *cfpb_a_clk = clk_get_sys("clock-8960", "cfpb_a_clk");
Stephen Boyda3787f32011-09-16 18:55:13 -07006715
Stephen Boyd9e497f02012-08-24 13:07:24 -07006716 /* Vote for MMFPB to be on when Apps is active. */
Stephen Boyda3787f32011-09-16 18:55:13 -07006717 if (WARN(IS_ERR(mmfpb_a_clk), "mmfpb_a_clk not found (%ld)\n",
6718 PTR_ERR(mmfpb_a_clk)))
6719 return PTR_ERR(mmfpb_a_clk);
Stephen Boyd9e497f02012-08-24 13:07:24 -07006720 rc = clk_set_rate(mmfpb_a_clk, 38400000);
Stephen Boyda3787f32011-09-16 18:55:13 -07006721 if (WARN(rc, "mmfpb_a_clk rate was not set (%d)\n", rc))
6722 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006723 rc = clk_prepare_enable(mmfpb_a_clk);
Stephen Boyda3787f32011-09-16 18:55:13 -07006724 if (WARN(rc, "mmfpb_a_clk not enabled (%d)\n", rc))
6725 return rc;
6726
Stephen Boyd9e497f02012-08-24 13:07:24 -07006727 /* Vote for CFPB to be on when Apps is active. */
Stephen Boyd85436132011-09-16 18:55:13 -07006728 if (WARN(IS_ERR(cfpb_a_clk), "cfpb_a_clk not found (%ld)\n",
6729 PTR_ERR(cfpb_a_clk)))
6730 return PTR_ERR(cfpb_a_clk);
Stephen Boyd9e497f02012-08-24 13:07:24 -07006731 rc = clk_set_rate(cfpb_a_clk, 32000000);
Stephen Boyd85436132011-09-16 18:55:13 -07006732 if (WARN(rc, "cfpb_a_clk rate was not set (%d)\n", rc))
6733 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006734 rc = clk_prepare_enable(cfpb_a_clk);
Stephen Boyd85436132011-09-16 18:55:13 -07006735 if (WARN(rc, "cfpb_a_clk not enabled (%d)\n", rc))
6736 return rc;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006737
6738 return unvote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006739}
Stephen Boydbb600ae2011-08-02 20:11:40 -07006740
6741struct clock_init_data msm8960_clock_init_data __initdata = {
6742 .table = msm_clocks_8960,
6743 .size = ARRAY_SIZE(msm_clocks_8960),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006744 .pre_init = msm8960_clock_pre_init,
6745 .post_init = msm8960_clock_post_init,
Stephen Boydbb600ae2011-08-02 20:11:40 -07006746 .late_init = msm8960_clock_late_init,
6747};
Tianyi Gou41515e22011-09-01 19:37:43 -07006748
6749struct clock_init_data apq8064_clock_init_data __initdata = {
6750 .table = msm_clocks_8064,
6751 .size = ARRAY_SIZE(msm_clocks_8064),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006752 .pre_init = msm8960_clock_pre_init,
6753 .post_init = msm8960_clock_post_init,
Tianyi Gou41515e22011-09-01 19:37:43 -07006754 .late_init = msm8960_clock_late_init,
6755};
Tianyi Goue3d4f542012-03-15 17:06:45 -07006756
6757struct clock_init_data msm8930_clock_init_data __initdata = {
6758 .table = msm_clocks_8930,
6759 .size = ARRAY_SIZE(msm_clocks_8930),
Patrick Daly1a3859f2012-08-27 16:10:26 -07006760 .pre_init = msm8930_clock_pre_init,
6761 .post_init = msm8960_clock_post_init,
6762 .late_init = msm8960_clock_late_init,
6763};
6764
6765struct clock_init_data msm8930_pm8917_clock_init_data __initdata = {
6766 .table = msm_clocks_8930,
6767 .size = ARRAY_SIZE(msm_clocks_8930),
6768 .pre_init = msm8930_pm8917_clock_pre_init,
Matt Wagantallb64888f2012-04-02 21:35:07 -07006769 .post_init = msm8960_clock_post_init,
Tianyi Goue3d4f542012-03-15 17:06:45 -07006770 .late_init = msm8960_clock_late_init,
6771};