blob: e87dd148405a25b823a663ab1daff3b024f819a1 [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/err.h>
16#include <linux/ctype.h>
17#include <linux/bitops.h>
18#include <linux/io.h>
19#include <linux/spinlock.h>
20#include <linux/delay.h>
21#include <linux/clk.h>
22
23#include <asm/clkdev.h>
24#include <asm/mach-types.h>
25
26#include <mach/msm_iomap.h>
27#include <mach/clk.h>
28#include <mach/rpm-regulator.h>
Stephen Boyd94625ef2011-07-12 17:06:01 -070029#include <mach/socinfo.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030
31#include "clock-local.h"
32#include "clock-rpm.h"
33#include "clock-voter.h"
34#include "clock-dss-8960.h"
35#include "devices.h"
Vikram Mulukutla681d8682012-03-09 23:56:20 -080036#include "clock-pll.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38#define REG(off) (MSM_CLK_CTL_BASE + (off))
39#define REG_MM(off) (MSM_MMSS_CLK_CTL_BASE + (off))
40#define REG_LPA(off) (MSM_LPASS_CLK_CTL_BASE + (off))
Matt Wagantall8b38f942011-08-02 18:23:18 -070041#define REG_GCC(off) (MSM_APCS_GCC_BASE + (off))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
43/* Peripheral clock registers. */
Stephen Boyda52d7e32011-11-10 11:59:00 -080044#define ADM0_PBUS_CLK_CTL_REG REG(0x2208)
Tianyi Gou352955d2012-05-18 19:44:01 -070045#define SFAB_SATA_S_HCLK_CTL_REG REG(0x2480)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#define CE1_HCLK_CTL_REG REG(0x2720)
47#define CE1_CORE_CLK_CTL_REG REG(0x2724)
Tianyi Gou05e01102012-02-08 22:15:49 -080048#define PRNG_CLK_NS_REG REG(0x2E80)
Tianyi Gou41515e22011-09-01 19:37:43 -070049#define CE3_HCLK_CTL_REG REG(0x36C4)
50#define CE3_CORE_CLK_CTL_REG REG(0x36CC)
51#define CE3_CLK_SRC_NS_REG REG(0x36C0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#define DMA_BAM_HCLK_CTL REG(0x25C0)
Tianyi Gou6613de52012-01-27 17:57:53 -080053#define CLK_HALT_AFAB_SFAB_STATEA_REG REG(0x2FC0)
Tianyi Gou41515e22011-09-01 19:37:43 -070054#define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070055#define CLK_HALT_CFPB_STATEA_REG REG(0x2FCC)
56#define CLK_HALT_CFPB_STATEB_REG REG(0x2FD0)
57#define CLK_HALT_CFPB_STATEC_REG REG(0x2FD4)
58#define CLK_HALT_DFAB_STATE_REG REG(0x2FC8)
Tianyi Gou41515e22011-09-01 19:37:43 -070059/* 8064 name CLK_HALT_GSS_KPSS_MISC_STATE_REG */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070060#define CLK_HALT_MSS_SMPSS_MISC_STATE_REG REG(0x2FDC)
61#define CLK_HALT_SFPB_MISC_STATE_REG REG(0x2FD8)
Stephen Boyd973e4ba2011-07-12 17:06:01 -070062#define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#define CLK_TEST_REG REG(0x2FA0)
Matt Wagantall7625a4c2011-11-01 16:17:53 -070064#define GPn_MD_REG(n) REG(0x2D00+(0x20*(n)))
65#define GPn_NS_REG(n) REG(0x2D24+(0x20*(n)))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070066#define GSBIn_HCLK_CTL_REG(n) REG(0x29C0+(0x20*((n)-1)))
67#define GSBIn_QUP_APPS_MD_REG(n) REG(0x29C8+(0x20*((n)-1)))
68#define GSBIn_QUP_APPS_NS_REG(n) REG(0x29CC+(0x20*((n)-1)))
69#define GSBIn_RESET_REG(n) REG(0x29DC+(0x20*((n)-1)))
70#define GSBIn_UART_APPS_MD_REG(n) REG(0x29D0+(0x20*((n)-1)))
71#define GSBIn_UART_APPS_NS_REG(n) REG(0x29D4+(0x20*((n)-1)))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072#define PDM_CLK_NS_REG REG(0x2CC0)
Tianyi Gou41515e22011-09-01 19:37:43 -070073/* 8064 name BB_PLL_ENA_APCS_REG */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074#define BB_PLL_ENA_SC0_REG REG(0x34C0)
Tianyi Gou59608a72012-01-31 22:19:30 -080075#define BB_PLL_ENA_RPM_REG REG(0x34A0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076#define BB_PLL0_STATUS_REG REG(0x30D8)
77#define BB_PLL5_STATUS_REG REG(0x30F8)
78#define BB_PLL6_STATUS_REG REG(0x3118)
79#define BB_PLL7_STATUS_REG REG(0x3138)
80#define BB_PLL8_L_VAL_REG REG(0x3144)
81#define BB_PLL8_M_VAL_REG REG(0x3148)
82#define BB_PLL8_MODE_REG REG(0x3140)
83#define BB_PLL8_N_VAL_REG REG(0x314C)
84#define BB_PLL8_STATUS_REG REG(0x3158)
85#define BB_PLL8_CONFIG_REG REG(0x3154)
86#define BB_PLL8_TEST_CTL_REG REG(0x3150)
Stephen Boyd94625ef2011-07-12 17:06:01 -070087#define BB_MMCC_PLL2_MODE_REG REG(0x3160)
88#define BB_MMCC_PLL2_TEST_CTL_REG REG(0x3170)
Tianyi Gou41515e22011-09-01 19:37:43 -070089#define BB_PLL14_MODE_REG REG(0x31C0)
90#define BB_PLL14_L_VAL_REG REG(0x31C4)
91#define BB_PLL14_M_VAL_REG REG(0x31C8)
92#define BB_PLL14_N_VAL_REG REG(0x31CC)
93#define BB_PLL14_TEST_CTL_REG REG(0x31D0)
94#define BB_PLL14_CONFIG_REG REG(0x31D4)
Stephen Boyd94625ef2011-07-12 17:06:01 -070095#define BB_PLL14_STATUS_REG REG(0x31D8)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096#define PLLTEST_PAD_CFG_REG REG(0x2FA4)
97#define PMEM_ACLK_CTL_REG REG(0x25A0)
98#define RINGOSC_NS_REG REG(0x2DC0)
99#define RINGOSC_STATUS_REG REG(0x2DCC)
100#define RINGOSC_TCXO_CTL_REG REG(0x2DC4)
Stephen Boyda52d7e32011-11-10 11:59:00 -0800101#define RPM_MSG_RAM_HCLK_CTL_REG REG(0x27E0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700102#define SC0_U_CLK_BRANCH_ENA_VOTE_REG REG(0x3080)
103#define SDCn_APPS_CLK_MD_REG(n) REG(0x2828+(0x20*((n)-1)))
104#define SDCn_APPS_CLK_NS_REG(n) REG(0x282C+(0x20*((n)-1)))
105#define SDCn_HCLK_CTL_REG(n) REG(0x2820+(0x20*((n)-1)))
106#define SDCn_RESET_REG(n) REG(0x2830+(0x20*((n)-1)))
107#define SLIMBUS_XO_SRC_CLK_CTL_REG REG(0x2628)
108#define TSIF_HCLK_CTL_REG REG(0x2700)
109#define TSIF_REF_CLK_MD_REG REG(0x270C)
110#define TSIF_REF_CLK_NS_REG REG(0x2710)
111#define TSSC_CLK_CTL_REG REG(0x2CA0)
Tianyi Gou352955d2012-05-18 19:44:01 -0700112#define SATA_HCLK_CTL_REG REG(0x2C00)
Tianyi Gou41515e22011-09-01 19:37:43 -0700113#define SATA_CLK_SRC_NS_REG REG(0x2C08)
114#define SATA_RXOOB_CLK_CTL_REG REG(0x2C0C)
115#define SATA_PMALIVE_CLK_CTL_REG REG(0x2C10)
116#define SATA_PHY_REF_CLK_CTL_REG REG(0x2C14)
Tianyi Gou352955d2012-05-18 19:44:01 -0700117#define SATA_ACLK_CTL_REG REG(0x2C20)
Tianyi Gou41515e22011-09-01 19:37:43 -0700118#define SATA_PHY_CFG_CLK_CTL_REG REG(0x2C40)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700119#define USB_FSn_HCLK_CTL_REG(n) REG(0x2960+(0x20*((n)-1)))
120#define USB_FSn_RESET_REG(n) REG(0x2974+(0x20*((n)-1)))
121#define USB_FSn_SYSTEM_CLK_CTL_REG(n) REG(0x296C+(0x20*((n)-1)))
122#define USB_FSn_XCVR_FS_CLK_MD_REG(n) REG(0x2964+(0x20*((n)-1)))
123#define USB_FSn_XCVR_FS_CLK_NS_REG(n) REG(0x2968+(0x20*((n)-1)))
124#define USB_HS1_HCLK_CTL_REG REG(0x2900)
Tianyi Gou41515e22011-09-01 19:37:43 -0700125#define USB_HS1_HCLK_FS_REG REG(0x2904)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700126#define USB_HS1_RESET_REG REG(0x2910)
127#define USB_HS1_XCVR_FS_CLK_MD_REG REG(0x2908)
128#define USB_HS1_XCVR_FS_CLK_NS_REG REG(0x290C)
Tianyi Gou41515e22011-09-01 19:37:43 -0700129#define USB_HS3_HCLK_CTL_REG REG(0x3700)
130#define USB_HS3_HCLK_FS_REG REG(0x3704)
131#define USB_HS3_RESET_REG REG(0x3710)
132#define USB_HS3_XCVR_FS_CLK_MD_REG REG(0X3708)
133#define USB_HS3_XCVR_FS_CLK_NS_REG REG(0X370C)
134#define USB_HS4_HCLK_CTL_REG REG(0x3720)
135#define USB_HS4_HCLK_FS_REG REG(0x3724)
136#define USB_HS4_RESET_REG REG(0x3730)
137#define USB_HS4_XCVR_FS_CLK_MD_REG REG(0X3728)
138#define USB_HS4_XCVR_FS_CLK_NS_REG REG(0X372C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700139#define USB_HSIC_HCLK_CTL_REG REG(0x2920)
140#define USB_HSIC_HSIC_CLK_CTL_REG REG(0x2B44)
141#define USB_HSIC_HSIC_CLK_SRC_CTL_REG REG(0x2B40)
142#define USB_HSIC_HSIO_CAL_CLK_CTL_REG REG(0x2B48)
143#define USB_HSIC_RESET_REG REG(0x2934)
144#define USB_HSIC_SYSTEM_CLK_CTL_REG REG(0x292C)
145#define USB_HSIC_XCVR_FS_CLK_MD_REG REG(0x2924)
146#define USB_HSIC_XCVR_FS_CLK_NS_REG REG(0x2928)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700147#define USB_PHY0_RESET_REG REG(0x2E20)
Tianyi Gou41515e22011-09-01 19:37:43 -0700148#define PCIE_ALT_REF_CLK_NS_REG REG(0x3860)
Tianyi Gou6613de52012-01-27 17:57:53 -0800149#define PCIE_ACLK_CTL_REG REG(0x22C0)
Tianyi Gou41515e22011-09-01 19:37:43 -0700150#define PCIE_HCLK_CTL_REG REG(0x22CC)
Tianyi Gou6613de52012-01-27 17:57:53 -0800151#define PCIE_PCLK_CTL_REG REG(0x22D0)
Tianyi Gou41515e22011-09-01 19:37:43 -0700152#define GPLL1_MODE_REG REG(0x3160)
153#define GPLL1_L_VAL_REG REG(0x3164)
154#define GPLL1_M_VAL_REG REG(0x3168)
155#define GPLL1_N_VAL_REG REG(0x316C)
156#define GPLL1_CONFIG_REG REG(0x3174)
157#define GPLL1_STATUS_REG REG(0x3178)
158#define PXO_SRC_CLK_CTL_REG REG(0x2EA0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700159
160/* Multimedia clock registers. */
161#define AHB_EN_REG REG_MM(0x0008)
162#define AHB_EN2_REG REG_MM(0x0038)
Tianyi Gou41515e22011-09-01 19:37:43 -0700163#define AHB_EN3_REG REG_MM(0x0248)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164#define AHB_NS_REG REG_MM(0x0004)
165#define AXI_NS_REG REG_MM(0x0014)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700166#define CAMCLK0_NS_REG REG_MM(0x0148)
167#define CAMCLK0_CC_REG REG_MM(0x0140)
168#define CAMCLK0_MD_REG REG_MM(0x0144)
169#define CAMCLK1_NS_REG REG_MM(0x015C)
170#define CAMCLK1_CC_REG REG_MM(0x0154)
171#define CAMCLK1_MD_REG REG_MM(0x0158)
172#define CAMCLK2_NS_REG REG_MM(0x0228)
173#define CAMCLK2_CC_REG REG_MM(0x0220)
174#define CAMCLK2_MD_REG REG_MM(0x0224)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175#define CSI0_NS_REG REG_MM(0x0048)
176#define CSI0_CC_REG REG_MM(0x0040)
177#define CSI0_MD_REG REG_MM(0x0044)
178#define CSI1_NS_REG REG_MM(0x0010)
179#define CSI1_CC_REG REG_MM(0x0024)
180#define CSI1_MD_REG REG_MM(0x0028)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700181#define CSI2_NS_REG REG_MM(0x0234)
182#define CSI2_CC_REG REG_MM(0x022C)
183#define CSI2_MD_REG REG_MM(0x0230)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700184#define CSIPHYTIMER_CC_REG REG_MM(0x0160)
185#define CSIPHYTIMER_MD_REG REG_MM(0x0164)
186#define CSIPHYTIMER_NS_REG REG_MM(0x0168)
187#define DSI1_BYTE_NS_REG REG_MM(0x00B0)
188#define DSI1_BYTE_CC_REG REG_MM(0x0090)
189#define DSI2_BYTE_NS_REG REG_MM(0x00BC)
190#define DSI2_BYTE_CC_REG REG_MM(0x00B4)
191#define DSI1_ESC_NS_REG REG_MM(0x011C)
192#define DSI1_ESC_CC_REG REG_MM(0x00CC)
193#define DSI2_ESC_NS_REG REG_MM(0x0150)
194#define DSI2_ESC_CC_REG REG_MM(0x013C)
195#define DSI_PIXEL_CC_REG REG_MM(0x0130)
196#define DSI2_PIXEL_CC_REG REG_MM(0x0094)
Patrick Dalye6f489042012-07-11 15:29:15 -0700197#define DSI2_PIXEL_CC2_REG REG_MM(0x0264)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700198#define DBG_BUS_VEC_A_REG REG_MM(0x01C8)
199#define DBG_BUS_VEC_B_REG REG_MM(0x01CC)
200#define DBG_BUS_VEC_C_REG REG_MM(0x01D0)
201#define DBG_BUS_VEC_D_REG REG_MM(0x01D4)
202#define DBG_BUS_VEC_E_REG REG_MM(0x01D8)
203#define DBG_BUS_VEC_F_REG REG_MM(0x01DC)
204#define DBG_BUS_VEC_G_REG REG_MM(0x01E0)
205#define DBG_BUS_VEC_H_REG REG_MM(0x01E4)
206#define DBG_BUS_VEC_I_REG REG_MM(0x01E8)
Tianyi Gou41515e22011-09-01 19:37:43 -0700207#define DBG_BUS_VEC_J_REG REG_MM(0x0240)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700208#define DBG_CFG_REG_HS_REG REG_MM(0x01B4)
209#define DBG_CFG_REG_LS_REG REG_MM(0x01B8)
210#define GFX2D0_CC_REG REG_MM(0x0060)
211#define GFX2D0_MD0_REG REG_MM(0x0064)
212#define GFX2D0_MD1_REG REG_MM(0x0068)
213#define GFX2D0_NS_REG REG_MM(0x0070)
214#define GFX2D1_CC_REG REG_MM(0x0074)
215#define GFX2D1_MD0_REG REG_MM(0x0078)
216#define GFX2D1_MD1_REG REG_MM(0x006C)
217#define GFX2D1_NS_REG REG_MM(0x007C)
218#define GFX3D_CC_REG REG_MM(0x0080)
219#define GFX3D_MD0_REG REG_MM(0x0084)
220#define GFX3D_MD1_REG REG_MM(0x0088)
221#define GFX3D_NS_REG REG_MM(0x008C)
222#define IJPEG_CC_REG REG_MM(0x0098)
223#define IJPEG_MD_REG REG_MM(0x009C)
224#define IJPEG_NS_REG REG_MM(0x00A0)
225#define JPEGD_CC_REG REG_MM(0x00A4)
226#define JPEGD_NS_REG REG_MM(0x00AC)
Tianyi Gou41515e22011-09-01 19:37:43 -0700227#define VCAP_CC_REG REG_MM(0x0178)
228#define VCAP_NS_REG REG_MM(0x021C)
229#define VCAP_MD0_REG REG_MM(0x01EC)
230#define VCAP_MD1_REG REG_MM(0x0218)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700231#define MAXI_EN_REG REG_MM(0x0018)
232#define MAXI_EN2_REG REG_MM(0x0020)
233#define MAXI_EN3_REG REG_MM(0x002C)
234#define MAXI_EN4_REG REG_MM(0x0114)
Tianyi Gou41515e22011-09-01 19:37:43 -0700235#define MAXI_EN5_REG REG_MM(0x0244)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236#define MDP_CC_REG REG_MM(0x00C0)
237#define MDP_LUT_CC_REG REG_MM(0x016C)
238#define MDP_MD0_REG REG_MM(0x00C4)
239#define MDP_MD1_REG REG_MM(0x00C8)
240#define MDP_NS_REG REG_MM(0x00D0)
241#define MISC_CC_REG REG_MM(0x0058)
242#define MISC_CC2_REG REG_MM(0x005C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700243#define MISC_CC3_REG REG_MM(0x0238)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700244#define MM_PLL1_MODE_REG REG_MM(0x031C)
Tianyi Gou41515e22011-09-01 19:37:43 -0700245#define MM_PLL1_L_VAL_REG REG_MM(0x0320)
246#define MM_PLL1_M_VAL_REG REG_MM(0x0324)
247#define MM_PLL1_N_VAL_REG REG_MM(0x0328)
248#define MM_PLL1_CONFIG_REG REG_MM(0x032C)
249#define MM_PLL1_TEST_CTL_REG REG_MM(0x0330)
250#define MM_PLL1_STATUS_REG REG_MM(0x0334)
251#define MM_PLL3_MODE_REG REG_MM(0x0338)
Tianyi Gou621f8742011-09-01 21:45:01 -0700252#define MM_PLL3_L_VAL_REG REG_MM(0x033C)
253#define MM_PLL3_M_VAL_REG REG_MM(0x0340)
254#define MM_PLL3_N_VAL_REG REG_MM(0x0344)
255#define MM_PLL3_CONFIG_REG REG_MM(0x0348)
256#define MM_PLL3_TEST_CTL_REG REG_MM(0x034C)
257#define MM_PLL3_STATUS_REG REG_MM(0x0350)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700258#define ROT_CC_REG REG_MM(0x00E0)
259#define ROT_NS_REG REG_MM(0x00E8)
260#define SAXI_EN_REG REG_MM(0x0030)
261#define SW_RESET_AHB_REG REG_MM(0x020C)
262#define SW_RESET_AHB2_REG REG_MM(0x0200)
263#define SW_RESET_ALL_REG REG_MM(0x0204)
264#define SW_RESET_AXI_REG REG_MM(0x0208)
265#define SW_RESET_CORE_REG REG_MM(0x0210)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700266#define SW_RESET_CORE2_REG REG_MM(0x0214)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267#define TV_CC_REG REG_MM(0x00EC)
268#define TV_CC2_REG REG_MM(0x0124)
269#define TV_MD_REG REG_MM(0x00F0)
270#define TV_NS_REG REG_MM(0x00F4)
271#define VCODEC_CC_REG REG_MM(0x00F8)
272#define VCODEC_MD0_REG REG_MM(0x00FC)
273#define VCODEC_MD1_REG REG_MM(0x0128)
274#define VCODEC_NS_REG REG_MM(0x0100)
275#define VFE_CC_REG REG_MM(0x0104)
276#define VFE_MD_REG REG_MM(0x0108)
277#define VFE_NS_REG REG_MM(0x010C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700278#define VFE_CC2_REG REG_MM(0x023C)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279#define VPE_CC_REG REG_MM(0x0110)
280#define VPE_NS_REG REG_MM(0x0118)
281
282/* Low-power Audio clock registers. */
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700283#define LCC_CLK_HS_DEBUG_CFG_REG REG_LPA(0x00A4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700284#define LCC_CLK_LS_DEBUG_CFG_REG REG_LPA(0x00A8)
285#define LCC_CODEC_I2S_MIC_MD_REG REG_LPA(0x0064)
286#define LCC_CODEC_I2S_MIC_NS_REG REG_LPA(0x0060)
287#define LCC_CODEC_I2S_MIC_STATUS_REG REG_LPA(0x0068)
288#define LCC_CODEC_I2S_SPKR_MD_REG REG_LPA(0x0070)
289#define LCC_CODEC_I2S_SPKR_NS_REG REG_LPA(0x006C)
290#define LCC_CODEC_I2S_SPKR_STATUS_REG REG_LPA(0x0074)
291#define LCC_MI2S_MD_REG REG_LPA(0x004C)
292#define LCC_MI2S_NS_REG REG_LPA(0x0048)
293#define LCC_MI2S_STATUS_REG REG_LPA(0x0050)
294#define LCC_PCM_MD_REG REG_LPA(0x0058)
295#define LCC_PCM_NS_REG REG_LPA(0x0054)
296#define LCC_PCM_STATUS_REG REG_LPA(0x005C)
Tianyi Gouc29c3242011-10-12 21:02:15 -0700297#define LCC_PLL0_MODE_REG REG_LPA(0x0000)
298#define LCC_PLL0_L_VAL_REG REG_LPA(0x0004)
299#define LCC_PLL0_M_VAL_REG REG_LPA(0x0008)
300#define LCC_PLL0_N_VAL_REG REG_LPA(0x000C)
301#define LCC_PLL0_CONFIG_REG REG_LPA(0x0014)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700302#define LCC_PLL0_STATUS_REG REG_LPA(0x0018)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700303#define LCC_SPARE_I2S_MIC_MD_REG REG_LPA(0x007C)
304#define LCC_SPARE_I2S_MIC_NS_REG REG_LPA(0x0078)
305#define LCC_SPARE_I2S_MIC_STATUS_REG REG_LPA(0x0080)
306#define LCC_SPARE_I2S_SPKR_MD_REG REG_LPA(0x0088)
307#define LCC_SPARE_I2S_SPKR_NS_REG REG_LPA(0x0084)
308#define LCC_SPARE_I2S_SPKR_STATUS_REG REG_LPA(0x008C)
309#define LCC_SLIMBUS_NS_REG REG_LPA(0x00CC)
310#define LCC_SLIMBUS_MD_REG REG_LPA(0x00D0)
311#define LCC_SLIMBUS_STATUS_REG REG_LPA(0x00D4)
312#define LCC_AHBEX_BRANCH_CTL_REG REG_LPA(0x00E4)
Tianyi Gouc29c3242011-10-12 21:02:15 -0700313#define LCC_PRI_PLL_CLK_CTL_REG REG_LPA(0x00C4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314
Matt Wagantall8b38f942011-08-02 18:23:18 -0700315#define GCC_APCS_CLK_DIAG REG_GCC(0x001C)
316
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700317/* MUX source input identifiers. */
318#define pxo_to_bb_mux 0
Matt Wagantall7625a4c2011-11-01 16:17:53 -0700319#define cxo_to_bb_mux 5
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320#define pll0_to_bb_mux 2
321#define pll8_to_bb_mux 3
322#define pll6_to_bb_mux 4
323#define gnd_to_bb_mux 5
Stephen Boyd94625ef2011-07-12 17:06:01 -0700324#define pll3_to_bb_mux 6
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700325#define pxo_to_mm_mux 0
326#define pll1_to_mm_mux 1
Tianyi Gou41515e22011-09-01 19:37:43 -0700327#define pll2_to_mm_mux 1 /* or MMCC_PLL1 */
328#define pll8_to_mm_mux 2 /* or GCC_PERF */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329#define pll0_to_mm_mux 3
Tianyi Gou41515e22011-09-01 19:37:43 -0700330#define pll15_to_mm_mux 3 /* or MM_PLL3 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331#define gnd_to_mm_mux 4
Stephen Boyd7a776cd2011-10-20 12:46:04 -0700332#define pll3_to_mm_mux 3 /* or MMCC_PLL2 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700333#define hdmi_pll_to_mm_mux 3
334#define cxo_to_xo_mux 0
335#define pxo_to_xo_mux 1
336#define gnd_to_xo_mux 3
337#define pxo_to_lpa_mux 0
338#define cxo_to_lpa_mux 1
339#define pll4_to_lpa_mux 2
340#define gnd_to_lpa_mux 6
Tianyi Gou41515e22011-09-01 19:37:43 -0700341#define pxo_to_pcie_mux 0
342#define pll3_to_pcie_mux 1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343
344/* Test Vector Macros */
345#define TEST_TYPE_PER_LS 1
346#define TEST_TYPE_PER_HS 2
347#define TEST_TYPE_MM_LS 3
348#define TEST_TYPE_MM_HS 4
349#define TEST_TYPE_LPA 5
Matt Wagantall8b38f942011-08-02 18:23:18 -0700350#define TEST_TYPE_CPUL2 6
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700351#define TEST_TYPE_LPA_HS 7
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352#define TEST_TYPE_SHIFT 24
353#define TEST_CLK_SEL_MASK BM(23, 0)
354#define TEST_VECTOR(s, t) (((t) << TEST_TYPE_SHIFT) | BVAL(23, 0, (s)))
355#define TEST_PER_LS(s) TEST_VECTOR((s), TEST_TYPE_PER_LS)
356#define TEST_PER_HS(s) TEST_VECTOR((s), TEST_TYPE_PER_HS)
357#define TEST_MM_LS(s) TEST_VECTOR((s), TEST_TYPE_MM_LS)
358#define TEST_MM_HS(s) TEST_VECTOR((s), TEST_TYPE_MM_HS)
359#define TEST_LPA(s) TEST_VECTOR((s), TEST_TYPE_LPA)
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700360#define TEST_LPA_HS(s) TEST_VECTOR((s), TEST_TYPE_LPA_HS)
Matt Wagantall8b38f942011-08-02 18:23:18 -0700361#define TEST_CPUL2(s) TEST_VECTOR((s), TEST_TYPE_CPUL2)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700362
363#define MN_MODE_DUAL_EDGE 0x2
364
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700365struct pll_rate {
366 const uint32_t l_val;
367 const uint32_t m_val;
368 const uint32_t n_val;
369 const uint32_t vco;
370 const uint32_t post_div;
371 const uint32_t i_bits;
372};
373#define PLL_RATE(l, m, n, v, d, i) { l, m, n, v, (d>>1), i }
374
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700375enum vdd_dig_levels {
376 VDD_DIG_NONE,
377 VDD_DIG_LOW,
378 VDD_DIG_NOMINAL,
379 VDD_DIG_HIGH
380};
381
Saravana Kannan298ec392012-02-08 19:21:47 -0800382static int set_vdd_dig_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700383{
384 static const int vdd_uv[] = {
385 [VDD_DIG_NONE] = 0,
386 [VDD_DIG_LOW] = 945000,
387 [VDD_DIG_NOMINAL] = 1050000,
388 [VDD_DIG_HIGH] = 1150000
389 };
Saravana Kannan298ec392012-02-08 19:21:47 -0800390 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S3, RPM_VREG_VOTER3,
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700391 vdd_uv[level], 1150000, 1);
392}
393
Saravana Kannan298ec392012-02-08 19:21:47 -0800394static DEFINE_VDD_CLASS(vdd_dig, set_vdd_dig_8960);
395
396static int set_vdd_dig_8930(struct clk_vdd_class *vdd_class, int level)
397{
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800398 static const int vdd_corner[] = {
399 [VDD_DIG_NONE] = RPM_VREG_CORNER_NONE,
400 [VDD_DIG_LOW] = RPM_VREG_CORNER_LOW,
401 [VDD_DIG_NOMINAL] = RPM_VREG_CORNER_NOMINAL,
402 [VDD_DIG_HIGH] = RPM_VREG_CORNER_HIGH,
Saravana Kannan298ec392012-02-08 19:21:47 -0800403 };
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800404 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8038_VDD_DIG_CORNER,
405 RPM_VREG_VOTER3,
406 vdd_corner[level],
407 RPM_VREG_CORNER_HIGH, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800408}
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700409
410#define VDD_DIG_FMAX_MAP1(l1, f1) \
411 .vdd_class = &vdd_dig, \
412 .fmax[VDD_DIG_##l1] = (f1)
413#define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \
414 .vdd_class = &vdd_dig, \
415 .fmax[VDD_DIG_##l1] = (f1), \
416 .fmax[VDD_DIG_##l2] = (f2)
417#define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \
418 .vdd_class = &vdd_dig, \
419 .fmax[VDD_DIG_##l1] = (f1), \
420 .fmax[VDD_DIG_##l2] = (f2), \
421 .fmax[VDD_DIG_##l3] = (f3)
422
Matt Wagantall82feaa12012-07-09 10:54:49 -0700423enum vdd_sr2_hdmi_pll_levels {
424 VDD_SR2_HDMI_PLL_OFF,
425 VDD_SR2_HDMI_PLL_ON
Matt Wagantallc57577d2011-10-06 17:06:53 -0700426};
427
Matt Wagantall82feaa12012-07-09 10:54:49 -0700428static int set_vdd_sr2_hdmi_pll_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantallc57577d2011-10-06 17:06:53 -0700429{
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800430 int rc = 0;
Saravana Kannan298ec392012-02-08 19:21:47 -0800431
Matt Wagantall82feaa12012-07-09 10:54:49 -0700432 if (level == VDD_SR2_HDMI_PLL_OFF) {
Saravana Kannan298ec392012-02-08 19:21:47 -0800433 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
434 RPM_VREG_VOTER3, 0, 0, 1);
435 if (rc)
436 return rc;
437 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
438 RPM_VREG_VOTER3, 0, 0, 1);
439 if (rc)
440 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
441 RPM_VREG_VOTER3, 1800000, 1800000, 1);
Tianyi Goue1faaf22012-01-24 16:07:19 -0800442 } else {
Saravana Kannan298ec392012-02-08 19:21:47 -0800443 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
David Collins9a81d6c2012-03-29 15:11:33 -0700444 RPM_VREG_VOTER3, 2050000, 2100000, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800445 if (rc)
446 return rc;
447 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
448 RPM_VREG_VOTER3, 1800000, 1800000, 1);
449 if (rc)
450 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800451 RPM_VREG_VOTER3, 0, 0, 1);
Matt Wagantallc57577d2011-10-06 17:06:53 -0700452 }
453
454 return rc;
455}
456
Matt Wagantall82feaa12012-07-09 10:54:49 -0700457static DEFINE_VDD_CLASS(vdd_sr2_hdmi_pll, set_vdd_sr2_hdmi_pll_8960);
Saravana Kannan298ec392012-02-08 19:21:47 -0800458
459static int sr2_lreg_uv[] = {
Matt Wagantall82feaa12012-07-09 10:54:49 -0700460 [VDD_SR2_HDMI_PLL_OFF] = 0,
461 [VDD_SR2_HDMI_PLL_ON] = 1800000,
Saravana Kannan298ec392012-02-08 19:21:47 -0800462};
463
Matt Wagantall82feaa12012-07-09 10:54:49 -0700464static int set_vdd_sr2_hdmi_pll_8064(struct clk_vdd_class *vdd_class, int level)
Saravana Kannan298ec392012-02-08 19:21:47 -0800465{
466 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_LVS7, RPM_VREG_VOTER3,
467 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
468}
469
Matt Wagantall82feaa12012-07-09 10:54:49 -0700470static int set_vdd_sr2_hdmi_pll_8930(struct clk_vdd_class *vdd_class, int level)
Saravana Kannan298ec392012-02-08 19:21:47 -0800471{
472 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8038_L23, RPM_VREG_VOTER3,
473 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
474}
Matt Wagantallc57577d2011-10-06 17:06:53 -0700475
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700476/*
477 * Clock Descriptions
478 */
479
Stephen Boyd72a80352012-01-26 15:57:38 -0800480DEFINE_CLK_RPM_BRANCH(pxo_clk, pxo_a_clk, PXO, 27000000);
481DEFINE_CLK_RPM_BRANCH(cxo_clk, cxo_a_clk, CXO, 19200000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700482
483static struct pll_clk pll2_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700484 .mode_reg = MM_PLL1_MODE_REG,
485 .parent = &pxo_clk.c,
486 .c = {
487 .dbg_name = "pll2_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800488 .rate = 800000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800489 .ops = &clk_ops_local_pll,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700490 CLK_INIT(pll2_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800491 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700492 },
493};
494
Stephen Boyd94625ef2011-07-12 17:06:01 -0700495static struct pll_clk pll3_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700496 .mode_reg = BB_MMCC_PLL2_MODE_REG,
497 .parent = &pxo_clk.c,
498 .c = {
499 .dbg_name = "pll3_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800500 .rate = 1200000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800501 .ops = &clk_ops_local_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -0700502 .vdd_class = &vdd_sr2_hdmi_pll,
503 .fmax[VDD_SR2_HDMI_PLL_ON] = ULONG_MAX,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700504 CLK_INIT(pll3_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800505 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700506 },
507};
508
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700509static struct pll_vote_clk pll4_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700510 .en_reg = BB_PLL_ENA_SC0_REG,
511 .en_mask = BIT(4),
512 .status_reg = LCC_PLL0_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800513 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700514 .parent = &pxo_clk.c,
515 .c = {
516 .dbg_name = "pll4_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800517 .rate = 393216000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700518 .ops = &clk_ops_pll_vote,
519 CLK_INIT(pll4_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800520 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700521 },
522};
523
524static struct pll_vote_clk pll8_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700525 .en_reg = BB_PLL_ENA_SC0_REG,
526 .en_mask = BIT(8),
527 .status_reg = BB_PLL8_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800528 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700529 .parent = &pxo_clk.c,
530 .c = {
531 .dbg_name = "pll8_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800532 .rate = 384000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700533 .ops = &clk_ops_pll_vote,
534 CLK_INIT(pll8_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800535 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700536 },
537};
538
Stephen Boyd94625ef2011-07-12 17:06:01 -0700539static struct pll_vote_clk pll14_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700540 .en_reg = BB_PLL_ENA_SC0_REG,
541 .en_mask = BIT(14),
542 .status_reg = BB_PLL14_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800543 .status_mask = BIT(16),
Stephen Boyd94625ef2011-07-12 17:06:01 -0700544 .parent = &pxo_clk.c,
545 .c = {
546 .dbg_name = "pll14_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800547 .rate = 480000000,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700548 .ops = &clk_ops_pll_vote,
549 CLK_INIT(pll14_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800550 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700551 },
552};
553
Tianyi Gou41515e22011-09-01 19:37:43 -0700554static struct pll_clk pll15_clk = {
Tianyi Gou41515e22011-09-01 19:37:43 -0700555 .mode_reg = MM_PLL3_MODE_REG,
556 .parent = &pxo_clk.c,
557 .c = {
558 .dbg_name = "pll15_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800559 .rate = 975000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800560 .ops = &clk_ops_local_pll,
Tianyi Gou41515e22011-09-01 19:37:43 -0700561 CLK_INIT(pll15_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800562 .warned = true,
Tianyi Gou41515e22011-09-01 19:37:43 -0700563 },
564};
565
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700566/* AXI Interfaces */
567static struct branch_clk gmem_axi_clk = {
568 .b = {
569 .ctl_reg = MAXI_EN_REG,
570 .en_mask = BIT(24),
571 .halt_reg = DBG_BUS_VEC_E_REG,
572 .halt_bit = 6,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800573 .retain_reg = MAXI_EN2_REG,
574 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700575 },
576 .c = {
577 .dbg_name = "gmem_axi_clk",
578 .ops = &clk_ops_branch,
579 CLK_INIT(gmem_axi_clk.c),
580 },
581};
582
583static struct branch_clk ijpeg_axi_clk = {
584 .b = {
585 .ctl_reg = MAXI_EN_REG,
586 .en_mask = BIT(21),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800587 .hwcg_reg = MAXI_EN_REG,
588 .hwcg_mask = BIT(11),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700589 .reset_reg = SW_RESET_AXI_REG,
590 .reset_mask = BIT(14),
591 .halt_reg = DBG_BUS_VEC_E_REG,
592 .halt_bit = 4,
593 },
594 .c = {
595 .dbg_name = "ijpeg_axi_clk",
596 .ops = &clk_ops_branch,
597 CLK_INIT(ijpeg_axi_clk.c),
598 },
599};
600
601static struct branch_clk imem_axi_clk = {
602 .b = {
603 .ctl_reg = MAXI_EN_REG,
604 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800605 .hwcg_reg = MAXI_EN_REG,
606 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700607 .reset_reg = SW_RESET_CORE_REG,
608 .reset_mask = BIT(10),
609 .halt_reg = DBG_BUS_VEC_E_REG,
610 .halt_bit = 7,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800611 .retain_reg = MAXI_EN2_REG,
612 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700613 },
614 .c = {
615 .dbg_name = "imem_axi_clk",
616 .ops = &clk_ops_branch,
617 CLK_INIT(imem_axi_clk.c),
618 },
619};
620
621static struct branch_clk jpegd_axi_clk = {
622 .b = {
623 .ctl_reg = MAXI_EN_REG,
624 .en_mask = BIT(25),
625 .halt_reg = DBG_BUS_VEC_E_REG,
626 .halt_bit = 5,
627 },
628 .c = {
629 .dbg_name = "jpegd_axi_clk",
630 .ops = &clk_ops_branch,
631 CLK_INIT(jpegd_axi_clk.c),
632 },
633};
634
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700635static struct branch_clk vcodec_axi_b_clk = {
636 .b = {
637 .ctl_reg = MAXI_EN4_REG,
638 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800639 .hwcg_reg = MAXI_EN4_REG,
640 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700641 .halt_reg = DBG_BUS_VEC_I_REG,
642 .halt_bit = 25,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800643 .retain_reg = MAXI_EN4_REG,
644 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700645 },
646 .c = {
647 .dbg_name = "vcodec_axi_b_clk",
648 .ops = &clk_ops_branch,
649 CLK_INIT(vcodec_axi_b_clk.c),
650 },
651};
652
Matt Wagantall91f42702011-07-14 12:01:15 -0700653static struct branch_clk vcodec_axi_a_clk = {
654 .b = {
655 .ctl_reg = MAXI_EN4_REG,
656 .en_mask = BIT(25),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800657 .hwcg_reg = MAXI_EN4_REG,
658 .hwcg_mask = BIT(24),
Matt Wagantall91f42702011-07-14 12:01:15 -0700659 .halt_reg = DBG_BUS_VEC_I_REG,
660 .halt_bit = 26,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800661 .retain_reg = MAXI_EN4_REG,
662 .retain_mask = BIT(10),
Matt Wagantall91f42702011-07-14 12:01:15 -0700663 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700664 .c = {
665 .dbg_name = "vcodec_axi_a_clk",
666 .ops = &clk_ops_branch,
667 CLK_INIT(vcodec_axi_a_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700668 .depends = &vcodec_axi_b_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700669 },
670};
671
672static struct branch_clk vcodec_axi_clk = {
673 .b = {
674 .ctl_reg = MAXI_EN_REG,
675 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800676 .hwcg_reg = MAXI_EN_REG,
677 .hwcg_mask = BIT(13),
Matt Wagantall91f42702011-07-14 12:01:15 -0700678 .reset_reg = SW_RESET_AXI_REG,
Gopikrishnaiah Anandan83b6e852012-01-05 17:47:02 -0800679 .reset_mask = BIT(4)|BIT(5)|BIT(7),
Matt Wagantall91f42702011-07-14 12:01:15 -0700680 .halt_reg = DBG_BUS_VEC_E_REG,
681 .halt_bit = 3,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800682 .retain_reg = MAXI_EN2_REG,
683 .retain_mask = BIT(28),
Matt Wagantall91f42702011-07-14 12:01:15 -0700684 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700685 .c = {
686 .dbg_name = "vcodec_axi_clk",
687 .ops = &clk_ops_branch,
688 CLK_INIT(vcodec_axi_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700689 .depends = &vcodec_axi_a_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700690 },
691};
692
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700693static struct branch_clk vfe_axi_clk = {
694 .b = {
695 .ctl_reg = MAXI_EN_REG,
696 .en_mask = BIT(18),
697 .reset_reg = SW_RESET_AXI_REG,
698 .reset_mask = BIT(9),
699 .halt_reg = DBG_BUS_VEC_E_REG,
700 .halt_bit = 0,
701 },
702 .c = {
703 .dbg_name = "vfe_axi_clk",
704 .ops = &clk_ops_branch,
705 CLK_INIT(vfe_axi_clk.c),
706 },
707};
708
709static struct branch_clk mdp_axi_clk = {
710 .b = {
711 .ctl_reg = MAXI_EN_REG,
712 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800713 .hwcg_reg = MAXI_EN_REG,
714 .hwcg_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700715 .reset_reg = SW_RESET_AXI_REG,
716 .reset_mask = BIT(13),
717 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700718 .halt_bit = 8,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800719 .retain_reg = MAXI_EN_REG,
720 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700721 },
722 .c = {
723 .dbg_name = "mdp_axi_clk",
724 .ops = &clk_ops_branch,
725 CLK_INIT(mdp_axi_clk.c),
726 },
727};
728
729static struct branch_clk rot_axi_clk = {
730 .b = {
731 .ctl_reg = MAXI_EN2_REG,
732 .en_mask = BIT(24),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800733 .hwcg_reg = MAXI_EN2_REG,
734 .hwcg_mask = BIT(25),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700735 .reset_reg = SW_RESET_AXI_REG,
736 .reset_mask = BIT(6),
737 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700738 .halt_bit = 2,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800739 .retain_reg = MAXI_EN3_REG,
740 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700741 },
742 .c = {
743 .dbg_name = "rot_axi_clk",
744 .ops = &clk_ops_branch,
745 CLK_INIT(rot_axi_clk.c),
746 },
747};
748
749static struct branch_clk vpe_axi_clk = {
750 .b = {
751 .ctl_reg = MAXI_EN2_REG,
752 .en_mask = BIT(26),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800753 .hwcg_reg = MAXI_EN2_REG,
754 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700755 .reset_reg = SW_RESET_AXI_REG,
756 .reset_mask = BIT(15),
757 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700758 .halt_bit = 1,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800759 .retain_reg = MAXI_EN3_REG,
760 .retain_mask = BIT(21),
761
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700762 },
763 .c = {
764 .dbg_name = "vpe_axi_clk",
765 .ops = &clk_ops_branch,
766 CLK_INIT(vpe_axi_clk.c),
767 },
768};
769
Tianyi Gou41515e22011-09-01 19:37:43 -0700770static struct branch_clk vcap_axi_clk = {
771 .b = {
772 .ctl_reg = MAXI_EN5_REG,
773 .en_mask = BIT(12),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700774 .hwcg_reg = MAXI_EN5_REG,
775 .hwcg_mask = BIT(11),
Tianyi Gou41515e22011-09-01 19:37:43 -0700776 .reset_reg = SW_RESET_AXI_REG,
777 .reset_mask = BIT(16),
778 .halt_reg = DBG_BUS_VEC_J_REG,
779 .halt_bit = 20,
780 },
781 .c = {
782 .dbg_name = "vcap_axi_clk",
783 .ops = &clk_ops_branch,
784 CLK_INIT(vcap_axi_clk.c),
785 },
786};
787
Tianyi Goue3d4f542012-03-15 17:06:45 -0700788/* gfx3d_axi_clk is set as a dependency of gmem_axi_clk at runtime */
Patrick Dalye6f489042012-07-11 15:29:15 -0700789static struct branch_clk gfx3d_axi_clk = {
Tianyi Gou621f8742011-09-01 21:45:01 -0700790 .b = {
791 .ctl_reg = MAXI_EN5_REG,
792 .en_mask = BIT(25),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700793 .hwcg_reg = MAXI_EN5_REG,
794 .hwcg_mask = BIT(24),
Tianyi Gou621f8742011-09-01 21:45:01 -0700795 .reset_reg = SW_RESET_AXI_REG,
796 .reset_mask = BIT(17),
797 .halt_reg = DBG_BUS_VEC_J_REG,
798 .halt_bit = 30,
799 },
800 .c = {
801 .dbg_name = "gfx3d_axi_clk",
802 .ops = &clk_ops_branch,
Patrick Dalye6f489042012-07-11 15:29:15 -0700803 CLK_INIT(gfx3d_axi_clk.c),
Tianyi Goue3d4f542012-03-15 17:06:45 -0700804 },
805};
806
807static struct branch_clk gfx3d_axi_clk_8930 = {
808 .b = {
809 .ctl_reg = MAXI_EN5_REG,
810 .en_mask = BIT(12),
811 .reset_reg = SW_RESET_AXI_REG,
812 .reset_mask = BIT(16),
813 .halt_reg = DBG_BUS_VEC_J_REG,
814 .halt_bit = 12,
815 },
816 .c = {
817 .dbg_name = "gfx3d_axi_clk",
818 .ops = &clk_ops_branch,
819 CLK_INIT(gfx3d_axi_clk_8930.c),
Tianyi Gou621f8742011-09-01 21:45:01 -0700820 },
821};
822
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700823/* AHB Interfaces */
824static struct branch_clk amp_p_clk = {
825 .b = {
826 .ctl_reg = AHB_EN_REG,
827 .en_mask = BIT(24),
Matt Wagantalld40857a2012-04-10 19:15:43 -0700828 .reset_reg = SW_RESET_CORE_REG,
829 .reset_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700830 .halt_reg = DBG_BUS_VEC_F_REG,
831 .halt_bit = 18,
832 },
833 .c = {
834 .dbg_name = "amp_p_clk",
835 .ops = &clk_ops_branch,
836 CLK_INIT(amp_p_clk.c),
837 },
838};
839
Matt Wagantallc23eee92011-08-16 23:06:52 -0700840static struct branch_clk csi_p_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700841 .b = {
842 .ctl_reg = AHB_EN_REG,
843 .en_mask = BIT(7),
844 .reset_reg = SW_RESET_AHB_REG,
845 .reset_mask = BIT(17),
846 .halt_reg = DBG_BUS_VEC_F_REG,
847 .halt_bit = 16,
848 },
849 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -0700850 .dbg_name = "csi_p_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700851 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -0700852 CLK_INIT(csi_p_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700853 },
854};
855
856static struct branch_clk dsi1_m_p_clk = {
857 .b = {
858 .ctl_reg = AHB_EN_REG,
859 .en_mask = BIT(9),
860 .reset_reg = SW_RESET_AHB_REG,
861 .reset_mask = BIT(6),
862 .halt_reg = DBG_BUS_VEC_F_REG,
863 .halt_bit = 19,
864 },
865 .c = {
866 .dbg_name = "dsi1_m_p_clk",
867 .ops = &clk_ops_branch,
868 CLK_INIT(dsi1_m_p_clk.c),
869 },
870};
871
872static struct branch_clk dsi1_s_p_clk = {
873 .b = {
874 .ctl_reg = AHB_EN_REG,
875 .en_mask = BIT(18),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800876 .hwcg_reg = AHB_EN2_REG,
877 .hwcg_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700878 .reset_reg = SW_RESET_AHB_REG,
879 .reset_mask = BIT(5),
880 .halt_reg = DBG_BUS_VEC_F_REG,
881 .halt_bit = 21,
882 },
883 .c = {
884 .dbg_name = "dsi1_s_p_clk",
885 .ops = &clk_ops_branch,
886 CLK_INIT(dsi1_s_p_clk.c),
887 },
888};
889
890static struct branch_clk dsi2_m_p_clk = {
891 .b = {
892 .ctl_reg = AHB_EN_REG,
893 .en_mask = BIT(17),
894 .reset_reg = SW_RESET_AHB2_REG,
895 .reset_mask = BIT(1),
896 .halt_reg = DBG_BUS_VEC_E_REG,
897 .halt_bit = 18,
898 },
899 .c = {
900 .dbg_name = "dsi2_m_p_clk",
901 .ops = &clk_ops_branch,
902 CLK_INIT(dsi2_m_p_clk.c),
903 },
904};
905
906static struct branch_clk dsi2_s_p_clk = {
907 .b = {
908 .ctl_reg = AHB_EN_REG,
909 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800910 .hwcg_reg = AHB_EN2_REG,
911 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700912 .reset_reg = SW_RESET_AHB2_REG,
913 .reset_mask = BIT(0),
914 .halt_reg = DBG_BUS_VEC_F_REG,
915 .halt_bit = 20,
916 },
917 .c = {
918 .dbg_name = "dsi2_s_p_clk",
919 .ops = &clk_ops_branch,
920 CLK_INIT(dsi2_s_p_clk.c),
921 },
922};
923
924static struct branch_clk gfx2d0_p_clk = {
925 .b = {
926 .ctl_reg = AHB_EN_REG,
927 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800928 .hwcg_reg = AHB_EN2_REG,
929 .hwcg_mask = BIT(28),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700930 .reset_reg = SW_RESET_AHB_REG,
931 .reset_mask = BIT(12),
932 .halt_reg = DBG_BUS_VEC_F_REG,
933 .halt_bit = 2,
934 },
935 .c = {
936 .dbg_name = "gfx2d0_p_clk",
937 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700938 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700939 CLK_INIT(gfx2d0_p_clk.c),
940 },
941};
942
943static struct branch_clk gfx2d1_p_clk = {
944 .b = {
945 .ctl_reg = AHB_EN_REG,
946 .en_mask = BIT(2),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800947 .hwcg_reg = AHB_EN2_REG,
948 .hwcg_mask = BIT(29),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700949 .reset_reg = SW_RESET_AHB_REG,
950 .reset_mask = BIT(11),
951 .halt_reg = DBG_BUS_VEC_F_REG,
952 .halt_bit = 3,
953 },
954 .c = {
955 .dbg_name = "gfx2d1_p_clk",
956 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700957 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700958 CLK_INIT(gfx2d1_p_clk.c),
959 },
960};
961
962static struct branch_clk gfx3d_p_clk = {
963 .b = {
964 .ctl_reg = AHB_EN_REG,
965 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800966 .hwcg_reg = AHB_EN2_REG,
967 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700968 .reset_reg = SW_RESET_AHB_REG,
969 .reset_mask = BIT(10),
970 .halt_reg = DBG_BUS_VEC_F_REG,
971 .halt_bit = 4,
972 },
973 .c = {
974 .dbg_name = "gfx3d_p_clk",
975 .ops = &clk_ops_branch,
976 CLK_INIT(gfx3d_p_clk.c),
977 },
978};
979
980static struct branch_clk hdmi_m_p_clk = {
981 .b = {
982 .ctl_reg = AHB_EN_REG,
983 .en_mask = BIT(14),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800984 .hwcg_reg = AHB_EN2_REG,
985 .hwcg_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700986 .reset_reg = SW_RESET_AHB_REG,
987 .reset_mask = BIT(9),
988 .halt_reg = DBG_BUS_VEC_F_REG,
989 .halt_bit = 5,
990 },
991 .c = {
992 .dbg_name = "hdmi_m_p_clk",
993 .ops = &clk_ops_branch,
994 CLK_INIT(hdmi_m_p_clk.c),
995 },
996};
997
998static struct branch_clk hdmi_s_p_clk = {
999 .b = {
1000 .ctl_reg = AHB_EN_REG,
1001 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001002 .hwcg_reg = AHB_EN2_REG,
1003 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001004 .reset_reg = SW_RESET_AHB_REG,
1005 .reset_mask = BIT(9),
1006 .halt_reg = DBG_BUS_VEC_F_REG,
1007 .halt_bit = 6,
1008 },
1009 .c = {
1010 .dbg_name = "hdmi_s_p_clk",
1011 .ops = &clk_ops_branch,
1012 CLK_INIT(hdmi_s_p_clk.c),
1013 },
1014};
1015
1016static struct branch_clk ijpeg_p_clk = {
1017 .b = {
1018 .ctl_reg = AHB_EN_REG,
1019 .en_mask = BIT(5),
1020 .reset_reg = SW_RESET_AHB_REG,
1021 .reset_mask = BIT(7),
1022 .halt_reg = DBG_BUS_VEC_F_REG,
1023 .halt_bit = 9,
1024 },
1025 .c = {
1026 .dbg_name = "ijpeg_p_clk",
1027 .ops = &clk_ops_branch,
1028 CLK_INIT(ijpeg_p_clk.c),
1029 },
1030};
1031
1032static struct branch_clk imem_p_clk = {
1033 .b = {
1034 .ctl_reg = AHB_EN_REG,
1035 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001036 .hwcg_reg = AHB_EN2_REG,
1037 .hwcg_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001038 .reset_reg = SW_RESET_AHB_REG,
1039 .reset_mask = BIT(8),
1040 .halt_reg = DBG_BUS_VEC_F_REG,
1041 .halt_bit = 10,
1042 },
1043 .c = {
1044 .dbg_name = "imem_p_clk",
1045 .ops = &clk_ops_branch,
1046 CLK_INIT(imem_p_clk.c),
1047 },
1048};
1049
1050static struct branch_clk jpegd_p_clk = {
1051 .b = {
1052 .ctl_reg = AHB_EN_REG,
1053 .en_mask = BIT(21),
1054 .reset_reg = SW_RESET_AHB_REG,
1055 .reset_mask = BIT(4),
1056 .halt_reg = DBG_BUS_VEC_F_REG,
1057 .halt_bit = 7,
1058 },
1059 .c = {
1060 .dbg_name = "jpegd_p_clk",
1061 .ops = &clk_ops_branch,
1062 CLK_INIT(jpegd_p_clk.c),
1063 },
1064};
1065
1066static struct branch_clk mdp_p_clk = {
1067 .b = {
1068 .ctl_reg = AHB_EN_REG,
1069 .en_mask = BIT(10),
1070 .reset_reg = SW_RESET_AHB_REG,
1071 .reset_mask = BIT(3),
1072 .halt_reg = DBG_BUS_VEC_F_REG,
1073 .halt_bit = 11,
1074 },
1075 .c = {
1076 .dbg_name = "mdp_p_clk",
1077 .ops = &clk_ops_branch,
1078 CLK_INIT(mdp_p_clk.c),
1079 },
1080};
1081
1082static struct branch_clk rot_p_clk = {
1083 .b = {
1084 .ctl_reg = AHB_EN_REG,
1085 .en_mask = BIT(12),
1086 .reset_reg = SW_RESET_AHB_REG,
1087 .reset_mask = BIT(2),
1088 .halt_reg = DBG_BUS_VEC_F_REG,
1089 .halt_bit = 13,
1090 },
1091 .c = {
1092 .dbg_name = "rot_p_clk",
1093 .ops = &clk_ops_branch,
1094 CLK_INIT(rot_p_clk.c),
1095 },
1096};
1097
1098static struct branch_clk smmu_p_clk = {
1099 .b = {
1100 .ctl_reg = AHB_EN_REG,
1101 .en_mask = BIT(15),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001102 .hwcg_reg = AHB_EN_REG,
1103 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001104 .halt_reg = DBG_BUS_VEC_F_REG,
1105 .halt_bit = 22,
1106 },
1107 .c = {
1108 .dbg_name = "smmu_p_clk",
1109 .ops = &clk_ops_branch,
1110 CLK_INIT(smmu_p_clk.c),
1111 },
1112};
1113
1114static struct branch_clk tv_enc_p_clk = {
1115 .b = {
1116 .ctl_reg = AHB_EN_REG,
1117 .en_mask = BIT(25),
1118 .reset_reg = SW_RESET_AHB_REG,
1119 .reset_mask = BIT(15),
1120 .halt_reg = DBG_BUS_VEC_F_REG,
1121 .halt_bit = 23,
1122 },
1123 .c = {
1124 .dbg_name = "tv_enc_p_clk",
1125 .ops = &clk_ops_branch,
1126 CLK_INIT(tv_enc_p_clk.c),
1127 },
1128};
1129
1130static struct branch_clk vcodec_p_clk = {
1131 .b = {
1132 .ctl_reg = AHB_EN_REG,
1133 .en_mask = BIT(11),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001134 .hwcg_reg = AHB_EN2_REG,
1135 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001136 .reset_reg = SW_RESET_AHB_REG,
1137 .reset_mask = BIT(1),
1138 .halt_reg = DBG_BUS_VEC_F_REG,
1139 .halt_bit = 12,
1140 },
1141 .c = {
1142 .dbg_name = "vcodec_p_clk",
1143 .ops = &clk_ops_branch,
1144 CLK_INIT(vcodec_p_clk.c),
1145 },
1146};
1147
1148static struct branch_clk vfe_p_clk = {
1149 .b = {
1150 .ctl_reg = AHB_EN_REG,
1151 .en_mask = BIT(13),
1152 .reset_reg = SW_RESET_AHB_REG,
1153 .reset_mask = BIT(0),
1154 .halt_reg = DBG_BUS_VEC_F_REG,
1155 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08001156 .retain_reg = AHB_EN2_REG,
1157 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001158 },
1159 .c = {
1160 .dbg_name = "vfe_p_clk",
1161 .ops = &clk_ops_branch,
1162 CLK_INIT(vfe_p_clk.c),
1163 },
1164};
1165
1166static struct branch_clk vpe_p_clk = {
1167 .b = {
1168 .ctl_reg = AHB_EN_REG,
1169 .en_mask = BIT(16),
1170 .reset_reg = SW_RESET_AHB_REG,
1171 .reset_mask = BIT(14),
1172 .halt_reg = DBG_BUS_VEC_F_REG,
1173 .halt_bit = 15,
1174 },
1175 .c = {
1176 .dbg_name = "vpe_p_clk",
1177 .ops = &clk_ops_branch,
1178 CLK_INIT(vpe_p_clk.c),
1179 },
1180};
1181
Tianyi Gou41515e22011-09-01 19:37:43 -07001182static struct branch_clk vcap_p_clk = {
1183 .b = {
1184 .ctl_reg = AHB_EN3_REG,
1185 .en_mask = BIT(1),
Tianyi Gouf3095ea2012-05-22 14:16:06 -07001186 .hwcg_reg = AHB_EN3_REG,
1187 .hwcg_mask = BIT(0),
Tianyi Gou41515e22011-09-01 19:37:43 -07001188 .reset_reg = SW_RESET_AHB2_REG,
1189 .reset_mask = BIT(2),
1190 .halt_reg = DBG_BUS_VEC_J_REG,
1191 .halt_bit = 23,
1192 },
1193 .c = {
1194 .dbg_name = "vcap_p_clk",
1195 .ops = &clk_ops_branch,
1196 CLK_INIT(vcap_p_clk.c),
1197 },
1198};
1199
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001200/*
1201 * Peripheral Clocks
1202 */
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001203#define CLK_GP(i, n, h_r, h_b) \
1204 struct rcg_clk i##_clk = { \
1205 .b = { \
1206 .ctl_reg = GPn_NS_REG(n), \
1207 .en_mask = BIT(9), \
1208 .halt_reg = h_r, \
1209 .halt_bit = h_b, \
1210 }, \
1211 .ns_reg = GPn_NS_REG(n), \
1212 .md_reg = GPn_MD_REG(n), \
1213 .root_en_mask = BIT(11), \
1214 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001215 .mnd_en_mask = BIT(8), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001216 .set_rate = set_rate_mnd, \
1217 .freq_tbl = clk_tbl_gp, \
1218 .current_freq = &rcg_dummy_freq, \
1219 .c = { \
1220 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001221 .ops = &clk_ops_rcg, \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001222 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), \
1223 CLK_INIT(i##_clk.c), \
1224 }, \
1225 }
1226#define F_GP(f, s, d, m, n) \
1227 { \
1228 .freq_hz = f, \
1229 .src_clk = &s##_clk.c, \
1230 .md_val = MD8(16, m, 0, n), \
1231 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001232 }
1233static struct clk_freq_tbl clk_tbl_gp[] = {
1234 F_GP( 0, gnd, 1, 0, 0),
1235 F_GP( 9600000, cxo, 2, 0, 0),
1236 F_GP( 13500000, pxo, 2, 0, 0),
1237 F_GP( 19200000, cxo, 1, 0, 0),
1238 F_GP( 27000000, pxo, 1, 0, 0),
1239 F_GP( 64000000, pll8, 2, 1, 3),
1240 F_GP( 76800000, pll8, 1, 1, 5),
1241 F_GP( 96000000, pll8, 4, 0, 0),
1242 F_GP(128000000, pll8, 3, 0, 0),
1243 F_GP(192000000, pll8, 2, 0, 0),
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001244 F_END
1245};
1246
1247static CLK_GP(gp0, 0, CLK_HALT_SFPB_MISC_STATE_REG, 7);
1248static CLK_GP(gp1, 1, CLK_HALT_SFPB_MISC_STATE_REG, 6);
1249static CLK_GP(gp2, 2, CLK_HALT_SFPB_MISC_STATE_REG, 5);
1250
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001251#define CLK_GSBI_UART(i, n, h_r, h_b) \
1252 struct rcg_clk i##_clk = { \
1253 .b = { \
1254 .ctl_reg = GSBIn_UART_APPS_NS_REG(n), \
1255 .en_mask = BIT(9), \
1256 .reset_reg = GSBIn_RESET_REG(n), \
1257 .reset_mask = BIT(0), \
1258 .halt_reg = h_r, \
1259 .halt_bit = h_b, \
1260 }, \
1261 .ns_reg = GSBIn_UART_APPS_NS_REG(n), \
1262 .md_reg = GSBIn_UART_APPS_MD_REG(n), \
1263 .root_en_mask = BIT(11), \
1264 .ns_mask = (BM(31, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001265 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001266 .set_rate = set_rate_mnd, \
1267 .freq_tbl = clk_tbl_gsbi_uart, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001268 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001269 .c = { \
1270 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001271 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001272 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001273 CLK_INIT(i##_clk.c), \
1274 }, \
1275 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001276#define F_GSBI_UART(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001277 { \
1278 .freq_hz = f, \
1279 .src_clk = &s##_clk.c, \
1280 .md_val = MD16(m, n), \
1281 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001282 }
1283static struct clk_freq_tbl clk_tbl_gsbi_uart[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001284 F_GSBI_UART( 0, gnd, 1, 0, 0),
Matt Wagantall9a561f72012-01-19 16:13:12 -08001285 F_GSBI_UART( 1843200, pll8, 2, 6, 625),
1286 F_GSBI_UART( 3686400, pll8, 2, 12, 625),
1287 F_GSBI_UART( 7372800, pll8, 2, 24, 625),
1288 F_GSBI_UART(14745600, pll8, 2, 48, 625),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001289 F_GSBI_UART(16000000, pll8, 4, 1, 6),
1290 F_GSBI_UART(24000000, pll8, 4, 1, 4),
1291 F_GSBI_UART(32000000, pll8, 4, 1, 3),
1292 F_GSBI_UART(40000000, pll8, 1, 5, 48),
1293 F_GSBI_UART(46400000, pll8, 1, 29, 240),
1294 F_GSBI_UART(48000000, pll8, 4, 1, 2),
1295 F_GSBI_UART(51200000, pll8, 1, 2, 15),
1296 F_GSBI_UART(56000000, pll8, 1, 7, 48),
1297 F_GSBI_UART(58982400, pll8, 1, 96, 625),
1298 F_GSBI_UART(64000000, pll8, 2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001299 F_END
1300};
1301
1302static CLK_GSBI_UART(gsbi1_uart, 1, CLK_HALT_CFPB_STATEA_REG, 10);
1303static CLK_GSBI_UART(gsbi2_uart, 2, CLK_HALT_CFPB_STATEA_REG, 6);
1304static CLK_GSBI_UART(gsbi3_uart, 3, CLK_HALT_CFPB_STATEA_REG, 2);
1305static CLK_GSBI_UART(gsbi4_uart, 4, CLK_HALT_CFPB_STATEB_REG, 26);
1306static CLK_GSBI_UART(gsbi5_uart, 5, CLK_HALT_CFPB_STATEB_REG, 22);
1307static CLK_GSBI_UART(gsbi6_uart, 6, CLK_HALT_CFPB_STATEB_REG, 18);
1308static CLK_GSBI_UART(gsbi7_uart, 7, CLK_HALT_CFPB_STATEB_REG, 14);
1309static CLK_GSBI_UART(gsbi8_uart, 8, CLK_HALT_CFPB_STATEB_REG, 10);
1310static CLK_GSBI_UART(gsbi9_uart, 9, CLK_HALT_CFPB_STATEB_REG, 6);
1311static CLK_GSBI_UART(gsbi10_uart, 10, CLK_HALT_CFPB_STATEB_REG, 2);
1312static CLK_GSBI_UART(gsbi11_uart, 11, CLK_HALT_CFPB_STATEC_REG, 17);
1313static CLK_GSBI_UART(gsbi12_uart, 12, CLK_HALT_CFPB_STATEC_REG, 13);
1314
1315#define CLK_GSBI_QUP(i, n, h_r, h_b) \
1316 struct rcg_clk i##_clk = { \
1317 .b = { \
1318 .ctl_reg = GSBIn_QUP_APPS_NS_REG(n), \
1319 .en_mask = BIT(9), \
1320 .reset_reg = GSBIn_RESET_REG(n), \
1321 .reset_mask = BIT(0), \
1322 .halt_reg = h_r, \
1323 .halt_bit = h_b, \
1324 }, \
1325 .ns_reg = GSBIn_QUP_APPS_NS_REG(n), \
1326 .md_reg = GSBIn_QUP_APPS_MD_REG(n), \
1327 .root_en_mask = BIT(11), \
1328 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001329 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001330 .set_rate = set_rate_mnd, \
1331 .freq_tbl = clk_tbl_gsbi_qup, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001332 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001333 .c = { \
1334 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001335 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001336 VDD_DIG_FMAX_MAP2(LOW, 24000000, NOMINAL, 52000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001337 CLK_INIT(i##_clk.c), \
1338 }, \
1339 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001340#define F_GSBI_QUP(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001341 { \
1342 .freq_hz = f, \
1343 .src_clk = &s##_clk.c, \
1344 .md_val = MD8(16, m, 0, n), \
1345 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001346 }
1347static struct clk_freq_tbl clk_tbl_gsbi_qup[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001348 F_GSBI_QUP( 0, gnd, 1, 0, 0),
1349 F_GSBI_QUP( 1100000, pxo, 1, 2, 49),
1350 F_GSBI_QUP( 5400000, pxo, 1, 1, 5),
1351 F_GSBI_QUP(10800000, pxo, 1, 2, 5),
1352 F_GSBI_QUP(15060000, pll8, 1, 2, 51),
1353 F_GSBI_QUP(24000000, pll8, 4, 1, 4),
1354 F_GSBI_QUP(25600000, pll8, 1, 1, 15),
1355 F_GSBI_QUP(27000000, pxo, 1, 0, 0),
1356 F_GSBI_QUP(48000000, pll8, 4, 1, 2),
1357 F_GSBI_QUP(51200000, pll8, 1, 2, 15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001358 F_END
1359};
1360
1361static CLK_GSBI_QUP(gsbi1_qup, 1, CLK_HALT_CFPB_STATEA_REG, 9);
1362static CLK_GSBI_QUP(gsbi2_qup, 2, CLK_HALT_CFPB_STATEA_REG, 4);
1363static CLK_GSBI_QUP(gsbi3_qup, 3, CLK_HALT_CFPB_STATEA_REG, 0);
1364static CLK_GSBI_QUP(gsbi4_qup, 4, CLK_HALT_CFPB_STATEB_REG, 24);
1365static CLK_GSBI_QUP(gsbi5_qup, 5, CLK_HALT_CFPB_STATEB_REG, 20);
1366static CLK_GSBI_QUP(gsbi6_qup, 6, CLK_HALT_CFPB_STATEB_REG, 16);
1367static CLK_GSBI_QUP(gsbi7_qup, 7, CLK_HALT_CFPB_STATEB_REG, 12);
1368static CLK_GSBI_QUP(gsbi8_qup, 8, CLK_HALT_CFPB_STATEB_REG, 8);
1369static CLK_GSBI_QUP(gsbi9_qup, 9, CLK_HALT_CFPB_STATEB_REG, 4);
1370static CLK_GSBI_QUP(gsbi10_qup, 10, CLK_HALT_CFPB_STATEB_REG, 0);
1371static CLK_GSBI_QUP(gsbi11_qup, 11, CLK_HALT_CFPB_STATEC_REG, 15);
1372static CLK_GSBI_QUP(gsbi12_qup, 12, CLK_HALT_CFPB_STATEC_REG, 11);
1373
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001374#define F_PDM(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001375 { \
1376 .freq_hz = f, \
1377 .src_clk = &s##_clk.c, \
1378 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001379 }
1380static struct clk_freq_tbl clk_tbl_pdm[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001381 F_PDM( 0, gnd, 1),
1382 F_PDM(27000000, pxo, 1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001383 F_END
1384};
1385
1386static struct rcg_clk pdm_clk = {
1387 .b = {
1388 .ctl_reg = PDM_CLK_NS_REG,
1389 .en_mask = BIT(9),
1390 .reset_reg = PDM_CLK_NS_REG,
1391 .reset_mask = BIT(12),
1392 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1393 .halt_bit = 3,
1394 },
1395 .ns_reg = PDM_CLK_NS_REG,
1396 .root_en_mask = BIT(11),
1397 .ns_mask = BM(1, 0),
1398 .set_rate = set_rate_nop,
1399 .freq_tbl = clk_tbl_pdm,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001400 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001401 .c = {
1402 .dbg_name = "pdm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001403 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001404 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001405 CLK_INIT(pdm_clk.c),
1406 },
1407};
1408
1409static struct branch_clk pmem_clk = {
1410 .b = {
1411 .ctl_reg = PMEM_ACLK_CTL_REG,
1412 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001413 .hwcg_reg = PMEM_ACLK_CTL_REG,
1414 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001415 .halt_reg = CLK_HALT_DFAB_STATE_REG,
1416 .halt_bit = 20,
1417 },
1418 .c = {
1419 .dbg_name = "pmem_clk",
1420 .ops = &clk_ops_branch,
1421 CLK_INIT(pmem_clk.c),
1422 },
1423};
1424
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001425#define F_PRNG(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001426 { \
1427 .freq_hz = f, \
1428 .src_clk = &s##_clk.c, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001429 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07001430static struct clk_freq_tbl clk_tbl_prng_32[] = {
1431 F_PRNG(32000000, pll8),
1432 F_END
1433};
1434
1435static struct clk_freq_tbl clk_tbl_prng_64[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001436 F_PRNG(64000000, pll8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001437 F_END
1438};
1439
1440static struct rcg_clk prng_clk = {
1441 .b = {
1442 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
1443 .en_mask = BIT(10),
1444 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
1445 .halt_check = HALT_VOTED,
1446 .halt_bit = 10,
1447 },
1448 .set_rate = set_rate_nop,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001449 .freq_tbl = clk_tbl_prng_32,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001450 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001451 .c = {
1452 .dbg_name = "prng_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001453 .ops = &clk_ops_rcg,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001454 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455 CLK_INIT(prng_clk.c),
1456 },
1457};
1458
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001459#define CLK_SDC(name, n, h_b, fmax_low, fmax_nom) \
Stephen Boyda78a7402011-08-02 11:23:39 -07001460 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001461 .b = { \
1462 .ctl_reg = SDCn_APPS_CLK_NS_REG(n), \
1463 .en_mask = BIT(9), \
1464 .reset_reg = SDCn_RESET_REG(n), \
1465 .reset_mask = BIT(0), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001466 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001467 .halt_bit = h_b, \
1468 }, \
1469 .ns_reg = SDCn_APPS_CLK_NS_REG(n), \
1470 .md_reg = SDCn_APPS_CLK_MD_REG(n), \
1471 .root_en_mask = BIT(11), \
1472 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001473 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001474 .set_rate = set_rate_mnd, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001475 .freq_tbl = clk_tbl_sdc, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001476 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001477 .c = { \
Stephen Boyda78a7402011-08-02 11:23:39 -07001478 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001479 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001480 VDD_DIG_FMAX_MAP2(LOW, fmax_low, NOMINAL, fmax_nom), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001481 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001482 }, \
1483 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001484#define F_SDC(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001485 { \
1486 .freq_hz = f, \
1487 .src_clk = &s##_clk.c, \
1488 .md_val = MD8(16, m, 0, n), \
1489 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001490 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001491static struct clk_freq_tbl clk_tbl_sdc[] = {
1492 F_SDC( 0, gnd, 1, 0, 0),
1493 F_SDC( 144000, pxo, 3, 2, 125),
1494 F_SDC( 400000, pll8, 4, 1, 240),
1495 F_SDC( 16000000, pll8, 4, 1, 6),
1496 F_SDC( 17070000, pll8, 1, 2, 45),
1497 F_SDC( 20210000, pll8, 1, 1, 19),
1498 F_SDC( 24000000, pll8, 4, 1, 4),
1499 F_SDC( 48000000, pll8, 4, 1, 2),
1500 F_SDC( 64000000, pll8, 3, 1, 2),
1501 F_SDC( 96000000, pll8, 4, 0, 0),
Subhash Jadavanibd238ba2011-11-24 15:12:39 +05301502 F_SDC(192000000, pll8, 2, 0, 0),
Stephen Boyda78a7402011-08-02 11:23:39 -07001503 F_END
1504};
1505
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001506static CLK_SDC(sdc1_clk, 1, 6, 52000000, 104000000);
1507static CLK_SDC(sdc2_clk, 2, 5, 52000000, 104000000);
1508static CLK_SDC(sdc3_clk, 3, 4, 104000000, 208000000);
1509static CLK_SDC(sdc4_clk, 4, 3, 33000000, 67000000);
1510static CLK_SDC(sdc5_clk, 5, 2, 33000000, 67000000);
Stephen Boyda78a7402011-08-02 11:23:39 -07001511
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001512#define F_TSIF_REF(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001513 { \
1514 .freq_hz = f, \
1515 .src_clk = &s##_clk.c, \
1516 .md_val = MD16(m, n), \
1517 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001518 }
1519static struct clk_freq_tbl clk_tbl_tsif_ref[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001520 F_TSIF_REF( 0, gnd, 1, 0, 0),
1521 F_TSIF_REF(105000, pxo, 1, 1, 256),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001522 F_END
1523};
1524
1525static struct rcg_clk tsif_ref_clk = {
1526 .b = {
1527 .ctl_reg = TSIF_REF_CLK_NS_REG,
1528 .en_mask = BIT(9),
1529 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1530 .halt_bit = 5,
1531 },
1532 .ns_reg = TSIF_REF_CLK_NS_REG,
1533 .md_reg = TSIF_REF_CLK_MD_REG,
1534 .root_en_mask = BIT(11),
1535 .ns_mask = (BM(31, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001536 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001537 .set_rate = set_rate_mnd,
1538 .freq_tbl = clk_tbl_tsif_ref,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001539 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001540 .c = {
1541 .dbg_name = "tsif_ref_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001542 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001543 VDD_DIG_FMAX_MAP2(LOW, 27000000, NOMINAL, 54000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001544 CLK_INIT(tsif_ref_clk.c),
1545 },
1546};
1547
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001548#define F_TSSC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001549 { \
1550 .freq_hz = f, \
1551 .src_clk = &s##_clk.c, \
1552 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001553 }
1554static struct clk_freq_tbl clk_tbl_tssc[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001555 F_TSSC( 0, gnd),
1556 F_TSSC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001557 F_END
1558};
1559
1560static struct rcg_clk tssc_clk = {
1561 .b = {
1562 .ctl_reg = TSSC_CLK_CTL_REG,
1563 .en_mask = BIT(4),
1564 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1565 .halt_bit = 4,
1566 },
1567 .ns_reg = TSSC_CLK_CTL_REG,
1568 .ns_mask = BM(1, 0),
1569 .set_rate = set_rate_nop,
1570 .freq_tbl = clk_tbl_tssc,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001571 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001572 .c = {
1573 .dbg_name = "tssc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001574 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001575 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001576 CLK_INIT(tssc_clk.c),
1577 },
1578};
1579
Tianyi Gou41515e22011-09-01 19:37:43 -07001580#define CLK_USB_HS(name, n, h_b) \
1581 static struct rcg_clk name = { \
1582 .b = { \
1583 .ctl_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1584 .en_mask = BIT(9), \
1585 .reset_reg = USB_HS##n##_RESET_REG, \
1586 .reset_mask = BIT(0), \
1587 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
1588 .halt_bit = h_b, \
1589 }, \
1590 .ns_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1591 .md_reg = USB_HS##n##_XCVR_FS_CLK_MD_REG, \
1592 .root_en_mask = BIT(11), \
1593 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001594 .mnd_en_mask = BIT(8), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001595 .set_rate = set_rate_mnd, \
1596 .freq_tbl = clk_tbl_usb, \
1597 .current_freq = &rcg_dummy_freq, \
1598 .c = { \
1599 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001600 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001601 VDD_DIG_FMAX_MAP1(NOMINAL, 64000000), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001602 CLK_INIT(name.c), \
1603 }, \
1604}
1605
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001606#define F_USB(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001607 { \
1608 .freq_hz = f, \
1609 .src_clk = &s##_clk.c, \
1610 .md_val = MD8(16, m, 0, n), \
1611 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001612 }
1613static struct clk_freq_tbl clk_tbl_usb[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001614 F_USB( 0, gnd, 1, 0, 0),
1615 F_USB(60000000, pll8, 1, 5, 32),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001616 F_END
1617};
1618
Tianyi Gou41515e22011-09-01 19:37:43 -07001619CLK_USB_HS(usb_hs1_xcvr_clk, 1, 0);
1620CLK_USB_HS(usb_hs3_xcvr_clk, 3, 30);
1621CLK_USB_HS(usb_hs4_xcvr_clk, 4, 2);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001622
Stephen Boyd94625ef2011-07-12 17:06:01 -07001623static struct clk_freq_tbl clk_tbl_usb_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001624 F_USB( 0, gnd, 1, 0, 0),
1625 F_USB(60000000, pll8, 1, 5, 32),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001626 F_END
1627};
1628
1629static struct rcg_clk usb_hsic_xcvr_fs_clk = {
1630 .b = {
1631 .ctl_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1632 .en_mask = BIT(9),
1633 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1634 .halt_bit = 26,
1635 },
1636 .ns_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1637 .md_reg = USB_HSIC_XCVR_FS_CLK_MD_REG,
1638 .root_en_mask = BIT(11),
1639 .ns_mask = (BM(23, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001640 .mnd_en_mask = BIT(8),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001641 .set_rate = set_rate_mnd,
1642 .freq_tbl = clk_tbl_usb_hsic,
1643 .current_freq = &rcg_dummy_freq,
1644 .c = {
1645 .dbg_name = "usb_hsic_xcvr_fs_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001646 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001647 VDD_DIG_FMAX_MAP1(LOW, 60000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001648 CLK_INIT(usb_hsic_xcvr_fs_clk.c),
1649 },
1650};
1651
1652static struct branch_clk usb_hsic_system_clk = {
1653 .b = {
1654 .ctl_reg = USB_HSIC_SYSTEM_CLK_CTL_REG,
1655 .en_mask = BIT(4),
1656 .reset_reg = USB_HSIC_RESET_REG,
1657 .reset_mask = BIT(0),
1658 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1659 .halt_bit = 24,
1660 },
1661 .parent = &usb_hsic_xcvr_fs_clk.c,
1662 .c = {
1663 .dbg_name = "usb_hsic_system_clk",
1664 .ops = &clk_ops_branch,
1665 CLK_INIT(usb_hsic_system_clk.c),
1666 },
1667};
1668
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001669#define F_USB_HSIC(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001670 { \
1671 .freq_hz = f, \
1672 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001673 }
1674static struct clk_freq_tbl clk_tbl_usb2_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001675 F_USB_HSIC(480000000, pll14),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001676 F_END
1677};
1678
1679static struct rcg_clk usb_hsic_hsic_src_clk = {
1680 .b = {
1681 .ctl_reg = USB_HSIC_HSIC_CLK_SRC_CTL_REG,
1682 .halt_check = NOCHECK,
1683 },
1684 .root_en_mask = BIT(0),
1685 .set_rate = set_rate_nop,
1686 .freq_tbl = clk_tbl_usb2_hsic,
1687 .current_freq = &rcg_dummy_freq,
1688 .c = {
1689 .dbg_name = "usb_hsic_hsic_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001690 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001691 VDD_DIG_FMAX_MAP1(LOW, 480000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001692 CLK_INIT(usb_hsic_hsic_src_clk.c),
1693 },
1694};
1695
1696static struct branch_clk usb_hsic_hsic_clk = {
1697 .b = {
1698 .ctl_reg = USB_HSIC_HSIC_CLK_CTL_REG,
1699 .en_mask = BIT(0),
1700 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1701 .halt_bit = 19,
1702 },
1703 .parent = &usb_hsic_hsic_src_clk.c,
1704 .c = {
1705 .dbg_name = "usb_hsic_hsic_clk",
1706 .ops = &clk_ops_branch,
1707 CLK_INIT(usb_hsic_hsic_clk.c),
1708 },
1709};
1710
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001711#define F_USB_HSIO_CAL(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001712 { \
1713 .freq_hz = f, \
1714 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001715 }
1716static struct clk_freq_tbl clk_tbl_usb_hsio_cal[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001717 F_USB_HSIO_CAL(9000000, pxo),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001718 F_END
1719};
1720
1721static struct rcg_clk usb_hsic_hsio_cal_clk = {
1722 .b = {
1723 .ctl_reg = USB_HSIC_HSIO_CAL_CLK_CTL_REG,
1724 .en_mask = BIT(0),
1725 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1726 .halt_bit = 23,
1727 },
1728 .set_rate = set_rate_nop,
1729 .freq_tbl = clk_tbl_usb_hsio_cal,
1730 .current_freq = &rcg_dummy_freq,
1731 .c = {
1732 .dbg_name = "usb_hsic_hsio_cal_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, 10000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001735 CLK_INIT(usb_hsic_hsio_cal_clk.c),
1736 },
1737};
1738
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001739static struct branch_clk usb_phy0_clk = {
1740 .b = {
1741 .reset_reg = USB_PHY0_RESET_REG,
1742 .reset_mask = BIT(0),
1743 },
1744 .c = {
1745 .dbg_name = "usb_phy0_clk",
1746 .ops = &clk_ops_reset,
1747 CLK_INIT(usb_phy0_clk.c),
1748 },
1749};
1750
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001751#define CLK_USB_FS(i, n, fmax_nom) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001752 struct rcg_clk i##_clk = { \
1753 .ns_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1754 .b = { \
1755 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1756 .halt_check = NOCHECK, \
1757 }, \
1758 .md_reg = USB_FSn_XCVR_FS_CLK_MD_REG(n), \
1759 .root_en_mask = BIT(11), \
1760 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001761 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001762 .set_rate = set_rate_mnd, \
1763 .freq_tbl = clk_tbl_usb, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001764 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001765 .c = { \
1766 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001767 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001768 VDD_DIG_FMAX_MAP1(NOMINAL, fmax_nom), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001769 CLK_INIT(i##_clk.c), \
1770 }, \
1771 }
1772
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001773static CLK_USB_FS(usb_fs1_src, 1, 64000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001774static struct branch_clk usb_fs1_xcvr_clk = {
1775 .b = {
1776 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(1),
1777 .en_mask = BIT(9),
1778 .reset_reg = USB_FSn_RESET_REG(1),
1779 .reset_mask = BIT(1),
1780 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1781 .halt_bit = 15,
1782 },
1783 .parent = &usb_fs1_src_clk.c,
1784 .c = {
1785 .dbg_name = "usb_fs1_xcvr_clk",
1786 .ops = &clk_ops_branch,
1787 CLK_INIT(usb_fs1_xcvr_clk.c),
1788 },
1789};
1790
1791static struct branch_clk usb_fs1_sys_clk = {
1792 .b = {
1793 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(1),
1794 .en_mask = BIT(4),
1795 .reset_reg = USB_FSn_RESET_REG(1),
1796 .reset_mask = BIT(0),
1797 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1798 .halt_bit = 16,
1799 },
1800 .parent = &usb_fs1_src_clk.c,
1801 .c = {
1802 .dbg_name = "usb_fs1_sys_clk",
1803 .ops = &clk_ops_branch,
1804 CLK_INIT(usb_fs1_sys_clk.c),
1805 },
1806};
1807
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001808static CLK_USB_FS(usb_fs2_src, 2, 60000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001809static struct branch_clk usb_fs2_xcvr_clk = {
1810 .b = {
1811 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(2),
1812 .en_mask = BIT(9),
1813 .reset_reg = USB_FSn_RESET_REG(2),
1814 .reset_mask = BIT(1),
1815 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1816 .halt_bit = 12,
1817 },
1818 .parent = &usb_fs2_src_clk.c,
1819 .c = {
1820 .dbg_name = "usb_fs2_xcvr_clk",
1821 .ops = &clk_ops_branch,
1822 CLK_INIT(usb_fs2_xcvr_clk.c),
1823 },
1824};
1825
1826static struct branch_clk usb_fs2_sys_clk = {
1827 .b = {
1828 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(2),
1829 .en_mask = BIT(4),
1830 .reset_reg = USB_FSn_RESET_REG(2),
1831 .reset_mask = BIT(0),
1832 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1833 .halt_bit = 13,
1834 },
1835 .parent = &usb_fs2_src_clk.c,
1836 .c = {
1837 .dbg_name = "usb_fs2_sys_clk",
1838 .ops = &clk_ops_branch,
1839 CLK_INIT(usb_fs2_sys_clk.c),
1840 },
1841};
1842
1843/* Fast Peripheral Bus Clocks */
1844static struct branch_clk ce1_core_clk = {
1845 .b = {
1846 .ctl_reg = CE1_CORE_CLK_CTL_REG,
1847 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001848 .hwcg_reg = CE1_CORE_CLK_CTL_REG,
1849 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001850 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1851 .halt_bit = 27,
1852 },
1853 .c = {
1854 .dbg_name = "ce1_core_clk",
1855 .ops = &clk_ops_branch,
1856 CLK_INIT(ce1_core_clk.c),
1857 },
1858};
Tianyi Gou41515e22011-09-01 19:37:43 -07001859
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001860static struct branch_clk ce1_p_clk = {
1861 .b = {
1862 .ctl_reg = CE1_HCLK_CTL_REG,
1863 .en_mask = BIT(4),
1864 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1865 .halt_bit = 1,
1866 },
1867 .c = {
1868 .dbg_name = "ce1_p_clk",
1869 .ops = &clk_ops_branch,
1870 CLK_INIT(ce1_p_clk.c),
1871 },
1872};
1873
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001874#define F_CE3(f, s, d) \
Tianyi Gou41515e22011-09-01 19:37:43 -07001875 { \
1876 .freq_hz = f, \
1877 .src_clk = &s##_clk.c, \
1878 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001879 }
1880
1881static struct clk_freq_tbl clk_tbl_ce3[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001882 F_CE3( 0, gnd, 1),
1883 F_CE3( 48000000, pll8, 8),
1884 F_CE3(100000000, pll3, 12),
Tianyi Gou41515e22011-09-01 19:37:43 -07001885 F_END
1886};
1887
1888static struct rcg_clk ce3_src_clk = {
1889 .b = {
1890 .ctl_reg = CE3_CLK_SRC_NS_REG,
1891 .halt_check = NOCHECK,
1892 },
1893 .ns_reg = CE3_CLK_SRC_NS_REG,
1894 .root_en_mask = BIT(7),
1895 .ns_mask = BM(6, 0),
1896 .set_rate = set_rate_nop,
1897 .freq_tbl = clk_tbl_ce3,
1898 .current_freq = &rcg_dummy_freq,
1899 .c = {
1900 .dbg_name = "ce3_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001901 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001902 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
Tianyi Gou41515e22011-09-01 19:37:43 -07001903 CLK_INIT(ce3_src_clk.c),
1904 },
1905};
1906
1907static struct branch_clk ce3_core_clk = {
1908 .b = {
1909 .ctl_reg = CE3_CORE_CLK_CTL_REG,
1910 .en_mask = BIT(4),
1911 .reset_reg = CE3_CORE_CLK_CTL_REG,
1912 .reset_mask = BIT(7),
1913 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
1914 .halt_bit = 5,
1915 },
1916 .parent = &ce3_src_clk.c,
1917 .c = {
1918 .dbg_name = "ce3_core_clk",
1919 .ops = &clk_ops_branch,
1920 CLK_INIT(ce3_core_clk.c),
1921 }
1922};
1923
1924static struct branch_clk ce3_p_clk = {
1925 .b = {
1926 .ctl_reg = CE3_HCLK_CTL_REG,
1927 .en_mask = BIT(4),
1928 .reset_reg = CE3_HCLK_CTL_REG,
1929 .reset_mask = BIT(7),
1930 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
1931 .halt_bit = 16,
1932 },
1933 .parent = &ce3_src_clk.c,
1934 .c = {
1935 .dbg_name = "ce3_p_clk",
1936 .ops = &clk_ops_branch,
1937 CLK_INIT(ce3_p_clk.c),
1938 }
1939};
1940
Tianyi Gou352955d2012-05-18 19:44:01 -07001941#define F_SATA(f, s, d) \
1942 { \
1943 .freq_hz = f, \
1944 .src_clk = &s##_clk.c, \
1945 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
1946 }
1947
1948static struct clk_freq_tbl clk_tbl_sata[] = {
1949 F_SATA( 0, gnd, 1),
1950 F_SATA( 48000000, pll8, 8),
1951 F_SATA(100000000, pll3, 12),
1952 F_END
1953};
1954
1955static struct rcg_clk sata_src_clk = {
1956 .b = {
1957 .ctl_reg = SATA_CLK_SRC_NS_REG,
1958 .halt_check = NOCHECK,
1959 },
1960 .ns_reg = SATA_CLK_SRC_NS_REG,
1961 .root_en_mask = BIT(7),
1962 .ns_mask = BM(6, 0),
1963 .set_rate = set_rate_nop,
1964 .freq_tbl = clk_tbl_sata,
1965 .current_freq = &rcg_dummy_freq,
1966 .c = {
1967 .dbg_name = "sata_src_clk",
1968 .ops = &clk_ops_rcg,
1969 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
1970 CLK_INIT(sata_src_clk.c),
1971 },
1972};
1973
1974static struct branch_clk sata_rxoob_clk = {
1975 .b = {
1976 .ctl_reg = SATA_RXOOB_CLK_CTL_REG,
1977 .en_mask = BIT(4),
1978 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
1979 .halt_bit = 26,
1980 },
1981 .parent = &sata_src_clk.c,
1982 .c = {
1983 .dbg_name = "sata_rxoob_clk",
1984 .ops = &clk_ops_branch,
1985 CLK_INIT(sata_rxoob_clk.c),
1986 },
1987};
1988
1989static struct branch_clk sata_pmalive_clk = {
1990 .b = {
1991 .ctl_reg = SATA_PMALIVE_CLK_CTL_REG,
1992 .en_mask = BIT(4),
1993 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
1994 .halt_bit = 25,
1995 },
1996 .parent = &sata_src_clk.c,
1997 .c = {
1998 .dbg_name = "sata_pmalive_clk",
1999 .ops = &clk_ops_branch,
2000 CLK_INIT(sata_pmalive_clk.c),
2001 },
2002};
2003
Tianyi Gou41515e22011-09-01 19:37:43 -07002004static struct branch_clk sata_phy_ref_clk = {
2005 .b = {
2006 .ctl_reg = SATA_PHY_REF_CLK_CTL_REG,
2007 .en_mask = BIT(4),
2008 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2009 .halt_bit = 24,
2010 },
2011 .parent = &pxo_clk.c,
2012 .c = {
2013 .dbg_name = "sata_phy_ref_clk",
2014 .ops = &clk_ops_branch,
2015 CLK_INIT(sata_phy_ref_clk.c),
2016 },
2017};
2018
Tianyi Gou352955d2012-05-18 19:44:01 -07002019static struct branch_clk sata_a_clk = {
2020 .b = {
2021 .ctl_reg = SATA_ACLK_CTL_REG,
2022 .en_mask = BIT(4),
2023 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2024 .halt_bit = 12,
2025 },
2026 .c = {
2027 .dbg_name = "sata_a_clk",
2028 .ops = &clk_ops_branch,
2029 CLK_INIT(sata_a_clk.c),
2030 },
2031};
2032
2033static struct branch_clk sata_p_clk = {
2034 .b = {
2035 .ctl_reg = SATA_HCLK_CTL_REG,
2036 .en_mask = BIT(4),
2037 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2038 .halt_bit = 27,
2039 },
2040 .c = {
2041 .dbg_name = "sata_p_clk",
2042 .ops = &clk_ops_branch,
2043 CLK_INIT(sata_p_clk.c),
2044 },
2045};
2046
2047static struct branch_clk sfab_sata_s_p_clk = {
2048 .b = {
2049 .ctl_reg = SFAB_SATA_S_HCLK_CTL_REG,
2050 .en_mask = BIT(4),
2051 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
2052 .halt_bit = 14,
2053 },
2054 .c = {
2055 .dbg_name = "sfab_sata_s_p_clk",
2056 .ops = &clk_ops_branch,
2057 CLK_INIT(sfab_sata_s_p_clk.c),
2058 },
2059};
Tianyi Gou41515e22011-09-01 19:37:43 -07002060static struct branch_clk pcie_p_clk = {
2061 .b = {
2062 .ctl_reg = PCIE_HCLK_CTL_REG,
2063 .en_mask = BIT(4),
2064 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2065 .halt_bit = 8,
2066 },
2067 .c = {
2068 .dbg_name = "pcie_p_clk",
2069 .ops = &clk_ops_branch,
2070 CLK_INIT(pcie_p_clk.c),
2071 },
2072};
2073
Tianyi Gou6613de52012-01-27 17:57:53 -08002074static struct branch_clk pcie_phy_ref_clk = {
2075 .b = {
2076 .ctl_reg = PCIE_PCLK_CTL_REG,
2077 .en_mask = BIT(4),
2078 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2079 .halt_bit = 29,
2080 },
2081 .c = {
2082 .dbg_name = "pcie_phy_ref_clk",
2083 .ops = &clk_ops_branch,
2084 CLK_INIT(pcie_phy_ref_clk.c),
2085 },
2086};
2087
2088static struct branch_clk pcie_a_clk = {
2089 .b = {
2090 .ctl_reg = PCIE_ACLK_CTL_REG,
2091 .en_mask = BIT(4),
2092 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2093 .halt_bit = 13,
2094 },
2095 .c = {
2096 .dbg_name = "pcie_a_clk",
2097 .ops = &clk_ops_branch,
2098 CLK_INIT(pcie_a_clk.c),
2099 },
2100};
2101
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002102static struct branch_clk dma_bam_p_clk = {
2103 .b = {
2104 .ctl_reg = DMA_BAM_HCLK_CTL,
2105 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002106 .hwcg_reg = DMA_BAM_HCLK_CTL,
2107 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002108 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2109 .halt_bit = 12,
2110 },
2111 .c = {
2112 .dbg_name = "dma_bam_p_clk",
2113 .ops = &clk_ops_branch,
2114 CLK_INIT(dma_bam_p_clk.c),
2115 },
2116};
2117
2118static struct branch_clk gsbi1_p_clk = {
2119 .b = {
2120 .ctl_reg = GSBIn_HCLK_CTL_REG(1),
2121 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002122 .hwcg_reg = GSBIn_HCLK_CTL_REG(1),
2123 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002124 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2125 .halt_bit = 11,
2126 },
2127 .c = {
2128 .dbg_name = "gsbi1_p_clk",
2129 .ops = &clk_ops_branch,
2130 CLK_INIT(gsbi1_p_clk.c),
2131 },
2132};
2133
2134static struct branch_clk gsbi2_p_clk = {
2135 .b = {
2136 .ctl_reg = GSBIn_HCLK_CTL_REG(2),
2137 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002138 .hwcg_reg = GSBIn_HCLK_CTL_REG(2),
2139 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002140 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2141 .halt_bit = 7,
2142 },
2143 .c = {
2144 .dbg_name = "gsbi2_p_clk",
2145 .ops = &clk_ops_branch,
2146 CLK_INIT(gsbi2_p_clk.c),
2147 },
2148};
2149
2150static struct branch_clk gsbi3_p_clk = {
2151 .b = {
2152 .ctl_reg = GSBIn_HCLK_CTL_REG(3),
2153 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002154 .hwcg_reg = GSBIn_HCLK_CTL_REG(3),
2155 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002156 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2157 .halt_bit = 3,
2158 },
2159 .c = {
2160 .dbg_name = "gsbi3_p_clk",
2161 .ops = &clk_ops_branch,
2162 CLK_INIT(gsbi3_p_clk.c),
2163 },
2164};
2165
2166static struct branch_clk gsbi4_p_clk = {
2167 .b = {
2168 .ctl_reg = GSBIn_HCLK_CTL_REG(4),
2169 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002170 .hwcg_reg = GSBIn_HCLK_CTL_REG(4),
2171 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002172 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2173 .halt_bit = 27,
2174 },
2175 .c = {
2176 .dbg_name = "gsbi4_p_clk",
2177 .ops = &clk_ops_branch,
2178 CLK_INIT(gsbi4_p_clk.c),
2179 },
2180};
2181
2182static struct branch_clk gsbi5_p_clk = {
2183 .b = {
2184 .ctl_reg = GSBIn_HCLK_CTL_REG(5),
2185 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002186 .hwcg_reg = GSBIn_HCLK_CTL_REG(5),
2187 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002188 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2189 .halt_bit = 23,
2190 },
2191 .c = {
2192 .dbg_name = "gsbi5_p_clk",
2193 .ops = &clk_ops_branch,
2194 CLK_INIT(gsbi5_p_clk.c),
2195 },
2196};
2197
2198static struct branch_clk gsbi6_p_clk = {
2199 .b = {
2200 .ctl_reg = GSBIn_HCLK_CTL_REG(6),
2201 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002202 .hwcg_reg = GSBIn_HCLK_CTL_REG(6),
2203 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002204 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2205 .halt_bit = 19,
2206 },
2207 .c = {
2208 .dbg_name = "gsbi6_p_clk",
2209 .ops = &clk_ops_branch,
2210 CLK_INIT(gsbi6_p_clk.c),
2211 },
2212};
2213
2214static struct branch_clk gsbi7_p_clk = {
2215 .b = {
2216 .ctl_reg = GSBIn_HCLK_CTL_REG(7),
2217 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002218 .hwcg_reg = GSBIn_HCLK_CTL_REG(7),
2219 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002220 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2221 .halt_bit = 15,
2222 },
2223 .c = {
2224 .dbg_name = "gsbi7_p_clk",
2225 .ops = &clk_ops_branch,
2226 CLK_INIT(gsbi7_p_clk.c),
2227 },
2228};
2229
2230static struct branch_clk gsbi8_p_clk = {
2231 .b = {
2232 .ctl_reg = GSBIn_HCLK_CTL_REG(8),
2233 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002234 .hwcg_reg = GSBIn_HCLK_CTL_REG(8),
2235 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002236 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2237 .halt_bit = 11,
2238 },
2239 .c = {
2240 .dbg_name = "gsbi8_p_clk",
2241 .ops = &clk_ops_branch,
2242 CLK_INIT(gsbi8_p_clk.c),
2243 },
2244};
2245
2246static struct branch_clk gsbi9_p_clk = {
2247 .b = {
2248 .ctl_reg = GSBIn_HCLK_CTL_REG(9),
2249 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002250 .hwcg_reg = GSBIn_HCLK_CTL_REG(9),
2251 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002252 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2253 .halt_bit = 7,
2254 },
2255 .c = {
2256 .dbg_name = "gsbi9_p_clk",
2257 .ops = &clk_ops_branch,
2258 CLK_INIT(gsbi9_p_clk.c),
2259 },
2260};
2261
2262static struct branch_clk gsbi10_p_clk = {
2263 .b = {
2264 .ctl_reg = GSBIn_HCLK_CTL_REG(10),
2265 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002266 .hwcg_reg = GSBIn_HCLK_CTL_REG(10),
2267 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002268 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2269 .halt_bit = 3,
2270 },
2271 .c = {
2272 .dbg_name = "gsbi10_p_clk",
2273 .ops = &clk_ops_branch,
2274 CLK_INIT(gsbi10_p_clk.c),
2275 },
2276};
2277
2278static struct branch_clk gsbi11_p_clk = {
2279 .b = {
2280 .ctl_reg = GSBIn_HCLK_CTL_REG(11),
2281 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002282 .hwcg_reg = GSBIn_HCLK_CTL_REG(11),
2283 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002284 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2285 .halt_bit = 18,
2286 },
2287 .c = {
2288 .dbg_name = "gsbi11_p_clk",
2289 .ops = &clk_ops_branch,
2290 CLK_INIT(gsbi11_p_clk.c),
2291 },
2292};
2293
2294static struct branch_clk gsbi12_p_clk = {
2295 .b = {
2296 .ctl_reg = GSBIn_HCLK_CTL_REG(12),
2297 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002298 .hwcg_reg = GSBIn_HCLK_CTL_REG(12),
2299 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002300 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2301 .halt_bit = 14,
2302 },
2303 .c = {
2304 .dbg_name = "gsbi12_p_clk",
2305 .ops = &clk_ops_branch,
2306 CLK_INIT(gsbi12_p_clk.c),
2307 },
2308};
2309
Tianyi Gou41515e22011-09-01 19:37:43 -07002310static struct branch_clk sata_phy_cfg_clk = {
2311 .b = {
2312 .ctl_reg = SATA_PHY_CFG_CLK_CTL_REG,
2313 .en_mask = BIT(4),
2314 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2315 .halt_bit = 12,
2316 },
2317 .c = {
2318 .dbg_name = "sata_phy_cfg_clk",
2319 .ops = &clk_ops_branch,
2320 CLK_INIT(sata_phy_cfg_clk.c),
Stephen Boyd973e4ba2011-07-12 17:06:01 -07002321 },
2322};
2323
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002324static struct branch_clk tsif_p_clk = {
2325 .b = {
2326 .ctl_reg = TSIF_HCLK_CTL_REG,
2327 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002328 .hwcg_reg = TSIF_HCLK_CTL_REG,
2329 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002330 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2331 .halt_bit = 7,
2332 },
2333 .c = {
2334 .dbg_name = "tsif_p_clk",
2335 .ops = &clk_ops_branch,
2336 CLK_INIT(tsif_p_clk.c),
2337 },
2338};
2339
2340static struct branch_clk usb_fs1_p_clk = {
2341 .b = {
2342 .ctl_reg = USB_FSn_HCLK_CTL_REG(1),
2343 .en_mask = BIT(4),
2344 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2345 .halt_bit = 17,
2346 },
2347 .c = {
2348 .dbg_name = "usb_fs1_p_clk",
2349 .ops = &clk_ops_branch,
2350 CLK_INIT(usb_fs1_p_clk.c),
2351 },
2352};
2353
2354static struct branch_clk usb_fs2_p_clk = {
2355 .b = {
2356 .ctl_reg = USB_FSn_HCLK_CTL_REG(2),
2357 .en_mask = BIT(4),
2358 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2359 .halt_bit = 14,
2360 },
2361 .c = {
2362 .dbg_name = "usb_fs2_p_clk",
2363 .ops = &clk_ops_branch,
2364 CLK_INIT(usb_fs2_p_clk.c),
2365 },
2366};
2367
2368static struct branch_clk usb_hs1_p_clk = {
2369 .b = {
2370 .ctl_reg = USB_HS1_HCLK_CTL_REG,
2371 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002372 .hwcg_reg = USB_HS1_HCLK_CTL_REG,
2373 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002374 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2375 .halt_bit = 1,
2376 },
2377 .c = {
2378 .dbg_name = "usb_hs1_p_clk",
2379 .ops = &clk_ops_branch,
2380 CLK_INIT(usb_hs1_p_clk.c),
2381 },
2382};
2383
Tianyi Gou41515e22011-09-01 19:37:43 -07002384static struct branch_clk usb_hs3_p_clk = {
2385 .b = {
2386 .ctl_reg = USB_HS3_HCLK_CTL_REG,
2387 .en_mask = BIT(4),
2388 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2389 .halt_bit = 31,
2390 },
2391 .c = {
2392 .dbg_name = "usb_hs3_p_clk",
2393 .ops = &clk_ops_branch,
2394 CLK_INIT(usb_hs3_p_clk.c),
2395 },
2396};
2397
2398static struct branch_clk usb_hs4_p_clk = {
2399 .b = {
2400 .ctl_reg = USB_HS4_HCLK_CTL_REG,
2401 .en_mask = BIT(4),
2402 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2403 .halt_bit = 7,
2404 },
2405 .c = {
2406 .dbg_name = "usb_hs4_p_clk",
2407 .ops = &clk_ops_branch,
2408 CLK_INIT(usb_hs4_p_clk.c),
2409 },
2410};
2411
Stephen Boyd94625ef2011-07-12 17:06:01 -07002412static struct branch_clk usb_hsic_p_clk = {
2413 .b = {
2414 .ctl_reg = USB_HSIC_HCLK_CTL_REG,
2415 .en_mask = BIT(4),
2416 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2417 .halt_bit = 28,
2418 },
2419 .c = {
2420 .dbg_name = "usb_hsic_p_clk",
2421 .ops = &clk_ops_branch,
2422 CLK_INIT(usb_hsic_p_clk.c),
2423 },
2424};
2425
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002426static struct branch_clk sdc1_p_clk = {
2427 .b = {
2428 .ctl_reg = SDCn_HCLK_CTL_REG(1),
2429 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002430 .hwcg_reg = SDCn_HCLK_CTL_REG(1),
2431 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002432 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2433 .halt_bit = 11,
2434 },
2435 .c = {
2436 .dbg_name = "sdc1_p_clk",
2437 .ops = &clk_ops_branch,
2438 CLK_INIT(sdc1_p_clk.c),
2439 },
2440};
2441
2442static struct branch_clk sdc2_p_clk = {
2443 .b = {
2444 .ctl_reg = SDCn_HCLK_CTL_REG(2),
2445 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002446 .hwcg_reg = SDCn_HCLK_CTL_REG(2),
2447 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002448 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2449 .halt_bit = 10,
2450 },
2451 .c = {
2452 .dbg_name = "sdc2_p_clk",
2453 .ops = &clk_ops_branch,
2454 CLK_INIT(sdc2_p_clk.c),
2455 },
2456};
2457
2458static struct branch_clk sdc3_p_clk = {
2459 .b = {
2460 .ctl_reg = SDCn_HCLK_CTL_REG(3),
2461 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002462 .hwcg_reg = SDCn_HCLK_CTL_REG(3),
2463 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002464 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2465 .halt_bit = 9,
2466 },
2467 .c = {
2468 .dbg_name = "sdc3_p_clk",
2469 .ops = &clk_ops_branch,
2470 CLK_INIT(sdc3_p_clk.c),
2471 },
2472};
2473
2474static struct branch_clk sdc4_p_clk = {
2475 .b = {
2476 .ctl_reg = SDCn_HCLK_CTL_REG(4),
2477 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002478 .hwcg_reg = SDCn_HCLK_CTL_REG(4),
2479 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002480 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2481 .halt_bit = 8,
2482 },
2483 .c = {
2484 .dbg_name = "sdc4_p_clk",
2485 .ops = &clk_ops_branch,
2486 CLK_INIT(sdc4_p_clk.c),
2487 },
2488};
2489
2490static struct branch_clk sdc5_p_clk = {
2491 .b = {
2492 .ctl_reg = SDCn_HCLK_CTL_REG(5),
2493 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002494 .hwcg_reg = SDCn_HCLK_CTL_REG(5),
2495 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002496 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2497 .halt_bit = 7,
2498 },
2499 .c = {
2500 .dbg_name = "sdc5_p_clk",
2501 .ops = &clk_ops_branch,
2502 CLK_INIT(sdc5_p_clk.c),
2503 },
2504};
2505
2506/* HW-Voteable Clocks */
2507static struct branch_clk adm0_clk = {
2508 .b = {
2509 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2510 .en_mask = BIT(2),
2511 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2512 .halt_check = HALT_VOTED,
2513 .halt_bit = 14,
2514 },
2515 .c = {
2516 .dbg_name = "adm0_clk",
2517 .ops = &clk_ops_branch,
2518 CLK_INIT(adm0_clk.c),
2519 },
2520};
2521
2522static struct branch_clk adm0_p_clk = {
2523 .b = {
2524 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2525 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002526 .hwcg_reg = ADM0_PBUS_CLK_CTL_REG,
2527 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002528 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2529 .halt_check = HALT_VOTED,
2530 .halt_bit = 13,
2531 },
2532 .c = {
2533 .dbg_name = "adm0_p_clk",
2534 .ops = &clk_ops_branch,
2535 CLK_INIT(adm0_p_clk.c),
2536 },
2537};
2538
2539static struct branch_clk pmic_arb0_p_clk = {
2540 .b = {
2541 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2542 .en_mask = BIT(8),
2543 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2544 .halt_check = HALT_VOTED,
2545 .halt_bit = 22,
2546 },
2547 .c = {
2548 .dbg_name = "pmic_arb0_p_clk",
2549 .ops = &clk_ops_branch,
2550 CLK_INIT(pmic_arb0_p_clk.c),
2551 },
2552};
2553
2554static struct branch_clk pmic_arb1_p_clk = {
2555 .b = {
2556 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2557 .en_mask = BIT(9),
2558 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2559 .halt_check = HALT_VOTED,
2560 .halt_bit = 21,
2561 },
2562 .c = {
2563 .dbg_name = "pmic_arb1_p_clk",
2564 .ops = &clk_ops_branch,
2565 CLK_INIT(pmic_arb1_p_clk.c),
2566 },
2567};
2568
2569static struct branch_clk pmic_ssbi2_clk = {
2570 .b = {
2571 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2572 .en_mask = BIT(7),
2573 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2574 .halt_check = HALT_VOTED,
2575 .halt_bit = 23,
2576 },
2577 .c = {
2578 .dbg_name = "pmic_ssbi2_clk",
2579 .ops = &clk_ops_branch,
2580 CLK_INIT(pmic_ssbi2_clk.c),
2581 },
2582};
2583
2584static struct branch_clk rpm_msg_ram_p_clk = {
2585 .b = {
2586 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2587 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002588 .hwcg_reg = RPM_MSG_RAM_HCLK_CTL_REG,
2589 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002590 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2591 .halt_check = HALT_VOTED,
2592 .halt_bit = 12,
2593 },
2594 .c = {
2595 .dbg_name = "rpm_msg_ram_p_clk",
2596 .ops = &clk_ops_branch,
2597 CLK_INIT(rpm_msg_ram_p_clk.c),
2598 },
2599};
2600
2601/*
2602 * Multimedia Clocks
2603 */
2604
Stephen Boyd94625ef2011-07-12 17:06:01 -07002605#define CLK_CAM(name, n, hb) \
2606 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002607 .b = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002608 .ctl_reg = CAMCLK##n##_CC_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002609 .en_mask = BIT(0), \
2610 .halt_reg = DBG_BUS_VEC_I_REG, \
2611 .halt_bit = hb, \
2612 }, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002613 .ns_reg = CAMCLK##n##_NS_REG, \
2614 .md_reg = CAMCLK##n##_MD_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002615 .root_en_mask = BIT(2), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002616 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), \
Matt Wagantall07c45472012-02-10 23:27:24 -08002617 .mnd_en_mask = BIT(5), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002618 .ctl_mask = BM(7, 6), \
2619 .set_rate = set_rate_mnd_8, \
2620 .freq_tbl = clk_tbl_cam, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002621 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002622 .c = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002623 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07002624 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002625 VDD_DIG_FMAX_MAP2(LOW, 64000000, NOMINAL, 128000000), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002626 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002627 }, \
2628 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002629#define F_CAM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002630 { \
2631 .freq_hz = f, \
2632 .src_clk = &s##_clk.c, \
2633 .md_val = MD8(8, m, 0, n), \
2634 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2635 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002636 }
2637static struct clk_freq_tbl clk_tbl_cam[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002638 F_CAM( 0, gnd, 1, 0, 0),
2639 F_CAM( 6000000, pll8, 4, 1, 16),
2640 F_CAM( 8000000, pll8, 4, 1, 12),
2641 F_CAM( 12000000, pll8, 4, 1, 8),
2642 F_CAM( 16000000, pll8, 4, 1, 6),
2643 F_CAM( 19200000, pll8, 4, 1, 5),
2644 F_CAM( 24000000, pll8, 4, 1, 4),
2645 F_CAM( 32000000, pll8, 4, 1, 3),
2646 F_CAM( 48000000, pll8, 4, 1, 2),
2647 F_CAM( 64000000, pll8, 3, 1, 2),
2648 F_CAM( 96000000, pll8, 4, 0, 0),
2649 F_CAM(128000000, pll8, 3, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002650 F_END
2651};
2652
Stephen Boyd94625ef2011-07-12 17:06:01 -07002653static CLK_CAM(cam0_clk, 0, 15);
2654static CLK_CAM(cam1_clk, 1, 16);
2655static CLK_CAM(cam2_clk, 2, 31);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002656
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002657#define F_CSI(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002658 { \
2659 .freq_hz = f, \
2660 .src_clk = &s##_clk.c, \
2661 .md_val = MD8(8, m, 0, n), \
2662 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2663 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002664 }
2665static struct clk_freq_tbl clk_tbl_csi[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002666 F_CSI( 0, gnd, 1, 0, 0),
Stephen Boyd092fd182011-10-21 15:56:30 -07002667 F_CSI( 27000000, pxo, 1, 0, 0),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002668 F_CSI( 85330000, pll8, 1, 2, 9),
2669 F_CSI(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002670 F_END
2671};
2672
2673static struct rcg_clk csi0_src_clk = {
2674 .ns_reg = CSI0_NS_REG,
2675 .b = {
2676 .ctl_reg = CSI0_CC_REG,
2677 .halt_check = NOCHECK,
2678 },
2679 .md_reg = CSI0_MD_REG,
2680 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002681 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002682 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002683 .ctl_mask = BM(7, 6),
2684 .set_rate = set_rate_mnd,
2685 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002686 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002687 .c = {
2688 .dbg_name = "csi0_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002689 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002690 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002691 CLK_INIT(csi0_src_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002692 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002693 },
2694};
2695
2696static struct branch_clk csi0_clk = {
2697 .b = {
2698 .ctl_reg = CSI0_CC_REG,
2699 .en_mask = BIT(0),
2700 .reset_reg = SW_RESET_CORE_REG,
2701 .reset_mask = BIT(8),
2702 .halt_reg = DBG_BUS_VEC_B_REG,
2703 .halt_bit = 13,
2704 },
2705 .parent = &csi0_src_clk.c,
2706 .c = {
2707 .dbg_name = "csi0_clk",
2708 .ops = &clk_ops_branch,
2709 CLK_INIT(csi0_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002710 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002711 },
2712};
2713
2714static struct branch_clk csi0_phy_clk = {
2715 .b = {
2716 .ctl_reg = CSI0_CC_REG,
2717 .en_mask = BIT(8),
2718 .reset_reg = SW_RESET_CORE_REG,
2719 .reset_mask = BIT(29),
2720 .halt_reg = DBG_BUS_VEC_I_REG,
2721 .halt_bit = 9,
2722 },
2723 .parent = &csi0_src_clk.c,
2724 .c = {
2725 .dbg_name = "csi0_phy_clk",
2726 .ops = &clk_ops_branch,
2727 CLK_INIT(csi0_phy_clk.c),
2728 },
2729};
2730
2731static struct rcg_clk csi1_src_clk = {
2732 .ns_reg = CSI1_NS_REG,
2733 .b = {
2734 .ctl_reg = CSI1_CC_REG,
2735 .halt_check = NOCHECK,
2736 },
2737 .md_reg = CSI1_MD_REG,
2738 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002739 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002740 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002741 .ctl_mask = BM(7, 6),
2742 .set_rate = set_rate_mnd,
2743 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002744 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002745 .c = {
2746 .dbg_name = "csi1_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002747 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002748 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002749 CLK_INIT(csi1_src_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002750 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002751 },
2752};
2753
2754static struct branch_clk csi1_clk = {
2755 .b = {
2756 .ctl_reg = CSI1_CC_REG,
2757 .en_mask = BIT(0),
2758 .reset_reg = SW_RESET_CORE_REG,
2759 .reset_mask = BIT(18),
2760 .halt_reg = DBG_BUS_VEC_B_REG,
2761 .halt_bit = 14,
2762 },
2763 .parent = &csi1_src_clk.c,
2764 .c = {
2765 .dbg_name = "csi1_clk",
2766 .ops = &clk_ops_branch,
2767 CLK_INIT(csi1_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002768 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002769 },
2770};
2771
2772static struct branch_clk csi1_phy_clk = {
2773 .b = {
2774 .ctl_reg = CSI1_CC_REG,
2775 .en_mask = BIT(8),
2776 .reset_reg = SW_RESET_CORE_REG,
2777 .reset_mask = BIT(28),
2778 .halt_reg = DBG_BUS_VEC_I_REG,
2779 .halt_bit = 10,
2780 },
2781 .parent = &csi1_src_clk.c,
2782 .c = {
2783 .dbg_name = "csi1_phy_clk",
2784 .ops = &clk_ops_branch,
2785 CLK_INIT(csi1_phy_clk.c),
2786 },
2787};
2788
Stephen Boyd94625ef2011-07-12 17:06:01 -07002789static struct rcg_clk csi2_src_clk = {
2790 .ns_reg = CSI2_NS_REG,
2791 .b = {
2792 .ctl_reg = CSI2_CC_REG,
2793 .halt_check = NOCHECK,
2794 },
2795 .md_reg = CSI2_MD_REG,
2796 .root_en_mask = BIT(2),
2797 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002798 .mnd_en_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002799 .ctl_mask = BM(7, 6),
2800 .set_rate = set_rate_mnd,
2801 .freq_tbl = clk_tbl_csi,
2802 .current_freq = &rcg_dummy_freq,
2803 .c = {
2804 .dbg_name = "csi2_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002805 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002806 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002807 CLK_INIT(csi2_src_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002808 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002809 },
2810};
2811
2812static struct branch_clk csi2_clk = {
2813 .b = {
2814 .ctl_reg = CSI2_CC_REG,
2815 .en_mask = BIT(0),
2816 .reset_reg = SW_RESET_CORE2_REG,
2817 .reset_mask = BIT(2),
2818 .halt_reg = DBG_BUS_VEC_B_REG,
2819 .halt_bit = 29,
2820 },
2821 .parent = &csi2_src_clk.c,
2822 .c = {
2823 .dbg_name = "csi2_clk",
2824 .ops = &clk_ops_branch,
2825 CLK_INIT(csi2_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002826 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002827 },
2828};
2829
2830static struct branch_clk csi2_phy_clk = {
2831 .b = {
2832 .ctl_reg = CSI2_CC_REG,
2833 .en_mask = BIT(8),
2834 .reset_reg = SW_RESET_CORE_REG,
2835 .reset_mask = BIT(31),
2836 .halt_reg = DBG_BUS_VEC_I_REG,
2837 .halt_bit = 29,
2838 },
2839 .parent = &csi2_src_clk.c,
2840 .c = {
2841 .dbg_name = "csi2_phy_clk",
2842 .ops = &clk_ops_branch,
2843 CLK_INIT(csi2_phy_clk.c),
2844 },
2845};
2846
Stephen Boyd092fd182011-10-21 15:56:30 -07002847static struct clk *pix_rdi_mux_map[] = {
2848 [0] = &csi0_clk.c,
2849 [1] = &csi1_clk.c,
2850 [2] = &csi2_clk.c,
2851 NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002852};
2853
Stephen Boyd092fd182011-10-21 15:56:30 -07002854struct pix_rdi_clk {
2855 bool enabled;
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002856 unsigned long cur_rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002857
2858 void __iomem *const s_reg;
2859 u32 s_mask;
2860
2861 void __iomem *const s2_reg;
2862 u32 s2_mask;
2863
2864 struct branch b;
2865 struct clk c;
2866};
2867
Matt Wagantallf82f2942012-01-27 13:56:13 -08002868static inline struct pix_rdi_clk *to_pix_rdi_clk(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002869{
Matt Wagantallf82f2942012-01-27 13:56:13 -08002870 return container_of(c, struct pix_rdi_clk, c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002871}
2872
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002873static int pix_rdi_clk_set_rate(struct clk *c, unsigned long rate)
Stephen Boyd092fd182011-10-21 15:56:30 -07002874{
2875 int ret, i;
2876 u32 reg;
2877 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002878 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002879 struct clk **mux_map = pix_rdi_mux_map;
2880
2881 /*
2882 * These clocks select three inputs via two muxes. One mux selects
2883 * between csi0 and csi1 and the second mux selects between that mux's
2884 * output and csi2. The source and destination selections for each
2885 * mux must be clocking for the switch to succeed so just turn on
2886 * all three sources because it's easier than figuring out what source
2887 * needs to be on at what time.
2888 */
2889 for (i = 0; mux_map[i]; i++) {
2890 ret = clk_enable(mux_map[i]);
2891 if (ret)
2892 goto err;
2893 }
2894 if (rate >= i) {
2895 ret = -EINVAL;
2896 goto err;
2897 }
2898 /* Keep the new source on when switching inputs of an enabled clock */
Matt Wagantallf82f2942012-01-27 13:56:13 -08002899 if (rdi->enabled) {
2900 clk_disable(mux_map[rdi->cur_rate]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002901 clk_enable(mux_map[rate]);
2902 }
2903 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002904 reg = readl_relaxed(rdi->s2_reg);
2905 reg &= ~rdi->s2_mask;
2906 reg |= rate == 2 ? rdi->s2_mask : 0;
2907 writel_relaxed(reg, rdi->s2_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002908 /*
2909 * Wait at least 6 cycles of slowest clock
2910 * for the glitch-free MUX to fully switch sources.
2911 */
2912 mb();
2913 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002914 reg = readl_relaxed(rdi->s_reg);
2915 reg &= ~rdi->s_mask;
2916 reg |= rate == 1 ? rdi->s_mask : 0;
2917 writel_relaxed(reg, rdi->s_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002918 /*
2919 * Wait at least 6 cycles of slowest clock
2920 * for the glitch-free MUX to fully switch sources.
2921 */
2922 mb();
2923 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002924 rdi->cur_rate = rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002925 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
2926err:
2927 for (i--; i >= 0; i--)
2928 clk_disable(mux_map[i]);
2929
2930 return 0;
2931}
2932
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002933static unsigned long pix_rdi_clk_get_rate(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002934{
2935 return to_pix_rdi_clk(c)->cur_rate;
2936}
2937
2938static int pix_rdi_clk_enable(struct clk *c)
2939{
2940 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002941 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002942
2943 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07002944 __branch_enable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07002945 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002946 rdi->enabled = true;
Stephen Boyd092fd182011-10-21 15:56:30 -07002947
2948 return 0;
2949}
2950
2951static void pix_rdi_clk_disable(struct clk *c)
2952{
2953 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002954 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002955
2956 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07002957 __branch_disable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07002958 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002959 rdi->enabled = false;
Stephen Boyd092fd182011-10-21 15:56:30 -07002960}
2961
Matt Wagantallf82f2942012-01-27 13:56:13 -08002962static int pix_rdi_clk_reset(struct clk *c, enum clk_reset_action action)
Stephen Boyd092fd182011-10-21 15:56:30 -07002963{
Matt Wagantallf82f2942012-01-27 13:56:13 -08002964 return branch_reset(&to_pix_rdi_clk(c)->b, action);
Stephen Boyd092fd182011-10-21 15:56:30 -07002965}
2966
2967static struct clk *pix_rdi_clk_get_parent(struct clk *c)
2968{
Matt Wagantallf82f2942012-01-27 13:56:13 -08002969 return pix_rdi_mux_map[to_pix_rdi_clk(c)->cur_rate];
Stephen Boyd092fd182011-10-21 15:56:30 -07002970}
2971
2972static int pix_rdi_clk_list_rate(struct clk *c, unsigned n)
2973{
2974 if (pix_rdi_mux_map[n])
2975 return n;
2976 return -ENXIO;
2977}
2978
Matt Wagantalla15833b2012-04-03 11:00:56 -07002979static enum handoff pix_rdi_clk_handoff(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002980{
2981 u32 reg;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002982 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07002983 enum handoff ret;
2984
Matt Wagantallf82f2942012-01-27 13:56:13 -08002985 ret = branch_handoff(&rdi->b, &rdi->c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07002986 if (ret == HANDOFF_DISABLED_CLK)
2987 return ret;
Stephen Boyd092fd182011-10-21 15:56:30 -07002988
Matt Wagantallf82f2942012-01-27 13:56:13 -08002989 reg = readl_relaxed(rdi->s_reg);
2990 rdi->cur_rate = reg & rdi->s_mask ? 1 : 0;
2991 reg = readl_relaxed(rdi->s2_reg);
2992 rdi->cur_rate = reg & rdi->s2_mask ? 2 : rdi->cur_rate;
Matt Wagantalla15833b2012-04-03 11:00:56 -07002993
2994 return HANDOFF_ENABLED_CLK;
Stephen Boyd092fd182011-10-21 15:56:30 -07002995}
2996
2997static struct clk_ops clk_ops_pix_rdi_8960 = {
2998 .enable = pix_rdi_clk_enable,
2999 .disable = pix_rdi_clk_disable,
Stephen Boyd092fd182011-10-21 15:56:30 -07003000 .handoff = pix_rdi_clk_handoff,
3001 .set_rate = pix_rdi_clk_set_rate,
3002 .get_rate = pix_rdi_clk_get_rate,
3003 .list_rate = pix_rdi_clk_list_rate,
3004 .reset = pix_rdi_clk_reset,
Stephen Boyd092fd182011-10-21 15:56:30 -07003005 .get_parent = pix_rdi_clk_get_parent,
3006};
3007
3008static struct pix_rdi_clk csi_pix_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003009 .b = {
3010 .ctl_reg = MISC_CC_REG,
3011 .en_mask = BIT(26),
3012 .halt_check = DELAY,
3013 .reset_reg = SW_RESET_CORE_REG,
3014 .reset_mask = BIT(26),
3015 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003016 .s_reg = MISC_CC_REG,
3017 .s_mask = BIT(25),
3018 .s2_reg = MISC_CC3_REG,
3019 .s2_mask = BIT(13),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003020 .c = {
3021 .dbg_name = "csi_pix_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003022 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003023 CLK_INIT(csi_pix_clk.c),
3024 },
3025};
3026
Stephen Boyd092fd182011-10-21 15:56:30 -07003027static struct pix_rdi_clk csi_pix1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003028 .b = {
3029 .ctl_reg = MISC_CC3_REG,
3030 .en_mask = BIT(10),
3031 .halt_check = DELAY,
3032 .reset_reg = SW_RESET_CORE_REG,
3033 .reset_mask = BIT(30),
3034 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003035 .s_reg = MISC_CC3_REG,
3036 .s_mask = BIT(8),
3037 .s2_reg = MISC_CC3_REG,
3038 .s2_mask = BIT(9),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003039 .c = {
3040 .dbg_name = "csi_pix1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003041 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003042 CLK_INIT(csi_pix1_clk.c),
3043 },
3044};
3045
Stephen Boyd092fd182011-10-21 15:56:30 -07003046static struct pix_rdi_clk csi_rdi_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003047 .b = {
3048 .ctl_reg = MISC_CC_REG,
3049 .en_mask = BIT(13),
3050 .halt_check = DELAY,
3051 .reset_reg = SW_RESET_CORE_REG,
3052 .reset_mask = BIT(27),
3053 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003054 .s_reg = MISC_CC_REG,
3055 .s_mask = BIT(12),
3056 .s2_reg = MISC_CC3_REG,
3057 .s2_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003058 .c = {
3059 .dbg_name = "csi_rdi_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003060 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003061 CLK_INIT(csi_rdi_clk.c),
3062 },
3063};
3064
Stephen Boyd092fd182011-10-21 15:56:30 -07003065static struct pix_rdi_clk csi_rdi1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003066 .b = {
3067 .ctl_reg = MISC_CC3_REG,
3068 .en_mask = BIT(2),
3069 .halt_check = DELAY,
3070 .reset_reg = SW_RESET_CORE2_REG,
3071 .reset_mask = BIT(1),
3072 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003073 .s_reg = MISC_CC3_REG,
3074 .s_mask = BIT(0),
3075 .s2_reg = MISC_CC3_REG,
3076 .s2_mask = BIT(1),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003077 .c = {
3078 .dbg_name = "csi_rdi1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003079 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003080 CLK_INIT(csi_rdi1_clk.c),
3081 },
3082};
3083
Stephen Boyd092fd182011-10-21 15:56:30 -07003084static struct pix_rdi_clk csi_rdi2_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003085 .b = {
3086 .ctl_reg = MISC_CC3_REG,
3087 .en_mask = BIT(6),
3088 .halt_check = DELAY,
3089 .reset_reg = SW_RESET_CORE2_REG,
3090 .reset_mask = BIT(0),
3091 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003092 .s_reg = MISC_CC3_REG,
3093 .s_mask = BIT(4),
3094 .s2_reg = MISC_CC3_REG,
3095 .s2_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003096 .c = {
3097 .dbg_name = "csi_rdi2_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003098 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003099 CLK_INIT(csi_rdi2_clk.c),
3100 },
3101};
3102
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003103#define F_CSI_PHYTIMER(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003104 { \
3105 .freq_hz = f, \
3106 .src_clk = &s##_clk.c, \
3107 .md_val = MD8(8, m, 0, n), \
3108 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
3109 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003110 }
3111static struct clk_freq_tbl clk_tbl_csi_phytimer[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003112 F_CSI_PHYTIMER( 0, gnd, 1, 0, 0),
3113 F_CSI_PHYTIMER( 85330000, pll8, 1, 2, 9),
3114 F_CSI_PHYTIMER(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003115 F_END
3116};
3117
3118static struct rcg_clk csiphy_timer_src_clk = {
3119 .ns_reg = CSIPHYTIMER_NS_REG,
3120 .b = {
3121 .ctl_reg = CSIPHYTIMER_CC_REG,
3122 .halt_check = NOCHECK,
3123 },
3124 .md_reg = CSIPHYTIMER_MD_REG,
3125 .root_en_mask = BIT(2),
3126 .ns_mask = (BM(31, 24) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003127 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003128 .ctl_mask = BM(7, 6),
3129 .set_rate = set_rate_mnd_8,
3130 .freq_tbl = clk_tbl_csi_phytimer,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003131 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003132 .c = {
3133 .dbg_name = "csiphy_timer_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003134 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003135 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003136 CLK_INIT(csiphy_timer_src_clk.c),
3137 },
3138};
3139
3140static struct branch_clk csi0phy_timer_clk = {
3141 .b = {
3142 .ctl_reg = CSIPHYTIMER_CC_REG,
3143 .en_mask = BIT(0),
3144 .halt_reg = DBG_BUS_VEC_I_REG,
3145 .halt_bit = 17,
3146 },
3147 .parent = &csiphy_timer_src_clk.c,
3148 .c = {
3149 .dbg_name = "csi0phy_timer_clk",
3150 .ops = &clk_ops_branch,
3151 CLK_INIT(csi0phy_timer_clk.c),
3152 },
3153};
3154
3155static struct branch_clk csi1phy_timer_clk = {
3156 .b = {
3157 .ctl_reg = CSIPHYTIMER_CC_REG,
3158 .en_mask = BIT(9),
3159 .halt_reg = DBG_BUS_VEC_I_REG,
3160 .halt_bit = 18,
3161 },
3162 .parent = &csiphy_timer_src_clk.c,
3163 .c = {
3164 .dbg_name = "csi1phy_timer_clk",
3165 .ops = &clk_ops_branch,
3166 CLK_INIT(csi1phy_timer_clk.c),
3167 },
3168};
3169
Stephen Boyd94625ef2011-07-12 17:06:01 -07003170static struct branch_clk csi2phy_timer_clk = {
3171 .b = {
3172 .ctl_reg = CSIPHYTIMER_CC_REG,
3173 .en_mask = BIT(11),
3174 .halt_reg = DBG_BUS_VEC_I_REG,
3175 .halt_bit = 30,
3176 },
3177 .parent = &csiphy_timer_src_clk.c,
3178 .c = {
3179 .dbg_name = "csi2phy_timer_clk",
3180 .ops = &clk_ops_branch,
3181 CLK_INIT(csi2phy_timer_clk.c),
3182 },
3183};
3184
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003185#define F_DSI(d) \
3186 { \
3187 .freq_hz = d, \
3188 .ns_val = BVAL(15, 12, (d-1)), \
3189 }
3190/*
3191 * The DSI_BYTE/ESC clock is sourced from the DSI PHY PLL, which may change rate
3192 * without this clock driver knowing. So, overload the clk_set_rate() to set
3193 * the divider (1 to 16) of the clock with respect to the PLL rate.
3194 */
3195static struct clk_freq_tbl clk_tbl_dsi_byte[] = {
3196 F_DSI(1), F_DSI(2), F_DSI(3), F_DSI(4),
3197 F_DSI(5), F_DSI(6), F_DSI(7), F_DSI(8),
3198 F_DSI(9), F_DSI(10), F_DSI(11), F_DSI(12),
3199 F_DSI(13), F_DSI(14), F_DSI(15), F_DSI(16),
3200 F_END
3201};
3202
3203static struct rcg_clk dsi1_byte_clk = {
3204 .b = {
3205 .ctl_reg = DSI1_BYTE_CC_REG,
3206 .en_mask = BIT(0),
3207 .reset_reg = SW_RESET_CORE_REG,
3208 .reset_mask = BIT(7),
3209 .halt_reg = DBG_BUS_VEC_B_REG,
3210 .halt_bit = 21,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003211 .retain_reg = DSI1_BYTE_CC_REG,
3212 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003213 },
3214 .ns_reg = DSI1_BYTE_NS_REG,
3215 .root_en_mask = BIT(2),
3216 .ns_mask = BM(15, 12),
3217 .set_rate = set_rate_nop,
3218 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003219 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003220 .c = {
3221 .dbg_name = "dsi1_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003222 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003223 CLK_INIT(dsi1_byte_clk.c),
3224 },
3225};
3226
3227static struct rcg_clk dsi2_byte_clk = {
3228 .b = {
3229 .ctl_reg = DSI2_BYTE_CC_REG,
3230 .en_mask = BIT(0),
3231 .reset_reg = SW_RESET_CORE_REG,
3232 .reset_mask = BIT(25),
3233 .halt_reg = DBG_BUS_VEC_B_REG,
3234 .halt_bit = 20,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003235 .retain_reg = DSI2_BYTE_CC_REG,
3236 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003237 },
3238 .ns_reg = DSI2_BYTE_NS_REG,
3239 .root_en_mask = BIT(2),
3240 .ns_mask = BM(15, 12),
3241 .set_rate = set_rate_nop,
3242 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003243 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003244 .c = {
3245 .dbg_name = "dsi2_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003246 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003247 CLK_INIT(dsi2_byte_clk.c),
3248 },
3249};
3250
3251static struct rcg_clk dsi1_esc_clk = {
3252 .b = {
3253 .ctl_reg = DSI1_ESC_CC_REG,
3254 .en_mask = BIT(0),
3255 .reset_reg = SW_RESET_CORE_REG,
3256 .halt_reg = DBG_BUS_VEC_I_REG,
3257 .halt_bit = 1,
3258 },
3259 .ns_reg = DSI1_ESC_NS_REG,
3260 .root_en_mask = BIT(2),
3261 .ns_mask = BM(15, 12),
3262 .set_rate = set_rate_nop,
3263 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003264 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003265 .c = {
3266 .dbg_name = "dsi1_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003267 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003268 CLK_INIT(dsi1_esc_clk.c),
3269 },
3270};
3271
3272static struct rcg_clk dsi2_esc_clk = {
3273 .b = {
3274 .ctl_reg = DSI2_ESC_CC_REG,
3275 .en_mask = BIT(0),
3276 .halt_reg = DBG_BUS_VEC_I_REG,
3277 .halt_bit = 3,
3278 },
3279 .ns_reg = DSI2_ESC_NS_REG,
3280 .root_en_mask = BIT(2),
3281 .ns_mask = BM(15, 12),
3282 .set_rate = set_rate_nop,
3283 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003284 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003285 .c = {
3286 .dbg_name = "dsi2_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003287 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003288 CLK_INIT(dsi2_esc_clk.c),
3289 },
3290};
3291
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003292#define F_GFX2D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003293 { \
3294 .freq_hz = f, \
3295 .src_clk = &s##_clk.c, \
3296 .md_val = MD4(4, m, 0, n), \
3297 .ns_val = NS_MND_BANKED4(20, 16, n, m, 3, 0, s##_to_mm_mux), \
3298 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003299 }
3300static struct clk_freq_tbl clk_tbl_gfx2d[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003301 F_GFX2D( 0, gnd, 0, 0),
3302 F_GFX2D( 27000000, pxo, 0, 0),
3303 F_GFX2D( 48000000, pll8, 1, 8),
3304 F_GFX2D( 54857000, pll8, 1, 7),
3305 F_GFX2D( 64000000, pll8, 1, 6),
3306 F_GFX2D( 76800000, pll8, 1, 5),
3307 F_GFX2D( 96000000, pll8, 1, 4),
3308 F_GFX2D(128000000, pll8, 1, 3),
3309 F_GFX2D(145455000, pll2, 2, 11),
3310 F_GFX2D(160000000, pll2, 1, 5),
3311 F_GFX2D(177778000, pll2, 2, 9),
3312 F_GFX2D(200000000, pll2, 1, 4),
3313 F_GFX2D(228571000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003314 F_END
3315};
3316
3317static struct bank_masks bmnd_info_gfx2d0 = {
3318 .bank_sel_mask = BIT(11),
3319 .bank0_mask = {
3320 .md_reg = GFX2D0_MD0_REG,
3321 .ns_mask = BM(23, 20) | BM(5, 3),
3322 .rst_mask = BIT(25),
3323 .mnd_en_mask = BIT(8),
3324 .mode_mask = BM(10, 9),
3325 },
3326 .bank1_mask = {
3327 .md_reg = GFX2D0_MD1_REG,
3328 .ns_mask = BM(19, 16) | BM(2, 0),
3329 .rst_mask = BIT(24),
3330 .mnd_en_mask = BIT(5),
3331 .mode_mask = BM(7, 6),
3332 },
3333};
3334
3335static struct rcg_clk gfx2d0_clk = {
3336 .b = {
3337 .ctl_reg = GFX2D0_CC_REG,
3338 .en_mask = BIT(0),
3339 .reset_reg = SW_RESET_CORE_REG,
3340 .reset_mask = BIT(14),
3341 .halt_reg = DBG_BUS_VEC_A_REG,
3342 .halt_bit = 9,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003343 .retain_reg = GFX2D0_CC_REG,
3344 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003345 },
3346 .ns_reg = GFX2D0_NS_REG,
3347 .root_en_mask = BIT(2),
3348 .set_rate = set_rate_mnd_banked,
3349 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003350 .bank_info = &bmnd_info_gfx2d0,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003351 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003352 .c = {
3353 .dbg_name = "gfx2d0_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003354 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003355 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003356 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3357 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003358 CLK_INIT(gfx2d0_clk.c),
3359 },
3360};
3361
3362static struct bank_masks bmnd_info_gfx2d1 = {
3363 .bank_sel_mask = BIT(11),
3364 .bank0_mask = {
3365 .md_reg = GFX2D1_MD0_REG,
3366 .ns_mask = BM(23, 20) | BM(5, 3),
3367 .rst_mask = BIT(25),
3368 .mnd_en_mask = BIT(8),
3369 .mode_mask = BM(10, 9),
3370 },
3371 .bank1_mask = {
3372 .md_reg = GFX2D1_MD1_REG,
3373 .ns_mask = BM(19, 16) | BM(2, 0),
3374 .rst_mask = BIT(24),
3375 .mnd_en_mask = BIT(5),
3376 .mode_mask = BM(7, 6),
3377 },
3378};
3379
3380static struct rcg_clk gfx2d1_clk = {
3381 .b = {
3382 .ctl_reg = GFX2D1_CC_REG,
3383 .en_mask = BIT(0),
3384 .reset_reg = SW_RESET_CORE_REG,
3385 .reset_mask = BIT(13),
3386 .halt_reg = DBG_BUS_VEC_A_REG,
3387 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003388 .retain_reg = GFX2D1_CC_REG,
3389 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003390 },
3391 .ns_reg = GFX2D1_NS_REG,
3392 .root_en_mask = BIT(2),
3393 .set_rate = set_rate_mnd_banked,
3394 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003395 .bank_info = &bmnd_info_gfx2d1,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003396 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003397 .c = {
3398 .dbg_name = "gfx2d1_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003399 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003400 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003401 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3402 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003403 CLK_INIT(gfx2d1_clk.c),
3404 },
3405};
3406
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003407#define F_GFX3D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003408 { \
3409 .freq_hz = f, \
3410 .src_clk = &s##_clk.c, \
3411 .md_val = MD4(4, m, 0, n), \
3412 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3413 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003414 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003415
Patrick Dalye6f489042012-07-11 15:29:15 -07003416static struct clk_freq_tbl clk_tbl_gfx3d_8960ab[] = {
3417 F_GFX3D( 0, gnd, 0, 0),
3418 F_GFX3D( 27000000, pxo, 0, 0),
3419 F_GFX3D( 48000000, pll8, 1, 8),
3420 F_GFX3D( 54857000, pll8, 1, 7),
3421 F_GFX3D( 64000000, pll8, 1, 6),
3422 F_GFX3D( 76800000, pll8, 1, 5),
3423 F_GFX3D( 96000000, pll8, 1, 4),
3424 F_GFX3D(128000000, pll8, 1, 3),
3425 F_GFX3D(145455000, pll2, 2, 11),
3426 F_GFX3D(160000000, pll2, 1, 5),
3427 F_GFX3D(177778000, pll2, 2, 9),
3428 F_GFX3D(200000000, pll2, 1, 4),
3429 F_GFX3D(228571000, pll2, 2, 7),
3430 F_GFX3D(266667000, pll2, 1, 3),
3431 F_GFX3D(320000000, pll2, 2, 5),
3432 F_GFX3D(325000000, pll3, 1, 2),
3433 F_GFX3D(400000000, pll2, 1, 2),
3434 F_END
3435};
3436
Tianyi Gou41515e22011-09-01 19:37:43 -07003437static struct clk_freq_tbl clk_tbl_gfx3d_8960[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003438 F_GFX3D( 0, gnd, 0, 0),
3439 F_GFX3D( 27000000, pxo, 0, 0),
3440 F_GFX3D( 48000000, pll8, 1, 8),
3441 F_GFX3D( 54857000, pll8, 1, 7),
3442 F_GFX3D( 64000000, pll8, 1, 6),
3443 F_GFX3D( 76800000, pll8, 1, 5),
3444 F_GFX3D( 96000000, pll8, 1, 4),
3445 F_GFX3D(128000000, pll8, 1, 3),
3446 F_GFX3D(145455000, pll2, 2, 11),
3447 F_GFX3D(160000000, pll2, 1, 5),
3448 F_GFX3D(177778000, pll2, 2, 9),
3449 F_GFX3D(200000000, pll2, 1, 4),
3450 F_GFX3D(228571000, pll2, 2, 7),
3451 F_GFX3D(266667000, pll2, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003452 F_GFX3D(300000000, pll3, 1, 4),
3453 F_GFX3D(320000000, pll2, 2, 5),
3454 F_GFX3D(400000000, pll2, 1, 2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003455 F_END
3456};
3457
Tianyi Gou41515e22011-09-01 19:37:43 -07003458static struct clk_freq_tbl clk_tbl_gfx3d_8064[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003459 F_GFX3D( 0, gnd, 0, 0),
3460 F_GFX3D( 27000000, pxo, 0, 0),
3461 F_GFX3D( 48000000, pll8, 1, 8),
3462 F_GFX3D( 54857000, pll8, 1, 7),
3463 F_GFX3D( 64000000, pll8, 1, 6),
3464 F_GFX3D( 76800000, pll8, 1, 5),
3465 F_GFX3D( 96000000, pll8, 1, 4),
3466 F_GFX3D(128000000, pll8, 1, 3),
3467 F_GFX3D(145455000, pll2, 2, 11),
3468 F_GFX3D(160000000, pll2, 1, 5),
3469 F_GFX3D(177778000, pll2, 2, 9),
3470 F_GFX3D(200000000, pll2, 1, 4),
3471 F_GFX3D(228571000, pll2, 2, 7),
3472 F_GFX3D(266667000, pll2, 1, 3),
Tianyi Gou0c50fe32011-10-19 15:50:35 -07003473 F_GFX3D(325000000, pll15, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003474 F_GFX3D(400000000, pll2, 1, 2),
Tianyi Gou41515e22011-09-01 19:37:43 -07003475 F_END
3476};
3477
Tianyi Goue3d4f542012-03-15 17:06:45 -07003478static struct clk_freq_tbl clk_tbl_gfx3d_8930[] = {
3479 F_GFX3D( 0, gnd, 0, 0),
3480 F_GFX3D( 27000000, pxo, 0, 0),
3481 F_GFX3D( 48000000, pll8, 1, 8),
3482 F_GFX3D( 54857000, pll8, 1, 7),
3483 F_GFX3D( 64000000, pll8, 1, 6),
3484 F_GFX3D( 76800000, pll8, 1, 5),
3485 F_GFX3D( 96000000, pll8, 1, 4),
3486 F_GFX3D(128000000, pll8, 1, 3),
3487 F_GFX3D(145455000, pll2, 2, 11),
3488 F_GFX3D(160000000, pll2, 1, 5),
3489 F_GFX3D(177778000, pll2, 2, 9),
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003490 F_GFX3D(192000000, pll8, 1, 2),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003491 F_GFX3D(200000000, pll2, 1, 4),
3492 F_GFX3D(228571000, pll2, 2, 7),
3493 F_GFX3D(266667000, pll2, 1, 3),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003494 F_GFX3D(320000000, pll2, 2, 5),
3495 F_GFX3D(400000000, pll2, 1, 2),
3496 F_GFX3D(450000000, pll15, 1, 2),
3497 F_END
3498};
3499
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003500static unsigned long fmax_gfx3d_8064[MAX_VDD_LEVELS] __initdata = {
3501 [VDD_DIG_LOW] = 128000000,
3502 [VDD_DIG_NOMINAL] = 325000000,
3503 [VDD_DIG_HIGH] = 400000000
3504};
3505
Tianyi Goue3d4f542012-03-15 17:06:45 -07003506static unsigned long fmax_gfx3d_8930[MAX_VDD_LEVELS] __initdata = {
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003507 [VDD_DIG_LOW] = 192000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003508 [VDD_DIG_NOMINAL] = 320000000,
3509 [VDD_DIG_HIGH] = 450000000
3510};
3511
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003512static struct bank_masks bmnd_info_gfx3d = {
3513 .bank_sel_mask = BIT(11),
3514 .bank0_mask = {
3515 .md_reg = GFX3D_MD0_REG,
3516 .ns_mask = BM(21, 18) | BM(5, 3),
3517 .rst_mask = BIT(23),
3518 .mnd_en_mask = BIT(8),
3519 .mode_mask = BM(10, 9),
3520 },
3521 .bank1_mask = {
3522 .md_reg = GFX3D_MD1_REG,
3523 .ns_mask = BM(17, 14) | BM(2, 0),
3524 .rst_mask = BIT(22),
3525 .mnd_en_mask = BIT(5),
3526 .mode_mask = BM(7, 6),
3527 },
3528};
3529
3530static struct rcg_clk gfx3d_clk = {
3531 .b = {
3532 .ctl_reg = GFX3D_CC_REG,
3533 .en_mask = BIT(0),
3534 .reset_reg = SW_RESET_CORE_REG,
3535 .reset_mask = BIT(12),
3536 .halt_reg = DBG_BUS_VEC_A_REG,
3537 .halt_bit = 4,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003538 .retain_reg = GFX3D_CC_REG,
3539 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003540 },
3541 .ns_reg = GFX3D_NS_REG,
3542 .root_en_mask = BIT(2),
3543 .set_rate = set_rate_mnd_banked,
Tianyi Gou41515e22011-09-01 19:37:43 -07003544 .freq_tbl = clk_tbl_gfx3d_8960,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003545 .bank_info = &bmnd_info_gfx3d,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003546 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003547 .c = {
3548 .dbg_name = "gfx3d_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003549 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003550 VDD_DIG_FMAX_MAP3(LOW, 128000000, NOMINAL, 300000000,
3551 HIGH, 400000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003552 CLK_INIT(gfx3d_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003553 .depends = &gmem_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003554 },
3555};
3556
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003557#define F_VCAP(f, s, m, n) \
Tianyi Gou621f8742011-09-01 21:45:01 -07003558 { \
3559 .freq_hz = f, \
3560 .src_clk = &s##_clk.c, \
3561 .md_val = MD4(4, m, 0, n), \
3562 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3563 .ctl_val = CC_BANKED(9, 6, n), \
Tianyi Gou621f8742011-09-01 21:45:01 -07003564 }
3565
3566static struct clk_freq_tbl clk_tbl_vcap[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003567 F_VCAP( 0, gnd, 0, 0),
3568 F_VCAP( 27000000, pxo, 0, 0),
3569 F_VCAP( 54860000, pll8, 1, 7),
3570 F_VCAP( 64000000, pll8, 1, 6),
3571 F_VCAP( 76800000, pll8, 1, 5),
3572 F_VCAP(128000000, pll8, 1, 3),
3573 F_VCAP(160000000, pll2, 1, 5),
3574 F_VCAP(200000000, pll2, 1, 4),
Tianyi Gou621f8742011-09-01 21:45:01 -07003575 F_END
3576};
3577
3578static struct bank_masks bmnd_info_vcap = {
3579 .bank_sel_mask = BIT(11),
3580 .bank0_mask = {
3581 .md_reg = VCAP_MD0_REG,
3582 .ns_mask = BM(21, 18) | BM(5, 3),
3583 .rst_mask = BIT(23),
3584 .mnd_en_mask = BIT(8),
3585 .mode_mask = BM(10, 9),
3586 },
3587 .bank1_mask = {
3588 .md_reg = VCAP_MD1_REG,
3589 .ns_mask = BM(17, 14) | BM(2, 0),
3590 .rst_mask = BIT(22),
3591 .mnd_en_mask = BIT(5),
3592 .mode_mask = BM(7, 6),
3593 },
3594};
3595
3596static struct rcg_clk vcap_clk = {
3597 .b = {
3598 .ctl_reg = VCAP_CC_REG,
3599 .en_mask = BIT(0),
3600 .halt_reg = DBG_BUS_VEC_J_REG,
3601 .halt_bit = 15,
3602 },
3603 .ns_reg = VCAP_NS_REG,
3604 .root_en_mask = BIT(2),
3605 .set_rate = set_rate_mnd_banked,
3606 .freq_tbl = clk_tbl_vcap,
3607 .bank_info = &bmnd_info_vcap,
3608 .current_freq = &rcg_dummy_freq,
3609 .c = {
3610 .dbg_name = "vcap_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003611 .ops = &clk_ops_rcg,
Tianyi Gou621f8742011-09-01 21:45:01 -07003612 .depends = &vcap_axi_clk.c,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003613 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
Tianyi Gou621f8742011-09-01 21:45:01 -07003614 CLK_INIT(vcap_clk.c),
3615 },
3616};
3617
3618static struct branch_clk vcap_npl_clk = {
3619 .b = {
3620 .ctl_reg = VCAP_CC_REG,
3621 .en_mask = BIT(13),
3622 .halt_reg = DBG_BUS_VEC_J_REG,
3623 .halt_bit = 25,
3624 },
3625 .parent = &vcap_clk.c,
3626 .c = {
3627 .dbg_name = "vcap_npl_clk",
3628 .ops = &clk_ops_branch,
3629 CLK_INIT(vcap_npl_clk.c),
3630 },
3631};
3632
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003633#define F_IJPEG(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003634 { \
3635 .freq_hz = f, \
3636 .src_clk = &s##_clk.c, \
3637 .md_val = MD8(8, m, 0, n), \
3638 .ns_val = NS_MM(23, 16, n, m, 15, 12, d, 2, 0, s##_to_mm_mux), \
3639 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003640 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003641
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003642static struct clk_freq_tbl clk_tbl_ijpeg[] = {
3643 F_IJPEG( 0, gnd, 1, 0, 0),
3644 F_IJPEG( 27000000, pxo, 1, 0, 0),
3645 F_IJPEG( 36570000, pll8, 1, 2, 21),
3646 F_IJPEG( 54860000, pll8, 7, 0, 0),
3647 F_IJPEG( 96000000, pll8, 4, 0, 0),
3648 F_IJPEG(109710000, pll8, 1, 2, 7),
3649 F_IJPEG(128000000, pll8, 3, 0, 0),
3650 F_IJPEG(153600000, pll8, 1, 2, 5),
3651 F_IJPEG(200000000, pll2, 4, 0, 0),
3652 F_IJPEG(228571000, pll2, 1, 2, 7),
3653 F_IJPEG(266667000, pll2, 1, 1, 3),
3654 F_IJPEG(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003655 F_END
3656};
3657
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003658static unsigned long fmax_ijpeg_8064[MAX_VDD_LEVELS] __initdata = {
3659 [VDD_DIG_LOW] = 128000000,
3660 [VDD_DIG_NOMINAL] = 266667000,
3661 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07003662};
3663
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003664static struct rcg_clk ijpeg_clk = {
3665 .b = {
3666 .ctl_reg = IJPEG_CC_REG,
3667 .en_mask = BIT(0),
3668 .reset_reg = SW_RESET_CORE_REG,
3669 .reset_mask = BIT(9),
3670 .halt_reg = DBG_BUS_VEC_A_REG,
3671 .halt_bit = 24,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003672 .retain_reg = IJPEG_CC_REG,
3673 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003674 },
3675 .ns_reg = IJPEG_NS_REG,
3676 .md_reg = IJPEG_MD_REG,
3677 .root_en_mask = BIT(2),
3678 .ns_mask = (BM(23, 16) | BM(15, 12) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003679 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003680 .ctl_mask = BM(7, 6),
3681 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003682 .freq_tbl = clk_tbl_ijpeg,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003683 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003684 .c = {
3685 .dbg_name = "ijpeg_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003686 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003687 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
3688 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003689 CLK_INIT(ijpeg_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003690 .depends = &ijpeg_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003691 },
3692};
3693
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003694#define F_JPEGD(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003695 { \
3696 .freq_hz = f, \
3697 .src_clk = &s##_clk.c, \
3698 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003699 }
3700static struct clk_freq_tbl clk_tbl_jpegd[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003701 F_JPEGD( 0, gnd, 1),
3702 F_JPEGD( 64000000, pll8, 6),
3703 F_JPEGD( 76800000, pll8, 5),
3704 F_JPEGD( 96000000, pll8, 4),
3705 F_JPEGD(160000000, pll2, 5),
3706 F_JPEGD(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003707 F_END
3708};
3709
3710static struct rcg_clk jpegd_clk = {
3711 .b = {
3712 .ctl_reg = JPEGD_CC_REG,
3713 .en_mask = BIT(0),
3714 .reset_reg = SW_RESET_CORE_REG,
3715 .reset_mask = BIT(19),
3716 .halt_reg = DBG_BUS_VEC_A_REG,
3717 .halt_bit = 19,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003718 .retain_reg = JPEGD_CC_REG,
3719 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003720 },
3721 .ns_reg = JPEGD_NS_REG,
3722 .root_en_mask = BIT(2),
3723 .ns_mask = (BM(15, 12) | BM(2, 0)),
3724 .set_rate = set_rate_nop,
3725 .freq_tbl = clk_tbl_jpegd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003726 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003727 .c = {
3728 .dbg_name = "jpegd_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003729 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003730 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003731 CLK_INIT(jpegd_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003732 .depends = &jpegd_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003733 },
3734};
3735
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003736#define F_MDP(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003737 { \
3738 .freq_hz = f, \
3739 .src_clk = &s##_clk.c, \
3740 .md_val = MD8(8, m, 0, n), \
3741 .ns_val = NS_MND_BANKED8(22, 14, n, m, 3, 0, s##_to_mm_mux), \
3742 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003743 }
Patrick Dalye6f489042012-07-11 15:29:15 -07003744static struct clk_freq_tbl clk_tbl_mdp_8960ab[] = {
3745 F_MDP( 0, gnd, 0, 0),
3746 F_MDP( 9600000, pll8, 1, 40),
3747 F_MDP( 13710000, pll8, 1, 28),
3748 F_MDP( 27000000, pxo, 0, 0),
3749 F_MDP( 29540000, pll8, 1, 13),
3750 F_MDP( 34910000, pll8, 1, 11),
3751 F_MDP( 38400000, pll8, 1, 10),
3752 F_MDP( 59080000, pll8, 2, 13),
3753 F_MDP( 76800000, pll8, 1, 5),
3754 F_MDP( 85330000, pll8, 2, 9),
3755 F_MDP( 96000000, pll8, 1, 4),
3756 F_MDP(128000000, pll8, 1, 3),
3757 F_MDP(160000000, pll2, 1, 5),
3758 F_MDP(177780000, pll2, 2, 9),
3759 F_MDP(200000000, pll2, 1, 4),
3760 F_MDP(228571000, pll2, 2, 7),
3761 F_MDP(266667000, pll2, 1, 3),
3762 F_END
3763};
3764
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003765static struct clk_freq_tbl clk_tbl_mdp[] = {
3766 F_MDP( 0, gnd, 0, 0),
3767 F_MDP( 9600000, pll8, 1, 40),
3768 F_MDP( 13710000, pll8, 1, 28),
3769 F_MDP( 27000000, pxo, 0, 0),
3770 F_MDP( 29540000, pll8, 1, 13),
3771 F_MDP( 34910000, pll8, 1, 11),
3772 F_MDP( 38400000, pll8, 1, 10),
3773 F_MDP( 59080000, pll8, 2, 13),
3774 F_MDP( 76800000, pll8, 1, 5),
3775 F_MDP( 85330000, pll8, 2, 9),
3776 F_MDP( 96000000, pll8, 1, 4),
3777 F_MDP(128000000, pll8, 1, 3),
3778 F_MDP(160000000, pll2, 1, 5),
3779 F_MDP(177780000, pll2, 2, 9),
3780 F_MDP(200000000, pll2, 1, 4),
3781 F_MDP(266667000, pll2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003782 F_END
3783};
3784
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003785static unsigned long fmax_mdp_8064[MAX_VDD_LEVELS] __initdata = {
3786 [VDD_DIG_LOW] = 128000000,
3787 [VDD_DIG_NOMINAL] = 266667000
Tianyi Gou621f8742011-09-01 21:45:01 -07003788};
3789
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003790static struct bank_masks bmnd_info_mdp = {
3791 .bank_sel_mask = BIT(11),
3792 .bank0_mask = {
3793 .md_reg = MDP_MD0_REG,
3794 .ns_mask = BM(29, 22) | BM(5, 3),
3795 .rst_mask = BIT(31),
3796 .mnd_en_mask = BIT(8),
3797 .mode_mask = BM(10, 9),
3798 },
3799 .bank1_mask = {
3800 .md_reg = MDP_MD1_REG,
3801 .ns_mask = BM(21, 14) | BM(2, 0),
3802 .rst_mask = BIT(30),
3803 .mnd_en_mask = BIT(5),
3804 .mode_mask = BM(7, 6),
3805 },
3806};
3807
3808static struct rcg_clk mdp_clk = {
3809 .b = {
3810 .ctl_reg = MDP_CC_REG,
3811 .en_mask = BIT(0),
3812 .reset_reg = SW_RESET_CORE_REG,
3813 .reset_mask = BIT(21),
3814 .halt_reg = DBG_BUS_VEC_C_REG,
3815 .halt_bit = 10,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003816 .retain_reg = MDP_CC_REG,
3817 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003818 },
3819 .ns_reg = MDP_NS_REG,
3820 .root_en_mask = BIT(2),
3821 .set_rate = set_rate_mnd_banked,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003822 .freq_tbl = clk_tbl_mdp,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003823 .bank_info = &bmnd_info_mdp,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003824 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003825 .c = {
3826 .dbg_name = "mdp_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003827 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003828 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003829 CLK_INIT(mdp_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003830 .depends = &mdp_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003831 },
3832};
3833
3834static struct branch_clk lut_mdp_clk = {
3835 .b = {
3836 .ctl_reg = MDP_LUT_CC_REG,
3837 .en_mask = BIT(0),
3838 .halt_reg = DBG_BUS_VEC_I_REG,
3839 .halt_bit = 13,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003840 .retain_reg = MDP_LUT_CC_REG,
3841 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003842 },
3843 .parent = &mdp_clk.c,
3844 .c = {
3845 .dbg_name = "lut_mdp_clk",
3846 .ops = &clk_ops_branch,
3847 CLK_INIT(lut_mdp_clk.c),
3848 },
3849};
3850
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003851#define F_MDP_VSYNC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003852 { \
3853 .freq_hz = f, \
3854 .src_clk = &s##_clk.c, \
3855 .ns_val = NS_SRC_SEL(13, 13, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003856 }
3857static struct clk_freq_tbl clk_tbl_mdp_vsync[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003858 F_MDP_VSYNC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003859 F_END
3860};
3861
3862static struct rcg_clk mdp_vsync_clk = {
3863 .b = {
3864 .ctl_reg = MISC_CC_REG,
3865 .en_mask = BIT(6),
3866 .reset_reg = SW_RESET_CORE_REG,
3867 .reset_mask = BIT(3),
3868 .halt_reg = DBG_BUS_VEC_B_REG,
3869 .halt_bit = 22,
3870 },
3871 .ns_reg = MISC_CC2_REG,
3872 .ns_mask = BIT(13),
3873 .set_rate = set_rate_nop,
3874 .freq_tbl = clk_tbl_mdp_vsync,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003875 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003876 .c = {
3877 .dbg_name = "mdp_vsync_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003878 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003879 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003880 CLK_INIT(mdp_vsync_clk.c),
3881 },
3882};
3883
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003884#define F_ROT(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003885 { \
3886 .freq_hz = f, \
3887 .src_clk = &s##_clk.c, \
3888 .ns_val = NS_DIVSRC_BANKED(29, 26, 25, 22, d, \
3889 21, 19, 18, 16, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003890 }
3891static struct clk_freq_tbl clk_tbl_rot[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003892 F_ROT( 0, gnd, 1),
3893 F_ROT( 27000000, pxo, 1),
3894 F_ROT( 29540000, pll8, 13),
3895 F_ROT( 32000000, pll8, 12),
3896 F_ROT( 38400000, pll8, 10),
3897 F_ROT( 48000000, pll8, 8),
3898 F_ROT( 54860000, pll8, 7),
3899 F_ROT( 64000000, pll8, 6),
3900 F_ROT( 76800000, pll8, 5),
3901 F_ROT( 96000000, pll8, 4),
3902 F_ROT(100000000, pll2, 8),
3903 F_ROT(114290000, pll2, 7),
3904 F_ROT(133330000, pll2, 6),
3905 F_ROT(160000000, pll2, 5),
3906 F_ROT(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003907 F_END
3908};
3909
3910static struct bank_masks bdiv_info_rot = {
3911 .bank_sel_mask = BIT(30),
3912 .bank0_mask = {
3913 .ns_mask = BM(25, 22) | BM(18, 16),
3914 },
3915 .bank1_mask = {
3916 .ns_mask = BM(29, 26) | BM(21, 19),
3917 },
3918};
3919
3920static struct rcg_clk rot_clk = {
3921 .b = {
3922 .ctl_reg = ROT_CC_REG,
3923 .en_mask = BIT(0),
3924 .reset_reg = SW_RESET_CORE_REG,
3925 .reset_mask = BIT(2),
3926 .halt_reg = DBG_BUS_VEC_C_REG,
3927 .halt_bit = 15,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003928 .retain_reg = ROT_CC_REG,
3929 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003930 },
3931 .ns_reg = ROT_NS_REG,
3932 .root_en_mask = BIT(2),
3933 .set_rate = set_rate_div_banked,
3934 .freq_tbl = clk_tbl_rot,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003935 .bank_info = &bdiv_info_rot,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003936 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003937 .c = {
3938 .dbg_name = "rot_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003939 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003940 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003941 CLK_INIT(rot_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003942 .depends = &rot_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003943 },
3944};
3945
Matt Wagantallf82f2942012-01-27 13:56:13 -08003946static int hdmi_pll_clk_enable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003947{
3948 int ret;
3949 unsigned long flags;
3950 spin_lock_irqsave(&local_clock_reg_lock, flags);
3951 ret = hdmi_pll_enable();
3952 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
3953 return ret;
3954}
3955
Matt Wagantallf82f2942012-01-27 13:56:13 -08003956static void hdmi_pll_clk_disable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003957{
3958 unsigned long flags;
3959 spin_lock_irqsave(&local_clock_reg_lock, flags);
3960 hdmi_pll_disable();
3961 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
3962}
3963
Matt Wagantallf82f2942012-01-27 13:56:13 -08003964static struct clk *hdmi_pll_clk_get_parent(struct clk *c)
Stephen Boyd5b35dee2011-09-21 12:17:38 -07003965{
3966 return &pxo_clk.c;
3967}
3968
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003969static struct clk_ops clk_ops_hdmi_pll = {
3970 .enable = hdmi_pll_clk_enable,
3971 .disable = hdmi_pll_clk_disable,
Stephen Boyd5b35dee2011-09-21 12:17:38 -07003972 .get_parent = hdmi_pll_clk_get_parent,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003973};
3974
3975static struct clk hdmi_pll_clk = {
3976 .dbg_name = "hdmi_pll_clk",
3977 .ops = &clk_ops_hdmi_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -07003978 .vdd_class = &vdd_sr2_hdmi_pll,
3979 .fmax[VDD_SR2_HDMI_PLL_ON] = ULONG_MAX,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003980 CLK_INIT(hdmi_pll_clk),
3981};
3982
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003983#define F_TV_GND(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003984 { \
3985 .freq_hz = f, \
3986 .src_clk = &s##_clk.c, \
3987 .md_val = MD8(8, m, 0, n), \
3988 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
3989 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003990 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003991#define F_TV(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003992 { \
3993 .freq_hz = f, \
3994 .src_clk = &s##_clk, \
3995 .md_val = MD8(8, m, 0, n), \
3996 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
3997 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003998 .extra_freq_data = (void *)p_r, \
3999 }
4000/* Switching TV freqs requires PLL reconfiguration. */
4001static struct clk_freq_tbl clk_tbl_tv[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004002 F_TV_GND( 0, gnd, 0, 1, 0, 0),
4003 F_TV( 25200000, hdmi_pll, 25200000, 1, 0, 0),
4004 F_TV( 27000000, hdmi_pll, 27000000, 1, 0, 0),
4005 F_TV( 27030000, hdmi_pll, 27030000, 1, 0, 0),
4006 F_TV( 74250000, hdmi_pll, 74250000, 1, 0, 0),
4007 F_TV(148500000, hdmi_pll, 148500000, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004008 F_END
4009};
4010
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004011static unsigned long fmax_tv_src_8064[MAX_VDD_LEVELS] __initdata = {
4012 [VDD_DIG_LOW] = 74250000,
4013 [VDD_DIG_NOMINAL] = 149000000
4014};
4015
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004016/*
4017 * Unlike other clocks, the TV rate is adjusted through PLL
4018 * re-programming. It is also routed through an MND divider.
4019 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08004020void set_rate_tv(struct rcg_clk *rcg, struct clk_freq_tbl *nf)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004021{
4022 unsigned long pll_rate = (unsigned long)nf->extra_freq_data;
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004023 if (pll_rate) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004024 hdmi_pll_set_rate(pll_rate);
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004025 hdmi_pll_clk.rate = pll_rate;
4026 }
Matt Wagantallf82f2942012-01-27 13:56:13 -08004027 set_rate_mnd(rcg, nf);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004028}
4029
4030static struct rcg_clk tv_src_clk = {
4031 .ns_reg = TV_NS_REG,
4032 .b = {
4033 .ctl_reg = TV_CC_REG,
4034 .halt_check = NOCHECK,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004035 .retain_reg = TV_CC_REG,
4036 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004037 },
4038 .md_reg = TV_MD_REG,
4039 .root_en_mask = BIT(2),
4040 .ns_mask = (BM(23, 16) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004041 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004042 .ctl_mask = BM(7, 6),
4043 .set_rate = set_rate_tv,
4044 .freq_tbl = clk_tbl_tv,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004045 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004046 .c = {
4047 .dbg_name = "tv_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004048 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004049 VDD_DIG_FMAX_MAP2(LOW, 27030000, NOMINAL, 149000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004050 CLK_INIT(tv_src_clk.c),
4051 },
4052};
4053
Tianyi Gou51918802012-01-26 14:05:43 -08004054static struct cdiv_clk tv_src_div_clk = {
4055 .b = {
4056 .ctl_reg = TV_NS_REG,
4057 .halt_check = NOCHECK,
4058 },
4059 .ns_reg = TV_NS_REG,
4060 .div_offset = 6,
4061 .max_div = 2,
4062 .c = {
4063 .dbg_name = "tv_src_div_clk",
4064 .ops = &clk_ops_cdiv,
4065 CLK_INIT(tv_src_div_clk.c),
Stephen Boydd51d5e82012-06-18 18:09:50 -07004066 .rate = ULONG_MAX,
Tianyi Gou51918802012-01-26 14:05:43 -08004067 },
4068};
4069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004070static struct branch_clk tv_enc_clk = {
4071 .b = {
4072 .ctl_reg = TV_CC_REG,
4073 .en_mask = BIT(8),
4074 .reset_reg = SW_RESET_CORE_REG,
4075 .reset_mask = BIT(0),
4076 .halt_reg = DBG_BUS_VEC_D_REG,
4077 .halt_bit = 9,
4078 },
4079 .parent = &tv_src_clk.c,
4080 .c = {
4081 .dbg_name = "tv_enc_clk",
4082 .ops = &clk_ops_branch,
4083 CLK_INIT(tv_enc_clk.c),
4084 },
4085};
4086
4087static struct branch_clk tv_dac_clk = {
4088 .b = {
4089 .ctl_reg = TV_CC_REG,
4090 .en_mask = BIT(10),
4091 .halt_reg = DBG_BUS_VEC_D_REG,
4092 .halt_bit = 10,
4093 },
4094 .parent = &tv_src_clk.c,
4095 .c = {
4096 .dbg_name = "tv_dac_clk",
4097 .ops = &clk_ops_branch,
4098 CLK_INIT(tv_dac_clk.c),
4099 },
4100};
4101
4102static struct branch_clk mdp_tv_clk = {
4103 .b = {
4104 .ctl_reg = TV_CC_REG,
4105 .en_mask = BIT(0),
4106 .reset_reg = SW_RESET_CORE_REG,
4107 .reset_mask = BIT(4),
4108 .halt_reg = DBG_BUS_VEC_D_REG,
4109 .halt_bit = 12,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004110 .retain_reg = TV_CC2_REG,
4111 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004112 },
4113 .parent = &tv_src_clk.c,
4114 .c = {
4115 .dbg_name = "mdp_tv_clk",
4116 .ops = &clk_ops_branch,
4117 CLK_INIT(mdp_tv_clk.c),
4118 },
4119};
4120
4121static struct branch_clk hdmi_tv_clk = {
4122 .b = {
4123 .ctl_reg = TV_CC_REG,
4124 .en_mask = BIT(12),
4125 .reset_reg = SW_RESET_CORE_REG,
4126 .reset_mask = BIT(1),
4127 .halt_reg = DBG_BUS_VEC_D_REG,
4128 .halt_bit = 11,
4129 },
4130 .parent = &tv_src_clk.c,
4131 .c = {
4132 .dbg_name = "hdmi_tv_clk",
4133 .ops = &clk_ops_branch,
4134 CLK_INIT(hdmi_tv_clk.c),
4135 },
4136};
4137
Tianyi Gou51918802012-01-26 14:05:43 -08004138static struct branch_clk rgb_tv_clk = {
4139 .b = {
4140 .ctl_reg = TV_CC2_REG,
4141 .en_mask = BIT(14),
4142 .halt_reg = DBG_BUS_VEC_J_REG,
4143 .halt_bit = 27,
4144 },
4145 .parent = &tv_src_clk.c,
4146 .c = {
4147 .dbg_name = "rgb_tv_clk",
4148 .ops = &clk_ops_branch,
4149 CLK_INIT(rgb_tv_clk.c),
4150 },
4151};
4152
4153static struct branch_clk npl_tv_clk = {
4154 .b = {
4155 .ctl_reg = TV_CC2_REG,
4156 .en_mask = BIT(16),
4157 .halt_reg = DBG_BUS_VEC_J_REG,
4158 .halt_bit = 26,
4159 },
4160 .parent = &tv_src_clk.c,
4161 .c = {
4162 .dbg_name = "npl_tv_clk",
4163 .ops = &clk_ops_branch,
4164 CLK_INIT(npl_tv_clk.c),
4165 },
4166};
4167
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004168static struct branch_clk hdmi_app_clk = {
4169 .b = {
4170 .ctl_reg = MISC_CC2_REG,
4171 .en_mask = BIT(11),
4172 .reset_reg = SW_RESET_CORE_REG,
4173 .reset_mask = BIT(11),
4174 .halt_reg = DBG_BUS_VEC_B_REG,
4175 .halt_bit = 25,
4176 },
4177 .c = {
4178 .dbg_name = "hdmi_app_clk",
4179 .ops = &clk_ops_branch,
4180 CLK_INIT(hdmi_app_clk.c),
4181 },
4182};
4183
4184static struct bank_masks bmnd_info_vcodec = {
4185 .bank_sel_mask = BIT(13),
4186 .bank0_mask = {
4187 .md_reg = VCODEC_MD0_REG,
4188 .ns_mask = BM(18, 11) | BM(2, 0),
4189 .rst_mask = BIT(31),
4190 .mnd_en_mask = BIT(5),
4191 .mode_mask = BM(7, 6),
4192 },
4193 .bank1_mask = {
4194 .md_reg = VCODEC_MD1_REG,
4195 .ns_mask = BM(26, 19) | BM(29, 27),
4196 .rst_mask = BIT(30),
4197 .mnd_en_mask = BIT(10),
4198 .mode_mask = BM(12, 11),
4199 },
4200};
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004201#define F_VCODEC(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004202 { \
4203 .freq_hz = f, \
4204 .src_clk = &s##_clk.c, \
4205 .md_val = MD8(8, m, 0, n), \
4206 .ns_val = NS_MND_BANKED8(11, 19, n, m, 0, 27, s##_to_mm_mux), \
4207 .ctl_val = CC_BANKED(6, 11, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004208 }
4209static struct clk_freq_tbl clk_tbl_vcodec[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004210 F_VCODEC( 0, gnd, 0, 0),
4211 F_VCODEC( 27000000, pxo, 0, 0),
4212 F_VCODEC( 32000000, pll8, 1, 12),
4213 F_VCODEC( 48000000, pll8, 1, 8),
4214 F_VCODEC( 54860000, pll8, 1, 7),
4215 F_VCODEC( 96000000, pll8, 1, 4),
4216 F_VCODEC(133330000, pll2, 1, 6),
4217 F_VCODEC(200000000, pll2, 1, 4),
4218 F_VCODEC(228570000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004219 F_END
4220};
4221
4222static struct rcg_clk vcodec_clk = {
4223 .b = {
4224 .ctl_reg = VCODEC_CC_REG,
4225 .en_mask = BIT(0),
4226 .reset_reg = SW_RESET_CORE_REG,
4227 .reset_mask = BIT(6),
4228 .halt_reg = DBG_BUS_VEC_C_REG,
4229 .halt_bit = 29,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004230 .retain_reg = VCODEC_CC_REG,
4231 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004232 },
4233 .ns_reg = VCODEC_NS_REG,
4234 .root_en_mask = BIT(2),
4235 .set_rate = set_rate_mnd_banked,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004236 .bank_info = &bmnd_info_vcodec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004237 .freq_tbl = clk_tbl_vcodec,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004238 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004239 .c = {
4240 .dbg_name = "vcodec_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004241 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004242 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
4243 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004244 CLK_INIT(vcodec_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004245 .depends = &vcodec_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004246 },
4247};
4248
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004249#define F_VPE(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004250 { \
4251 .freq_hz = f, \
4252 .src_clk = &s##_clk.c, \
4253 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004254 }
4255static struct clk_freq_tbl clk_tbl_vpe[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004256 F_VPE( 0, gnd, 1),
4257 F_VPE( 27000000, pxo, 1),
4258 F_VPE( 34909000, pll8, 11),
4259 F_VPE( 38400000, pll8, 10),
4260 F_VPE( 64000000, pll8, 6),
4261 F_VPE( 76800000, pll8, 5),
4262 F_VPE( 96000000, pll8, 4),
4263 F_VPE(100000000, pll2, 8),
4264 F_VPE(160000000, pll2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004265 F_END
4266};
4267
4268static struct rcg_clk vpe_clk = {
4269 .b = {
4270 .ctl_reg = VPE_CC_REG,
4271 .en_mask = BIT(0),
4272 .reset_reg = SW_RESET_CORE_REG,
4273 .reset_mask = BIT(17),
4274 .halt_reg = DBG_BUS_VEC_A_REG,
4275 .halt_bit = 28,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004276 .retain_reg = VPE_CC_REG,
4277 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004278 },
4279 .ns_reg = VPE_NS_REG,
4280 .root_en_mask = BIT(2),
4281 .ns_mask = (BM(15, 12) | BM(2, 0)),
4282 .set_rate = set_rate_nop,
4283 .freq_tbl = clk_tbl_vpe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004284 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004285 .c = {
4286 .dbg_name = "vpe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004287 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004288 VDD_DIG_FMAX_MAP2(LOW, 76800000, NOMINAL, 160000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004289 CLK_INIT(vpe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004290 .depends = &vpe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004291 },
4292};
4293
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004294#define F_VFE(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004295 { \
4296 .freq_hz = f, \
4297 .src_clk = &s##_clk.c, \
4298 .md_val = MD8(8, m, 0, n), \
4299 .ns_val = NS_MM(23, 16, n, m, 11, 10, d, 2, 0, s##_to_mm_mux), \
4300 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004301 }
Tianyi Gou41515e22011-09-01 19:37:43 -07004302
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004303static struct clk_freq_tbl clk_tbl_vfe[] = {
4304 F_VFE( 0, gnd, 1, 0, 0),
4305 F_VFE( 13960000, pll8, 1, 2, 55),
4306 F_VFE( 27000000, pxo, 1, 0, 0),
4307 F_VFE( 36570000, pll8, 1, 2, 21),
4308 F_VFE( 38400000, pll8, 2, 1, 5),
4309 F_VFE( 45180000, pll8, 1, 2, 17),
4310 F_VFE( 48000000, pll8, 2, 1, 4),
4311 F_VFE( 54860000, pll8, 1, 1, 7),
4312 F_VFE( 64000000, pll8, 2, 1, 3),
4313 F_VFE( 76800000, pll8, 1, 1, 5),
4314 F_VFE( 96000000, pll8, 2, 1, 2),
4315 F_VFE(109710000, pll8, 1, 2, 7),
4316 F_VFE(128000000, pll8, 1, 1, 3),
4317 F_VFE(153600000, pll8, 1, 2, 5),
4318 F_VFE(200000000, pll2, 2, 1, 2),
4319 F_VFE(228570000, pll2, 1, 2, 7),
4320 F_VFE(266667000, pll2, 1, 1, 3),
4321 F_VFE(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004322 F_END
4323};
4324
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004325static unsigned long fmax_vfe_8064[MAX_VDD_LEVELS] __initdata = {
4326 [VDD_DIG_LOW] = 128000000,
4327 [VDD_DIG_NOMINAL] = 266667000,
4328 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07004329};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004330
4331static struct rcg_clk vfe_clk = {
4332 .b = {
4333 .ctl_reg = VFE_CC_REG,
4334 .reset_reg = SW_RESET_CORE_REG,
4335 .reset_mask = BIT(15),
4336 .halt_reg = DBG_BUS_VEC_B_REG,
4337 .halt_bit = 6,
4338 .en_mask = BIT(0),
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004339 .retain_reg = VFE_CC2_REG,
4340 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004341 },
4342 .ns_reg = VFE_NS_REG,
4343 .md_reg = VFE_MD_REG,
4344 .root_en_mask = BIT(2),
4345 .ns_mask = (BM(23, 16) | BM(11, 10) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004346 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004347 .ctl_mask = BM(7, 6),
4348 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004349 .freq_tbl = clk_tbl_vfe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004350 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004351 .c = {
4352 .dbg_name = "vfe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004353 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08004354 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
4355 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004356 CLK_INIT(vfe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004357 .depends = &vfe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004358 },
4359};
4360
Matt Wagantallc23eee92011-08-16 23:06:52 -07004361static struct branch_clk csi_vfe_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004362 .b = {
4363 .ctl_reg = VFE_CC_REG,
4364 .en_mask = BIT(12),
4365 .reset_reg = SW_RESET_CORE_REG,
4366 .reset_mask = BIT(24),
4367 .halt_reg = DBG_BUS_VEC_B_REG,
4368 .halt_bit = 8,
4369 },
4370 .parent = &vfe_clk.c,
4371 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -07004372 .dbg_name = "csi_vfe_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004373 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -07004374 CLK_INIT(csi_vfe_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004375 },
4376};
4377
4378/*
4379 * Low Power Audio Clocks
4380 */
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004381#define F_AIF_OSR(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004382 { \
4383 .freq_hz = f, \
4384 .src_clk = &s##_clk.c, \
4385 .md_val = MD8(8, m, 0, n), \
4386 .ns_val = NS(31, 24, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004387 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004388static struct clk_freq_tbl clk_tbl_aif_osr_492[] = {
4389 F_AIF_OSR( 0, gnd, 1, 0, 0),
4390 F_AIF_OSR( 512000, pll4, 4, 1, 240),
4391 F_AIF_OSR( 768000, pll4, 4, 1, 160),
4392 F_AIF_OSR( 1024000, pll4, 4, 1, 120),
4393 F_AIF_OSR( 1536000, pll4, 4, 1, 80),
4394 F_AIF_OSR( 2048000, pll4, 4, 1, 60),
4395 F_AIF_OSR( 3072000, pll4, 4, 1, 40),
4396 F_AIF_OSR( 4096000, pll4, 4, 1, 30),
4397 F_AIF_OSR( 6144000, pll4, 4, 1, 20),
4398 F_AIF_OSR( 8192000, pll4, 4, 1, 15),
4399 F_AIF_OSR(12288000, pll4, 4, 1, 10),
4400 F_AIF_OSR(24576000, pll4, 4, 1, 5),
4401 F_END
4402};
4403
4404static struct clk_freq_tbl clk_tbl_aif_osr_393[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004405 F_AIF_OSR( 0, gnd, 1, 0, 0),
4406 F_AIF_OSR( 512000, pll4, 4, 1, 192),
4407 F_AIF_OSR( 768000, pll4, 4, 1, 128),
4408 F_AIF_OSR( 1024000, pll4, 4, 1, 96),
4409 F_AIF_OSR( 1536000, pll4, 4, 1, 64),
4410 F_AIF_OSR( 2048000, pll4, 4, 1, 48),
4411 F_AIF_OSR( 3072000, pll4, 4, 1, 32),
4412 F_AIF_OSR( 4096000, pll4, 4, 1, 24),
4413 F_AIF_OSR( 6144000, pll4, 4, 1, 16),
4414 F_AIF_OSR( 8192000, pll4, 4, 1, 12),
4415 F_AIF_OSR(12288000, pll4, 4, 1, 8),
4416 F_AIF_OSR(24576000, pll4, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004417 F_END
4418};
4419
4420#define CLK_AIF_OSR(i, ns, md, h_r) \
4421 struct rcg_clk i##_clk = { \
4422 .b = { \
4423 .ctl_reg = ns, \
4424 .en_mask = BIT(17), \
4425 .reset_reg = ns, \
4426 .reset_mask = BIT(19), \
4427 .halt_reg = h_r, \
4428 .halt_check = ENABLE, \
4429 .halt_bit = 1, \
4430 }, \
4431 .ns_reg = ns, \
4432 .md_reg = md, \
4433 .root_en_mask = BIT(9), \
4434 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004435 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004436 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004437 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004438 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004439 .c = { \
4440 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004441 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004442 VDD_DIG_FMAX_MAP1(LOW, 24576000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004443 CLK_INIT(i##_clk.c), \
4444 }, \
4445 }
4446#define CLK_AIF_OSR_DIV(i, ns, md, h_r) \
4447 struct rcg_clk i##_clk = { \
4448 .b = { \
4449 .ctl_reg = ns, \
4450 .en_mask = BIT(21), \
4451 .reset_reg = ns, \
4452 .reset_mask = BIT(23), \
4453 .halt_reg = h_r, \
4454 .halt_check = ENABLE, \
4455 .halt_bit = 1, \
4456 }, \
4457 .ns_reg = ns, \
4458 .md_reg = md, \
4459 .root_en_mask = BIT(9), \
4460 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004461 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004462 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004463 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004464 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004465 .c = { \
4466 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004467 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004468 VDD_DIG_FMAX_MAP1(LOW, 24576000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004469 CLK_INIT(i##_clk.c), \
4470 }, \
4471 }
4472
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004473#define CLK_AIF_BIT(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004474 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004475 .b = { \
4476 .ctl_reg = ns, \
4477 .en_mask = BIT(15), \
4478 .halt_reg = h_r, \
4479 .halt_check = DELAY, \
4480 }, \
4481 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004482 .ext_mask = BIT(14), \
4483 .div_offset = 10, \
4484 .max_div = 16, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004485 .c = { \
4486 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004487 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004488 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004489 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004490 }, \
4491 }
4492
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004493#define CLK_AIF_BIT_DIV(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004494 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004495 .b = { \
4496 .ctl_reg = ns, \
4497 .en_mask = BIT(19), \
4498 .halt_reg = h_r, \
Stephen Boyd7bb9cf82012-01-25 18:09:01 -08004499 .halt_check = DELAY, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004500 }, \
4501 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004502 .ext_mask = BIT(18), \
4503 .div_offset = 10, \
4504 .max_div = 256, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004505 .c = { \
4506 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004507 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004508 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004509 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004510 }, \
4511 }
4512
4513static CLK_AIF_OSR(mi2s_osr, LCC_MI2S_NS_REG, LCC_MI2S_MD_REG,
4514 LCC_MI2S_STATUS_REG);
4515static CLK_AIF_BIT(mi2s_bit, LCC_MI2S_NS_REG, LCC_MI2S_STATUS_REG);
4516
4517static CLK_AIF_OSR_DIV(codec_i2s_mic_osr, LCC_CODEC_I2S_MIC_NS_REG,
4518 LCC_CODEC_I2S_MIC_MD_REG, LCC_CODEC_I2S_MIC_STATUS_REG);
4519static CLK_AIF_BIT_DIV(codec_i2s_mic_bit, LCC_CODEC_I2S_MIC_NS_REG,
4520 LCC_CODEC_I2S_MIC_STATUS_REG);
4521
4522static CLK_AIF_OSR_DIV(spare_i2s_mic_osr, LCC_SPARE_I2S_MIC_NS_REG,
4523 LCC_SPARE_I2S_MIC_MD_REG, LCC_SPARE_I2S_MIC_STATUS_REG);
4524static CLK_AIF_BIT_DIV(spare_i2s_mic_bit, LCC_SPARE_I2S_MIC_NS_REG,
4525 LCC_SPARE_I2S_MIC_STATUS_REG);
4526
4527static CLK_AIF_OSR_DIV(codec_i2s_spkr_osr, LCC_CODEC_I2S_SPKR_NS_REG,
4528 LCC_CODEC_I2S_SPKR_MD_REG, LCC_CODEC_I2S_SPKR_STATUS_REG);
4529static CLK_AIF_BIT_DIV(codec_i2s_spkr_bit, LCC_CODEC_I2S_SPKR_NS_REG,
4530 LCC_CODEC_I2S_SPKR_STATUS_REG);
4531
4532static CLK_AIF_OSR_DIV(spare_i2s_spkr_osr, LCC_SPARE_I2S_SPKR_NS_REG,
4533 LCC_SPARE_I2S_SPKR_MD_REG, LCC_SPARE_I2S_SPKR_STATUS_REG);
4534static CLK_AIF_BIT_DIV(spare_i2s_spkr_bit, LCC_SPARE_I2S_SPKR_NS_REG,
4535 LCC_SPARE_I2S_SPKR_STATUS_REG);
4536
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004537#define F_PCM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004538 { \
4539 .freq_hz = f, \
4540 .src_clk = &s##_clk.c, \
4541 .md_val = MD16(m, n), \
4542 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004543 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004544static struct clk_freq_tbl clk_tbl_pcm_492[] = {
4545 { .ns_val = BIT(10) /* external input */ },
4546 F_PCM( 512000, pll4, 4, 1, 240),
4547 F_PCM( 768000, pll4, 4, 1, 160),
4548 F_PCM( 1024000, pll4, 4, 1, 120),
4549 F_PCM( 1536000, pll4, 4, 1, 80),
4550 F_PCM( 2048000, pll4, 4, 1, 60),
4551 F_PCM( 3072000, pll4, 4, 1, 40),
4552 F_PCM( 4096000, pll4, 4, 1, 30),
4553 F_PCM( 6144000, pll4, 4, 1, 20),
4554 F_PCM( 8192000, pll4, 4, 1, 15),
4555 F_PCM(12288000, pll4, 4, 1, 10),
4556 F_PCM(24576000, pll4, 4, 1, 5),
4557 F_END
4558};
4559
4560static struct clk_freq_tbl clk_tbl_pcm_393[] = {
Stephen Boyd630f3252012-01-31 00:10:08 -08004561 { .ns_val = BIT(10) /* external input */ },
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004562 F_PCM( 512000, pll4, 4, 1, 192),
4563 F_PCM( 768000, pll4, 4, 1, 128),
4564 F_PCM( 1024000, pll4, 4, 1, 96),
4565 F_PCM( 1536000, pll4, 4, 1, 64),
4566 F_PCM( 2048000, pll4, 4, 1, 48),
4567 F_PCM( 3072000, pll4, 4, 1, 32),
4568 F_PCM( 4096000, pll4, 4, 1, 24),
4569 F_PCM( 6144000, pll4, 4, 1, 16),
4570 F_PCM( 8192000, pll4, 4, 1, 12),
4571 F_PCM(12288000, pll4, 4, 1, 8),
4572 F_PCM(24576000, pll4, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004573 F_END
4574};
4575
4576static struct rcg_clk pcm_clk = {
4577 .b = {
4578 .ctl_reg = LCC_PCM_NS_REG,
4579 .en_mask = BIT(11),
4580 .reset_reg = LCC_PCM_NS_REG,
4581 .reset_mask = BIT(13),
4582 .halt_reg = LCC_PCM_STATUS_REG,
4583 .halt_check = ENABLE,
4584 .halt_bit = 0,
4585 },
4586 .ns_reg = LCC_PCM_NS_REG,
4587 .md_reg = LCC_PCM_MD_REG,
4588 .root_en_mask = BIT(9),
Stephen Boyd630f3252012-01-31 00:10:08 -08004589 .ns_mask = BM(31, 16) | BIT(10) | BM(6, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08004590 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004591 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004592 .freq_tbl = clk_tbl_pcm_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004593 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004594 .c = {
4595 .dbg_name = "pcm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004596 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004597 VDD_DIG_FMAX_MAP1(LOW, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004598 CLK_INIT(pcm_clk.c),
Stephen Boydc5492fc2012-06-18 18:47:03 -07004599 .rate = ULONG_MAX,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004600 },
4601};
4602
4603static struct rcg_clk audio_slimbus_clk = {
4604 .b = {
4605 .ctl_reg = LCC_SLIMBUS_NS_REG,
4606 .en_mask = BIT(10),
4607 .reset_reg = LCC_AHBEX_BRANCH_CTL_REG,
4608 .reset_mask = BIT(5),
4609 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4610 .halt_check = ENABLE,
4611 .halt_bit = 0,
4612 },
4613 .ns_reg = LCC_SLIMBUS_NS_REG,
4614 .md_reg = LCC_SLIMBUS_MD_REG,
4615 .root_en_mask = BIT(9),
4616 .ns_mask = (BM(31, 24) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004617 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004618 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004619 .freq_tbl = clk_tbl_aif_osr_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004620 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004621 .c = {
4622 .dbg_name = "audio_slimbus_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004623 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004624 VDD_DIG_FMAX_MAP1(LOW, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004625 CLK_INIT(audio_slimbus_clk.c),
4626 },
4627};
4628
4629static struct branch_clk sps_slimbus_clk = {
4630 .b = {
4631 .ctl_reg = LCC_SLIMBUS_NS_REG,
4632 .en_mask = BIT(12),
4633 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4634 .halt_check = ENABLE,
4635 .halt_bit = 1,
4636 },
4637 .parent = &audio_slimbus_clk.c,
4638 .c = {
4639 .dbg_name = "sps_slimbus_clk",
4640 .ops = &clk_ops_branch,
4641 CLK_INIT(sps_slimbus_clk.c),
4642 },
4643};
4644
4645static struct branch_clk slimbus_xo_src_clk = {
4646 .b = {
4647 .ctl_reg = SLIMBUS_XO_SRC_CLK_CTL_REG,
4648 .en_mask = BIT(2),
4649 .halt_reg = CLK_HALT_DFAB_STATE_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004650 .halt_bit = 28,
4651 },
4652 .parent = &sps_slimbus_clk.c,
4653 .c = {
4654 .dbg_name = "slimbus_xo_src_clk",
4655 .ops = &clk_ops_branch,
4656 CLK_INIT(slimbus_xo_src_clk.c),
4657 },
4658};
4659
Matt Wagantall735f01a2011-08-12 12:40:28 -07004660DEFINE_CLK_RPM(afab_clk, afab_a_clk, APPS_FABRIC, NULL);
4661DEFINE_CLK_RPM(cfpb_clk, cfpb_a_clk, CFPB, NULL);
4662DEFINE_CLK_RPM(dfab_clk, dfab_a_clk, DAYTONA_FABRIC, NULL);
4663DEFINE_CLK_RPM(ebi1_clk, ebi1_a_clk, EBI1, NULL);
4664DEFINE_CLK_RPM(mmfab_clk, mmfab_a_clk, MM_FABRIC, NULL);
4665DEFINE_CLK_RPM(mmfpb_clk, mmfpb_a_clk, MMFPB, NULL);
4666DEFINE_CLK_RPM(sfab_clk, sfab_a_clk, SYSTEM_FABRIC, NULL);
4667DEFINE_CLK_RPM(sfpb_clk, sfpb_a_clk, SFPB, NULL);
Stephen Boydc7fc3b12012-05-17 14:42:46 -07004668DEFINE_CLK_RPM_QDSS(qdss_clk, qdss_a_clk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004669
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004670static DEFINE_CLK_VOTER(sfab_msmbus_a_clk, &sfab_a_clk.c, 0);
4671static DEFINE_CLK_VOTER(sfab_tmr_a_clk, &sfab_a_clk.c, 0);
Stephen Boydd7a143a2012-02-16 17:59:26 -08004672
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004673static DEFINE_CLK_VOTER(dfab_dsps_clk, &dfab_clk.c, 0);
4674static DEFINE_CLK_VOTER(dfab_usb_hs_clk, &dfab_clk.c, 0);
4675static DEFINE_CLK_VOTER(dfab_usb_hs3_clk, &dfab_clk.c, 0);
4676static DEFINE_CLK_VOTER(dfab_usb_hs4_clk, &dfab_clk.c, 0);
4677static DEFINE_CLK_VOTER(dfab_sdc1_clk, &dfab_clk.c, 0);
4678static DEFINE_CLK_VOTER(dfab_sdc2_clk, &dfab_clk.c, 0);
4679static DEFINE_CLK_VOTER(dfab_sdc3_clk, &dfab_clk.c, 0);
4680static DEFINE_CLK_VOTER(dfab_sdc4_clk, &dfab_clk.c, 0);
4681static DEFINE_CLK_VOTER(dfab_sdc5_clk, &dfab_clk.c, 0);
4682static DEFINE_CLK_VOTER(dfab_sps_clk, &dfab_clk.c, 0);
4683static DEFINE_CLK_VOTER(dfab_bam_dmux_clk, &dfab_clk.c, 0);
4684static DEFINE_CLK_VOTER(dfab_scm_clk, &dfab_clk.c, 0);
4685static DEFINE_CLK_VOTER(dfab_qseecom_clk, &dfab_clk.c, 0);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004686static DEFINE_CLK_VOTER(dfab_msmbus_clk, &dfab_clk.c, 0);
4687static DEFINE_CLK_VOTER(dfab_msmbus_a_clk, &dfab_a_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004688
Matt Wagantall42cd12a2012-03-30 18:02:40 -07004689static DEFINE_CLK_VOTER(ebi1_msmbus_clk, &ebi1_clk.c, LONG_MAX);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004690static DEFINE_CLK_VOTER(ebi1_adm_clk, &ebi1_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004691
Matt Wagantall33bac7e2012-05-22 14:59:05 -07004692static DEFINE_CLK_VOTER(ebi1_acpu_a_clk, &ebi1_a_clk.c, LONG_MAX);
4693static DEFINE_CLK_VOTER(ebi1_msmbus_a_clk, &ebi1_a_clk.c, LONG_MAX);
4694static DEFINE_CLK_VOTER(afab_acpu_a_clk, &afab_a_clk.c, LONG_MAX);
4695static DEFINE_CLK_VOTER(afab_msmbus_a_clk, &afab_a_clk.c, LONG_MAX);
4696
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004697#ifdef CONFIG_DEBUG_FS
4698struct measure_sel {
4699 u32 test_vector;
Matt Wagantallf82f2942012-01-27 13:56:13 -08004700 struct clk *c;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004701};
4702
Matt Wagantall8b38f942011-08-02 18:23:18 -07004703static DEFINE_CLK_MEASURE(l2_m_clk);
4704static DEFINE_CLK_MEASURE(krait0_m_clk);
4705static DEFINE_CLK_MEASURE(krait1_m_clk);
Tianyi Gou455c13c2012-02-02 16:33:24 -08004706static DEFINE_CLK_MEASURE(krait2_m_clk);
4707static DEFINE_CLK_MEASURE(krait3_m_clk);
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004708static DEFINE_CLK_MEASURE(q6sw_clk);
4709static DEFINE_CLK_MEASURE(q6fw_clk);
4710static DEFINE_CLK_MEASURE(q6_func_clk);
Matt Wagantall8b38f942011-08-02 18:23:18 -07004711
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004712static struct measure_sel measure_mux[] = {
4713 { TEST_PER_LS(0x08), &slimbus_xo_src_clk.c },
4714 { TEST_PER_LS(0x12), &sdc1_p_clk.c },
4715 { TEST_PER_LS(0x13), &sdc1_clk.c },
4716 { TEST_PER_LS(0x14), &sdc2_p_clk.c },
4717 { TEST_PER_LS(0x15), &sdc2_clk.c },
4718 { TEST_PER_LS(0x16), &sdc3_p_clk.c },
4719 { TEST_PER_LS(0x17), &sdc3_clk.c },
4720 { TEST_PER_LS(0x18), &sdc4_p_clk.c },
4721 { TEST_PER_LS(0x19), &sdc4_clk.c },
4722 { TEST_PER_LS(0x1A), &sdc5_p_clk.c },
4723 { TEST_PER_LS(0x1B), &sdc5_clk.c },
Matt Wagantall7625a4c2011-11-01 16:17:53 -07004724 { TEST_PER_LS(0x1F), &gp0_clk.c },
4725 { TEST_PER_LS(0x20), &gp1_clk.c },
4726 { TEST_PER_LS(0x21), &gp2_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004727 { TEST_PER_LS(0x25), &dfab_clk.c },
4728 { TEST_PER_LS(0x25), &dfab_a_clk.c },
4729 { TEST_PER_LS(0x26), &pmem_clk.c },
4730 { TEST_PER_LS(0x32), &dma_bam_p_clk.c },
4731 { TEST_PER_LS(0x33), &cfpb_clk.c },
4732 { TEST_PER_LS(0x33), &cfpb_a_clk.c },
4733 { TEST_PER_LS(0x3D), &gsbi1_p_clk.c },
4734 { TEST_PER_LS(0x3E), &gsbi1_uart_clk.c },
4735 { TEST_PER_LS(0x3F), &gsbi1_qup_clk.c },
4736 { TEST_PER_LS(0x41), &gsbi2_p_clk.c },
4737 { TEST_PER_LS(0x42), &gsbi2_uart_clk.c },
4738 { TEST_PER_LS(0x44), &gsbi2_qup_clk.c },
4739 { TEST_PER_LS(0x45), &gsbi3_p_clk.c },
4740 { TEST_PER_LS(0x46), &gsbi3_uart_clk.c },
4741 { TEST_PER_LS(0x48), &gsbi3_qup_clk.c },
4742 { TEST_PER_LS(0x49), &gsbi4_p_clk.c },
4743 { TEST_PER_LS(0x4A), &gsbi4_uart_clk.c },
4744 { TEST_PER_LS(0x4C), &gsbi4_qup_clk.c },
4745 { TEST_PER_LS(0x4D), &gsbi5_p_clk.c },
4746 { TEST_PER_LS(0x4E), &gsbi5_uart_clk.c },
4747 { TEST_PER_LS(0x50), &gsbi5_qup_clk.c },
4748 { TEST_PER_LS(0x51), &gsbi6_p_clk.c },
4749 { TEST_PER_LS(0x52), &gsbi6_uart_clk.c },
4750 { TEST_PER_LS(0x54), &gsbi6_qup_clk.c },
4751 { TEST_PER_LS(0x55), &gsbi7_p_clk.c },
4752 { TEST_PER_LS(0x56), &gsbi7_uart_clk.c },
4753 { TEST_PER_LS(0x58), &gsbi7_qup_clk.c },
4754 { TEST_PER_LS(0x59), &gsbi8_p_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004755 { TEST_PER_LS(0x59), &sfab_sata_s_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004756 { TEST_PER_LS(0x5A), &gsbi8_uart_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004757 { TEST_PER_LS(0x5A), &sata_p_clk.c },
4758 { TEST_PER_LS(0x5B), &sata_rxoob_clk.c },
4759 { TEST_PER_LS(0x5C), &sata_pmalive_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004760 { TEST_PER_LS(0x5C), &gsbi8_qup_clk.c },
4761 { TEST_PER_LS(0x5D), &gsbi9_p_clk.c },
4762 { TEST_PER_LS(0x5E), &gsbi9_uart_clk.c },
4763 { TEST_PER_LS(0x60), &gsbi9_qup_clk.c },
4764 { TEST_PER_LS(0x61), &gsbi10_p_clk.c },
4765 { TEST_PER_LS(0x62), &gsbi10_uart_clk.c },
4766 { TEST_PER_LS(0x64), &gsbi10_qup_clk.c },
4767 { TEST_PER_LS(0x65), &gsbi11_p_clk.c },
4768 { TEST_PER_LS(0x66), &gsbi11_uart_clk.c },
4769 { TEST_PER_LS(0x68), &gsbi11_qup_clk.c },
4770 { TEST_PER_LS(0x69), &gsbi12_p_clk.c },
4771 { TEST_PER_LS(0x6A), &gsbi12_uart_clk.c },
4772 { TEST_PER_LS(0x6C), &gsbi12_qup_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004773 { TEST_PER_LS(0x5E), &pcie_p_clk.c },
4774 { TEST_PER_LS(0x5F), &ce3_p_clk.c },
4775 { TEST_PER_LS(0x60), &ce3_core_clk.c },
4776 { TEST_PER_LS(0x63), &usb_hs3_p_clk.c },
4777 { TEST_PER_LS(0x64), &usb_hs3_xcvr_clk.c },
4778 { TEST_PER_LS(0x65), &usb_hs4_p_clk.c },
4779 { TEST_PER_LS(0x66), &usb_hs4_xcvr_clk.c },
4780 { TEST_PER_LS(0x6B), &sata_phy_ref_clk.c },
4781 { TEST_PER_LS(0x6C), &sata_phy_cfg_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004782 { TEST_PER_LS(0x78), &sfpb_clk.c },
4783 { TEST_PER_LS(0x78), &sfpb_a_clk.c },
4784 { TEST_PER_LS(0x7A), &pmic_ssbi2_clk.c },
4785 { TEST_PER_LS(0x7B), &pmic_arb0_p_clk.c },
4786 { TEST_PER_LS(0x7C), &pmic_arb1_p_clk.c },
4787 { TEST_PER_LS(0x7D), &prng_clk.c },
4788 { TEST_PER_LS(0x7F), &rpm_msg_ram_p_clk.c },
4789 { TEST_PER_LS(0x80), &adm0_p_clk.c },
4790 { TEST_PER_LS(0x84), &usb_hs1_p_clk.c },
4791 { TEST_PER_LS(0x85), &usb_hs1_xcvr_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004792 { TEST_PER_LS(0x86), &usb_hsic_p_clk.c },
4793 { TEST_PER_LS(0x87), &usb_hsic_system_clk.c },
4794 { TEST_PER_LS(0x88), &usb_hsic_xcvr_fs_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004795 { TEST_PER_LS(0x89), &usb_fs1_p_clk.c },
4796 { TEST_PER_LS(0x8A), &usb_fs1_sys_clk.c },
4797 { TEST_PER_LS(0x8B), &usb_fs1_xcvr_clk.c },
4798 { TEST_PER_LS(0x8C), &usb_fs2_p_clk.c },
4799 { TEST_PER_LS(0x8D), &usb_fs2_sys_clk.c },
4800 { TEST_PER_LS(0x8E), &usb_fs2_xcvr_clk.c },
4801 { TEST_PER_LS(0x8F), &tsif_p_clk.c },
4802 { TEST_PER_LS(0x91), &tsif_ref_clk.c },
4803 { TEST_PER_LS(0x92), &ce1_p_clk.c },
4804 { TEST_PER_LS(0x94), &tssc_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004805 { TEST_PER_LS(0x9D), &usb_hsic_hsio_cal_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004806 { TEST_PER_LS(0xA4), &ce1_core_clk.c },
4807
4808 { TEST_PER_HS(0x07), &afab_clk.c },
4809 { TEST_PER_HS(0x07), &afab_a_clk.c },
4810 { TEST_PER_HS(0x18), &sfab_clk.c },
4811 { TEST_PER_HS(0x18), &sfab_a_clk.c },
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004812 { TEST_PER_HS(0x26), &q6sw_clk },
4813 { TEST_PER_HS(0x27), &q6fw_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004814 { TEST_PER_HS(0x2A), &adm0_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004815 { TEST_PER_HS(0x31), &sata_a_clk.c },
Tianyi Gou6613de52012-01-27 17:57:53 -08004816 { TEST_PER_HS(0x2D), &pcie_phy_ref_clk.c },
4817 { TEST_PER_HS(0x32), &pcie_a_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004818 { TEST_PER_HS(0x34), &ebi1_clk.c },
4819 { TEST_PER_HS(0x34), &ebi1_a_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004820 { TEST_PER_HS(0x50), &usb_hsic_hsic_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004821
4822 { TEST_MM_LS(0x00), &dsi1_byte_clk.c },
4823 { TEST_MM_LS(0x01), &dsi2_byte_clk.c },
4824 { TEST_MM_LS(0x02), &cam1_clk.c },
4825 { TEST_MM_LS(0x06), &amp_p_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004826 { TEST_MM_LS(0x07), &csi_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004827 { TEST_MM_LS(0x08), &dsi2_s_p_clk.c },
4828 { TEST_MM_LS(0x09), &dsi1_m_p_clk.c },
4829 { TEST_MM_LS(0x0A), &dsi1_s_p_clk.c },
4830 { TEST_MM_LS(0x0C), &gfx2d0_p_clk.c },
4831 { TEST_MM_LS(0x0D), &gfx2d1_p_clk.c },
4832 { TEST_MM_LS(0x0E), &gfx3d_p_clk.c },
4833 { TEST_MM_LS(0x0F), &hdmi_m_p_clk.c },
4834 { TEST_MM_LS(0x10), &hdmi_s_p_clk.c },
4835 { TEST_MM_LS(0x11), &ijpeg_p_clk.c },
4836 { TEST_MM_LS(0x12), &imem_p_clk.c },
4837 { TEST_MM_LS(0x13), &jpegd_p_clk.c },
4838 { TEST_MM_LS(0x14), &mdp_p_clk.c },
4839 { TEST_MM_LS(0x16), &rot_p_clk.c },
4840 { TEST_MM_LS(0x17), &dsi1_esc_clk.c },
4841 { TEST_MM_LS(0x18), &smmu_p_clk.c },
4842 { TEST_MM_LS(0x19), &tv_enc_p_clk.c },
4843 { TEST_MM_LS(0x1A), &vcodec_p_clk.c },
4844 { TEST_MM_LS(0x1B), &vfe_p_clk.c },
4845 { TEST_MM_LS(0x1C), &vpe_p_clk.c },
4846 { TEST_MM_LS(0x1D), &cam0_clk.c },
4847 { TEST_MM_LS(0x1F), &hdmi_app_clk.c },
4848 { TEST_MM_LS(0x20), &mdp_vsync_clk.c },
4849 { TEST_MM_LS(0x21), &tv_dac_clk.c },
4850 { TEST_MM_LS(0x22), &tv_enc_clk.c },
4851 { TEST_MM_LS(0x23), &dsi2_esc_clk.c },
4852 { TEST_MM_LS(0x25), &mmfpb_clk.c },
4853 { TEST_MM_LS(0x25), &mmfpb_a_clk.c },
4854 { TEST_MM_LS(0x26), &dsi2_m_p_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004855 { TEST_MM_LS(0x27), &cam2_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004856 { TEST_MM_LS(0x28), &vcap_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004857
4858 { TEST_MM_HS(0x00), &csi0_clk.c },
4859 { TEST_MM_HS(0x01), &csi1_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004860 { TEST_MM_HS(0x04), &csi_vfe_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004861 { TEST_MM_HS(0x05), &ijpeg_clk.c },
4862 { TEST_MM_HS(0x06), &vfe_clk.c },
4863 { TEST_MM_HS(0x07), &gfx2d0_clk.c },
4864 { TEST_MM_HS(0x08), &gfx2d1_clk.c },
4865 { TEST_MM_HS(0x09), &gfx3d_clk.c },
4866 { TEST_MM_HS(0x0A), &jpegd_clk.c },
4867 { TEST_MM_HS(0x0B), &vcodec_clk.c },
4868 { TEST_MM_HS(0x0F), &mmfab_clk.c },
4869 { TEST_MM_HS(0x0F), &mmfab_a_clk.c },
4870 { TEST_MM_HS(0x11), &gmem_axi_clk.c },
4871 { TEST_MM_HS(0x12), &ijpeg_axi_clk.c },
4872 { TEST_MM_HS(0x13), &imem_axi_clk.c },
4873 { TEST_MM_HS(0x14), &jpegd_axi_clk.c },
4874 { TEST_MM_HS(0x15), &mdp_axi_clk.c },
4875 { TEST_MM_HS(0x16), &rot_axi_clk.c },
4876 { TEST_MM_HS(0x17), &vcodec_axi_clk.c },
4877 { TEST_MM_HS(0x18), &vfe_axi_clk.c },
4878 { TEST_MM_HS(0x19), &vpe_axi_clk.c },
4879 { TEST_MM_HS(0x1A), &mdp_clk.c },
4880 { TEST_MM_HS(0x1B), &rot_clk.c },
4881 { TEST_MM_HS(0x1C), &vpe_clk.c },
4882 { TEST_MM_HS(0x1E), &hdmi_tv_clk.c },
4883 { TEST_MM_HS(0x1F), &mdp_tv_clk.c },
4884 { TEST_MM_HS(0x24), &csi0_phy_clk.c },
4885 { TEST_MM_HS(0x25), &csi1_phy_clk.c },
4886 { TEST_MM_HS(0x26), &csi_pix_clk.c },
4887 { TEST_MM_HS(0x27), &csi_rdi_clk.c },
4888 { TEST_MM_HS(0x28), &lut_mdp_clk.c },
4889 { TEST_MM_HS(0x29), &vcodec_axi_a_clk.c },
4890 { TEST_MM_HS(0x2A), &vcodec_axi_b_clk.c },
4891 { TEST_MM_HS(0x2B), &csi1phy_timer_clk.c },
4892 { TEST_MM_HS(0x2C), &csi0phy_timer_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004893 { TEST_MM_HS(0x2D), &csi2_clk.c },
4894 { TEST_MM_HS(0x2E), &csi2_phy_clk.c },
4895 { TEST_MM_HS(0x2F), &csi2phy_timer_clk.c },
4896 { TEST_MM_HS(0x30), &csi_pix1_clk.c },
4897 { TEST_MM_HS(0x31), &csi_rdi1_clk.c },
4898 { TEST_MM_HS(0x32), &csi_rdi2_clk.c },
Tianyi Gou621f8742011-09-01 21:45:01 -07004899 { TEST_MM_HS(0x33), &vcap_clk.c },
4900 { TEST_MM_HS(0x34), &vcap_npl_clk.c },
Tianyi Goue3d4f542012-03-15 17:06:45 -07004901 { TEST_MM_HS(0x34), &gfx3d_axi_clk_8930.c },
Tianyi Gou7747a962012-02-03 15:03:55 -08004902 { TEST_MM_HS(0x35), &vcap_axi_clk.c },
Tianyi Gou51918802012-01-26 14:05:43 -08004903 { TEST_MM_HS(0x36), &rgb_tv_clk.c },
4904 { TEST_MM_HS(0x37), &npl_tv_clk.c },
Patrick Dalye6f489042012-07-11 15:29:15 -07004905 { TEST_MM_HS(0x38), &gfx3d_axi_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004906
4907 { TEST_LPA(0x0F), &mi2s_bit_clk.c },
4908 { TEST_LPA(0x10), &codec_i2s_mic_bit_clk.c },
4909 { TEST_LPA(0x11), &codec_i2s_spkr_bit_clk.c },
4910 { TEST_LPA(0x12), &spare_i2s_mic_bit_clk.c },
4911 { TEST_LPA(0x13), &spare_i2s_spkr_bit_clk.c },
4912 { TEST_LPA(0x14), &pcm_clk.c },
4913 { TEST_LPA(0x1D), &audio_slimbus_clk.c },
Matt Wagantall8b38f942011-08-02 18:23:18 -07004914
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004915 { TEST_LPA_HS(0x00), &q6_func_clk },
4916
Stephen Boyd46fdf0d2011-11-22 12:25:09 -08004917 { TEST_CPUL2(0x2), &l2_m_clk },
4918 { TEST_CPUL2(0x0), &krait0_m_clk },
4919 { TEST_CPUL2(0x1), &krait1_m_clk },
Tianyi Gou455c13c2012-02-02 16:33:24 -08004920 { TEST_CPUL2(0x4), &krait2_m_clk },
4921 { TEST_CPUL2(0x5), &krait3_m_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004922};
4923
Matt Wagantallf82f2942012-01-27 13:56:13 -08004924static struct measure_sel *find_measure_sel(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004925{
4926 int i;
4927
4928 for (i = 0; i < ARRAY_SIZE(measure_mux); i++)
Matt Wagantallf82f2942012-01-27 13:56:13 -08004929 if (measure_mux[i].c == c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004930 return &measure_mux[i];
4931 return NULL;
4932}
4933
Matt Wagantall8b38f942011-08-02 18:23:18 -07004934static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004935{
4936 int ret = 0;
4937 u32 clk_sel;
4938 struct measure_sel *p;
Matt Wagantallf82f2942012-01-27 13:56:13 -08004939 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004940 unsigned long flags;
4941
4942 if (!parent)
4943 return -EINVAL;
4944
4945 p = find_measure_sel(parent);
4946 if (!p)
4947 return -EINVAL;
4948
4949 spin_lock_irqsave(&local_clock_reg_lock, flags);
4950
Matt Wagantall8b38f942011-08-02 18:23:18 -07004951 /*
4952 * Program the test vector, measurement period (sample_ticks)
4953 * and scaling multiplier.
4954 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08004955 measure->sample_ticks = 0x10000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004956 clk_sel = p->test_vector & TEST_CLK_SEL_MASK;
Matt Wagantallf82f2942012-01-27 13:56:13 -08004957 measure->multiplier = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004958 switch (p->test_vector >> TEST_TYPE_SHIFT) {
4959 case TEST_TYPE_PER_LS:
4960 writel_relaxed(0x4030D00|BVAL(7, 0, clk_sel), CLK_TEST_REG);
4961 break;
4962 case TEST_TYPE_PER_HS:
4963 writel_relaxed(0x4020000|BVAL(16, 10, clk_sel), CLK_TEST_REG);
4964 break;
4965 case TEST_TYPE_MM_LS:
4966 writel_relaxed(0x4030D97, CLK_TEST_REG);
4967 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_LS_REG);
4968 break;
4969 case TEST_TYPE_MM_HS:
4970 writel_relaxed(0x402B800, CLK_TEST_REG);
4971 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_HS_REG);
4972 break;
4973 case TEST_TYPE_LPA:
4974 writel_relaxed(0x4030D98, CLK_TEST_REG);
4975 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0),
4976 LCC_CLK_LS_DEBUG_CFG_REG);
4977 break;
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004978 case TEST_TYPE_LPA_HS:
4979 writel_relaxed(0x402BC00, CLK_TEST_REG);
4980 writel_relaxed(BVAL(2, 1, clk_sel)|BIT(0),
4981 LCC_CLK_HS_DEBUG_CFG_REG);
4982 break;
Matt Wagantall8b38f942011-08-02 18:23:18 -07004983 case TEST_TYPE_CPUL2:
4984 writel_relaxed(0x4030400, CLK_TEST_REG);
4985 writel_relaxed(0x80|BVAL(5, 3, clk_sel), GCC_APCS_CLK_DIAG);
Matt Wagantallf82f2942012-01-27 13:56:13 -08004986 measure->sample_ticks = 0x4000;
4987 measure->multiplier = 2;
Matt Wagantall8b38f942011-08-02 18:23:18 -07004988 break;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004989 default:
4990 ret = -EPERM;
4991 }
4992 /* Make sure test vector is set before starting measurements. */
4993 mb();
4994
4995 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4996
4997 return ret;
4998}
4999
5000/* Sample clock for 'ticks' reference clock ticks. */
5001static u32 run_measurement(unsigned ticks)
5002{
5003 /* Stop counters and set the XO4 counter start value. */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005004 writel_relaxed(ticks, RINGOSC_TCXO_CTL_REG);
5005
5006 /* Wait for timer to become ready. */
5007 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) != 0)
5008 cpu_relax();
5009
5010 /* Run measurement and wait for completion. */
5011 writel_relaxed(BIT(20)|ticks, RINGOSC_TCXO_CTL_REG);
5012 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) == 0)
5013 cpu_relax();
5014
5015 /* Stop counters. */
5016 writel_relaxed(0x0, RINGOSC_TCXO_CTL_REG);
5017
5018 /* Return measured ticks. */
5019 return readl_relaxed(RINGOSC_STATUS_REG) & BM(24, 0);
5020}
5021
5022
5023/* Perform a hardware rate measurement for a given clock.
5024 FOR DEBUG USE ONLY: Measurements take ~15 ms! */
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07005025static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005026{
5027 unsigned long flags;
5028 u32 pdm_reg_backup, ringosc_reg_backup;
5029 u64 raw_count_short, raw_count_full;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005030 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005031 unsigned ret;
5032
Stephen Boyde334aeb2012-01-24 12:17:29 -08005033 ret = clk_prepare_enable(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005034 if (ret) {
5035 pr_warning("CXO clock failed to enable. Can't measure\n");
5036 return 0;
5037 }
5038
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005039 spin_lock_irqsave(&local_clock_reg_lock, flags);
5040
5041 /* Enable CXO/4 and RINGOSC branch and root. */
5042 pdm_reg_backup = readl_relaxed(PDM_CLK_NS_REG);
5043 ringosc_reg_backup = readl_relaxed(RINGOSC_NS_REG);
5044 writel_relaxed(0x2898, PDM_CLK_NS_REG);
5045 writel_relaxed(0xA00, RINGOSC_NS_REG);
5046
5047 /*
5048 * The ring oscillator counter will not reset if the measured clock
5049 * is not running. To detect this, run a short measurement before
5050 * the full measurement. If the raw results of the two are the same
5051 * then the clock must be off.
5052 */
5053
5054 /* Run a short measurement. (~1 ms) */
5055 raw_count_short = run_measurement(0x1000);
5056 /* Run a full measurement. (~14 ms) */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005057 raw_count_full = run_measurement(measure->sample_ticks);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005058
5059 writel_relaxed(ringosc_reg_backup, RINGOSC_NS_REG);
5060 writel_relaxed(pdm_reg_backup, PDM_CLK_NS_REG);
5061
5062 /* Return 0 if the clock is off. */
5063 if (raw_count_full == raw_count_short)
5064 ret = 0;
5065 else {
5066 /* Compute rate in Hz. */
5067 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005068 do_div(raw_count_full, ((measure->sample_ticks * 10) + 35));
5069 ret = (raw_count_full * measure->multiplier);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005070 }
5071
5072 /* Route dbg_hs_clk to PLLTEST. 300mV single-ended amplitude. */
Stephen Boyd69da8402011-07-14 17:45:31 -07005073 writel_relaxed(0x38F8, PLLTEST_PAD_CFG_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005074 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5075
Stephen Boyde334aeb2012-01-24 12:17:29 -08005076 clk_disable_unprepare(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005077
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005078 return ret;
5079}
5080#else /* !CONFIG_DEBUG_FS */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005081static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005082{
5083 return -EINVAL;
5084}
5085
Matt Wagantallf82f2942012-01-27 13:56:13 -08005086static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005087{
5088 return 0;
5089}
5090#endif /* CONFIG_DEBUG_FS */
5091
Matt Wagantallae053222012-05-14 19:42:07 -07005092static struct clk_ops clk_ops_measure = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005093 .set_parent = measure_clk_set_parent,
5094 .get_rate = measure_clk_get_rate,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005095};
5096
Matt Wagantall8b38f942011-08-02 18:23:18 -07005097static struct measure_clk measure_clk = {
5098 .c = {
5099 .dbg_name = "measure_clk",
Matt Wagantallae053222012-05-14 19:42:07 -07005100 .ops = &clk_ops_measure,
Matt Wagantall8b38f942011-08-02 18:23:18 -07005101 CLK_INIT(measure_clk.c),
5102 },
5103 .multiplier = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005104};
5105
Tianyi Goua8b3cce2011-11-08 14:37:26 -08005106static struct clk_lookup msm_clocks_8064[] = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005107 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5108 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Mohan Pallaka804ca592012-06-14 14:37:38 +05305109 CLK_LOOKUP("pwm_clk", cxo_clk.c, "0-0048"),
Stephen Boyded630b02012-01-26 15:26:47 -08005110 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5111 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5112 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5113 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5114 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
Matt Wagantall292aace2012-01-26 19:12:34 -08005115 CLK_LOOKUP("xo", cxo_clk.c, "pil_gss"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005116 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005117 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Stephen Boyded630b02012-01-26 15:26:47 -08005118 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5119 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5120 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5121 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005122
Matt Wagantalld75f1312012-05-23 16:17:35 -07005123 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5124 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5125 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5126 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5127 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5128 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5129 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5130 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5131 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5132 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5133 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5134 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5135 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5136 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5137 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5138 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5139
Tianyi Gou21a0e802012-02-04 22:34:10 -08005140 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005141 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005142 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5143 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5144 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005145 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005146 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5147 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5148 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5149 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5150 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005151 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005152 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5153 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005154 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
5155 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_etb.0"),
5156 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_tpiu.0"),
5157 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_funnel.0"),
5158 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_stm.0"),
5159 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_etm.0"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005160
Tianyi Gou21a0e802012-02-04 22:34:10 -08005161 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005162 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, ""),
5163 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5164 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005165
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005166 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5167 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5168 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005169 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, "msm_serial_hsl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005170 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5171 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5172 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5173 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, ""),
5174 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005175 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, "msm_serial_hsl.0"),
David Keitel3c40fc52012-02-09 17:53:52 -08005176 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005177 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005178 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005179 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005180 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005181 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "qup_i2c.5"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005182 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5183 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5184 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Tianyi Gou50f23812012-02-06 16:04:19 -08005185 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Tianyi Gou05e01102012-02-08 22:15:49 -08005186 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005187 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5188 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5189 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5190 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
Joel Nider6cbe66a2012-06-26 11:11:59 +03005191 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.0"),
5192 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.0"),
5193 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.1"),
5194 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005195 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005196 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5197 CLK_LOOKUP("alt_core_clk", usb_hs3_xcvr_clk.c, "msm_ehci_host.0"),
5198 CLK_LOOKUP("alt_core_clk", usb_hs4_xcvr_clk.c, "msm_ehci_host.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005199 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5200 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5201 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005202 CLK_LOOKUP("ref_clk", sata_phy_ref_clk.c, ""),
5203 CLK_LOOKUP("cfg_clk", sata_phy_cfg_clk.c, ""),
Tianyi Gou352955d2012-05-18 19:44:01 -07005204 CLK_LOOKUP("src_clk", sata_src_clk.c, ""),
5205 CLK_LOOKUP("core_rxoob_clk", sata_rxoob_clk.c, ""),
5206 CLK_LOOKUP("core_pmalive_clk", sata_pmalive_clk.c, ""),
5207 CLK_LOOKUP("bus_clk", sata_a_clk.c, ""),
5208 CLK_LOOKUP("iface_clk", sata_p_clk.c, ""),
5209 CLK_LOOKUP("slave_iface_clk", sfab_sata_s_p_clk.c, ""),
Ramesh Masavarapu28311912011-10-27 11:04:12 -07005210 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qce.0"),
5211 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qcrypto.0"),
5212 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qce.0"),
5213 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qcrypto.0"),
5214 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qce.0"),
5215 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qcrypto.0"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005216 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005217 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "msm_serial_hsl.1"),
David Keitel3c40fc52012-02-09 17:53:52 -08005218 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005219 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005220 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005221 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005222 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005223 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "qup_i2c.5"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005224 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005225 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, "msm_serial_hsl.0"),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005226 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5227 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005228 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005229 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Manu Gautam7483f172011-11-08 15:22:26 +05305230 CLK_LOOKUP("iface_clk", usb_hs3_p_clk.c, "msm_ehci_host.0"),
5231 CLK_LOOKUP("iface_clk", usb_hs4_p_clk.c, "msm_ehci_host.1"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005232 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5233 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5234 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5235 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06005236 CLK_LOOKUP("iface_clk", pcie_p_clk.c, "msm_pcie"),
5237 CLK_LOOKUP("ref_clk", pcie_phy_ref_clk.c, "msm_pcie"),
5238 CLK_LOOKUP("bus_clk", pcie_a_clk.c, "msm_pcie"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005239 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5240 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005241 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5242 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5243 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5244 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chand07220e2012-02-13 15:52:22 -08005245 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005246 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Sreesudhan Ramakrish Ramkumar8002a792012-04-09 17:42:58 -07005247 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -08005248 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Kevin Chand07220e2012-02-13 15:52:22 -08005249 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
5250 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5251 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
5252 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
5253 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5254 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
5255 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
5256 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5257 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
5258 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
5259 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5260 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5261 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
5262 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5263 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5264 CLK_LOOKUP("csiphy_timer_src_clk",
5265 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5266 CLK_LOOKUP("csiphy_timer_src_clk",
5267 csiphy_timer_src_clk.c, "msm_csiphy.1"),
5268 CLK_LOOKUP("csiphy_timer_src_clk",
5269 csiphy_timer_src_clk.c, "msm_csiphy.2"),
5270 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5271 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
5272 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005273 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5274 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5275 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5276 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Tianyi Gou51918802012-01-26 14:05:43 -08005277 CLK_LOOKUP("rgb_clk", rgb_tv_clk.c, ""),
5278 CLK_LOOKUP("npl_clk", npl_tv_clk.c, ""),
5279
Pu Chen86b4be92011-11-03 17:27:57 -07005280 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005281 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005282 CLK_LOOKUP("bus_clk",
Patrick Dalye6f489042012-07-11 15:29:15 -07005283 gfx3d_axi_clk.c, "footswitch-8x60.2"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005284 CLK_LOOKUP("iface_clk", vcap_p_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005285 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005286 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "footswitch-8x60.10"),
5287 CLK_LOOKUP("bus_clk", vcap_axi_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005288 CLK_LOOKUP("core_clk", vcap_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005289 CLK_LOOKUP("core_clk", vcap_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005290 CLK_LOOKUP("core_clk", vcap_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005291 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005292 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005293 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005294 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5295 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005296 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005297 CLK_LOOKUP("core_clk", jpegd_clk.c, ""),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005298 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005299 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005300 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005301 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005302 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005303 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005304 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005305 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Matt Wagantall61286312012-02-22 15:55:09 -08005306 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005307 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5308 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
Greg Griscofa47b532011-11-11 10:32:06 -08005309 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005310 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005311 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
Tianyi Gou51918802012-01-26 14:05:43 -08005312 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005313 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005314 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Ujwal Pateld041f982012-03-27 19:51:44 -07005315 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005316 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chand07220e2012-02-13 15:52:22 -08005317 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005318 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chand07220e2012-02-13 15:52:22 -08005319 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005320 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5321 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5322 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5323 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5324 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5325 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5326 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005327 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5328 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chand07220e2012-02-13 15:52:22 -08005329 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5330 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
5331 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005332 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5333 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5334 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5335 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Pu Chen86b4be92011-11-03 17:27:57 -07005336 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005337 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005338 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5339 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005340 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005341 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005342 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005343 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005344 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005345 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005346 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005347 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005348 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Greg Griscofa47b532011-11-11 10:32:06 -08005349 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005350 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chand07220e2012-02-13 15:52:22 -08005351 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005352 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chanb20742b2012-02-27 15:47:35 -08005353 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall61286312012-02-22 15:55:09 -08005354 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005355
Patrick Lai04baee942012-05-01 14:38:47 -07005356 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5357 "msm-dai-q6-mi2s"),
5358 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5359 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005360 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5361 "msm-dai-q6.1"),
5362 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5363 "msm-dai-q6.1"),
5364 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5365 "msm-dai-q6.5"),
5366 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5367 "msm-dai-q6.5"),
5368 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
5369 "msm-dai-q6.16384"),
5370 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5371 "msm-dai-q6.16384"),
5372 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5373 "msm-dai-q6.4"),
5374 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5375 "msm-dai-q6.4"),
5376 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005377 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005378 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, ""),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005379 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005380 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, ""),
5381 CLK_LOOKUP("core_clk", vpe_axi_clk.c, ""),
5382 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
5383 CLK_LOOKUP("core_clk", vcap_axi_clk.c, ""),
5384 CLK_LOOKUP("core_clk", rot_axi_clk.c, ""),
5385 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, ""),
5386 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
5387 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, ""),
5388 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, ""),
Patrick Dalye6f489042012-07-11 15:29:15 -07005389 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005390
5391 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
5392 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
5393 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.0"),
5394 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.1"),
5395 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5396 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5397 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5398 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5399 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
5400 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
5401 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Ramesh Masavarapua1bc0e42012-03-05 07:42:48 -08005402 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005403
Manu Gautam5143b252012-01-05 19:25:23 -08005404 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5405 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5406 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5407 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5408 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005409
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005410 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5411 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5412 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5413 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5414 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5415 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5416 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5417 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5418 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005419 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.9"),
5420 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.10"),
5421
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005422 CLK_LOOKUP("core_clk", vcap_axi_clk.c, "msm_iommu.11"),
5423
Deepak Kotur954b1782012-04-24 17:58:19 -07005424 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5425 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5426 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5427 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5428 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005429 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5430 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
5431
Jeff Ohlstein8c116c72011-10-27 17:34:48 -07005432 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005433 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5434 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005435
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005436 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5437 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5438 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
Tianyi Gou455c13c2012-02-02 16:33:24 -08005439 CLK_LOOKUP("krait2_mclk", krait2_m_clk, ""),
5440 CLK_LOOKUP("krait3_mclk", krait3_m_clk, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005441};
5442
Patrick Dalye6f489042012-07-11 15:29:15 -07005443static struct clk_lookup msm_clocks_8960_common[] __initdata = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005444 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5445 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Stephen Boyded630b02012-01-26 15:26:47 -08005446 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5447 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5448 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5449 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5450 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005451 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005452 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Stephen Boyded630b02012-01-26 15:26:47 -08005453 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5454 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5455 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5456 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005457
Matt Wagantalld75f1312012-05-23 16:17:35 -07005458 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5459 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5460 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5461 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5462 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5463 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5464 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5465 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5466 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5467 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5468 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5469 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5470 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5471 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5472 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5473 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5474
Matt Wagantallb2710b82011-11-16 19:55:17 -08005475 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005476 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005477 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5478 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5479 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005480 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005481 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5482 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5483 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5484 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5485 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005486 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005487 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5488 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005489 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
5490 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_etb.0"),
5491 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_tpiu.0"),
5492 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_funnel.0"),
5493 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_stm.0"),
5494 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_etm.0"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005495
5496 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005497 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5498 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5499 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005500
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005501 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5502 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5503 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5504 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5505 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5506 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5507 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
Matt Wagantalle2522372011-08-17 14:52:21 -07005508 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5509 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005510 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005511 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hsl.1"),
Mayank Ranae009c922012-03-22 03:02:06 +05305512 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, "msm_serial_hs.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005513 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5514 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5515 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005516 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005517 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005518 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5519 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005520 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5521 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5522 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5523 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005524 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005525 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005526 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005527 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005528 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Vikram Mulukutladd0a2372011-09-19 15:58:21 -07005529 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Matt Wagantallc1205292011-08-11 17:19:31 -07005530 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005531 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5532 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5533 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5534 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5535 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005536 CLK_LOOKUP("slimbus_xo_src_clk", slimbus_xo_src_clk.c, NULL),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005537 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005538 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5539 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005540 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5541 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5542 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5543 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5544 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5545 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005546 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5547 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5548 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5549 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5550 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005551 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005552 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005553 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005554 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005555 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Matt Wagantallac294852011-08-17 15:44:58 -07005556 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005557 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005558 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
5559 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Matt Wagantalle2522372011-08-17 14:52:21 -07005560 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
5561 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005562 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005563 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hsl.1"),
Mayank Ranae009c922012-03-22 03:02:06 +05305564 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "msm_serial_hs.1"),
Matt Wagantallac294852011-08-17 15:44:58 -07005565 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005566 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005567 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005568 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005569 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5570 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005571 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
5572 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005573 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005574 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5575 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5576 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5577 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
5578 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
Matt Wagantalle1a86062011-08-18 17:46:10 -07005579 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5580 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005581 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5582 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5583 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5584 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chan09f4e662011-12-16 08:17:02 -08005585 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
5586 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-006c"),
5587 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0048"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005588 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -08005589 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005590 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005591 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5592 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005593 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005594 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5595 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005596 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005597 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5598 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005599 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
Kevin Chane12c6672011-10-26 11:55:26 -07005600 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5601 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005602 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
5603 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
5604 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5605 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5606 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5607 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
5608 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
Kevin Chanf6216f22011-10-25 18:40:11 -07005609 CLK_LOOKUP("csiphy_timer_src_clk",
5610 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5611 CLK_LOOKUP("csiphy_timer_src_clk",
5612 csiphy_timer_src_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005613 CLK_LOOKUP("csiphy_timer_src_clk",
5614 csiphy_timer_src_clk.c, "msm_csiphy.2"),
Kevin Chanf6216f22011-10-25 18:40:11 -07005615 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5616 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005617 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005618 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5619 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5620 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5621 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005622 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005623 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
5624 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005625 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5626 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005627 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07005628 CLK_LOOKUP("core_clk", jpegd_clk.c, "msm_mercury.0"),
5629 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, "msm_mercury.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005630 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005631 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005632 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005633 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005634 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005635 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005636 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005637 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005638 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5639 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005640 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005641 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005642 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005643 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
5644 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005645 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005646 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005647 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Kevin Chana0853122011-11-07 19:48:44 -08005648 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005649 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chan5827c552011-10-28 18:36:32 -07005650 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005651 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chan5827c552011-10-28 18:36:32 -07005652 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005653 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5654 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5655 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5656 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5657 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5658 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5659 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005660 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5661 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005662 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5663 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005664 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005665 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5666 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5667 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5668 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005669 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005670 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005671 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5672 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005673 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005674 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005675 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005676 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005677 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005678 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005679 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005680 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005681 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005682 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005683 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chan5827c552011-10-28 18:36:32 -07005684 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005685 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chana0853122011-11-07 19:48:44 -08005686 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005687 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Patrick Lai04baee942012-05-01 14:38:47 -07005688 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5689 "msm-dai-q6-mi2s"),
5690 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5691 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005692 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5693 "msm-dai-q6.1"),
5694 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5695 "msm-dai-q6.1"),
5696 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5697 "msm-dai-q6.5"),
5698 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5699 "msm-dai-q6.5"),
5700 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
5701 "msm-dai-q6.16384"),
5702 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5703 "msm-dai-q6.16384"),
5704 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5705 "msm-dai-q6.4"),
5706 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5707 "msm-dai-q6.4"),
5708 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005709 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005710 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005711 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005712 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5713 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5714 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5715 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5716 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5717 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5718 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5719 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5720 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
5721 CLK_LOOKUP("core_clk", gfx3d_clk.c, "msm_iommu.9"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005722
5723 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5724 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5725 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5726 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5727 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005728 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5729 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005730
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005731 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
Manu Gautam5143b252012-01-05 19:25:23 -08005732 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005733 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5734 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5735 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5736 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5737 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
Yan He160633e2011-06-30 12:18:56 -07005738 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
Stephen Boyd1c51a492011-10-26 12:11:47 -07005739 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
Stephen Boydef5d1c42011-12-15 20:47:14 -08005740 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Ramesh Masavarapua1bc0e42012-03-05 07:42:48 -08005741 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005742
Matt Wagantalle1a86062011-08-18 17:46:10 -07005743 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005744 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5745 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Matt Wagantall8b38f942011-08-02 18:23:18 -07005746
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005747 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5748 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5749 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
5750 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
5751 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
5752 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005753};
5754
Patrick Dalye6f489042012-07-11 15:29:15 -07005755static struct clk_lookup msm_clocks_8960_only[] __initdata = {
5756 CLK_LOOKUP("enc_clk", tv_enc_clk.c, "tvenc.0"),
5757 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
5758 CLK_LOOKUP("iface_clk", tv_enc_p_clk.c, "tvenc.0"),
5759
5760 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "kgsl-2d0.0"),
5761 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "footswitch-8x60.0"),
5762 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "kgsl-2d1.1"),
5763 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "footswitch-8x60.1"),
5764 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "kgsl-2d0.0"),
5765 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "footswitch-8x60.0"),
5766 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "kgsl-2d1.1"),
5767 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "footswitch-8x60.1"),
5768 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "msm_iommu.10"),
5769 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "msm_iommu.11"),
5770};
5771
5772static struct clk_lookup msm_clocks_8960ab_only[] __initdata = {
5773 CLK_LOOKUP("bus_clk", gfx3d_axi_clk.c, "footswitch-8x60.2"),
5774 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
5775};
5776
5777static struct clk_lookup msm_clocks_8960[ARRAY_SIZE(msm_clocks_8960_common)
5778 + ARRAY_SIZE(msm_clocks_8960_only)
5779 + ARRAY_SIZE(msm_clocks_8960ab_only)];
5780
Tianyi Goue3d4f542012-03-15 17:06:45 -07005781static struct clk_lookup msm_clocks_8930[] = {
Stephen Boydbe1a7392012-04-02 20:17:11 -07005782 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005783 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5784 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5785 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5786 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5787 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
5788 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
5789 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5790 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5791 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5792 CLK_LOOKUP("measure", measure_clk.c, "debug"),
5793
Matt Wagantalld75f1312012-05-23 16:17:35 -07005794 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5795 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5796 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5797 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5798 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5799 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5800 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5801 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5802 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5803 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5804 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5805 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5806 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5807 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5808 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5809 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5810
Tianyi Goue3d4f542012-03-15 17:06:45 -07005811 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005812 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005813 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5814 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5815 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
5816 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
5817 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5818 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5819 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5820 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5821 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005822 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005823 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5824 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005825 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
5826 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_etb.0"),
5827 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_tpiu.0"),
5828 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_funnel.0"),
5829 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_stm.0"),
5830 CLK_LOOKUP("core_clk", qdss_clk.c, "msm_etm.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005831
5832 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005833 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5834 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5835 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
5836
5837 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5838 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5839 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5840 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5841 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5842 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5843 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5844 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5845 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
5846 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
5847 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, ""),
5848 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, ""),
5849 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5850 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5851 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
5852 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
5853 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
5854 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5855 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
5856 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5857 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5858 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5859 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
5860 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, "qup_i2c.0"),
5861 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
5862 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
5863 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
5864 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
5865 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
5866 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
5867 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5868 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5869 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5870 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5871 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
5872 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, ""),
5873 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
5874 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5875 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
5876 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5877 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5878 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5879 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5880 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5881 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
5882 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5883 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5884 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5885 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5886 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
5887 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
5888 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
5889 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
5890 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
5891 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
5892 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
5893 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
5894 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
5895 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
5896 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
5897 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
5898 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
5899 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, ""),
5900 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "qup_i2c.0"),
5901 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
5902 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
5903 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
5904 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
5905 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
5906 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
5907 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
5908 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5909 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5910 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5911 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
5912 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
5913 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5914 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
5915 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5916 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5917 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5918 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005919 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Hody Hung994f4622012-04-24 10:27:45 -07005920 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
Sreesudhan Ramakrish Ramkumar981c82c2012-04-30 17:31:37 -07005921 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005922 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
5923 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
5924 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5925 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
5926 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
5927 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5928 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
5929 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
5930 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5931 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
5932 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
5933 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5934 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
5935 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
5936 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
5937 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5938 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5939 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5940 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
5941 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
5942 CLK_LOOKUP("csiphy_timer_src_clk",
5943 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5944 CLK_LOOKUP("csiphy_timer_src_clk",
5945 csiphy_timer_src_clk.c, "msm_csiphy.1"),
5946 CLK_LOOKUP("csiphy_timer_src_clk",
5947 csiphy_timer_src_clk.c, "msm_csiphy.2"),
5948 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5949 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
5950 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005951 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5952 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005953 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
5954 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
5955 CLK_LOOKUP("bus_clk",
5956 gfx3d_axi_clk_8930.c, "footswitch-8x60.2"),
5957 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005958 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5959 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005960 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005961 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005962 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005963 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005964 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005965 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005966 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
5967 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
5968 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005969 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5970 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005971 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005972 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005973 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
5974 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005975 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
5976 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005977 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005978 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005979 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
5980 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
5981 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
5982 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
5983 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
5984 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
5985 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5986 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5987 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5988 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5989 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5990 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5991 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005992 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005993 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5994 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
5995 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005996 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5997 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005998 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
5999 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
6000 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
6001 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006002 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006003 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
6004 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006005 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006006 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
6007 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
6008 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
6009 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
6010 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
6011 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
6012 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
6013 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
6014 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
6015 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
6016 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.6"),
6017 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.6"),
6018 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
6019 "msm-dai-q6.1"),
6020 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
6021 "msm-dai-q6.1"),
6022 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
6023 "msm-dai-q6.5"),
6024 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
6025 "msm-dai-q6.5"),
6026 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
6027 "msm-dai-q6.16384"),
6028 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
6029 "msm-dai-q6.16384"),
6030 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
6031 "msm-dai-q6.4"),
6032 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
6033 "msm-dai-q6.4"),
6034 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
6035 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
6036 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
6037 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
6038 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
6039 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
6040 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
6041 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
6042 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
6043 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
6044 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
6045 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.9"),
6046 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.10"),
6047
6048 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
6049 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
6050 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
6051 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
6052 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08006053 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
6054 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006055
6056 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
6057 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
6058 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
6059 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
6060 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
6061 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
6062 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
6063 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
6064 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
6065 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
6066 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
6067
6068 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07006069 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
6070 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006071
6072 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
6073 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
6074 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
6075 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
6076 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
6077 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
6078};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006079/*
6080 * Miscellaneous clock register initializations
6081 */
6082
6083/* Read, modify, then write-back a register. */
6084static void __init rmwreg(uint32_t val, void *reg, uint32_t mask)
6085{
6086 uint32_t regval = readl_relaxed(reg);
6087 regval &= ~mask;
6088 regval |= val;
6089 writel_relaxed(regval, reg);
6090}
6091
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006092static struct pll_config_regs pll4_regs __initdata = {
6093 .l_reg = LCC_PLL0_L_VAL_REG,
6094 .m_reg = LCC_PLL0_M_VAL_REG,
6095 .n_reg = LCC_PLL0_N_VAL_REG,
6096 .config_reg = LCC_PLL0_CONFIG_REG,
6097 .mode_reg = LCC_PLL0_MODE_REG,
6098};
Tianyi Gou41515e22011-09-01 19:37:43 -07006099
Matt Wagantall86e03822011-12-12 10:59:24 -08006100static struct pll_config pll4_config_393 __initdata = {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006101 .l = 0xE,
6102 .m = 0x27A,
6103 .n = 0x465,
6104 .vco_val = 0x0,
6105 .vco_mask = BM(17, 16),
6106 .pre_div_val = 0x0,
6107 .pre_div_mask = BIT(19),
6108 .post_div_val = 0x0,
6109 .post_div_mask = BM(21, 20),
6110 .mn_ena_val = BIT(22),
6111 .mn_ena_mask = BIT(22),
6112 .main_output_val = BIT(23),
6113 .main_output_mask = BIT(23),
6114};
Tianyi Gou41515e22011-09-01 19:37:43 -07006115
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006116static struct pll_config_regs pll15_regs __initdata = {
6117 .l_reg = MM_PLL3_L_VAL_REG,
6118 .m_reg = MM_PLL3_M_VAL_REG,
6119 .n_reg = MM_PLL3_N_VAL_REG,
6120 .config_reg = MM_PLL3_CONFIG_REG,
6121 .mode_reg = MM_PLL3_MODE_REG,
6122};
Tianyi Gou358c3862011-10-18 17:03:41 -07006123
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006124static struct pll_config pll15_config __initdata = {
6125 .l = (0x24 | BVAL(31, 7, 0x620)),
6126 .m = 0x1,
6127 .n = 0x9,
6128 .vco_val = BVAL(17, 16, 0x2),
6129 .vco_mask = BM(17, 16),
6130 .pre_div_val = 0x0,
6131 .pre_div_mask = BIT(19),
6132 .post_div_val = 0x0,
6133 .post_div_mask = BM(21, 20),
6134 .mn_ena_val = BIT(22),
6135 .mn_ena_mask = BIT(22),
6136 .main_output_val = BIT(23),
6137 .main_output_mask = BIT(23),
6138};
Tianyi Gou41515e22011-09-01 19:37:43 -07006139
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006140static struct pll_config_regs pll14_regs __initdata = {
6141 .l_reg = BB_PLL14_L_VAL_REG,
6142 .m_reg = BB_PLL14_M_VAL_REG,
6143 .n_reg = BB_PLL14_N_VAL_REG,
6144 .config_reg = BB_PLL14_CONFIG_REG,
6145 .mode_reg = BB_PLL14_MODE_REG,
6146};
6147
6148static struct pll_config pll14_config __initdata = {
6149 .l = (0x11 | BVAL(31, 7, 0x620)),
6150 .m = 0x7,
6151 .n = 0x9,
6152 .vco_val = 0x0,
6153 .vco_mask = BM(17, 16),
6154 .pre_div_val = 0x0,
6155 .pre_div_mask = BIT(19),
6156 .post_div_val = 0x0,
6157 .post_div_mask = BM(21, 20),
6158 .mn_ena_val = BIT(22),
6159 .mn_ena_mask = BIT(22),
6160 .main_output_val = BIT(23),
6161 .main_output_mask = BIT(23),
6162};
Tianyi Gou41515e22011-09-01 19:37:43 -07006163
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006164static void __init reg_init(void)
6165{
Stephen Boydd471e7a2011-11-19 01:37:39 -08006166 void __iomem *imem_reg;
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006167
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006168 /* Deassert MM SW_RESET_ALL signal. */
6169 writel_relaxed(0, SW_RESET_ALL_REG);
6170
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006171 /*
Tianyi Goue3d4f542012-03-15 17:06:45 -07006172 * Some bits are only used on 8960 or 8064 or 8930 and are marked as
6173 * reserved bits on the other SoCs. Writing to these reserved bits
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006174 * should have no effect.
6175 */
Stephen Boydd471e7a2011-11-19 01:37:39 -08006176 /*
6177 * Initialize MM AHB registers: Enable the FPB clock and disable HW
Patrick Dalye6f489042012-07-11 15:29:15 -07006178 * gating on 8627 and 8960 for all clocks. Also set VFE_AHB's
Stephen Boydd471e7a2011-11-19 01:37:39 -08006179 * FORCE_CORE_ON bit to prevent its memory from being collapsed when
6180 * the clock is halted. The sleep and wake-up delays are set to safe
6181 * values.
6182 */
Patrick Dalye6f489042012-07-11 15:29:15 -07006183 if (cpu_is_msm8627() || cpu_is_msm8960ab()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006184 rmwreg(0x00000003, AHB_EN_REG, 0x6C000103);
6185 writel_relaxed(0x000007F9, AHB_EN2_REG);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006186 } else {
6187 rmwreg(0x44000000, AHB_EN_REG, 0x6C000103);
6188 writel_relaxed(0x3C7097F9, AHB_EN2_REG);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006189 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006190
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006191 if (cpu_is_apq8064())
Tianyi Gouf3095ea2012-05-22 14:16:06 -07006192 rmwreg(0x00000001, AHB_EN3_REG, 0x00000001);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006193
6194 /* Deassert all locally-owned MM AHB resets. */
6195 rmwreg(0, SW_RESET_AHB_REG, 0xFFF7DFFF);
Tianyi Gou41515e22011-09-01 19:37:43 -07006196 rmwreg(0, SW_RESET_AHB2_REG, 0x0000000F);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006197
6198 /* Initialize MM AXI registers: Enable HW gating for all clocks that
6199 * support it. Also set FORCE_CORE_ON bits, and any sleep and wake-up
6200 * delays to safe values. */
Patrick Dalye6f489042012-07-11 15:29:15 -07006201 if (cpu_is_msm8960ab() || (cpu_is_msm8960() &&
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006202 SOCINFO_VERSION_MAJOR(socinfo_get_version()) < 3) ||
6203 cpu_is_msm8627()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006204 rmwreg(0x000007F9, MAXI_EN_REG, 0x0803FFFF);
6205 rmwreg(0x3027FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006206 } else {
6207 rmwreg(0x0003AFF9, MAXI_EN_REG, 0x0803FFFF);
6208 rmwreg(0x3A27FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006209 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006210
Matt Wagantall53d968f2011-07-19 13:22:53 -07006211 rmwreg(0x0027FCFF, MAXI_EN3_REG, 0x003FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006212 rmwreg(0x0027FCFF, MAXI_EN4_REG, 0x017FFFFF);
6213
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006214 if (cpu_is_apq8064())
Tianyi Gouf3095ea2012-05-22 14:16:06 -07006215 rmwreg(0x019FECFF, MAXI_EN5_REG, 0x01FFEFFF);
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006216 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006217 rmwreg(0x000004FF, MAXI_EN5_REG, 0x00000FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006218 if (cpu_is_msm8960ab())
6219 rmwreg(0x009FE000, MAXI_EN5_REG, 0x01FFE000);
6220
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006221 if (cpu_is_msm8627())
Stephen Boydd471e7a2011-11-19 01:37:39 -08006222 rmwreg(0x000003C7, SAXI_EN_REG, 0x00003FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006223 else if (cpu_is_msm8960ab())
6224 rmwreg(0x000001C6, SAXI_EN_REG, 0x00001DF6);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006225 else
6226 rmwreg(0x00003C38, SAXI_EN_REG, 0x00003FFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006227
6228 /* Enable IMEM's clk_on signal */
6229 imem_reg = ioremap(0x04b00040, 4);
6230 if (imem_reg) {
6231 writel_relaxed(0x3, imem_reg);
6232 iounmap(imem_reg);
6233 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006234
6235 /* Initialize MM CC registers: Set MM FORCE_CORE_ON bits so that core
6236 * memories retain state even when not clocked. Also, set sleep and
6237 * wake-up delays to safe values. */
Matt Wagantall53d968f2011-07-19 13:22:53 -07006238 rmwreg(0x00000000, CSI0_CC_REG, 0x00000410);
6239 rmwreg(0x00000000, CSI1_CC_REG, 0x00000410);
6240 rmwreg(0x80FF0000, DSI1_BYTE_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006241 rmwreg(0x80FF0000, DSI_PIXEL_CC_REG, 0xE0FF0010);
Tarun Karra6fbc00a2011-12-13 09:23:47 -07006242 rmwreg(0xC0FF0000, GFX3D_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006243 rmwreg(0x80FF0000, IJPEG_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006244 rmwreg(0x80FF0000, MDP_CC_REG, 0xE1FF0010);
6245 rmwreg(0x80FF0000, MDP_LUT_CC_REG, 0xE0FF0010);
6246 rmwreg(0x80FF0000, ROT_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006247 rmwreg(0x000004FF, TV_CC2_REG, 0x000007FF);
6248 rmwreg(0xC0FF0000, VCODEC_CC_REG, 0xE0FF0010);
6249 rmwreg(0x80FF0000, VFE_CC_REG, 0xE0FF4010);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006250 rmwreg(0x800000FF, VFE_CC2_REG, 0xE00000FF);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006251 rmwreg(0x80FF0000, VPE_CC_REG, 0xE0FF0010);
Patrick Dalye6f489042012-07-11 15:29:15 -07006252 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_apq8064()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006253 rmwreg(0x80FF0000, DSI2_BYTE_CC_REG, 0xE0FF0010);
6254 rmwreg(0x80FF0000, DSI2_PIXEL_CC_REG, 0xE0FF0010);
6255 rmwreg(0x80FF0000, JPEGD_CC_REG, 0xE0FF0010);
6256 }
Patrick Dalye6f489042012-07-11 15:29:15 -07006257 if (cpu_is_msm8960ab())
6258 rmwreg(0x00000001, DSI2_PIXEL_CC2_REG, 0x00000001);
6259
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006260 if (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm8930aa() ||
6261 cpu_is_msm8627())
Patrick Dalye6f489042012-07-11 15:29:15 -07006262 rmwreg(0x80FF0000, TV_CC_REG, 0xE1FFC010);
6263 if (cpu_is_msm8960ab())
6264 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Goue3d4f542012-03-15 17:06:45 -07006265
6266 if (cpu_is_msm8960()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006267 rmwreg(0x80FF0000, GFX2D0_CC_REG, 0xE0FF0010);
6268 rmwreg(0x80FF0000, GFX2D1_CC_REG, 0xE0FF0010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006269 }
6270 if (cpu_is_apq8064()) {
6271 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Gou621f8742011-09-01 21:45:01 -07006272 rmwreg(0x80FF0000, VCAP_CC_REG, 0xE0FF1010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006273 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006274
Tianyi Gou41515e22011-09-01 19:37:43 -07006275 /*
6276 * Initialize USB_HS_HCLK_FS registers: Set FORCE_C_ON bits so that
6277 * core remain active during halt state of the clk. Also, set sleep
6278 * and wake-up value to max.
6279 */
6280 rmwreg(0x0000004F, USB_HS1_HCLK_FS_REG, 0x0000007F);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006281 if (cpu_is_apq8064()) {
6282 rmwreg(0x0000004F, USB_HS3_HCLK_FS_REG, 0x0000007F);
6283 rmwreg(0x0000004F, USB_HS4_HCLK_FS_REG, 0x0000007F);
6284 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006285
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006286 /* De-assert MM AXI resets to all hardware blocks. */
6287 writel_relaxed(0, SW_RESET_AXI_REG);
6288
6289 /* Deassert all MM core resets. */
6290 writel_relaxed(0, SW_RESET_CORE_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006291 writel_relaxed(0, SW_RESET_CORE2_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006292
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006293 /* Enable TSSC and PDM PXO sources. */
6294 writel_relaxed(BIT(11), TSSC_CLK_CTL_REG);
6295 writel_relaxed(BIT(15), PDM_CLK_NS_REG);
6296
6297 /* Source SLIMBus xo src from slimbus reference clock */
Patrick Dalye6f489042012-07-11 15:29:15 -07006298 if (cpu_is_msm8960ab() || cpu_is_msm8960())
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006299 writel_relaxed(0x3, SLIMBUS_XO_SRC_CLK_CTL_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006300
6301 /* Source the dsi_byte_clks from the DSI PHY PLLs */
6302 rmwreg(0x1, DSI1_BYTE_NS_REG, 0x7);
Patrick Dalye6f489042012-07-11 15:29:15 -07006303 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_apq8064())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006304 rmwreg(0x2, DSI2_BYTE_NS_REG, 0x7);
Tianyi Gou41515e22011-09-01 19:37:43 -07006305
Siddhartha Agrawal482459c2012-05-24 15:28:53 -07006306 /* Source the dsi1_esc_clk from the DSI1 PHY PLLs */
6307 rmwreg(0x1, DSI1_ESC_NS_REG, 0x7);
6308
Tianyi Gou352955d2012-05-18 19:44:01 -07006309 /*
6310 * Source the sata_phy_ref_clk from PXO and set predivider of
6311 * sata_pmalive_clk to 1.
6312 */
6313 if (cpu_is_apq8064()) {
Tianyi Gou41515e22011-09-01 19:37:43 -07006314 rmwreg(0, SATA_PHY_REF_CLK_CTL_REG, 0x1);
Tianyi Gou352955d2012-05-18 19:44:01 -07006315 rmwreg(0, SATA_PMALIVE_CLK_CTL_REG, 0x3);
6316 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006317
6318 /*
Tianyi Gou05e01102012-02-08 22:15:49 -08006319 * TODO: Programming below PLLs and prng_clk is temporary and
6320 * needs to be removed after bootloaders program them.
Tianyi Gou41515e22011-09-01 19:37:43 -07006321 */
6322 if (cpu_is_apq8064()) {
Tianyi Gou317aa862012-02-06 14:31:07 -08006323 u32 is_pll_enabled;
Tianyi Gou41515e22011-09-01 19:37:43 -07006324
6325 /* Program pxo_src_clk to source from PXO */
6326 rmwreg(0x1, PXO_SRC_CLK_CTL_REG, 0x7);
6327
Tianyi Gou41515e22011-09-01 19:37:43 -07006328 /* Check if PLL14 is active */
6329 is_pll_enabled = readl_relaxed(BB_PLL14_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006330 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006331 /* Ref clk = 27MHz and program pll14 to 480MHz */
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006332 configure_pll(&pll14_config, &pll14_regs, 1);
Tianyi Gou621f8742011-09-01 21:45:01 -07006333
Tianyi Gou621f8742011-09-01 21:45:01 -07006334 /* Program PLL15 to 975MHz with ref clk = 27MHz */
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006335 configure_pll(&pll15_config, &pll15_regs, 0);
Tianyi Gouc29c3242011-10-12 21:02:15 -07006336
6337 /* Check if PLL4 is active */
6338 is_pll_enabled = readl_relaxed(LCC_PLL0_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006339 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006340 /* Ref clk = 27MHz and program pll4 to 393.2160MHz */
Matt Wagantall86e03822011-12-12 10:59:24 -08006341 configure_pll(&pll4_config_393, &pll4_regs, 1);
Tianyi Gouc29c3242011-10-12 21:02:15 -07006342
6343 /* Enable PLL4 source on the LPASS Primary PLL Mux */
6344 writel_relaxed(0x1, LCC_PRI_PLL_CLK_CTL_REG);
Tianyi Gou05e01102012-02-08 22:15:49 -08006345
6346 /* Program prng_clk to 64MHz if it isn't configured */
6347 if (!readl_relaxed(PRNG_CLK_NS_REG))
6348 writel_relaxed(0x2B, PRNG_CLK_NS_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006349 }
Tianyi Gou65c536a2012-03-20 23:20:29 -07006350
6351 /*
6352 * Program PLL15 to 900MHz with ref clk = 27MHz and
6353 * only enable PLL main output.
6354 */
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006355 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006356 pll15_config.l = 0x21 | BVAL(31, 7, 0x600);
6357 pll15_config.m = 0x1;
6358 pll15_config.n = 0x3;
6359 configure_pll(&pll15_config, &pll15_regs, 0);
6360 /* Disable AUX and BIST outputs */
6361 writel_relaxed(0, MM_PLL3_TEST_CTL_REG);
Tianyi Gou65c536a2012-03-20 23:20:29 -07006362 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006363}
6364
Patrick Dalye6f489042012-07-11 15:29:15 -07006365struct clock_init_data msm8960_clock_init_data __initdata;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006366static void __init msm8960_clock_pre_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006367{
Matt Wagantall86e03822011-12-12 10:59:24 -08006368 /* Initialize clock registers. */
6369 reg_init();
6370
Saravana Kannan298ec392012-02-08 19:21:47 -08006371 if (cpu_is_apq8064()) {
Matt Wagantall82feaa12012-07-09 10:54:49 -07006372 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8064;
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006373 } else if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
Saravana Kannan298ec392012-02-08 19:21:47 -08006374 vdd_dig.set_vdd = set_vdd_dig_8930;
Matt Wagantall82feaa12012-07-09 10:54:49 -07006375 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930;
Tianyi Goue1faaf22012-01-24 16:07:19 -08006376 }
Tianyi Goubf3d0b12012-01-23 14:37:28 -08006377
Matt Wagantall86e03822011-12-12 10:59:24 -08006378 /* Detect PLL4 programmed for alternate 491.52MHz clock plan. */
6379 if (readl_relaxed(LCC_PLL0_L_VAL_REG) == 0x12) {
6380 pll4_clk.c.rate = 491520000;
6381 audio_slimbus_clk.freq_tbl = clk_tbl_aif_osr_492;
6382 mi2s_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6383 codec_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6384 spare_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6385 codec_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6386 spare_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6387 pcm_clk.freq_tbl = clk_tbl_pcm_492;
6388 }
6389
Patrick Dalye6f489042012-07-11 15:29:15 -07006390 if (cpu_is_msm8960() || cpu_is_msm8960ab())
6391 memcpy(msm_clocks_8960, msm_clocks_8960_common,
6392 sizeof(msm_clocks_8960_common));
6393 if (cpu_is_msm8960ab()) {
6394 pll3_clk.c.rate = 650000000;
6395 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8960ab;
6396 gfx3d_clk.c.fmax[VDD_DIG_LOW] = 192000000;
6397 gfx3d_clk.c.fmax[VDD_DIG_NOMINAL] = 325000000;
6398 gfx3d_clk.c.fmax[VDD_DIG_HIGH] = 400000000;
6399 mdp_clk.freq_tbl = clk_tbl_mdp_8960ab;
6400 mdp_clk.c.fmax[VDD_DIG_LOW] = 128000000;
6401 mdp_clk.c.fmax[VDD_DIG_NOMINAL] = 266667000;
6402
6403 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6404 msm_clocks_8960ab_only, sizeof(msm_clocks_8960ab_only));
6405 msm8960_clock_init_data.size -=
6406 ARRAY_SIZE(msm_clocks_8960_only);
6407 } else if (cpu_is_msm8960()) {
6408 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6409 msm_clocks_8960_only, sizeof(msm_clocks_8960_only));
6410 msm8960_clock_init_data.size -=
6411 ARRAY_SIZE(msm_clocks_8960ab_only);
6412 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006413 /*
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006414 * Change the freq tables for and voltage requirements for
6415 * clocks which differ between 8960 and 8064.
Tianyi Gou41515e22011-09-01 19:37:43 -07006416 */
6417 if (cpu_is_apq8064()) {
6418 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8064;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006419
6420 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8064,
6421 sizeof(gfx3d_clk.c.fmax));
6422 memcpy(ijpeg_clk.c.fmax, fmax_ijpeg_8064,
6423 sizeof(ijpeg_clk.c.fmax));
6424 memcpy(mdp_clk.c.fmax, fmax_mdp_8064,
6425 sizeof(ijpeg_clk.c.fmax));
6426 memcpy(tv_src_clk.c.fmax, fmax_tv_src_8064,
6427 sizeof(tv_src_clk.c.fmax));
6428 memcpy(vfe_clk.c.fmax, fmax_vfe_8064,
6429 sizeof(vfe_clk.c.fmax));
6430
Patrick Dalye6f489042012-07-11 15:29:15 -07006431 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Tianyi Goue3d4f542012-03-15 17:06:45 -07006432 }
6433
6434 /*
6435 * Change the freq tables and voltage requirements for
6436 * clocks which differ between 8960 and 8930.
6437 */
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006438 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006439 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8930;
6440
6441 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8930,
6442 sizeof(gfx3d_clk.c.fmax));
6443
6444 pll15_clk.c.rate = 900000000;
6445 gmem_axi_clk.c.depends = &gfx3d_axi_clk_8930.c;
Tianyi Gou41515e22011-09-01 19:37:43 -07006446 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07006447 if ((readl_relaxed(PRNG_CLK_NS_REG) & 0x7F) == 0x2B)
6448 prng_clk.freq_tbl = clk_tbl_prng_64;
Stephen Boyd94625ef2011-07-12 17:06:01 -07006449
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006450 vote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006451
Vikram Mulukutla681d8682012-03-09 23:56:20 -08006452 clk_ops_local_pll.enable = sr_pll_clk_enable;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006453}
6454
6455static void __init msm8960_clock_post_init(void)
6456{
6457 /* Keep PXO on whenever APPS cpu is active */
6458 clk_prepare_enable(&pxo_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006459
Matt Wagantalle655cd72012-04-09 10:15:03 -07006460 /* Reset 3D core while clocked to ensure it resets completely. */
6461 clk_set_rate(&gfx3d_clk.c, 27000000);
6462 clk_prepare_enable(&gfx3d_clk.c);
6463 clk_reset(&gfx3d_clk.c, CLK_RESET_ASSERT);
6464 udelay(5);
6465 clk_reset(&gfx3d_clk.c, CLK_RESET_DEASSERT);
6466 clk_disable_unprepare(&gfx3d_clk.c);
6467
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006468 /* Initialize rates for clocks that only support one. */
6469 clk_set_rate(&pdm_clk.c, 27000000);
Stephen Boyd842a1f62012-04-26 19:07:38 -07006470 clk_set_rate(&prng_clk.c, prng_clk.freq_tbl->freq_hz);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006471 clk_set_rate(&mdp_vsync_clk.c, 27000000);
6472 clk_set_rate(&tsif_ref_clk.c, 105000);
6473 clk_set_rate(&tssc_clk.c, 27000000);
6474 clk_set_rate(&usb_hs1_xcvr_clk.c, 60000000);
Tianyi Gou41515e22011-09-01 19:37:43 -07006475 if (cpu_is_apq8064()) {
6476 clk_set_rate(&usb_hs3_xcvr_clk.c, 60000000);
6477 clk_set_rate(&usb_hs4_xcvr_clk.c, 60000000);
6478 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006479 clk_set_rate(&usb_fs1_src_clk.c, 60000000);
Patrick Dalye6f489042012-07-11 15:29:15 -07006480 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_msm8930() ||
6481 cpu_is_msm8930aa() || cpu_is_msm8627())
Tianyi Gou41515e22011-09-01 19:37:43 -07006482 clk_set_rate(&usb_fs2_src_clk.c, 60000000);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006483 clk_set_rate(&usb_hsic_xcvr_fs_clk.c, 60000000);
6484 clk_set_rate(&usb_hsic_hsic_src_clk.c, 480000000);
6485 clk_set_rate(&usb_hsic_hsio_cal_clk.c, 9000000);
Lena Salman127823f2012-02-14 17:13:53 +02006486 clk_set_rate(&usb_hsic_system_clk.c, 60000000);
Stephen Boyd092fd182011-10-21 15:56:30 -07006487 /*
6488 * Set the CSI rates to a safe default to avoid warnings when
6489 * switching csi pix and rdi clocks.
6490 */
6491 clk_set_rate(&csi0_src_clk.c, 27000000);
6492 clk_set_rate(&csi1_src_clk.c, 27000000);
6493 clk_set_rate(&csi2_src_clk.c, 27000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006494
6495 /*
Stephen Boyd60496bb2011-10-17 13:51:37 -07006496 * The halt status bits for these clocks may be incorrect at boot.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006497 * Toggle these clocks on and off to refresh them.
6498 */
Stephen Boyd409b8b42012-04-10 12:12:56 -07006499 clk_prepare_enable(&pdm_clk.c);
6500 clk_disable_unprepare(&pdm_clk.c);
6501 clk_prepare_enable(&tssc_clk.c);
6502 clk_disable_unprepare(&tssc_clk.c);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006503 clk_prepare_enable(&usb_hsic_hsic_clk.c);
6504 clk_disable_unprepare(&usb_hsic_hsic_clk.c);
Stephen Boydd7a143a2012-02-16 17:59:26 -08006505
6506 /*
6507 * Keep sfab floor @ 54MHz so that Krait AHB is at least 27MHz at all
6508 * times when Apps CPU is active. This ensures the timer's requirement
6509 * of Krait AHB running 4 times as fast as the timer itself.
6510 */
6511 clk_set_rate(&sfab_tmr_a_clk.c, 54000000);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006512 clk_prepare_enable(&sfab_tmr_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006513}
6514
Stephen Boydbb600ae2011-08-02 20:11:40 -07006515static int __init msm8960_clock_late_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006516{
Stephen Boyda3787f32011-09-16 18:55:13 -07006517 int rc;
6518 struct clk *mmfpb_a_clk = clk_get_sys("clock-8960", "mmfpb_a_clk");
Stephen Boyd85436132011-09-16 18:55:13 -07006519 struct clk *cfpb_a_clk = clk_get_sys("clock-8960", "cfpb_a_clk");
Stephen Boyda3787f32011-09-16 18:55:13 -07006520
6521 /* Vote for MMFPB to be at least 76.8MHz when an Apps CPU is active. */
6522 if (WARN(IS_ERR(mmfpb_a_clk), "mmfpb_a_clk not found (%ld)\n",
6523 PTR_ERR(mmfpb_a_clk)))
6524 return PTR_ERR(mmfpb_a_clk);
Matt Wagantallde555f562011-11-08 14:18:07 -08006525 rc = clk_set_rate(mmfpb_a_clk, 76800000);
Stephen Boyda3787f32011-09-16 18:55:13 -07006526 if (WARN(rc, "mmfpb_a_clk rate was not set (%d)\n", rc))
6527 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006528 rc = clk_prepare_enable(mmfpb_a_clk);
Stephen Boyda3787f32011-09-16 18:55:13 -07006529 if (WARN(rc, "mmfpb_a_clk not enabled (%d)\n", rc))
6530 return rc;
6531
Stephen Boyd85436132011-09-16 18:55:13 -07006532 /* Vote for CFPB to be at least 64MHz when an Apps CPU is active. */
6533 if (WARN(IS_ERR(cfpb_a_clk), "cfpb_a_clk not found (%ld)\n",
6534 PTR_ERR(cfpb_a_clk)))
6535 return PTR_ERR(cfpb_a_clk);
Matt Wagantallde555f562011-11-08 14:18:07 -08006536 rc = clk_set_rate(cfpb_a_clk, 64000000);
Stephen Boyd85436132011-09-16 18:55:13 -07006537 if (WARN(rc, "cfpb_a_clk rate was not set (%d)\n", rc))
6538 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006539 rc = clk_prepare_enable(cfpb_a_clk);
Stephen Boyd85436132011-09-16 18:55:13 -07006540 if (WARN(rc, "cfpb_a_clk not enabled (%d)\n", rc))
6541 return rc;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006542
6543 return unvote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006544}
Stephen Boydbb600ae2011-08-02 20:11:40 -07006545
6546struct clock_init_data msm8960_clock_init_data __initdata = {
6547 .table = msm_clocks_8960,
6548 .size = ARRAY_SIZE(msm_clocks_8960),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006549 .pre_init = msm8960_clock_pre_init,
6550 .post_init = msm8960_clock_post_init,
Stephen Boydbb600ae2011-08-02 20:11:40 -07006551 .late_init = msm8960_clock_late_init,
6552};
Tianyi Gou41515e22011-09-01 19:37:43 -07006553
6554struct clock_init_data apq8064_clock_init_data __initdata = {
6555 .table = msm_clocks_8064,
6556 .size = ARRAY_SIZE(msm_clocks_8064),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006557 .pre_init = msm8960_clock_pre_init,
6558 .post_init = msm8960_clock_post_init,
Tianyi Gou41515e22011-09-01 19:37:43 -07006559 .late_init = msm8960_clock_late_init,
6560};
Tianyi Goue3d4f542012-03-15 17:06:45 -07006561
6562struct clock_init_data msm8930_clock_init_data __initdata = {
6563 .table = msm_clocks_8930,
6564 .size = ARRAY_SIZE(msm_clocks_8930),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006565 .pre_init = msm8960_clock_pre_init,
6566 .post_init = msm8960_clock_post_init,
Tianyi Goue3d4f542012-03-15 17:06:45 -07006567 .late_init = msm8960_clock_late_init,
6568};