blob: 2ec4e381a16ec34fb770475672569b0cc433728d [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/err.h>
16#include <linux/ctype.h>
17#include <linux/bitops.h>
18#include <linux/io.h>
19#include <linux/spinlock.h>
20#include <linux/delay.h>
21#include <linux/clk.h>
22
23#include <asm/clkdev.h>
24#include <asm/mach-types.h>
25
26#include <mach/msm_iomap.h>
27#include <mach/clk.h>
28#include <mach/rpm-regulator.h>
Stephen Boyd94625ef2011-07-12 17:06:01 -070029#include <mach/socinfo.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030
31#include "clock-local.h"
32#include "clock-rpm.h"
33#include "clock-voter.h"
34#include "clock-dss-8960.h"
35#include "devices.h"
Vikram Mulukutla681d8682012-03-09 23:56:20 -080036#include "clock-pll.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38#define REG(off) (MSM_CLK_CTL_BASE + (off))
39#define REG_MM(off) (MSM_MMSS_CLK_CTL_BASE + (off))
40#define REG_LPA(off) (MSM_LPASS_CLK_CTL_BASE + (off))
Matt Wagantall8b38f942011-08-02 18:23:18 -070041#define REG_GCC(off) (MSM_APCS_GCC_BASE + (off))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
43/* Peripheral clock registers. */
Stephen Boyda52d7e32011-11-10 11:59:00 -080044#define ADM0_PBUS_CLK_CTL_REG REG(0x2208)
Tianyi Gou352955d2012-05-18 19:44:01 -070045#define SFAB_SATA_S_HCLK_CTL_REG REG(0x2480)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#define CE1_HCLK_CTL_REG REG(0x2720)
47#define CE1_CORE_CLK_CTL_REG REG(0x2724)
Tianyi Gou05e01102012-02-08 22:15:49 -080048#define PRNG_CLK_NS_REG REG(0x2E80)
Tianyi Gou41515e22011-09-01 19:37:43 -070049#define CE3_HCLK_CTL_REG REG(0x36C4)
50#define CE3_CORE_CLK_CTL_REG REG(0x36CC)
51#define CE3_CLK_SRC_NS_REG REG(0x36C0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#define DMA_BAM_HCLK_CTL REG(0x25C0)
Tianyi Gou6613de52012-01-27 17:57:53 -080053#define CLK_HALT_AFAB_SFAB_STATEA_REG REG(0x2FC0)
Tianyi Gou41515e22011-09-01 19:37:43 -070054#define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070055#define CLK_HALT_CFPB_STATEA_REG REG(0x2FCC)
56#define CLK_HALT_CFPB_STATEB_REG REG(0x2FD0)
57#define CLK_HALT_CFPB_STATEC_REG REG(0x2FD4)
58#define CLK_HALT_DFAB_STATE_REG REG(0x2FC8)
Tianyi Gou41515e22011-09-01 19:37:43 -070059/* 8064 name CLK_HALT_GSS_KPSS_MISC_STATE_REG */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070060#define CLK_HALT_MSS_SMPSS_MISC_STATE_REG REG(0x2FDC)
61#define CLK_HALT_SFPB_MISC_STATE_REG REG(0x2FD8)
Stephen Boyd973e4ba2011-07-12 17:06:01 -070062#define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#define CLK_TEST_REG REG(0x2FA0)
Matt Wagantall7625a4c2011-11-01 16:17:53 -070064#define GPn_MD_REG(n) REG(0x2D00+(0x20*(n)))
65#define GPn_NS_REG(n) REG(0x2D24+(0x20*(n)))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070066#define GSBIn_HCLK_CTL_REG(n) REG(0x29C0+(0x20*((n)-1)))
67#define GSBIn_QUP_APPS_MD_REG(n) REG(0x29C8+(0x20*((n)-1)))
68#define GSBIn_QUP_APPS_NS_REG(n) REG(0x29CC+(0x20*((n)-1)))
69#define GSBIn_RESET_REG(n) REG(0x29DC+(0x20*((n)-1)))
70#define GSBIn_UART_APPS_MD_REG(n) REG(0x29D0+(0x20*((n)-1)))
71#define GSBIn_UART_APPS_NS_REG(n) REG(0x29D4+(0x20*((n)-1)))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072#define PDM_CLK_NS_REG REG(0x2CC0)
Tianyi Gou41515e22011-09-01 19:37:43 -070073/* 8064 name BB_PLL_ENA_APCS_REG */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074#define BB_PLL_ENA_SC0_REG REG(0x34C0)
Tianyi Gou59608a72012-01-31 22:19:30 -080075#define BB_PLL_ENA_RPM_REG REG(0x34A0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076#define BB_PLL0_STATUS_REG REG(0x30D8)
77#define BB_PLL5_STATUS_REG REG(0x30F8)
78#define BB_PLL6_STATUS_REG REG(0x3118)
79#define BB_PLL7_STATUS_REG REG(0x3138)
80#define BB_PLL8_L_VAL_REG REG(0x3144)
81#define BB_PLL8_M_VAL_REG REG(0x3148)
82#define BB_PLL8_MODE_REG REG(0x3140)
83#define BB_PLL8_N_VAL_REG REG(0x314C)
84#define BB_PLL8_STATUS_REG REG(0x3158)
85#define BB_PLL8_CONFIG_REG REG(0x3154)
86#define BB_PLL8_TEST_CTL_REG REG(0x3150)
Stephen Boyd94625ef2011-07-12 17:06:01 -070087#define BB_MMCC_PLL2_MODE_REG REG(0x3160)
88#define BB_MMCC_PLL2_TEST_CTL_REG REG(0x3170)
Tianyi Gou41515e22011-09-01 19:37:43 -070089#define BB_PLL14_MODE_REG REG(0x31C0)
90#define BB_PLL14_L_VAL_REG REG(0x31C4)
91#define BB_PLL14_M_VAL_REG REG(0x31C8)
92#define BB_PLL14_N_VAL_REG REG(0x31CC)
93#define BB_PLL14_TEST_CTL_REG REG(0x31D0)
94#define BB_PLL14_CONFIG_REG REG(0x31D4)
Stephen Boyd94625ef2011-07-12 17:06:01 -070095#define BB_PLL14_STATUS_REG REG(0x31D8)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096#define PLLTEST_PAD_CFG_REG REG(0x2FA4)
97#define PMEM_ACLK_CTL_REG REG(0x25A0)
98#define RINGOSC_NS_REG REG(0x2DC0)
99#define RINGOSC_STATUS_REG REG(0x2DCC)
100#define RINGOSC_TCXO_CTL_REG REG(0x2DC4)
Stephen Boyda52d7e32011-11-10 11:59:00 -0800101#define RPM_MSG_RAM_HCLK_CTL_REG REG(0x27E0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700102#define SC0_U_CLK_BRANCH_ENA_VOTE_REG REG(0x3080)
103#define SDCn_APPS_CLK_MD_REG(n) REG(0x2828+(0x20*((n)-1)))
104#define SDCn_APPS_CLK_NS_REG(n) REG(0x282C+(0x20*((n)-1)))
105#define SDCn_HCLK_CTL_REG(n) REG(0x2820+(0x20*((n)-1)))
106#define SDCn_RESET_REG(n) REG(0x2830+(0x20*((n)-1)))
107#define SLIMBUS_XO_SRC_CLK_CTL_REG REG(0x2628)
108#define TSIF_HCLK_CTL_REG REG(0x2700)
109#define TSIF_REF_CLK_MD_REG REG(0x270C)
110#define TSIF_REF_CLK_NS_REG REG(0x2710)
111#define TSSC_CLK_CTL_REG REG(0x2CA0)
Tianyi Gou352955d2012-05-18 19:44:01 -0700112#define SATA_HCLK_CTL_REG REG(0x2C00)
Tianyi Gou41515e22011-09-01 19:37:43 -0700113#define SATA_CLK_SRC_NS_REG REG(0x2C08)
114#define SATA_RXOOB_CLK_CTL_REG REG(0x2C0C)
115#define SATA_PMALIVE_CLK_CTL_REG REG(0x2C10)
116#define SATA_PHY_REF_CLK_CTL_REG REG(0x2C14)
Tianyi Gou352955d2012-05-18 19:44:01 -0700117#define SATA_ACLK_CTL_REG REG(0x2C20)
Tianyi Gou41515e22011-09-01 19:37:43 -0700118#define SATA_PHY_CFG_CLK_CTL_REG REG(0x2C40)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700119#define USB_FSn_HCLK_CTL_REG(n) REG(0x2960+(0x20*((n)-1)))
120#define USB_FSn_RESET_REG(n) REG(0x2974+(0x20*((n)-1)))
121#define USB_FSn_SYSTEM_CLK_CTL_REG(n) REG(0x296C+(0x20*((n)-1)))
122#define USB_FSn_XCVR_FS_CLK_MD_REG(n) REG(0x2964+(0x20*((n)-1)))
123#define USB_FSn_XCVR_FS_CLK_NS_REG(n) REG(0x2968+(0x20*((n)-1)))
124#define USB_HS1_HCLK_CTL_REG REG(0x2900)
Tianyi Gou41515e22011-09-01 19:37:43 -0700125#define USB_HS1_HCLK_FS_REG REG(0x2904)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700126#define USB_HS1_RESET_REG REG(0x2910)
127#define USB_HS1_XCVR_FS_CLK_MD_REG REG(0x2908)
128#define USB_HS1_XCVR_FS_CLK_NS_REG REG(0x290C)
Tianyi Gou41515e22011-09-01 19:37:43 -0700129#define USB_HS3_HCLK_CTL_REG REG(0x3700)
130#define USB_HS3_HCLK_FS_REG REG(0x3704)
131#define USB_HS3_RESET_REG REG(0x3710)
132#define USB_HS3_XCVR_FS_CLK_MD_REG REG(0X3708)
133#define USB_HS3_XCVR_FS_CLK_NS_REG REG(0X370C)
134#define USB_HS4_HCLK_CTL_REG REG(0x3720)
135#define USB_HS4_HCLK_FS_REG REG(0x3724)
136#define USB_HS4_RESET_REG REG(0x3730)
137#define USB_HS4_XCVR_FS_CLK_MD_REG REG(0X3728)
138#define USB_HS4_XCVR_FS_CLK_NS_REG REG(0X372C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700139#define USB_HSIC_HCLK_CTL_REG REG(0x2920)
140#define USB_HSIC_HSIC_CLK_CTL_REG REG(0x2B44)
141#define USB_HSIC_HSIC_CLK_SRC_CTL_REG REG(0x2B40)
142#define USB_HSIC_HSIO_CAL_CLK_CTL_REG REG(0x2B48)
143#define USB_HSIC_RESET_REG REG(0x2934)
144#define USB_HSIC_SYSTEM_CLK_CTL_REG REG(0x292C)
145#define USB_HSIC_XCVR_FS_CLK_MD_REG REG(0x2924)
146#define USB_HSIC_XCVR_FS_CLK_NS_REG REG(0x2928)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700147#define USB_PHY0_RESET_REG REG(0x2E20)
Tianyi Gou41515e22011-09-01 19:37:43 -0700148#define PCIE_ALT_REF_CLK_NS_REG REG(0x3860)
Tianyi Gou6613de52012-01-27 17:57:53 -0800149#define PCIE_ACLK_CTL_REG REG(0x22C0)
Tianyi Gou41515e22011-09-01 19:37:43 -0700150#define PCIE_HCLK_CTL_REG REG(0x22CC)
Tianyi Gou6613de52012-01-27 17:57:53 -0800151#define PCIE_PCLK_CTL_REG REG(0x22D0)
Tianyi Gou41515e22011-09-01 19:37:43 -0700152#define GPLL1_MODE_REG REG(0x3160)
153#define GPLL1_L_VAL_REG REG(0x3164)
154#define GPLL1_M_VAL_REG REG(0x3168)
155#define GPLL1_N_VAL_REG REG(0x316C)
156#define GPLL1_CONFIG_REG REG(0x3174)
157#define GPLL1_STATUS_REG REG(0x3178)
158#define PXO_SRC_CLK_CTL_REG REG(0x2EA0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700159
160/* Multimedia clock registers. */
161#define AHB_EN_REG REG_MM(0x0008)
162#define AHB_EN2_REG REG_MM(0x0038)
Tianyi Gou41515e22011-09-01 19:37:43 -0700163#define AHB_EN3_REG REG_MM(0x0248)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164#define AHB_NS_REG REG_MM(0x0004)
165#define AXI_NS_REG REG_MM(0x0014)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700166#define CAMCLK0_NS_REG REG_MM(0x0148)
167#define CAMCLK0_CC_REG REG_MM(0x0140)
168#define CAMCLK0_MD_REG REG_MM(0x0144)
169#define CAMCLK1_NS_REG REG_MM(0x015C)
170#define CAMCLK1_CC_REG REG_MM(0x0154)
171#define CAMCLK1_MD_REG REG_MM(0x0158)
172#define CAMCLK2_NS_REG REG_MM(0x0228)
173#define CAMCLK2_CC_REG REG_MM(0x0220)
174#define CAMCLK2_MD_REG REG_MM(0x0224)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175#define CSI0_NS_REG REG_MM(0x0048)
176#define CSI0_CC_REG REG_MM(0x0040)
177#define CSI0_MD_REG REG_MM(0x0044)
178#define CSI1_NS_REG REG_MM(0x0010)
179#define CSI1_CC_REG REG_MM(0x0024)
180#define CSI1_MD_REG REG_MM(0x0028)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700181#define CSI2_NS_REG REG_MM(0x0234)
182#define CSI2_CC_REG REG_MM(0x022C)
183#define CSI2_MD_REG REG_MM(0x0230)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700184#define CSIPHYTIMER_CC_REG REG_MM(0x0160)
185#define CSIPHYTIMER_MD_REG REG_MM(0x0164)
186#define CSIPHYTIMER_NS_REG REG_MM(0x0168)
187#define DSI1_BYTE_NS_REG REG_MM(0x00B0)
188#define DSI1_BYTE_CC_REG REG_MM(0x0090)
189#define DSI2_BYTE_NS_REG REG_MM(0x00BC)
190#define DSI2_BYTE_CC_REG REG_MM(0x00B4)
191#define DSI1_ESC_NS_REG REG_MM(0x011C)
192#define DSI1_ESC_CC_REG REG_MM(0x00CC)
193#define DSI2_ESC_NS_REG REG_MM(0x0150)
194#define DSI2_ESC_CC_REG REG_MM(0x013C)
195#define DSI_PIXEL_CC_REG REG_MM(0x0130)
196#define DSI2_PIXEL_CC_REG REG_MM(0x0094)
Patrick Dalye6f489042012-07-11 15:29:15 -0700197#define DSI2_PIXEL_CC2_REG REG_MM(0x0264)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700198#define DBG_BUS_VEC_A_REG REG_MM(0x01C8)
199#define DBG_BUS_VEC_B_REG REG_MM(0x01CC)
200#define DBG_BUS_VEC_C_REG REG_MM(0x01D0)
201#define DBG_BUS_VEC_D_REG REG_MM(0x01D4)
202#define DBG_BUS_VEC_E_REG REG_MM(0x01D8)
203#define DBG_BUS_VEC_F_REG REG_MM(0x01DC)
204#define DBG_BUS_VEC_G_REG REG_MM(0x01E0)
205#define DBG_BUS_VEC_H_REG REG_MM(0x01E4)
206#define DBG_BUS_VEC_I_REG REG_MM(0x01E8)
Tianyi Gou41515e22011-09-01 19:37:43 -0700207#define DBG_BUS_VEC_J_REG REG_MM(0x0240)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700208#define DBG_CFG_REG_HS_REG REG_MM(0x01B4)
209#define DBG_CFG_REG_LS_REG REG_MM(0x01B8)
210#define GFX2D0_CC_REG REG_MM(0x0060)
211#define GFX2D0_MD0_REG REG_MM(0x0064)
212#define GFX2D0_MD1_REG REG_MM(0x0068)
213#define GFX2D0_NS_REG REG_MM(0x0070)
214#define GFX2D1_CC_REG REG_MM(0x0074)
215#define GFX2D1_MD0_REG REG_MM(0x0078)
216#define GFX2D1_MD1_REG REG_MM(0x006C)
217#define GFX2D1_NS_REG REG_MM(0x007C)
218#define GFX3D_CC_REG REG_MM(0x0080)
219#define GFX3D_MD0_REG REG_MM(0x0084)
220#define GFX3D_MD1_REG REG_MM(0x0088)
221#define GFX3D_NS_REG REG_MM(0x008C)
222#define IJPEG_CC_REG REG_MM(0x0098)
223#define IJPEG_MD_REG REG_MM(0x009C)
224#define IJPEG_NS_REG REG_MM(0x00A0)
225#define JPEGD_CC_REG REG_MM(0x00A4)
226#define JPEGD_NS_REG REG_MM(0x00AC)
Tianyi Gou41515e22011-09-01 19:37:43 -0700227#define VCAP_CC_REG REG_MM(0x0178)
228#define VCAP_NS_REG REG_MM(0x021C)
229#define VCAP_MD0_REG REG_MM(0x01EC)
230#define VCAP_MD1_REG REG_MM(0x0218)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700231#define MAXI_EN_REG REG_MM(0x0018)
232#define MAXI_EN2_REG REG_MM(0x0020)
233#define MAXI_EN3_REG REG_MM(0x002C)
234#define MAXI_EN4_REG REG_MM(0x0114)
Tianyi Gou41515e22011-09-01 19:37:43 -0700235#define MAXI_EN5_REG REG_MM(0x0244)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236#define MDP_CC_REG REG_MM(0x00C0)
237#define MDP_LUT_CC_REG REG_MM(0x016C)
238#define MDP_MD0_REG REG_MM(0x00C4)
239#define MDP_MD1_REG REG_MM(0x00C8)
240#define MDP_NS_REG REG_MM(0x00D0)
241#define MISC_CC_REG REG_MM(0x0058)
242#define MISC_CC2_REG REG_MM(0x005C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700243#define MISC_CC3_REG REG_MM(0x0238)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700244#define MM_PLL1_MODE_REG REG_MM(0x031C)
Tianyi Gou41515e22011-09-01 19:37:43 -0700245#define MM_PLL1_L_VAL_REG REG_MM(0x0320)
246#define MM_PLL1_M_VAL_REG REG_MM(0x0324)
247#define MM_PLL1_N_VAL_REG REG_MM(0x0328)
248#define MM_PLL1_CONFIG_REG REG_MM(0x032C)
249#define MM_PLL1_TEST_CTL_REG REG_MM(0x0330)
250#define MM_PLL1_STATUS_REG REG_MM(0x0334)
251#define MM_PLL3_MODE_REG REG_MM(0x0338)
Tianyi Gou621f8742011-09-01 21:45:01 -0700252#define MM_PLL3_L_VAL_REG REG_MM(0x033C)
253#define MM_PLL3_M_VAL_REG REG_MM(0x0340)
254#define MM_PLL3_N_VAL_REG REG_MM(0x0344)
255#define MM_PLL3_CONFIG_REG REG_MM(0x0348)
256#define MM_PLL3_TEST_CTL_REG REG_MM(0x034C)
257#define MM_PLL3_STATUS_REG REG_MM(0x0350)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700258#define ROT_CC_REG REG_MM(0x00E0)
259#define ROT_NS_REG REG_MM(0x00E8)
260#define SAXI_EN_REG REG_MM(0x0030)
261#define SW_RESET_AHB_REG REG_MM(0x020C)
262#define SW_RESET_AHB2_REG REG_MM(0x0200)
263#define SW_RESET_ALL_REG REG_MM(0x0204)
264#define SW_RESET_AXI_REG REG_MM(0x0208)
265#define SW_RESET_CORE_REG REG_MM(0x0210)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700266#define SW_RESET_CORE2_REG REG_MM(0x0214)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267#define TV_CC_REG REG_MM(0x00EC)
268#define TV_CC2_REG REG_MM(0x0124)
269#define TV_MD_REG REG_MM(0x00F0)
270#define TV_NS_REG REG_MM(0x00F4)
271#define VCODEC_CC_REG REG_MM(0x00F8)
272#define VCODEC_MD0_REG REG_MM(0x00FC)
273#define VCODEC_MD1_REG REG_MM(0x0128)
274#define VCODEC_NS_REG REG_MM(0x0100)
275#define VFE_CC_REG REG_MM(0x0104)
276#define VFE_MD_REG REG_MM(0x0108)
277#define VFE_NS_REG REG_MM(0x010C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700278#define VFE_CC2_REG REG_MM(0x023C)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279#define VPE_CC_REG REG_MM(0x0110)
280#define VPE_NS_REG REG_MM(0x0118)
281
282/* Low-power Audio clock registers. */
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700283#define LCC_CLK_HS_DEBUG_CFG_REG REG_LPA(0x00A4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700284#define LCC_CLK_LS_DEBUG_CFG_REG REG_LPA(0x00A8)
285#define LCC_CODEC_I2S_MIC_MD_REG REG_LPA(0x0064)
286#define LCC_CODEC_I2S_MIC_NS_REG REG_LPA(0x0060)
287#define LCC_CODEC_I2S_MIC_STATUS_REG REG_LPA(0x0068)
288#define LCC_CODEC_I2S_SPKR_MD_REG REG_LPA(0x0070)
289#define LCC_CODEC_I2S_SPKR_NS_REG REG_LPA(0x006C)
290#define LCC_CODEC_I2S_SPKR_STATUS_REG REG_LPA(0x0074)
291#define LCC_MI2S_MD_REG REG_LPA(0x004C)
292#define LCC_MI2S_NS_REG REG_LPA(0x0048)
293#define LCC_MI2S_STATUS_REG REG_LPA(0x0050)
294#define LCC_PCM_MD_REG REG_LPA(0x0058)
295#define LCC_PCM_NS_REG REG_LPA(0x0054)
296#define LCC_PCM_STATUS_REG REG_LPA(0x005C)
Tianyi Gouc29c3242011-10-12 21:02:15 -0700297#define LCC_PLL0_MODE_REG REG_LPA(0x0000)
298#define LCC_PLL0_L_VAL_REG REG_LPA(0x0004)
299#define LCC_PLL0_M_VAL_REG REG_LPA(0x0008)
300#define LCC_PLL0_N_VAL_REG REG_LPA(0x000C)
301#define LCC_PLL0_CONFIG_REG REG_LPA(0x0014)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700302#define LCC_PLL0_STATUS_REG REG_LPA(0x0018)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700303#define LCC_SPARE_I2S_MIC_MD_REG REG_LPA(0x007C)
304#define LCC_SPARE_I2S_MIC_NS_REG REG_LPA(0x0078)
305#define LCC_SPARE_I2S_MIC_STATUS_REG REG_LPA(0x0080)
306#define LCC_SPARE_I2S_SPKR_MD_REG REG_LPA(0x0088)
307#define LCC_SPARE_I2S_SPKR_NS_REG REG_LPA(0x0084)
308#define LCC_SPARE_I2S_SPKR_STATUS_REG REG_LPA(0x008C)
309#define LCC_SLIMBUS_NS_REG REG_LPA(0x00CC)
310#define LCC_SLIMBUS_MD_REG REG_LPA(0x00D0)
311#define LCC_SLIMBUS_STATUS_REG REG_LPA(0x00D4)
312#define LCC_AHBEX_BRANCH_CTL_REG REG_LPA(0x00E4)
Tianyi Gouc29c3242011-10-12 21:02:15 -0700313#define LCC_PRI_PLL_CLK_CTL_REG REG_LPA(0x00C4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314
Matt Wagantall8b38f942011-08-02 18:23:18 -0700315#define GCC_APCS_CLK_DIAG REG_GCC(0x001C)
316
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700317/* MUX source input identifiers. */
318#define pxo_to_bb_mux 0
Matt Wagantall7625a4c2011-11-01 16:17:53 -0700319#define cxo_to_bb_mux 5
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320#define pll0_to_bb_mux 2
321#define pll8_to_bb_mux 3
322#define pll6_to_bb_mux 4
323#define gnd_to_bb_mux 5
Stephen Boyd94625ef2011-07-12 17:06:01 -0700324#define pll3_to_bb_mux 6
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700325#define pxo_to_mm_mux 0
326#define pll1_to_mm_mux 1
Tianyi Gou41515e22011-09-01 19:37:43 -0700327#define pll2_to_mm_mux 1 /* or MMCC_PLL1 */
328#define pll8_to_mm_mux 2 /* or GCC_PERF */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329#define pll0_to_mm_mux 3
Tianyi Gou41515e22011-09-01 19:37:43 -0700330#define pll15_to_mm_mux 3 /* or MM_PLL3 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331#define gnd_to_mm_mux 4
Stephen Boyd7a776cd2011-10-20 12:46:04 -0700332#define pll3_to_mm_mux 3 /* or MMCC_PLL2 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700333#define hdmi_pll_to_mm_mux 3
334#define cxo_to_xo_mux 0
335#define pxo_to_xo_mux 1
336#define gnd_to_xo_mux 3
337#define pxo_to_lpa_mux 0
338#define cxo_to_lpa_mux 1
339#define pll4_to_lpa_mux 2
340#define gnd_to_lpa_mux 6
Tianyi Gou41515e22011-09-01 19:37:43 -0700341#define pxo_to_pcie_mux 0
342#define pll3_to_pcie_mux 1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343
344/* Test Vector Macros */
345#define TEST_TYPE_PER_LS 1
346#define TEST_TYPE_PER_HS 2
347#define TEST_TYPE_MM_LS 3
348#define TEST_TYPE_MM_HS 4
349#define TEST_TYPE_LPA 5
Matt Wagantall8b38f942011-08-02 18:23:18 -0700350#define TEST_TYPE_CPUL2 6
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700351#define TEST_TYPE_LPA_HS 7
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352#define TEST_TYPE_SHIFT 24
353#define TEST_CLK_SEL_MASK BM(23, 0)
354#define TEST_VECTOR(s, t) (((t) << TEST_TYPE_SHIFT) | BVAL(23, 0, (s)))
355#define TEST_PER_LS(s) TEST_VECTOR((s), TEST_TYPE_PER_LS)
356#define TEST_PER_HS(s) TEST_VECTOR((s), TEST_TYPE_PER_HS)
357#define TEST_MM_LS(s) TEST_VECTOR((s), TEST_TYPE_MM_LS)
358#define TEST_MM_HS(s) TEST_VECTOR((s), TEST_TYPE_MM_HS)
359#define TEST_LPA(s) TEST_VECTOR((s), TEST_TYPE_LPA)
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700360#define TEST_LPA_HS(s) TEST_VECTOR((s), TEST_TYPE_LPA_HS)
Matt Wagantall8b38f942011-08-02 18:23:18 -0700361#define TEST_CPUL2(s) TEST_VECTOR((s), TEST_TYPE_CPUL2)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700362
363#define MN_MODE_DUAL_EDGE 0x2
364
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700365struct pll_rate {
366 const uint32_t l_val;
367 const uint32_t m_val;
368 const uint32_t n_val;
369 const uint32_t vco;
370 const uint32_t post_div;
371 const uint32_t i_bits;
372};
373#define PLL_RATE(l, m, n, v, d, i) { l, m, n, v, (d>>1), i }
374
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700375enum vdd_dig_levels {
376 VDD_DIG_NONE,
377 VDD_DIG_LOW,
378 VDD_DIG_NOMINAL,
379 VDD_DIG_HIGH
380};
381
Saravana Kannan298ec392012-02-08 19:21:47 -0800382static int set_vdd_dig_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700383{
384 static const int vdd_uv[] = {
385 [VDD_DIG_NONE] = 0,
386 [VDD_DIG_LOW] = 945000,
387 [VDD_DIG_NOMINAL] = 1050000,
388 [VDD_DIG_HIGH] = 1150000
389 };
Saravana Kannan298ec392012-02-08 19:21:47 -0800390 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S3, RPM_VREG_VOTER3,
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700391 vdd_uv[level], 1150000, 1);
392}
393
Saravana Kannan298ec392012-02-08 19:21:47 -0800394static DEFINE_VDD_CLASS(vdd_dig, set_vdd_dig_8960);
395
Patrick Daly1a3859f2012-08-27 16:10:26 -0700396static int rpm_vreg_dig_8930 = RPM_VREG_ID_PM8038_VDD_DIG_CORNER;
Saravana Kannan298ec392012-02-08 19:21:47 -0800397static int set_vdd_dig_8930(struct clk_vdd_class *vdd_class, int level)
398{
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800399 static const int vdd_corner[] = {
400 [VDD_DIG_NONE] = RPM_VREG_CORNER_NONE,
401 [VDD_DIG_LOW] = RPM_VREG_CORNER_LOW,
402 [VDD_DIG_NOMINAL] = RPM_VREG_CORNER_NOMINAL,
403 [VDD_DIG_HIGH] = RPM_VREG_CORNER_HIGH,
Saravana Kannan298ec392012-02-08 19:21:47 -0800404 };
Patrick Daly1a3859f2012-08-27 16:10:26 -0700405 return rpm_vreg_set_voltage(rpm_vreg_dig_8930,
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800406 RPM_VREG_VOTER3,
407 vdd_corner[level],
408 RPM_VREG_CORNER_HIGH, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800409}
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700410
411#define VDD_DIG_FMAX_MAP1(l1, f1) \
412 .vdd_class = &vdd_dig, \
413 .fmax[VDD_DIG_##l1] = (f1)
414#define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \
415 .vdd_class = &vdd_dig, \
416 .fmax[VDD_DIG_##l1] = (f1), \
417 .fmax[VDD_DIG_##l2] = (f2)
418#define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \
419 .vdd_class = &vdd_dig, \
420 .fmax[VDD_DIG_##l1] = (f1), \
421 .fmax[VDD_DIG_##l2] = (f2), \
422 .fmax[VDD_DIG_##l3] = (f3)
423
Matt Wagantall82feaa12012-07-09 10:54:49 -0700424enum vdd_sr2_hdmi_pll_levels {
425 VDD_SR2_HDMI_PLL_OFF,
426 VDD_SR2_HDMI_PLL_ON
Matt Wagantallc57577d2011-10-06 17:06:53 -0700427};
428
Matt Wagantall82feaa12012-07-09 10:54:49 -0700429static int set_vdd_sr2_hdmi_pll_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantallc57577d2011-10-06 17:06:53 -0700430{
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800431 int rc = 0;
Saravana Kannan298ec392012-02-08 19:21:47 -0800432
Matt Wagantall82feaa12012-07-09 10:54:49 -0700433 if (level == VDD_SR2_HDMI_PLL_OFF) {
Saravana Kannan298ec392012-02-08 19:21:47 -0800434 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
435 RPM_VREG_VOTER3, 0, 0, 1);
436 if (rc)
437 return rc;
438 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
439 RPM_VREG_VOTER3, 0, 0, 1);
440 if (rc)
441 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
442 RPM_VREG_VOTER3, 1800000, 1800000, 1);
Tianyi Goue1faaf22012-01-24 16:07:19 -0800443 } else {
Saravana Kannan298ec392012-02-08 19:21:47 -0800444 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
David Collins9a81d6c2012-03-29 15:11:33 -0700445 RPM_VREG_VOTER3, 2050000, 2100000, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800446 if (rc)
447 return rc;
448 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
449 RPM_VREG_VOTER3, 1800000, 1800000, 1);
450 if (rc)
451 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800452 RPM_VREG_VOTER3, 0, 0, 1);
Matt Wagantallc57577d2011-10-06 17:06:53 -0700453 }
454
455 return rc;
456}
457
Matt Wagantall82feaa12012-07-09 10:54:49 -0700458static DEFINE_VDD_CLASS(vdd_sr2_hdmi_pll, set_vdd_sr2_hdmi_pll_8960);
Saravana Kannan298ec392012-02-08 19:21:47 -0800459
460static int sr2_lreg_uv[] = {
Matt Wagantall82feaa12012-07-09 10:54:49 -0700461 [VDD_SR2_HDMI_PLL_OFF] = 0,
462 [VDD_SR2_HDMI_PLL_ON] = 1800000,
Saravana Kannan298ec392012-02-08 19:21:47 -0800463};
464
Matt Wagantall82feaa12012-07-09 10:54:49 -0700465static int set_vdd_sr2_hdmi_pll_8064(struct clk_vdd_class *vdd_class, int level)
Saravana Kannan298ec392012-02-08 19:21:47 -0800466{
467 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_LVS7, RPM_VREG_VOTER3,
468 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
469}
470
Patrick Daly1a3859f2012-08-27 16:10:26 -0700471static int set_vdd_sr2_hdmi_pll_8930_pm8917(struct clk_vdd_class *vdd_class,
472 int level)
473{
474 int rc = 0;
475
476 if (level == VDD_SR2_HDMI_PLL_OFF) {
477 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
478 RPM_VREG_VOTER3, 0, 0, 1);
479 if (rc)
480 return rc;
481 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
482 RPM_VREG_VOTER3, 0, 0, 1);
483 if (rc)
484 rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
485 RPM_VREG_VOTER3, 1800000, 1800000, 1);
486 } else {
487 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
488 RPM_VREG_VOTER3, 2050000, 2100000, 1);
489 if (rc)
490 return rc;
491 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
492 RPM_VREG_VOTER3, 1800000, 1800000, 1);
493 if (rc)
494 rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
495 RPM_VREG_VOTER3, 0, 0, 1);
496 }
497
498 return rc;
499}
500
Matt Wagantall82feaa12012-07-09 10:54:49 -0700501static int set_vdd_sr2_hdmi_pll_8930(struct clk_vdd_class *vdd_class, int level)
Saravana Kannan298ec392012-02-08 19:21:47 -0800502{
503 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8038_L23, RPM_VREG_VOTER3,
504 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
505}
Matt Wagantallc57577d2011-10-06 17:06:53 -0700506
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700507/*
508 * Clock Descriptions
509 */
510
Stephen Boyd72a80352012-01-26 15:57:38 -0800511DEFINE_CLK_RPM_BRANCH(pxo_clk, pxo_a_clk, PXO, 27000000);
512DEFINE_CLK_RPM_BRANCH(cxo_clk, cxo_a_clk, CXO, 19200000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700513
514static struct pll_clk pll2_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700515 .mode_reg = MM_PLL1_MODE_REG,
516 .parent = &pxo_clk.c,
517 .c = {
518 .dbg_name = "pll2_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800519 .rate = 800000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800520 .ops = &clk_ops_local_pll,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700521 CLK_INIT(pll2_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800522 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700523 },
524};
525
Stephen Boyd94625ef2011-07-12 17:06:01 -0700526static struct pll_clk pll3_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700527 .mode_reg = BB_MMCC_PLL2_MODE_REG,
528 .parent = &pxo_clk.c,
529 .c = {
530 .dbg_name = "pll3_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800531 .rate = 1200000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800532 .ops = &clk_ops_local_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -0700533 .vdd_class = &vdd_sr2_hdmi_pll,
534 .fmax[VDD_SR2_HDMI_PLL_ON] = ULONG_MAX,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700535 CLK_INIT(pll3_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800536 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700537 },
538};
539
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700540static struct pll_vote_clk pll4_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700541 .en_reg = BB_PLL_ENA_SC0_REG,
542 .en_mask = BIT(4),
543 .status_reg = LCC_PLL0_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800544 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700545 .parent = &pxo_clk.c,
546 .c = {
547 .dbg_name = "pll4_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800548 .rate = 393216000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700549 .ops = &clk_ops_pll_vote,
550 CLK_INIT(pll4_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800551 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700552 },
553};
554
555static struct pll_vote_clk pll8_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700556 .en_reg = BB_PLL_ENA_SC0_REG,
557 .en_mask = BIT(8),
558 .status_reg = BB_PLL8_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800559 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700560 .parent = &pxo_clk.c,
561 .c = {
562 .dbg_name = "pll8_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800563 .rate = 384000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700564 .ops = &clk_ops_pll_vote,
565 CLK_INIT(pll8_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800566 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700567 },
568};
569
Stephen Boyd94625ef2011-07-12 17:06:01 -0700570static struct pll_vote_clk pll14_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700571 .en_reg = BB_PLL_ENA_SC0_REG,
572 .en_mask = BIT(14),
573 .status_reg = BB_PLL14_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800574 .status_mask = BIT(16),
Stephen Boyd94625ef2011-07-12 17:06:01 -0700575 .parent = &pxo_clk.c,
576 .c = {
577 .dbg_name = "pll14_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800578 .rate = 480000000,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700579 .ops = &clk_ops_pll_vote,
580 CLK_INIT(pll14_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800581 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700582 },
583};
584
Tianyi Gou41515e22011-09-01 19:37:43 -0700585static struct pll_clk pll15_clk = {
Tianyi Gou41515e22011-09-01 19:37:43 -0700586 .mode_reg = MM_PLL3_MODE_REG,
587 .parent = &pxo_clk.c,
588 .c = {
589 .dbg_name = "pll15_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800590 .rate = 975000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800591 .ops = &clk_ops_local_pll,
Tianyi Gou41515e22011-09-01 19:37:43 -0700592 CLK_INIT(pll15_clk.c),
Stephen Boyd3bbf3462012-01-12 00:19:23 -0800593 .warned = true,
Tianyi Gou41515e22011-09-01 19:37:43 -0700594 },
595};
596
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700597/* AXI Interfaces */
598static struct branch_clk gmem_axi_clk = {
599 .b = {
600 .ctl_reg = MAXI_EN_REG,
601 .en_mask = BIT(24),
602 .halt_reg = DBG_BUS_VEC_E_REG,
603 .halt_bit = 6,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800604 .retain_reg = MAXI_EN2_REG,
605 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 },
607 .c = {
608 .dbg_name = "gmem_axi_clk",
609 .ops = &clk_ops_branch,
610 CLK_INIT(gmem_axi_clk.c),
611 },
612};
613
614static struct branch_clk ijpeg_axi_clk = {
615 .b = {
616 .ctl_reg = MAXI_EN_REG,
617 .en_mask = BIT(21),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800618 .hwcg_reg = MAXI_EN_REG,
619 .hwcg_mask = BIT(11),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620 .reset_reg = SW_RESET_AXI_REG,
621 .reset_mask = BIT(14),
622 .halt_reg = DBG_BUS_VEC_E_REG,
623 .halt_bit = 4,
624 },
625 .c = {
626 .dbg_name = "ijpeg_axi_clk",
627 .ops = &clk_ops_branch,
628 CLK_INIT(ijpeg_axi_clk.c),
629 },
630};
631
632static struct branch_clk imem_axi_clk = {
633 .b = {
634 .ctl_reg = MAXI_EN_REG,
635 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800636 .hwcg_reg = MAXI_EN_REG,
637 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700638 .reset_reg = SW_RESET_CORE_REG,
639 .reset_mask = BIT(10),
640 .halt_reg = DBG_BUS_VEC_E_REG,
641 .halt_bit = 7,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800642 .retain_reg = MAXI_EN2_REG,
643 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700644 },
645 .c = {
646 .dbg_name = "imem_axi_clk",
647 .ops = &clk_ops_branch,
648 CLK_INIT(imem_axi_clk.c),
649 },
650};
651
652static struct branch_clk jpegd_axi_clk = {
653 .b = {
654 .ctl_reg = MAXI_EN_REG,
655 .en_mask = BIT(25),
656 .halt_reg = DBG_BUS_VEC_E_REG,
657 .halt_bit = 5,
658 },
659 .c = {
660 .dbg_name = "jpegd_axi_clk",
661 .ops = &clk_ops_branch,
662 CLK_INIT(jpegd_axi_clk.c),
663 },
664};
665
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700666static struct branch_clk vcodec_axi_b_clk = {
667 .b = {
668 .ctl_reg = MAXI_EN4_REG,
669 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800670 .hwcg_reg = MAXI_EN4_REG,
671 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700672 .halt_reg = DBG_BUS_VEC_I_REG,
673 .halt_bit = 25,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800674 .retain_reg = MAXI_EN4_REG,
675 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700676 },
677 .c = {
678 .dbg_name = "vcodec_axi_b_clk",
679 .ops = &clk_ops_branch,
680 CLK_INIT(vcodec_axi_b_clk.c),
681 },
682};
683
Matt Wagantall91f42702011-07-14 12:01:15 -0700684static struct branch_clk vcodec_axi_a_clk = {
685 .b = {
686 .ctl_reg = MAXI_EN4_REG,
687 .en_mask = BIT(25),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800688 .hwcg_reg = MAXI_EN4_REG,
689 .hwcg_mask = BIT(24),
Matt Wagantall91f42702011-07-14 12:01:15 -0700690 .halt_reg = DBG_BUS_VEC_I_REG,
691 .halt_bit = 26,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800692 .retain_reg = MAXI_EN4_REG,
693 .retain_mask = BIT(10),
Matt Wagantall91f42702011-07-14 12:01:15 -0700694 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700695 .c = {
696 .dbg_name = "vcodec_axi_a_clk",
697 .ops = &clk_ops_branch,
698 CLK_INIT(vcodec_axi_a_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700699 .depends = &vcodec_axi_b_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700700 },
701};
702
703static struct branch_clk vcodec_axi_clk = {
704 .b = {
705 .ctl_reg = MAXI_EN_REG,
706 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800707 .hwcg_reg = MAXI_EN_REG,
708 .hwcg_mask = BIT(13),
Matt Wagantall91f42702011-07-14 12:01:15 -0700709 .reset_reg = SW_RESET_AXI_REG,
Gopikrishnaiah Anandan83b6e852012-01-05 17:47:02 -0800710 .reset_mask = BIT(4)|BIT(5)|BIT(7),
Matt Wagantall91f42702011-07-14 12:01:15 -0700711 .halt_reg = DBG_BUS_VEC_E_REG,
712 .halt_bit = 3,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800713 .retain_reg = MAXI_EN2_REG,
714 .retain_mask = BIT(28),
Matt Wagantall91f42702011-07-14 12:01:15 -0700715 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700716 .c = {
717 .dbg_name = "vcodec_axi_clk",
718 .ops = &clk_ops_branch,
719 CLK_INIT(vcodec_axi_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700720 .depends = &vcodec_axi_a_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700721 },
722};
723
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700724static struct branch_clk vfe_axi_clk = {
725 .b = {
726 .ctl_reg = MAXI_EN_REG,
727 .en_mask = BIT(18),
728 .reset_reg = SW_RESET_AXI_REG,
729 .reset_mask = BIT(9),
730 .halt_reg = DBG_BUS_VEC_E_REG,
731 .halt_bit = 0,
732 },
733 .c = {
734 .dbg_name = "vfe_axi_clk",
735 .ops = &clk_ops_branch,
736 CLK_INIT(vfe_axi_clk.c),
737 },
738};
739
740static struct branch_clk mdp_axi_clk = {
741 .b = {
742 .ctl_reg = MAXI_EN_REG,
743 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800744 .hwcg_reg = MAXI_EN_REG,
745 .hwcg_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700746 .reset_reg = SW_RESET_AXI_REG,
747 .reset_mask = BIT(13),
748 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700749 .halt_bit = 8,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800750 .retain_reg = MAXI_EN_REG,
751 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700752 },
753 .c = {
754 .dbg_name = "mdp_axi_clk",
755 .ops = &clk_ops_branch,
756 CLK_INIT(mdp_axi_clk.c),
757 },
758};
759
760static struct branch_clk rot_axi_clk = {
761 .b = {
762 .ctl_reg = MAXI_EN2_REG,
763 .en_mask = BIT(24),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800764 .hwcg_reg = MAXI_EN2_REG,
765 .hwcg_mask = BIT(25),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700766 .reset_reg = SW_RESET_AXI_REG,
767 .reset_mask = BIT(6),
768 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700769 .halt_bit = 2,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800770 .retain_reg = MAXI_EN3_REG,
771 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700772 },
773 .c = {
774 .dbg_name = "rot_axi_clk",
775 .ops = &clk_ops_branch,
776 CLK_INIT(rot_axi_clk.c),
777 },
778};
779
780static struct branch_clk vpe_axi_clk = {
781 .b = {
782 .ctl_reg = MAXI_EN2_REG,
783 .en_mask = BIT(26),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800784 .hwcg_reg = MAXI_EN2_REG,
785 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700786 .reset_reg = SW_RESET_AXI_REG,
787 .reset_mask = BIT(15),
788 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700789 .halt_bit = 1,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800790 .retain_reg = MAXI_EN3_REG,
791 .retain_mask = BIT(21),
792
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700793 },
794 .c = {
795 .dbg_name = "vpe_axi_clk",
796 .ops = &clk_ops_branch,
797 CLK_INIT(vpe_axi_clk.c),
798 },
799};
800
Tianyi Gou41515e22011-09-01 19:37:43 -0700801static struct branch_clk vcap_axi_clk = {
802 .b = {
803 .ctl_reg = MAXI_EN5_REG,
804 .en_mask = BIT(12),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700805 .hwcg_reg = MAXI_EN5_REG,
806 .hwcg_mask = BIT(11),
Tianyi Gou41515e22011-09-01 19:37:43 -0700807 .reset_reg = SW_RESET_AXI_REG,
808 .reset_mask = BIT(16),
809 .halt_reg = DBG_BUS_VEC_J_REG,
810 .halt_bit = 20,
811 },
812 .c = {
813 .dbg_name = "vcap_axi_clk",
814 .ops = &clk_ops_branch,
815 CLK_INIT(vcap_axi_clk.c),
816 },
817};
818
Tianyi Goue3d4f542012-03-15 17:06:45 -0700819/* gfx3d_axi_clk is set as a dependency of gmem_axi_clk at runtime */
Patrick Dalye6f489042012-07-11 15:29:15 -0700820static struct branch_clk gfx3d_axi_clk = {
Tianyi Gou621f8742011-09-01 21:45:01 -0700821 .b = {
822 .ctl_reg = MAXI_EN5_REG,
823 .en_mask = BIT(25),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700824 .hwcg_reg = MAXI_EN5_REG,
825 .hwcg_mask = BIT(24),
Tianyi Gou621f8742011-09-01 21:45:01 -0700826 .reset_reg = SW_RESET_AXI_REG,
827 .reset_mask = BIT(17),
828 .halt_reg = DBG_BUS_VEC_J_REG,
829 .halt_bit = 30,
830 },
831 .c = {
832 .dbg_name = "gfx3d_axi_clk",
833 .ops = &clk_ops_branch,
Patrick Dalye6f489042012-07-11 15:29:15 -0700834 CLK_INIT(gfx3d_axi_clk.c),
Tianyi Goue3d4f542012-03-15 17:06:45 -0700835 },
836};
837
838static struct branch_clk gfx3d_axi_clk_8930 = {
839 .b = {
840 .ctl_reg = MAXI_EN5_REG,
841 .en_mask = BIT(12),
842 .reset_reg = SW_RESET_AXI_REG,
843 .reset_mask = BIT(16),
844 .halt_reg = DBG_BUS_VEC_J_REG,
845 .halt_bit = 12,
846 },
847 .c = {
848 .dbg_name = "gfx3d_axi_clk",
849 .ops = &clk_ops_branch,
850 CLK_INIT(gfx3d_axi_clk_8930.c),
Tianyi Gou621f8742011-09-01 21:45:01 -0700851 },
852};
853
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700854/* AHB Interfaces */
855static struct branch_clk amp_p_clk = {
856 .b = {
857 .ctl_reg = AHB_EN_REG,
858 .en_mask = BIT(24),
Matt Wagantalld40857a2012-04-10 19:15:43 -0700859 .reset_reg = SW_RESET_CORE_REG,
860 .reset_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700861 .halt_reg = DBG_BUS_VEC_F_REG,
862 .halt_bit = 18,
863 },
864 .c = {
865 .dbg_name = "amp_p_clk",
866 .ops = &clk_ops_branch,
867 CLK_INIT(amp_p_clk.c),
868 },
869};
870
Matt Wagantallc23eee92011-08-16 23:06:52 -0700871static struct branch_clk csi_p_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700872 .b = {
873 .ctl_reg = AHB_EN_REG,
874 .en_mask = BIT(7),
875 .reset_reg = SW_RESET_AHB_REG,
876 .reset_mask = BIT(17),
877 .halt_reg = DBG_BUS_VEC_F_REG,
878 .halt_bit = 16,
879 },
880 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -0700881 .dbg_name = "csi_p_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700882 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -0700883 CLK_INIT(csi_p_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700884 },
885};
886
887static struct branch_clk dsi1_m_p_clk = {
888 .b = {
889 .ctl_reg = AHB_EN_REG,
890 .en_mask = BIT(9),
891 .reset_reg = SW_RESET_AHB_REG,
892 .reset_mask = BIT(6),
893 .halt_reg = DBG_BUS_VEC_F_REG,
894 .halt_bit = 19,
895 },
896 .c = {
897 .dbg_name = "dsi1_m_p_clk",
898 .ops = &clk_ops_branch,
899 CLK_INIT(dsi1_m_p_clk.c),
900 },
901};
902
903static struct branch_clk dsi1_s_p_clk = {
904 .b = {
905 .ctl_reg = AHB_EN_REG,
906 .en_mask = BIT(18),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800907 .hwcg_reg = AHB_EN2_REG,
908 .hwcg_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909 .reset_reg = SW_RESET_AHB_REG,
910 .reset_mask = BIT(5),
911 .halt_reg = DBG_BUS_VEC_F_REG,
912 .halt_bit = 21,
913 },
914 .c = {
915 .dbg_name = "dsi1_s_p_clk",
916 .ops = &clk_ops_branch,
917 CLK_INIT(dsi1_s_p_clk.c),
918 },
919};
920
921static struct branch_clk dsi2_m_p_clk = {
922 .b = {
923 .ctl_reg = AHB_EN_REG,
924 .en_mask = BIT(17),
925 .reset_reg = SW_RESET_AHB2_REG,
926 .reset_mask = BIT(1),
927 .halt_reg = DBG_BUS_VEC_E_REG,
928 .halt_bit = 18,
929 },
930 .c = {
931 .dbg_name = "dsi2_m_p_clk",
932 .ops = &clk_ops_branch,
933 CLK_INIT(dsi2_m_p_clk.c),
934 },
935};
936
937static struct branch_clk dsi2_s_p_clk = {
938 .b = {
939 .ctl_reg = AHB_EN_REG,
940 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800941 .hwcg_reg = AHB_EN2_REG,
942 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700943 .reset_reg = SW_RESET_AHB2_REG,
944 .reset_mask = BIT(0),
945 .halt_reg = DBG_BUS_VEC_F_REG,
946 .halt_bit = 20,
947 },
948 .c = {
949 .dbg_name = "dsi2_s_p_clk",
950 .ops = &clk_ops_branch,
951 CLK_INIT(dsi2_s_p_clk.c),
952 },
953};
954
955static struct branch_clk gfx2d0_p_clk = {
956 .b = {
957 .ctl_reg = AHB_EN_REG,
958 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800959 .hwcg_reg = AHB_EN2_REG,
960 .hwcg_mask = BIT(28),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700961 .reset_reg = SW_RESET_AHB_REG,
962 .reset_mask = BIT(12),
963 .halt_reg = DBG_BUS_VEC_F_REG,
964 .halt_bit = 2,
965 },
966 .c = {
967 .dbg_name = "gfx2d0_p_clk",
968 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700969 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700970 CLK_INIT(gfx2d0_p_clk.c),
971 },
972};
973
974static struct branch_clk gfx2d1_p_clk = {
975 .b = {
976 .ctl_reg = AHB_EN_REG,
977 .en_mask = BIT(2),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800978 .hwcg_reg = AHB_EN2_REG,
979 .hwcg_mask = BIT(29),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700980 .reset_reg = SW_RESET_AHB_REG,
981 .reset_mask = BIT(11),
982 .halt_reg = DBG_BUS_VEC_F_REG,
983 .halt_bit = 3,
984 },
985 .c = {
986 .dbg_name = "gfx2d1_p_clk",
987 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700988 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700989 CLK_INIT(gfx2d1_p_clk.c),
990 },
991};
992
993static struct branch_clk gfx3d_p_clk = {
994 .b = {
995 .ctl_reg = AHB_EN_REG,
996 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800997 .hwcg_reg = AHB_EN2_REG,
998 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999 .reset_reg = SW_RESET_AHB_REG,
1000 .reset_mask = BIT(10),
1001 .halt_reg = DBG_BUS_VEC_F_REG,
1002 .halt_bit = 4,
1003 },
1004 .c = {
1005 .dbg_name = "gfx3d_p_clk",
1006 .ops = &clk_ops_branch,
1007 CLK_INIT(gfx3d_p_clk.c),
1008 },
1009};
1010
1011static struct branch_clk hdmi_m_p_clk = {
1012 .b = {
1013 .ctl_reg = AHB_EN_REG,
1014 .en_mask = BIT(14),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001015 .hwcg_reg = AHB_EN2_REG,
1016 .hwcg_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001017 .reset_reg = SW_RESET_AHB_REG,
1018 .reset_mask = BIT(9),
1019 .halt_reg = DBG_BUS_VEC_F_REG,
1020 .halt_bit = 5,
1021 },
1022 .c = {
1023 .dbg_name = "hdmi_m_p_clk",
1024 .ops = &clk_ops_branch,
1025 CLK_INIT(hdmi_m_p_clk.c),
1026 },
1027};
1028
1029static struct branch_clk hdmi_s_p_clk = {
1030 .b = {
1031 .ctl_reg = AHB_EN_REG,
1032 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001033 .hwcg_reg = AHB_EN2_REG,
1034 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001035 .reset_reg = SW_RESET_AHB_REG,
1036 .reset_mask = BIT(9),
1037 .halt_reg = DBG_BUS_VEC_F_REG,
1038 .halt_bit = 6,
1039 },
1040 .c = {
1041 .dbg_name = "hdmi_s_p_clk",
1042 .ops = &clk_ops_branch,
1043 CLK_INIT(hdmi_s_p_clk.c),
1044 },
1045};
1046
1047static struct branch_clk ijpeg_p_clk = {
1048 .b = {
1049 .ctl_reg = AHB_EN_REG,
1050 .en_mask = BIT(5),
1051 .reset_reg = SW_RESET_AHB_REG,
1052 .reset_mask = BIT(7),
1053 .halt_reg = DBG_BUS_VEC_F_REG,
1054 .halt_bit = 9,
1055 },
1056 .c = {
1057 .dbg_name = "ijpeg_p_clk",
1058 .ops = &clk_ops_branch,
1059 CLK_INIT(ijpeg_p_clk.c),
1060 },
1061};
1062
1063static struct branch_clk imem_p_clk = {
1064 .b = {
1065 .ctl_reg = AHB_EN_REG,
1066 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001067 .hwcg_reg = AHB_EN2_REG,
1068 .hwcg_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001069 .reset_reg = SW_RESET_AHB_REG,
1070 .reset_mask = BIT(8),
1071 .halt_reg = DBG_BUS_VEC_F_REG,
1072 .halt_bit = 10,
1073 },
1074 .c = {
1075 .dbg_name = "imem_p_clk",
1076 .ops = &clk_ops_branch,
1077 CLK_INIT(imem_p_clk.c),
1078 },
1079};
1080
1081static struct branch_clk jpegd_p_clk = {
1082 .b = {
1083 .ctl_reg = AHB_EN_REG,
1084 .en_mask = BIT(21),
1085 .reset_reg = SW_RESET_AHB_REG,
1086 .reset_mask = BIT(4),
1087 .halt_reg = DBG_BUS_VEC_F_REG,
1088 .halt_bit = 7,
1089 },
1090 .c = {
1091 .dbg_name = "jpegd_p_clk",
1092 .ops = &clk_ops_branch,
1093 CLK_INIT(jpegd_p_clk.c),
1094 },
1095};
1096
1097static struct branch_clk mdp_p_clk = {
1098 .b = {
1099 .ctl_reg = AHB_EN_REG,
1100 .en_mask = BIT(10),
1101 .reset_reg = SW_RESET_AHB_REG,
1102 .reset_mask = BIT(3),
1103 .halt_reg = DBG_BUS_VEC_F_REG,
1104 .halt_bit = 11,
1105 },
1106 .c = {
1107 .dbg_name = "mdp_p_clk",
1108 .ops = &clk_ops_branch,
1109 CLK_INIT(mdp_p_clk.c),
1110 },
1111};
1112
1113static struct branch_clk rot_p_clk = {
1114 .b = {
1115 .ctl_reg = AHB_EN_REG,
1116 .en_mask = BIT(12),
1117 .reset_reg = SW_RESET_AHB_REG,
1118 .reset_mask = BIT(2),
1119 .halt_reg = DBG_BUS_VEC_F_REG,
1120 .halt_bit = 13,
1121 },
1122 .c = {
1123 .dbg_name = "rot_p_clk",
1124 .ops = &clk_ops_branch,
1125 CLK_INIT(rot_p_clk.c),
1126 },
1127};
1128
1129static struct branch_clk smmu_p_clk = {
1130 .b = {
1131 .ctl_reg = AHB_EN_REG,
1132 .en_mask = BIT(15),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001133 .hwcg_reg = AHB_EN_REG,
1134 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001135 .halt_reg = DBG_BUS_VEC_F_REG,
1136 .halt_bit = 22,
1137 },
1138 .c = {
1139 .dbg_name = "smmu_p_clk",
1140 .ops = &clk_ops_branch,
1141 CLK_INIT(smmu_p_clk.c),
1142 },
1143};
1144
1145static struct branch_clk tv_enc_p_clk = {
1146 .b = {
1147 .ctl_reg = AHB_EN_REG,
1148 .en_mask = BIT(25),
1149 .reset_reg = SW_RESET_AHB_REG,
1150 .reset_mask = BIT(15),
1151 .halt_reg = DBG_BUS_VEC_F_REG,
1152 .halt_bit = 23,
1153 },
1154 .c = {
1155 .dbg_name = "tv_enc_p_clk",
1156 .ops = &clk_ops_branch,
1157 CLK_INIT(tv_enc_p_clk.c),
1158 },
1159};
1160
1161static struct branch_clk vcodec_p_clk = {
1162 .b = {
1163 .ctl_reg = AHB_EN_REG,
1164 .en_mask = BIT(11),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001165 .hwcg_reg = AHB_EN2_REG,
1166 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001167 .reset_reg = SW_RESET_AHB_REG,
1168 .reset_mask = BIT(1),
1169 .halt_reg = DBG_BUS_VEC_F_REG,
1170 .halt_bit = 12,
1171 },
1172 .c = {
1173 .dbg_name = "vcodec_p_clk",
1174 .ops = &clk_ops_branch,
1175 CLK_INIT(vcodec_p_clk.c),
1176 },
1177};
1178
1179static struct branch_clk vfe_p_clk = {
1180 .b = {
1181 .ctl_reg = AHB_EN_REG,
1182 .en_mask = BIT(13),
1183 .reset_reg = SW_RESET_AHB_REG,
1184 .reset_mask = BIT(0),
1185 .halt_reg = DBG_BUS_VEC_F_REG,
1186 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08001187 .retain_reg = AHB_EN2_REG,
1188 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001189 },
1190 .c = {
1191 .dbg_name = "vfe_p_clk",
1192 .ops = &clk_ops_branch,
1193 CLK_INIT(vfe_p_clk.c),
1194 },
1195};
1196
1197static struct branch_clk vpe_p_clk = {
1198 .b = {
1199 .ctl_reg = AHB_EN_REG,
1200 .en_mask = BIT(16),
1201 .reset_reg = SW_RESET_AHB_REG,
1202 .reset_mask = BIT(14),
1203 .halt_reg = DBG_BUS_VEC_F_REG,
1204 .halt_bit = 15,
1205 },
1206 .c = {
1207 .dbg_name = "vpe_p_clk",
1208 .ops = &clk_ops_branch,
1209 CLK_INIT(vpe_p_clk.c),
1210 },
1211};
1212
Tianyi Gou41515e22011-09-01 19:37:43 -07001213static struct branch_clk vcap_p_clk = {
1214 .b = {
1215 .ctl_reg = AHB_EN3_REG,
1216 .en_mask = BIT(1),
Tianyi Gouf3095ea2012-05-22 14:16:06 -07001217 .hwcg_reg = AHB_EN3_REG,
1218 .hwcg_mask = BIT(0),
Tianyi Gou41515e22011-09-01 19:37:43 -07001219 .reset_reg = SW_RESET_AHB2_REG,
1220 .reset_mask = BIT(2),
1221 .halt_reg = DBG_BUS_VEC_J_REG,
1222 .halt_bit = 23,
1223 },
1224 .c = {
1225 .dbg_name = "vcap_p_clk",
1226 .ops = &clk_ops_branch,
1227 CLK_INIT(vcap_p_clk.c),
1228 },
1229};
1230
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001231/*
1232 * Peripheral Clocks
1233 */
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001234#define CLK_GP(i, n, h_r, h_b) \
1235 struct rcg_clk i##_clk = { \
1236 .b = { \
1237 .ctl_reg = GPn_NS_REG(n), \
1238 .en_mask = BIT(9), \
1239 .halt_reg = h_r, \
1240 .halt_bit = h_b, \
1241 }, \
1242 .ns_reg = GPn_NS_REG(n), \
1243 .md_reg = GPn_MD_REG(n), \
1244 .root_en_mask = BIT(11), \
1245 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001246 .mnd_en_mask = BIT(8), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001247 .set_rate = set_rate_mnd, \
1248 .freq_tbl = clk_tbl_gp, \
1249 .current_freq = &rcg_dummy_freq, \
1250 .c = { \
1251 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001252 .ops = &clk_ops_rcg, \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001253 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), \
1254 CLK_INIT(i##_clk.c), \
1255 }, \
1256 }
1257#define F_GP(f, s, d, m, n) \
1258 { \
1259 .freq_hz = f, \
1260 .src_clk = &s##_clk.c, \
1261 .md_val = MD8(16, m, 0, n), \
1262 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001263 }
1264static struct clk_freq_tbl clk_tbl_gp[] = {
1265 F_GP( 0, gnd, 1, 0, 0),
1266 F_GP( 9600000, cxo, 2, 0, 0),
1267 F_GP( 13500000, pxo, 2, 0, 0),
1268 F_GP( 19200000, cxo, 1, 0, 0),
1269 F_GP( 27000000, pxo, 1, 0, 0),
1270 F_GP( 64000000, pll8, 2, 1, 3),
1271 F_GP( 76800000, pll8, 1, 1, 5),
1272 F_GP( 96000000, pll8, 4, 0, 0),
1273 F_GP(128000000, pll8, 3, 0, 0),
1274 F_GP(192000000, pll8, 2, 0, 0),
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001275 F_END
1276};
1277
1278static CLK_GP(gp0, 0, CLK_HALT_SFPB_MISC_STATE_REG, 7);
1279static CLK_GP(gp1, 1, CLK_HALT_SFPB_MISC_STATE_REG, 6);
1280static CLK_GP(gp2, 2, CLK_HALT_SFPB_MISC_STATE_REG, 5);
1281
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001282#define CLK_GSBI_UART(i, n, h_r, h_b) \
1283 struct rcg_clk i##_clk = { \
1284 .b = { \
1285 .ctl_reg = GSBIn_UART_APPS_NS_REG(n), \
1286 .en_mask = BIT(9), \
1287 .reset_reg = GSBIn_RESET_REG(n), \
1288 .reset_mask = BIT(0), \
1289 .halt_reg = h_r, \
1290 .halt_bit = h_b, \
1291 }, \
1292 .ns_reg = GSBIn_UART_APPS_NS_REG(n), \
1293 .md_reg = GSBIn_UART_APPS_MD_REG(n), \
1294 .root_en_mask = BIT(11), \
1295 .ns_mask = (BM(31, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001296 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001297 .set_rate = set_rate_mnd, \
1298 .freq_tbl = clk_tbl_gsbi_uart, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001299 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300 .c = { \
1301 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001302 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001303 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001304 CLK_INIT(i##_clk.c), \
1305 }, \
1306 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001307#define F_GSBI_UART(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001308 { \
1309 .freq_hz = f, \
1310 .src_clk = &s##_clk.c, \
1311 .md_val = MD16(m, n), \
1312 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001313 }
1314static struct clk_freq_tbl clk_tbl_gsbi_uart[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001315 F_GSBI_UART( 0, gnd, 1, 0, 0),
Matt Wagantall9a561f72012-01-19 16:13:12 -08001316 F_GSBI_UART( 1843200, pll8, 2, 6, 625),
1317 F_GSBI_UART( 3686400, pll8, 2, 12, 625),
1318 F_GSBI_UART( 7372800, pll8, 2, 24, 625),
1319 F_GSBI_UART(14745600, pll8, 2, 48, 625),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001320 F_GSBI_UART(16000000, pll8, 4, 1, 6),
1321 F_GSBI_UART(24000000, pll8, 4, 1, 4),
1322 F_GSBI_UART(32000000, pll8, 4, 1, 3),
1323 F_GSBI_UART(40000000, pll8, 1, 5, 48),
1324 F_GSBI_UART(46400000, pll8, 1, 29, 240),
1325 F_GSBI_UART(48000000, pll8, 4, 1, 2),
1326 F_GSBI_UART(51200000, pll8, 1, 2, 15),
1327 F_GSBI_UART(56000000, pll8, 1, 7, 48),
1328 F_GSBI_UART(58982400, pll8, 1, 96, 625),
1329 F_GSBI_UART(64000000, pll8, 2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001330 F_END
1331};
1332
1333static CLK_GSBI_UART(gsbi1_uart, 1, CLK_HALT_CFPB_STATEA_REG, 10);
1334static CLK_GSBI_UART(gsbi2_uart, 2, CLK_HALT_CFPB_STATEA_REG, 6);
1335static CLK_GSBI_UART(gsbi3_uart, 3, CLK_HALT_CFPB_STATEA_REG, 2);
1336static CLK_GSBI_UART(gsbi4_uart, 4, CLK_HALT_CFPB_STATEB_REG, 26);
1337static CLK_GSBI_UART(gsbi5_uart, 5, CLK_HALT_CFPB_STATEB_REG, 22);
1338static CLK_GSBI_UART(gsbi6_uart, 6, CLK_HALT_CFPB_STATEB_REG, 18);
1339static CLK_GSBI_UART(gsbi7_uart, 7, CLK_HALT_CFPB_STATEB_REG, 14);
1340static CLK_GSBI_UART(gsbi8_uart, 8, CLK_HALT_CFPB_STATEB_REG, 10);
1341static CLK_GSBI_UART(gsbi9_uart, 9, CLK_HALT_CFPB_STATEB_REG, 6);
1342static CLK_GSBI_UART(gsbi10_uart, 10, CLK_HALT_CFPB_STATEB_REG, 2);
1343static CLK_GSBI_UART(gsbi11_uart, 11, CLK_HALT_CFPB_STATEC_REG, 17);
1344static CLK_GSBI_UART(gsbi12_uart, 12, CLK_HALT_CFPB_STATEC_REG, 13);
1345
1346#define CLK_GSBI_QUP(i, n, h_r, h_b) \
1347 struct rcg_clk i##_clk = { \
1348 .b = { \
1349 .ctl_reg = GSBIn_QUP_APPS_NS_REG(n), \
1350 .en_mask = BIT(9), \
1351 .reset_reg = GSBIn_RESET_REG(n), \
1352 .reset_mask = BIT(0), \
1353 .halt_reg = h_r, \
1354 .halt_bit = h_b, \
1355 }, \
1356 .ns_reg = GSBIn_QUP_APPS_NS_REG(n), \
1357 .md_reg = GSBIn_QUP_APPS_MD_REG(n), \
1358 .root_en_mask = BIT(11), \
1359 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001360 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361 .set_rate = set_rate_mnd, \
1362 .freq_tbl = clk_tbl_gsbi_qup, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001363 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364 .c = { \
1365 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001366 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001367 VDD_DIG_FMAX_MAP2(LOW, 24000000, NOMINAL, 52000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001368 CLK_INIT(i##_clk.c), \
1369 }, \
1370 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001371#define F_GSBI_QUP(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001372 { \
1373 .freq_hz = f, \
1374 .src_clk = &s##_clk.c, \
1375 .md_val = MD8(16, m, 0, n), \
1376 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001377 }
1378static struct clk_freq_tbl clk_tbl_gsbi_qup[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001379 F_GSBI_QUP( 0, gnd, 1, 0, 0),
1380 F_GSBI_QUP( 1100000, pxo, 1, 2, 49),
1381 F_GSBI_QUP( 5400000, pxo, 1, 1, 5),
1382 F_GSBI_QUP(10800000, pxo, 1, 2, 5),
1383 F_GSBI_QUP(15060000, pll8, 1, 2, 51),
1384 F_GSBI_QUP(24000000, pll8, 4, 1, 4),
1385 F_GSBI_QUP(25600000, pll8, 1, 1, 15),
1386 F_GSBI_QUP(27000000, pxo, 1, 0, 0),
1387 F_GSBI_QUP(48000000, pll8, 4, 1, 2),
1388 F_GSBI_QUP(51200000, pll8, 1, 2, 15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001389 F_END
1390};
1391
1392static CLK_GSBI_QUP(gsbi1_qup, 1, CLK_HALT_CFPB_STATEA_REG, 9);
1393static CLK_GSBI_QUP(gsbi2_qup, 2, CLK_HALT_CFPB_STATEA_REG, 4);
1394static CLK_GSBI_QUP(gsbi3_qup, 3, CLK_HALT_CFPB_STATEA_REG, 0);
1395static CLK_GSBI_QUP(gsbi4_qup, 4, CLK_HALT_CFPB_STATEB_REG, 24);
1396static CLK_GSBI_QUP(gsbi5_qup, 5, CLK_HALT_CFPB_STATEB_REG, 20);
1397static CLK_GSBI_QUP(gsbi6_qup, 6, CLK_HALT_CFPB_STATEB_REG, 16);
1398static CLK_GSBI_QUP(gsbi7_qup, 7, CLK_HALT_CFPB_STATEB_REG, 12);
1399static CLK_GSBI_QUP(gsbi8_qup, 8, CLK_HALT_CFPB_STATEB_REG, 8);
1400static CLK_GSBI_QUP(gsbi9_qup, 9, CLK_HALT_CFPB_STATEB_REG, 4);
1401static CLK_GSBI_QUP(gsbi10_qup, 10, CLK_HALT_CFPB_STATEB_REG, 0);
1402static CLK_GSBI_QUP(gsbi11_qup, 11, CLK_HALT_CFPB_STATEC_REG, 15);
1403static CLK_GSBI_QUP(gsbi12_qup, 12, CLK_HALT_CFPB_STATEC_REG, 11);
1404
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001405#define F_PDM(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001406 { \
1407 .freq_hz = f, \
1408 .src_clk = &s##_clk.c, \
1409 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001410 }
1411static struct clk_freq_tbl clk_tbl_pdm[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001412 F_PDM( 0, gnd, 1),
1413 F_PDM(27000000, pxo, 1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001414 F_END
1415};
1416
1417static struct rcg_clk pdm_clk = {
1418 .b = {
1419 .ctl_reg = PDM_CLK_NS_REG,
1420 .en_mask = BIT(9),
1421 .reset_reg = PDM_CLK_NS_REG,
1422 .reset_mask = BIT(12),
1423 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1424 .halt_bit = 3,
1425 },
1426 .ns_reg = PDM_CLK_NS_REG,
1427 .root_en_mask = BIT(11),
1428 .ns_mask = BM(1, 0),
1429 .set_rate = set_rate_nop,
1430 .freq_tbl = clk_tbl_pdm,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001431 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001432 .c = {
1433 .dbg_name = "pdm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001434 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001435 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001436 CLK_INIT(pdm_clk.c),
1437 },
1438};
1439
1440static struct branch_clk pmem_clk = {
1441 .b = {
1442 .ctl_reg = PMEM_ACLK_CTL_REG,
1443 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001444 .hwcg_reg = PMEM_ACLK_CTL_REG,
1445 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001446 .halt_reg = CLK_HALT_DFAB_STATE_REG,
1447 .halt_bit = 20,
1448 },
1449 .c = {
1450 .dbg_name = "pmem_clk",
1451 .ops = &clk_ops_branch,
1452 CLK_INIT(pmem_clk.c),
1453 },
1454};
1455
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001456#define F_PRNG(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001457 { \
1458 .freq_hz = f, \
1459 .src_clk = &s##_clk.c, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001460 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07001461static struct clk_freq_tbl clk_tbl_prng_32[] = {
1462 F_PRNG(32000000, pll8),
1463 F_END
1464};
1465
1466static struct clk_freq_tbl clk_tbl_prng_64[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001467 F_PRNG(64000000, pll8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001468 F_END
1469};
1470
1471static struct rcg_clk prng_clk = {
1472 .b = {
1473 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
1474 .en_mask = BIT(10),
1475 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
1476 .halt_check = HALT_VOTED,
1477 .halt_bit = 10,
1478 },
1479 .set_rate = set_rate_nop,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001480 .freq_tbl = clk_tbl_prng_32,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001481 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001482 .c = {
1483 .dbg_name = "prng_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001484 .ops = &clk_ops_rcg,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001485 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001486 CLK_INIT(prng_clk.c),
1487 },
1488};
1489
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001490#define CLK_SDC(name, n, h_b, fmax_low, fmax_nom) \
Stephen Boyda78a7402011-08-02 11:23:39 -07001491 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001492 .b = { \
1493 .ctl_reg = SDCn_APPS_CLK_NS_REG(n), \
1494 .en_mask = BIT(9), \
1495 .reset_reg = SDCn_RESET_REG(n), \
1496 .reset_mask = BIT(0), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001497 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001498 .halt_bit = h_b, \
1499 }, \
1500 .ns_reg = SDCn_APPS_CLK_NS_REG(n), \
1501 .md_reg = SDCn_APPS_CLK_MD_REG(n), \
1502 .root_en_mask = BIT(11), \
1503 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001504 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001505 .set_rate = set_rate_mnd, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001506 .freq_tbl = clk_tbl_sdc, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001507 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001508 .c = { \
Stephen Boyda78a7402011-08-02 11:23:39 -07001509 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001510 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001511 VDD_DIG_FMAX_MAP2(LOW, fmax_low, NOMINAL, fmax_nom), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001512 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001513 }, \
1514 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001515#define F_SDC(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001516 { \
1517 .freq_hz = f, \
1518 .src_clk = &s##_clk.c, \
1519 .md_val = MD8(16, m, 0, n), \
1520 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001521 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001522static struct clk_freq_tbl clk_tbl_sdc[] = {
1523 F_SDC( 0, gnd, 1, 0, 0),
1524 F_SDC( 144000, pxo, 3, 2, 125),
1525 F_SDC( 400000, pll8, 4, 1, 240),
1526 F_SDC( 16000000, pll8, 4, 1, 6),
1527 F_SDC( 17070000, pll8, 1, 2, 45),
1528 F_SDC( 20210000, pll8, 1, 1, 19),
1529 F_SDC( 24000000, pll8, 4, 1, 4),
1530 F_SDC( 48000000, pll8, 4, 1, 2),
1531 F_SDC( 64000000, pll8, 3, 1, 2),
1532 F_SDC( 96000000, pll8, 4, 0, 0),
Subhash Jadavanibd238ba2011-11-24 15:12:39 +05301533 F_SDC(192000000, pll8, 2, 0, 0),
Stephen Boyda78a7402011-08-02 11:23:39 -07001534 F_END
1535};
1536
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001537static CLK_SDC(sdc1_clk, 1, 6, 52000000, 104000000);
1538static CLK_SDC(sdc2_clk, 2, 5, 52000000, 104000000);
1539static CLK_SDC(sdc3_clk, 3, 4, 104000000, 208000000);
1540static CLK_SDC(sdc4_clk, 4, 3, 33000000, 67000000);
1541static CLK_SDC(sdc5_clk, 5, 2, 33000000, 67000000);
Stephen Boyda78a7402011-08-02 11:23:39 -07001542
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001543#define F_TSIF_REF(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001544 { \
1545 .freq_hz = f, \
1546 .src_clk = &s##_clk.c, \
1547 .md_val = MD16(m, n), \
1548 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001549 }
1550static struct clk_freq_tbl clk_tbl_tsif_ref[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001551 F_TSIF_REF( 0, gnd, 1, 0, 0),
1552 F_TSIF_REF(105000, pxo, 1, 1, 256),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001553 F_END
1554};
1555
1556static struct rcg_clk tsif_ref_clk = {
1557 .b = {
1558 .ctl_reg = TSIF_REF_CLK_NS_REG,
1559 .en_mask = BIT(9),
1560 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1561 .halt_bit = 5,
1562 },
1563 .ns_reg = TSIF_REF_CLK_NS_REG,
1564 .md_reg = TSIF_REF_CLK_MD_REG,
1565 .root_en_mask = BIT(11),
1566 .ns_mask = (BM(31, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001567 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001568 .set_rate = set_rate_mnd,
1569 .freq_tbl = clk_tbl_tsif_ref,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001570 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001571 .c = {
1572 .dbg_name = "tsif_ref_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001573 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001574 VDD_DIG_FMAX_MAP2(LOW, 27000000, NOMINAL, 54000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001575 CLK_INIT(tsif_ref_clk.c),
1576 },
1577};
1578
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001579#define F_TSSC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001580 { \
1581 .freq_hz = f, \
1582 .src_clk = &s##_clk.c, \
1583 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001584 }
1585static struct clk_freq_tbl clk_tbl_tssc[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001586 F_TSSC( 0, gnd),
1587 F_TSSC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001588 F_END
1589};
1590
1591static struct rcg_clk tssc_clk = {
1592 .b = {
1593 .ctl_reg = TSSC_CLK_CTL_REG,
1594 .en_mask = BIT(4),
1595 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1596 .halt_bit = 4,
1597 },
1598 .ns_reg = TSSC_CLK_CTL_REG,
1599 .ns_mask = BM(1, 0),
1600 .set_rate = set_rate_nop,
1601 .freq_tbl = clk_tbl_tssc,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001602 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001603 .c = {
1604 .dbg_name = "tssc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001605 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001606 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001607 CLK_INIT(tssc_clk.c),
1608 },
1609};
1610
Tianyi Gou41515e22011-09-01 19:37:43 -07001611#define CLK_USB_HS(name, n, h_b) \
1612 static struct rcg_clk name = { \
1613 .b = { \
1614 .ctl_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1615 .en_mask = BIT(9), \
1616 .reset_reg = USB_HS##n##_RESET_REG, \
1617 .reset_mask = BIT(0), \
1618 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
1619 .halt_bit = h_b, \
1620 }, \
1621 .ns_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1622 .md_reg = USB_HS##n##_XCVR_FS_CLK_MD_REG, \
1623 .root_en_mask = BIT(11), \
1624 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001625 .mnd_en_mask = BIT(8), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001626 .set_rate = set_rate_mnd, \
1627 .freq_tbl = clk_tbl_usb, \
1628 .current_freq = &rcg_dummy_freq, \
1629 .c = { \
1630 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001631 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001632 VDD_DIG_FMAX_MAP1(NOMINAL, 64000000), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001633 CLK_INIT(name.c), \
1634 }, \
1635}
1636
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001637#define F_USB(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001638 { \
1639 .freq_hz = f, \
1640 .src_clk = &s##_clk.c, \
1641 .md_val = MD8(16, m, 0, n), \
1642 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001643 }
1644static struct clk_freq_tbl clk_tbl_usb[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001645 F_USB( 0, gnd, 1, 0, 0),
1646 F_USB(60000000, pll8, 1, 5, 32),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001647 F_END
1648};
1649
Tianyi Gou41515e22011-09-01 19:37:43 -07001650CLK_USB_HS(usb_hs1_xcvr_clk, 1, 0);
1651CLK_USB_HS(usb_hs3_xcvr_clk, 3, 30);
1652CLK_USB_HS(usb_hs4_xcvr_clk, 4, 2);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001653
Stephen Boyd94625ef2011-07-12 17:06:01 -07001654static struct clk_freq_tbl clk_tbl_usb_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001655 F_USB( 0, gnd, 1, 0, 0),
1656 F_USB(60000000, pll8, 1, 5, 32),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001657 F_END
1658};
1659
1660static struct rcg_clk usb_hsic_xcvr_fs_clk = {
1661 .b = {
1662 .ctl_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1663 .en_mask = BIT(9),
1664 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1665 .halt_bit = 26,
1666 },
1667 .ns_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1668 .md_reg = USB_HSIC_XCVR_FS_CLK_MD_REG,
1669 .root_en_mask = BIT(11),
1670 .ns_mask = (BM(23, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001671 .mnd_en_mask = BIT(8),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001672 .set_rate = set_rate_mnd,
1673 .freq_tbl = clk_tbl_usb_hsic,
1674 .current_freq = &rcg_dummy_freq,
1675 .c = {
1676 .dbg_name = "usb_hsic_xcvr_fs_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001677 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001678 VDD_DIG_FMAX_MAP1(LOW, 60000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001679 CLK_INIT(usb_hsic_xcvr_fs_clk.c),
1680 },
1681};
1682
1683static struct branch_clk usb_hsic_system_clk = {
1684 .b = {
1685 .ctl_reg = USB_HSIC_SYSTEM_CLK_CTL_REG,
1686 .en_mask = BIT(4),
1687 .reset_reg = USB_HSIC_RESET_REG,
1688 .reset_mask = BIT(0),
1689 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1690 .halt_bit = 24,
1691 },
1692 .parent = &usb_hsic_xcvr_fs_clk.c,
1693 .c = {
1694 .dbg_name = "usb_hsic_system_clk",
1695 .ops = &clk_ops_branch,
1696 CLK_INIT(usb_hsic_system_clk.c),
1697 },
1698};
1699
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001700#define F_USB_HSIC(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001701 { \
1702 .freq_hz = f, \
1703 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001704 }
1705static struct clk_freq_tbl clk_tbl_usb2_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001706 F_USB_HSIC(480000000, pll14),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001707 F_END
1708};
1709
1710static struct rcg_clk usb_hsic_hsic_src_clk = {
1711 .b = {
1712 .ctl_reg = USB_HSIC_HSIC_CLK_SRC_CTL_REG,
1713 .halt_check = NOCHECK,
1714 },
1715 .root_en_mask = BIT(0),
1716 .set_rate = set_rate_nop,
1717 .freq_tbl = clk_tbl_usb2_hsic,
1718 .current_freq = &rcg_dummy_freq,
1719 .c = {
1720 .dbg_name = "usb_hsic_hsic_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001721 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001722 VDD_DIG_FMAX_MAP1(LOW, 480000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001723 CLK_INIT(usb_hsic_hsic_src_clk.c),
1724 },
1725};
1726
1727static struct branch_clk usb_hsic_hsic_clk = {
1728 .b = {
1729 .ctl_reg = USB_HSIC_HSIC_CLK_CTL_REG,
1730 .en_mask = BIT(0),
1731 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1732 .halt_bit = 19,
1733 },
1734 .parent = &usb_hsic_hsic_src_clk.c,
1735 .c = {
1736 .dbg_name = "usb_hsic_hsic_clk",
1737 .ops = &clk_ops_branch,
1738 CLK_INIT(usb_hsic_hsic_clk.c),
1739 },
1740};
1741
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001742#define F_USB_HSIO_CAL(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001743 { \
1744 .freq_hz = f, \
1745 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001746 }
1747static struct clk_freq_tbl clk_tbl_usb_hsio_cal[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001748 F_USB_HSIO_CAL(9000000, pxo),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001749 F_END
1750};
1751
1752static struct rcg_clk usb_hsic_hsio_cal_clk = {
1753 .b = {
1754 .ctl_reg = USB_HSIC_HSIO_CAL_CLK_CTL_REG,
1755 .en_mask = BIT(0),
1756 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1757 .halt_bit = 23,
1758 },
1759 .set_rate = set_rate_nop,
1760 .freq_tbl = clk_tbl_usb_hsio_cal,
1761 .current_freq = &rcg_dummy_freq,
1762 .c = {
1763 .dbg_name = "usb_hsic_hsio_cal_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001764 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001765 VDD_DIG_FMAX_MAP1(LOW, 10000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001766 CLK_INIT(usb_hsic_hsio_cal_clk.c),
1767 },
1768};
1769
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001770static struct branch_clk usb_phy0_clk = {
1771 .b = {
1772 .reset_reg = USB_PHY0_RESET_REG,
1773 .reset_mask = BIT(0),
1774 },
1775 .c = {
1776 .dbg_name = "usb_phy0_clk",
1777 .ops = &clk_ops_reset,
1778 CLK_INIT(usb_phy0_clk.c),
1779 },
1780};
1781
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001782#define CLK_USB_FS(i, n, fmax_nom) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001783 struct rcg_clk i##_clk = { \
1784 .ns_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1785 .b = { \
1786 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1787 .halt_check = NOCHECK, \
1788 }, \
1789 .md_reg = USB_FSn_XCVR_FS_CLK_MD_REG(n), \
1790 .root_en_mask = BIT(11), \
1791 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001792 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001793 .set_rate = set_rate_mnd, \
1794 .freq_tbl = clk_tbl_usb, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001795 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001796 .c = { \
1797 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001798 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001799 VDD_DIG_FMAX_MAP1(NOMINAL, fmax_nom), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001800 CLK_INIT(i##_clk.c), \
1801 }, \
1802 }
1803
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001804static CLK_USB_FS(usb_fs1_src, 1, 64000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001805static struct branch_clk usb_fs1_xcvr_clk = {
1806 .b = {
1807 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(1),
1808 .en_mask = BIT(9),
1809 .reset_reg = USB_FSn_RESET_REG(1),
1810 .reset_mask = BIT(1),
1811 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1812 .halt_bit = 15,
1813 },
1814 .parent = &usb_fs1_src_clk.c,
1815 .c = {
1816 .dbg_name = "usb_fs1_xcvr_clk",
1817 .ops = &clk_ops_branch,
1818 CLK_INIT(usb_fs1_xcvr_clk.c),
1819 },
1820};
1821
1822static struct branch_clk usb_fs1_sys_clk = {
1823 .b = {
1824 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(1),
1825 .en_mask = BIT(4),
1826 .reset_reg = USB_FSn_RESET_REG(1),
1827 .reset_mask = BIT(0),
1828 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1829 .halt_bit = 16,
1830 },
1831 .parent = &usb_fs1_src_clk.c,
1832 .c = {
1833 .dbg_name = "usb_fs1_sys_clk",
1834 .ops = &clk_ops_branch,
1835 CLK_INIT(usb_fs1_sys_clk.c),
1836 },
1837};
1838
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001839static CLK_USB_FS(usb_fs2_src, 2, 60000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001840static struct branch_clk usb_fs2_xcvr_clk = {
1841 .b = {
1842 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(2),
1843 .en_mask = BIT(9),
1844 .reset_reg = USB_FSn_RESET_REG(2),
1845 .reset_mask = BIT(1),
1846 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1847 .halt_bit = 12,
1848 },
1849 .parent = &usb_fs2_src_clk.c,
1850 .c = {
1851 .dbg_name = "usb_fs2_xcvr_clk",
1852 .ops = &clk_ops_branch,
1853 CLK_INIT(usb_fs2_xcvr_clk.c),
1854 },
1855};
1856
1857static struct branch_clk usb_fs2_sys_clk = {
1858 .b = {
1859 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(2),
1860 .en_mask = BIT(4),
1861 .reset_reg = USB_FSn_RESET_REG(2),
1862 .reset_mask = BIT(0),
1863 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1864 .halt_bit = 13,
1865 },
1866 .parent = &usb_fs2_src_clk.c,
1867 .c = {
1868 .dbg_name = "usb_fs2_sys_clk",
1869 .ops = &clk_ops_branch,
1870 CLK_INIT(usb_fs2_sys_clk.c),
1871 },
1872};
1873
1874/* Fast Peripheral Bus Clocks */
1875static struct branch_clk ce1_core_clk = {
1876 .b = {
1877 .ctl_reg = CE1_CORE_CLK_CTL_REG,
1878 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001879 .hwcg_reg = CE1_CORE_CLK_CTL_REG,
1880 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001881 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1882 .halt_bit = 27,
1883 },
1884 .c = {
1885 .dbg_name = "ce1_core_clk",
1886 .ops = &clk_ops_branch,
1887 CLK_INIT(ce1_core_clk.c),
1888 },
1889};
Tianyi Gou41515e22011-09-01 19:37:43 -07001890
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001891static struct branch_clk ce1_p_clk = {
1892 .b = {
1893 .ctl_reg = CE1_HCLK_CTL_REG,
1894 .en_mask = BIT(4),
1895 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1896 .halt_bit = 1,
1897 },
1898 .c = {
1899 .dbg_name = "ce1_p_clk",
1900 .ops = &clk_ops_branch,
1901 CLK_INIT(ce1_p_clk.c),
1902 },
1903};
1904
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001905#define F_CE3(f, s, d) \
Tianyi Gou41515e22011-09-01 19:37:43 -07001906 { \
1907 .freq_hz = f, \
1908 .src_clk = &s##_clk.c, \
1909 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001910 }
1911
1912static struct clk_freq_tbl clk_tbl_ce3[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001913 F_CE3( 0, gnd, 1),
1914 F_CE3( 48000000, pll8, 8),
1915 F_CE3(100000000, pll3, 12),
Tianyi Gou41515e22011-09-01 19:37:43 -07001916 F_END
1917};
1918
1919static struct rcg_clk ce3_src_clk = {
1920 .b = {
1921 .ctl_reg = CE3_CLK_SRC_NS_REG,
1922 .halt_check = NOCHECK,
1923 },
1924 .ns_reg = CE3_CLK_SRC_NS_REG,
1925 .root_en_mask = BIT(7),
1926 .ns_mask = BM(6, 0),
1927 .set_rate = set_rate_nop,
1928 .freq_tbl = clk_tbl_ce3,
1929 .current_freq = &rcg_dummy_freq,
1930 .c = {
1931 .dbg_name = "ce3_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001932 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001933 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
Tianyi Gou41515e22011-09-01 19:37:43 -07001934 CLK_INIT(ce3_src_clk.c),
1935 },
1936};
1937
1938static struct branch_clk ce3_core_clk = {
1939 .b = {
1940 .ctl_reg = CE3_CORE_CLK_CTL_REG,
1941 .en_mask = BIT(4),
1942 .reset_reg = CE3_CORE_CLK_CTL_REG,
1943 .reset_mask = BIT(7),
1944 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
1945 .halt_bit = 5,
1946 },
1947 .parent = &ce3_src_clk.c,
1948 .c = {
1949 .dbg_name = "ce3_core_clk",
1950 .ops = &clk_ops_branch,
1951 CLK_INIT(ce3_core_clk.c),
1952 }
1953};
1954
1955static struct branch_clk ce3_p_clk = {
1956 .b = {
1957 .ctl_reg = CE3_HCLK_CTL_REG,
1958 .en_mask = BIT(4),
1959 .reset_reg = CE3_HCLK_CTL_REG,
1960 .reset_mask = BIT(7),
1961 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
1962 .halt_bit = 16,
1963 },
1964 .parent = &ce3_src_clk.c,
1965 .c = {
1966 .dbg_name = "ce3_p_clk",
1967 .ops = &clk_ops_branch,
1968 CLK_INIT(ce3_p_clk.c),
1969 }
1970};
1971
Tianyi Gou352955d2012-05-18 19:44:01 -07001972#define F_SATA(f, s, d) \
1973 { \
1974 .freq_hz = f, \
1975 .src_clk = &s##_clk.c, \
1976 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
1977 }
1978
1979static struct clk_freq_tbl clk_tbl_sata[] = {
1980 F_SATA( 0, gnd, 1),
1981 F_SATA( 48000000, pll8, 8),
1982 F_SATA(100000000, pll3, 12),
1983 F_END
1984};
1985
1986static struct rcg_clk sata_src_clk = {
1987 .b = {
1988 .ctl_reg = SATA_CLK_SRC_NS_REG,
1989 .halt_check = NOCHECK,
1990 },
1991 .ns_reg = SATA_CLK_SRC_NS_REG,
1992 .root_en_mask = BIT(7),
1993 .ns_mask = BM(6, 0),
1994 .set_rate = set_rate_nop,
1995 .freq_tbl = clk_tbl_sata,
1996 .current_freq = &rcg_dummy_freq,
1997 .c = {
1998 .dbg_name = "sata_src_clk",
1999 .ops = &clk_ops_rcg,
2000 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
2001 CLK_INIT(sata_src_clk.c),
2002 },
2003};
2004
2005static struct branch_clk sata_rxoob_clk = {
2006 .b = {
2007 .ctl_reg = SATA_RXOOB_CLK_CTL_REG,
2008 .en_mask = BIT(4),
2009 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2010 .halt_bit = 26,
2011 },
2012 .parent = &sata_src_clk.c,
2013 .c = {
2014 .dbg_name = "sata_rxoob_clk",
2015 .ops = &clk_ops_branch,
2016 CLK_INIT(sata_rxoob_clk.c),
2017 },
2018};
2019
2020static struct branch_clk sata_pmalive_clk = {
2021 .b = {
2022 .ctl_reg = SATA_PMALIVE_CLK_CTL_REG,
2023 .en_mask = BIT(4),
2024 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2025 .halt_bit = 25,
2026 },
2027 .parent = &sata_src_clk.c,
2028 .c = {
2029 .dbg_name = "sata_pmalive_clk",
2030 .ops = &clk_ops_branch,
2031 CLK_INIT(sata_pmalive_clk.c),
2032 },
2033};
2034
Tianyi Gou41515e22011-09-01 19:37:43 -07002035static struct branch_clk sata_phy_ref_clk = {
2036 .b = {
2037 .ctl_reg = SATA_PHY_REF_CLK_CTL_REG,
2038 .en_mask = BIT(4),
2039 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2040 .halt_bit = 24,
2041 },
2042 .parent = &pxo_clk.c,
2043 .c = {
2044 .dbg_name = "sata_phy_ref_clk",
2045 .ops = &clk_ops_branch,
2046 CLK_INIT(sata_phy_ref_clk.c),
2047 },
2048};
2049
Tianyi Gou352955d2012-05-18 19:44:01 -07002050static struct branch_clk sata_a_clk = {
2051 .b = {
2052 .ctl_reg = SATA_ACLK_CTL_REG,
2053 .en_mask = BIT(4),
2054 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2055 .halt_bit = 12,
2056 },
2057 .c = {
2058 .dbg_name = "sata_a_clk",
2059 .ops = &clk_ops_branch,
2060 CLK_INIT(sata_a_clk.c),
2061 },
2062};
2063
2064static struct branch_clk sata_p_clk = {
2065 .b = {
2066 .ctl_reg = SATA_HCLK_CTL_REG,
2067 .en_mask = BIT(4),
2068 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2069 .halt_bit = 27,
2070 },
2071 .c = {
2072 .dbg_name = "sata_p_clk",
2073 .ops = &clk_ops_branch,
2074 CLK_INIT(sata_p_clk.c),
2075 },
2076};
2077
2078static struct branch_clk sfab_sata_s_p_clk = {
2079 .b = {
2080 .ctl_reg = SFAB_SATA_S_HCLK_CTL_REG,
2081 .en_mask = BIT(4),
2082 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
2083 .halt_bit = 14,
2084 },
2085 .c = {
2086 .dbg_name = "sfab_sata_s_p_clk",
2087 .ops = &clk_ops_branch,
2088 CLK_INIT(sfab_sata_s_p_clk.c),
2089 },
2090};
Tianyi Gou41515e22011-09-01 19:37:43 -07002091static struct branch_clk pcie_p_clk = {
2092 .b = {
2093 .ctl_reg = PCIE_HCLK_CTL_REG,
2094 .en_mask = BIT(4),
2095 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2096 .halt_bit = 8,
2097 },
2098 .c = {
2099 .dbg_name = "pcie_p_clk",
2100 .ops = &clk_ops_branch,
2101 CLK_INIT(pcie_p_clk.c),
2102 },
2103};
2104
Tianyi Gou6613de52012-01-27 17:57:53 -08002105static struct branch_clk pcie_phy_ref_clk = {
2106 .b = {
2107 .ctl_reg = PCIE_PCLK_CTL_REG,
2108 .en_mask = BIT(4),
2109 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2110 .halt_bit = 29,
2111 },
2112 .c = {
2113 .dbg_name = "pcie_phy_ref_clk",
2114 .ops = &clk_ops_branch,
2115 CLK_INIT(pcie_phy_ref_clk.c),
2116 },
2117};
2118
2119static struct branch_clk pcie_a_clk = {
2120 .b = {
2121 .ctl_reg = PCIE_ACLK_CTL_REG,
2122 .en_mask = BIT(4),
2123 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2124 .halt_bit = 13,
2125 },
2126 .c = {
2127 .dbg_name = "pcie_a_clk",
2128 .ops = &clk_ops_branch,
2129 CLK_INIT(pcie_a_clk.c),
2130 },
2131};
2132
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002133static struct branch_clk dma_bam_p_clk = {
2134 .b = {
2135 .ctl_reg = DMA_BAM_HCLK_CTL,
2136 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002137 .hwcg_reg = DMA_BAM_HCLK_CTL,
2138 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002139 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2140 .halt_bit = 12,
2141 },
2142 .c = {
2143 .dbg_name = "dma_bam_p_clk",
2144 .ops = &clk_ops_branch,
2145 CLK_INIT(dma_bam_p_clk.c),
2146 },
2147};
2148
2149static struct branch_clk gsbi1_p_clk = {
2150 .b = {
2151 .ctl_reg = GSBIn_HCLK_CTL_REG(1),
2152 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002153 .hwcg_reg = GSBIn_HCLK_CTL_REG(1),
2154 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002155 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2156 .halt_bit = 11,
2157 },
2158 .c = {
2159 .dbg_name = "gsbi1_p_clk",
2160 .ops = &clk_ops_branch,
2161 CLK_INIT(gsbi1_p_clk.c),
2162 },
2163};
2164
2165static struct branch_clk gsbi2_p_clk = {
2166 .b = {
2167 .ctl_reg = GSBIn_HCLK_CTL_REG(2),
2168 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002169 .hwcg_reg = GSBIn_HCLK_CTL_REG(2),
2170 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002171 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2172 .halt_bit = 7,
2173 },
2174 .c = {
2175 .dbg_name = "gsbi2_p_clk",
2176 .ops = &clk_ops_branch,
2177 CLK_INIT(gsbi2_p_clk.c),
2178 },
2179};
2180
2181static struct branch_clk gsbi3_p_clk = {
2182 .b = {
2183 .ctl_reg = GSBIn_HCLK_CTL_REG(3),
2184 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002185 .hwcg_reg = GSBIn_HCLK_CTL_REG(3),
2186 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002187 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2188 .halt_bit = 3,
2189 },
2190 .c = {
2191 .dbg_name = "gsbi3_p_clk",
2192 .ops = &clk_ops_branch,
2193 CLK_INIT(gsbi3_p_clk.c),
2194 },
2195};
2196
2197static struct branch_clk gsbi4_p_clk = {
2198 .b = {
2199 .ctl_reg = GSBIn_HCLK_CTL_REG(4),
2200 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002201 .hwcg_reg = GSBIn_HCLK_CTL_REG(4),
2202 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002203 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2204 .halt_bit = 27,
2205 },
2206 .c = {
2207 .dbg_name = "gsbi4_p_clk",
2208 .ops = &clk_ops_branch,
2209 CLK_INIT(gsbi4_p_clk.c),
2210 },
2211};
2212
2213static struct branch_clk gsbi5_p_clk = {
2214 .b = {
2215 .ctl_reg = GSBIn_HCLK_CTL_REG(5),
2216 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002217 .hwcg_reg = GSBIn_HCLK_CTL_REG(5),
2218 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002219 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2220 .halt_bit = 23,
2221 },
2222 .c = {
2223 .dbg_name = "gsbi5_p_clk",
2224 .ops = &clk_ops_branch,
2225 CLK_INIT(gsbi5_p_clk.c),
2226 },
2227};
2228
2229static struct branch_clk gsbi6_p_clk = {
2230 .b = {
2231 .ctl_reg = GSBIn_HCLK_CTL_REG(6),
2232 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002233 .hwcg_reg = GSBIn_HCLK_CTL_REG(6),
2234 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002235 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2236 .halt_bit = 19,
2237 },
2238 .c = {
2239 .dbg_name = "gsbi6_p_clk",
2240 .ops = &clk_ops_branch,
2241 CLK_INIT(gsbi6_p_clk.c),
2242 },
2243};
2244
2245static struct branch_clk gsbi7_p_clk = {
2246 .b = {
2247 .ctl_reg = GSBIn_HCLK_CTL_REG(7),
2248 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002249 .hwcg_reg = GSBIn_HCLK_CTL_REG(7),
2250 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002251 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2252 .halt_bit = 15,
2253 },
2254 .c = {
2255 .dbg_name = "gsbi7_p_clk",
2256 .ops = &clk_ops_branch,
2257 CLK_INIT(gsbi7_p_clk.c),
2258 },
2259};
2260
2261static struct branch_clk gsbi8_p_clk = {
2262 .b = {
2263 .ctl_reg = GSBIn_HCLK_CTL_REG(8),
2264 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002265 .hwcg_reg = GSBIn_HCLK_CTL_REG(8),
2266 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002267 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2268 .halt_bit = 11,
2269 },
2270 .c = {
2271 .dbg_name = "gsbi8_p_clk",
2272 .ops = &clk_ops_branch,
2273 CLK_INIT(gsbi8_p_clk.c),
2274 },
2275};
2276
2277static struct branch_clk gsbi9_p_clk = {
2278 .b = {
2279 .ctl_reg = GSBIn_HCLK_CTL_REG(9),
2280 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002281 .hwcg_reg = GSBIn_HCLK_CTL_REG(9),
2282 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002283 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2284 .halt_bit = 7,
2285 },
2286 .c = {
2287 .dbg_name = "gsbi9_p_clk",
2288 .ops = &clk_ops_branch,
2289 CLK_INIT(gsbi9_p_clk.c),
2290 },
2291};
2292
2293static struct branch_clk gsbi10_p_clk = {
2294 .b = {
2295 .ctl_reg = GSBIn_HCLK_CTL_REG(10),
2296 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002297 .hwcg_reg = GSBIn_HCLK_CTL_REG(10),
2298 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002299 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2300 .halt_bit = 3,
2301 },
2302 .c = {
2303 .dbg_name = "gsbi10_p_clk",
2304 .ops = &clk_ops_branch,
2305 CLK_INIT(gsbi10_p_clk.c),
2306 },
2307};
2308
2309static struct branch_clk gsbi11_p_clk = {
2310 .b = {
2311 .ctl_reg = GSBIn_HCLK_CTL_REG(11),
2312 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002313 .hwcg_reg = GSBIn_HCLK_CTL_REG(11),
2314 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002315 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2316 .halt_bit = 18,
2317 },
2318 .c = {
2319 .dbg_name = "gsbi11_p_clk",
2320 .ops = &clk_ops_branch,
2321 CLK_INIT(gsbi11_p_clk.c),
2322 },
2323};
2324
2325static struct branch_clk gsbi12_p_clk = {
2326 .b = {
2327 .ctl_reg = GSBIn_HCLK_CTL_REG(12),
2328 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002329 .hwcg_reg = GSBIn_HCLK_CTL_REG(12),
2330 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002331 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2332 .halt_bit = 14,
2333 },
2334 .c = {
2335 .dbg_name = "gsbi12_p_clk",
2336 .ops = &clk_ops_branch,
2337 CLK_INIT(gsbi12_p_clk.c),
2338 },
2339};
2340
Tianyi Gou41515e22011-09-01 19:37:43 -07002341static struct branch_clk sata_phy_cfg_clk = {
2342 .b = {
2343 .ctl_reg = SATA_PHY_CFG_CLK_CTL_REG,
2344 .en_mask = BIT(4),
2345 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2346 .halt_bit = 12,
2347 },
2348 .c = {
2349 .dbg_name = "sata_phy_cfg_clk",
2350 .ops = &clk_ops_branch,
2351 CLK_INIT(sata_phy_cfg_clk.c),
Stephen Boyd973e4ba2011-07-12 17:06:01 -07002352 },
2353};
2354
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002355static struct branch_clk tsif_p_clk = {
2356 .b = {
2357 .ctl_reg = TSIF_HCLK_CTL_REG,
2358 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002359 .hwcg_reg = TSIF_HCLK_CTL_REG,
2360 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002361 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2362 .halt_bit = 7,
2363 },
2364 .c = {
2365 .dbg_name = "tsif_p_clk",
2366 .ops = &clk_ops_branch,
2367 CLK_INIT(tsif_p_clk.c),
2368 },
2369};
2370
2371static struct branch_clk usb_fs1_p_clk = {
2372 .b = {
2373 .ctl_reg = USB_FSn_HCLK_CTL_REG(1),
2374 .en_mask = BIT(4),
2375 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2376 .halt_bit = 17,
2377 },
2378 .c = {
2379 .dbg_name = "usb_fs1_p_clk",
2380 .ops = &clk_ops_branch,
2381 CLK_INIT(usb_fs1_p_clk.c),
2382 },
2383};
2384
2385static struct branch_clk usb_fs2_p_clk = {
2386 .b = {
2387 .ctl_reg = USB_FSn_HCLK_CTL_REG(2),
2388 .en_mask = BIT(4),
2389 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2390 .halt_bit = 14,
2391 },
2392 .c = {
2393 .dbg_name = "usb_fs2_p_clk",
2394 .ops = &clk_ops_branch,
2395 CLK_INIT(usb_fs2_p_clk.c),
2396 },
2397};
2398
2399static struct branch_clk usb_hs1_p_clk = {
2400 .b = {
2401 .ctl_reg = USB_HS1_HCLK_CTL_REG,
2402 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002403 .hwcg_reg = USB_HS1_HCLK_CTL_REG,
2404 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002405 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2406 .halt_bit = 1,
2407 },
2408 .c = {
2409 .dbg_name = "usb_hs1_p_clk",
2410 .ops = &clk_ops_branch,
2411 CLK_INIT(usb_hs1_p_clk.c),
2412 },
2413};
2414
Tianyi Gou41515e22011-09-01 19:37:43 -07002415static struct branch_clk usb_hs3_p_clk = {
2416 .b = {
2417 .ctl_reg = USB_HS3_HCLK_CTL_REG,
2418 .en_mask = BIT(4),
2419 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2420 .halt_bit = 31,
2421 },
2422 .c = {
2423 .dbg_name = "usb_hs3_p_clk",
2424 .ops = &clk_ops_branch,
2425 CLK_INIT(usb_hs3_p_clk.c),
2426 },
2427};
2428
2429static struct branch_clk usb_hs4_p_clk = {
2430 .b = {
2431 .ctl_reg = USB_HS4_HCLK_CTL_REG,
2432 .en_mask = BIT(4),
2433 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2434 .halt_bit = 7,
2435 },
2436 .c = {
2437 .dbg_name = "usb_hs4_p_clk",
2438 .ops = &clk_ops_branch,
2439 CLK_INIT(usb_hs4_p_clk.c),
2440 },
2441};
2442
Stephen Boyd94625ef2011-07-12 17:06:01 -07002443static struct branch_clk usb_hsic_p_clk = {
2444 .b = {
2445 .ctl_reg = USB_HSIC_HCLK_CTL_REG,
2446 .en_mask = BIT(4),
2447 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2448 .halt_bit = 28,
2449 },
2450 .c = {
2451 .dbg_name = "usb_hsic_p_clk",
2452 .ops = &clk_ops_branch,
2453 CLK_INIT(usb_hsic_p_clk.c),
2454 },
2455};
2456
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002457static struct branch_clk sdc1_p_clk = {
2458 .b = {
2459 .ctl_reg = SDCn_HCLK_CTL_REG(1),
2460 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002461 .hwcg_reg = SDCn_HCLK_CTL_REG(1),
2462 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002463 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2464 .halt_bit = 11,
2465 },
2466 .c = {
2467 .dbg_name = "sdc1_p_clk",
2468 .ops = &clk_ops_branch,
2469 CLK_INIT(sdc1_p_clk.c),
2470 },
2471};
2472
2473static struct branch_clk sdc2_p_clk = {
2474 .b = {
2475 .ctl_reg = SDCn_HCLK_CTL_REG(2),
2476 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002477 .hwcg_reg = SDCn_HCLK_CTL_REG(2),
2478 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002479 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2480 .halt_bit = 10,
2481 },
2482 .c = {
2483 .dbg_name = "sdc2_p_clk",
2484 .ops = &clk_ops_branch,
2485 CLK_INIT(sdc2_p_clk.c),
2486 },
2487};
2488
2489static struct branch_clk sdc3_p_clk = {
2490 .b = {
2491 .ctl_reg = SDCn_HCLK_CTL_REG(3),
2492 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002493 .hwcg_reg = SDCn_HCLK_CTL_REG(3),
2494 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002495 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2496 .halt_bit = 9,
2497 },
2498 .c = {
2499 .dbg_name = "sdc3_p_clk",
2500 .ops = &clk_ops_branch,
2501 CLK_INIT(sdc3_p_clk.c),
2502 },
2503};
2504
2505static struct branch_clk sdc4_p_clk = {
2506 .b = {
2507 .ctl_reg = SDCn_HCLK_CTL_REG(4),
2508 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002509 .hwcg_reg = SDCn_HCLK_CTL_REG(4),
2510 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002511 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2512 .halt_bit = 8,
2513 },
2514 .c = {
2515 .dbg_name = "sdc4_p_clk",
2516 .ops = &clk_ops_branch,
2517 CLK_INIT(sdc4_p_clk.c),
2518 },
2519};
2520
2521static struct branch_clk sdc5_p_clk = {
2522 .b = {
2523 .ctl_reg = SDCn_HCLK_CTL_REG(5),
2524 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002525 .hwcg_reg = SDCn_HCLK_CTL_REG(5),
2526 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002527 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2528 .halt_bit = 7,
2529 },
2530 .c = {
2531 .dbg_name = "sdc5_p_clk",
2532 .ops = &clk_ops_branch,
2533 CLK_INIT(sdc5_p_clk.c),
2534 },
2535};
2536
2537/* HW-Voteable Clocks */
2538static struct branch_clk adm0_clk = {
2539 .b = {
2540 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2541 .en_mask = BIT(2),
2542 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2543 .halt_check = HALT_VOTED,
2544 .halt_bit = 14,
2545 },
2546 .c = {
2547 .dbg_name = "adm0_clk",
2548 .ops = &clk_ops_branch,
2549 CLK_INIT(adm0_clk.c),
2550 },
2551};
2552
2553static struct branch_clk adm0_p_clk = {
2554 .b = {
2555 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2556 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002557 .hwcg_reg = ADM0_PBUS_CLK_CTL_REG,
2558 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002559 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2560 .halt_check = HALT_VOTED,
2561 .halt_bit = 13,
2562 },
2563 .c = {
2564 .dbg_name = "adm0_p_clk",
2565 .ops = &clk_ops_branch,
2566 CLK_INIT(adm0_p_clk.c),
2567 },
2568};
2569
2570static struct branch_clk pmic_arb0_p_clk = {
2571 .b = {
2572 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2573 .en_mask = BIT(8),
2574 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2575 .halt_check = HALT_VOTED,
2576 .halt_bit = 22,
2577 },
2578 .c = {
2579 .dbg_name = "pmic_arb0_p_clk",
2580 .ops = &clk_ops_branch,
2581 CLK_INIT(pmic_arb0_p_clk.c),
2582 },
2583};
2584
2585static struct branch_clk pmic_arb1_p_clk = {
2586 .b = {
2587 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2588 .en_mask = BIT(9),
2589 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2590 .halt_check = HALT_VOTED,
2591 .halt_bit = 21,
2592 },
2593 .c = {
2594 .dbg_name = "pmic_arb1_p_clk",
2595 .ops = &clk_ops_branch,
2596 CLK_INIT(pmic_arb1_p_clk.c),
2597 },
2598};
2599
2600static struct branch_clk pmic_ssbi2_clk = {
2601 .b = {
2602 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2603 .en_mask = BIT(7),
2604 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2605 .halt_check = HALT_VOTED,
2606 .halt_bit = 23,
2607 },
2608 .c = {
2609 .dbg_name = "pmic_ssbi2_clk",
2610 .ops = &clk_ops_branch,
2611 CLK_INIT(pmic_ssbi2_clk.c),
2612 },
2613};
2614
2615static struct branch_clk rpm_msg_ram_p_clk = {
2616 .b = {
2617 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2618 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002619 .hwcg_reg = RPM_MSG_RAM_HCLK_CTL_REG,
2620 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002621 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2622 .halt_check = HALT_VOTED,
2623 .halt_bit = 12,
2624 },
2625 .c = {
2626 .dbg_name = "rpm_msg_ram_p_clk",
2627 .ops = &clk_ops_branch,
2628 CLK_INIT(rpm_msg_ram_p_clk.c),
2629 },
2630};
2631
2632/*
2633 * Multimedia Clocks
2634 */
2635
Stephen Boyd94625ef2011-07-12 17:06:01 -07002636#define CLK_CAM(name, n, hb) \
2637 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002638 .b = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002639 .ctl_reg = CAMCLK##n##_CC_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002640 .en_mask = BIT(0), \
2641 .halt_reg = DBG_BUS_VEC_I_REG, \
2642 .halt_bit = hb, \
2643 }, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002644 .ns_reg = CAMCLK##n##_NS_REG, \
2645 .md_reg = CAMCLK##n##_MD_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002646 .root_en_mask = BIT(2), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002647 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), \
Matt Wagantall07c45472012-02-10 23:27:24 -08002648 .mnd_en_mask = BIT(5), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002649 .ctl_mask = BM(7, 6), \
2650 .set_rate = set_rate_mnd_8, \
2651 .freq_tbl = clk_tbl_cam, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002652 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002653 .c = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002654 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07002655 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002656 VDD_DIG_FMAX_MAP2(LOW, 64000000, NOMINAL, 128000000), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002657 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002658 }, \
2659 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002660#define F_CAM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002661 { \
2662 .freq_hz = f, \
2663 .src_clk = &s##_clk.c, \
2664 .md_val = MD8(8, m, 0, n), \
2665 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2666 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002667 }
2668static struct clk_freq_tbl clk_tbl_cam[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002669 F_CAM( 0, gnd, 1, 0, 0),
2670 F_CAM( 6000000, pll8, 4, 1, 16),
2671 F_CAM( 8000000, pll8, 4, 1, 12),
2672 F_CAM( 12000000, pll8, 4, 1, 8),
2673 F_CAM( 16000000, pll8, 4, 1, 6),
2674 F_CAM( 19200000, pll8, 4, 1, 5),
2675 F_CAM( 24000000, pll8, 4, 1, 4),
2676 F_CAM( 32000000, pll8, 4, 1, 3),
2677 F_CAM( 48000000, pll8, 4, 1, 2),
2678 F_CAM( 64000000, pll8, 3, 1, 2),
2679 F_CAM( 96000000, pll8, 4, 0, 0),
2680 F_CAM(128000000, pll8, 3, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002681 F_END
2682};
2683
Stephen Boyd94625ef2011-07-12 17:06:01 -07002684static CLK_CAM(cam0_clk, 0, 15);
2685static CLK_CAM(cam1_clk, 1, 16);
2686static CLK_CAM(cam2_clk, 2, 31);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002687
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002688#define F_CSI(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002689 { \
2690 .freq_hz = f, \
2691 .src_clk = &s##_clk.c, \
2692 .md_val = MD8(8, m, 0, n), \
2693 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2694 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002695 }
2696static struct clk_freq_tbl clk_tbl_csi[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002697 F_CSI( 0, gnd, 1, 0, 0),
Stephen Boyd092fd182011-10-21 15:56:30 -07002698 F_CSI( 27000000, pxo, 1, 0, 0),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002699 F_CSI( 85330000, pll8, 1, 2, 9),
2700 F_CSI(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002701 F_END
2702};
2703
2704static struct rcg_clk csi0_src_clk = {
2705 .ns_reg = CSI0_NS_REG,
2706 .b = {
2707 .ctl_reg = CSI0_CC_REG,
2708 .halt_check = NOCHECK,
2709 },
2710 .md_reg = CSI0_MD_REG,
2711 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002712 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002713 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002714 .ctl_mask = BM(7, 6),
2715 .set_rate = set_rate_mnd,
2716 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002717 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002718 .c = {
2719 .dbg_name = "csi0_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002720 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002721 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002722 CLK_INIT(csi0_src_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002723 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002724 },
2725};
2726
2727static struct branch_clk csi0_clk = {
2728 .b = {
2729 .ctl_reg = CSI0_CC_REG,
2730 .en_mask = BIT(0),
2731 .reset_reg = SW_RESET_CORE_REG,
2732 .reset_mask = BIT(8),
2733 .halt_reg = DBG_BUS_VEC_B_REG,
2734 .halt_bit = 13,
2735 },
2736 .parent = &csi0_src_clk.c,
2737 .c = {
2738 .dbg_name = "csi0_clk",
2739 .ops = &clk_ops_branch,
2740 CLK_INIT(csi0_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002741 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002742 },
2743};
2744
2745static struct branch_clk csi0_phy_clk = {
2746 .b = {
2747 .ctl_reg = CSI0_CC_REG,
2748 .en_mask = BIT(8),
2749 .reset_reg = SW_RESET_CORE_REG,
2750 .reset_mask = BIT(29),
2751 .halt_reg = DBG_BUS_VEC_I_REG,
2752 .halt_bit = 9,
2753 },
2754 .parent = &csi0_src_clk.c,
2755 .c = {
2756 .dbg_name = "csi0_phy_clk",
2757 .ops = &clk_ops_branch,
2758 CLK_INIT(csi0_phy_clk.c),
2759 },
2760};
2761
2762static struct rcg_clk csi1_src_clk = {
2763 .ns_reg = CSI1_NS_REG,
2764 .b = {
2765 .ctl_reg = CSI1_CC_REG,
2766 .halt_check = NOCHECK,
2767 },
2768 .md_reg = CSI1_MD_REG,
2769 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002770 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002771 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002772 .ctl_mask = BM(7, 6),
2773 .set_rate = set_rate_mnd,
2774 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002775 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002776 .c = {
2777 .dbg_name = "csi1_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002778 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002779 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002780 CLK_INIT(csi1_src_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002781 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002782 },
2783};
2784
2785static struct branch_clk csi1_clk = {
2786 .b = {
2787 .ctl_reg = CSI1_CC_REG,
2788 .en_mask = BIT(0),
2789 .reset_reg = SW_RESET_CORE_REG,
2790 .reset_mask = BIT(18),
2791 .halt_reg = DBG_BUS_VEC_B_REG,
2792 .halt_bit = 14,
2793 },
2794 .parent = &csi1_src_clk.c,
2795 .c = {
2796 .dbg_name = "csi1_clk",
2797 .ops = &clk_ops_branch,
2798 CLK_INIT(csi1_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002799 .warned = true,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002800 },
2801};
2802
2803static struct branch_clk csi1_phy_clk = {
2804 .b = {
2805 .ctl_reg = CSI1_CC_REG,
2806 .en_mask = BIT(8),
2807 .reset_reg = SW_RESET_CORE_REG,
2808 .reset_mask = BIT(28),
2809 .halt_reg = DBG_BUS_VEC_I_REG,
2810 .halt_bit = 10,
2811 },
2812 .parent = &csi1_src_clk.c,
2813 .c = {
2814 .dbg_name = "csi1_phy_clk",
2815 .ops = &clk_ops_branch,
2816 CLK_INIT(csi1_phy_clk.c),
2817 },
2818};
2819
Stephen Boyd94625ef2011-07-12 17:06:01 -07002820static struct rcg_clk csi2_src_clk = {
2821 .ns_reg = CSI2_NS_REG,
2822 .b = {
2823 .ctl_reg = CSI2_CC_REG,
2824 .halt_check = NOCHECK,
2825 },
2826 .md_reg = CSI2_MD_REG,
2827 .root_en_mask = BIT(2),
2828 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002829 .mnd_en_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002830 .ctl_mask = BM(7, 6),
2831 .set_rate = set_rate_mnd,
2832 .freq_tbl = clk_tbl_csi,
2833 .current_freq = &rcg_dummy_freq,
2834 .c = {
2835 .dbg_name = "csi2_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002836 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002837 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002838 CLK_INIT(csi2_src_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002839 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002840 },
2841};
2842
2843static struct branch_clk csi2_clk = {
2844 .b = {
2845 .ctl_reg = CSI2_CC_REG,
2846 .en_mask = BIT(0),
2847 .reset_reg = SW_RESET_CORE2_REG,
2848 .reset_mask = BIT(2),
2849 .halt_reg = DBG_BUS_VEC_B_REG,
2850 .halt_bit = 29,
2851 },
2852 .parent = &csi2_src_clk.c,
2853 .c = {
2854 .dbg_name = "csi2_clk",
2855 .ops = &clk_ops_branch,
2856 CLK_INIT(csi2_clk.c),
Matt Wagantall67b8a9232012-07-20 17:16:03 -07002857 .warned = true,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002858 },
2859};
2860
2861static struct branch_clk csi2_phy_clk = {
2862 .b = {
2863 .ctl_reg = CSI2_CC_REG,
2864 .en_mask = BIT(8),
2865 .reset_reg = SW_RESET_CORE_REG,
2866 .reset_mask = BIT(31),
2867 .halt_reg = DBG_BUS_VEC_I_REG,
2868 .halt_bit = 29,
2869 },
2870 .parent = &csi2_src_clk.c,
2871 .c = {
2872 .dbg_name = "csi2_phy_clk",
2873 .ops = &clk_ops_branch,
2874 CLK_INIT(csi2_phy_clk.c),
2875 },
2876};
2877
Stephen Boyd092fd182011-10-21 15:56:30 -07002878static struct clk *pix_rdi_mux_map[] = {
2879 [0] = &csi0_clk.c,
2880 [1] = &csi1_clk.c,
2881 [2] = &csi2_clk.c,
2882 NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002883};
2884
Stephen Boyd092fd182011-10-21 15:56:30 -07002885struct pix_rdi_clk {
Stephen Boydd86d1f22012-01-24 17:36:34 -08002886 bool prepared;
Stephen Boyd092fd182011-10-21 15:56:30 -07002887 bool enabled;
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002888 unsigned long cur_rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002889
2890 void __iomem *const s_reg;
2891 u32 s_mask;
2892
2893 void __iomem *const s2_reg;
2894 u32 s2_mask;
2895
2896 struct branch b;
2897 struct clk c;
2898};
2899
Matt Wagantallf82f2942012-01-27 13:56:13 -08002900static inline struct pix_rdi_clk *to_pix_rdi_clk(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002901{
Matt Wagantallf82f2942012-01-27 13:56:13 -08002902 return container_of(c, struct pix_rdi_clk, c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002903}
2904
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002905static int pix_rdi_clk_set_rate(struct clk *c, unsigned long rate)
Stephen Boyd092fd182011-10-21 15:56:30 -07002906{
2907 int ret, i;
2908 u32 reg;
2909 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002910 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002911 struct clk **mux_map = pix_rdi_mux_map;
Stephen Boydd86d1f22012-01-24 17:36:34 -08002912 unsigned long old_rate = rdi->cur_rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002913
2914 /*
2915 * These clocks select three inputs via two muxes. One mux selects
2916 * between csi0 and csi1 and the second mux selects between that mux's
2917 * output and csi2. The source and destination selections for each
2918 * mux must be clocking for the switch to succeed so just turn on
2919 * all three sources because it's easier than figuring out what source
2920 * needs to be on at what time.
2921 */
2922 for (i = 0; mux_map[i]; i++) {
Stephen Boydd86d1f22012-01-24 17:36:34 -08002923 ret = clk_prepare_enable(mux_map[i]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002924 if (ret)
2925 goto err;
2926 }
2927 if (rate >= i) {
2928 ret = -EINVAL;
2929 goto err;
2930 }
2931 /* Keep the new source on when switching inputs of an enabled clock */
Stephen Boydd86d1f22012-01-24 17:36:34 -08002932 if (rdi->prepared) {
2933 ret = clk_prepare(mux_map[rate]);
2934 if (ret)
2935 goto err;
Stephen Boyd092fd182011-10-21 15:56:30 -07002936 }
Stephen Boydd86d1f22012-01-24 17:36:34 -08002937 spin_lock_irqsave(&c->lock, flags);
2938 if (rdi->enabled) {
2939 ret = clk_enable(mux_map[rate]);
2940 if (ret) {
2941 spin_unlock_irqrestore(&c->lock, flags);
2942 clk_unprepare(mux_map[rate]);
2943 goto err;
2944 }
2945 }
2946 spin_lock(&local_clock_reg_lock);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002947 reg = readl_relaxed(rdi->s2_reg);
2948 reg &= ~rdi->s2_mask;
2949 reg |= rate == 2 ? rdi->s2_mask : 0;
2950 writel_relaxed(reg, rdi->s2_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002951 /*
2952 * Wait at least 6 cycles of slowest clock
2953 * for the glitch-free MUX to fully switch sources.
2954 */
2955 mb();
2956 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002957 reg = readl_relaxed(rdi->s_reg);
2958 reg &= ~rdi->s_mask;
2959 reg |= rate == 1 ? rdi->s_mask : 0;
2960 writel_relaxed(reg, rdi->s_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002961 /*
2962 * Wait at least 6 cycles of slowest clock
2963 * for the glitch-free MUX to fully switch sources.
2964 */
2965 mb();
2966 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002967 rdi->cur_rate = rate;
Stephen Boydd86d1f22012-01-24 17:36:34 -08002968 spin_unlock(&local_clock_reg_lock);
2969
2970 if (rdi->enabled)
2971 clk_disable(mux_map[old_rate]);
2972 spin_unlock_irqrestore(&c->lock, flags);
2973 if (rdi->prepared)
2974 clk_unprepare(mux_map[old_rate]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002975err:
2976 for (i--; i >= 0; i--)
Stephen Boydd86d1f22012-01-24 17:36:34 -08002977 clk_disable_unprepare(mux_map[i]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002978
2979 return 0;
2980}
2981
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002982static unsigned long pix_rdi_clk_get_rate(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002983{
2984 return to_pix_rdi_clk(c)->cur_rate;
2985}
2986
Stephen Boydd86d1f22012-01-24 17:36:34 -08002987static int pix_rdi_clk_prepare(struct clk *c)
2988{
2989 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
2990 rdi->prepared = true;
2991 return 0;
2992}
2993
Stephen Boyd092fd182011-10-21 15:56:30 -07002994static int pix_rdi_clk_enable(struct clk *c)
2995{
2996 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002997 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002998
2999 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07003000 __branch_enable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07003001 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08003002 rdi->enabled = true;
Stephen Boyd092fd182011-10-21 15:56:30 -07003003
3004 return 0;
3005}
3006
3007static void pix_rdi_clk_disable(struct clk *c)
3008{
3009 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08003010 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07003011
3012 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07003013 __branch_disable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07003014 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08003015 rdi->enabled = false;
Stephen Boyd092fd182011-10-21 15:56:30 -07003016}
3017
Stephen Boydd86d1f22012-01-24 17:36:34 -08003018static void pix_rdi_clk_unprepare(struct clk *c)
3019{
3020 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
3021 rdi->prepared = false;
3022}
3023
Matt Wagantallf82f2942012-01-27 13:56:13 -08003024static int pix_rdi_clk_reset(struct clk *c, enum clk_reset_action action)
Stephen Boyd092fd182011-10-21 15:56:30 -07003025{
Matt Wagantallf82f2942012-01-27 13:56:13 -08003026 return branch_reset(&to_pix_rdi_clk(c)->b, action);
Stephen Boyd092fd182011-10-21 15:56:30 -07003027}
3028
3029static struct clk *pix_rdi_clk_get_parent(struct clk *c)
3030{
Matt Wagantallf82f2942012-01-27 13:56:13 -08003031 return pix_rdi_mux_map[to_pix_rdi_clk(c)->cur_rate];
Stephen Boyd092fd182011-10-21 15:56:30 -07003032}
3033
3034static int pix_rdi_clk_list_rate(struct clk *c, unsigned n)
3035{
3036 if (pix_rdi_mux_map[n])
3037 return n;
3038 return -ENXIO;
3039}
3040
Matt Wagantalla15833b2012-04-03 11:00:56 -07003041static enum handoff pix_rdi_clk_handoff(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07003042{
3043 u32 reg;
Matt Wagantallf82f2942012-01-27 13:56:13 -08003044 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07003045 enum handoff ret;
3046
Matt Wagantallf82f2942012-01-27 13:56:13 -08003047 ret = branch_handoff(&rdi->b, &rdi->c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07003048 if (ret == HANDOFF_DISABLED_CLK)
3049 return ret;
Stephen Boyd092fd182011-10-21 15:56:30 -07003050
Matt Wagantallf82f2942012-01-27 13:56:13 -08003051 reg = readl_relaxed(rdi->s_reg);
3052 rdi->cur_rate = reg & rdi->s_mask ? 1 : 0;
3053 reg = readl_relaxed(rdi->s2_reg);
3054 rdi->cur_rate = reg & rdi->s2_mask ? 2 : rdi->cur_rate;
Matt Wagantalla15833b2012-04-03 11:00:56 -07003055
3056 return HANDOFF_ENABLED_CLK;
Stephen Boyd092fd182011-10-21 15:56:30 -07003057}
3058
3059static struct clk_ops clk_ops_pix_rdi_8960 = {
Stephen Boydd86d1f22012-01-24 17:36:34 -08003060 .prepare = pix_rdi_clk_prepare,
Stephen Boyd092fd182011-10-21 15:56:30 -07003061 .enable = pix_rdi_clk_enable,
3062 .disable = pix_rdi_clk_disable,
Stephen Boydd86d1f22012-01-24 17:36:34 -08003063 .unprepare = pix_rdi_clk_unprepare,
Stephen Boyd092fd182011-10-21 15:56:30 -07003064 .handoff = pix_rdi_clk_handoff,
3065 .set_rate = pix_rdi_clk_set_rate,
3066 .get_rate = pix_rdi_clk_get_rate,
3067 .list_rate = pix_rdi_clk_list_rate,
3068 .reset = pix_rdi_clk_reset,
Stephen Boyd092fd182011-10-21 15:56:30 -07003069 .get_parent = pix_rdi_clk_get_parent,
3070};
3071
3072static struct pix_rdi_clk csi_pix_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003073 .b = {
3074 .ctl_reg = MISC_CC_REG,
3075 .en_mask = BIT(26),
3076 .halt_check = DELAY,
3077 .reset_reg = SW_RESET_CORE_REG,
3078 .reset_mask = BIT(26),
3079 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003080 .s_reg = MISC_CC_REG,
3081 .s_mask = BIT(25),
3082 .s2_reg = MISC_CC3_REG,
3083 .s2_mask = BIT(13),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003084 .c = {
3085 .dbg_name = "csi_pix_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003086 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003087 CLK_INIT(csi_pix_clk.c),
3088 },
3089};
3090
Stephen Boyd092fd182011-10-21 15:56:30 -07003091static struct pix_rdi_clk csi_pix1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003092 .b = {
3093 .ctl_reg = MISC_CC3_REG,
3094 .en_mask = BIT(10),
3095 .halt_check = DELAY,
3096 .reset_reg = SW_RESET_CORE_REG,
3097 .reset_mask = BIT(30),
3098 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003099 .s_reg = MISC_CC3_REG,
3100 .s_mask = BIT(8),
3101 .s2_reg = MISC_CC3_REG,
3102 .s2_mask = BIT(9),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003103 .c = {
3104 .dbg_name = "csi_pix1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003105 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003106 CLK_INIT(csi_pix1_clk.c),
3107 },
3108};
3109
Stephen Boyd092fd182011-10-21 15:56:30 -07003110static struct pix_rdi_clk csi_rdi_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003111 .b = {
3112 .ctl_reg = MISC_CC_REG,
3113 .en_mask = BIT(13),
3114 .halt_check = DELAY,
3115 .reset_reg = SW_RESET_CORE_REG,
3116 .reset_mask = BIT(27),
3117 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003118 .s_reg = MISC_CC_REG,
3119 .s_mask = BIT(12),
3120 .s2_reg = MISC_CC3_REG,
3121 .s2_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003122 .c = {
3123 .dbg_name = "csi_rdi_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003124 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003125 CLK_INIT(csi_rdi_clk.c),
3126 },
3127};
3128
Stephen Boyd092fd182011-10-21 15:56:30 -07003129static struct pix_rdi_clk csi_rdi1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003130 .b = {
3131 .ctl_reg = MISC_CC3_REG,
3132 .en_mask = BIT(2),
3133 .halt_check = DELAY,
3134 .reset_reg = SW_RESET_CORE2_REG,
3135 .reset_mask = BIT(1),
3136 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003137 .s_reg = MISC_CC3_REG,
3138 .s_mask = BIT(0),
3139 .s2_reg = MISC_CC3_REG,
3140 .s2_mask = BIT(1),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003141 .c = {
3142 .dbg_name = "csi_rdi1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003143 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003144 CLK_INIT(csi_rdi1_clk.c),
3145 },
3146};
3147
Stephen Boyd092fd182011-10-21 15:56:30 -07003148static struct pix_rdi_clk csi_rdi2_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003149 .b = {
3150 .ctl_reg = MISC_CC3_REG,
3151 .en_mask = BIT(6),
3152 .halt_check = DELAY,
3153 .reset_reg = SW_RESET_CORE2_REG,
3154 .reset_mask = BIT(0),
3155 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003156 .s_reg = MISC_CC3_REG,
3157 .s_mask = BIT(4),
3158 .s2_reg = MISC_CC3_REG,
3159 .s2_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003160 .c = {
3161 .dbg_name = "csi_rdi2_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003162 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003163 CLK_INIT(csi_rdi2_clk.c),
3164 },
3165};
3166
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003167#define F_CSI_PHYTIMER(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003168 { \
3169 .freq_hz = f, \
3170 .src_clk = &s##_clk.c, \
3171 .md_val = MD8(8, m, 0, n), \
3172 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
3173 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003174 }
3175static struct clk_freq_tbl clk_tbl_csi_phytimer[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003176 F_CSI_PHYTIMER( 0, gnd, 1, 0, 0),
3177 F_CSI_PHYTIMER( 85330000, pll8, 1, 2, 9),
3178 F_CSI_PHYTIMER(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003179 F_END
3180};
3181
3182static struct rcg_clk csiphy_timer_src_clk = {
3183 .ns_reg = CSIPHYTIMER_NS_REG,
3184 .b = {
3185 .ctl_reg = CSIPHYTIMER_CC_REG,
3186 .halt_check = NOCHECK,
3187 },
3188 .md_reg = CSIPHYTIMER_MD_REG,
3189 .root_en_mask = BIT(2),
3190 .ns_mask = (BM(31, 24) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003191 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003192 .ctl_mask = BM(7, 6),
3193 .set_rate = set_rate_mnd_8,
3194 .freq_tbl = clk_tbl_csi_phytimer,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003195 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003196 .c = {
3197 .dbg_name = "csiphy_timer_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003198 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003199 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003200 CLK_INIT(csiphy_timer_src_clk.c),
3201 },
3202};
3203
3204static struct branch_clk csi0phy_timer_clk = {
3205 .b = {
3206 .ctl_reg = CSIPHYTIMER_CC_REG,
3207 .en_mask = BIT(0),
3208 .halt_reg = DBG_BUS_VEC_I_REG,
3209 .halt_bit = 17,
3210 },
3211 .parent = &csiphy_timer_src_clk.c,
3212 .c = {
3213 .dbg_name = "csi0phy_timer_clk",
3214 .ops = &clk_ops_branch,
3215 CLK_INIT(csi0phy_timer_clk.c),
3216 },
3217};
3218
3219static struct branch_clk csi1phy_timer_clk = {
3220 .b = {
3221 .ctl_reg = CSIPHYTIMER_CC_REG,
3222 .en_mask = BIT(9),
3223 .halt_reg = DBG_BUS_VEC_I_REG,
3224 .halt_bit = 18,
3225 },
3226 .parent = &csiphy_timer_src_clk.c,
3227 .c = {
3228 .dbg_name = "csi1phy_timer_clk",
3229 .ops = &clk_ops_branch,
3230 CLK_INIT(csi1phy_timer_clk.c),
3231 },
3232};
3233
Stephen Boyd94625ef2011-07-12 17:06:01 -07003234static struct branch_clk csi2phy_timer_clk = {
3235 .b = {
3236 .ctl_reg = CSIPHYTIMER_CC_REG,
3237 .en_mask = BIT(11),
3238 .halt_reg = DBG_BUS_VEC_I_REG,
3239 .halt_bit = 30,
3240 },
3241 .parent = &csiphy_timer_src_clk.c,
3242 .c = {
3243 .dbg_name = "csi2phy_timer_clk",
3244 .ops = &clk_ops_branch,
3245 CLK_INIT(csi2phy_timer_clk.c),
3246 },
3247};
3248
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003249#define F_DSI(d) \
3250 { \
3251 .freq_hz = d, \
3252 .ns_val = BVAL(15, 12, (d-1)), \
3253 }
3254/*
3255 * The DSI_BYTE/ESC clock is sourced from the DSI PHY PLL, which may change rate
3256 * without this clock driver knowing. So, overload the clk_set_rate() to set
3257 * the divider (1 to 16) of the clock with respect to the PLL rate.
3258 */
3259static struct clk_freq_tbl clk_tbl_dsi_byte[] = {
3260 F_DSI(1), F_DSI(2), F_DSI(3), F_DSI(4),
3261 F_DSI(5), F_DSI(6), F_DSI(7), F_DSI(8),
3262 F_DSI(9), F_DSI(10), F_DSI(11), F_DSI(12),
3263 F_DSI(13), F_DSI(14), F_DSI(15), F_DSI(16),
3264 F_END
3265};
3266
Matt Wagantall735e41b2012-07-23 17:18:58 -07003267static struct branch_clk dsi1_reset_clk = {
3268 .b = {
3269 .reset_reg = SW_RESET_CORE_REG,
3270 .reset_mask = BIT(7),
3271 .halt_check = NOCHECK,
3272 },
3273 .c = {
3274 .dbg_name = "dsi1_reset_clk",
3275 .ops = &clk_ops_branch,
3276 CLK_INIT(dsi1_reset_clk.c),
3277 },
3278};
3279
3280static struct branch_clk dsi2_reset_clk = {
3281 .b = {
3282 .reset_reg = SW_RESET_CORE_REG,
3283 .reset_mask = BIT(25),
3284 .halt_check = NOCHECK,
3285 },
3286 .c = {
3287 .dbg_name = "dsi2_reset_clk",
3288 .ops = &clk_ops_branch,
3289 CLK_INIT(dsi2_reset_clk.c),
3290 },
3291};
3292
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003293static struct rcg_clk dsi1_byte_clk = {
3294 .b = {
3295 .ctl_reg = DSI1_BYTE_CC_REG,
3296 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003297 .halt_reg = DBG_BUS_VEC_B_REG,
3298 .halt_bit = 21,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003299 .retain_reg = DSI1_BYTE_CC_REG,
3300 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003301 },
3302 .ns_reg = DSI1_BYTE_NS_REG,
3303 .root_en_mask = BIT(2),
3304 .ns_mask = BM(15, 12),
3305 .set_rate = set_rate_nop,
3306 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003307 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003308 .c = {
3309 .dbg_name = "dsi1_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003310 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003311 CLK_INIT(dsi1_byte_clk.c),
3312 },
3313};
3314
3315static struct rcg_clk dsi2_byte_clk = {
3316 .b = {
3317 .ctl_reg = DSI2_BYTE_CC_REG,
3318 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003319 .halt_reg = DBG_BUS_VEC_B_REG,
3320 .halt_bit = 20,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003321 .retain_reg = DSI2_BYTE_CC_REG,
3322 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003323 },
3324 .ns_reg = DSI2_BYTE_NS_REG,
3325 .root_en_mask = BIT(2),
3326 .ns_mask = BM(15, 12),
3327 .set_rate = set_rate_nop,
3328 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003329 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003330 .c = {
3331 .dbg_name = "dsi2_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003332 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003333 CLK_INIT(dsi2_byte_clk.c),
3334 },
3335};
3336
3337static struct rcg_clk dsi1_esc_clk = {
3338 .b = {
3339 .ctl_reg = DSI1_ESC_CC_REG,
3340 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003341 .halt_reg = DBG_BUS_VEC_I_REG,
3342 .halt_bit = 1,
3343 },
3344 .ns_reg = DSI1_ESC_NS_REG,
3345 .root_en_mask = BIT(2),
3346 .ns_mask = BM(15, 12),
3347 .set_rate = set_rate_nop,
3348 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003349 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003350 .c = {
3351 .dbg_name = "dsi1_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003352 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003353 CLK_INIT(dsi1_esc_clk.c),
3354 },
3355};
3356
3357static struct rcg_clk dsi2_esc_clk = {
3358 .b = {
3359 .ctl_reg = DSI2_ESC_CC_REG,
3360 .en_mask = BIT(0),
3361 .halt_reg = DBG_BUS_VEC_I_REG,
3362 .halt_bit = 3,
3363 },
3364 .ns_reg = DSI2_ESC_NS_REG,
3365 .root_en_mask = BIT(2),
3366 .ns_mask = BM(15, 12),
3367 .set_rate = set_rate_nop,
3368 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003369 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003370 .c = {
3371 .dbg_name = "dsi2_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003372 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003373 CLK_INIT(dsi2_esc_clk.c),
3374 },
3375};
3376
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003377#define F_GFX2D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003378 { \
3379 .freq_hz = f, \
3380 .src_clk = &s##_clk.c, \
3381 .md_val = MD4(4, m, 0, n), \
3382 .ns_val = NS_MND_BANKED4(20, 16, n, m, 3, 0, s##_to_mm_mux), \
3383 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003384 }
3385static struct clk_freq_tbl clk_tbl_gfx2d[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003386 F_GFX2D( 0, gnd, 0, 0),
3387 F_GFX2D( 27000000, pxo, 0, 0),
3388 F_GFX2D( 48000000, pll8, 1, 8),
3389 F_GFX2D( 54857000, pll8, 1, 7),
3390 F_GFX2D( 64000000, pll8, 1, 6),
3391 F_GFX2D( 76800000, pll8, 1, 5),
3392 F_GFX2D( 96000000, pll8, 1, 4),
3393 F_GFX2D(128000000, pll8, 1, 3),
3394 F_GFX2D(145455000, pll2, 2, 11),
3395 F_GFX2D(160000000, pll2, 1, 5),
3396 F_GFX2D(177778000, pll2, 2, 9),
3397 F_GFX2D(200000000, pll2, 1, 4),
3398 F_GFX2D(228571000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003399 F_END
3400};
3401
3402static struct bank_masks bmnd_info_gfx2d0 = {
3403 .bank_sel_mask = BIT(11),
3404 .bank0_mask = {
3405 .md_reg = GFX2D0_MD0_REG,
3406 .ns_mask = BM(23, 20) | BM(5, 3),
3407 .rst_mask = BIT(25),
3408 .mnd_en_mask = BIT(8),
3409 .mode_mask = BM(10, 9),
3410 },
3411 .bank1_mask = {
3412 .md_reg = GFX2D0_MD1_REG,
3413 .ns_mask = BM(19, 16) | BM(2, 0),
3414 .rst_mask = BIT(24),
3415 .mnd_en_mask = BIT(5),
3416 .mode_mask = BM(7, 6),
3417 },
3418};
3419
3420static struct rcg_clk gfx2d0_clk = {
3421 .b = {
3422 .ctl_reg = GFX2D0_CC_REG,
3423 .en_mask = BIT(0),
3424 .reset_reg = SW_RESET_CORE_REG,
3425 .reset_mask = BIT(14),
3426 .halt_reg = DBG_BUS_VEC_A_REG,
3427 .halt_bit = 9,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003428 .retain_reg = GFX2D0_CC_REG,
3429 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003430 },
3431 .ns_reg = GFX2D0_NS_REG,
3432 .root_en_mask = BIT(2),
3433 .set_rate = set_rate_mnd_banked,
3434 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003435 .bank_info = &bmnd_info_gfx2d0,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003436 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003437 .c = {
3438 .dbg_name = "gfx2d0_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003439 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003440 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003441 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3442 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003443 CLK_INIT(gfx2d0_clk.c),
3444 },
3445};
3446
3447static struct bank_masks bmnd_info_gfx2d1 = {
3448 .bank_sel_mask = BIT(11),
3449 .bank0_mask = {
3450 .md_reg = GFX2D1_MD0_REG,
3451 .ns_mask = BM(23, 20) | BM(5, 3),
3452 .rst_mask = BIT(25),
3453 .mnd_en_mask = BIT(8),
3454 .mode_mask = BM(10, 9),
3455 },
3456 .bank1_mask = {
3457 .md_reg = GFX2D1_MD1_REG,
3458 .ns_mask = BM(19, 16) | BM(2, 0),
3459 .rst_mask = BIT(24),
3460 .mnd_en_mask = BIT(5),
3461 .mode_mask = BM(7, 6),
3462 },
3463};
3464
3465static struct rcg_clk gfx2d1_clk = {
3466 .b = {
3467 .ctl_reg = GFX2D1_CC_REG,
3468 .en_mask = BIT(0),
3469 .reset_reg = SW_RESET_CORE_REG,
3470 .reset_mask = BIT(13),
3471 .halt_reg = DBG_BUS_VEC_A_REG,
3472 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003473 .retain_reg = GFX2D1_CC_REG,
3474 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003475 },
3476 .ns_reg = GFX2D1_NS_REG,
3477 .root_en_mask = BIT(2),
3478 .set_rate = set_rate_mnd_banked,
3479 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003480 .bank_info = &bmnd_info_gfx2d1,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003481 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003482 .c = {
3483 .dbg_name = "gfx2d1_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003484 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003485 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003486 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3487 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003488 CLK_INIT(gfx2d1_clk.c),
3489 },
3490};
3491
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003492#define F_GFX3D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003493 { \
3494 .freq_hz = f, \
3495 .src_clk = &s##_clk.c, \
3496 .md_val = MD4(4, m, 0, n), \
3497 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3498 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003499 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003500
Patrick Dalye6f489042012-07-11 15:29:15 -07003501static struct clk_freq_tbl clk_tbl_gfx3d_8960ab[] = {
3502 F_GFX3D( 0, gnd, 0, 0),
3503 F_GFX3D( 27000000, pxo, 0, 0),
3504 F_GFX3D( 48000000, pll8, 1, 8),
3505 F_GFX3D( 54857000, pll8, 1, 7),
3506 F_GFX3D( 64000000, pll8, 1, 6),
3507 F_GFX3D( 76800000, pll8, 1, 5),
3508 F_GFX3D( 96000000, pll8, 1, 4),
3509 F_GFX3D(128000000, pll8, 1, 3),
3510 F_GFX3D(145455000, pll2, 2, 11),
3511 F_GFX3D(160000000, pll2, 1, 5),
3512 F_GFX3D(177778000, pll2, 2, 9),
3513 F_GFX3D(200000000, pll2, 1, 4),
3514 F_GFX3D(228571000, pll2, 2, 7),
3515 F_GFX3D(266667000, pll2, 1, 3),
3516 F_GFX3D(320000000, pll2, 2, 5),
3517 F_GFX3D(325000000, pll3, 1, 2),
3518 F_GFX3D(400000000, pll2, 1, 2),
3519 F_END
3520};
3521
Tianyi Gou41515e22011-09-01 19:37:43 -07003522static struct clk_freq_tbl clk_tbl_gfx3d_8960[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003523 F_GFX3D( 0, gnd, 0, 0),
3524 F_GFX3D( 27000000, pxo, 0, 0),
3525 F_GFX3D( 48000000, pll8, 1, 8),
3526 F_GFX3D( 54857000, pll8, 1, 7),
3527 F_GFX3D( 64000000, pll8, 1, 6),
3528 F_GFX3D( 76800000, pll8, 1, 5),
3529 F_GFX3D( 96000000, pll8, 1, 4),
3530 F_GFX3D(128000000, pll8, 1, 3),
3531 F_GFX3D(145455000, pll2, 2, 11),
3532 F_GFX3D(160000000, pll2, 1, 5),
3533 F_GFX3D(177778000, pll2, 2, 9),
3534 F_GFX3D(200000000, pll2, 1, 4),
3535 F_GFX3D(228571000, pll2, 2, 7),
3536 F_GFX3D(266667000, pll2, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003537 F_GFX3D(300000000, pll3, 1, 4),
3538 F_GFX3D(320000000, pll2, 2, 5),
3539 F_GFX3D(400000000, pll2, 1, 2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003540 F_END
3541};
3542
Tianyi Gou41515e22011-09-01 19:37:43 -07003543static struct clk_freq_tbl clk_tbl_gfx3d_8064[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003544 F_GFX3D( 0, gnd, 0, 0),
3545 F_GFX3D( 27000000, pxo, 0, 0),
3546 F_GFX3D( 48000000, pll8, 1, 8),
3547 F_GFX3D( 54857000, pll8, 1, 7),
3548 F_GFX3D( 64000000, pll8, 1, 6),
3549 F_GFX3D( 76800000, pll8, 1, 5),
3550 F_GFX3D( 96000000, pll8, 1, 4),
3551 F_GFX3D(128000000, pll8, 1, 3),
3552 F_GFX3D(145455000, pll2, 2, 11),
3553 F_GFX3D(160000000, pll2, 1, 5),
3554 F_GFX3D(177778000, pll2, 2, 9),
3555 F_GFX3D(200000000, pll2, 1, 4),
3556 F_GFX3D(228571000, pll2, 2, 7),
3557 F_GFX3D(266667000, pll2, 1, 3),
Tianyi Gou0c50fe32011-10-19 15:50:35 -07003558 F_GFX3D(325000000, pll15, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003559 F_GFX3D(400000000, pll2, 1, 2),
Tianyi Gou41515e22011-09-01 19:37:43 -07003560 F_END
3561};
3562
Tianyi Goue3d4f542012-03-15 17:06:45 -07003563static struct clk_freq_tbl clk_tbl_gfx3d_8930[] = {
3564 F_GFX3D( 0, gnd, 0, 0),
3565 F_GFX3D( 27000000, pxo, 0, 0),
3566 F_GFX3D( 48000000, pll8, 1, 8),
3567 F_GFX3D( 54857000, pll8, 1, 7),
3568 F_GFX3D( 64000000, pll8, 1, 6),
3569 F_GFX3D( 76800000, pll8, 1, 5),
3570 F_GFX3D( 96000000, pll8, 1, 4),
3571 F_GFX3D(128000000, pll8, 1, 3),
3572 F_GFX3D(145455000, pll2, 2, 11),
3573 F_GFX3D(160000000, pll2, 1, 5),
3574 F_GFX3D(177778000, pll2, 2, 9),
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003575 F_GFX3D(192000000, pll8, 1, 2),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003576 F_GFX3D(200000000, pll2, 1, 4),
3577 F_GFX3D(228571000, pll2, 2, 7),
3578 F_GFX3D(266667000, pll2, 1, 3),
Tianyi Goue3d4f542012-03-15 17:06:45 -07003579 F_GFX3D(320000000, pll2, 2, 5),
3580 F_GFX3D(400000000, pll2, 1, 2),
3581 F_GFX3D(450000000, pll15, 1, 2),
3582 F_END
3583};
3584
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003585static unsigned long fmax_gfx3d_8064[MAX_VDD_LEVELS] __initdata = {
3586 [VDD_DIG_LOW] = 128000000,
3587 [VDD_DIG_NOMINAL] = 325000000,
3588 [VDD_DIG_HIGH] = 400000000
3589};
3590
Tianyi Goue3d4f542012-03-15 17:06:45 -07003591static unsigned long fmax_gfx3d_8930[MAX_VDD_LEVELS] __initdata = {
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003592 [VDD_DIG_LOW] = 192000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003593 [VDD_DIG_NOMINAL] = 320000000,
Patrick Dalyebe63c52012-08-07 15:41:30 -07003594 [VDD_DIG_HIGH] = 400000000
3595};
3596
3597static unsigned long fmax_gfx3d_8930aa[MAX_VDD_LEVELS] __initdata = {
3598 [VDD_DIG_LOW] = 192000000,
3599 [VDD_DIG_NOMINAL] = 320000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003600 [VDD_DIG_HIGH] = 450000000
3601};
3602
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003603static struct bank_masks bmnd_info_gfx3d = {
3604 .bank_sel_mask = BIT(11),
3605 .bank0_mask = {
3606 .md_reg = GFX3D_MD0_REG,
3607 .ns_mask = BM(21, 18) | BM(5, 3),
3608 .rst_mask = BIT(23),
3609 .mnd_en_mask = BIT(8),
3610 .mode_mask = BM(10, 9),
3611 },
3612 .bank1_mask = {
3613 .md_reg = GFX3D_MD1_REG,
3614 .ns_mask = BM(17, 14) | BM(2, 0),
3615 .rst_mask = BIT(22),
3616 .mnd_en_mask = BIT(5),
3617 .mode_mask = BM(7, 6),
3618 },
3619};
3620
3621static struct rcg_clk gfx3d_clk = {
3622 .b = {
3623 .ctl_reg = GFX3D_CC_REG,
3624 .en_mask = BIT(0),
3625 .reset_reg = SW_RESET_CORE_REG,
3626 .reset_mask = BIT(12),
3627 .halt_reg = DBG_BUS_VEC_A_REG,
3628 .halt_bit = 4,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003629 .retain_reg = GFX3D_CC_REG,
3630 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003631 },
3632 .ns_reg = GFX3D_NS_REG,
3633 .root_en_mask = BIT(2),
3634 .set_rate = set_rate_mnd_banked,
Tianyi Gou41515e22011-09-01 19:37:43 -07003635 .freq_tbl = clk_tbl_gfx3d_8960,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003636 .bank_info = &bmnd_info_gfx3d,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003637 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003638 .c = {
3639 .dbg_name = "gfx3d_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003640 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003641 VDD_DIG_FMAX_MAP3(LOW, 128000000, NOMINAL, 300000000,
3642 HIGH, 400000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003643 CLK_INIT(gfx3d_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003644 .depends = &gmem_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003645 },
3646};
3647
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003648#define F_VCAP(f, s, m, n) \
Tianyi Gou621f8742011-09-01 21:45:01 -07003649 { \
3650 .freq_hz = f, \
3651 .src_clk = &s##_clk.c, \
3652 .md_val = MD4(4, m, 0, n), \
3653 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3654 .ctl_val = CC_BANKED(9, 6, n), \
Tianyi Gou621f8742011-09-01 21:45:01 -07003655 }
3656
3657static struct clk_freq_tbl clk_tbl_vcap[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003658 F_VCAP( 0, gnd, 0, 0),
3659 F_VCAP( 27000000, pxo, 0, 0),
3660 F_VCAP( 54860000, pll8, 1, 7),
3661 F_VCAP( 64000000, pll8, 1, 6),
3662 F_VCAP( 76800000, pll8, 1, 5),
3663 F_VCAP(128000000, pll8, 1, 3),
3664 F_VCAP(160000000, pll2, 1, 5),
3665 F_VCAP(200000000, pll2, 1, 4),
Tianyi Gou621f8742011-09-01 21:45:01 -07003666 F_END
3667};
3668
3669static struct bank_masks bmnd_info_vcap = {
3670 .bank_sel_mask = BIT(11),
3671 .bank0_mask = {
3672 .md_reg = VCAP_MD0_REG,
3673 .ns_mask = BM(21, 18) | BM(5, 3),
3674 .rst_mask = BIT(23),
3675 .mnd_en_mask = BIT(8),
3676 .mode_mask = BM(10, 9),
3677 },
3678 .bank1_mask = {
3679 .md_reg = VCAP_MD1_REG,
3680 .ns_mask = BM(17, 14) | BM(2, 0),
3681 .rst_mask = BIT(22),
3682 .mnd_en_mask = BIT(5),
3683 .mode_mask = BM(7, 6),
3684 },
3685};
3686
3687static struct rcg_clk vcap_clk = {
3688 .b = {
3689 .ctl_reg = VCAP_CC_REG,
3690 .en_mask = BIT(0),
3691 .halt_reg = DBG_BUS_VEC_J_REG,
3692 .halt_bit = 15,
3693 },
3694 .ns_reg = VCAP_NS_REG,
3695 .root_en_mask = BIT(2),
3696 .set_rate = set_rate_mnd_banked,
3697 .freq_tbl = clk_tbl_vcap,
3698 .bank_info = &bmnd_info_vcap,
3699 .current_freq = &rcg_dummy_freq,
3700 .c = {
3701 .dbg_name = "vcap_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003702 .ops = &clk_ops_rcg,
Tianyi Gou621f8742011-09-01 21:45:01 -07003703 .depends = &vcap_axi_clk.c,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003704 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
Tianyi Gou621f8742011-09-01 21:45:01 -07003705 CLK_INIT(vcap_clk.c),
3706 },
3707};
3708
3709static struct branch_clk vcap_npl_clk = {
3710 .b = {
3711 .ctl_reg = VCAP_CC_REG,
3712 .en_mask = BIT(13),
3713 .halt_reg = DBG_BUS_VEC_J_REG,
3714 .halt_bit = 25,
3715 },
3716 .parent = &vcap_clk.c,
3717 .c = {
3718 .dbg_name = "vcap_npl_clk",
3719 .ops = &clk_ops_branch,
3720 CLK_INIT(vcap_npl_clk.c),
3721 },
3722};
3723
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003724#define F_IJPEG(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003725 { \
3726 .freq_hz = f, \
3727 .src_clk = &s##_clk.c, \
3728 .md_val = MD8(8, m, 0, n), \
3729 .ns_val = NS_MM(23, 16, n, m, 15, 12, d, 2, 0, s##_to_mm_mux), \
3730 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003731 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003732
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003733static struct clk_freq_tbl clk_tbl_ijpeg[] = {
3734 F_IJPEG( 0, gnd, 1, 0, 0),
3735 F_IJPEG( 27000000, pxo, 1, 0, 0),
3736 F_IJPEG( 36570000, pll8, 1, 2, 21),
3737 F_IJPEG( 54860000, pll8, 7, 0, 0),
3738 F_IJPEG( 96000000, pll8, 4, 0, 0),
3739 F_IJPEG(109710000, pll8, 1, 2, 7),
3740 F_IJPEG(128000000, pll8, 3, 0, 0),
3741 F_IJPEG(153600000, pll8, 1, 2, 5),
3742 F_IJPEG(200000000, pll2, 4, 0, 0),
3743 F_IJPEG(228571000, pll2, 1, 2, 7),
3744 F_IJPEG(266667000, pll2, 1, 1, 3),
3745 F_IJPEG(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003746 F_END
3747};
3748
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003749static unsigned long fmax_ijpeg_8064[MAX_VDD_LEVELS] __initdata = {
3750 [VDD_DIG_LOW] = 128000000,
3751 [VDD_DIG_NOMINAL] = 266667000,
3752 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07003753};
3754
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003755static struct rcg_clk ijpeg_clk = {
3756 .b = {
3757 .ctl_reg = IJPEG_CC_REG,
3758 .en_mask = BIT(0),
3759 .reset_reg = SW_RESET_CORE_REG,
3760 .reset_mask = BIT(9),
3761 .halt_reg = DBG_BUS_VEC_A_REG,
3762 .halt_bit = 24,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003763 .retain_reg = IJPEG_CC_REG,
3764 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003765 },
3766 .ns_reg = IJPEG_NS_REG,
3767 .md_reg = IJPEG_MD_REG,
3768 .root_en_mask = BIT(2),
3769 .ns_mask = (BM(23, 16) | BM(15, 12) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003770 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003771 .ctl_mask = BM(7, 6),
3772 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003773 .freq_tbl = clk_tbl_ijpeg,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003774 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003775 .c = {
3776 .dbg_name = "ijpeg_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003777 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003778 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
3779 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003780 CLK_INIT(ijpeg_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003781 .depends = &ijpeg_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003782 },
3783};
3784
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003785#define F_JPEGD(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003786 { \
3787 .freq_hz = f, \
3788 .src_clk = &s##_clk.c, \
3789 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003790 }
3791static struct clk_freq_tbl clk_tbl_jpegd[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003792 F_JPEGD( 0, gnd, 1),
3793 F_JPEGD( 64000000, pll8, 6),
3794 F_JPEGD( 76800000, pll8, 5),
3795 F_JPEGD( 96000000, pll8, 4),
3796 F_JPEGD(160000000, pll2, 5),
3797 F_JPEGD(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003798 F_END
3799};
3800
3801static struct rcg_clk jpegd_clk = {
3802 .b = {
3803 .ctl_reg = JPEGD_CC_REG,
3804 .en_mask = BIT(0),
3805 .reset_reg = SW_RESET_CORE_REG,
3806 .reset_mask = BIT(19),
3807 .halt_reg = DBG_BUS_VEC_A_REG,
3808 .halt_bit = 19,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003809 .retain_reg = JPEGD_CC_REG,
3810 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003811 },
3812 .ns_reg = JPEGD_NS_REG,
3813 .root_en_mask = BIT(2),
3814 .ns_mask = (BM(15, 12) | BM(2, 0)),
3815 .set_rate = set_rate_nop,
3816 .freq_tbl = clk_tbl_jpegd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003817 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003818 .c = {
3819 .dbg_name = "jpegd_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003820 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003821 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003822 CLK_INIT(jpegd_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003823 .depends = &jpegd_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003824 },
3825};
3826
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003827#define F_MDP(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003828 { \
3829 .freq_hz = f, \
3830 .src_clk = &s##_clk.c, \
3831 .md_val = MD8(8, m, 0, n), \
3832 .ns_val = NS_MND_BANKED8(22, 14, n, m, 3, 0, s##_to_mm_mux), \
3833 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003834 }
Patrick Dalye6f489042012-07-11 15:29:15 -07003835static struct clk_freq_tbl clk_tbl_mdp_8960ab[] = {
3836 F_MDP( 0, gnd, 0, 0),
3837 F_MDP( 9600000, pll8, 1, 40),
3838 F_MDP( 13710000, pll8, 1, 28),
3839 F_MDP( 27000000, pxo, 0, 0),
3840 F_MDP( 29540000, pll8, 1, 13),
3841 F_MDP( 34910000, pll8, 1, 11),
3842 F_MDP( 38400000, pll8, 1, 10),
3843 F_MDP( 59080000, pll8, 2, 13),
3844 F_MDP( 76800000, pll8, 1, 5),
3845 F_MDP( 85330000, pll8, 2, 9),
3846 F_MDP( 96000000, pll8, 1, 4),
3847 F_MDP(128000000, pll8, 1, 3),
3848 F_MDP(160000000, pll2, 1, 5),
3849 F_MDP(177780000, pll2, 2, 9),
3850 F_MDP(200000000, pll2, 1, 4),
3851 F_MDP(228571000, pll2, 2, 7),
3852 F_MDP(266667000, pll2, 1, 3),
3853 F_END
3854};
3855
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003856static struct clk_freq_tbl clk_tbl_mdp[] = {
3857 F_MDP( 0, gnd, 0, 0),
3858 F_MDP( 9600000, pll8, 1, 40),
3859 F_MDP( 13710000, pll8, 1, 28),
3860 F_MDP( 27000000, pxo, 0, 0),
3861 F_MDP( 29540000, pll8, 1, 13),
3862 F_MDP( 34910000, pll8, 1, 11),
3863 F_MDP( 38400000, pll8, 1, 10),
3864 F_MDP( 59080000, pll8, 2, 13),
3865 F_MDP( 76800000, pll8, 1, 5),
3866 F_MDP( 85330000, pll8, 2, 9),
3867 F_MDP( 96000000, pll8, 1, 4),
3868 F_MDP(128000000, pll8, 1, 3),
3869 F_MDP(160000000, pll2, 1, 5),
3870 F_MDP(177780000, pll2, 2, 9),
3871 F_MDP(200000000, pll2, 1, 4),
3872 F_MDP(266667000, pll2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003873 F_END
3874};
3875
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003876static unsigned long fmax_mdp_8064[MAX_VDD_LEVELS] __initdata = {
3877 [VDD_DIG_LOW] = 128000000,
3878 [VDD_DIG_NOMINAL] = 266667000
Tianyi Gou621f8742011-09-01 21:45:01 -07003879};
3880
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003881static struct bank_masks bmnd_info_mdp = {
3882 .bank_sel_mask = BIT(11),
3883 .bank0_mask = {
3884 .md_reg = MDP_MD0_REG,
3885 .ns_mask = BM(29, 22) | BM(5, 3),
3886 .rst_mask = BIT(31),
3887 .mnd_en_mask = BIT(8),
3888 .mode_mask = BM(10, 9),
3889 },
3890 .bank1_mask = {
3891 .md_reg = MDP_MD1_REG,
3892 .ns_mask = BM(21, 14) | BM(2, 0),
3893 .rst_mask = BIT(30),
3894 .mnd_en_mask = BIT(5),
3895 .mode_mask = BM(7, 6),
3896 },
3897};
3898
3899static struct rcg_clk mdp_clk = {
3900 .b = {
3901 .ctl_reg = MDP_CC_REG,
3902 .en_mask = BIT(0),
3903 .reset_reg = SW_RESET_CORE_REG,
3904 .reset_mask = BIT(21),
3905 .halt_reg = DBG_BUS_VEC_C_REG,
3906 .halt_bit = 10,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003907 .retain_reg = MDP_CC_REG,
3908 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003909 },
3910 .ns_reg = MDP_NS_REG,
3911 .root_en_mask = BIT(2),
3912 .set_rate = set_rate_mnd_banked,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003913 .freq_tbl = clk_tbl_mdp,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003914 .bank_info = &bmnd_info_mdp,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003915 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003916 .c = {
3917 .dbg_name = "mdp_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003918 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003919 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003920 CLK_INIT(mdp_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003921 .depends = &mdp_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003922 },
3923};
3924
3925static struct branch_clk lut_mdp_clk = {
3926 .b = {
3927 .ctl_reg = MDP_LUT_CC_REG,
3928 .en_mask = BIT(0),
3929 .halt_reg = DBG_BUS_VEC_I_REG,
3930 .halt_bit = 13,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003931 .retain_reg = MDP_LUT_CC_REG,
3932 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003933 },
3934 .parent = &mdp_clk.c,
3935 .c = {
3936 .dbg_name = "lut_mdp_clk",
3937 .ops = &clk_ops_branch,
3938 CLK_INIT(lut_mdp_clk.c),
3939 },
3940};
3941
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003942#define F_MDP_VSYNC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003943 { \
3944 .freq_hz = f, \
3945 .src_clk = &s##_clk.c, \
3946 .ns_val = NS_SRC_SEL(13, 13, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003947 }
3948static struct clk_freq_tbl clk_tbl_mdp_vsync[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003949 F_MDP_VSYNC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003950 F_END
3951};
3952
3953static struct rcg_clk mdp_vsync_clk = {
3954 .b = {
3955 .ctl_reg = MISC_CC_REG,
3956 .en_mask = BIT(6),
3957 .reset_reg = SW_RESET_CORE_REG,
3958 .reset_mask = BIT(3),
3959 .halt_reg = DBG_BUS_VEC_B_REG,
3960 .halt_bit = 22,
3961 },
3962 .ns_reg = MISC_CC2_REG,
3963 .ns_mask = BIT(13),
3964 .set_rate = set_rate_nop,
3965 .freq_tbl = clk_tbl_mdp_vsync,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003966 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003967 .c = {
3968 .dbg_name = "mdp_vsync_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003969 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003970 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003971 CLK_INIT(mdp_vsync_clk.c),
3972 },
3973};
3974
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003975#define F_ROT(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003976 { \
3977 .freq_hz = f, \
3978 .src_clk = &s##_clk.c, \
3979 .ns_val = NS_DIVSRC_BANKED(29, 26, 25, 22, d, \
3980 21, 19, 18, 16, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003981 }
3982static struct clk_freq_tbl clk_tbl_rot[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003983 F_ROT( 0, gnd, 1),
3984 F_ROT( 27000000, pxo, 1),
3985 F_ROT( 29540000, pll8, 13),
3986 F_ROT( 32000000, pll8, 12),
3987 F_ROT( 38400000, pll8, 10),
3988 F_ROT( 48000000, pll8, 8),
3989 F_ROT( 54860000, pll8, 7),
3990 F_ROT( 64000000, pll8, 6),
3991 F_ROT( 76800000, pll8, 5),
3992 F_ROT( 96000000, pll8, 4),
3993 F_ROT(100000000, pll2, 8),
3994 F_ROT(114290000, pll2, 7),
3995 F_ROT(133330000, pll2, 6),
3996 F_ROT(160000000, pll2, 5),
3997 F_ROT(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003998 F_END
3999};
4000
4001static struct bank_masks bdiv_info_rot = {
4002 .bank_sel_mask = BIT(30),
4003 .bank0_mask = {
4004 .ns_mask = BM(25, 22) | BM(18, 16),
4005 },
4006 .bank1_mask = {
4007 .ns_mask = BM(29, 26) | BM(21, 19),
4008 },
4009};
4010
4011static struct rcg_clk rot_clk = {
4012 .b = {
4013 .ctl_reg = ROT_CC_REG,
4014 .en_mask = BIT(0),
4015 .reset_reg = SW_RESET_CORE_REG,
4016 .reset_mask = BIT(2),
4017 .halt_reg = DBG_BUS_VEC_C_REG,
4018 .halt_bit = 15,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004019 .retain_reg = ROT_CC_REG,
4020 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004021 },
4022 .ns_reg = ROT_NS_REG,
4023 .root_en_mask = BIT(2),
4024 .set_rate = set_rate_div_banked,
4025 .freq_tbl = clk_tbl_rot,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004026 .bank_info = &bdiv_info_rot,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004027 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004028 .c = {
4029 .dbg_name = "rot_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004030 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004031 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004032 CLK_INIT(rot_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004033 .depends = &rot_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004034 },
4035};
4036
Matt Wagantallf82f2942012-01-27 13:56:13 -08004037static int hdmi_pll_clk_enable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004038{
4039 int ret;
4040 unsigned long flags;
4041 spin_lock_irqsave(&local_clock_reg_lock, flags);
4042 ret = hdmi_pll_enable();
4043 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4044 return ret;
4045}
4046
Matt Wagantallf82f2942012-01-27 13:56:13 -08004047static void hdmi_pll_clk_disable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004048{
4049 unsigned long flags;
4050 spin_lock_irqsave(&local_clock_reg_lock, flags);
4051 hdmi_pll_disable();
4052 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4053}
4054
Matt Wagantallf82f2942012-01-27 13:56:13 -08004055static struct clk *hdmi_pll_clk_get_parent(struct clk *c)
Stephen Boyd5b35dee2011-09-21 12:17:38 -07004056{
4057 return &pxo_clk.c;
4058}
4059
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004060static struct clk_ops clk_ops_hdmi_pll = {
4061 .enable = hdmi_pll_clk_enable,
4062 .disable = hdmi_pll_clk_disable,
Stephen Boyd5b35dee2011-09-21 12:17:38 -07004063 .get_parent = hdmi_pll_clk_get_parent,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004064};
4065
4066static struct clk hdmi_pll_clk = {
4067 .dbg_name = "hdmi_pll_clk",
4068 .ops = &clk_ops_hdmi_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -07004069 .vdd_class = &vdd_sr2_hdmi_pll,
4070 .fmax[VDD_SR2_HDMI_PLL_ON] = ULONG_MAX,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004071 CLK_INIT(hdmi_pll_clk),
4072};
4073
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004074#define F_TV_GND(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004075 { \
4076 .freq_hz = f, \
4077 .src_clk = &s##_clk.c, \
4078 .md_val = MD8(8, m, 0, n), \
4079 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
4080 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004081 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004082#define F_TV(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004083 { \
4084 .freq_hz = f, \
4085 .src_clk = &s##_clk, \
4086 .md_val = MD8(8, m, 0, n), \
4087 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
4088 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004089 .extra_freq_data = (void *)p_r, \
4090 }
4091/* Switching TV freqs requires PLL reconfiguration. */
4092static struct clk_freq_tbl clk_tbl_tv[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004093 F_TV_GND( 0, gnd, 0, 1, 0, 0),
4094 F_TV( 25200000, hdmi_pll, 25200000, 1, 0, 0),
4095 F_TV( 27000000, hdmi_pll, 27000000, 1, 0, 0),
4096 F_TV( 27030000, hdmi_pll, 27030000, 1, 0, 0),
4097 F_TV( 74250000, hdmi_pll, 74250000, 1, 0, 0),
4098 F_TV(148500000, hdmi_pll, 148500000, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004099 F_END
4100};
4101
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004102static unsigned long fmax_tv_src_8064[MAX_VDD_LEVELS] __initdata = {
4103 [VDD_DIG_LOW] = 74250000,
4104 [VDD_DIG_NOMINAL] = 149000000
4105};
4106
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004107/*
4108 * Unlike other clocks, the TV rate is adjusted through PLL
4109 * re-programming. It is also routed through an MND divider.
4110 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08004111void set_rate_tv(struct rcg_clk *rcg, struct clk_freq_tbl *nf)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004112{
4113 unsigned long pll_rate = (unsigned long)nf->extra_freq_data;
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004114 if (pll_rate) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004115 hdmi_pll_set_rate(pll_rate);
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004116 hdmi_pll_clk.rate = pll_rate;
4117 }
Matt Wagantallf82f2942012-01-27 13:56:13 -08004118 set_rate_mnd(rcg, nf);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004119}
4120
4121static struct rcg_clk tv_src_clk = {
4122 .ns_reg = TV_NS_REG,
4123 .b = {
4124 .ctl_reg = TV_CC_REG,
4125 .halt_check = NOCHECK,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004126 .retain_reg = TV_CC_REG,
4127 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004128 },
4129 .md_reg = TV_MD_REG,
4130 .root_en_mask = BIT(2),
4131 .ns_mask = (BM(23, 16) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004132 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004133 .ctl_mask = BM(7, 6),
4134 .set_rate = set_rate_tv,
4135 .freq_tbl = clk_tbl_tv,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004136 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004137 .c = {
4138 .dbg_name = "tv_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004139 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004140 VDD_DIG_FMAX_MAP2(LOW, 27030000, NOMINAL, 149000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004141 CLK_INIT(tv_src_clk.c),
4142 },
4143};
4144
Tianyi Gou51918802012-01-26 14:05:43 -08004145static struct cdiv_clk tv_src_div_clk = {
4146 .b = {
4147 .ctl_reg = TV_NS_REG,
4148 .halt_check = NOCHECK,
4149 },
4150 .ns_reg = TV_NS_REG,
4151 .div_offset = 6,
4152 .max_div = 2,
4153 .c = {
4154 .dbg_name = "tv_src_div_clk",
4155 .ops = &clk_ops_cdiv,
4156 CLK_INIT(tv_src_div_clk.c),
Stephen Boydd51d5e82012-06-18 18:09:50 -07004157 .rate = ULONG_MAX,
Tianyi Gou51918802012-01-26 14:05:43 -08004158 },
4159};
4160
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004161static struct branch_clk tv_enc_clk = {
4162 .b = {
4163 .ctl_reg = TV_CC_REG,
4164 .en_mask = BIT(8),
4165 .reset_reg = SW_RESET_CORE_REG,
4166 .reset_mask = BIT(0),
4167 .halt_reg = DBG_BUS_VEC_D_REG,
4168 .halt_bit = 9,
4169 },
4170 .parent = &tv_src_clk.c,
4171 .c = {
4172 .dbg_name = "tv_enc_clk",
4173 .ops = &clk_ops_branch,
4174 CLK_INIT(tv_enc_clk.c),
4175 },
4176};
4177
4178static struct branch_clk tv_dac_clk = {
4179 .b = {
4180 .ctl_reg = TV_CC_REG,
4181 .en_mask = BIT(10),
4182 .halt_reg = DBG_BUS_VEC_D_REG,
4183 .halt_bit = 10,
4184 },
4185 .parent = &tv_src_clk.c,
4186 .c = {
4187 .dbg_name = "tv_dac_clk",
4188 .ops = &clk_ops_branch,
4189 CLK_INIT(tv_dac_clk.c),
4190 },
4191};
4192
4193static struct branch_clk mdp_tv_clk = {
4194 .b = {
4195 .ctl_reg = TV_CC_REG,
4196 .en_mask = BIT(0),
4197 .reset_reg = SW_RESET_CORE_REG,
4198 .reset_mask = BIT(4),
4199 .halt_reg = DBG_BUS_VEC_D_REG,
4200 .halt_bit = 12,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004201 .retain_reg = TV_CC2_REG,
4202 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004203 },
4204 .parent = &tv_src_clk.c,
4205 .c = {
4206 .dbg_name = "mdp_tv_clk",
4207 .ops = &clk_ops_branch,
4208 CLK_INIT(mdp_tv_clk.c),
4209 },
4210};
4211
4212static struct branch_clk hdmi_tv_clk = {
4213 .b = {
4214 .ctl_reg = TV_CC_REG,
4215 .en_mask = BIT(12),
4216 .reset_reg = SW_RESET_CORE_REG,
4217 .reset_mask = BIT(1),
4218 .halt_reg = DBG_BUS_VEC_D_REG,
4219 .halt_bit = 11,
4220 },
4221 .parent = &tv_src_clk.c,
4222 .c = {
4223 .dbg_name = "hdmi_tv_clk",
4224 .ops = &clk_ops_branch,
4225 CLK_INIT(hdmi_tv_clk.c),
4226 },
4227};
4228
Tianyi Gou51918802012-01-26 14:05:43 -08004229static struct branch_clk rgb_tv_clk = {
4230 .b = {
4231 .ctl_reg = TV_CC2_REG,
4232 .en_mask = BIT(14),
4233 .halt_reg = DBG_BUS_VEC_J_REG,
4234 .halt_bit = 27,
4235 },
4236 .parent = &tv_src_clk.c,
4237 .c = {
4238 .dbg_name = "rgb_tv_clk",
4239 .ops = &clk_ops_branch,
4240 CLK_INIT(rgb_tv_clk.c),
4241 },
4242};
4243
4244static struct branch_clk npl_tv_clk = {
4245 .b = {
4246 .ctl_reg = TV_CC2_REG,
4247 .en_mask = BIT(16),
4248 .halt_reg = DBG_BUS_VEC_J_REG,
4249 .halt_bit = 26,
4250 },
4251 .parent = &tv_src_clk.c,
4252 .c = {
4253 .dbg_name = "npl_tv_clk",
4254 .ops = &clk_ops_branch,
4255 CLK_INIT(npl_tv_clk.c),
4256 },
4257};
4258
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004259static struct branch_clk hdmi_app_clk = {
4260 .b = {
4261 .ctl_reg = MISC_CC2_REG,
4262 .en_mask = BIT(11),
4263 .reset_reg = SW_RESET_CORE_REG,
4264 .reset_mask = BIT(11),
4265 .halt_reg = DBG_BUS_VEC_B_REG,
4266 .halt_bit = 25,
4267 },
4268 .c = {
4269 .dbg_name = "hdmi_app_clk",
4270 .ops = &clk_ops_branch,
4271 CLK_INIT(hdmi_app_clk.c),
4272 },
4273};
4274
4275static struct bank_masks bmnd_info_vcodec = {
4276 .bank_sel_mask = BIT(13),
4277 .bank0_mask = {
4278 .md_reg = VCODEC_MD0_REG,
4279 .ns_mask = BM(18, 11) | BM(2, 0),
4280 .rst_mask = BIT(31),
4281 .mnd_en_mask = BIT(5),
4282 .mode_mask = BM(7, 6),
4283 },
4284 .bank1_mask = {
4285 .md_reg = VCODEC_MD1_REG,
4286 .ns_mask = BM(26, 19) | BM(29, 27),
4287 .rst_mask = BIT(30),
4288 .mnd_en_mask = BIT(10),
4289 .mode_mask = BM(12, 11),
4290 },
4291};
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004292#define F_VCODEC(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004293 { \
4294 .freq_hz = f, \
4295 .src_clk = &s##_clk.c, \
4296 .md_val = MD8(8, m, 0, n), \
4297 .ns_val = NS_MND_BANKED8(11, 19, n, m, 0, 27, s##_to_mm_mux), \
4298 .ctl_val = CC_BANKED(6, 11, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004299 }
4300static struct clk_freq_tbl clk_tbl_vcodec[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004301 F_VCODEC( 0, gnd, 0, 0),
4302 F_VCODEC( 27000000, pxo, 0, 0),
4303 F_VCODEC( 32000000, pll8, 1, 12),
4304 F_VCODEC( 48000000, pll8, 1, 8),
4305 F_VCODEC( 54860000, pll8, 1, 7),
4306 F_VCODEC( 96000000, pll8, 1, 4),
4307 F_VCODEC(133330000, pll2, 1, 6),
4308 F_VCODEC(200000000, pll2, 1, 4),
4309 F_VCODEC(228570000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004310 F_END
4311};
4312
4313static struct rcg_clk vcodec_clk = {
4314 .b = {
4315 .ctl_reg = VCODEC_CC_REG,
4316 .en_mask = BIT(0),
4317 .reset_reg = SW_RESET_CORE_REG,
4318 .reset_mask = BIT(6),
4319 .halt_reg = DBG_BUS_VEC_C_REG,
4320 .halt_bit = 29,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004321 .retain_reg = VCODEC_CC_REG,
4322 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004323 },
4324 .ns_reg = VCODEC_NS_REG,
4325 .root_en_mask = BIT(2),
4326 .set_rate = set_rate_mnd_banked,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004327 .bank_info = &bmnd_info_vcodec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004328 .freq_tbl = clk_tbl_vcodec,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004329 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004330 .c = {
4331 .dbg_name = "vcodec_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004332 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004333 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
4334 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004335 CLK_INIT(vcodec_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004336 .depends = &vcodec_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004337 },
4338};
4339
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004340#define F_VPE(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004341 { \
4342 .freq_hz = f, \
4343 .src_clk = &s##_clk.c, \
4344 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004345 }
4346static struct clk_freq_tbl clk_tbl_vpe[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004347 F_VPE( 0, gnd, 1),
4348 F_VPE( 27000000, pxo, 1),
4349 F_VPE( 34909000, pll8, 11),
4350 F_VPE( 38400000, pll8, 10),
4351 F_VPE( 64000000, pll8, 6),
4352 F_VPE( 76800000, pll8, 5),
4353 F_VPE( 96000000, pll8, 4),
4354 F_VPE(100000000, pll2, 8),
4355 F_VPE(160000000, pll2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004356 F_END
4357};
4358
4359static struct rcg_clk vpe_clk = {
4360 .b = {
4361 .ctl_reg = VPE_CC_REG,
4362 .en_mask = BIT(0),
4363 .reset_reg = SW_RESET_CORE_REG,
4364 .reset_mask = BIT(17),
4365 .halt_reg = DBG_BUS_VEC_A_REG,
4366 .halt_bit = 28,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004367 .retain_reg = VPE_CC_REG,
4368 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004369 },
4370 .ns_reg = VPE_NS_REG,
4371 .root_en_mask = BIT(2),
4372 .ns_mask = (BM(15, 12) | BM(2, 0)),
4373 .set_rate = set_rate_nop,
4374 .freq_tbl = clk_tbl_vpe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004375 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004376 .c = {
4377 .dbg_name = "vpe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004378 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004379 VDD_DIG_FMAX_MAP2(LOW, 76800000, NOMINAL, 160000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004380 CLK_INIT(vpe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004381 .depends = &vpe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004382 },
4383};
4384
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004385#define F_VFE(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004386 { \
4387 .freq_hz = f, \
4388 .src_clk = &s##_clk.c, \
4389 .md_val = MD8(8, m, 0, n), \
4390 .ns_val = NS_MM(23, 16, n, m, 11, 10, d, 2, 0, s##_to_mm_mux), \
4391 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004392 }
Tianyi Gou41515e22011-09-01 19:37:43 -07004393
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004394static struct clk_freq_tbl clk_tbl_vfe[] = {
4395 F_VFE( 0, gnd, 1, 0, 0),
4396 F_VFE( 13960000, pll8, 1, 2, 55),
4397 F_VFE( 27000000, pxo, 1, 0, 0),
4398 F_VFE( 36570000, pll8, 1, 2, 21),
4399 F_VFE( 38400000, pll8, 2, 1, 5),
4400 F_VFE( 45180000, pll8, 1, 2, 17),
4401 F_VFE( 48000000, pll8, 2, 1, 4),
4402 F_VFE( 54860000, pll8, 1, 1, 7),
4403 F_VFE( 64000000, pll8, 2, 1, 3),
4404 F_VFE( 76800000, pll8, 1, 1, 5),
4405 F_VFE( 96000000, pll8, 2, 1, 2),
4406 F_VFE(109710000, pll8, 1, 2, 7),
4407 F_VFE(128000000, pll8, 1, 1, 3),
4408 F_VFE(153600000, pll8, 1, 2, 5),
4409 F_VFE(200000000, pll2, 2, 1, 2),
4410 F_VFE(228570000, pll2, 1, 2, 7),
4411 F_VFE(266667000, pll2, 1, 1, 3),
4412 F_VFE(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004413 F_END
4414};
4415
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004416static unsigned long fmax_vfe_8064[MAX_VDD_LEVELS] __initdata = {
4417 [VDD_DIG_LOW] = 128000000,
4418 [VDD_DIG_NOMINAL] = 266667000,
4419 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07004420};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004421
4422static struct rcg_clk vfe_clk = {
4423 .b = {
4424 .ctl_reg = VFE_CC_REG,
4425 .reset_reg = SW_RESET_CORE_REG,
4426 .reset_mask = BIT(15),
4427 .halt_reg = DBG_BUS_VEC_B_REG,
4428 .halt_bit = 6,
4429 .en_mask = BIT(0),
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004430 .retain_reg = VFE_CC2_REG,
4431 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004432 },
4433 .ns_reg = VFE_NS_REG,
4434 .md_reg = VFE_MD_REG,
4435 .root_en_mask = BIT(2),
4436 .ns_mask = (BM(23, 16) | BM(11, 10) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004437 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004438 .ctl_mask = BM(7, 6),
4439 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004440 .freq_tbl = clk_tbl_vfe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004441 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004442 .c = {
4443 .dbg_name = "vfe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004444 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08004445 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
4446 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004447 CLK_INIT(vfe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004448 .depends = &vfe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004449 },
4450};
4451
Matt Wagantallc23eee92011-08-16 23:06:52 -07004452static struct branch_clk csi_vfe_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004453 .b = {
4454 .ctl_reg = VFE_CC_REG,
4455 .en_mask = BIT(12),
4456 .reset_reg = SW_RESET_CORE_REG,
4457 .reset_mask = BIT(24),
4458 .halt_reg = DBG_BUS_VEC_B_REG,
4459 .halt_bit = 8,
4460 },
4461 .parent = &vfe_clk.c,
4462 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -07004463 .dbg_name = "csi_vfe_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004464 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -07004465 CLK_INIT(csi_vfe_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004466 },
4467};
4468
4469/*
4470 * Low Power Audio Clocks
4471 */
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004472#define F_AIF_OSR(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004473 { \
4474 .freq_hz = f, \
4475 .src_clk = &s##_clk.c, \
4476 .md_val = MD8(8, m, 0, n), \
4477 .ns_val = NS(31, 24, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004478 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004479static struct clk_freq_tbl clk_tbl_aif_osr_492[] = {
4480 F_AIF_OSR( 0, gnd, 1, 0, 0),
4481 F_AIF_OSR( 512000, pll4, 4, 1, 240),
4482 F_AIF_OSR( 768000, pll4, 4, 1, 160),
4483 F_AIF_OSR( 1024000, pll4, 4, 1, 120),
4484 F_AIF_OSR( 1536000, pll4, 4, 1, 80),
4485 F_AIF_OSR( 2048000, pll4, 4, 1, 60),
4486 F_AIF_OSR( 3072000, pll4, 4, 1, 40),
4487 F_AIF_OSR( 4096000, pll4, 4, 1, 30),
4488 F_AIF_OSR( 6144000, pll4, 4, 1, 20),
4489 F_AIF_OSR( 8192000, pll4, 4, 1, 15),
4490 F_AIF_OSR(12288000, pll4, 4, 1, 10),
4491 F_AIF_OSR(24576000, pll4, 4, 1, 5),
4492 F_END
4493};
4494
4495static struct clk_freq_tbl clk_tbl_aif_osr_393[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004496 F_AIF_OSR( 0, gnd, 1, 0, 0),
4497 F_AIF_OSR( 512000, pll4, 4, 1, 192),
4498 F_AIF_OSR( 768000, pll4, 4, 1, 128),
4499 F_AIF_OSR( 1024000, pll4, 4, 1, 96),
4500 F_AIF_OSR( 1536000, pll4, 4, 1, 64),
4501 F_AIF_OSR( 2048000, pll4, 4, 1, 48),
4502 F_AIF_OSR( 3072000, pll4, 4, 1, 32),
4503 F_AIF_OSR( 4096000, pll4, 4, 1, 24),
4504 F_AIF_OSR( 6144000, pll4, 4, 1, 16),
4505 F_AIF_OSR( 8192000, pll4, 4, 1, 12),
4506 F_AIF_OSR(12288000, pll4, 4, 1, 8),
4507 F_AIF_OSR(24576000, pll4, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004508 F_END
4509};
4510
4511#define CLK_AIF_OSR(i, ns, md, h_r) \
4512 struct rcg_clk i##_clk = { \
4513 .b = { \
4514 .ctl_reg = ns, \
4515 .en_mask = BIT(17), \
4516 .reset_reg = ns, \
4517 .reset_mask = BIT(19), \
4518 .halt_reg = h_r, \
4519 .halt_check = ENABLE, \
4520 .halt_bit = 1, \
4521 }, \
4522 .ns_reg = ns, \
4523 .md_reg = md, \
4524 .root_en_mask = BIT(9), \
4525 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004526 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004527 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004528 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004529 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004530 .c = { \
4531 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004532 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004533 VDD_DIG_FMAX_MAP1(LOW, 24576000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004534 CLK_INIT(i##_clk.c), \
4535 }, \
4536 }
4537#define CLK_AIF_OSR_DIV(i, ns, md, h_r) \
4538 struct rcg_clk i##_clk = { \
4539 .b = { \
4540 .ctl_reg = ns, \
4541 .en_mask = BIT(21), \
4542 .reset_reg = ns, \
4543 .reset_mask = BIT(23), \
4544 .halt_reg = h_r, \
4545 .halt_check = ENABLE, \
4546 .halt_bit = 1, \
4547 }, \
4548 .ns_reg = ns, \
4549 .md_reg = md, \
4550 .root_en_mask = BIT(9), \
4551 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004552 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004553 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004554 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004555 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004556 .c = { \
4557 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004558 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004559 VDD_DIG_FMAX_MAP1(LOW, 24576000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004560 CLK_INIT(i##_clk.c), \
4561 }, \
4562 }
4563
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004564#define CLK_AIF_BIT(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004565 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004566 .b = { \
4567 .ctl_reg = ns, \
4568 .en_mask = BIT(15), \
4569 .halt_reg = h_r, \
4570 .halt_check = DELAY, \
4571 }, \
4572 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004573 .ext_mask = BIT(14), \
4574 .div_offset = 10, \
4575 .max_div = 16, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004576 .c = { \
4577 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004578 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004579 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004580 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004581 }, \
4582 }
4583
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004584#define CLK_AIF_BIT_DIV(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004585 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004586 .b = { \
4587 .ctl_reg = ns, \
4588 .en_mask = BIT(19), \
4589 .halt_reg = h_r, \
Stephen Boyd7bb9cf82012-01-25 18:09:01 -08004590 .halt_check = DELAY, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004591 }, \
4592 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004593 .ext_mask = BIT(18), \
4594 .div_offset = 10, \
4595 .max_div = 256, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004596 .c = { \
4597 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004598 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004599 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004600 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004601 }, \
4602 }
4603
4604static CLK_AIF_OSR(mi2s_osr, LCC_MI2S_NS_REG, LCC_MI2S_MD_REG,
4605 LCC_MI2S_STATUS_REG);
4606static CLK_AIF_BIT(mi2s_bit, LCC_MI2S_NS_REG, LCC_MI2S_STATUS_REG);
4607
4608static CLK_AIF_OSR_DIV(codec_i2s_mic_osr, LCC_CODEC_I2S_MIC_NS_REG,
4609 LCC_CODEC_I2S_MIC_MD_REG, LCC_CODEC_I2S_MIC_STATUS_REG);
4610static CLK_AIF_BIT_DIV(codec_i2s_mic_bit, LCC_CODEC_I2S_MIC_NS_REG,
4611 LCC_CODEC_I2S_MIC_STATUS_REG);
4612
4613static CLK_AIF_OSR_DIV(spare_i2s_mic_osr, LCC_SPARE_I2S_MIC_NS_REG,
4614 LCC_SPARE_I2S_MIC_MD_REG, LCC_SPARE_I2S_MIC_STATUS_REG);
4615static CLK_AIF_BIT_DIV(spare_i2s_mic_bit, LCC_SPARE_I2S_MIC_NS_REG,
4616 LCC_SPARE_I2S_MIC_STATUS_REG);
4617
4618static CLK_AIF_OSR_DIV(codec_i2s_spkr_osr, LCC_CODEC_I2S_SPKR_NS_REG,
4619 LCC_CODEC_I2S_SPKR_MD_REG, LCC_CODEC_I2S_SPKR_STATUS_REG);
4620static CLK_AIF_BIT_DIV(codec_i2s_spkr_bit, LCC_CODEC_I2S_SPKR_NS_REG,
4621 LCC_CODEC_I2S_SPKR_STATUS_REG);
4622
4623static CLK_AIF_OSR_DIV(spare_i2s_spkr_osr, LCC_SPARE_I2S_SPKR_NS_REG,
4624 LCC_SPARE_I2S_SPKR_MD_REG, LCC_SPARE_I2S_SPKR_STATUS_REG);
4625static CLK_AIF_BIT_DIV(spare_i2s_spkr_bit, LCC_SPARE_I2S_SPKR_NS_REG,
4626 LCC_SPARE_I2S_SPKR_STATUS_REG);
4627
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004628#define F_PCM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004629 { \
4630 .freq_hz = f, \
4631 .src_clk = &s##_clk.c, \
4632 .md_val = MD16(m, n), \
4633 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004634 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004635static struct clk_freq_tbl clk_tbl_pcm_492[] = {
4636 { .ns_val = BIT(10) /* external input */ },
Stephen Boyde9ed94d2012-08-02 10:57:11 -07004637 F_PCM( 256000, pll4, 4, 1, 480),
Matt Wagantall86e03822011-12-12 10:59:24 -08004638 F_PCM( 512000, pll4, 4, 1, 240),
4639 F_PCM( 768000, pll4, 4, 1, 160),
4640 F_PCM( 1024000, pll4, 4, 1, 120),
4641 F_PCM( 1536000, pll4, 4, 1, 80),
4642 F_PCM( 2048000, pll4, 4, 1, 60),
4643 F_PCM( 3072000, pll4, 4, 1, 40),
4644 F_PCM( 4096000, pll4, 4, 1, 30),
4645 F_PCM( 6144000, pll4, 4, 1, 20),
4646 F_PCM( 8192000, pll4, 4, 1, 15),
4647 F_PCM(12288000, pll4, 4, 1, 10),
4648 F_PCM(24576000, pll4, 4, 1, 5),
4649 F_END
4650};
4651
4652static struct clk_freq_tbl clk_tbl_pcm_393[] = {
Stephen Boyd630f3252012-01-31 00:10:08 -08004653 { .ns_val = BIT(10) /* external input */ },
Stephen Boyde9ed94d2012-08-02 10:57:11 -07004654 F_PCM( 256000, pll4, 4, 1, 384),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004655 F_PCM( 512000, pll4, 4, 1, 192),
4656 F_PCM( 768000, pll4, 4, 1, 128),
4657 F_PCM( 1024000, pll4, 4, 1, 96),
4658 F_PCM( 1536000, pll4, 4, 1, 64),
4659 F_PCM( 2048000, pll4, 4, 1, 48),
4660 F_PCM( 3072000, pll4, 4, 1, 32),
4661 F_PCM( 4096000, pll4, 4, 1, 24),
4662 F_PCM( 6144000, pll4, 4, 1, 16),
4663 F_PCM( 8192000, pll4, 4, 1, 12),
4664 F_PCM(12288000, pll4, 4, 1, 8),
4665 F_PCM(24576000, pll4, 4, 1, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004666 F_END
4667};
4668
4669static struct rcg_clk pcm_clk = {
4670 .b = {
4671 .ctl_reg = LCC_PCM_NS_REG,
4672 .en_mask = BIT(11),
4673 .reset_reg = LCC_PCM_NS_REG,
4674 .reset_mask = BIT(13),
4675 .halt_reg = LCC_PCM_STATUS_REG,
4676 .halt_check = ENABLE,
4677 .halt_bit = 0,
4678 },
4679 .ns_reg = LCC_PCM_NS_REG,
4680 .md_reg = LCC_PCM_MD_REG,
4681 .root_en_mask = BIT(9),
Stephen Boyd630f3252012-01-31 00:10:08 -08004682 .ns_mask = BM(31, 16) | BIT(10) | BM(6, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08004683 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004684 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004685 .freq_tbl = clk_tbl_pcm_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004686 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004687 .c = {
4688 .dbg_name = "pcm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004689 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004690 VDD_DIG_FMAX_MAP1(LOW, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004691 CLK_INIT(pcm_clk.c),
Stephen Boydc5492fc2012-06-18 18:47:03 -07004692 .rate = ULONG_MAX,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004693 },
4694};
4695
4696static struct rcg_clk audio_slimbus_clk = {
4697 .b = {
4698 .ctl_reg = LCC_SLIMBUS_NS_REG,
4699 .en_mask = BIT(10),
4700 .reset_reg = LCC_AHBEX_BRANCH_CTL_REG,
4701 .reset_mask = BIT(5),
4702 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4703 .halt_check = ENABLE,
4704 .halt_bit = 0,
4705 },
4706 .ns_reg = LCC_SLIMBUS_NS_REG,
4707 .md_reg = LCC_SLIMBUS_MD_REG,
4708 .root_en_mask = BIT(9),
4709 .ns_mask = (BM(31, 24) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004710 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004711 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004712 .freq_tbl = clk_tbl_aif_osr_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004713 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004714 .c = {
4715 .dbg_name = "audio_slimbus_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004716 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004717 VDD_DIG_FMAX_MAP1(LOW, 24576000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004718 CLK_INIT(audio_slimbus_clk.c),
4719 },
4720};
4721
4722static struct branch_clk sps_slimbus_clk = {
4723 .b = {
4724 .ctl_reg = LCC_SLIMBUS_NS_REG,
4725 .en_mask = BIT(12),
4726 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4727 .halt_check = ENABLE,
4728 .halt_bit = 1,
4729 },
4730 .parent = &audio_slimbus_clk.c,
4731 .c = {
4732 .dbg_name = "sps_slimbus_clk",
4733 .ops = &clk_ops_branch,
4734 CLK_INIT(sps_slimbus_clk.c),
4735 },
4736};
4737
4738static struct branch_clk slimbus_xo_src_clk = {
4739 .b = {
4740 .ctl_reg = SLIMBUS_XO_SRC_CLK_CTL_REG,
4741 .en_mask = BIT(2),
4742 .halt_reg = CLK_HALT_DFAB_STATE_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004743 .halt_bit = 28,
4744 },
4745 .parent = &sps_slimbus_clk.c,
4746 .c = {
4747 .dbg_name = "slimbus_xo_src_clk",
4748 .ops = &clk_ops_branch,
4749 CLK_INIT(slimbus_xo_src_clk.c),
4750 },
4751};
4752
Matt Wagantall735f01a2011-08-12 12:40:28 -07004753DEFINE_CLK_RPM(afab_clk, afab_a_clk, APPS_FABRIC, NULL);
4754DEFINE_CLK_RPM(cfpb_clk, cfpb_a_clk, CFPB, NULL);
4755DEFINE_CLK_RPM(dfab_clk, dfab_a_clk, DAYTONA_FABRIC, NULL);
4756DEFINE_CLK_RPM(ebi1_clk, ebi1_a_clk, EBI1, NULL);
4757DEFINE_CLK_RPM(mmfab_clk, mmfab_a_clk, MM_FABRIC, NULL);
4758DEFINE_CLK_RPM(mmfpb_clk, mmfpb_a_clk, MMFPB, NULL);
4759DEFINE_CLK_RPM(sfab_clk, sfab_a_clk, SYSTEM_FABRIC, NULL);
4760DEFINE_CLK_RPM(sfpb_clk, sfpb_a_clk, SFPB, NULL);
Stephen Boydc7fc3b12012-05-17 14:42:46 -07004761DEFINE_CLK_RPM_QDSS(qdss_clk, qdss_a_clk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004762
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004763static DEFINE_CLK_VOTER(sfab_msmbus_a_clk, &sfab_a_clk.c, 0);
4764static DEFINE_CLK_VOTER(sfab_tmr_a_clk, &sfab_a_clk.c, 0);
Stephen Boydd7a143a2012-02-16 17:59:26 -08004765
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004766static DEFINE_CLK_VOTER(dfab_dsps_clk, &dfab_clk.c, 0);
4767static DEFINE_CLK_VOTER(dfab_usb_hs_clk, &dfab_clk.c, 0);
4768static DEFINE_CLK_VOTER(dfab_usb_hs3_clk, &dfab_clk.c, 0);
4769static DEFINE_CLK_VOTER(dfab_usb_hs4_clk, &dfab_clk.c, 0);
4770static DEFINE_CLK_VOTER(dfab_sdc1_clk, &dfab_clk.c, 0);
4771static DEFINE_CLK_VOTER(dfab_sdc2_clk, &dfab_clk.c, 0);
4772static DEFINE_CLK_VOTER(dfab_sdc3_clk, &dfab_clk.c, 0);
4773static DEFINE_CLK_VOTER(dfab_sdc4_clk, &dfab_clk.c, 0);
4774static DEFINE_CLK_VOTER(dfab_sdc5_clk, &dfab_clk.c, 0);
4775static DEFINE_CLK_VOTER(dfab_sps_clk, &dfab_clk.c, 0);
4776static DEFINE_CLK_VOTER(dfab_bam_dmux_clk, &dfab_clk.c, 0);
4777static DEFINE_CLK_VOTER(dfab_scm_clk, &dfab_clk.c, 0);
4778static DEFINE_CLK_VOTER(dfab_qseecom_clk, &dfab_clk.c, 0);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004779static DEFINE_CLK_VOTER(dfab_msmbus_clk, &dfab_clk.c, 0);
4780static DEFINE_CLK_VOTER(dfab_msmbus_a_clk, &dfab_a_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004781
Matt Wagantall42cd12a2012-03-30 18:02:40 -07004782static DEFINE_CLK_VOTER(ebi1_msmbus_clk, &ebi1_clk.c, LONG_MAX);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004783static DEFINE_CLK_VOTER(ebi1_adm_clk, &ebi1_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004784
Matt Wagantall33bac7e2012-05-22 14:59:05 -07004785static DEFINE_CLK_VOTER(ebi1_acpu_a_clk, &ebi1_a_clk.c, LONG_MAX);
4786static DEFINE_CLK_VOTER(ebi1_msmbus_a_clk, &ebi1_a_clk.c, LONG_MAX);
4787static DEFINE_CLK_VOTER(afab_acpu_a_clk, &afab_a_clk.c, LONG_MAX);
4788static DEFINE_CLK_VOTER(afab_msmbus_a_clk, &afab_a_clk.c, LONG_MAX);
4789
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004790#ifdef CONFIG_DEBUG_FS
4791struct measure_sel {
4792 u32 test_vector;
Matt Wagantallf82f2942012-01-27 13:56:13 -08004793 struct clk *c;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004794};
4795
Matt Wagantall8b38f942011-08-02 18:23:18 -07004796static DEFINE_CLK_MEASURE(l2_m_clk);
4797static DEFINE_CLK_MEASURE(krait0_m_clk);
4798static DEFINE_CLK_MEASURE(krait1_m_clk);
Tianyi Gou455c13c2012-02-02 16:33:24 -08004799static DEFINE_CLK_MEASURE(krait2_m_clk);
4800static DEFINE_CLK_MEASURE(krait3_m_clk);
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004801static DEFINE_CLK_MEASURE(q6sw_clk);
4802static DEFINE_CLK_MEASURE(q6fw_clk);
4803static DEFINE_CLK_MEASURE(q6_func_clk);
Matt Wagantall8b38f942011-08-02 18:23:18 -07004804
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004805static struct measure_sel measure_mux[] = {
4806 { TEST_PER_LS(0x08), &slimbus_xo_src_clk.c },
4807 { TEST_PER_LS(0x12), &sdc1_p_clk.c },
4808 { TEST_PER_LS(0x13), &sdc1_clk.c },
4809 { TEST_PER_LS(0x14), &sdc2_p_clk.c },
4810 { TEST_PER_LS(0x15), &sdc2_clk.c },
4811 { TEST_PER_LS(0x16), &sdc3_p_clk.c },
4812 { TEST_PER_LS(0x17), &sdc3_clk.c },
4813 { TEST_PER_LS(0x18), &sdc4_p_clk.c },
4814 { TEST_PER_LS(0x19), &sdc4_clk.c },
4815 { TEST_PER_LS(0x1A), &sdc5_p_clk.c },
4816 { TEST_PER_LS(0x1B), &sdc5_clk.c },
Matt Wagantall7625a4c2011-11-01 16:17:53 -07004817 { TEST_PER_LS(0x1F), &gp0_clk.c },
4818 { TEST_PER_LS(0x20), &gp1_clk.c },
4819 { TEST_PER_LS(0x21), &gp2_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004820 { TEST_PER_LS(0x25), &dfab_clk.c },
4821 { TEST_PER_LS(0x25), &dfab_a_clk.c },
4822 { TEST_PER_LS(0x26), &pmem_clk.c },
4823 { TEST_PER_LS(0x32), &dma_bam_p_clk.c },
4824 { TEST_PER_LS(0x33), &cfpb_clk.c },
4825 { TEST_PER_LS(0x33), &cfpb_a_clk.c },
4826 { TEST_PER_LS(0x3D), &gsbi1_p_clk.c },
4827 { TEST_PER_LS(0x3E), &gsbi1_uart_clk.c },
4828 { TEST_PER_LS(0x3F), &gsbi1_qup_clk.c },
4829 { TEST_PER_LS(0x41), &gsbi2_p_clk.c },
4830 { TEST_PER_LS(0x42), &gsbi2_uart_clk.c },
4831 { TEST_PER_LS(0x44), &gsbi2_qup_clk.c },
4832 { TEST_PER_LS(0x45), &gsbi3_p_clk.c },
4833 { TEST_PER_LS(0x46), &gsbi3_uart_clk.c },
4834 { TEST_PER_LS(0x48), &gsbi3_qup_clk.c },
4835 { TEST_PER_LS(0x49), &gsbi4_p_clk.c },
4836 { TEST_PER_LS(0x4A), &gsbi4_uart_clk.c },
4837 { TEST_PER_LS(0x4C), &gsbi4_qup_clk.c },
4838 { TEST_PER_LS(0x4D), &gsbi5_p_clk.c },
4839 { TEST_PER_LS(0x4E), &gsbi5_uart_clk.c },
4840 { TEST_PER_LS(0x50), &gsbi5_qup_clk.c },
4841 { TEST_PER_LS(0x51), &gsbi6_p_clk.c },
4842 { TEST_PER_LS(0x52), &gsbi6_uart_clk.c },
4843 { TEST_PER_LS(0x54), &gsbi6_qup_clk.c },
4844 { TEST_PER_LS(0x55), &gsbi7_p_clk.c },
4845 { TEST_PER_LS(0x56), &gsbi7_uart_clk.c },
4846 { TEST_PER_LS(0x58), &gsbi7_qup_clk.c },
4847 { TEST_PER_LS(0x59), &gsbi8_p_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004848 { TEST_PER_LS(0x59), &sfab_sata_s_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004849 { TEST_PER_LS(0x5A), &gsbi8_uart_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004850 { TEST_PER_LS(0x5A), &sata_p_clk.c },
4851 { TEST_PER_LS(0x5B), &sata_rxoob_clk.c },
4852 { TEST_PER_LS(0x5C), &sata_pmalive_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004853 { TEST_PER_LS(0x5C), &gsbi8_qup_clk.c },
4854 { TEST_PER_LS(0x5D), &gsbi9_p_clk.c },
4855 { TEST_PER_LS(0x5E), &gsbi9_uart_clk.c },
4856 { TEST_PER_LS(0x60), &gsbi9_qup_clk.c },
4857 { TEST_PER_LS(0x61), &gsbi10_p_clk.c },
4858 { TEST_PER_LS(0x62), &gsbi10_uart_clk.c },
4859 { TEST_PER_LS(0x64), &gsbi10_qup_clk.c },
4860 { TEST_PER_LS(0x65), &gsbi11_p_clk.c },
4861 { TEST_PER_LS(0x66), &gsbi11_uart_clk.c },
4862 { TEST_PER_LS(0x68), &gsbi11_qup_clk.c },
4863 { TEST_PER_LS(0x69), &gsbi12_p_clk.c },
4864 { TEST_PER_LS(0x6A), &gsbi12_uart_clk.c },
4865 { TEST_PER_LS(0x6C), &gsbi12_qup_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004866 { TEST_PER_LS(0x5E), &pcie_p_clk.c },
4867 { TEST_PER_LS(0x5F), &ce3_p_clk.c },
4868 { TEST_PER_LS(0x60), &ce3_core_clk.c },
4869 { TEST_PER_LS(0x63), &usb_hs3_p_clk.c },
4870 { TEST_PER_LS(0x64), &usb_hs3_xcvr_clk.c },
4871 { TEST_PER_LS(0x65), &usb_hs4_p_clk.c },
4872 { TEST_PER_LS(0x66), &usb_hs4_xcvr_clk.c },
4873 { TEST_PER_LS(0x6B), &sata_phy_ref_clk.c },
4874 { TEST_PER_LS(0x6C), &sata_phy_cfg_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004875 { TEST_PER_LS(0x78), &sfpb_clk.c },
4876 { TEST_PER_LS(0x78), &sfpb_a_clk.c },
4877 { TEST_PER_LS(0x7A), &pmic_ssbi2_clk.c },
4878 { TEST_PER_LS(0x7B), &pmic_arb0_p_clk.c },
4879 { TEST_PER_LS(0x7C), &pmic_arb1_p_clk.c },
4880 { TEST_PER_LS(0x7D), &prng_clk.c },
4881 { TEST_PER_LS(0x7F), &rpm_msg_ram_p_clk.c },
4882 { TEST_PER_LS(0x80), &adm0_p_clk.c },
4883 { TEST_PER_LS(0x84), &usb_hs1_p_clk.c },
4884 { TEST_PER_LS(0x85), &usb_hs1_xcvr_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004885 { TEST_PER_LS(0x86), &usb_hsic_p_clk.c },
4886 { TEST_PER_LS(0x87), &usb_hsic_system_clk.c },
4887 { TEST_PER_LS(0x88), &usb_hsic_xcvr_fs_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004888 { TEST_PER_LS(0x89), &usb_fs1_p_clk.c },
4889 { TEST_PER_LS(0x8A), &usb_fs1_sys_clk.c },
4890 { TEST_PER_LS(0x8B), &usb_fs1_xcvr_clk.c },
4891 { TEST_PER_LS(0x8C), &usb_fs2_p_clk.c },
4892 { TEST_PER_LS(0x8D), &usb_fs2_sys_clk.c },
4893 { TEST_PER_LS(0x8E), &usb_fs2_xcvr_clk.c },
4894 { TEST_PER_LS(0x8F), &tsif_p_clk.c },
4895 { TEST_PER_LS(0x91), &tsif_ref_clk.c },
4896 { TEST_PER_LS(0x92), &ce1_p_clk.c },
4897 { TEST_PER_LS(0x94), &tssc_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004898 { TEST_PER_LS(0x9D), &usb_hsic_hsio_cal_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004899 { TEST_PER_LS(0xA4), &ce1_core_clk.c },
4900
4901 { TEST_PER_HS(0x07), &afab_clk.c },
4902 { TEST_PER_HS(0x07), &afab_a_clk.c },
4903 { TEST_PER_HS(0x18), &sfab_clk.c },
4904 { TEST_PER_HS(0x18), &sfab_a_clk.c },
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004905 { TEST_PER_HS(0x26), &q6sw_clk },
4906 { TEST_PER_HS(0x27), &q6fw_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004907 { TEST_PER_HS(0x2A), &adm0_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004908 { TEST_PER_HS(0x31), &sata_a_clk.c },
Tianyi Gou6613de52012-01-27 17:57:53 -08004909 { TEST_PER_HS(0x2D), &pcie_phy_ref_clk.c },
4910 { TEST_PER_HS(0x32), &pcie_a_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004911 { TEST_PER_HS(0x34), &ebi1_clk.c },
4912 { TEST_PER_HS(0x34), &ebi1_a_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004913 { TEST_PER_HS(0x50), &usb_hsic_hsic_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004914
4915 { TEST_MM_LS(0x00), &dsi1_byte_clk.c },
4916 { TEST_MM_LS(0x01), &dsi2_byte_clk.c },
4917 { TEST_MM_LS(0x02), &cam1_clk.c },
4918 { TEST_MM_LS(0x06), &amp_p_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004919 { TEST_MM_LS(0x07), &csi_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004920 { TEST_MM_LS(0x08), &dsi2_s_p_clk.c },
4921 { TEST_MM_LS(0x09), &dsi1_m_p_clk.c },
4922 { TEST_MM_LS(0x0A), &dsi1_s_p_clk.c },
4923 { TEST_MM_LS(0x0C), &gfx2d0_p_clk.c },
4924 { TEST_MM_LS(0x0D), &gfx2d1_p_clk.c },
4925 { TEST_MM_LS(0x0E), &gfx3d_p_clk.c },
4926 { TEST_MM_LS(0x0F), &hdmi_m_p_clk.c },
4927 { TEST_MM_LS(0x10), &hdmi_s_p_clk.c },
4928 { TEST_MM_LS(0x11), &ijpeg_p_clk.c },
4929 { TEST_MM_LS(0x12), &imem_p_clk.c },
4930 { TEST_MM_LS(0x13), &jpegd_p_clk.c },
4931 { TEST_MM_LS(0x14), &mdp_p_clk.c },
4932 { TEST_MM_LS(0x16), &rot_p_clk.c },
4933 { TEST_MM_LS(0x17), &dsi1_esc_clk.c },
4934 { TEST_MM_LS(0x18), &smmu_p_clk.c },
4935 { TEST_MM_LS(0x19), &tv_enc_p_clk.c },
4936 { TEST_MM_LS(0x1A), &vcodec_p_clk.c },
4937 { TEST_MM_LS(0x1B), &vfe_p_clk.c },
4938 { TEST_MM_LS(0x1C), &vpe_p_clk.c },
4939 { TEST_MM_LS(0x1D), &cam0_clk.c },
4940 { TEST_MM_LS(0x1F), &hdmi_app_clk.c },
4941 { TEST_MM_LS(0x20), &mdp_vsync_clk.c },
4942 { TEST_MM_LS(0x21), &tv_dac_clk.c },
4943 { TEST_MM_LS(0x22), &tv_enc_clk.c },
4944 { TEST_MM_LS(0x23), &dsi2_esc_clk.c },
4945 { TEST_MM_LS(0x25), &mmfpb_clk.c },
4946 { TEST_MM_LS(0x25), &mmfpb_a_clk.c },
4947 { TEST_MM_LS(0x26), &dsi2_m_p_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004948 { TEST_MM_LS(0x27), &cam2_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004949 { TEST_MM_LS(0x28), &vcap_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004950
4951 { TEST_MM_HS(0x00), &csi0_clk.c },
4952 { TEST_MM_HS(0x01), &csi1_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004953 { TEST_MM_HS(0x04), &csi_vfe_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004954 { TEST_MM_HS(0x05), &ijpeg_clk.c },
4955 { TEST_MM_HS(0x06), &vfe_clk.c },
4956 { TEST_MM_HS(0x07), &gfx2d0_clk.c },
4957 { TEST_MM_HS(0x08), &gfx2d1_clk.c },
4958 { TEST_MM_HS(0x09), &gfx3d_clk.c },
4959 { TEST_MM_HS(0x0A), &jpegd_clk.c },
4960 { TEST_MM_HS(0x0B), &vcodec_clk.c },
4961 { TEST_MM_HS(0x0F), &mmfab_clk.c },
4962 { TEST_MM_HS(0x0F), &mmfab_a_clk.c },
4963 { TEST_MM_HS(0x11), &gmem_axi_clk.c },
4964 { TEST_MM_HS(0x12), &ijpeg_axi_clk.c },
4965 { TEST_MM_HS(0x13), &imem_axi_clk.c },
4966 { TEST_MM_HS(0x14), &jpegd_axi_clk.c },
4967 { TEST_MM_HS(0x15), &mdp_axi_clk.c },
4968 { TEST_MM_HS(0x16), &rot_axi_clk.c },
4969 { TEST_MM_HS(0x17), &vcodec_axi_clk.c },
4970 { TEST_MM_HS(0x18), &vfe_axi_clk.c },
4971 { TEST_MM_HS(0x19), &vpe_axi_clk.c },
4972 { TEST_MM_HS(0x1A), &mdp_clk.c },
4973 { TEST_MM_HS(0x1B), &rot_clk.c },
4974 { TEST_MM_HS(0x1C), &vpe_clk.c },
4975 { TEST_MM_HS(0x1E), &hdmi_tv_clk.c },
4976 { TEST_MM_HS(0x1F), &mdp_tv_clk.c },
4977 { TEST_MM_HS(0x24), &csi0_phy_clk.c },
4978 { TEST_MM_HS(0x25), &csi1_phy_clk.c },
4979 { TEST_MM_HS(0x26), &csi_pix_clk.c },
4980 { TEST_MM_HS(0x27), &csi_rdi_clk.c },
4981 { TEST_MM_HS(0x28), &lut_mdp_clk.c },
4982 { TEST_MM_HS(0x29), &vcodec_axi_a_clk.c },
4983 { TEST_MM_HS(0x2A), &vcodec_axi_b_clk.c },
4984 { TEST_MM_HS(0x2B), &csi1phy_timer_clk.c },
4985 { TEST_MM_HS(0x2C), &csi0phy_timer_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004986 { TEST_MM_HS(0x2D), &csi2_clk.c },
4987 { TEST_MM_HS(0x2E), &csi2_phy_clk.c },
4988 { TEST_MM_HS(0x2F), &csi2phy_timer_clk.c },
4989 { TEST_MM_HS(0x30), &csi_pix1_clk.c },
4990 { TEST_MM_HS(0x31), &csi_rdi1_clk.c },
4991 { TEST_MM_HS(0x32), &csi_rdi2_clk.c },
Tianyi Gou621f8742011-09-01 21:45:01 -07004992 { TEST_MM_HS(0x33), &vcap_clk.c },
4993 { TEST_MM_HS(0x34), &vcap_npl_clk.c },
Tianyi Goue3d4f542012-03-15 17:06:45 -07004994 { TEST_MM_HS(0x34), &gfx3d_axi_clk_8930.c },
Tianyi Gou7747a962012-02-03 15:03:55 -08004995 { TEST_MM_HS(0x35), &vcap_axi_clk.c },
Tianyi Gou51918802012-01-26 14:05:43 -08004996 { TEST_MM_HS(0x36), &rgb_tv_clk.c },
4997 { TEST_MM_HS(0x37), &npl_tv_clk.c },
Patrick Dalye6f489042012-07-11 15:29:15 -07004998 { TEST_MM_HS(0x38), &gfx3d_axi_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004999
5000 { TEST_LPA(0x0F), &mi2s_bit_clk.c },
5001 { TEST_LPA(0x10), &codec_i2s_mic_bit_clk.c },
5002 { TEST_LPA(0x11), &codec_i2s_spkr_bit_clk.c },
5003 { TEST_LPA(0x12), &spare_i2s_mic_bit_clk.c },
5004 { TEST_LPA(0x13), &spare_i2s_spkr_bit_clk.c },
5005 { TEST_LPA(0x14), &pcm_clk.c },
5006 { TEST_LPA(0x1D), &audio_slimbus_clk.c },
Matt Wagantall8b38f942011-08-02 18:23:18 -07005007
Stephen Boyd3939c8d2011-08-29 17:36:22 -07005008 { TEST_LPA_HS(0x00), &q6_func_clk },
5009
Stephen Boyd46fdf0d2011-11-22 12:25:09 -08005010 { TEST_CPUL2(0x2), &l2_m_clk },
5011 { TEST_CPUL2(0x0), &krait0_m_clk },
5012 { TEST_CPUL2(0x1), &krait1_m_clk },
Tianyi Gou455c13c2012-02-02 16:33:24 -08005013 { TEST_CPUL2(0x4), &krait2_m_clk },
5014 { TEST_CPUL2(0x5), &krait3_m_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005015};
5016
Matt Wagantallf82f2942012-01-27 13:56:13 -08005017static struct measure_sel *find_measure_sel(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005018{
5019 int i;
5020
5021 for (i = 0; i < ARRAY_SIZE(measure_mux); i++)
Matt Wagantallf82f2942012-01-27 13:56:13 -08005022 if (measure_mux[i].c == c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005023 return &measure_mux[i];
5024 return NULL;
5025}
5026
Matt Wagantall8b38f942011-08-02 18:23:18 -07005027static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005028{
5029 int ret = 0;
5030 u32 clk_sel;
5031 struct measure_sel *p;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005032 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005033 unsigned long flags;
5034
5035 if (!parent)
5036 return -EINVAL;
5037
5038 p = find_measure_sel(parent);
5039 if (!p)
5040 return -EINVAL;
5041
5042 spin_lock_irqsave(&local_clock_reg_lock, flags);
5043
Matt Wagantall8b38f942011-08-02 18:23:18 -07005044 /*
5045 * Program the test vector, measurement period (sample_ticks)
5046 * and scaling multiplier.
5047 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005048 measure->sample_ticks = 0x10000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005049 clk_sel = p->test_vector & TEST_CLK_SEL_MASK;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005050 measure->multiplier = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005051 switch (p->test_vector >> TEST_TYPE_SHIFT) {
5052 case TEST_TYPE_PER_LS:
5053 writel_relaxed(0x4030D00|BVAL(7, 0, clk_sel), CLK_TEST_REG);
5054 break;
5055 case TEST_TYPE_PER_HS:
5056 writel_relaxed(0x4020000|BVAL(16, 10, clk_sel), CLK_TEST_REG);
5057 break;
5058 case TEST_TYPE_MM_LS:
5059 writel_relaxed(0x4030D97, CLK_TEST_REG);
5060 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_LS_REG);
5061 break;
5062 case TEST_TYPE_MM_HS:
5063 writel_relaxed(0x402B800, CLK_TEST_REG);
5064 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_HS_REG);
5065 break;
5066 case TEST_TYPE_LPA:
5067 writel_relaxed(0x4030D98, CLK_TEST_REG);
5068 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0),
5069 LCC_CLK_LS_DEBUG_CFG_REG);
5070 break;
Stephen Boyd3939c8d2011-08-29 17:36:22 -07005071 case TEST_TYPE_LPA_HS:
5072 writel_relaxed(0x402BC00, CLK_TEST_REG);
5073 writel_relaxed(BVAL(2, 1, clk_sel)|BIT(0),
5074 LCC_CLK_HS_DEBUG_CFG_REG);
5075 break;
Matt Wagantall8b38f942011-08-02 18:23:18 -07005076 case TEST_TYPE_CPUL2:
5077 writel_relaxed(0x4030400, CLK_TEST_REG);
5078 writel_relaxed(0x80|BVAL(5, 3, clk_sel), GCC_APCS_CLK_DIAG);
Matt Wagantallf82f2942012-01-27 13:56:13 -08005079 measure->sample_ticks = 0x4000;
5080 measure->multiplier = 2;
Matt Wagantall8b38f942011-08-02 18:23:18 -07005081 break;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005082 default:
5083 ret = -EPERM;
5084 }
5085 /* Make sure test vector is set before starting measurements. */
5086 mb();
5087
5088 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5089
5090 return ret;
5091}
5092
5093/* Sample clock for 'ticks' reference clock ticks. */
5094static u32 run_measurement(unsigned ticks)
5095{
5096 /* Stop counters and set the XO4 counter start value. */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005097 writel_relaxed(ticks, RINGOSC_TCXO_CTL_REG);
5098
5099 /* Wait for timer to become ready. */
5100 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) != 0)
5101 cpu_relax();
5102
5103 /* Run measurement and wait for completion. */
5104 writel_relaxed(BIT(20)|ticks, RINGOSC_TCXO_CTL_REG);
5105 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) == 0)
5106 cpu_relax();
5107
5108 /* Stop counters. */
5109 writel_relaxed(0x0, RINGOSC_TCXO_CTL_REG);
5110
5111 /* Return measured ticks. */
5112 return readl_relaxed(RINGOSC_STATUS_REG) & BM(24, 0);
5113}
5114
5115
5116/* Perform a hardware rate measurement for a given clock.
5117 FOR DEBUG USE ONLY: Measurements take ~15 ms! */
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07005118static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005119{
5120 unsigned long flags;
5121 u32 pdm_reg_backup, ringosc_reg_backup;
5122 u64 raw_count_short, raw_count_full;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005123 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005124 unsigned ret;
5125
Stephen Boyde334aeb2012-01-24 12:17:29 -08005126 ret = clk_prepare_enable(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005127 if (ret) {
5128 pr_warning("CXO clock failed to enable. Can't measure\n");
5129 return 0;
5130 }
5131
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005132 spin_lock_irqsave(&local_clock_reg_lock, flags);
5133
5134 /* Enable CXO/4 and RINGOSC branch and root. */
5135 pdm_reg_backup = readl_relaxed(PDM_CLK_NS_REG);
5136 ringosc_reg_backup = readl_relaxed(RINGOSC_NS_REG);
5137 writel_relaxed(0x2898, PDM_CLK_NS_REG);
5138 writel_relaxed(0xA00, RINGOSC_NS_REG);
5139
5140 /*
5141 * The ring oscillator counter will not reset if the measured clock
5142 * is not running. To detect this, run a short measurement before
5143 * the full measurement. If the raw results of the two are the same
5144 * then the clock must be off.
5145 */
5146
5147 /* Run a short measurement. (~1 ms) */
5148 raw_count_short = run_measurement(0x1000);
5149 /* Run a full measurement. (~14 ms) */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005150 raw_count_full = run_measurement(measure->sample_ticks);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005151
5152 writel_relaxed(ringosc_reg_backup, RINGOSC_NS_REG);
5153 writel_relaxed(pdm_reg_backup, PDM_CLK_NS_REG);
5154
5155 /* Return 0 if the clock is off. */
5156 if (raw_count_full == raw_count_short)
5157 ret = 0;
5158 else {
5159 /* Compute rate in Hz. */
5160 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005161 do_div(raw_count_full, ((measure->sample_ticks * 10) + 35));
5162 ret = (raw_count_full * measure->multiplier);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005163 }
5164
5165 /* Route dbg_hs_clk to PLLTEST. 300mV single-ended amplitude. */
Stephen Boyd69da8402011-07-14 17:45:31 -07005166 writel_relaxed(0x38F8, PLLTEST_PAD_CFG_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005167 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5168
Stephen Boyde334aeb2012-01-24 12:17:29 -08005169 clk_disable_unprepare(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005170
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005171 return ret;
5172}
5173#else /* !CONFIG_DEBUG_FS */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005174static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005175{
5176 return -EINVAL;
5177}
5178
Matt Wagantallf82f2942012-01-27 13:56:13 -08005179static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005180{
5181 return 0;
5182}
5183#endif /* CONFIG_DEBUG_FS */
5184
Matt Wagantallae053222012-05-14 19:42:07 -07005185static struct clk_ops clk_ops_measure = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005186 .set_parent = measure_clk_set_parent,
5187 .get_rate = measure_clk_get_rate,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005188};
5189
Matt Wagantall8b38f942011-08-02 18:23:18 -07005190static struct measure_clk measure_clk = {
5191 .c = {
5192 .dbg_name = "measure_clk",
Matt Wagantallae053222012-05-14 19:42:07 -07005193 .ops = &clk_ops_measure,
Matt Wagantall8b38f942011-08-02 18:23:18 -07005194 CLK_INIT(measure_clk.c),
5195 },
5196 .multiplier = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005197};
5198
Tianyi Goua8b3cce2011-11-08 14:37:26 -08005199static struct clk_lookup msm_clocks_8064[] = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005200 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5201 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Mohan Pallaka804ca592012-06-14 14:37:38 +05305202 CLK_LOOKUP("pwm_clk", cxo_clk.c, "0-0048"),
Stephen Boyded630b02012-01-26 15:26:47 -08005203 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5204 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5205 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5206 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5207 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
Matt Wagantall292aace2012-01-26 19:12:34 -08005208 CLK_LOOKUP("xo", cxo_clk.c, "pil_gss"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005209 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005210 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
David Collinsa7d23532012-08-02 10:48:16 -07005211 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Stephen Boyded630b02012-01-26 15:26:47 -08005212 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5213 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5214 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5215 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005216
Matt Wagantalld75f1312012-05-23 16:17:35 -07005217 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5218 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5219 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5220 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5221 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5222 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5223 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5224 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5225 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5226 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5227 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5228 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5229 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5230 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5231 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5232 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5233
Tianyi Gou21a0e802012-02-04 22:34:10 -08005234 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005235 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005236 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5237 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5238 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005239 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005240 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5241 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5242 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5243 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5244 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005245 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005246 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5247 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005248 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005249 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5250 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5251 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5252 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5253 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5254 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5255 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005256
Tianyi Gou21a0e802012-02-04 22:34:10 -08005257 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005258 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, ""),
5259 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5260 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005261
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005262 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5263 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5264 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005265 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, "msm_serial_hsl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005266 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5267 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5268 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5269 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, ""),
Mayank Rana262e9032012-05-10 15:14:00 -07005270 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005271 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, "msm_serial_hsl.0"),
David Keitel3c40fc52012-02-09 17:53:52 -08005272 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005273 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005274 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005275 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005276 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005277 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "qup_i2c.5"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005278 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5279 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5280 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Tianyi Gou50f23812012-02-06 16:04:19 -08005281 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Tianyi Gou05e01102012-02-08 22:15:49 -08005282 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005283 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5284 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5285 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5286 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
Joel Nider6cbe66a2012-06-26 11:11:59 +03005287 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.0"),
5288 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.0"),
5289 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.1"),
5290 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005291 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005292 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5293 CLK_LOOKUP("alt_core_clk", usb_hs3_xcvr_clk.c, "msm_ehci_host.0"),
5294 CLK_LOOKUP("alt_core_clk", usb_hs4_xcvr_clk.c, "msm_ehci_host.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005295 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5296 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5297 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005298 CLK_LOOKUP("ref_clk", sata_phy_ref_clk.c, ""),
5299 CLK_LOOKUP("cfg_clk", sata_phy_cfg_clk.c, ""),
Tianyi Gou352955d2012-05-18 19:44:01 -07005300 CLK_LOOKUP("src_clk", sata_src_clk.c, ""),
5301 CLK_LOOKUP("core_rxoob_clk", sata_rxoob_clk.c, ""),
5302 CLK_LOOKUP("core_pmalive_clk", sata_pmalive_clk.c, ""),
5303 CLK_LOOKUP("bus_clk", sata_a_clk.c, ""),
5304 CLK_LOOKUP("iface_clk", sata_p_clk.c, ""),
5305 CLK_LOOKUP("slave_iface_clk", sfab_sata_s_p_clk.c, ""),
Ramesh Masavarapu28311912011-10-27 11:04:12 -07005306 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qce.0"),
5307 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qcrypto.0"),
5308 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qce.0"),
5309 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qcrypto.0"),
5310 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qce.0"),
5311 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qcrypto.0"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005312 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005313 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "msm_serial_hsl.1"),
David Keitel3c40fc52012-02-09 17:53:52 -08005314 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005315 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005316 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005317 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005318 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005319 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "qup_i2c.5"),
Mayank Rana262e9032012-05-10 15:14:00 -07005320 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005321 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, "msm_serial_hsl.0"),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005322 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5323 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005324 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005325 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Manu Gautam7483f172011-11-08 15:22:26 +05305326 CLK_LOOKUP("iface_clk", usb_hs3_p_clk.c, "msm_ehci_host.0"),
5327 CLK_LOOKUP("iface_clk", usb_hs4_p_clk.c, "msm_ehci_host.1"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005328 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5329 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5330 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5331 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06005332 CLK_LOOKUP("iface_clk", pcie_p_clk.c, "msm_pcie"),
5333 CLK_LOOKUP("ref_clk", pcie_phy_ref_clk.c, "msm_pcie"),
5334 CLK_LOOKUP("bus_clk", pcie_a_clk.c, "msm_pcie"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005335 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5336 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005337 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5338 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5339 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5340 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chand07220e2012-02-13 15:52:22 -08005341 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005342 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Sreesudhan Ramakrish Ramkumar8002a792012-04-09 17:42:58 -07005343 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -08005344 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Kevin Chand07220e2012-02-13 15:52:22 -08005345 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
5346 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5347 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
5348 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
5349 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5350 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
5351 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
5352 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5353 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
5354 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
5355 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5356 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5357 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
5358 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5359 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5360 CLK_LOOKUP("csiphy_timer_src_clk",
5361 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5362 CLK_LOOKUP("csiphy_timer_src_clk",
5363 csiphy_timer_src_clk.c, "msm_csiphy.1"),
5364 CLK_LOOKUP("csiphy_timer_src_clk",
5365 csiphy_timer_src_clk.c, "msm_csiphy.2"),
5366 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5367 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
5368 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005369 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5370 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5371 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5372 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Tianyi Gou51918802012-01-26 14:05:43 -08005373 CLK_LOOKUP("rgb_clk", rgb_tv_clk.c, ""),
5374 CLK_LOOKUP("npl_clk", npl_tv_clk.c, ""),
5375
Pu Chen86b4be92011-11-03 17:27:57 -07005376 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005377 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005378 CLK_LOOKUP("bus_clk",
Patrick Dalye6f489042012-07-11 15:29:15 -07005379 gfx3d_axi_clk.c, "footswitch-8x60.2"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005380 CLK_LOOKUP("iface_clk", vcap_p_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005381 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005382 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "footswitch-8x60.10"),
5383 CLK_LOOKUP("bus_clk", vcap_axi_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005384 CLK_LOOKUP("core_clk", vcap_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005385 CLK_LOOKUP("core_clk", vcap_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005386 CLK_LOOKUP("core_clk", vcap_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005387 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005388 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005389 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005390 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5391 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005392 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005393 CLK_LOOKUP("core_clk", jpegd_clk.c, ""),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005394 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005395 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005396 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005397 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005398 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005399 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005400 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005401 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Matt Wagantall61286312012-02-22 15:55:09 -08005402 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005403 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5404 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
Greg Griscofa47b532011-11-11 10:32:06 -08005405 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005406 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005407 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
Tianyi Gou51918802012-01-26 14:05:43 -08005408 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005409 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005410 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Ujwal Pateld041f982012-03-27 19:51:44 -07005411 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005412 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chand07220e2012-02-13 15:52:22 -08005413 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005414 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chand07220e2012-02-13 15:52:22 -08005415 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005416 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5417 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5418 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5419 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5420 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5421 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5422 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005423 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5424 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chand07220e2012-02-13 15:52:22 -08005425 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5426 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
5427 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005428 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5429 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5430 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5431 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Pu Chen86b4be92011-11-03 17:27:57 -07005432 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005433 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005434 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5435 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005436 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005437 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005438 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005439 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005440 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005441 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005442 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005443 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005444 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Greg Griscofa47b532011-11-11 10:32:06 -08005445 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005446 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chand07220e2012-02-13 15:52:22 -08005447 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005448 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chanb20742b2012-02-27 15:47:35 -08005449 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall61286312012-02-22 15:55:09 -08005450 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005451
Patrick Lai04baee942012-05-01 14:38:47 -07005452 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5453 "msm-dai-q6-mi2s"),
5454 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5455 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005456 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5457 "msm-dai-q6.1"),
5458 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5459 "msm-dai-q6.1"),
5460 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5461 "msm-dai-q6.5"),
5462 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5463 "msm-dai-q6.5"),
5464 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
5465 "msm-dai-q6.16384"),
5466 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5467 "msm-dai-q6.16384"),
5468 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5469 "msm-dai-q6.4"),
5470 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5471 "msm-dai-q6.4"),
5472 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005473 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005474 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, ""),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005475 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005476 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, ""),
5477 CLK_LOOKUP("core_clk", vpe_axi_clk.c, ""),
5478 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
5479 CLK_LOOKUP("core_clk", vcap_axi_clk.c, ""),
5480 CLK_LOOKUP("core_clk", rot_axi_clk.c, ""),
5481 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, ""),
5482 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
5483 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, ""),
5484 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, ""),
Patrick Dalye6f489042012-07-11 15:29:15 -07005485 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005486
5487 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
5488 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
5489 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.0"),
5490 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.1"),
5491 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5492 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5493 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5494 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5495 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
5496 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
5497 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Ramesh Masavarapua1bc0e42012-03-05 07:42:48 -08005498 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005499
Manu Gautam5143b252012-01-05 19:25:23 -08005500 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5501 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5502 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5503 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5504 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005505
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005506 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5507 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5508 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5509 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5510 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5511 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5512 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5513 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5514 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005515 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.9"),
5516 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.10"),
5517
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005518 CLK_LOOKUP("core_clk", vcap_axi_clk.c, "msm_iommu.11"),
5519
Deepak Kotur954b1782012-04-24 17:58:19 -07005520 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5521 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5522 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5523 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5524 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005525 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5526 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
5527
Jeff Ohlstein8c116c72011-10-27 17:34:48 -07005528 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005529 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5530 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005531
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07005532 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
5533 CLK_LOOKUP("reset2_clk", dsi2_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07005534
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005535 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5536 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5537 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
Tianyi Gou455c13c2012-02-02 16:33:24 -08005538 CLK_LOOKUP("krait2_mclk", krait2_m_clk, ""),
5539 CLK_LOOKUP("krait3_mclk", krait3_m_clk, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005540};
5541
Patrick Dalye6f489042012-07-11 15:29:15 -07005542static struct clk_lookup msm_clocks_8960_common[] __initdata = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005543 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5544 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Stephen Boyded630b02012-01-26 15:26:47 -08005545 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5546 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5547 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5548 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5549 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005550 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005551 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
David Collinsa7d23532012-08-02 10:48:16 -07005552 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Stephen Boyded630b02012-01-26 15:26:47 -08005553 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5554 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5555 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5556 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005557
Matt Wagantalld75f1312012-05-23 16:17:35 -07005558 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5559 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5560 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5561 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5562 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5563 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5564 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5565 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5566 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5567 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5568 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5569 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5570 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5571 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5572 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5573 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5574
Matt Wagantallb2710b82011-11-16 19:55:17 -08005575 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005576 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005577 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5578 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5579 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005580 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005581 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5582 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5583 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5584 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5585 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005586 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005587 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5588 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005589 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005590 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5591 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5592 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5593 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5594 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5595 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5596 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005597
5598 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005599 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5600 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5601 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005602
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005603 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5604 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5605 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5606 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5607 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5608 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5609 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
Matt Wagantalle2522372011-08-17 14:52:21 -07005610 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5611 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005612 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
Mayank Rana1f02d952012-07-04 19:11:20 +05305613 /* used on 8960 SGLTE for console */
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005614 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hsl.1"),
Mayank Rana1f02d952012-07-04 19:11:20 +05305615 /* used on 8960 standalone with Atheros Bluetooth */
5616 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hs.2"),
Mayank Ranae009c922012-03-22 03:02:06 +05305617 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, "msm_serial_hs.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005618 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5619 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5620 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005621 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005622 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005623 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5624 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005625 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5626 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5627 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5628 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005629 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005630 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005631 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005632 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005633 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Vikram Mulukutladd0a2372011-09-19 15:58:21 -07005634 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Matt Wagantallc1205292011-08-11 17:19:31 -07005635 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005636 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5637 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5638 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5639 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5640 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005641 CLK_LOOKUP("slimbus_xo_src_clk", slimbus_xo_src_clk.c, NULL),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005642 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005643 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5644 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005645 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5646 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5647 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5648 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5649 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5650 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005651 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5652 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5653 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5654 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5655 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005656 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005657 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005658 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005659 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005660 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Matt Wagantallac294852011-08-17 15:44:58 -07005661 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005662 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005663 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
5664 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Matt Wagantalle2522372011-08-17 14:52:21 -07005665 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
5666 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005667 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
Mayank Rana1f02d952012-07-04 19:11:20 +05305668 /* used on 8960 SGLTE for serial console */
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005669 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hsl.1"),
Mayank Rana1f02d952012-07-04 19:11:20 +05305670 /* used on 8960 standalone with Atheros Bluetooth */
5671 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hs.2"),
Mayank Ranae009c922012-03-22 03:02:06 +05305672 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "msm_serial_hs.1"),
Matt Wagantallac294852011-08-17 15:44:58 -07005673 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005674 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005675 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005676 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005677 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5678 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005679 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
5680 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005681 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005682 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5683 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5684 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5685 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
5686 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
Matt Wagantalle1a86062011-08-18 17:46:10 -07005687 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5688 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005689 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5690 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5691 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5692 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chan09f4e662011-12-16 08:17:02 -08005693 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
5694 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-006c"),
5695 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0048"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005696 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -08005697 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005698 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005699 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5700 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005701 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005702 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5703 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005704 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005705 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5706 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005707 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
Kevin Chane12c6672011-10-26 11:55:26 -07005708 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5709 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005710 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
5711 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
5712 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5713 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5714 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5715 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
5716 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
Kevin Chanf6216f22011-10-25 18:40:11 -07005717 CLK_LOOKUP("csiphy_timer_src_clk",
5718 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5719 CLK_LOOKUP("csiphy_timer_src_clk",
5720 csiphy_timer_src_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005721 CLK_LOOKUP("csiphy_timer_src_clk",
5722 csiphy_timer_src_clk.c, "msm_csiphy.2"),
Kevin Chanf6216f22011-10-25 18:40:11 -07005723 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5724 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005725 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005726 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5727 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5728 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5729 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005730 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005731 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
5732 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005733 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5734 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005735 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07005736 CLK_LOOKUP("core_clk", jpegd_clk.c, "msm_mercury.0"),
5737 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, "msm_mercury.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005738 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005739 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005740 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005741 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005742 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005743 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005744 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005745 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005746 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5747 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005748 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005749 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005750 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005751 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
5752 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005753 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005754 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005755 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Kevin Chana0853122011-11-07 19:48:44 -08005756 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005757 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chan5827c552011-10-28 18:36:32 -07005758 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005759 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chan5827c552011-10-28 18:36:32 -07005760 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005761 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5762 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5763 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5764 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5765 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5766 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5767 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005768 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5769 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005770 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5771 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005772 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005773 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5774 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5775 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5776 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005777 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005778 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005779 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5780 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005781 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005782 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005783 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005784 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005785 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005786 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005787 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005788 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005789 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005790 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005791 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chan5827c552011-10-28 18:36:32 -07005792 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005793 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chana0853122011-11-07 19:48:44 -08005794 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005795 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Patrick Lai04baee942012-05-01 14:38:47 -07005796 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5797 "msm-dai-q6-mi2s"),
5798 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5799 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005800 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5801 "msm-dai-q6.1"),
5802 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5803 "msm-dai-q6.1"),
5804 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5805 "msm-dai-q6.5"),
5806 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5807 "msm-dai-q6.5"),
5808 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
5809 "msm-dai-q6.16384"),
5810 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5811 "msm-dai-q6.16384"),
5812 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5813 "msm-dai-q6.4"),
5814 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5815 "msm-dai-q6.4"),
5816 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005817 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005818 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005819 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantalle604d712011-10-21 15:38:18 -07005820 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"),
5821 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
5822 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
5823 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
5824 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
5825 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
5826 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
5827 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
5828 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
5829 CLK_LOOKUP("core_clk", gfx3d_clk.c, "msm_iommu.9"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005830
5831 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5832 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5833 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5834 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5835 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005836 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5837 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005838
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005839 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
Manu Gautam5143b252012-01-05 19:25:23 -08005840 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005841 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5842 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5843 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5844 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5845 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
Yan He160633e2011-06-30 12:18:56 -07005846 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
Stephen Boyd1c51a492011-10-26 12:11:47 -07005847 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
Stephen Boydef5d1c42011-12-15 20:47:14 -08005848 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Ramesh Masavarapua1bc0e42012-03-05 07:42:48 -08005849 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005850
Matt Wagantalle1a86062011-08-18 17:46:10 -07005851 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005852 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5853 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Matt Wagantall8b38f942011-08-02 18:23:18 -07005854
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07005855 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
5856 CLK_LOOKUP("reset2_clk", dsi2_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07005857
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005858 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5859 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5860 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
5861 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
5862 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
5863 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005864};
5865
Patrick Dalye6f489042012-07-11 15:29:15 -07005866static struct clk_lookup msm_clocks_8960_only[] __initdata = {
5867 CLK_LOOKUP("enc_clk", tv_enc_clk.c, "tvenc.0"),
5868 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
5869 CLK_LOOKUP("iface_clk", tv_enc_p_clk.c, "tvenc.0"),
5870
5871 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "kgsl-2d0.0"),
5872 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "footswitch-8x60.0"),
5873 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "kgsl-2d1.1"),
5874 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "footswitch-8x60.1"),
5875 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "kgsl-2d0.0"),
5876 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "footswitch-8x60.0"),
5877 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "kgsl-2d1.1"),
5878 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "footswitch-8x60.1"),
5879 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "msm_iommu.10"),
5880 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "msm_iommu.11"),
5881};
5882
5883static struct clk_lookup msm_clocks_8960ab_only[] __initdata = {
5884 CLK_LOOKUP("bus_clk", gfx3d_axi_clk.c, "footswitch-8x60.2"),
Joel King9af070b2012-08-19 22:32:14 -07005885 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu.10"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005886 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
5887};
5888
5889static struct clk_lookup msm_clocks_8960[ARRAY_SIZE(msm_clocks_8960_common)
5890 + ARRAY_SIZE(msm_clocks_8960_only)
5891 + ARRAY_SIZE(msm_clocks_8960ab_only)];
5892
Tianyi Goue3d4f542012-03-15 17:06:45 -07005893static struct clk_lookup msm_clocks_8930[] = {
Stephen Boydbe1a7392012-04-02 20:17:11 -07005894 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005895 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5896 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
5897 CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
5898 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.1"),
5899 CLK_LOOKUP("xo", cxo_clk.c, "pil_qdsp6v4.2"),
5900 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
David Collinsa7d23532012-08-02 10:48:16 -07005901 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005902 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5903 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5904 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5905 CLK_LOOKUP("measure", measure_clk.c, "debug"),
5906
Matt Wagantalld75f1312012-05-23 16:17:35 -07005907 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5908 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5909 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5910 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5911 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5912 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5913 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5914 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5915 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5916 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5917 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5918 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5919 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5920 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5921 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5922 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5923
Tianyi Goue3d4f542012-03-15 17:06:45 -07005924 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005925 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005926 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5927 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5928 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
5929 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
5930 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5931 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5932 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5933 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5934 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005935 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005936 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5937 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005938 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005939 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5940 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5941 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5942 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5943 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5944 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5945 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005946
5947 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005948 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5949 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5950 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
5951
5952 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5953 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5954 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5955 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5956 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5957 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5958 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
5959 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5960 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
5961 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
5962 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, ""),
5963 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, ""),
5964 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5965 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5966 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
5967 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
5968 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
5969 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5970 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
5971 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5972 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5973 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5974 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
5975 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, "qup_i2c.0"),
5976 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
5977 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
5978 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
5979 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
5980 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
5981 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
5982 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5983 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5984 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5985 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5986 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
5987 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, ""),
5988 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
5989 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5990 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
5991 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5992 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5993 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5994 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5995 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5996 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
5997 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5998 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5999 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
6000 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
6001 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
6002 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
6003 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
6004 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
6005 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
6006 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
6007 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
6008 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
6009 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
6010 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
6011 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
6012 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
6013 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
6014 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, ""),
6015 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "qup_i2c.0"),
6016 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
6017 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
6018 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
6019 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
6020 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
6021 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
6022 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
6023 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
6024 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
6025 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
6026 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
6027 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
6028 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
6029 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
6030 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
6031 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
6032 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
6033 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006034 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Hody Hung994f4622012-04-24 10:27:45 -07006035 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
Sreesudhan Ramakrish Ramkumar981c82c2012-04-30 17:31:37 -07006036 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006037 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
6038 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
6039 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
6040 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
6041 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
6042 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
6043 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
6044 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
6045 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
6046 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
6047 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
6048 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
6049 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
6050 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
6051 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
6052 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
6053 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
6054 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
6055 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
6056 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
6057 CLK_LOOKUP("csiphy_timer_src_clk",
6058 csiphy_timer_src_clk.c, "msm_csiphy.0"),
6059 CLK_LOOKUP("csiphy_timer_src_clk",
6060 csiphy_timer_src_clk.c, "msm_csiphy.1"),
6061 CLK_LOOKUP("csiphy_timer_src_clk",
6062 csiphy_timer_src_clk.c, "msm_csiphy.2"),
6063 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
6064 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
6065 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006066 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
6067 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006068 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
6069 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
6070 CLK_LOOKUP("bus_clk",
6071 gfx3d_axi_clk_8930.c, "footswitch-8x60.2"),
6072 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006073 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
6074 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006075 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006076 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006077 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006078 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006079 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006080 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006081 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
6082 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
6083 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006084 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
6085 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006086 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006087 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006088 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
6089 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006090 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
6091 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006092 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006093 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006094 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
6095 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
6096 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
6097 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
6098 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
6099 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
6100 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
6101 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
6102 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
6103 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
6104 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
6105 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
6106 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006107 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006108 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
6109 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
6110 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006111 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
6112 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006113 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
6114 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
6115 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
6116 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006117 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006118 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
6119 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006120 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006121 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
6122 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"),
6123 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
6124 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
6125 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
6126 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
6127 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
6128 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
6129 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
6130 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
6131 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.6"),
6132 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.6"),
6133 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
6134 "msm-dai-q6.1"),
6135 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
6136 "msm-dai-q6.1"),
6137 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
6138 "msm-dai-q6.5"),
6139 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
6140 "msm-dai-q6.5"),
6141 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
6142 "msm-dai-q6.16384"),
6143 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
6144 "msm-dai-q6.16384"),
6145 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
6146 "msm-dai-q6.4"),
6147 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
6148 "msm-dai-q6.4"),
6149 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
6150 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
6151 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
6152 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"),
6153 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"),
6154 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"),
6155 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"),
6156 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"),
6157 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"),
6158 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu.7"),
6159 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu.8"),
6160 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.9"),
6161 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu.10"),
6162
6163 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
6164 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
6165 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
6166 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
6167 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08006168 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
6169 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006170
6171 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
6172 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
6173 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
6174 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
6175 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
6176 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
6177 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
6178 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
6179 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
6180 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
6181 CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"),
6182
6183 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07006184 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
6185 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006186
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07006187 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07006188
Tianyi Goue3d4f542012-03-15 17:06:45 -07006189 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
6190 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
6191 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
6192 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
6193 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
6194 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
6195};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006196/*
6197 * Miscellaneous clock register initializations
6198 */
6199
6200/* Read, modify, then write-back a register. */
6201static void __init rmwreg(uint32_t val, void *reg, uint32_t mask)
6202{
6203 uint32_t regval = readl_relaxed(reg);
6204 regval &= ~mask;
6205 regval |= val;
6206 writel_relaxed(regval, reg);
6207}
6208
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006209static struct pll_config_regs pll4_regs __initdata = {
6210 .l_reg = LCC_PLL0_L_VAL_REG,
6211 .m_reg = LCC_PLL0_M_VAL_REG,
6212 .n_reg = LCC_PLL0_N_VAL_REG,
6213 .config_reg = LCC_PLL0_CONFIG_REG,
6214 .mode_reg = LCC_PLL0_MODE_REG,
6215};
Tianyi Gou41515e22011-09-01 19:37:43 -07006216
Matt Wagantall86e03822011-12-12 10:59:24 -08006217static struct pll_config pll4_config_393 __initdata = {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006218 .l = 0xE,
6219 .m = 0x27A,
6220 .n = 0x465,
6221 .vco_val = 0x0,
6222 .vco_mask = BM(17, 16),
6223 .pre_div_val = 0x0,
6224 .pre_div_mask = BIT(19),
6225 .post_div_val = 0x0,
6226 .post_div_mask = BM(21, 20),
6227 .mn_ena_val = BIT(22),
6228 .mn_ena_mask = BIT(22),
6229 .main_output_val = BIT(23),
6230 .main_output_mask = BIT(23),
6231};
Tianyi Gou41515e22011-09-01 19:37:43 -07006232
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006233static struct pll_config_regs pll15_regs __initdata = {
6234 .l_reg = MM_PLL3_L_VAL_REG,
6235 .m_reg = MM_PLL3_M_VAL_REG,
6236 .n_reg = MM_PLL3_N_VAL_REG,
6237 .config_reg = MM_PLL3_CONFIG_REG,
6238 .mode_reg = MM_PLL3_MODE_REG,
6239};
Tianyi Gou358c3862011-10-18 17:03:41 -07006240
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006241static struct pll_config pll15_config __initdata = {
6242 .l = (0x24 | BVAL(31, 7, 0x620)),
6243 .m = 0x1,
6244 .n = 0x9,
6245 .vco_val = BVAL(17, 16, 0x2),
6246 .vco_mask = BM(17, 16),
6247 .pre_div_val = 0x0,
6248 .pre_div_mask = BIT(19),
6249 .post_div_val = 0x0,
6250 .post_div_mask = BM(21, 20),
6251 .mn_ena_val = BIT(22),
6252 .mn_ena_mask = BIT(22),
6253 .main_output_val = BIT(23),
6254 .main_output_mask = BIT(23),
6255};
Tianyi Gou41515e22011-09-01 19:37:43 -07006256
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006257static struct pll_config_regs pll14_regs __initdata = {
6258 .l_reg = BB_PLL14_L_VAL_REG,
6259 .m_reg = BB_PLL14_M_VAL_REG,
6260 .n_reg = BB_PLL14_N_VAL_REG,
6261 .config_reg = BB_PLL14_CONFIG_REG,
6262 .mode_reg = BB_PLL14_MODE_REG,
6263};
6264
6265static struct pll_config pll14_config __initdata = {
6266 .l = (0x11 | BVAL(31, 7, 0x620)),
6267 .m = 0x7,
6268 .n = 0x9,
6269 .vco_val = 0x0,
6270 .vco_mask = BM(17, 16),
6271 .pre_div_val = 0x0,
6272 .pre_div_mask = BIT(19),
6273 .post_div_val = 0x0,
6274 .post_div_mask = BM(21, 20),
6275 .mn_ena_val = BIT(22),
6276 .mn_ena_mask = BIT(22),
6277 .main_output_val = BIT(23),
6278 .main_output_mask = BIT(23),
6279};
Tianyi Gou41515e22011-09-01 19:37:43 -07006280
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006281static void __init reg_init(void)
6282{
Stephen Boydd471e7a2011-11-19 01:37:39 -08006283 void __iomem *imem_reg;
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006284
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006285 /* Deassert MM SW_RESET_ALL signal. */
6286 writel_relaxed(0, SW_RESET_ALL_REG);
6287
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006288 /*
Tianyi Goue3d4f542012-03-15 17:06:45 -07006289 * Some bits are only used on 8960 or 8064 or 8930 and are marked as
6290 * reserved bits on the other SoCs. Writing to these reserved bits
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006291 * should have no effect.
6292 */
Stephen Boydd471e7a2011-11-19 01:37:39 -08006293 /*
6294 * Initialize MM AHB registers: Enable the FPB clock and disable HW
Patrick Dalye6f489042012-07-11 15:29:15 -07006295 * gating on 8627 and 8960 for all clocks. Also set VFE_AHB's
Stephen Boydd471e7a2011-11-19 01:37:39 -08006296 * FORCE_CORE_ON bit to prevent its memory from being collapsed when
6297 * the clock is halted. The sleep and wake-up delays are set to safe
6298 * values.
6299 */
Patrick Dalye6f489042012-07-11 15:29:15 -07006300 if (cpu_is_msm8627() || cpu_is_msm8960ab()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006301 rmwreg(0x00000003, AHB_EN_REG, 0x6C000103);
6302 writel_relaxed(0x000007F9, AHB_EN2_REG);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006303 } else {
David Garibaldif69836a2012-08-17 16:05:22 -07006304 rmwreg(0x40000000, AHB_EN_REG, 0x6C000103);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006305 writel_relaxed(0x3C7097F9, AHB_EN2_REG);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006306 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006307
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006308 if (cpu_is_apq8064())
Tianyi Gouf3095ea2012-05-22 14:16:06 -07006309 rmwreg(0x00000001, AHB_EN3_REG, 0x00000001);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006310
6311 /* Deassert all locally-owned MM AHB resets. */
6312 rmwreg(0, SW_RESET_AHB_REG, 0xFFF7DFFF);
Tianyi Gou41515e22011-09-01 19:37:43 -07006313 rmwreg(0, SW_RESET_AHB2_REG, 0x0000000F);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006314
6315 /* Initialize MM AXI registers: Enable HW gating for all clocks that
6316 * support it. Also set FORCE_CORE_ON bits, and any sleep and wake-up
6317 * delays to safe values. */
Patrick Dalye6f489042012-07-11 15:29:15 -07006318 if (cpu_is_msm8960ab() || (cpu_is_msm8960() &&
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006319 SOCINFO_VERSION_MAJOR(socinfo_get_version()) < 3) ||
6320 cpu_is_msm8627()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006321 rmwreg(0x000007F9, MAXI_EN_REG, 0x0803FFFF);
6322 rmwreg(0x3027FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006323 } else {
6324 rmwreg(0x0003AFF9, MAXI_EN_REG, 0x0803FFFF);
6325 rmwreg(0x3A27FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006326 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006327
Matt Wagantall53d968f2011-07-19 13:22:53 -07006328 rmwreg(0x0027FCFF, MAXI_EN3_REG, 0x003FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006329 rmwreg(0x0027FCFF, MAXI_EN4_REG, 0x017FFFFF);
6330
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006331 if (cpu_is_apq8064())
Tianyi Gouf3095ea2012-05-22 14:16:06 -07006332 rmwreg(0x019FECFF, MAXI_EN5_REG, 0x01FFEFFF);
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006333 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006334 rmwreg(0x000004FF, MAXI_EN5_REG, 0x00000FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006335 if (cpu_is_msm8960ab())
6336 rmwreg(0x009FE000, MAXI_EN5_REG, 0x01FFE000);
6337
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006338 if (cpu_is_msm8627())
Stephen Boydd471e7a2011-11-19 01:37:39 -08006339 rmwreg(0x000003C7, SAXI_EN_REG, 0x00003FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006340 else if (cpu_is_msm8960ab())
6341 rmwreg(0x000001C6, SAXI_EN_REG, 0x00001DF6);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006342 else
6343 rmwreg(0x00003C38, SAXI_EN_REG, 0x00003FFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006344
6345 /* Enable IMEM's clk_on signal */
6346 imem_reg = ioremap(0x04b00040, 4);
6347 if (imem_reg) {
6348 writel_relaxed(0x3, imem_reg);
6349 iounmap(imem_reg);
6350 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006351
6352 /* Initialize MM CC registers: Set MM FORCE_CORE_ON bits so that core
6353 * memories retain state even when not clocked. Also, set sleep and
6354 * wake-up delays to safe values. */
Matt Wagantall53d968f2011-07-19 13:22:53 -07006355 rmwreg(0x00000000, CSI0_CC_REG, 0x00000410);
6356 rmwreg(0x00000000, CSI1_CC_REG, 0x00000410);
6357 rmwreg(0x80FF0000, DSI1_BYTE_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006358 rmwreg(0x80FF0000, DSI_PIXEL_CC_REG, 0xE0FF0010);
Tarun Karra6fbc00a2011-12-13 09:23:47 -07006359 rmwreg(0xC0FF0000, GFX3D_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006360 rmwreg(0x80FF0000, IJPEG_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006361 rmwreg(0x80FF0000, MDP_CC_REG, 0xE1FF0010);
6362 rmwreg(0x80FF0000, MDP_LUT_CC_REG, 0xE0FF0010);
6363 rmwreg(0x80FF0000, ROT_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006364 rmwreg(0x000004FF, TV_CC2_REG, 0x000007FF);
6365 rmwreg(0xC0FF0000, VCODEC_CC_REG, 0xE0FF0010);
6366 rmwreg(0x80FF0000, VFE_CC_REG, 0xE0FF4010);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006367 rmwreg(0x800000FF, VFE_CC2_REG, 0xE00000FF);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006368 rmwreg(0x80FF0000, VPE_CC_REG, 0xE0FF0010);
Patrick Dalye6f489042012-07-11 15:29:15 -07006369 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_apq8064()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006370 rmwreg(0x80FF0000, DSI2_BYTE_CC_REG, 0xE0FF0010);
6371 rmwreg(0x80FF0000, DSI2_PIXEL_CC_REG, 0xE0FF0010);
6372 rmwreg(0x80FF0000, JPEGD_CC_REG, 0xE0FF0010);
6373 }
Patrick Dalye6f489042012-07-11 15:29:15 -07006374 if (cpu_is_msm8960ab())
6375 rmwreg(0x00000001, DSI2_PIXEL_CC2_REG, 0x00000001);
6376
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006377 if (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm8930aa() ||
6378 cpu_is_msm8627())
Patrick Dalye6f489042012-07-11 15:29:15 -07006379 rmwreg(0x80FF0000, TV_CC_REG, 0xE1FFC010);
6380 if (cpu_is_msm8960ab())
6381 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Goue3d4f542012-03-15 17:06:45 -07006382
6383 if (cpu_is_msm8960()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006384 rmwreg(0x80FF0000, GFX2D0_CC_REG, 0xE0FF0010);
6385 rmwreg(0x80FF0000, GFX2D1_CC_REG, 0xE0FF0010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006386 }
6387 if (cpu_is_apq8064()) {
6388 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Gou621f8742011-09-01 21:45:01 -07006389 rmwreg(0x80FF0000, VCAP_CC_REG, 0xE0FF1010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006390 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006391
Tianyi Gou41515e22011-09-01 19:37:43 -07006392 /*
6393 * Initialize USB_HS_HCLK_FS registers: Set FORCE_C_ON bits so that
6394 * core remain active during halt state of the clk. Also, set sleep
6395 * and wake-up value to max.
6396 */
6397 rmwreg(0x0000004F, USB_HS1_HCLK_FS_REG, 0x0000007F);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006398 if (cpu_is_apq8064()) {
6399 rmwreg(0x0000004F, USB_HS3_HCLK_FS_REG, 0x0000007F);
6400 rmwreg(0x0000004F, USB_HS4_HCLK_FS_REG, 0x0000007F);
6401 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006402
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006403 /* De-assert MM AXI resets to all hardware blocks. */
6404 writel_relaxed(0, SW_RESET_AXI_REG);
6405
6406 /* Deassert all MM core resets. */
6407 writel_relaxed(0, SW_RESET_CORE_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006408 writel_relaxed(0, SW_RESET_CORE2_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006409
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006410 /* Enable TSSC and PDM PXO sources. */
6411 writel_relaxed(BIT(11), TSSC_CLK_CTL_REG);
6412 writel_relaxed(BIT(15), PDM_CLK_NS_REG);
6413
6414 /* Source SLIMBus xo src from slimbus reference clock */
Patrick Dalye6f489042012-07-11 15:29:15 -07006415 if (cpu_is_msm8960ab() || cpu_is_msm8960())
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006416 writel_relaxed(0x3, SLIMBUS_XO_SRC_CLK_CTL_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006417
6418 /* Source the dsi_byte_clks from the DSI PHY PLLs */
6419 rmwreg(0x1, DSI1_BYTE_NS_REG, 0x7);
Patrick Dalye6f489042012-07-11 15:29:15 -07006420 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_apq8064())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006421 rmwreg(0x2, DSI2_BYTE_NS_REG, 0x7);
Tianyi Gou41515e22011-09-01 19:37:43 -07006422
Siddhartha Agrawal482459c2012-05-24 15:28:53 -07006423 /* Source the dsi1_esc_clk from the DSI1 PHY PLLs */
6424 rmwreg(0x1, DSI1_ESC_NS_REG, 0x7);
6425
Tianyi Gou352955d2012-05-18 19:44:01 -07006426 /*
6427 * Source the sata_phy_ref_clk from PXO and set predivider of
6428 * sata_pmalive_clk to 1.
6429 */
6430 if (cpu_is_apq8064()) {
Tianyi Gou41515e22011-09-01 19:37:43 -07006431 rmwreg(0, SATA_PHY_REF_CLK_CTL_REG, 0x1);
Tianyi Gou352955d2012-05-18 19:44:01 -07006432 rmwreg(0, SATA_PMALIVE_CLK_CTL_REG, 0x3);
6433 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006434
6435 /*
Tianyi Gou05e01102012-02-08 22:15:49 -08006436 * TODO: Programming below PLLs and prng_clk is temporary and
6437 * needs to be removed after bootloaders program them.
Tianyi Gou41515e22011-09-01 19:37:43 -07006438 */
6439 if (cpu_is_apq8064()) {
Tianyi Gou317aa862012-02-06 14:31:07 -08006440 u32 is_pll_enabled;
Tianyi Gou41515e22011-09-01 19:37:43 -07006441
6442 /* Program pxo_src_clk to source from PXO */
6443 rmwreg(0x1, PXO_SRC_CLK_CTL_REG, 0x7);
6444
Tianyi Gou41515e22011-09-01 19:37:43 -07006445 /* Check if PLL14 is active */
6446 is_pll_enabled = readl_relaxed(BB_PLL14_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006447 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006448 /* Ref clk = 27MHz and program pll14 to 480MHz */
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006449 configure_pll(&pll14_config, &pll14_regs, 1);
Tianyi Gou621f8742011-09-01 21:45:01 -07006450
Tianyi Gou621f8742011-09-01 21:45:01 -07006451 /* Program PLL15 to 975MHz with ref clk = 27MHz */
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006452 configure_pll(&pll15_config, &pll15_regs, 0);
Tianyi Gouc29c3242011-10-12 21:02:15 -07006453
6454 /* Check if PLL4 is active */
6455 is_pll_enabled = readl_relaxed(LCC_PLL0_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006456 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006457 /* Ref clk = 27MHz and program pll4 to 393.2160MHz */
Matt Wagantall86e03822011-12-12 10:59:24 -08006458 configure_pll(&pll4_config_393, &pll4_regs, 1);
Tianyi Gouc29c3242011-10-12 21:02:15 -07006459
6460 /* Enable PLL4 source on the LPASS Primary PLL Mux */
6461 writel_relaxed(0x1, LCC_PRI_PLL_CLK_CTL_REG);
Tianyi Gou05e01102012-02-08 22:15:49 -08006462
6463 /* Program prng_clk to 64MHz if it isn't configured */
6464 if (!readl_relaxed(PRNG_CLK_NS_REG))
6465 writel_relaxed(0x2B, PRNG_CLK_NS_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006466 }
Tianyi Gou65c536a2012-03-20 23:20:29 -07006467
6468 /*
6469 * Program PLL15 to 900MHz with ref clk = 27MHz and
6470 * only enable PLL main output.
6471 */
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006472 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006473 pll15_config.l = 0x21 | BVAL(31, 7, 0x600);
6474 pll15_config.m = 0x1;
6475 pll15_config.n = 0x3;
6476 configure_pll(&pll15_config, &pll15_regs, 0);
6477 /* Disable AUX and BIST outputs */
6478 writel_relaxed(0, MM_PLL3_TEST_CTL_REG);
Tianyi Gou65c536a2012-03-20 23:20:29 -07006479 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006480}
6481
Patrick Dalye6f489042012-07-11 15:29:15 -07006482struct clock_init_data msm8960_clock_init_data __initdata;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006483static void __init msm8960_clock_pre_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006484{
Matt Wagantall86e03822011-12-12 10:59:24 -08006485 /* Initialize clock registers. */
6486 reg_init();
6487
Patrick Daly1a3859f2012-08-27 16:10:26 -07006488 if (cpu_is_apq8064())
Matt Wagantall82feaa12012-07-09 10:54:49 -07006489 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8064;
Tianyi Goubf3d0b12012-01-23 14:37:28 -08006490
Matt Wagantall86e03822011-12-12 10:59:24 -08006491 /* Detect PLL4 programmed for alternate 491.52MHz clock plan. */
6492 if (readl_relaxed(LCC_PLL0_L_VAL_REG) == 0x12) {
6493 pll4_clk.c.rate = 491520000;
6494 audio_slimbus_clk.freq_tbl = clk_tbl_aif_osr_492;
6495 mi2s_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6496 codec_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6497 spare_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6498 codec_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6499 spare_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6500 pcm_clk.freq_tbl = clk_tbl_pcm_492;
6501 }
6502
Patrick Dalye6f489042012-07-11 15:29:15 -07006503 if (cpu_is_msm8960() || cpu_is_msm8960ab())
6504 memcpy(msm_clocks_8960, msm_clocks_8960_common,
6505 sizeof(msm_clocks_8960_common));
6506 if (cpu_is_msm8960ab()) {
6507 pll3_clk.c.rate = 650000000;
6508 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8960ab;
6509 gfx3d_clk.c.fmax[VDD_DIG_LOW] = 192000000;
6510 gfx3d_clk.c.fmax[VDD_DIG_NOMINAL] = 325000000;
6511 gfx3d_clk.c.fmax[VDD_DIG_HIGH] = 400000000;
6512 mdp_clk.freq_tbl = clk_tbl_mdp_8960ab;
6513 mdp_clk.c.fmax[VDD_DIG_LOW] = 128000000;
6514 mdp_clk.c.fmax[VDD_DIG_NOMINAL] = 266667000;
6515
6516 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6517 msm_clocks_8960ab_only, sizeof(msm_clocks_8960ab_only));
6518 msm8960_clock_init_data.size -=
6519 ARRAY_SIZE(msm_clocks_8960_only);
Joel King9af070b2012-08-19 22:32:14 -07006520
6521 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Patrick Dalye6f489042012-07-11 15:29:15 -07006522 } else if (cpu_is_msm8960()) {
6523 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6524 msm_clocks_8960_only, sizeof(msm_clocks_8960_only));
6525 msm8960_clock_init_data.size -=
6526 ARRAY_SIZE(msm_clocks_8960ab_only);
6527 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006528 /*
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006529 * Change the freq tables for and voltage requirements for
6530 * clocks which differ between 8960 and 8064.
Tianyi Gou41515e22011-09-01 19:37:43 -07006531 */
6532 if (cpu_is_apq8064()) {
6533 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8064;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006534
6535 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8064,
6536 sizeof(gfx3d_clk.c.fmax));
6537 memcpy(ijpeg_clk.c.fmax, fmax_ijpeg_8064,
6538 sizeof(ijpeg_clk.c.fmax));
6539 memcpy(mdp_clk.c.fmax, fmax_mdp_8064,
6540 sizeof(ijpeg_clk.c.fmax));
6541 memcpy(tv_src_clk.c.fmax, fmax_tv_src_8064,
6542 sizeof(tv_src_clk.c.fmax));
6543 memcpy(vfe_clk.c.fmax, fmax_vfe_8064,
6544 sizeof(vfe_clk.c.fmax));
6545
Patrick Dalye6f489042012-07-11 15:29:15 -07006546 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Tianyi Goue3d4f542012-03-15 17:06:45 -07006547 }
6548
6549 /*
6550 * Change the freq tables and voltage requirements for
6551 * clocks which differ between 8960 and 8930.
6552 */
Patrick Dalyebe63c52012-08-07 15:41:30 -07006553 if (cpu_is_msm8930() || cpu_is_msm8627()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006554 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8930,
6555 sizeof(gfx3d_clk.c.fmax));
Patrick Dalyebe63c52012-08-07 15:41:30 -07006556 } else if (cpu_is_msm8930aa()) {
6557 memcpy(gfx3d_clk.c.fmax, fmax_gfx3d_8930aa,
6558 sizeof(gfx3d_clk.c.fmax));
6559 }
6560 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
6561 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8930;
Tianyi Goue3d4f542012-03-15 17:06:45 -07006562 pll15_clk.c.rate = 900000000;
6563 gmem_axi_clk.c.depends = &gfx3d_axi_clk_8930.c;
Tianyi Gou41515e22011-09-01 19:37:43 -07006564 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07006565 if ((readl_relaxed(PRNG_CLK_NS_REG) & 0x7F) == 0x2B)
6566 prng_clk.freq_tbl = clk_tbl_prng_64;
Stephen Boyd94625ef2011-07-12 17:06:01 -07006567
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006568 vote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006569
Vikram Mulukutla681d8682012-03-09 23:56:20 -08006570 clk_ops_local_pll.enable = sr_pll_clk_enable;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006571}
6572
Patrick Daly1a3859f2012-08-27 16:10:26 -07006573static void __init msm8930_pm8917_clock_pre_init(void)
6574{
6575 /* detect pmic8917 from board file, and call this init function */
6576
6577 vdd_dig.set_vdd = set_vdd_dig_8930;
6578 rpm_vreg_dig_8930 = RPM_VREG_ID_PM8917_VDD_DIG_CORNER;
6579 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930_pm8917;
6580
6581 msm8960_clock_pre_init();
6582}
6583
6584static void __init msm8930_clock_pre_init(void)
6585{
6586 vdd_dig.set_vdd = set_vdd_dig_8930;
6587 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930;
6588
6589 msm8960_clock_pre_init();
6590}
6591
Matt Wagantallb64888f2012-04-02 21:35:07 -07006592static void __init msm8960_clock_post_init(void)
6593{
6594 /* Keep PXO on whenever APPS cpu is active */
6595 clk_prepare_enable(&pxo_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006596
Matt Wagantalle655cd72012-04-09 10:15:03 -07006597 /* Reset 3D core while clocked to ensure it resets completely. */
6598 clk_set_rate(&gfx3d_clk.c, 27000000);
6599 clk_prepare_enable(&gfx3d_clk.c);
6600 clk_reset(&gfx3d_clk.c, CLK_RESET_ASSERT);
6601 udelay(5);
6602 clk_reset(&gfx3d_clk.c, CLK_RESET_DEASSERT);
6603 clk_disable_unprepare(&gfx3d_clk.c);
6604
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006605 /* Initialize rates for clocks that only support one. */
6606 clk_set_rate(&pdm_clk.c, 27000000);
Stephen Boyd842a1f62012-04-26 19:07:38 -07006607 clk_set_rate(&prng_clk.c, prng_clk.freq_tbl->freq_hz);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006608 clk_set_rate(&mdp_vsync_clk.c, 27000000);
6609 clk_set_rate(&tsif_ref_clk.c, 105000);
6610 clk_set_rate(&tssc_clk.c, 27000000);
6611 clk_set_rate(&usb_hs1_xcvr_clk.c, 60000000);
Tianyi Gou41515e22011-09-01 19:37:43 -07006612 if (cpu_is_apq8064()) {
6613 clk_set_rate(&usb_hs3_xcvr_clk.c, 60000000);
6614 clk_set_rate(&usb_hs4_xcvr_clk.c, 60000000);
6615 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006616 clk_set_rate(&usb_fs1_src_clk.c, 60000000);
Patrick Dalye6f489042012-07-11 15:29:15 -07006617 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_msm8930() ||
6618 cpu_is_msm8930aa() || cpu_is_msm8627())
Tianyi Gou41515e22011-09-01 19:37:43 -07006619 clk_set_rate(&usb_fs2_src_clk.c, 60000000);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006620 clk_set_rate(&usb_hsic_xcvr_fs_clk.c, 60000000);
6621 clk_set_rate(&usb_hsic_hsic_src_clk.c, 480000000);
6622 clk_set_rate(&usb_hsic_hsio_cal_clk.c, 9000000);
Lena Salman127823f2012-02-14 17:13:53 +02006623 clk_set_rate(&usb_hsic_system_clk.c, 60000000);
Stephen Boyd092fd182011-10-21 15:56:30 -07006624 /*
6625 * Set the CSI rates to a safe default to avoid warnings when
6626 * switching csi pix and rdi clocks.
6627 */
6628 clk_set_rate(&csi0_src_clk.c, 27000000);
6629 clk_set_rate(&csi1_src_clk.c, 27000000);
6630 clk_set_rate(&csi2_src_clk.c, 27000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006631
6632 /*
Stephen Boyd60496bb2011-10-17 13:51:37 -07006633 * The halt status bits for these clocks may be incorrect at boot.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006634 * Toggle these clocks on and off to refresh them.
6635 */
Stephen Boyd409b8b42012-04-10 12:12:56 -07006636 clk_prepare_enable(&pdm_clk.c);
6637 clk_disable_unprepare(&pdm_clk.c);
6638 clk_prepare_enable(&tssc_clk.c);
6639 clk_disable_unprepare(&tssc_clk.c);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006640 clk_prepare_enable(&usb_hsic_hsic_clk.c);
6641 clk_disable_unprepare(&usb_hsic_hsic_clk.c);
Stephen Boydd7a143a2012-02-16 17:59:26 -08006642
6643 /*
6644 * Keep sfab floor @ 54MHz so that Krait AHB is at least 27MHz at all
6645 * times when Apps CPU is active. This ensures the timer's requirement
6646 * of Krait AHB running 4 times as fast as the timer itself.
6647 */
6648 clk_set_rate(&sfab_tmr_a_clk.c, 54000000);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006649 clk_prepare_enable(&sfab_tmr_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006650}
6651
Stephen Boydbb600ae2011-08-02 20:11:40 -07006652static int __init msm8960_clock_late_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006653{
Stephen Boyda3787f32011-09-16 18:55:13 -07006654 int rc;
6655 struct clk *mmfpb_a_clk = clk_get_sys("clock-8960", "mmfpb_a_clk");
Stephen Boyd85436132011-09-16 18:55:13 -07006656 struct clk *cfpb_a_clk = clk_get_sys("clock-8960", "cfpb_a_clk");
Stephen Boyda3787f32011-09-16 18:55:13 -07006657
6658 /* Vote for MMFPB to be at least 76.8MHz when an Apps CPU is active. */
6659 if (WARN(IS_ERR(mmfpb_a_clk), "mmfpb_a_clk not found (%ld)\n",
6660 PTR_ERR(mmfpb_a_clk)))
6661 return PTR_ERR(mmfpb_a_clk);
Matt Wagantallde555f562011-11-08 14:18:07 -08006662 rc = clk_set_rate(mmfpb_a_clk, 76800000);
Stephen Boyda3787f32011-09-16 18:55:13 -07006663 if (WARN(rc, "mmfpb_a_clk rate was not set (%d)\n", rc))
6664 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006665 rc = clk_prepare_enable(mmfpb_a_clk);
Stephen Boyda3787f32011-09-16 18:55:13 -07006666 if (WARN(rc, "mmfpb_a_clk not enabled (%d)\n", rc))
6667 return rc;
6668
Stephen Boyd85436132011-09-16 18:55:13 -07006669 /* Vote for CFPB to be at least 64MHz when an Apps CPU is active. */
6670 if (WARN(IS_ERR(cfpb_a_clk), "cfpb_a_clk not found (%ld)\n",
6671 PTR_ERR(cfpb_a_clk)))
6672 return PTR_ERR(cfpb_a_clk);
Matt Wagantallde555f562011-11-08 14:18:07 -08006673 rc = clk_set_rate(cfpb_a_clk, 64000000);
Stephen Boyd85436132011-09-16 18:55:13 -07006674 if (WARN(rc, "cfpb_a_clk rate was not set (%d)\n", rc))
6675 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006676 rc = clk_prepare_enable(cfpb_a_clk);
Stephen Boyd85436132011-09-16 18:55:13 -07006677 if (WARN(rc, "cfpb_a_clk not enabled (%d)\n", rc))
6678 return rc;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006679
6680 return unvote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006681}
Stephen Boydbb600ae2011-08-02 20:11:40 -07006682
6683struct clock_init_data msm8960_clock_init_data __initdata = {
6684 .table = msm_clocks_8960,
6685 .size = ARRAY_SIZE(msm_clocks_8960),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006686 .pre_init = msm8960_clock_pre_init,
6687 .post_init = msm8960_clock_post_init,
Stephen Boydbb600ae2011-08-02 20:11:40 -07006688 .late_init = msm8960_clock_late_init,
6689};
Tianyi Gou41515e22011-09-01 19:37:43 -07006690
6691struct clock_init_data apq8064_clock_init_data __initdata = {
6692 .table = msm_clocks_8064,
6693 .size = ARRAY_SIZE(msm_clocks_8064),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006694 .pre_init = msm8960_clock_pre_init,
6695 .post_init = msm8960_clock_post_init,
Tianyi Gou41515e22011-09-01 19:37:43 -07006696 .late_init = msm8960_clock_late_init,
6697};
Tianyi Goue3d4f542012-03-15 17:06:45 -07006698
6699struct clock_init_data msm8930_clock_init_data __initdata = {
6700 .table = msm_clocks_8930,
6701 .size = ARRAY_SIZE(msm_clocks_8930),
Patrick Daly1a3859f2012-08-27 16:10:26 -07006702 .pre_init = msm8930_clock_pre_init,
6703 .post_init = msm8960_clock_post_init,
6704 .late_init = msm8960_clock_late_init,
6705};
6706
6707struct clock_init_data msm8930_pm8917_clock_init_data __initdata = {
6708 .table = msm_clocks_8930,
6709 .size = ARRAY_SIZE(msm_clocks_8930),
6710 .pre_init = msm8930_pm8917_clock_pre_init,
Matt Wagantallb64888f2012-04-02 21:35:07 -07006711 .post_init = msm8960_clock_post_init,
Tianyi Goue3d4f542012-03-15 17:06:45 -07006712 .late_init = msm8960_clock_late_init,
6713};