blob: be6d965a3f7152f684283bc39cc2ab72690f6931 [file] [log] [blame]
Sujit Reddy Thummab0d51e72012-12-31 15:37:16 +05301/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/err.h>
16#include <linux/ctype.h>
17#include <linux/bitops.h>
18#include <linux/io.h>
19#include <linux/spinlock.h>
20#include <linux/delay.h>
21#include <linux/clk.h>
22
23#include <asm/clkdev.h>
24#include <asm/mach-types.h>
25
26#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027#include <mach/rpm-regulator.h>
Stephen Boyd94625ef2011-07-12 17:06:01 -070028#include <mach/socinfo.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029
Matt Wagantall33d01f52012-02-23 23:27:44 -080030#include "clock.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031#include "clock-local.h"
32#include "clock-rpm.h"
33#include "clock-voter.h"
34#include "clock-dss-8960.h"
35#include "devices.h"
Vikram Mulukutla681d8682012-03-09 23:56:20 -080036#include "clock-pll.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38#define REG(off) (MSM_CLK_CTL_BASE + (off))
39#define REG_MM(off) (MSM_MMSS_CLK_CTL_BASE + (off))
40#define REG_LPA(off) (MSM_LPASS_CLK_CTL_BASE + (off))
Matt Wagantall8b38f942011-08-02 18:23:18 -070041#define REG_GCC(off) (MSM_APCS_GCC_BASE + (off))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
43/* Peripheral clock registers. */
Stephen Boyda52d7e32011-11-10 11:59:00 -080044#define ADM0_PBUS_CLK_CTL_REG REG(0x2208)
Tianyi Gou352955d2012-05-18 19:44:01 -070045#define SFAB_SATA_S_HCLK_CTL_REG REG(0x2480)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#define CE1_HCLK_CTL_REG REG(0x2720)
47#define CE1_CORE_CLK_CTL_REG REG(0x2724)
Tianyi Gou05e01102012-02-08 22:15:49 -080048#define PRNG_CLK_NS_REG REG(0x2E80)
Tianyi Gou41515e22011-09-01 19:37:43 -070049#define CE3_HCLK_CTL_REG REG(0x36C4)
50#define CE3_CORE_CLK_CTL_REG REG(0x36CC)
51#define CE3_CLK_SRC_NS_REG REG(0x36C0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#define DMA_BAM_HCLK_CTL REG(0x25C0)
Tianyi Gou6613de52012-01-27 17:57:53 -080053#define CLK_HALT_AFAB_SFAB_STATEA_REG REG(0x2FC0)
Tianyi Gou41515e22011-09-01 19:37:43 -070054#define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070055#define CLK_HALT_CFPB_STATEA_REG REG(0x2FCC)
56#define CLK_HALT_CFPB_STATEB_REG REG(0x2FD0)
57#define CLK_HALT_CFPB_STATEC_REG REG(0x2FD4)
58#define CLK_HALT_DFAB_STATE_REG REG(0x2FC8)
Tianyi Gou41515e22011-09-01 19:37:43 -070059/* 8064 name CLK_HALT_GSS_KPSS_MISC_STATE_REG */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070060#define CLK_HALT_MSS_SMPSS_MISC_STATE_REG REG(0x2FDC)
61#define CLK_HALT_SFPB_MISC_STATE_REG REG(0x2FD8)
Stephen Boyd973e4ba2011-07-12 17:06:01 -070062#define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#define CLK_TEST_REG REG(0x2FA0)
Matt Wagantall7625a4c2011-11-01 16:17:53 -070064#define GPn_MD_REG(n) REG(0x2D00+(0x20*(n)))
65#define GPn_NS_REG(n) REG(0x2D24+(0x20*(n)))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070066#define GSBIn_HCLK_CTL_REG(n) REG(0x29C0+(0x20*((n)-1)))
67#define GSBIn_QUP_APPS_MD_REG(n) REG(0x29C8+(0x20*((n)-1)))
68#define GSBIn_QUP_APPS_NS_REG(n) REG(0x29CC+(0x20*((n)-1)))
69#define GSBIn_RESET_REG(n) REG(0x29DC+(0x20*((n)-1)))
70#define GSBIn_UART_APPS_MD_REG(n) REG(0x29D0+(0x20*((n)-1)))
71#define GSBIn_UART_APPS_NS_REG(n) REG(0x29D4+(0x20*((n)-1)))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072#define PDM_CLK_NS_REG REG(0x2CC0)
Tianyi Gou41515e22011-09-01 19:37:43 -070073/* 8064 name BB_PLL_ENA_APCS_REG */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074#define BB_PLL_ENA_SC0_REG REG(0x34C0)
Tianyi Gou59608a72012-01-31 22:19:30 -080075#define BB_PLL_ENA_RPM_REG REG(0x34A0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076#define BB_PLL0_STATUS_REG REG(0x30D8)
77#define BB_PLL5_STATUS_REG REG(0x30F8)
78#define BB_PLL6_STATUS_REG REG(0x3118)
79#define BB_PLL7_STATUS_REG REG(0x3138)
80#define BB_PLL8_L_VAL_REG REG(0x3144)
81#define BB_PLL8_M_VAL_REG REG(0x3148)
82#define BB_PLL8_MODE_REG REG(0x3140)
83#define BB_PLL8_N_VAL_REG REG(0x314C)
84#define BB_PLL8_STATUS_REG REG(0x3158)
85#define BB_PLL8_CONFIG_REG REG(0x3154)
86#define BB_PLL8_TEST_CTL_REG REG(0x3150)
Stephen Boyd94625ef2011-07-12 17:06:01 -070087#define BB_MMCC_PLL2_MODE_REG REG(0x3160)
Patrick Dalyaa614562013-01-23 16:39:45 -080088#define BB_MMCC_PLL2_L_REG REG(0x3164)
89#define BB_MMCC_PLL2_M_REG REG(0x3168)
90#define BB_MMCC_PLL2_N_REG REG(0x316C)
Stephen Boyd94625ef2011-07-12 17:06:01 -070091#define BB_MMCC_PLL2_TEST_CTL_REG REG(0x3170)
Patrick Dalyaa614562013-01-23 16:39:45 -080092#define BB_MMCC_PLL2_CONFIG_REG REG(0x3174)
93#define BB_MMCC_PLL2_STATUS_REG REG(0x3178)
Tianyi Gou41515e22011-09-01 19:37:43 -070094#define BB_PLL14_MODE_REG REG(0x31C0)
95#define BB_PLL14_L_VAL_REG REG(0x31C4)
96#define BB_PLL14_M_VAL_REG REG(0x31C8)
97#define BB_PLL14_N_VAL_REG REG(0x31CC)
98#define BB_PLL14_TEST_CTL_REG REG(0x31D0)
99#define BB_PLL14_CONFIG_REG REG(0x31D4)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700100#define BB_PLL14_STATUS_REG REG(0x31D8)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700101#define PLLTEST_PAD_CFG_REG REG(0x2FA4)
102#define PMEM_ACLK_CTL_REG REG(0x25A0)
103#define RINGOSC_NS_REG REG(0x2DC0)
104#define RINGOSC_STATUS_REG REG(0x2DCC)
105#define RINGOSC_TCXO_CTL_REG REG(0x2DC4)
Stephen Boyda52d7e32011-11-10 11:59:00 -0800106#define RPM_MSG_RAM_HCLK_CTL_REG REG(0x27E0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700107#define SC0_U_CLK_BRANCH_ENA_VOTE_REG REG(0x3080)
108#define SDCn_APPS_CLK_MD_REG(n) REG(0x2828+(0x20*((n)-1)))
109#define SDCn_APPS_CLK_NS_REG(n) REG(0x282C+(0x20*((n)-1)))
110#define SDCn_HCLK_CTL_REG(n) REG(0x2820+(0x20*((n)-1)))
111#define SDCn_RESET_REG(n) REG(0x2830+(0x20*((n)-1)))
112#define SLIMBUS_XO_SRC_CLK_CTL_REG REG(0x2628)
113#define TSIF_HCLK_CTL_REG REG(0x2700)
114#define TSIF_REF_CLK_MD_REG REG(0x270C)
115#define TSIF_REF_CLK_NS_REG REG(0x2710)
116#define TSSC_CLK_CTL_REG REG(0x2CA0)
Tianyi Gou352955d2012-05-18 19:44:01 -0700117#define SATA_HCLK_CTL_REG REG(0x2C00)
Tianyi Gou41515e22011-09-01 19:37:43 -0700118#define SATA_CLK_SRC_NS_REG REG(0x2C08)
119#define SATA_RXOOB_CLK_CTL_REG REG(0x2C0C)
120#define SATA_PMALIVE_CLK_CTL_REG REG(0x2C10)
121#define SATA_PHY_REF_CLK_CTL_REG REG(0x2C14)
Sujit Reddy Thummab0d51e72012-12-31 15:37:16 +0530122#define SATA_RESET REG(0x2C1C)
Tianyi Gou352955d2012-05-18 19:44:01 -0700123#define SATA_ACLK_CTL_REG REG(0x2C20)
Tianyi Gou41515e22011-09-01 19:37:43 -0700124#define SATA_PHY_CFG_CLK_CTL_REG REG(0x2C40)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700125#define USB_FSn_HCLK_CTL_REG(n) REG(0x2960+(0x20*((n)-1)))
126#define USB_FSn_RESET_REG(n) REG(0x2974+(0x20*((n)-1)))
127#define USB_FSn_SYSTEM_CLK_CTL_REG(n) REG(0x296C+(0x20*((n)-1)))
128#define USB_FSn_XCVR_FS_CLK_MD_REG(n) REG(0x2964+(0x20*((n)-1)))
129#define USB_FSn_XCVR_FS_CLK_NS_REG(n) REG(0x2968+(0x20*((n)-1)))
130#define USB_HS1_HCLK_CTL_REG REG(0x2900)
Tianyi Gou41515e22011-09-01 19:37:43 -0700131#define USB_HS1_HCLK_FS_REG REG(0x2904)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700132#define USB_HS1_RESET_REG REG(0x2910)
133#define USB_HS1_XCVR_FS_CLK_MD_REG REG(0x2908)
134#define USB_HS1_XCVR_FS_CLK_NS_REG REG(0x290C)
Tianyi Gou41515e22011-09-01 19:37:43 -0700135#define USB_HS3_HCLK_CTL_REG REG(0x3700)
136#define USB_HS3_HCLK_FS_REG REG(0x3704)
137#define USB_HS3_RESET_REG REG(0x3710)
138#define USB_HS3_XCVR_FS_CLK_MD_REG REG(0X3708)
139#define USB_HS3_XCVR_FS_CLK_NS_REG REG(0X370C)
140#define USB_HS4_HCLK_CTL_REG REG(0x3720)
141#define USB_HS4_HCLK_FS_REG REG(0x3724)
142#define USB_HS4_RESET_REG REG(0x3730)
143#define USB_HS4_XCVR_FS_CLK_MD_REG REG(0X3728)
144#define USB_HS4_XCVR_FS_CLK_NS_REG REG(0X372C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700145#define USB_HSIC_HCLK_CTL_REG REG(0x2920)
146#define USB_HSIC_HSIC_CLK_CTL_REG REG(0x2B44)
147#define USB_HSIC_HSIC_CLK_SRC_CTL_REG REG(0x2B40)
148#define USB_HSIC_HSIO_CAL_CLK_CTL_REG REG(0x2B48)
149#define USB_HSIC_RESET_REG REG(0x2934)
150#define USB_HSIC_SYSTEM_CLK_CTL_REG REG(0x292C)
151#define USB_HSIC_XCVR_FS_CLK_MD_REG REG(0x2924)
152#define USB_HSIC_XCVR_FS_CLK_NS_REG REG(0x2928)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700153#define USB_PHY0_RESET_REG REG(0x2E20)
Tianyi Gou41515e22011-09-01 19:37:43 -0700154#define PCIE_ALT_REF_CLK_NS_REG REG(0x3860)
Tianyi Gou6613de52012-01-27 17:57:53 -0800155#define PCIE_ACLK_CTL_REG REG(0x22C0)
Tianyi Gou41515e22011-09-01 19:37:43 -0700156#define PCIE_HCLK_CTL_REG REG(0x22CC)
Tianyi Gou6613de52012-01-27 17:57:53 -0800157#define PCIE_PCLK_CTL_REG REG(0x22D0)
Tianyi Gou41515e22011-09-01 19:37:43 -0700158#define GPLL1_MODE_REG REG(0x3160)
159#define GPLL1_L_VAL_REG REG(0x3164)
160#define GPLL1_M_VAL_REG REG(0x3168)
161#define GPLL1_N_VAL_REG REG(0x316C)
162#define GPLL1_CONFIG_REG REG(0x3174)
163#define GPLL1_STATUS_REG REG(0x3178)
164#define PXO_SRC_CLK_CTL_REG REG(0x2EA0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165
166/* Multimedia clock registers. */
167#define AHB_EN_REG REG_MM(0x0008)
168#define AHB_EN2_REG REG_MM(0x0038)
Tianyi Gou41515e22011-09-01 19:37:43 -0700169#define AHB_EN3_REG REG_MM(0x0248)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700170#define AHB_NS_REG REG_MM(0x0004)
171#define AXI_NS_REG REG_MM(0x0014)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700172#define CAMCLK0_NS_REG REG_MM(0x0148)
173#define CAMCLK0_CC_REG REG_MM(0x0140)
174#define CAMCLK0_MD_REG REG_MM(0x0144)
175#define CAMCLK1_NS_REG REG_MM(0x015C)
176#define CAMCLK1_CC_REG REG_MM(0x0154)
177#define CAMCLK1_MD_REG REG_MM(0x0158)
178#define CAMCLK2_NS_REG REG_MM(0x0228)
179#define CAMCLK2_CC_REG REG_MM(0x0220)
180#define CAMCLK2_MD_REG REG_MM(0x0224)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700181#define CSI0_NS_REG REG_MM(0x0048)
182#define CSI0_CC_REG REG_MM(0x0040)
183#define CSI0_MD_REG REG_MM(0x0044)
184#define CSI1_NS_REG REG_MM(0x0010)
185#define CSI1_CC_REG REG_MM(0x0024)
186#define CSI1_MD_REG REG_MM(0x0028)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700187#define CSI2_NS_REG REG_MM(0x0234)
188#define CSI2_CC_REG REG_MM(0x022C)
189#define CSI2_MD_REG REG_MM(0x0230)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700190#define CSIPHYTIMER_CC_REG REG_MM(0x0160)
191#define CSIPHYTIMER_MD_REG REG_MM(0x0164)
192#define CSIPHYTIMER_NS_REG REG_MM(0x0168)
193#define DSI1_BYTE_NS_REG REG_MM(0x00B0)
194#define DSI1_BYTE_CC_REG REG_MM(0x0090)
195#define DSI2_BYTE_NS_REG REG_MM(0x00BC)
196#define DSI2_BYTE_CC_REG REG_MM(0x00B4)
197#define DSI1_ESC_NS_REG REG_MM(0x011C)
198#define DSI1_ESC_CC_REG REG_MM(0x00CC)
199#define DSI2_ESC_NS_REG REG_MM(0x0150)
200#define DSI2_ESC_CC_REG REG_MM(0x013C)
201#define DSI_PIXEL_CC_REG REG_MM(0x0130)
202#define DSI2_PIXEL_CC_REG REG_MM(0x0094)
Patrick Dalye6f489042012-07-11 15:29:15 -0700203#define DSI2_PIXEL_CC2_REG REG_MM(0x0264)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700204#define DBG_BUS_VEC_A_REG REG_MM(0x01C8)
205#define DBG_BUS_VEC_B_REG REG_MM(0x01CC)
206#define DBG_BUS_VEC_C_REG REG_MM(0x01D0)
207#define DBG_BUS_VEC_D_REG REG_MM(0x01D4)
208#define DBG_BUS_VEC_E_REG REG_MM(0x01D8)
209#define DBG_BUS_VEC_F_REG REG_MM(0x01DC)
210#define DBG_BUS_VEC_G_REG REG_MM(0x01E0)
211#define DBG_BUS_VEC_H_REG REG_MM(0x01E4)
212#define DBG_BUS_VEC_I_REG REG_MM(0x01E8)
Tianyi Gou41515e22011-09-01 19:37:43 -0700213#define DBG_BUS_VEC_J_REG REG_MM(0x0240)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700214#define DBG_CFG_REG_HS_REG REG_MM(0x01B4)
215#define DBG_CFG_REG_LS_REG REG_MM(0x01B8)
216#define GFX2D0_CC_REG REG_MM(0x0060)
217#define GFX2D0_MD0_REG REG_MM(0x0064)
218#define GFX2D0_MD1_REG REG_MM(0x0068)
219#define GFX2D0_NS_REG REG_MM(0x0070)
220#define GFX2D1_CC_REG REG_MM(0x0074)
221#define GFX2D1_MD0_REG REG_MM(0x0078)
222#define GFX2D1_MD1_REG REG_MM(0x006C)
223#define GFX2D1_NS_REG REG_MM(0x007C)
224#define GFX3D_CC_REG REG_MM(0x0080)
225#define GFX3D_MD0_REG REG_MM(0x0084)
226#define GFX3D_MD1_REG REG_MM(0x0088)
227#define GFX3D_NS_REG REG_MM(0x008C)
228#define IJPEG_CC_REG REG_MM(0x0098)
229#define IJPEG_MD_REG REG_MM(0x009C)
230#define IJPEG_NS_REG REG_MM(0x00A0)
231#define JPEGD_CC_REG REG_MM(0x00A4)
232#define JPEGD_NS_REG REG_MM(0x00AC)
Tianyi Gou41515e22011-09-01 19:37:43 -0700233#define VCAP_CC_REG REG_MM(0x0178)
234#define VCAP_NS_REG REG_MM(0x021C)
235#define VCAP_MD0_REG REG_MM(0x01EC)
236#define VCAP_MD1_REG REG_MM(0x0218)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700237#define MAXI_EN_REG REG_MM(0x0018)
238#define MAXI_EN2_REG REG_MM(0x0020)
239#define MAXI_EN3_REG REG_MM(0x002C)
240#define MAXI_EN4_REG REG_MM(0x0114)
Tianyi Gou41515e22011-09-01 19:37:43 -0700241#define MAXI_EN5_REG REG_MM(0x0244)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242#define MDP_CC_REG REG_MM(0x00C0)
243#define MDP_LUT_CC_REG REG_MM(0x016C)
244#define MDP_MD0_REG REG_MM(0x00C4)
245#define MDP_MD1_REG REG_MM(0x00C8)
246#define MDP_NS_REG REG_MM(0x00D0)
247#define MISC_CC_REG REG_MM(0x0058)
248#define MISC_CC2_REG REG_MM(0x005C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700249#define MISC_CC3_REG REG_MM(0x0238)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700250#define MM_PLL1_MODE_REG REG_MM(0x031C)
Tianyi Gou41515e22011-09-01 19:37:43 -0700251#define MM_PLL1_L_VAL_REG REG_MM(0x0320)
252#define MM_PLL1_M_VAL_REG REG_MM(0x0324)
253#define MM_PLL1_N_VAL_REG REG_MM(0x0328)
254#define MM_PLL1_CONFIG_REG REG_MM(0x032C)
255#define MM_PLL1_TEST_CTL_REG REG_MM(0x0330)
256#define MM_PLL1_STATUS_REG REG_MM(0x0334)
257#define MM_PLL3_MODE_REG REG_MM(0x0338)
Tianyi Gou621f8742011-09-01 21:45:01 -0700258#define MM_PLL3_L_VAL_REG REG_MM(0x033C)
259#define MM_PLL3_M_VAL_REG REG_MM(0x0340)
260#define MM_PLL3_N_VAL_REG REG_MM(0x0344)
261#define MM_PLL3_CONFIG_REG REG_MM(0x0348)
262#define MM_PLL3_TEST_CTL_REG REG_MM(0x034C)
263#define MM_PLL3_STATUS_REG REG_MM(0x0350)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700264#define ROT_CC_REG REG_MM(0x00E0)
265#define ROT_NS_REG REG_MM(0x00E8)
266#define SAXI_EN_REG REG_MM(0x0030)
267#define SW_RESET_AHB_REG REG_MM(0x020C)
268#define SW_RESET_AHB2_REG REG_MM(0x0200)
269#define SW_RESET_ALL_REG REG_MM(0x0204)
270#define SW_RESET_AXI_REG REG_MM(0x0208)
271#define SW_RESET_CORE_REG REG_MM(0x0210)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700272#define SW_RESET_CORE2_REG REG_MM(0x0214)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700273#define TV_CC_REG REG_MM(0x00EC)
274#define TV_CC2_REG REG_MM(0x0124)
275#define TV_MD_REG REG_MM(0x00F0)
276#define TV_NS_REG REG_MM(0x00F4)
277#define VCODEC_CC_REG REG_MM(0x00F8)
278#define VCODEC_MD0_REG REG_MM(0x00FC)
279#define VCODEC_MD1_REG REG_MM(0x0128)
280#define VCODEC_NS_REG REG_MM(0x0100)
281#define VFE_CC_REG REG_MM(0x0104)
282#define VFE_MD_REG REG_MM(0x0108)
283#define VFE_NS_REG REG_MM(0x010C)
Stephen Boyd94625ef2011-07-12 17:06:01 -0700284#define VFE_CC2_REG REG_MM(0x023C)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700285#define VPE_CC_REG REG_MM(0x0110)
286#define VPE_NS_REG REG_MM(0x0118)
287
288/* Low-power Audio clock registers. */
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700289#define LCC_CLK_HS_DEBUG_CFG_REG REG_LPA(0x00A4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700290#define LCC_CLK_LS_DEBUG_CFG_REG REG_LPA(0x00A8)
291#define LCC_CODEC_I2S_MIC_MD_REG REG_LPA(0x0064)
292#define LCC_CODEC_I2S_MIC_NS_REG REG_LPA(0x0060)
293#define LCC_CODEC_I2S_MIC_STATUS_REG REG_LPA(0x0068)
294#define LCC_CODEC_I2S_SPKR_MD_REG REG_LPA(0x0070)
295#define LCC_CODEC_I2S_SPKR_NS_REG REG_LPA(0x006C)
296#define LCC_CODEC_I2S_SPKR_STATUS_REG REG_LPA(0x0074)
297#define LCC_MI2S_MD_REG REG_LPA(0x004C)
298#define LCC_MI2S_NS_REG REG_LPA(0x0048)
299#define LCC_MI2S_STATUS_REG REG_LPA(0x0050)
300#define LCC_PCM_MD_REG REG_LPA(0x0058)
301#define LCC_PCM_NS_REG REG_LPA(0x0054)
302#define LCC_PCM_STATUS_REG REG_LPA(0x005C)
Tianyi Gouc29c3242011-10-12 21:02:15 -0700303#define LCC_PLL0_MODE_REG REG_LPA(0x0000)
304#define LCC_PLL0_L_VAL_REG REG_LPA(0x0004)
305#define LCC_PLL0_M_VAL_REG REG_LPA(0x0008)
306#define LCC_PLL0_N_VAL_REG REG_LPA(0x000C)
307#define LCC_PLL0_CONFIG_REG REG_LPA(0x0014)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700308#define LCC_PLL0_STATUS_REG REG_LPA(0x0018)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309#define LCC_SPARE_I2S_MIC_MD_REG REG_LPA(0x007C)
310#define LCC_SPARE_I2S_MIC_NS_REG REG_LPA(0x0078)
311#define LCC_SPARE_I2S_MIC_STATUS_REG REG_LPA(0x0080)
312#define LCC_SPARE_I2S_SPKR_MD_REG REG_LPA(0x0088)
313#define LCC_SPARE_I2S_SPKR_NS_REG REG_LPA(0x0084)
314#define LCC_SPARE_I2S_SPKR_STATUS_REG REG_LPA(0x008C)
315#define LCC_SLIMBUS_NS_REG REG_LPA(0x00CC)
316#define LCC_SLIMBUS_MD_REG REG_LPA(0x00D0)
317#define LCC_SLIMBUS_STATUS_REG REG_LPA(0x00D4)
318#define LCC_AHBEX_BRANCH_CTL_REG REG_LPA(0x00E4)
Tianyi Gouc29c3242011-10-12 21:02:15 -0700319#define LCC_PRI_PLL_CLK_CTL_REG REG_LPA(0x00C4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320
Matt Wagantall8b38f942011-08-02 18:23:18 -0700321#define GCC_APCS_CLK_DIAG REG_GCC(0x001C)
322
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323/* MUX source input identifiers. */
324#define pxo_to_bb_mux 0
Matt Wagantall7625a4c2011-11-01 16:17:53 -0700325#define cxo_to_bb_mux 5
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700326#define pll0_to_bb_mux 2
327#define pll8_to_bb_mux 3
328#define pll6_to_bb_mux 4
329#define gnd_to_bb_mux 5
Stephen Boyd94625ef2011-07-12 17:06:01 -0700330#define pll3_to_bb_mux 6
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331#define pxo_to_mm_mux 0
332#define pll1_to_mm_mux 1
Tianyi Gou41515e22011-09-01 19:37:43 -0700333#define pll2_to_mm_mux 1 /* or MMCC_PLL1 */
334#define pll8_to_mm_mux 2 /* or GCC_PERF */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700335#define pll0_to_mm_mux 3
Tianyi Gou41515e22011-09-01 19:37:43 -0700336#define pll15_to_mm_mux 3 /* or MM_PLL3 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337#define gnd_to_mm_mux 4
Stephen Boyd7a776cd2011-10-20 12:46:04 -0700338#define pll3_to_mm_mux 3 /* or MMCC_PLL2 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700339#define hdmi_pll_to_mm_mux 3
340#define cxo_to_xo_mux 0
341#define pxo_to_xo_mux 1
342#define gnd_to_xo_mux 3
343#define pxo_to_lpa_mux 0
344#define cxo_to_lpa_mux 1
345#define pll4_to_lpa_mux 2
346#define gnd_to_lpa_mux 6
Tianyi Gou41515e22011-09-01 19:37:43 -0700347#define pxo_to_pcie_mux 0
348#define pll3_to_pcie_mux 1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700349
350/* Test Vector Macros */
351#define TEST_TYPE_PER_LS 1
352#define TEST_TYPE_PER_HS 2
353#define TEST_TYPE_MM_LS 3
354#define TEST_TYPE_MM_HS 4
355#define TEST_TYPE_LPA 5
Matt Wagantall8b38f942011-08-02 18:23:18 -0700356#define TEST_TYPE_CPUL2 6
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700357#define TEST_TYPE_LPA_HS 7
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700358#define TEST_TYPE_SHIFT 24
359#define TEST_CLK_SEL_MASK BM(23, 0)
360#define TEST_VECTOR(s, t) (((t) << TEST_TYPE_SHIFT) | BVAL(23, 0, (s)))
361#define TEST_PER_LS(s) TEST_VECTOR((s), TEST_TYPE_PER_LS)
362#define TEST_PER_HS(s) TEST_VECTOR((s), TEST_TYPE_PER_HS)
363#define TEST_MM_LS(s) TEST_VECTOR((s), TEST_TYPE_MM_LS)
364#define TEST_MM_HS(s) TEST_VECTOR((s), TEST_TYPE_MM_HS)
365#define TEST_LPA(s) TEST_VECTOR((s), TEST_TYPE_LPA)
Stephen Boyd3939c8d2011-08-29 17:36:22 -0700366#define TEST_LPA_HS(s) TEST_VECTOR((s), TEST_TYPE_LPA_HS)
Matt Wagantall8b38f942011-08-02 18:23:18 -0700367#define TEST_CPUL2(s) TEST_VECTOR((s), TEST_TYPE_CPUL2)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700368
369#define MN_MODE_DUAL_EDGE 0x2
370
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700371struct pll_rate {
372 const uint32_t l_val;
373 const uint32_t m_val;
374 const uint32_t n_val;
375 const uint32_t vco;
376 const uint32_t post_div;
377 const uint32_t i_bits;
378};
379#define PLL_RATE(l, m, n, v, d, i) { l, m, n, v, (d>>1), i }
380
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700381enum vdd_dig_levels {
382 VDD_DIG_NONE,
383 VDD_DIG_LOW,
384 VDD_DIG_NOMINAL,
Saravana Kannan55e959d2012-10-15 22:16:04 -0700385 VDD_DIG_HIGH,
386 VDD_DIG_NUM
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700387};
388
Saravana Kannan298ec392012-02-08 19:21:47 -0800389static int set_vdd_dig_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700390{
391 static const int vdd_uv[] = {
392 [VDD_DIG_NONE] = 0,
393 [VDD_DIG_LOW] = 945000,
394 [VDD_DIG_NOMINAL] = 1050000,
395 [VDD_DIG_HIGH] = 1150000
396 };
Saravana Kannan298ec392012-02-08 19:21:47 -0800397 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S3, RPM_VREG_VOTER3,
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700398 vdd_uv[level], 1150000, 1);
399}
400
Saravana Kannan55e959d2012-10-15 22:16:04 -0700401static DEFINE_VDD_CLASS(vdd_dig, set_vdd_dig_8960, VDD_DIG_NUM);
Saravana Kannan298ec392012-02-08 19:21:47 -0800402
Patrick Daly1a3859f2012-08-27 16:10:26 -0700403static int rpm_vreg_dig_8930 = RPM_VREG_ID_PM8038_VDD_DIG_CORNER;
Saravana Kannan298ec392012-02-08 19:21:47 -0800404static int set_vdd_dig_8930(struct clk_vdd_class *vdd_class, int level)
405{
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800406 static const int vdd_corner[] = {
407 [VDD_DIG_NONE] = RPM_VREG_CORNER_NONE,
408 [VDD_DIG_LOW] = RPM_VREG_CORNER_LOW,
409 [VDD_DIG_NOMINAL] = RPM_VREG_CORNER_NOMINAL,
410 [VDD_DIG_HIGH] = RPM_VREG_CORNER_HIGH,
Saravana Kannan298ec392012-02-08 19:21:47 -0800411 };
Patrick Daly1a3859f2012-08-27 16:10:26 -0700412 return rpm_vreg_set_voltage(rpm_vreg_dig_8930,
Saravana Kannanebaa3ac2012-02-08 19:55:44 -0800413 RPM_VREG_VOTER3,
414 vdd_corner[level],
415 RPM_VREG_CORNER_HIGH, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800416}
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700417
418#define VDD_DIG_FMAX_MAP1(l1, f1) \
Saravana Kannan55e959d2012-10-15 22:16:04 -0700419 .vdd_class = &vdd_dig, \
420 .fmax = (unsigned long[VDD_DIG_NUM]) { \
421 [VDD_DIG_##l1] = (f1), \
422 }, \
423 .num_fmax = VDD_DIG_NUM
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700424#define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \
Saravana Kannan55e959d2012-10-15 22:16:04 -0700425 .vdd_class = &vdd_dig, \
426 .fmax = (unsigned long[VDD_DIG_NUM]) { \
427 [VDD_DIG_##l1] = (f1), \
428 [VDD_DIG_##l2] = (f2), \
429 }, \
430 .num_fmax = VDD_DIG_NUM
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700431#define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \
Saravana Kannan55e959d2012-10-15 22:16:04 -0700432 .vdd_class = &vdd_dig, \
433 .fmax = (unsigned long[VDD_DIG_NUM]) { \
434 [VDD_DIG_##l1] = (f1), \
435 [VDD_DIG_##l2] = (f2), \
436 [VDD_DIG_##l3] = (f3), \
437 }, \
438 .num_fmax = VDD_DIG_NUM
Matt Wagantalle18bbc82011-10-06 10:07:28 -0700439
Matt Wagantall82feaa12012-07-09 10:54:49 -0700440enum vdd_sr2_hdmi_pll_levels {
441 VDD_SR2_HDMI_PLL_OFF,
Saravana Kannan55e959d2012-10-15 22:16:04 -0700442 VDD_SR2_HDMI_PLL_ON,
443 VDD_SR2_HDMI_PLL_NUM
Matt Wagantallc57577d2011-10-06 17:06:53 -0700444};
445
Matt Wagantall82feaa12012-07-09 10:54:49 -0700446static int set_vdd_sr2_hdmi_pll_8960(struct clk_vdd_class *vdd_class, int level)
Matt Wagantallc57577d2011-10-06 17:06:53 -0700447{
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800448 int rc = 0;
Saravana Kannan298ec392012-02-08 19:21:47 -0800449
Matt Wagantall82feaa12012-07-09 10:54:49 -0700450 if (level == VDD_SR2_HDMI_PLL_OFF) {
Saravana Kannan298ec392012-02-08 19:21:47 -0800451 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
452 RPM_VREG_VOTER3, 0, 0, 1);
453 if (rc)
454 return rc;
455 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
456 RPM_VREG_VOTER3, 0, 0, 1);
457 if (rc)
458 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
459 RPM_VREG_VOTER3, 1800000, 1800000, 1);
Tianyi Goue1faaf22012-01-24 16:07:19 -0800460 } else {
Saravana Kannan298ec392012-02-08 19:21:47 -0800461 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
David Collins9a81d6c2012-03-29 15:11:33 -0700462 RPM_VREG_VOTER3, 2050000, 2100000, 1);
Saravana Kannan298ec392012-02-08 19:21:47 -0800463 if (rc)
464 return rc;
465 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_L23,
466 RPM_VREG_VOTER3, 1800000, 1800000, 1);
467 if (rc)
468 rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S8,
Tianyi Goubf3d0b12012-01-23 14:37:28 -0800469 RPM_VREG_VOTER3, 0, 0, 1);
Matt Wagantallc57577d2011-10-06 17:06:53 -0700470 }
471
472 return rc;
473}
474
Saravana Kannan55e959d2012-10-15 22:16:04 -0700475static DEFINE_VDD_CLASS(vdd_sr2_hdmi_pll, set_vdd_sr2_hdmi_pll_8960,
476 VDD_SR2_HDMI_PLL_NUM);
Saravana Kannan298ec392012-02-08 19:21:47 -0800477
478static int sr2_lreg_uv[] = {
Matt Wagantall82feaa12012-07-09 10:54:49 -0700479 [VDD_SR2_HDMI_PLL_OFF] = 0,
480 [VDD_SR2_HDMI_PLL_ON] = 1800000,
Saravana Kannan298ec392012-02-08 19:21:47 -0800481};
482
Matt Wagantall82feaa12012-07-09 10:54:49 -0700483static int set_vdd_sr2_hdmi_pll_8064(struct clk_vdd_class *vdd_class, int level)
Saravana Kannan298ec392012-02-08 19:21:47 -0800484{
485 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_LVS7, RPM_VREG_VOTER3,
486 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
487}
488
Patrick Daly1a3859f2012-08-27 16:10:26 -0700489static int set_vdd_sr2_hdmi_pll_8930_pm8917(struct clk_vdd_class *vdd_class,
490 int level)
491{
492 int rc = 0;
493
494 if (level == VDD_SR2_HDMI_PLL_OFF) {
495 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
496 RPM_VREG_VOTER3, 0, 0, 1);
497 if (rc)
498 return rc;
499 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
500 RPM_VREG_VOTER3, 0, 0, 1);
501 if (rc)
502 rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
503 RPM_VREG_VOTER3, 1800000, 1800000, 1);
504 } else {
505 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
506 RPM_VREG_VOTER3, 2050000, 2100000, 1);
507 if (rc)
508 return rc;
509 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_L23,
510 RPM_VREG_VOTER3, 1800000, 1800000, 1);
511 if (rc)
512 rpm_vreg_set_voltage(RPM_VREG_ID_PM8917_S8,
513 RPM_VREG_VOTER3, 0, 0, 1);
514 }
515
516 return rc;
517}
518
Matt Wagantall82feaa12012-07-09 10:54:49 -0700519static int set_vdd_sr2_hdmi_pll_8930(struct clk_vdd_class *vdd_class, int level)
Saravana Kannan298ec392012-02-08 19:21:47 -0800520{
521 return rpm_vreg_set_voltage(RPM_VREG_ID_PM8038_L23, RPM_VREG_VOTER3,
522 sr2_lreg_uv[level], sr2_lreg_uv[level], 1);
523}
Matt Wagantallc57577d2011-10-06 17:06:53 -0700524
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700525/*
526 * Clock Descriptions
527 */
528
Stephen Boyd72a80352012-01-26 15:57:38 -0800529DEFINE_CLK_RPM_BRANCH(pxo_clk, pxo_a_clk, PXO, 27000000);
530DEFINE_CLK_RPM_BRANCH(cxo_clk, cxo_a_clk, CXO, 19200000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700531
532static struct pll_clk pll2_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700533 .mode_reg = MM_PLL1_MODE_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700534 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -0700535 .parent = &pxo_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700536 .dbg_name = "pll2_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800537 .rate = 800000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800538 .ops = &clk_ops_local_pll,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700539 CLK_INIT(pll2_clk.c),
540 },
541};
542
Stephen Boyd94625ef2011-07-12 17:06:01 -0700543static struct pll_clk pll3_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700544 .mode_reg = BB_MMCC_PLL2_MODE_REG,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700545 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -0700546 .parent = &pxo_clk.c,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700547 .dbg_name = "pll3_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800548 .rate = 1200000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800549 .ops = &clk_ops_local_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -0700550 .vdd_class = &vdd_sr2_hdmi_pll,
Saravana Kannan55e959d2012-10-15 22:16:04 -0700551 .fmax = (unsigned long[VDD_SR2_HDMI_PLL_NUM]) {
552 [VDD_SR2_HDMI_PLL_ON] = ULONG_MAX
553 },
554 .num_fmax = VDD_SR2_HDMI_PLL_NUM,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700555 CLK_INIT(pll3_clk.c),
556 },
557};
558
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700559static struct pll_vote_clk pll4_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700560 .en_reg = BB_PLL_ENA_SC0_REG,
561 .en_mask = BIT(4),
562 .status_reg = LCC_PLL0_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800563 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700564 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -0700565 .parent = &pxo_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700566 .dbg_name = "pll4_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800567 .rate = 393216000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568 .ops = &clk_ops_pll_vote,
569 CLK_INIT(pll4_clk.c),
570 },
571};
572
573static struct pll_vote_clk pll8_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700574 .en_reg = BB_PLL_ENA_SC0_REG,
575 .en_mask = BIT(8),
576 .status_reg = BB_PLL8_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800577 .status_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700578 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -0700579 .parent = &pxo_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700580 .dbg_name = "pll8_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800581 .rate = 384000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582 .ops = &clk_ops_pll_vote,
583 CLK_INIT(pll8_clk.c),
584 },
585};
586
Stephen Boyd94625ef2011-07-12 17:06:01 -0700587static struct pll_vote_clk pll14_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -0700588 .en_reg = BB_PLL_ENA_SC0_REG,
589 .en_mask = BIT(14),
590 .status_reg = BB_PLL14_STATUS_REG,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800591 .status_mask = BIT(16),
Stephen Boyd94625ef2011-07-12 17:06:01 -0700592 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -0700593 .parent = &pxo_clk.c,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700594 .dbg_name = "pll14_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800595 .rate = 480000000,
Stephen Boyd94625ef2011-07-12 17:06:01 -0700596 .ops = &clk_ops_pll_vote,
597 CLK_INIT(pll14_clk.c),
598 },
599};
600
Tianyi Gou41515e22011-09-01 19:37:43 -0700601static struct pll_clk pll15_clk = {
Tianyi Gou41515e22011-09-01 19:37:43 -0700602 .mode_reg = MM_PLL3_MODE_REG,
Tianyi Gou41515e22011-09-01 19:37:43 -0700603 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -0700604 .parent = &pxo_clk.c,
Tianyi Gou41515e22011-09-01 19:37:43 -0700605 .dbg_name = "pll15_clk",
Tianyi Gou7949ecb2012-02-14 14:25:32 -0800606 .rate = 975000000,
Vikram Mulukutla681d8682012-03-09 23:56:20 -0800607 .ops = &clk_ops_local_pll,
Tianyi Gou41515e22011-09-01 19:37:43 -0700608 CLK_INIT(pll15_clk.c),
609 },
610};
611
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700612/* AXI Interfaces */
613static struct branch_clk gmem_axi_clk = {
614 .b = {
615 .ctl_reg = MAXI_EN_REG,
616 .en_mask = BIT(24),
617 .halt_reg = DBG_BUS_VEC_E_REG,
618 .halt_bit = 6,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800619 .retain_reg = MAXI_EN2_REG,
620 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700621 },
622 .c = {
623 .dbg_name = "gmem_axi_clk",
624 .ops = &clk_ops_branch,
625 CLK_INIT(gmem_axi_clk.c),
626 },
627};
628
629static struct branch_clk ijpeg_axi_clk = {
630 .b = {
631 .ctl_reg = MAXI_EN_REG,
632 .en_mask = BIT(21),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800633 .hwcg_reg = MAXI_EN_REG,
634 .hwcg_mask = BIT(11),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700635 .reset_reg = SW_RESET_AXI_REG,
636 .reset_mask = BIT(14),
637 .halt_reg = DBG_BUS_VEC_E_REG,
638 .halt_bit = 4,
639 },
640 .c = {
641 .dbg_name = "ijpeg_axi_clk",
642 .ops = &clk_ops_branch,
643 CLK_INIT(ijpeg_axi_clk.c),
644 },
645};
646
647static struct branch_clk imem_axi_clk = {
648 .b = {
649 .ctl_reg = MAXI_EN_REG,
650 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800651 .hwcg_reg = MAXI_EN_REG,
652 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700653 .reset_reg = SW_RESET_CORE_REG,
654 .reset_mask = BIT(10),
655 .halt_reg = DBG_BUS_VEC_E_REG,
656 .halt_bit = 7,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800657 .retain_reg = MAXI_EN2_REG,
658 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700659 },
660 .c = {
661 .dbg_name = "imem_axi_clk",
662 .ops = &clk_ops_branch,
663 CLK_INIT(imem_axi_clk.c),
664 },
665};
666
667static struct branch_clk jpegd_axi_clk = {
668 .b = {
669 .ctl_reg = MAXI_EN_REG,
670 .en_mask = BIT(25),
671 .halt_reg = DBG_BUS_VEC_E_REG,
672 .halt_bit = 5,
673 },
674 .c = {
675 .dbg_name = "jpegd_axi_clk",
676 .ops = &clk_ops_branch,
677 CLK_INIT(jpegd_axi_clk.c),
678 },
679};
680
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700681static struct branch_clk vcodec_axi_b_clk = {
682 .b = {
683 .ctl_reg = MAXI_EN4_REG,
684 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800685 .hwcg_reg = MAXI_EN4_REG,
686 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700687 .halt_reg = DBG_BUS_VEC_I_REG,
688 .halt_bit = 25,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800689 .retain_reg = MAXI_EN4_REG,
690 .retain_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700691 },
692 .c = {
693 .dbg_name = "vcodec_axi_b_clk",
694 .ops = &clk_ops_branch,
695 CLK_INIT(vcodec_axi_b_clk.c),
696 },
697};
698
Matt Wagantall91f42702011-07-14 12:01:15 -0700699static struct branch_clk vcodec_axi_a_clk = {
700 .b = {
701 .ctl_reg = MAXI_EN4_REG,
702 .en_mask = BIT(25),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800703 .hwcg_reg = MAXI_EN4_REG,
704 .hwcg_mask = BIT(24),
Matt Wagantall91f42702011-07-14 12:01:15 -0700705 .halt_reg = DBG_BUS_VEC_I_REG,
706 .halt_bit = 26,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800707 .retain_reg = MAXI_EN4_REG,
708 .retain_mask = BIT(10),
Matt Wagantall91f42702011-07-14 12:01:15 -0700709 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700710 .c = {
711 .dbg_name = "vcodec_axi_a_clk",
712 .ops = &clk_ops_branch,
713 CLK_INIT(vcodec_axi_a_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700714 .depends = &vcodec_axi_b_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700715 },
716};
717
718static struct branch_clk vcodec_axi_clk = {
719 .b = {
720 .ctl_reg = MAXI_EN_REG,
721 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800722 .hwcg_reg = MAXI_EN_REG,
723 .hwcg_mask = BIT(13),
Matt Wagantall91f42702011-07-14 12:01:15 -0700724 .reset_reg = SW_RESET_AXI_REG,
Gopikrishnaiah Anandan83b6e852012-01-05 17:47:02 -0800725 .reset_mask = BIT(4)|BIT(5)|BIT(7),
Matt Wagantall91f42702011-07-14 12:01:15 -0700726 .halt_reg = DBG_BUS_VEC_E_REG,
727 .halt_bit = 3,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800728 .retain_reg = MAXI_EN2_REG,
729 .retain_mask = BIT(28),
Matt Wagantall91f42702011-07-14 12:01:15 -0700730 },
Matt Wagantall91f42702011-07-14 12:01:15 -0700731 .c = {
732 .dbg_name = "vcodec_axi_clk",
733 .ops = &clk_ops_branch,
734 CLK_INIT(vcodec_axi_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -0700735 .depends = &vcodec_axi_a_clk.c,
Matt Wagantall91f42702011-07-14 12:01:15 -0700736 },
737};
738
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700739static struct branch_clk vfe_axi_clk = {
740 .b = {
741 .ctl_reg = MAXI_EN_REG,
742 .en_mask = BIT(18),
743 .reset_reg = SW_RESET_AXI_REG,
744 .reset_mask = BIT(9),
745 .halt_reg = DBG_BUS_VEC_E_REG,
746 .halt_bit = 0,
747 },
748 .c = {
749 .dbg_name = "vfe_axi_clk",
750 .ops = &clk_ops_branch,
751 CLK_INIT(vfe_axi_clk.c),
752 },
753};
754
755static struct branch_clk mdp_axi_clk = {
756 .b = {
757 .ctl_reg = MAXI_EN_REG,
758 .en_mask = BIT(23),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800759 .hwcg_reg = MAXI_EN_REG,
760 .hwcg_mask = BIT(16),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700761 .reset_reg = SW_RESET_AXI_REG,
762 .reset_mask = BIT(13),
763 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700764 .halt_bit = 8,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800765 .retain_reg = MAXI_EN_REG,
766 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700767 },
768 .c = {
769 .dbg_name = "mdp_axi_clk",
770 .ops = &clk_ops_branch,
771 CLK_INIT(mdp_axi_clk.c),
772 },
773};
774
775static struct branch_clk rot_axi_clk = {
776 .b = {
777 .ctl_reg = MAXI_EN2_REG,
778 .en_mask = BIT(24),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800779 .hwcg_reg = MAXI_EN2_REG,
780 .hwcg_mask = BIT(25),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700781 .reset_reg = SW_RESET_AXI_REG,
782 .reset_mask = BIT(6),
783 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700784 .halt_bit = 2,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800785 .retain_reg = MAXI_EN3_REG,
786 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700787 },
788 .c = {
789 .dbg_name = "rot_axi_clk",
790 .ops = &clk_ops_branch,
791 CLK_INIT(rot_axi_clk.c),
792 },
793};
794
795static struct branch_clk vpe_axi_clk = {
796 .b = {
797 .ctl_reg = MAXI_EN2_REG,
798 .en_mask = BIT(26),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800799 .hwcg_reg = MAXI_EN2_REG,
800 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700801 .reset_reg = SW_RESET_AXI_REG,
802 .reset_mask = BIT(15),
803 .halt_reg = DBG_BUS_VEC_E_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700804 .halt_bit = 1,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -0800805 .retain_reg = MAXI_EN3_REG,
806 .retain_mask = BIT(21),
807
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700808 },
809 .c = {
810 .dbg_name = "vpe_axi_clk",
811 .ops = &clk_ops_branch,
812 CLK_INIT(vpe_axi_clk.c),
813 },
814};
815
Tianyi Gou41515e22011-09-01 19:37:43 -0700816static struct branch_clk vcap_axi_clk = {
817 .b = {
818 .ctl_reg = MAXI_EN5_REG,
819 .en_mask = BIT(12),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700820 .hwcg_reg = MAXI_EN5_REG,
821 .hwcg_mask = BIT(11),
Tianyi Gou41515e22011-09-01 19:37:43 -0700822 .reset_reg = SW_RESET_AXI_REG,
823 .reset_mask = BIT(16),
824 .halt_reg = DBG_BUS_VEC_J_REG,
825 .halt_bit = 20,
826 },
827 .c = {
828 .dbg_name = "vcap_axi_clk",
829 .ops = &clk_ops_branch,
830 CLK_INIT(vcap_axi_clk.c),
831 },
832};
833
Tianyi Goue3d4f542012-03-15 17:06:45 -0700834/* gfx3d_axi_clk is set as a dependency of gmem_axi_clk at runtime */
Patrick Dalye6f489042012-07-11 15:29:15 -0700835static struct branch_clk gfx3d_axi_clk = {
Tianyi Gou621f8742011-09-01 21:45:01 -0700836 .b = {
837 .ctl_reg = MAXI_EN5_REG,
838 .en_mask = BIT(25),
Tianyi Gouf3095ea2012-05-22 14:16:06 -0700839 .hwcg_reg = MAXI_EN5_REG,
840 .hwcg_mask = BIT(24),
Tianyi Gou621f8742011-09-01 21:45:01 -0700841 .reset_reg = SW_RESET_AXI_REG,
842 .reset_mask = BIT(17),
843 .halt_reg = DBG_BUS_VEC_J_REG,
844 .halt_bit = 30,
845 },
846 .c = {
847 .dbg_name = "gfx3d_axi_clk",
848 .ops = &clk_ops_branch,
Patrick Dalye6f489042012-07-11 15:29:15 -0700849 CLK_INIT(gfx3d_axi_clk.c),
Tianyi Goue3d4f542012-03-15 17:06:45 -0700850 },
851};
852
853static struct branch_clk gfx3d_axi_clk_8930 = {
854 .b = {
855 .ctl_reg = MAXI_EN5_REG,
856 .en_mask = BIT(12),
857 .reset_reg = SW_RESET_AXI_REG,
858 .reset_mask = BIT(16),
859 .halt_reg = DBG_BUS_VEC_J_REG,
860 .halt_bit = 12,
861 },
862 .c = {
863 .dbg_name = "gfx3d_axi_clk",
864 .ops = &clk_ops_branch,
865 CLK_INIT(gfx3d_axi_clk_8930.c),
Tianyi Gou621f8742011-09-01 21:45:01 -0700866 },
867};
868
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700869/* AHB Interfaces */
870static struct branch_clk amp_p_clk = {
871 .b = {
872 .ctl_reg = AHB_EN_REG,
873 .en_mask = BIT(24),
Matt Wagantalld40857a2012-04-10 19:15:43 -0700874 .reset_reg = SW_RESET_CORE_REG,
875 .reset_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700876 .halt_reg = DBG_BUS_VEC_F_REG,
877 .halt_bit = 18,
878 },
879 .c = {
880 .dbg_name = "amp_p_clk",
881 .ops = &clk_ops_branch,
882 CLK_INIT(amp_p_clk.c),
883 },
884};
885
Matt Wagantallc23eee92011-08-16 23:06:52 -0700886static struct branch_clk csi_p_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700887 .b = {
888 .ctl_reg = AHB_EN_REG,
889 .en_mask = BIT(7),
890 .reset_reg = SW_RESET_AHB_REG,
891 .reset_mask = BIT(17),
892 .halt_reg = DBG_BUS_VEC_F_REG,
893 .halt_bit = 16,
894 },
895 .c = {
Matt Wagantallc23eee92011-08-16 23:06:52 -0700896 .dbg_name = "csi_p_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700897 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -0700898 CLK_INIT(csi_p_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700899 },
900};
901
902static struct branch_clk dsi1_m_p_clk = {
903 .b = {
904 .ctl_reg = AHB_EN_REG,
905 .en_mask = BIT(9),
906 .reset_reg = SW_RESET_AHB_REG,
907 .reset_mask = BIT(6),
908 .halt_reg = DBG_BUS_VEC_F_REG,
909 .halt_bit = 19,
910 },
911 .c = {
912 .dbg_name = "dsi1_m_p_clk",
913 .ops = &clk_ops_branch,
914 CLK_INIT(dsi1_m_p_clk.c),
915 },
916};
917
918static struct branch_clk dsi1_s_p_clk = {
919 .b = {
920 .ctl_reg = AHB_EN_REG,
921 .en_mask = BIT(18),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800922 .hwcg_reg = AHB_EN2_REG,
923 .hwcg_mask = BIT(20),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700924 .reset_reg = SW_RESET_AHB_REG,
925 .reset_mask = BIT(5),
926 .halt_reg = DBG_BUS_VEC_F_REG,
927 .halt_bit = 21,
928 },
929 .c = {
930 .dbg_name = "dsi1_s_p_clk",
931 .ops = &clk_ops_branch,
932 CLK_INIT(dsi1_s_p_clk.c),
933 },
934};
935
936static struct branch_clk dsi2_m_p_clk = {
937 .b = {
938 .ctl_reg = AHB_EN_REG,
939 .en_mask = BIT(17),
940 .reset_reg = SW_RESET_AHB2_REG,
941 .reset_mask = BIT(1),
942 .halt_reg = DBG_BUS_VEC_E_REG,
943 .halt_bit = 18,
944 },
945 .c = {
946 .dbg_name = "dsi2_m_p_clk",
947 .ops = &clk_ops_branch,
948 CLK_INIT(dsi2_m_p_clk.c),
949 },
950};
951
952static struct branch_clk dsi2_s_p_clk = {
953 .b = {
954 .ctl_reg = AHB_EN_REG,
955 .en_mask = BIT(22),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800956 .hwcg_reg = AHB_EN2_REG,
957 .hwcg_mask = BIT(15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700958 .reset_reg = SW_RESET_AHB2_REG,
959 .reset_mask = BIT(0),
960 .halt_reg = DBG_BUS_VEC_F_REG,
961 .halt_bit = 20,
962 },
963 .c = {
964 .dbg_name = "dsi2_s_p_clk",
965 .ops = &clk_ops_branch,
966 CLK_INIT(dsi2_s_p_clk.c),
967 },
968};
969
970static struct branch_clk gfx2d0_p_clk = {
971 .b = {
972 .ctl_reg = AHB_EN_REG,
973 .en_mask = BIT(19),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800974 .hwcg_reg = AHB_EN2_REG,
975 .hwcg_mask = BIT(28),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700976 .reset_reg = SW_RESET_AHB_REG,
977 .reset_mask = BIT(12),
978 .halt_reg = DBG_BUS_VEC_F_REG,
979 .halt_bit = 2,
980 },
981 .c = {
982 .dbg_name = "gfx2d0_p_clk",
983 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -0700984 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700985 CLK_INIT(gfx2d0_p_clk.c),
986 },
987};
988
989static struct branch_clk gfx2d1_p_clk = {
990 .b = {
991 .ctl_reg = AHB_EN_REG,
992 .en_mask = BIT(2),
Stephen Boyda52d7e32011-11-10 11:59:00 -0800993 .hwcg_reg = AHB_EN2_REG,
994 .hwcg_mask = BIT(29),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700995 .reset_reg = SW_RESET_AHB_REG,
996 .reset_mask = BIT(11),
997 .halt_reg = DBG_BUS_VEC_F_REG,
998 .halt_bit = 3,
999 },
1000 .c = {
1001 .dbg_name = "gfx2d1_p_clk",
1002 .ops = &clk_ops_branch,
Matt Wagantall158f73b2012-05-16 11:29:35 -07001003 .flags = CLKFLAG_SKIP_HANDOFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001004 CLK_INIT(gfx2d1_p_clk.c),
1005 },
1006};
1007
1008static struct branch_clk gfx3d_p_clk = {
1009 .b = {
1010 .ctl_reg = AHB_EN_REG,
1011 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001012 .hwcg_reg = AHB_EN2_REG,
1013 .hwcg_mask = BIT(27),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001014 .reset_reg = SW_RESET_AHB_REG,
1015 .reset_mask = BIT(10),
1016 .halt_reg = DBG_BUS_VEC_F_REG,
1017 .halt_bit = 4,
1018 },
1019 .c = {
1020 .dbg_name = "gfx3d_p_clk",
1021 .ops = &clk_ops_branch,
1022 CLK_INIT(gfx3d_p_clk.c),
1023 },
1024};
1025
1026static struct branch_clk hdmi_m_p_clk = {
1027 .b = {
1028 .ctl_reg = AHB_EN_REG,
1029 .en_mask = BIT(14),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001030 .hwcg_reg = AHB_EN2_REG,
1031 .hwcg_mask = BIT(21),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001032 .reset_reg = SW_RESET_AHB_REG,
1033 .reset_mask = BIT(9),
1034 .halt_reg = DBG_BUS_VEC_F_REG,
1035 .halt_bit = 5,
1036 },
1037 .c = {
1038 .dbg_name = "hdmi_m_p_clk",
1039 .ops = &clk_ops_branch,
1040 CLK_INIT(hdmi_m_p_clk.c),
1041 },
1042};
1043
1044static struct branch_clk hdmi_s_p_clk = {
1045 .b = {
1046 .ctl_reg = AHB_EN_REG,
1047 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001048 .hwcg_reg = AHB_EN2_REG,
1049 .hwcg_mask = BIT(22),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001050 .reset_reg = SW_RESET_AHB_REG,
1051 .reset_mask = BIT(9),
1052 .halt_reg = DBG_BUS_VEC_F_REG,
1053 .halt_bit = 6,
1054 },
1055 .c = {
1056 .dbg_name = "hdmi_s_p_clk",
1057 .ops = &clk_ops_branch,
1058 CLK_INIT(hdmi_s_p_clk.c),
1059 },
1060};
1061
1062static struct branch_clk ijpeg_p_clk = {
1063 .b = {
1064 .ctl_reg = AHB_EN_REG,
1065 .en_mask = BIT(5),
1066 .reset_reg = SW_RESET_AHB_REG,
1067 .reset_mask = BIT(7),
1068 .halt_reg = DBG_BUS_VEC_F_REG,
1069 .halt_bit = 9,
1070 },
1071 .c = {
1072 .dbg_name = "ijpeg_p_clk",
1073 .ops = &clk_ops_branch,
1074 CLK_INIT(ijpeg_p_clk.c),
1075 },
1076};
1077
1078static struct branch_clk imem_p_clk = {
1079 .b = {
1080 .ctl_reg = AHB_EN_REG,
1081 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001082 .hwcg_reg = AHB_EN2_REG,
1083 .hwcg_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001084 .reset_reg = SW_RESET_AHB_REG,
1085 .reset_mask = BIT(8),
1086 .halt_reg = DBG_BUS_VEC_F_REG,
1087 .halt_bit = 10,
1088 },
1089 .c = {
1090 .dbg_name = "imem_p_clk",
1091 .ops = &clk_ops_branch,
1092 CLK_INIT(imem_p_clk.c),
1093 },
1094};
1095
1096static struct branch_clk jpegd_p_clk = {
1097 .b = {
1098 .ctl_reg = AHB_EN_REG,
1099 .en_mask = BIT(21),
1100 .reset_reg = SW_RESET_AHB_REG,
1101 .reset_mask = BIT(4),
1102 .halt_reg = DBG_BUS_VEC_F_REG,
1103 .halt_bit = 7,
1104 },
1105 .c = {
1106 .dbg_name = "jpegd_p_clk",
1107 .ops = &clk_ops_branch,
1108 CLK_INIT(jpegd_p_clk.c),
1109 },
1110};
1111
1112static struct branch_clk mdp_p_clk = {
1113 .b = {
1114 .ctl_reg = AHB_EN_REG,
1115 .en_mask = BIT(10),
1116 .reset_reg = SW_RESET_AHB_REG,
1117 .reset_mask = BIT(3),
1118 .halt_reg = DBG_BUS_VEC_F_REG,
1119 .halt_bit = 11,
1120 },
1121 .c = {
1122 .dbg_name = "mdp_p_clk",
1123 .ops = &clk_ops_branch,
1124 CLK_INIT(mdp_p_clk.c),
1125 },
1126};
1127
1128static struct branch_clk rot_p_clk = {
1129 .b = {
1130 .ctl_reg = AHB_EN_REG,
1131 .en_mask = BIT(12),
1132 .reset_reg = SW_RESET_AHB_REG,
1133 .reset_mask = BIT(2),
1134 .halt_reg = DBG_BUS_VEC_F_REG,
1135 .halt_bit = 13,
1136 },
1137 .c = {
1138 .dbg_name = "rot_p_clk",
1139 .ops = &clk_ops_branch,
1140 CLK_INIT(rot_p_clk.c),
1141 },
1142};
1143
1144static struct branch_clk smmu_p_clk = {
1145 .b = {
1146 .ctl_reg = AHB_EN_REG,
1147 .en_mask = BIT(15),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001148 .hwcg_reg = AHB_EN_REG,
1149 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001150 .halt_reg = DBG_BUS_VEC_F_REG,
1151 .halt_bit = 22,
1152 },
1153 .c = {
1154 .dbg_name = "smmu_p_clk",
1155 .ops = &clk_ops_branch,
1156 CLK_INIT(smmu_p_clk.c),
1157 },
1158};
1159
1160static struct branch_clk tv_enc_p_clk = {
1161 .b = {
1162 .ctl_reg = AHB_EN_REG,
1163 .en_mask = BIT(25),
1164 .reset_reg = SW_RESET_AHB_REG,
1165 .reset_mask = BIT(15),
1166 .halt_reg = DBG_BUS_VEC_F_REG,
1167 .halt_bit = 23,
1168 },
1169 .c = {
1170 .dbg_name = "tv_enc_p_clk",
1171 .ops = &clk_ops_branch,
1172 CLK_INIT(tv_enc_p_clk.c),
1173 },
1174};
1175
1176static struct branch_clk vcodec_p_clk = {
1177 .b = {
1178 .ctl_reg = AHB_EN_REG,
1179 .en_mask = BIT(11),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001180 .hwcg_reg = AHB_EN2_REG,
1181 .hwcg_mask = BIT(26),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001182 .reset_reg = SW_RESET_AHB_REG,
1183 .reset_mask = BIT(1),
1184 .halt_reg = DBG_BUS_VEC_F_REG,
1185 .halt_bit = 12,
1186 },
1187 .c = {
1188 .dbg_name = "vcodec_p_clk",
1189 .ops = &clk_ops_branch,
1190 CLK_INIT(vcodec_p_clk.c),
1191 },
1192};
1193
1194static struct branch_clk vfe_p_clk = {
1195 .b = {
1196 .ctl_reg = AHB_EN_REG,
1197 .en_mask = BIT(13),
1198 .reset_reg = SW_RESET_AHB_REG,
1199 .reset_mask = BIT(0),
1200 .halt_reg = DBG_BUS_VEC_F_REG,
1201 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08001202 .retain_reg = AHB_EN2_REG,
1203 .retain_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001204 },
1205 .c = {
1206 .dbg_name = "vfe_p_clk",
1207 .ops = &clk_ops_branch,
1208 CLK_INIT(vfe_p_clk.c),
1209 },
1210};
1211
1212static struct branch_clk vpe_p_clk = {
1213 .b = {
1214 .ctl_reg = AHB_EN_REG,
1215 .en_mask = BIT(16),
1216 .reset_reg = SW_RESET_AHB_REG,
1217 .reset_mask = BIT(14),
1218 .halt_reg = DBG_BUS_VEC_F_REG,
1219 .halt_bit = 15,
1220 },
1221 .c = {
1222 .dbg_name = "vpe_p_clk",
1223 .ops = &clk_ops_branch,
1224 CLK_INIT(vpe_p_clk.c),
1225 },
1226};
1227
Tianyi Gou41515e22011-09-01 19:37:43 -07001228static struct branch_clk vcap_p_clk = {
1229 .b = {
1230 .ctl_reg = AHB_EN3_REG,
1231 .en_mask = BIT(1),
1232 .reset_reg = SW_RESET_AHB2_REG,
1233 .reset_mask = BIT(2),
1234 .halt_reg = DBG_BUS_VEC_J_REG,
1235 .halt_bit = 23,
1236 },
1237 .c = {
1238 .dbg_name = "vcap_p_clk",
1239 .ops = &clk_ops_branch,
1240 CLK_INIT(vcap_p_clk.c),
1241 },
1242};
1243
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001244/*
1245 * Peripheral Clocks
1246 */
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001247#define CLK_GP(i, n, h_r, h_b) \
1248 struct rcg_clk i##_clk = { \
1249 .b = { \
1250 .ctl_reg = GPn_NS_REG(n), \
1251 .en_mask = BIT(9), \
1252 .halt_reg = h_r, \
1253 .halt_bit = h_b, \
1254 }, \
1255 .ns_reg = GPn_NS_REG(n), \
1256 .md_reg = GPn_MD_REG(n), \
1257 .root_en_mask = BIT(11), \
1258 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001259 .mnd_en_mask = BIT(8), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001260 .set_rate = set_rate_mnd, \
1261 .freq_tbl = clk_tbl_gp, \
1262 .current_freq = &rcg_dummy_freq, \
1263 .c = { \
1264 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001265 .ops = &clk_ops_rcg, \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001266 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), \
1267 CLK_INIT(i##_clk.c), \
1268 }, \
1269 }
1270#define F_GP(f, s, d, m, n) \
1271 { \
1272 .freq_hz = f, \
1273 .src_clk = &s##_clk.c, \
1274 .md_val = MD8(16, m, 0, n), \
1275 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001276 }
1277static struct clk_freq_tbl clk_tbl_gp[] = {
1278 F_GP( 0, gnd, 1, 0, 0),
1279 F_GP( 9600000, cxo, 2, 0, 0),
1280 F_GP( 13500000, pxo, 2, 0, 0),
1281 F_GP( 19200000, cxo, 1, 0, 0),
1282 F_GP( 27000000, pxo, 1, 0, 0),
1283 F_GP( 64000000, pll8, 2, 1, 3),
1284 F_GP( 76800000, pll8, 1, 1, 5),
1285 F_GP( 96000000, pll8, 4, 0, 0),
1286 F_GP(128000000, pll8, 3, 0, 0),
1287 F_GP(192000000, pll8, 2, 0, 0),
Matt Wagantall7625a4c2011-11-01 16:17:53 -07001288 F_END
1289};
1290
1291static CLK_GP(gp0, 0, CLK_HALT_SFPB_MISC_STATE_REG, 7);
1292static CLK_GP(gp1, 1, CLK_HALT_SFPB_MISC_STATE_REG, 6);
1293static CLK_GP(gp2, 2, CLK_HALT_SFPB_MISC_STATE_REG, 5);
1294
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001295#define CLK_GSBI_UART(i, n, h_r, h_b) \
1296 struct rcg_clk i##_clk = { \
1297 .b = { \
1298 .ctl_reg = GSBIn_UART_APPS_NS_REG(n), \
1299 .en_mask = BIT(9), \
1300 .reset_reg = GSBIn_RESET_REG(n), \
1301 .reset_mask = BIT(0), \
1302 .halt_reg = h_r, \
1303 .halt_bit = h_b, \
1304 }, \
1305 .ns_reg = GSBIn_UART_APPS_NS_REG(n), \
1306 .md_reg = GSBIn_UART_APPS_MD_REG(n), \
1307 .root_en_mask = BIT(11), \
1308 .ns_mask = (BM(31, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001309 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001310 .set_rate = set_rate_mnd, \
1311 .freq_tbl = clk_tbl_gsbi_uart, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001312 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001313 .c = { \
1314 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001315 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001316 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001317 CLK_INIT(i##_clk.c), \
1318 }, \
1319 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001320#define F_GSBI_UART(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321 { \
1322 .freq_hz = f, \
1323 .src_clk = &s##_clk.c, \
1324 .md_val = MD16(m, n), \
1325 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326 }
1327static struct clk_freq_tbl clk_tbl_gsbi_uart[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001328 F_GSBI_UART( 0, gnd, 1, 0, 0),
Matt Wagantall9a561f72012-01-19 16:13:12 -08001329 F_GSBI_UART( 1843200, pll8, 2, 6, 625),
1330 F_GSBI_UART( 3686400, pll8, 2, 12, 625),
1331 F_GSBI_UART( 7372800, pll8, 2, 24, 625),
1332 F_GSBI_UART(14745600, pll8, 2, 48, 625),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001333 F_GSBI_UART(16000000, pll8, 4, 1, 6),
1334 F_GSBI_UART(24000000, pll8, 4, 1, 4),
1335 F_GSBI_UART(32000000, pll8, 4, 1, 3),
1336 F_GSBI_UART(40000000, pll8, 1, 5, 48),
1337 F_GSBI_UART(46400000, pll8, 1, 29, 240),
1338 F_GSBI_UART(48000000, pll8, 4, 1, 2),
1339 F_GSBI_UART(51200000, pll8, 1, 2, 15),
1340 F_GSBI_UART(56000000, pll8, 1, 7, 48),
1341 F_GSBI_UART(58982400, pll8, 1, 96, 625),
1342 F_GSBI_UART(64000000, pll8, 2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001343 F_END
1344};
1345
1346static CLK_GSBI_UART(gsbi1_uart, 1, CLK_HALT_CFPB_STATEA_REG, 10);
1347static CLK_GSBI_UART(gsbi2_uart, 2, CLK_HALT_CFPB_STATEA_REG, 6);
1348static CLK_GSBI_UART(gsbi3_uart, 3, CLK_HALT_CFPB_STATEA_REG, 2);
1349static CLK_GSBI_UART(gsbi4_uart, 4, CLK_HALT_CFPB_STATEB_REG, 26);
1350static CLK_GSBI_UART(gsbi5_uart, 5, CLK_HALT_CFPB_STATEB_REG, 22);
1351static CLK_GSBI_UART(gsbi6_uart, 6, CLK_HALT_CFPB_STATEB_REG, 18);
1352static CLK_GSBI_UART(gsbi7_uart, 7, CLK_HALT_CFPB_STATEB_REG, 14);
1353static CLK_GSBI_UART(gsbi8_uart, 8, CLK_HALT_CFPB_STATEB_REG, 10);
1354static CLK_GSBI_UART(gsbi9_uart, 9, CLK_HALT_CFPB_STATEB_REG, 6);
1355static CLK_GSBI_UART(gsbi10_uart, 10, CLK_HALT_CFPB_STATEB_REG, 2);
1356static CLK_GSBI_UART(gsbi11_uart, 11, CLK_HALT_CFPB_STATEC_REG, 17);
1357static CLK_GSBI_UART(gsbi12_uart, 12, CLK_HALT_CFPB_STATEC_REG, 13);
1358
1359#define CLK_GSBI_QUP(i, n, h_r, h_b) \
1360 struct rcg_clk i##_clk = { \
1361 .b = { \
1362 .ctl_reg = GSBIn_QUP_APPS_NS_REG(n), \
1363 .en_mask = BIT(9), \
1364 .reset_reg = GSBIn_RESET_REG(n), \
1365 .reset_mask = BIT(0), \
1366 .halt_reg = h_r, \
1367 .halt_bit = h_b, \
1368 }, \
1369 .ns_reg = GSBIn_QUP_APPS_NS_REG(n), \
1370 .md_reg = GSBIn_QUP_APPS_MD_REG(n), \
1371 .root_en_mask = BIT(11), \
1372 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001373 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001374 .set_rate = set_rate_mnd, \
1375 .freq_tbl = clk_tbl_gsbi_qup, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001376 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001377 .c = { \
1378 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001379 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001380 VDD_DIG_FMAX_MAP2(LOW, 24000000, NOMINAL, 52000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001381 CLK_INIT(i##_clk.c), \
1382 }, \
1383 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001384#define F_GSBI_QUP(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001385 { \
1386 .freq_hz = f, \
1387 .src_clk = &s##_clk.c, \
1388 .md_val = MD8(16, m, 0, n), \
1389 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001390 }
1391static struct clk_freq_tbl clk_tbl_gsbi_qup[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001392 F_GSBI_QUP( 0, gnd, 1, 0, 0),
1393 F_GSBI_QUP( 1100000, pxo, 1, 2, 49),
1394 F_GSBI_QUP( 5400000, pxo, 1, 1, 5),
1395 F_GSBI_QUP(10800000, pxo, 1, 2, 5),
1396 F_GSBI_QUP(15060000, pll8, 1, 2, 51),
1397 F_GSBI_QUP(24000000, pll8, 4, 1, 4),
1398 F_GSBI_QUP(25600000, pll8, 1, 1, 15),
1399 F_GSBI_QUP(27000000, pxo, 1, 0, 0),
1400 F_GSBI_QUP(48000000, pll8, 4, 1, 2),
1401 F_GSBI_QUP(51200000, pll8, 1, 2, 15),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001402 F_END
1403};
1404
1405static CLK_GSBI_QUP(gsbi1_qup, 1, CLK_HALT_CFPB_STATEA_REG, 9);
1406static CLK_GSBI_QUP(gsbi2_qup, 2, CLK_HALT_CFPB_STATEA_REG, 4);
1407static CLK_GSBI_QUP(gsbi3_qup, 3, CLK_HALT_CFPB_STATEA_REG, 0);
1408static CLK_GSBI_QUP(gsbi4_qup, 4, CLK_HALT_CFPB_STATEB_REG, 24);
1409static CLK_GSBI_QUP(gsbi5_qup, 5, CLK_HALT_CFPB_STATEB_REG, 20);
1410static CLK_GSBI_QUP(gsbi6_qup, 6, CLK_HALT_CFPB_STATEB_REG, 16);
1411static CLK_GSBI_QUP(gsbi7_qup, 7, CLK_HALT_CFPB_STATEB_REG, 12);
1412static CLK_GSBI_QUP(gsbi8_qup, 8, CLK_HALT_CFPB_STATEB_REG, 8);
1413static CLK_GSBI_QUP(gsbi9_qup, 9, CLK_HALT_CFPB_STATEB_REG, 4);
1414static CLK_GSBI_QUP(gsbi10_qup, 10, CLK_HALT_CFPB_STATEB_REG, 0);
1415static CLK_GSBI_QUP(gsbi11_qup, 11, CLK_HALT_CFPB_STATEC_REG, 15);
1416static CLK_GSBI_QUP(gsbi12_qup, 12, CLK_HALT_CFPB_STATEC_REG, 11);
1417
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001418#define F_PDM(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001419 { \
1420 .freq_hz = f, \
1421 .src_clk = &s##_clk.c, \
1422 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001423 }
1424static struct clk_freq_tbl clk_tbl_pdm[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001425 F_PDM( 0, gnd, 1),
1426 F_PDM(27000000, pxo, 1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001427 F_END
1428};
1429
1430static struct rcg_clk pdm_clk = {
1431 .b = {
1432 .ctl_reg = PDM_CLK_NS_REG,
1433 .en_mask = BIT(9),
1434 .reset_reg = PDM_CLK_NS_REG,
1435 .reset_mask = BIT(12),
1436 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1437 .halt_bit = 3,
1438 },
1439 .ns_reg = PDM_CLK_NS_REG,
1440 .root_en_mask = BIT(11),
1441 .ns_mask = BM(1, 0),
1442 .set_rate = set_rate_nop,
1443 .freq_tbl = clk_tbl_pdm,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001444 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001445 .c = {
1446 .dbg_name = "pdm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001447 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001448 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001449 CLK_INIT(pdm_clk.c),
1450 },
1451};
1452
1453static struct branch_clk pmem_clk = {
1454 .b = {
1455 .ctl_reg = PMEM_ACLK_CTL_REG,
1456 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001457 .hwcg_reg = PMEM_ACLK_CTL_REG,
1458 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001459 .halt_reg = CLK_HALT_DFAB_STATE_REG,
1460 .halt_bit = 20,
1461 },
1462 .c = {
1463 .dbg_name = "pmem_clk",
1464 .ops = &clk_ops_branch,
1465 CLK_INIT(pmem_clk.c),
1466 },
1467};
1468
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001469#define F_PRNG(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001470 { \
1471 .freq_hz = f, \
1472 .src_clk = &s##_clk.c, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001473 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07001474static struct clk_freq_tbl clk_tbl_prng_32[] = {
1475 F_PRNG(32000000, pll8),
1476 F_END
1477};
1478
1479static struct clk_freq_tbl clk_tbl_prng_64[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001480 F_PRNG(64000000, pll8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001481 F_END
1482};
1483
1484static struct rcg_clk prng_clk = {
1485 .b = {
1486 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
1487 .en_mask = BIT(10),
1488 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
1489 .halt_check = HALT_VOTED,
1490 .halt_bit = 10,
1491 },
1492 .set_rate = set_rate_nop,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001493 .freq_tbl = clk_tbl_prng_32,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001494 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001495 .c = {
1496 .dbg_name = "prng_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001497 .ops = &clk_ops_rcg,
Stephen Boyd842a1f62012-04-26 19:07:38 -07001498 VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001499 CLK_INIT(prng_clk.c),
1500 },
1501};
1502
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001503#define CLK_SDC(name, n, h_b, fmax_low, fmax_nom) \
Stephen Boyda78a7402011-08-02 11:23:39 -07001504 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001505 .b = { \
1506 .ctl_reg = SDCn_APPS_CLK_NS_REG(n), \
1507 .en_mask = BIT(9), \
1508 .reset_reg = SDCn_RESET_REG(n), \
1509 .reset_mask = BIT(0), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001510 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001511 .halt_bit = h_b, \
1512 }, \
1513 .ns_reg = SDCn_APPS_CLK_NS_REG(n), \
1514 .md_reg = SDCn_APPS_CLK_MD_REG(n), \
1515 .root_en_mask = BIT(11), \
1516 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001517 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001518 .set_rate = set_rate_mnd, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001519 .freq_tbl = clk_tbl_sdc, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001520 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001521 .c = { \
Stephen Boyda78a7402011-08-02 11:23:39 -07001522 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001523 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001524 VDD_DIG_FMAX_MAP2(LOW, fmax_low, NOMINAL, fmax_nom), \
Stephen Boyda78a7402011-08-02 11:23:39 -07001525 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001526 }, \
1527 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001528#define F_SDC(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001529 { \
1530 .freq_hz = f, \
1531 .src_clk = &s##_clk.c, \
1532 .md_val = MD8(16, m, 0, n), \
1533 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001534 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001535static struct clk_freq_tbl clk_tbl_sdc[] = {
1536 F_SDC( 0, gnd, 1, 0, 0),
1537 F_SDC( 144000, pxo, 3, 2, 125),
1538 F_SDC( 400000, pll8, 4, 1, 240),
1539 F_SDC( 16000000, pll8, 4, 1, 6),
1540 F_SDC( 17070000, pll8, 1, 2, 45),
1541 F_SDC( 20210000, pll8, 1, 1, 19),
1542 F_SDC( 24000000, pll8, 4, 1, 4),
1543 F_SDC( 48000000, pll8, 4, 1, 2),
1544 F_SDC( 64000000, pll8, 3, 1, 2),
1545 F_SDC( 96000000, pll8, 4, 0, 0),
Subhash Jadavanibd238ba2011-11-24 15:12:39 +05301546 F_SDC(192000000, pll8, 2, 0, 0),
Stephen Boyda78a7402011-08-02 11:23:39 -07001547 F_END
1548};
1549
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001550static CLK_SDC(sdc1_clk, 1, 6, 52000000, 104000000);
1551static CLK_SDC(sdc2_clk, 2, 5, 52000000, 104000000);
1552static CLK_SDC(sdc3_clk, 3, 4, 104000000, 208000000);
1553static CLK_SDC(sdc4_clk, 4, 3, 33000000, 67000000);
1554static CLK_SDC(sdc5_clk, 5, 2, 33000000, 67000000);
Stephen Boyda78a7402011-08-02 11:23:39 -07001555
Saravana Kannan55e959d2012-10-15 22:16:04 -07001556static unsigned long fmax_sdc1_8064v2[VDD_DIG_NUM] = {
Patrick Dalyb7c777a2012-08-23 19:07:30 -07001557 [VDD_DIG_LOW] = 100000000,
1558 [VDD_DIG_NOMINAL] = 200000000,
1559};
1560
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001561#define F_TSIF_REF(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001562 { \
1563 .freq_hz = f, \
1564 .src_clk = &s##_clk.c, \
1565 .md_val = MD16(m, n), \
1566 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001567 }
1568static struct clk_freq_tbl clk_tbl_tsif_ref[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001569 F_TSIF_REF( 0, gnd, 1, 0, 0),
1570 F_TSIF_REF(105000, pxo, 1, 1, 256),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001571 F_END
1572};
1573
1574static struct rcg_clk tsif_ref_clk = {
1575 .b = {
1576 .ctl_reg = TSIF_REF_CLK_NS_REG,
1577 .en_mask = BIT(9),
1578 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1579 .halt_bit = 5,
1580 },
1581 .ns_reg = TSIF_REF_CLK_NS_REG,
1582 .md_reg = TSIF_REF_CLK_MD_REG,
1583 .root_en_mask = BIT(11),
1584 .ns_mask = (BM(31, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001585 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001586 .set_rate = set_rate_mnd,
1587 .freq_tbl = clk_tbl_tsif_ref,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001588 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001589 .c = {
1590 .dbg_name = "tsif_ref_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001591 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001592 VDD_DIG_FMAX_MAP2(LOW, 27000000, NOMINAL, 54000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001593 CLK_INIT(tsif_ref_clk.c),
1594 },
1595};
1596
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001597#define F_TSSC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001598 { \
1599 .freq_hz = f, \
1600 .src_clk = &s##_clk.c, \
1601 .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001602 }
1603static struct clk_freq_tbl clk_tbl_tssc[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001604 F_TSSC( 0, gnd),
1605 F_TSSC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001606 F_END
1607};
1608
1609static struct rcg_clk tssc_clk = {
1610 .b = {
1611 .ctl_reg = TSSC_CLK_CTL_REG,
1612 .en_mask = BIT(4),
1613 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1614 .halt_bit = 4,
1615 },
1616 .ns_reg = TSSC_CLK_CTL_REG,
1617 .ns_mask = BM(1, 0),
1618 .set_rate = set_rate_nop,
1619 .freq_tbl = clk_tbl_tssc,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001620 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001621 .c = {
1622 .dbg_name = "tssc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001623 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001624 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001625 CLK_INIT(tssc_clk.c),
1626 },
1627};
1628
Tianyi Gou41515e22011-09-01 19:37:43 -07001629#define CLK_USB_HS(name, n, h_b) \
1630 static struct rcg_clk name = { \
1631 .b = { \
1632 .ctl_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1633 .en_mask = BIT(9), \
1634 .reset_reg = USB_HS##n##_RESET_REG, \
1635 .reset_mask = BIT(0), \
1636 .halt_reg = CLK_HALT_DFAB_STATE_REG, \
1637 .halt_bit = h_b, \
1638 }, \
1639 .ns_reg = USB_HS##n##_XCVR_FS_CLK_NS_REG, \
1640 .md_reg = USB_HS##n##_XCVR_FS_CLK_MD_REG, \
1641 .root_en_mask = BIT(11), \
1642 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001643 .mnd_en_mask = BIT(8), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001644 .set_rate = set_rate_mnd, \
1645 .freq_tbl = clk_tbl_usb, \
1646 .current_freq = &rcg_dummy_freq, \
1647 .c = { \
1648 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001649 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001650 VDD_DIG_FMAX_MAP1(NOMINAL, 64000000), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001651 CLK_INIT(name.c), \
1652 }, \
1653}
1654
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001655#define F_USB(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001656 { \
1657 .freq_hz = f, \
1658 .src_clk = &s##_clk.c, \
1659 .md_val = MD8(16, m, 0, n), \
1660 .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001661 }
1662static struct clk_freq_tbl clk_tbl_usb[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001663 F_USB( 0, gnd, 1, 0, 0),
1664 F_USB(60000000, pll8, 1, 5, 32),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001665 F_END
1666};
1667
Tianyi Gou41515e22011-09-01 19:37:43 -07001668CLK_USB_HS(usb_hs1_xcvr_clk, 1, 0);
1669CLK_USB_HS(usb_hs3_xcvr_clk, 3, 30);
1670CLK_USB_HS(usb_hs4_xcvr_clk, 4, 2);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001671
Stephen Boyd94625ef2011-07-12 17:06:01 -07001672static struct clk_freq_tbl clk_tbl_usb_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001673 F_USB( 0, gnd, 1, 0, 0),
1674 F_USB(60000000, pll8, 1, 5, 32),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001675 F_END
1676};
1677
1678static struct rcg_clk usb_hsic_xcvr_fs_clk = {
1679 .b = {
1680 .ctl_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1681 .en_mask = BIT(9),
1682 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1683 .halt_bit = 26,
1684 },
1685 .ns_reg = USB_HSIC_XCVR_FS_CLK_NS_REG,
1686 .md_reg = USB_HSIC_XCVR_FS_CLK_MD_REG,
1687 .root_en_mask = BIT(11),
1688 .ns_mask = (BM(23, 16) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08001689 .mnd_en_mask = BIT(8),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001690 .set_rate = set_rate_mnd,
1691 .freq_tbl = clk_tbl_usb_hsic,
1692 .current_freq = &rcg_dummy_freq,
1693 .c = {
1694 .dbg_name = "usb_hsic_xcvr_fs_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001695 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001696 VDD_DIG_FMAX_MAP1(LOW, 60000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001697 CLK_INIT(usb_hsic_xcvr_fs_clk.c),
1698 },
1699};
1700
1701static struct branch_clk usb_hsic_system_clk = {
1702 .b = {
1703 .ctl_reg = USB_HSIC_SYSTEM_CLK_CTL_REG,
1704 .en_mask = BIT(4),
1705 .reset_reg = USB_HSIC_RESET_REG,
1706 .reset_mask = BIT(0),
1707 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1708 .halt_bit = 24,
1709 },
Stephen Boyd94625ef2011-07-12 17:06:01 -07001710 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001711 .parent = &usb_hsic_xcvr_fs_clk.c,
Stephen Boyd94625ef2011-07-12 17:06:01 -07001712 .dbg_name = "usb_hsic_system_clk",
1713 .ops = &clk_ops_branch,
1714 CLK_INIT(usb_hsic_system_clk.c),
1715 },
1716};
1717
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001718#define F_USB_HSIC(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001719 { \
1720 .freq_hz = f, \
1721 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001722 }
1723static struct clk_freq_tbl clk_tbl_usb2_hsic[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001724 F_USB_HSIC(480000000, pll14),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001725 F_END
1726};
1727
1728static struct rcg_clk usb_hsic_hsic_src_clk = {
1729 .b = {
1730 .ctl_reg = USB_HSIC_HSIC_CLK_SRC_CTL_REG,
1731 .halt_check = NOCHECK,
1732 },
1733 .root_en_mask = BIT(0),
1734 .set_rate = set_rate_nop,
1735 .freq_tbl = clk_tbl_usb2_hsic,
1736 .current_freq = &rcg_dummy_freq,
1737 .c = {
1738 .dbg_name = "usb_hsic_hsic_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001739 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001740 VDD_DIG_FMAX_MAP1(LOW, 480000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001741 CLK_INIT(usb_hsic_hsic_src_clk.c),
1742 },
1743};
1744
1745static struct branch_clk usb_hsic_hsic_clk = {
1746 .b = {
1747 .ctl_reg = USB_HSIC_HSIC_CLK_CTL_REG,
1748 .en_mask = BIT(0),
1749 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1750 .halt_bit = 19,
1751 },
Stephen Boyd94625ef2011-07-12 17:06:01 -07001752 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001753 .parent = &usb_hsic_hsic_src_clk.c,
Stephen Boyd94625ef2011-07-12 17:06:01 -07001754 .dbg_name = "usb_hsic_hsic_clk",
1755 .ops = &clk_ops_branch,
1756 CLK_INIT(usb_hsic_hsic_clk.c),
1757 },
1758};
1759
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001760#define F_USB_HSIO_CAL(f, s) \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001761 { \
1762 .freq_hz = f, \
1763 .src_clk = &s##_clk.c, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07001764 }
1765static struct clk_freq_tbl clk_tbl_usb_hsio_cal[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001766 F_USB_HSIO_CAL(9000000, pxo),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001767 F_END
1768};
1769
1770static struct rcg_clk usb_hsic_hsio_cal_clk = {
1771 .b = {
1772 .ctl_reg = USB_HSIC_HSIO_CAL_CLK_CTL_REG,
1773 .en_mask = BIT(0),
1774 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1775 .halt_bit = 23,
1776 },
1777 .set_rate = set_rate_nop,
1778 .freq_tbl = clk_tbl_usb_hsio_cal,
1779 .current_freq = &rcg_dummy_freq,
1780 .c = {
1781 .dbg_name = "usb_hsic_hsio_cal_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001782 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001783 VDD_DIG_FMAX_MAP1(LOW, 10000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07001784 CLK_INIT(usb_hsic_hsio_cal_clk.c),
1785 },
1786};
1787
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001788static struct branch_clk usb_phy0_clk = {
1789 .b = {
1790 .reset_reg = USB_PHY0_RESET_REG,
1791 .reset_mask = BIT(0),
1792 },
1793 .c = {
1794 .dbg_name = "usb_phy0_clk",
1795 .ops = &clk_ops_reset,
1796 CLK_INIT(usb_phy0_clk.c),
1797 },
1798};
1799
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001800#define CLK_USB_FS(i, n, fmax_nom) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001801 struct rcg_clk i##_clk = { \
1802 .ns_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1803 .b = { \
1804 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \
1805 .halt_check = NOCHECK, \
1806 }, \
1807 .md_reg = USB_FSn_XCVR_FS_CLK_MD_REG(n), \
1808 .root_en_mask = BIT(11), \
1809 .ns_mask = (BM(23, 16) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08001810 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001811 .set_rate = set_rate_mnd, \
1812 .freq_tbl = clk_tbl_usb, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07001813 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001814 .c = { \
1815 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07001816 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001817 VDD_DIG_FMAX_MAP1(NOMINAL, fmax_nom), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001818 CLK_INIT(i##_clk.c), \
1819 }, \
1820 }
1821
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001822static CLK_USB_FS(usb_fs1_src, 1, 64000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001823static struct branch_clk usb_fs1_xcvr_clk = {
1824 .b = {
1825 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(1),
1826 .en_mask = BIT(9),
1827 .reset_reg = USB_FSn_RESET_REG(1),
1828 .reset_mask = BIT(1),
1829 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1830 .halt_bit = 15,
1831 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001832 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001833 .parent = &usb_fs1_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001834 .dbg_name = "usb_fs1_xcvr_clk",
1835 .ops = &clk_ops_branch,
1836 CLK_INIT(usb_fs1_xcvr_clk.c),
1837 },
1838};
1839
1840static struct branch_clk usb_fs1_sys_clk = {
1841 .b = {
1842 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(1),
1843 .en_mask = BIT(4),
1844 .reset_reg = USB_FSn_RESET_REG(1),
1845 .reset_mask = BIT(0),
1846 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1847 .halt_bit = 16,
1848 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001849 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001850 .parent = &usb_fs1_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001851 .dbg_name = "usb_fs1_sys_clk",
1852 .ops = &clk_ops_branch,
1853 CLK_INIT(usb_fs1_sys_clk.c),
1854 },
1855};
1856
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001857static CLK_USB_FS(usb_fs2_src, 2, 60000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001858static struct branch_clk usb_fs2_xcvr_clk = {
1859 .b = {
1860 .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(2),
1861 .en_mask = BIT(9),
1862 .reset_reg = USB_FSn_RESET_REG(2),
1863 .reset_mask = BIT(1),
1864 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1865 .halt_bit = 12,
1866 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001867 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001868 .parent = &usb_fs2_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001869 .dbg_name = "usb_fs2_xcvr_clk",
1870 .ops = &clk_ops_branch,
1871 CLK_INIT(usb_fs2_xcvr_clk.c),
1872 },
1873};
1874
1875static struct branch_clk usb_fs2_sys_clk = {
1876 .b = {
1877 .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(2),
1878 .en_mask = BIT(4),
1879 .reset_reg = USB_FSn_RESET_REG(2),
1880 .reset_mask = BIT(0),
1881 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
1882 .halt_bit = 13,
1883 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001884 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001885 .parent = &usb_fs2_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001886 .dbg_name = "usb_fs2_sys_clk",
1887 .ops = &clk_ops_branch,
1888 CLK_INIT(usb_fs2_sys_clk.c),
1889 },
1890};
1891
1892/* Fast Peripheral Bus Clocks */
1893static struct branch_clk ce1_core_clk = {
1894 .b = {
1895 .ctl_reg = CE1_CORE_CLK_CTL_REG,
1896 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08001897 .hwcg_reg = CE1_CORE_CLK_CTL_REG,
1898 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001899 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1900 .halt_bit = 27,
1901 },
1902 .c = {
1903 .dbg_name = "ce1_core_clk",
1904 .ops = &clk_ops_branch,
1905 CLK_INIT(ce1_core_clk.c),
1906 },
1907};
Tianyi Gou41515e22011-09-01 19:37:43 -07001908
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001909static struct branch_clk ce1_p_clk = {
1910 .b = {
1911 .ctl_reg = CE1_HCLK_CTL_REG,
1912 .en_mask = BIT(4),
1913 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
1914 .halt_bit = 1,
1915 },
1916 .c = {
1917 .dbg_name = "ce1_p_clk",
1918 .ops = &clk_ops_branch,
1919 CLK_INIT(ce1_p_clk.c),
1920 },
1921};
1922
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001923#define F_CE3(f, s, d) \
Tianyi Gou41515e22011-09-01 19:37:43 -07001924 { \
1925 .freq_hz = f, \
1926 .src_clk = &s##_clk.c, \
1927 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
Tianyi Gou41515e22011-09-01 19:37:43 -07001928 }
1929
1930static struct clk_freq_tbl clk_tbl_ce3[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001931 F_CE3( 0, gnd, 1),
1932 F_CE3( 48000000, pll8, 8),
1933 F_CE3(100000000, pll3, 12),
Patrick Dalyb7c777a2012-08-23 19:07:30 -07001934 F_CE3(120000000, pll3, 10),
Tianyi Gou41515e22011-09-01 19:37:43 -07001935 F_END
1936};
1937
1938static struct rcg_clk ce3_src_clk = {
1939 .b = {
1940 .ctl_reg = CE3_CLK_SRC_NS_REG,
1941 .halt_check = NOCHECK,
1942 },
1943 .ns_reg = CE3_CLK_SRC_NS_REG,
1944 .root_en_mask = BIT(7),
1945 .ns_mask = BM(6, 0),
1946 .set_rate = set_rate_nop,
1947 .freq_tbl = clk_tbl_ce3,
1948 .current_freq = &rcg_dummy_freq,
1949 .c = {
1950 .dbg_name = "ce3_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07001951 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07001952 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
Tianyi Gou41515e22011-09-01 19:37:43 -07001953 CLK_INIT(ce3_src_clk.c),
1954 },
1955};
1956
Saravana Kannan55e959d2012-10-15 22:16:04 -07001957static unsigned long fmax_ce3_8064v2[VDD_DIG_NUM] = {
Patrick Dalyb7c777a2012-08-23 19:07:30 -07001958 [VDD_DIG_LOW] = 57000000,
1959 [VDD_DIG_NOMINAL] = 120000000,
1960};
1961
Tianyi Gou41515e22011-09-01 19:37:43 -07001962static struct branch_clk ce3_core_clk = {
1963 .b = {
1964 .ctl_reg = CE3_CORE_CLK_CTL_REG,
1965 .en_mask = BIT(4),
1966 .reset_reg = CE3_CORE_CLK_CTL_REG,
1967 .reset_mask = BIT(7),
1968 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
1969 .halt_bit = 5,
1970 },
Tianyi Gou41515e22011-09-01 19:37:43 -07001971 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001972 .parent = &ce3_src_clk.c,
Tianyi Gou41515e22011-09-01 19:37:43 -07001973 .dbg_name = "ce3_core_clk",
1974 .ops = &clk_ops_branch,
1975 CLK_INIT(ce3_core_clk.c),
1976 }
1977};
1978
1979static struct branch_clk ce3_p_clk = {
1980 .b = {
1981 .ctl_reg = CE3_HCLK_CTL_REG,
1982 .en_mask = BIT(4),
1983 .reset_reg = CE3_HCLK_CTL_REG,
1984 .reset_mask = BIT(7),
1985 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
1986 .halt_bit = 16,
1987 },
Tianyi Gou41515e22011-09-01 19:37:43 -07001988 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07001989 .parent = &ce3_src_clk.c,
Tianyi Gou41515e22011-09-01 19:37:43 -07001990 .dbg_name = "ce3_p_clk",
1991 .ops = &clk_ops_branch,
1992 CLK_INIT(ce3_p_clk.c),
1993 }
1994};
1995
Tianyi Gou352955d2012-05-18 19:44:01 -07001996#define F_SATA(f, s, d) \
1997 { \
1998 .freq_hz = f, \
1999 .src_clk = &s##_clk.c, \
2000 .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \
2001 }
2002
2003static struct clk_freq_tbl clk_tbl_sata[] = {
2004 F_SATA( 0, gnd, 1),
2005 F_SATA( 48000000, pll8, 8),
2006 F_SATA(100000000, pll3, 12),
2007 F_END
2008};
2009
2010static struct rcg_clk sata_src_clk = {
2011 .b = {
2012 .ctl_reg = SATA_CLK_SRC_NS_REG,
2013 .halt_check = NOCHECK,
2014 },
2015 .ns_reg = SATA_CLK_SRC_NS_REG,
2016 .root_en_mask = BIT(7),
2017 .ns_mask = BM(6, 0),
2018 .set_rate = set_rate_nop,
2019 .freq_tbl = clk_tbl_sata,
2020 .current_freq = &rcg_dummy_freq,
2021 .c = {
2022 .dbg_name = "sata_src_clk",
2023 .ops = &clk_ops_rcg,
2024 VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000),
2025 CLK_INIT(sata_src_clk.c),
2026 },
2027};
2028
2029static struct branch_clk sata_rxoob_clk = {
2030 .b = {
2031 .ctl_reg = SATA_RXOOB_CLK_CTL_REG,
2032 .en_mask = BIT(4),
2033 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2034 .halt_bit = 26,
2035 },
Tianyi Gou352955d2012-05-18 19:44:01 -07002036 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07002037 .parent = &sata_src_clk.c,
Tianyi Gou352955d2012-05-18 19:44:01 -07002038 .dbg_name = "sata_rxoob_clk",
2039 .ops = &clk_ops_branch,
2040 CLK_INIT(sata_rxoob_clk.c),
2041 },
2042};
2043
2044static struct branch_clk sata_pmalive_clk = {
2045 .b = {
2046 .ctl_reg = SATA_PMALIVE_CLK_CTL_REG,
2047 .en_mask = BIT(4),
2048 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2049 .halt_bit = 25,
2050 },
Tianyi Gou352955d2012-05-18 19:44:01 -07002051 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07002052 .parent = &sata_src_clk.c,
Tianyi Gou352955d2012-05-18 19:44:01 -07002053 .dbg_name = "sata_pmalive_clk",
2054 .ops = &clk_ops_branch,
2055 CLK_INIT(sata_pmalive_clk.c),
2056 },
2057};
2058
Tianyi Gou41515e22011-09-01 19:37:43 -07002059static struct branch_clk sata_phy_ref_clk = {
2060 .b = {
2061 .ctl_reg = SATA_PHY_REF_CLK_CTL_REG,
2062 .en_mask = BIT(4),
2063 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2064 .halt_bit = 24,
2065 },
Tianyi Gou41515e22011-09-01 19:37:43 -07002066 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07002067 .parent = &pxo_clk.c,
Tianyi Gou41515e22011-09-01 19:37:43 -07002068 .dbg_name = "sata_phy_ref_clk",
2069 .ops = &clk_ops_branch,
2070 CLK_INIT(sata_phy_ref_clk.c),
2071 },
2072};
2073
Tianyi Gou352955d2012-05-18 19:44:01 -07002074static struct branch_clk sata_a_clk = {
2075 .b = {
2076 .ctl_reg = SATA_ACLK_CTL_REG,
2077 .en_mask = BIT(4),
2078 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2079 .halt_bit = 12,
2080 },
2081 .c = {
2082 .dbg_name = "sata_a_clk",
2083 .ops = &clk_ops_branch,
2084 CLK_INIT(sata_a_clk.c),
2085 },
2086};
2087
2088static struct branch_clk sata_p_clk = {
2089 .b = {
2090 .ctl_reg = SATA_HCLK_CTL_REG,
2091 .en_mask = BIT(4),
2092 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2093 .halt_bit = 27,
Sujit Reddy Thummab0d51e72012-12-31 15:37:16 +05302094 .reset_reg = SATA_RESET,
2095 .reset_mask = BIT(0),
Tianyi Gou352955d2012-05-18 19:44:01 -07002096 },
2097 .c = {
2098 .dbg_name = "sata_p_clk",
2099 .ops = &clk_ops_branch,
2100 CLK_INIT(sata_p_clk.c),
2101 },
2102};
2103
2104static struct branch_clk sfab_sata_s_p_clk = {
2105 .b = {
2106 .ctl_reg = SFAB_SATA_S_HCLK_CTL_REG,
2107 .en_mask = BIT(4),
2108 .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG,
2109 .halt_bit = 14,
2110 },
2111 .c = {
2112 .dbg_name = "sfab_sata_s_p_clk",
2113 .ops = &clk_ops_branch,
2114 CLK_INIT(sfab_sata_s_p_clk.c),
2115 },
2116};
Tianyi Gou41515e22011-09-01 19:37:43 -07002117static struct branch_clk pcie_p_clk = {
2118 .b = {
2119 .ctl_reg = PCIE_HCLK_CTL_REG,
2120 .en_mask = BIT(4),
2121 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2122 .halt_bit = 8,
2123 },
2124 .c = {
2125 .dbg_name = "pcie_p_clk",
2126 .ops = &clk_ops_branch,
2127 CLK_INIT(pcie_p_clk.c),
2128 },
2129};
2130
Tianyi Gou6613de52012-01-27 17:57:53 -08002131static struct branch_clk pcie_phy_ref_clk = {
2132 .b = {
2133 .ctl_reg = PCIE_PCLK_CTL_REG,
2134 .en_mask = BIT(4),
2135 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2136 .halt_bit = 29,
2137 },
2138 .c = {
2139 .dbg_name = "pcie_phy_ref_clk",
2140 .ops = &clk_ops_branch,
2141 CLK_INIT(pcie_phy_ref_clk.c),
2142 },
2143};
2144
2145static struct branch_clk pcie_a_clk = {
2146 .b = {
2147 .ctl_reg = PCIE_ACLK_CTL_REG,
2148 .en_mask = BIT(4),
2149 .halt_reg = CLK_HALT_AFAB_SFAB_STATEA_REG,
2150 .halt_bit = 13,
2151 },
2152 .c = {
2153 .dbg_name = "pcie_a_clk",
2154 .ops = &clk_ops_branch,
2155 CLK_INIT(pcie_a_clk.c),
2156 },
2157};
2158
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002159static struct branch_clk dma_bam_p_clk = {
2160 .b = {
2161 .ctl_reg = DMA_BAM_HCLK_CTL,
2162 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002163 .hwcg_reg = DMA_BAM_HCLK_CTL,
2164 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002165 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2166 .halt_bit = 12,
2167 },
2168 .c = {
2169 .dbg_name = "dma_bam_p_clk",
2170 .ops = &clk_ops_branch,
2171 CLK_INIT(dma_bam_p_clk.c),
2172 },
2173};
2174
2175static struct branch_clk gsbi1_p_clk = {
2176 .b = {
2177 .ctl_reg = GSBIn_HCLK_CTL_REG(1),
2178 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002179 .hwcg_reg = GSBIn_HCLK_CTL_REG(1),
2180 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002181 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2182 .halt_bit = 11,
2183 },
2184 .c = {
2185 .dbg_name = "gsbi1_p_clk",
2186 .ops = &clk_ops_branch,
2187 CLK_INIT(gsbi1_p_clk.c),
2188 },
2189};
2190
2191static struct branch_clk gsbi2_p_clk = {
2192 .b = {
2193 .ctl_reg = GSBIn_HCLK_CTL_REG(2),
2194 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002195 .hwcg_reg = GSBIn_HCLK_CTL_REG(2),
2196 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002197 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2198 .halt_bit = 7,
2199 },
2200 .c = {
2201 .dbg_name = "gsbi2_p_clk",
2202 .ops = &clk_ops_branch,
2203 CLK_INIT(gsbi2_p_clk.c),
2204 },
2205};
2206
2207static struct branch_clk gsbi3_p_clk = {
2208 .b = {
2209 .ctl_reg = GSBIn_HCLK_CTL_REG(3),
2210 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002211 .hwcg_reg = GSBIn_HCLK_CTL_REG(3),
2212 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002213 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2214 .halt_bit = 3,
2215 },
2216 .c = {
2217 .dbg_name = "gsbi3_p_clk",
2218 .ops = &clk_ops_branch,
2219 CLK_INIT(gsbi3_p_clk.c),
2220 },
2221};
2222
2223static struct branch_clk gsbi4_p_clk = {
2224 .b = {
2225 .ctl_reg = GSBIn_HCLK_CTL_REG(4),
2226 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002227 .hwcg_reg = GSBIn_HCLK_CTL_REG(4),
2228 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002229 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2230 .halt_bit = 27,
2231 },
2232 .c = {
2233 .dbg_name = "gsbi4_p_clk",
2234 .ops = &clk_ops_branch,
2235 CLK_INIT(gsbi4_p_clk.c),
2236 },
2237};
2238
2239static struct branch_clk gsbi5_p_clk = {
2240 .b = {
2241 .ctl_reg = GSBIn_HCLK_CTL_REG(5),
2242 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002243 .hwcg_reg = GSBIn_HCLK_CTL_REG(5),
2244 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002245 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2246 .halt_bit = 23,
2247 },
2248 .c = {
2249 .dbg_name = "gsbi5_p_clk",
2250 .ops = &clk_ops_branch,
2251 CLK_INIT(gsbi5_p_clk.c),
2252 },
2253};
2254
2255static struct branch_clk gsbi6_p_clk = {
2256 .b = {
2257 .ctl_reg = GSBIn_HCLK_CTL_REG(6),
2258 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002259 .hwcg_reg = GSBIn_HCLK_CTL_REG(6),
2260 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002261 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2262 .halt_bit = 19,
2263 },
2264 .c = {
2265 .dbg_name = "gsbi6_p_clk",
2266 .ops = &clk_ops_branch,
2267 CLK_INIT(gsbi6_p_clk.c),
2268 },
2269};
2270
2271static struct branch_clk gsbi7_p_clk = {
2272 .b = {
2273 .ctl_reg = GSBIn_HCLK_CTL_REG(7),
2274 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002275 .hwcg_reg = GSBIn_HCLK_CTL_REG(7),
2276 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002277 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2278 .halt_bit = 15,
2279 },
2280 .c = {
2281 .dbg_name = "gsbi7_p_clk",
2282 .ops = &clk_ops_branch,
2283 CLK_INIT(gsbi7_p_clk.c),
2284 },
2285};
2286
2287static struct branch_clk gsbi8_p_clk = {
2288 .b = {
2289 .ctl_reg = GSBIn_HCLK_CTL_REG(8),
2290 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002291 .hwcg_reg = GSBIn_HCLK_CTL_REG(8),
2292 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002293 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2294 .halt_bit = 11,
2295 },
2296 .c = {
2297 .dbg_name = "gsbi8_p_clk",
2298 .ops = &clk_ops_branch,
2299 CLK_INIT(gsbi8_p_clk.c),
2300 },
2301};
2302
2303static struct branch_clk gsbi9_p_clk = {
2304 .b = {
2305 .ctl_reg = GSBIn_HCLK_CTL_REG(9),
2306 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002307 .hwcg_reg = GSBIn_HCLK_CTL_REG(9),
2308 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2310 .halt_bit = 7,
2311 },
2312 .c = {
2313 .dbg_name = "gsbi9_p_clk",
2314 .ops = &clk_ops_branch,
2315 CLK_INIT(gsbi9_p_clk.c),
2316 },
2317};
2318
2319static struct branch_clk gsbi10_p_clk = {
2320 .b = {
2321 .ctl_reg = GSBIn_HCLK_CTL_REG(10),
2322 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002323 .hwcg_reg = GSBIn_HCLK_CTL_REG(10),
2324 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002325 .halt_reg = CLK_HALT_CFPB_STATEB_REG,
2326 .halt_bit = 3,
2327 },
2328 .c = {
2329 .dbg_name = "gsbi10_p_clk",
2330 .ops = &clk_ops_branch,
2331 CLK_INIT(gsbi10_p_clk.c),
2332 },
2333};
2334
2335static struct branch_clk gsbi11_p_clk = {
2336 .b = {
2337 .ctl_reg = GSBIn_HCLK_CTL_REG(11),
2338 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002339 .hwcg_reg = GSBIn_HCLK_CTL_REG(11),
2340 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002341 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2342 .halt_bit = 18,
2343 },
2344 .c = {
2345 .dbg_name = "gsbi11_p_clk",
2346 .ops = &clk_ops_branch,
2347 CLK_INIT(gsbi11_p_clk.c),
2348 },
2349};
2350
2351static struct branch_clk gsbi12_p_clk = {
2352 .b = {
2353 .ctl_reg = GSBIn_HCLK_CTL_REG(12),
2354 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002355 .hwcg_reg = GSBIn_HCLK_CTL_REG(12),
2356 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002357 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2358 .halt_bit = 14,
2359 },
2360 .c = {
2361 .dbg_name = "gsbi12_p_clk",
2362 .ops = &clk_ops_branch,
2363 CLK_INIT(gsbi12_p_clk.c),
2364 },
2365};
2366
Tianyi Gou41515e22011-09-01 19:37:43 -07002367static struct branch_clk sata_phy_cfg_clk = {
2368 .b = {
2369 .ctl_reg = SATA_PHY_CFG_CLK_CTL_REG,
2370 .en_mask = BIT(4),
2371 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2372 .halt_bit = 12,
2373 },
2374 .c = {
2375 .dbg_name = "sata_phy_cfg_clk",
2376 .ops = &clk_ops_branch,
2377 CLK_INIT(sata_phy_cfg_clk.c),
Stephen Boyd973e4ba2011-07-12 17:06:01 -07002378 },
2379};
2380
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002381static struct branch_clk tsif_p_clk = {
2382 .b = {
2383 .ctl_reg = TSIF_HCLK_CTL_REG,
2384 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002385 .hwcg_reg = TSIF_HCLK_CTL_REG,
2386 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002387 .halt_reg = CLK_HALT_CFPB_STATEC_REG,
2388 .halt_bit = 7,
2389 },
2390 .c = {
2391 .dbg_name = "tsif_p_clk",
2392 .ops = &clk_ops_branch,
2393 CLK_INIT(tsif_p_clk.c),
2394 },
2395};
2396
2397static struct branch_clk usb_fs1_p_clk = {
2398 .b = {
2399 .ctl_reg = USB_FSn_HCLK_CTL_REG(1),
2400 .en_mask = BIT(4),
2401 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2402 .halt_bit = 17,
2403 },
2404 .c = {
2405 .dbg_name = "usb_fs1_p_clk",
2406 .ops = &clk_ops_branch,
2407 CLK_INIT(usb_fs1_p_clk.c),
2408 },
2409};
2410
2411static struct branch_clk usb_fs2_p_clk = {
2412 .b = {
2413 .ctl_reg = USB_FSn_HCLK_CTL_REG(2),
2414 .en_mask = BIT(4),
2415 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2416 .halt_bit = 14,
2417 },
2418 .c = {
2419 .dbg_name = "usb_fs2_p_clk",
2420 .ops = &clk_ops_branch,
2421 CLK_INIT(usb_fs2_p_clk.c),
2422 },
2423};
2424
2425static struct branch_clk usb_hs1_p_clk = {
2426 .b = {
2427 .ctl_reg = USB_HS1_HCLK_CTL_REG,
2428 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002429 .hwcg_reg = USB_HS1_HCLK_CTL_REG,
2430 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002431 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2432 .halt_bit = 1,
2433 },
2434 .c = {
2435 .dbg_name = "usb_hs1_p_clk",
2436 .ops = &clk_ops_branch,
2437 CLK_INIT(usb_hs1_p_clk.c),
2438 },
2439};
2440
Tianyi Gou41515e22011-09-01 19:37:43 -07002441static struct branch_clk usb_hs3_p_clk = {
2442 .b = {
2443 .ctl_reg = USB_HS3_HCLK_CTL_REG,
2444 .en_mask = BIT(4),
2445 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2446 .halt_bit = 31,
2447 },
2448 .c = {
2449 .dbg_name = "usb_hs3_p_clk",
2450 .ops = &clk_ops_branch,
2451 CLK_INIT(usb_hs3_p_clk.c),
2452 },
2453};
2454
2455static struct branch_clk usb_hs4_p_clk = {
2456 .b = {
2457 .ctl_reg = USB_HS4_HCLK_CTL_REG,
2458 .en_mask = BIT(4),
2459 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2460 .halt_bit = 7,
2461 },
2462 .c = {
2463 .dbg_name = "usb_hs4_p_clk",
2464 .ops = &clk_ops_branch,
2465 CLK_INIT(usb_hs4_p_clk.c),
2466 },
2467};
2468
Stephen Boyd94625ef2011-07-12 17:06:01 -07002469static struct branch_clk usb_hsic_p_clk = {
2470 .b = {
2471 .ctl_reg = USB_HSIC_HCLK_CTL_REG,
2472 .en_mask = BIT(4),
2473 .halt_reg = CLK_HALT_CFPB_STATEA_REG,
2474 .halt_bit = 28,
2475 },
2476 .c = {
2477 .dbg_name = "usb_hsic_p_clk",
2478 .ops = &clk_ops_branch,
2479 CLK_INIT(usb_hsic_p_clk.c),
2480 },
2481};
2482
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002483static struct branch_clk sdc1_p_clk = {
2484 .b = {
2485 .ctl_reg = SDCn_HCLK_CTL_REG(1),
2486 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002487 .hwcg_reg = SDCn_HCLK_CTL_REG(1),
2488 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002489 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2490 .halt_bit = 11,
2491 },
2492 .c = {
2493 .dbg_name = "sdc1_p_clk",
2494 .ops = &clk_ops_branch,
2495 CLK_INIT(sdc1_p_clk.c),
2496 },
2497};
2498
2499static struct branch_clk sdc2_p_clk = {
2500 .b = {
2501 .ctl_reg = SDCn_HCLK_CTL_REG(2),
2502 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002503 .hwcg_reg = SDCn_HCLK_CTL_REG(2),
2504 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002505 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2506 .halt_bit = 10,
2507 },
2508 .c = {
2509 .dbg_name = "sdc2_p_clk",
2510 .ops = &clk_ops_branch,
2511 CLK_INIT(sdc2_p_clk.c),
2512 },
2513};
2514
2515static struct branch_clk sdc3_p_clk = {
2516 .b = {
2517 .ctl_reg = SDCn_HCLK_CTL_REG(3),
2518 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002519 .hwcg_reg = SDCn_HCLK_CTL_REG(3),
2520 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002521 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2522 .halt_bit = 9,
2523 },
2524 .c = {
2525 .dbg_name = "sdc3_p_clk",
2526 .ops = &clk_ops_branch,
2527 CLK_INIT(sdc3_p_clk.c),
2528 },
2529};
2530
2531static struct branch_clk sdc4_p_clk = {
2532 .b = {
2533 .ctl_reg = SDCn_HCLK_CTL_REG(4),
2534 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002535 .hwcg_reg = SDCn_HCLK_CTL_REG(4),
2536 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002537 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2538 .halt_bit = 8,
2539 },
2540 .c = {
2541 .dbg_name = "sdc4_p_clk",
2542 .ops = &clk_ops_branch,
2543 CLK_INIT(sdc4_p_clk.c),
2544 },
2545};
2546
2547static struct branch_clk sdc5_p_clk = {
2548 .b = {
2549 .ctl_reg = SDCn_HCLK_CTL_REG(5),
2550 .en_mask = BIT(4),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002551 .hwcg_reg = SDCn_HCLK_CTL_REG(5),
2552 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002553 .halt_reg = CLK_HALT_DFAB_STATE_REG,
2554 .halt_bit = 7,
2555 },
2556 .c = {
2557 .dbg_name = "sdc5_p_clk",
2558 .ops = &clk_ops_branch,
2559 CLK_INIT(sdc5_p_clk.c),
2560 },
2561};
2562
2563/* HW-Voteable Clocks */
2564static struct branch_clk adm0_clk = {
2565 .b = {
2566 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2567 .en_mask = BIT(2),
2568 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2569 .halt_check = HALT_VOTED,
2570 .halt_bit = 14,
2571 },
2572 .c = {
2573 .dbg_name = "adm0_clk",
2574 .ops = &clk_ops_branch,
2575 CLK_INIT(adm0_clk.c),
2576 },
2577};
2578
2579static struct branch_clk adm0_p_clk = {
2580 .b = {
2581 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2582 .en_mask = BIT(3),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002583 .hwcg_reg = ADM0_PBUS_CLK_CTL_REG,
2584 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002585 .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG,
2586 .halt_check = HALT_VOTED,
2587 .halt_bit = 13,
2588 },
2589 .c = {
2590 .dbg_name = "adm0_p_clk",
2591 .ops = &clk_ops_branch,
2592 CLK_INIT(adm0_p_clk.c),
2593 },
2594};
2595
2596static struct branch_clk pmic_arb0_p_clk = {
2597 .b = {
2598 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2599 .en_mask = BIT(8),
2600 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2601 .halt_check = HALT_VOTED,
2602 .halt_bit = 22,
2603 },
2604 .c = {
2605 .dbg_name = "pmic_arb0_p_clk",
2606 .ops = &clk_ops_branch,
2607 CLK_INIT(pmic_arb0_p_clk.c),
2608 },
2609};
2610
2611static struct branch_clk pmic_arb1_p_clk = {
2612 .b = {
2613 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2614 .en_mask = BIT(9),
2615 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2616 .halt_check = HALT_VOTED,
2617 .halt_bit = 21,
2618 },
2619 .c = {
2620 .dbg_name = "pmic_arb1_p_clk",
2621 .ops = &clk_ops_branch,
2622 CLK_INIT(pmic_arb1_p_clk.c),
2623 },
2624};
2625
2626static struct branch_clk pmic_ssbi2_clk = {
2627 .b = {
2628 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2629 .en_mask = BIT(7),
2630 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2631 .halt_check = HALT_VOTED,
2632 .halt_bit = 23,
2633 },
2634 .c = {
2635 .dbg_name = "pmic_ssbi2_clk",
2636 .ops = &clk_ops_branch,
2637 CLK_INIT(pmic_ssbi2_clk.c),
2638 },
2639};
2640
2641static struct branch_clk rpm_msg_ram_p_clk = {
2642 .b = {
2643 .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG,
2644 .en_mask = BIT(6),
Stephen Boyda52d7e32011-11-10 11:59:00 -08002645 .hwcg_reg = RPM_MSG_RAM_HCLK_CTL_REG,
2646 .hwcg_mask = BIT(6),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002647 .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG,
2648 .halt_check = HALT_VOTED,
2649 .halt_bit = 12,
2650 },
2651 .c = {
2652 .dbg_name = "rpm_msg_ram_p_clk",
2653 .ops = &clk_ops_branch,
2654 CLK_INIT(rpm_msg_ram_p_clk.c),
2655 },
2656};
2657
2658/*
2659 * Multimedia Clocks
2660 */
2661
Stephen Boyd94625ef2011-07-12 17:06:01 -07002662#define CLK_CAM(name, n, hb) \
2663 struct rcg_clk name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002664 .b = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002665 .ctl_reg = CAMCLK##n##_CC_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002666 .en_mask = BIT(0), \
2667 .halt_reg = DBG_BUS_VEC_I_REG, \
2668 .halt_bit = hb, \
2669 }, \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002670 .ns_reg = CAMCLK##n##_NS_REG, \
2671 .md_reg = CAMCLK##n##_MD_REG, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002672 .root_en_mask = BIT(2), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002673 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), \
Matt Wagantall07c45472012-02-10 23:27:24 -08002674 .mnd_en_mask = BIT(5), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002675 .ctl_mask = BM(7, 6), \
2676 .set_rate = set_rate_mnd_8, \
2677 .freq_tbl = clk_tbl_cam, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002678 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002679 .c = { \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002680 .dbg_name = #name, \
Stephen Boyd409b8b42012-04-10 12:12:56 -07002681 .ops = &clk_ops_rcg, \
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002682 VDD_DIG_FMAX_MAP2(LOW, 64000000, NOMINAL, 128000000), \
Stephen Boyd94625ef2011-07-12 17:06:01 -07002683 CLK_INIT(name.c), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002684 }, \
2685 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002686#define F_CAM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002687 { \
2688 .freq_hz = f, \
2689 .src_clk = &s##_clk.c, \
2690 .md_val = MD8(8, m, 0, n), \
2691 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2692 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002693 }
2694static struct clk_freq_tbl clk_tbl_cam[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002695 F_CAM( 0, gnd, 1, 0, 0),
2696 F_CAM( 6000000, pll8, 4, 1, 16),
2697 F_CAM( 8000000, pll8, 4, 1, 12),
2698 F_CAM( 12000000, pll8, 4, 1, 8),
2699 F_CAM( 16000000, pll8, 4, 1, 6),
2700 F_CAM( 19200000, pll8, 4, 1, 5),
2701 F_CAM( 24000000, pll8, 4, 1, 4),
2702 F_CAM( 32000000, pll8, 4, 1, 3),
2703 F_CAM( 48000000, pll8, 4, 1, 2),
2704 F_CAM( 64000000, pll8, 3, 1, 2),
2705 F_CAM( 96000000, pll8, 4, 0, 0),
2706 F_CAM(128000000, pll8, 3, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002707 F_END
2708};
2709
Stephen Boyd94625ef2011-07-12 17:06:01 -07002710static CLK_CAM(cam0_clk, 0, 15);
2711static CLK_CAM(cam1_clk, 1, 16);
2712static CLK_CAM(cam2_clk, 2, 31);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002713
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002714#define F_CSI(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002715 { \
2716 .freq_hz = f, \
2717 .src_clk = &s##_clk.c, \
2718 .md_val = MD8(8, m, 0, n), \
2719 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
2720 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002721 }
2722static struct clk_freq_tbl clk_tbl_csi[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002723 F_CSI( 0, gnd, 1, 0, 0),
Stephen Boyd092fd182011-10-21 15:56:30 -07002724 F_CSI( 27000000, pxo, 1, 0, 0),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002725 F_CSI( 85330000, pll8, 1, 2, 9),
2726 F_CSI(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002727 F_END
2728};
2729
2730static struct rcg_clk csi0_src_clk = {
2731 .ns_reg = CSI0_NS_REG,
2732 .b = {
2733 .ctl_reg = CSI0_CC_REG,
2734 .halt_check = NOCHECK,
2735 },
2736 .md_reg = CSI0_MD_REG,
2737 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002738 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002739 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002740 .ctl_mask = BM(7, 6),
2741 .set_rate = set_rate_mnd,
2742 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002743 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002744 .c = {
2745 .dbg_name = "csi0_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002746 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002747 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002748 CLK_INIT(csi0_src_clk.c),
2749 },
2750};
2751
2752static struct branch_clk csi0_clk = {
2753 .b = {
2754 .ctl_reg = CSI0_CC_REG,
2755 .en_mask = BIT(0),
2756 .reset_reg = SW_RESET_CORE_REG,
2757 .reset_mask = BIT(8),
2758 .halt_reg = DBG_BUS_VEC_B_REG,
2759 .halt_bit = 13,
2760 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002761 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07002762 .parent = &csi0_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002763 .dbg_name = "csi0_clk",
2764 .ops = &clk_ops_branch,
2765 CLK_INIT(csi0_clk.c),
2766 },
2767};
2768
2769static struct branch_clk csi0_phy_clk = {
2770 .b = {
2771 .ctl_reg = CSI0_CC_REG,
2772 .en_mask = BIT(8),
2773 .reset_reg = SW_RESET_CORE_REG,
2774 .reset_mask = BIT(29),
2775 .halt_reg = DBG_BUS_VEC_I_REG,
2776 .halt_bit = 9,
2777 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002778 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07002779 .parent = &csi0_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002780 .dbg_name = "csi0_phy_clk",
2781 .ops = &clk_ops_branch,
2782 CLK_INIT(csi0_phy_clk.c),
2783 },
2784};
2785
2786static struct rcg_clk csi1_src_clk = {
2787 .ns_reg = CSI1_NS_REG,
2788 .b = {
2789 .ctl_reg = CSI1_CC_REG,
2790 .halt_check = NOCHECK,
2791 },
2792 .md_reg = CSI1_MD_REG,
2793 .root_en_mask = BIT(2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002794 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002795 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002796 .ctl_mask = BM(7, 6),
2797 .set_rate = set_rate_mnd,
2798 .freq_tbl = clk_tbl_csi,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07002799 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002800 .c = {
2801 .dbg_name = "csi1_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002802 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002803 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002804 CLK_INIT(csi1_src_clk.c),
2805 },
2806};
2807
2808static struct branch_clk csi1_clk = {
2809 .b = {
2810 .ctl_reg = CSI1_CC_REG,
2811 .en_mask = BIT(0),
2812 .reset_reg = SW_RESET_CORE_REG,
2813 .reset_mask = BIT(18),
2814 .halt_reg = DBG_BUS_VEC_B_REG,
2815 .halt_bit = 14,
2816 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002817 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07002818 .parent = &csi1_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002819 .dbg_name = "csi1_clk",
2820 .ops = &clk_ops_branch,
2821 CLK_INIT(csi1_clk.c),
2822 },
2823};
2824
2825static struct branch_clk csi1_phy_clk = {
2826 .b = {
2827 .ctl_reg = CSI1_CC_REG,
2828 .en_mask = BIT(8),
2829 .reset_reg = SW_RESET_CORE_REG,
2830 .reset_mask = BIT(28),
2831 .halt_reg = DBG_BUS_VEC_I_REG,
2832 .halt_bit = 10,
2833 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002834 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07002835 .parent = &csi1_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002836 .dbg_name = "csi1_phy_clk",
2837 .ops = &clk_ops_branch,
2838 CLK_INIT(csi1_phy_clk.c),
2839 },
2840};
2841
Stephen Boyd94625ef2011-07-12 17:06:01 -07002842static struct rcg_clk csi2_src_clk = {
2843 .ns_reg = CSI2_NS_REG,
2844 .b = {
2845 .ctl_reg = CSI2_CC_REG,
2846 .halt_check = NOCHECK,
2847 },
2848 .md_reg = CSI2_MD_REG,
2849 .root_en_mask = BIT(2),
2850 .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08002851 .mnd_en_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002852 .ctl_mask = BM(7, 6),
2853 .set_rate = set_rate_mnd,
2854 .freq_tbl = clk_tbl_csi,
2855 .current_freq = &rcg_dummy_freq,
2856 .c = {
2857 .dbg_name = "csi2_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07002858 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07002859 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Stephen Boyd94625ef2011-07-12 17:06:01 -07002860 CLK_INIT(csi2_src_clk.c),
2861 },
2862};
2863
2864static struct branch_clk csi2_clk = {
2865 .b = {
2866 .ctl_reg = CSI2_CC_REG,
2867 .en_mask = BIT(0),
2868 .reset_reg = SW_RESET_CORE2_REG,
2869 .reset_mask = BIT(2),
2870 .halt_reg = DBG_BUS_VEC_B_REG,
2871 .halt_bit = 29,
2872 },
Stephen Boyd94625ef2011-07-12 17:06:01 -07002873 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07002874 .parent = &csi2_src_clk.c,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002875 .dbg_name = "csi2_clk",
2876 .ops = &clk_ops_branch,
2877 CLK_INIT(csi2_clk.c),
2878 },
2879};
2880
2881static struct branch_clk csi2_phy_clk = {
2882 .b = {
2883 .ctl_reg = CSI2_CC_REG,
2884 .en_mask = BIT(8),
2885 .reset_reg = SW_RESET_CORE_REG,
2886 .reset_mask = BIT(31),
2887 .halt_reg = DBG_BUS_VEC_I_REG,
2888 .halt_bit = 29,
2889 },
Stephen Boyd94625ef2011-07-12 17:06:01 -07002890 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07002891 .parent = &csi2_src_clk.c,
Stephen Boyd94625ef2011-07-12 17:06:01 -07002892 .dbg_name = "csi2_phy_clk",
2893 .ops = &clk_ops_branch,
2894 CLK_INIT(csi2_phy_clk.c),
2895 },
2896};
2897
Stephen Boyd092fd182011-10-21 15:56:30 -07002898static struct clk *pix_rdi_mux_map[] = {
2899 [0] = &csi0_clk.c,
2900 [1] = &csi1_clk.c,
2901 [2] = &csi2_clk.c,
2902 NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002903};
2904
Stephen Boyd092fd182011-10-21 15:56:30 -07002905struct pix_rdi_clk {
Stephen Boydd86d1f22012-01-24 17:36:34 -08002906 bool prepared;
Stephen Boyd092fd182011-10-21 15:56:30 -07002907 bool enabled;
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002908 unsigned long cur_rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002909
2910 void __iomem *const s_reg;
2911 u32 s_mask;
2912
2913 void __iomem *const s2_reg;
2914 u32 s2_mask;
2915
2916 struct branch b;
2917 struct clk c;
2918};
2919
Matt Wagantallf82f2942012-01-27 13:56:13 -08002920static inline struct pix_rdi_clk *to_pix_rdi_clk(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07002921{
Matt Wagantallf82f2942012-01-27 13:56:13 -08002922 return container_of(c, struct pix_rdi_clk, c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002923}
2924
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07002925static int pix_rdi_clk_set_rate(struct clk *c, unsigned long rate)
Stephen Boyd092fd182011-10-21 15:56:30 -07002926{
2927 int ret, i;
2928 u32 reg;
2929 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08002930 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07002931 struct clk **mux_map = pix_rdi_mux_map;
Stephen Boydd86d1f22012-01-24 17:36:34 -08002932 unsigned long old_rate = rdi->cur_rate;
Stephen Boyd092fd182011-10-21 15:56:30 -07002933
2934 /*
2935 * These clocks select three inputs via two muxes. One mux selects
2936 * between csi0 and csi1 and the second mux selects between that mux's
2937 * output and csi2. The source and destination selections for each
2938 * mux must be clocking for the switch to succeed so just turn on
2939 * all three sources because it's easier than figuring out what source
2940 * needs to be on at what time.
2941 */
2942 for (i = 0; mux_map[i]; i++) {
Stephen Boydd86d1f22012-01-24 17:36:34 -08002943 ret = clk_prepare_enable(mux_map[i]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002944 if (ret)
2945 goto err;
2946 }
2947 if (rate >= i) {
2948 ret = -EINVAL;
2949 goto err;
2950 }
2951 /* Keep the new source on when switching inputs of an enabled clock */
Stephen Boydd86d1f22012-01-24 17:36:34 -08002952 if (rdi->prepared) {
2953 ret = clk_prepare(mux_map[rate]);
2954 if (ret)
2955 goto err;
Stephen Boyd092fd182011-10-21 15:56:30 -07002956 }
Stephen Boydd86d1f22012-01-24 17:36:34 -08002957 spin_lock_irqsave(&c->lock, flags);
2958 if (rdi->enabled) {
2959 ret = clk_enable(mux_map[rate]);
2960 if (ret) {
2961 spin_unlock_irqrestore(&c->lock, flags);
2962 clk_unprepare(mux_map[rate]);
2963 goto err;
2964 }
2965 }
2966 spin_lock(&local_clock_reg_lock);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002967 reg = readl_relaxed(rdi->s2_reg);
2968 reg &= ~rdi->s2_mask;
2969 reg |= rate == 2 ? rdi->s2_mask : 0;
2970 writel_relaxed(reg, rdi->s2_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002971 /*
2972 * Wait at least 6 cycles of slowest clock
2973 * for the glitch-free MUX to fully switch sources.
2974 */
2975 mb();
2976 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002977 reg = readl_relaxed(rdi->s_reg);
2978 reg &= ~rdi->s_mask;
2979 reg |= rate == 1 ? rdi->s_mask : 0;
2980 writel_relaxed(reg, rdi->s_reg);
Stephen Boyd092fd182011-10-21 15:56:30 -07002981 /*
2982 * Wait at least 6 cycles of slowest clock
2983 * for the glitch-free MUX to fully switch sources.
2984 */
2985 mb();
2986 udelay(1);
Matt Wagantallf82f2942012-01-27 13:56:13 -08002987 rdi->cur_rate = rate;
Saravana Kannan7a6532e2012-10-18 20:51:13 -07002988 c->parent = mux_map[rate];
Stephen Boydd86d1f22012-01-24 17:36:34 -08002989 spin_unlock(&local_clock_reg_lock);
2990
2991 if (rdi->enabled)
2992 clk_disable(mux_map[old_rate]);
2993 spin_unlock_irqrestore(&c->lock, flags);
2994 if (rdi->prepared)
2995 clk_unprepare(mux_map[old_rate]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002996err:
2997 for (i--; i >= 0; i--)
Stephen Boydd86d1f22012-01-24 17:36:34 -08002998 clk_disable_unprepare(mux_map[i]);
Stephen Boyd092fd182011-10-21 15:56:30 -07002999
3000 return 0;
3001}
3002
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07003003static unsigned long pix_rdi_clk_get_rate(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07003004{
3005 return to_pix_rdi_clk(c)->cur_rate;
3006}
3007
Stephen Boydd86d1f22012-01-24 17:36:34 -08003008static int pix_rdi_clk_prepare(struct clk *c)
3009{
3010 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
3011 rdi->prepared = true;
3012 return 0;
3013}
3014
Stephen Boyd092fd182011-10-21 15:56:30 -07003015static int pix_rdi_clk_enable(struct clk *c)
3016{
3017 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08003018 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07003019
3020 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07003021 __branch_enable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07003022 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08003023 rdi->enabled = true;
Stephen Boyd092fd182011-10-21 15:56:30 -07003024
3025 return 0;
3026}
3027
3028static void pix_rdi_clk_disable(struct clk *c)
3029{
3030 unsigned long flags;
Matt Wagantallf82f2942012-01-27 13:56:13 -08003031 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Stephen Boyd092fd182011-10-21 15:56:30 -07003032
3033 spin_lock_irqsave(&local_clock_reg_lock, flags);
Matt Wagantall0de1b3f2012-06-05 19:52:43 -07003034 __branch_disable_reg(&rdi->b, rdi->c.dbg_name);
Stephen Boyd092fd182011-10-21 15:56:30 -07003035 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
Matt Wagantallf82f2942012-01-27 13:56:13 -08003036 rdi->enabled = false;
Stephen Boyd092fd182011-10-21 15:56:30 -07003037}
3038
Stephen Boydd86d1f22012-01-24 17:36:34 -08003039static void pix_rdi_clk_unprepare(struct clk *c)
3040{
3041 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
3042 rdi->prepared = false;
3043}
3044
Matt Wagantallf82f2942012-01-27 13:56:13 -08003045static int pix_rdi_clk_reset(struct clk *c, enum clk_reset_action action)
Stephen Boyd092fd182011-10-21 15:56:30 -07003046{
Matt Wagantallf82f2942012-01-27 13:56:13 -08003047 return branch_reset(&to_pix_rdi_clk(c)->b, action);
Stephen Boyd092fd182011-10-21 15:56:30 -07003048}
3049
Stephen Boyd092fd182011-10-21 15:56:30 -07003050static int pix_rdi_clk_list_rate(struct clk *c, unsigned n)
3051{
3052 if (pix_rdi_mux_map[n])
3053 return n;
3054 return -ENXIO;
3055}
3056
Saravana Kannanc85ecf92013-01-21 17:58:35 -08003057static struct clk *pix_rdi_clk_get_parent(struct clk *c)
Stephen Boyd092fd182011-10-21 15:56:30 -07003058{
3059 u32 reg;
Matt Wagantallf82f2942012-01-27 13:56:13 -08003060 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Saravana Kannanc85ecf92013-01-21 17:58:35 -08003061
3062 reg = readl_relaxed(rdi->s_reg);
3063 rdi->cur_rate = reg & rdi->s_mask ? 1 : 0;
3064 reg = readl_relaxed(rdi->s2_reg);
3065 rdi->cur_rate = reg & rdi->s2_mask ? 2 : rdi->cur_rate;
3066
3067 return pix_rdi_mux_map[rdi->cur_rate];
3068}
3069
3070static enum handoff pix_rdi_clk_handoff(struct clk *c)
3071{
3072 struct pix_rdi_clk *rdi = to_pix_rdi_clk(c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07003073 enum handoff ret;
3074
Matt Wagantallf82f2942012-01-27 13:56:13 -08003075 ret = branch_handoff(&rdi->b, &rdi->c);
Matt Wagantalla15833b2012-04-03 11:00:56 -07003076 if (ret == HANDOFF_DISABLED_CLK)
3077 return ret;
Stephen Boyd092fd182011-10-21 15:56:30 -07003078
Saravana Kannanc85ecf92013-01-21 17:58:35 -08003079 rdi->prepared = true;
3080 rdi->enabled = true;
Matt Wagantalla15833b2012-04-03 11:00:56 -07003081 return HANDOFF_ENABLED_CLK;
Stephen Boyd092fd182011-10-21 15:56:30 -07003082}
3083
3084static struct clk_ops clk_ops_pix_rdi_8960 = {
Stephen Boydd86d1f22012-01-24 17:36:34 -08003085 .prepare = pix_rdi_clk_prepare,
Stephen Boyd092fd182011-10-21 15:56:30 -07003086 .enable = pix_rdi_clk_enable,
3087 .disable = pix_rdi_clk_disable,
Stephen Boydd86d1f22012-01-24 17:36:34 -08003088 .unprepare = pix_rdi_clk_unprepare,
Stephen Boyd092fd182011-10-21 15:56:30 -07003089 .handoff = pix_rdi_clk_handoff,
3090 .set_rate = pix_rdi_clk_set_rate,
3091 .get_rate = pix_rdi_clk_get_rate,
3092 .list_rate = pix_rdi_clk_list_rate,
3093 .reset = pix_rdi_clk_reset,
Saravana Kannanc85ecf92013-01-21 17:58:35 -08003094 .get_parent = pix_rdi_clk_get_parent,
Stephen Boyd092fd182011-10-21 15:56:30 -07003095};
3096
3097static struct pix_rdi_clk csi_pix_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003098 .b = {
3099 .ctl_reg = MISC_CC_REG,
3100 .en_mask = BIT(26),
3101 .halt_check = DELAY,
3102 .reset_reg = SW_RESET_CORE_REG,
3103 .reset_mask = BIT(26),
3104 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003105 .s_reg = MISC_CC_REG,
3106 .s_mask = BIT(25),
3107 .s2_reg = MISC_CC3_REG,
3108 .s2_mask = BIT(13),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003109 .c = {
3110 .dbg_name = "csi_pix_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003111 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003112 CLK_INIT(csi_pix_clk.c),
3113 },
3114};
3115
Stephen Boyd092fd182011-10-21 15:56:30 -07003116static struct pix_rdi_clk csi_pix1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003117 .b = {
3118 .ctl_reg = MISC_CC3_REG,
3119 .en_mask = BIT(10),
3120 .halt_check = DELAY,
3121 .reset_reg = SW_RESET_CORE_REG,
3122 .reset_mask = BIT(30),
3123 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003124 .s_reg = MISC_CC3_REG,
3125 .s_mask = BIT(8),
3126 .s2_reg = MISC_CC3_REG,
3127 .s2_mask = BIT(9),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003128 .c = {
3129 .dbg_name = "csi_pix1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003130 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003131 CLK_INIT(csi_pix1_clk.c),
3132 },
3133};
3134
Stephen Boyd092fd182011-10-21 15:56:30 -07003135static struct pix_rdi_clk csi_rdi_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003136 .b = {
3137 .ctl_reg = MISC_CC_REG,
3138 .en_mask = BIT(13),
3139 .halt_check = DELAY,
3140 .reset_reg = SW_RESET_CORE_REG,
3141 .reset_mask = BIT(27),
3142 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003143 .s_reg = MISC_CC_REG,
3144 .s_mask = BIT(12),
3145 .s2_reg = MISC_CC3_REG,
3146 .s2_mask = BIT(12),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003147 .c = {
3148 .dbg_name = "csi_rdi_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003149 .ops = &clk_ops_pix_rdi_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003150 CLK_INIT(csi_rdi_clk.c),
3151 },
3152};
3153
Stephen Boyd092fd182011-10-21 15:56:30 -07003154static struct pix_rdi_clk csi_rdi1_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003155 .b = {
3156 .ctl_reg = MISC_CC3_REG,
3157 .en_mask = BIT(2),
3158 .halt_check = DELAY,
3159 .reset_reg = SW_RESET_CORE2_REG,
3160 .reset_mask = BIT(1),
3161 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003162 .s_reg = MISC_CC3_REG,
3163 .s_mask = BIT(0),
3164 .s2_reg = MISC_CC3_REG,
3165 .s2_mask = BIT(1),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003166 .c = {
3167 .dbg_name = "csi_rdi1_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003168 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003169 CLK_INIT(csi_rdi1_clk.c),
3170 },
3171};
3172
Stephen Boyd092fd182011-10-21 15:56:30 -07003173static struct pix_rdi_clk csi_rdi2_clk = {
Stephen Boyd94625ef2011-07-12 17:06:01 -07003174 .b = {
3175 .ctl_reg = MISC_CC3_REG,
3176 .en_mask = BIT(6),
3177 .halt_check = DELAY,
3178 .reset_reg = SW_RESET_CORE2_REG,
3179 .reset_mask = BIT(0),
3180 },
Stephen Boyd092fd182011-10-21 15:56:30 -07003181 .s_reg = MISC_CC3_REG,
3182 .s_mask = BIT(4),
3183 .s2_reg = MISC_CC3_REG,
3184 .s2_mask = BIT(5),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003185 .c = {
3186 .dbg_name = "csi_rdi2_clk",
Stephen Boyd092fd182011-10-21 15:56:30 -07003187 .ops = &clk_ops_pix_rdi_8960,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003188 CLK_INIT(csi_rdi2_clk.c),
3189 },
3190};
3191
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003192#define F_CSI_PHYTIMER(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003193 { \
3194 .freq_hz = f, \
3195 .src_clk = &s##_clk.c, \
3196 .md_val = MD8(8, m, 0, n), \
3197 .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
3198 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003199 }
3200static struct clk_freq_tbl clk_tbl_csi_phytimer[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003201 F_CSI_PHYTIMER( 0, gnd, 1, 0, 0),
3202 F_CSI_PHYTIMER( 85330000, pll8, 1, 2, 9),
3203 F_CSI_PHYTIMER(177780000, pll2, 1, 2, 9),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003204 F_END
3205};
3206
3207static struct rcg_clk csiphy_timer_src_clk = {
3208 .ns_reg = CSIPHYTIMER_NS_REG,
3209 .b = {
3210 .ctl_reg = CSIPHYTIMER_CC_REG,
3211 .halt_check = NOCHECK,
3212 },
3213 .md_reg = CSIPHYTIMER_MD_REG,
3214 .root_en_mask = BIT(2),
3215 .ns_mask = (BM(31, 24) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003216 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003217 .ctl_mask = BM(7, 6),
3218 .set_rate = set_rate_mnd_8,
3219 .freq_tbl = clk_tbl_csi_phytimer,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003220 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003221 .c = {
3222 .dbg_name = "csiphy_timer_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003223 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003224 VDD_DIG_FMAX_MAP2(LOW, 86000000, NOMINAL, 178000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003225 CLK_INIT(csiphy_timer_src_clk.c),
3226 },
3227};
3228
3229static struct branch_clk csi0phy_timer_clk = {
3230 .b = {
3231 .ctl_reg = CSIPHYTIMER_CC_REG,
3232 .en_mask = BIT(0),
3233 .halt_reg = DBG_BUS_VEC_I_REG,
3234 .halt_bit = 17,
3235 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003236 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07003237 .parent = &csiphy_timer_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003238 .dbg_name = "csi0phy_timer_clk",
3239 .ops = &clk_ops_branch,
3240 CLK_INIT(csi0phy_timer_clk.c),
3241 },
3242};
3243
3244static struct branch_clk csi1phy_timer_clk = {
3245 .b = {
3246 .ctl_reg = CSIPHYTIMER_CC_REG,
3247 .en_mask = BIT(9),
3248 .halt_reg = DBG_BUS_VEC_I_REG,
3249 .halt_bit = 18,
3250 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003251 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07003252 .parent = &csiphy_timer_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003253 .dbg_name = "csi1phy_timer_clk",
3254 .ops = &clk_ops_branch,
3255 CLK_INIT(csi1phy_timer_clk.c),
3256 },
3257};
3258
Stephen Boyd94625ef2011-07-12 17:06:01 -07003259static struct branch_clk csi2phy_timer_clk = {
3260 .b = {
3261 .ctl_reg = CSIPHYTIMER_CC_REG,
3262 .en_mask = BIT(11),
3263 .halt_reg = DBG_BUS_VEC_I_REG,
3264 .halt_bit = 30,
3265 },
Stephen Boyd94625ef2011-07-12 17:06:01 -07003266 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07003267 .parent = &csiphy_timer_src_clk.c,
Stephen Boyd94625ef2011-07-12 17:06:01 -07003268 .dbg_name = "csi2phy_timer_clk",
3269 .ops = &clk_ops_branch,
3270 CLK_INIT(csi2phy_timer_clk.c),
3271 },
3272};
3273
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003274#define F_DSI(d) \
3275 { \
3276 .freq_hz = d, \
3277 .ns_val = BVAL(15, 12, (d-1)), \
3278 }
3279/*
3280 * The DSI_BYTE/ESC clock is sourced from the DSI PHY PLL, which may change rate
3281 * without this clock driver knowing. So, overload the clk_set_rate() to set
3282 * the divider (1 to 16) of the clock with respect to the PLL rate.
3283 */
3284static struct clk_freq_tbl clk_tbl_dsi_byte[] = {
3285 F_DSI(1), F_DSI(2), F_DSI(3), F_DSI(4),
3286 F_DSI(5), F_DSI(6), F_DSI(7), F_DSI(8),
3287 F_DSI(9), F_DSI(10), F_DSI(11), F_DSI(12),
3288 F_DSI(13), F_DSI(14), F_DSI(15), F_DSI(16),
3289 F_END
3290};
3291
Matt Wagantall735e41b2012-07-23 17:18:58 -07003292static struct branch_clk dsi1_reset_clk = {
3293 .b = {
3294 .reset_reg = SW_RESET_CORE_REG,
3295 .reset_mask = BIT(7),
3296 .halt_check = NOCHECK,
3297 },
3298 .c = {
3299 .dbg_name = "dsi1_reset_clk",
3300 .ops = &clk_ops_branch,
3301 CLK_INIT(dsi1_reset_clk.c),
3302 },
3303};
3304
3305static struct branch_clk dsi2_reset_clk = {
3306 .b = {
3307 .reset_reg = SW_RESET_CORE_REG,
3308 .reset_mask = BIT(25),
3309 .halt_check = NOCHECK,
3310 },
3311 .c = {
3312 .dbg_name = "dsi2_reset_clk",
3313 .ops = &clk_ops_branch,
3314 CLK_INIT(dsi2_reset_clk.c),
3315 },
3316};
3317
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003318static struct rcg_clk dsi1_byte_clk = {
3319 .b = {
3320 .ctl_reg = DSI1_BYTE_CC_REG,
3321 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003322 .halt_reg = DBG_BUS_VEC_B_REG,
3323 .halt_bit = 21,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003324 .retain_reg = DSI1_BYTE_CC_REG,
3325 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003326 },
3327 .ns_reg = DSI1_BYTE_NS_REG,
3328 .root_en_mask = BIT(2),
3329 .ns_mask = BM(15, 12),
3330 .set_rate = set_rate_nop,
3331 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003332 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003333 .c = {
3334 .dbg_name = "dsi1_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003335 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003336 CLK_INIT(dsi1_byte_clk.c),
3337 },
3338};
3339
3340static struct rcg_clk dsi2_byte_clk = {
3341 .b = {
3342 .ctl_reg = DSI2_BYTE_CC_REG,
3343 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003344 .halt_reg = DBG_BUS_VEC_B_REG,
3345 .halt_bit = 20,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003346 .retain_reg = DSI2_BYTE_CC_REG,
3347 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003348 },
3349 .ns_reg = DSI2_BYTE_NS_REG,
3350 .root_en_mask = BIT(2),
3351 .ns_mask = BM(15, 12),
3352 .set_rate = set_rate_nop,
3353 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003354 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003355 .c = {
3356 .dbg_name = "dsi2_byte_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003357 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003358 CLK_INIT(dsi2_byte_clk.c),
3359 },
3360};
3361
3362static struct rcg_clk dsi1_esc_clk = {
3363 .b = {
3364 .ctl_reg = DSI1_ESC_CC_REG,
3365 .en_mask = BIT(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003366 .halt_reg = DBG_BUS_VEC_I_REG,
3367 .halt_bit = 1,
3368 },
3369 .ns_reg = DSI1_ESC_NS_REG,
3370 .root_en_mask = BIT(2),
3371 .ns_mask = BM(15, 12),
3372 .set_rate = set_rate_nop,
3373 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003374 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003375 .c = {
3376 .dbg_name = "dsi1_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003377 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003378 CLK_INIT(dsi1_esc_clk.c),
3379 },
3380};
3381
3382static struct rcg_clk dsi2_esc_clk = {
3383 .b = {
3384 .ctl_reg = DSI2_ESC_CC_REG,
3385 .en_mask = BIT(0),
3386 .halt_reg = DBG_BUS_VEC_I_REG,
3387 .halt_bit = 3,
3388 },
3389 .ns_reg = DSI2_ESC_NS_REG,
3390 .root_en_mask = BIT(2),
3391 .ns_mask = BM(15, 12),
3392 .set_rate = set_rate_nop,
3393 .freq_tbl = clk_tbl_dsi_byte,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003394 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003395 .c = {
3396 .dbg_name = "dsi2_esc_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003397 .ops = &clk_ops_rcg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003398 CLK_INIT(dsi2_esc_clk.c),
3399 },
3400};
3401
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003402#define F_GFX2D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003403 { \
3404 .freq_hz = f, \
3405 .src_clk = &s##_clk.c, \
3406 .md_val = MD4(4, m, 0, n), \
3407 .ns_val = NS_MND_BANKED4(20, 16, n, m, 3, 0, s##_to_mm_mux), \
3408 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003409 }
3410static struct clk_freq_tbl clk_tbl_gfx2d[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003411 F_GFX2D( 0, gnd, 0, 0),
3412 F_GFX2D( 27000000, pxo, 0, 0),
3413 F_GFX2D( 48000000, pll8, 1, 8),
3414 F_GFX2D( 54857000, pll8, 1, 7),
3415 F_GFX2D( 64000000, pll8, 1, 6),
3416 F_GFX2D( 76800000, pll8, 1, 5),
3417 F_GFX2D( 96000000, pll8, 1, 4),
3418 F_GFX2D(128000000, pll8, 1, 3),
3419 F_GFX2D(145455000, pll2, 2, 11),
3420 F_GFX2D(160000000, pll2, 1, 5),
3421 F_GFX2D(177778000, pll2, 2, 9),
3422 F_GFX2D(200000000, pll2, 1, 4),
3423 F_GFX2D(228571000, pll2, 2, 7),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003424 F_END
3425};
3426
3427static struct bank_masks bmnd_info_gfx2d0 = {
3428 .bank_sel_mask = BIT(11),
3429 .bank0_mask = {
3430 .md_reg = GFX2D0_MD0_REG,
3431 .ns_mask = BM(23, 20) | BM(5, 3),
3432 .rst_mask = BIT(25),
3433 .mnd_en_mask = BIT(8),
3434 .mode_mask = BM(10, 9),
3435 },
3436 .bank1_mask = {
3437 .md_reg = GFX2D0_MD1_REG,
3438 .ns_mask = BM(19, 16) | BM(2, 0),
3439 .rst_mask = BIT(24),
3440 .mnd_en_mask = BIT(5),
3441 .mode_mask = BM(7, 6),
3442 },
3443};
3444
3445static struct rcg_clk gfx2d0_clk = {
3446 .b = {
3447 .ctl_reg = GFX2D0_CC_REG,
3448 .en_mask = BIT(0),
3449 .reset_reg = SW_RESET_CORE_REG,
3450 .reset_mask = BIT(14),
3451 .halt_reg = DBG_BUS_VEC_A_REG,
3452 .halt_bit = 9,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003453 .retain_reg = GFX2D0_CC_REG,
3454 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003455 },
3456 .ns_reg = GFX2D0_NS_REG,
3457 .root_en_mask = BIT(2),
3458 .set_rate = set_rate_mnd_banked,
3459 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003460 .bank_info = &bmnd_info_gfx2d0,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003461 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003462 .c = {
3463 .dbg_name = "gfx2d0_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003464 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003465 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003466 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3467 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003468 CLK_INIT(gfx2d0_clk.c),
3469 },
3470};
3471
3472static struct bank_masks bmnd_info_gfx2d1 = {
3473 .bank_sel_mask = BIT(11),
3474 .bank0_mask = {
3475 .md_reg = GFX2D1_MD0_REG,
3476 .ns_mask = BM(23, 20) | BM(5, 3),
3477 .rst_mask = BIT(25),
3478 .mnd_en_mask = BIT(8),
3479 .mode_mask = BM(10, 9),
3480 },
3481 .bank1_mask = {
3482 .md_reg = GFX2D1_MD1_REG,
3483 .ns_mask = BM(19, 16) | BM(2, 0),
3484 .rst_mask = BIT(24),
3485 .mnd_en_mask = BIT(5),
3486 .mode_mask = BM(7, 6),
3487 },
3488};
3489
3490static struct rcg_clk gfx2d1_clk = {
3491 .b = {
3492 .ctl_reg = GFX2D1_CC_REG,
3493 .en_mask = BIT(0),
3494 .reset_reg = SW_RESET_CORE_REG,
3495 .reset_mask = BIT(13),
3496 .halt_reg = DBG_BUS_VEC_A_REG,
3497 .halt_bit = 14,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003498 .retain_reg = GFX2D1_CC_REG,
3499 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003500 },
3501 .ns_reg = GFX2D1_NS_REG,
3502 .root_en_mask = BIT(2),
3503 .set_rate = set_rate_mnd_banked,
3504 .freq_tbl = clk_tbl_gfx2d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003505 .bank_info = &bmnd_info_gfx2d1,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003506 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003507 .c = {
3508 .dbg_name = "gfx2d1_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003509 .ops = &clk_ops_rcg,
Matt Wagantall158f73b2012-05-16 11:29:35 -07003510 .flags = CLKFLAG_SKIP_HANDOFF,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003511 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
3512 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003513 CLK_INIT(gfx2d1_clk.c),
3514 },
3515};
3516
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003517#define F_GFX3D(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003518 { \
3519 .freq_hz = f, \
3520 .src_clk = &s##_clk.c, \
3521 .md_val = MD4(4, m, 0, n), \
3522 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3523 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003524 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003525
Patrick Dalyaa614562013-01-23 16:39:45 -08003526/*Shared by 8064, and 8930*/
Patrick Daly2c09c4c2012-10-25 19:47:56 -07003527static struct clk_freq_tbl clk_tbl_gfx3d[] = {
3528 F_GFX3D( 0, gnd, 0, 0),
3529 F_GFX3D( 27000000, pxo, 0, 0),
3530 F_GFX3D( 48000000, pll8, 1, 8),
3531 F_GFX3D( 54857000, pll8, 1, 7),
3532 F_GFX3D( 64000000, pll8, 1, 6),
3533 F_GFX3D( 76800000, pll8, 1, 5),
3534 F_GFX3D( 96000000, pll8, 1, 4),
3535 F_GFX3D(128000000, pll8, 1, 3),
3536 F_GFX3D(145455000, pll2, 2, 11),
3537 F_GFX3D(160000000, pll2, 1, 5),
3538 F_GFX3D(177778000, pll2, 2, 9),
3539 F_GFX3D(192000000, pll8, 1, 2),
3540 F_GFX3D(200000000, pll2, 1, 4),
3541 F_GFX3D(228571000, pll2, 2, 7),
3542 F_GFX3D(266667000, pll2, 1, 3),
3543 F_GFX3D(320000000, pll2, 2, 5),
3544 F_GFX3D(400000000, pll2, 1, 2),
3545 F_GFX3D(450000000, pll15, 1, 2),
Patrick Dalye6f489042012-07-11 15:29:15 -07003546 F_END
3547};
3548
Patrick Dalyaa614562013-01-23 16:39:45 -08003549static struct clk_freq_tbl clk_tbl_gfx3d_8960ab[] = {
3550 F_GFX3D( 0, gnd, 0, 0),
3551 F_GFX3D( 27000000, pxo, 0, 0),
3552 F_GFX3D( 48000000, pll8, 1, 8),
3553 F_GFX3D( 54857000, pll8, 1, 7),
3554 F_GFX3D( 64000000, pll8, 1, 6),
3555 F_GFX3D( 76800000, pll8, 1, 5),
3556 F_GFX3D( 96000000, pll8, 1, 4),
3557 F_GFX3D(128000000, pll8, 1, 3),
3558 F_GFX3D(145455000, pll2, 2, 11),
3559 F_GFX3D(160000000, pll2, 1, 5),
3560 F_GFX3D(177778000, pll2, 2, 9),
3561 F_GFX3D(192000000, pll8, 1, 2),
3562 F_GFX3D(200000000, pll2, 1, 4),
3563 F_GFX3D(228571000, pll2, 2, 7),
3564 F_GFX3D(266667000, pll2, 1, 3),
3565 F_GFX3D(320000000, pll2, 2, 5),
3566 F_GFX3D(400000000, pll2, 1, 2),
3567 F_GFX3D(440000000, pll3, 1, 2),
3568 F_END
3569};
3570
Tianyi Gou41515e22011-09-01 19:37:43 -07003571static struct clk_freq_tbl clk_tbl_gfx3d_8960[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003572 F_GFX3D( 0, gnd, 0, 0),
3573 F_GFX3D( 27000000, pxo, 0, 0),
3574 F_GFX3D( 48000000, pll8, 1, 8),
3575 F_GFX3D( 54857000, pll8, 1, 7),
3576 F_GFX3D( 64000000, pll8, 1, 6),
3577 F_GFX3D( 76800000, pll8, 1, 5),
3578 F_GFX3D( 96000000, pll8, 1, 4),
3579 F_GFX3D(128000000, pll8, 1, 3),
3580 F_GFX3D(145455000, pll2, 2, 11),
3581 F_GFX3D(160000000, pll2, 1, 5),
3582 F_GFX3D(177778000, pll2, 2, 9),
3583 F_GFX3D(200000000, pll2, 1, 4),
3584 F_GFX3D(228571000, pll2, 2, 7),
3585 F_GFX3D(266667000, pll2, 1, 3),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003586 F_GFX3D(300000000, pll3, 1, 4),
3587 F_GFX3D(320000000, pll2, 2, 5),
3588 F_GFX3D(400000000, pll2, 1, 2),
Stephen Boyd94625ef2011-07-12 17:06:01 -07003589 F_END
3590};
3591
Seemanta Dutta4dc17082012-10-24 18:37:42 -07003592static struct clk_freq_tbl clk_tbl_gfx3d_8930ab[] = {
3593 F_GFX3D( 0, gnd, 0, 0),
3594 F_GFX3D( 27000000, pxo, 0, 0),
3595 F_GFX3D( 48000000, pll8, 1, 8),
3596 F_GFX3D( 54857000, pll8, 1, 7),
3597 F_GFX3D( 64000000, pll8, 1, 6),
3598 F_GFX3D( 76800000, pll8, 1, 5),
3599 F_GFX3D( 96000000, pll8, 1, 4),
3600 F_GFX3D(128000000, pll8, 1, 3),
3601 F_GFX3D(145455000, pll2, 2, 11),
3602 F_GFX3D(160000000, pll2, 1, 5),
3603 F_GFX3D(177778000, pll2, 2, 9),
3604 F_GFX3D(192000000, pll8, 1, 2),
3605 F_GFX3D(200000000, pll2, 1, 4),
3606 F_GFX3D(228571000, pll2, 2, 7),
3607 F_GFX3D(266667000, pll2, 1, 3),
3608 F_GFX3D(320000000, pll2, 2, 5),
3609 F_GFX3D(400000000, pll2, 1, 2),
3610 F_GFX3D(500000000, pll15, 1, 2),
3611 F_END
3612};
3613
Saravana Kannan55e959d2012-10-15 22:16:04 -07003614static unsigned long fmax_gfx3d_8064ab[VDD_DIG_NUM] = {
Patrick Dalyb7c777a2012-08-23 19:07:30 -07003615 [VDD_DIG_LOW] = 128000000,
3616 [VDD_DIG_NOMINAL] = 325000000,
3617 [VDD_DIG_HIGH] = 450000000
3618};
3619
Saravana Kannan55e959d2012-10-15 22:16:04 -07003620static unsigned long fmax_gfx3d_8064[VDD_DIG_NUM] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003621 [VDD_DIG_LOW] = 128000000,
3622 [VDD_DIG_NOMINAL] = 325000000,
3623 [VDD_DIG_HIGH] = 400000000
3624};
3625
Saravana Kannan55e959d2012-10-15 22:16:04 -07003626static unsigned long fmax_gfx3d_8930[VDD_DIG_NUM] = {
Tianyi Gou4d33c9c2012-03-30 11:10:15 -07003627 [VDD_DIG_LOW] = 192000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003628 [VDD_DIG_NOMINAL] = 320000000,
Patrick Dalyebe63c52012-08-07 15:41:30 -07003629 [VDD_DIG_HIGH] = 400000000
3630};
3631
Saravana Kannan55e959d2012-10-15 22:16:04 -07003632static unsigned long fmax_gfx3d_8930aa[VDD_DIG_NUM] = {
Patrick Dalyebe63c52012-08-07 15:41:30 -07003633 [VDD_DIG_LOW] = 192000000,
3634 [VDD_DIG_NOMINAL] = 320000000,
Tianyi Goue3d4f542012-03-15 17:06:45 -07003635 [VDD_DIG_HIGH] = 450000000
3636};
3637
Seemanta Dutta4dc17082012-10-24 18:37:42 -07003638static unsigned long fmax_gfx3d_8930ab[VDD_DIG_NUM] = {
3639 [VDD_DIG_LOW] = 192000000,
3640 [VDD_DIG_NOMINAL] = 320000000,
3641 [VDD_DIG_HIGH] = 500000000
3642};
3643
Patrick Dalyaa614562013-01-23 16:39:45 -08003644static unsigned long fmax_gfx3d_8960ab_400[VDD_DIG_NUM] = {
Patrick Daly6e034322012-10-26 18:18:32 -07003645 [VDD_DIG_LOW] = 192000000,
3646 [VDD_DIG_NOMINAL] = 325000000,
3647 [VDD_DIG_HIGH] = 400000000
3648};
3649
Patrick Dalyaa614562013-01-23 16:39:45 -08003650static unsigned long fmax_gfx3d_8960ab_440[VDD_DIG_NUM] = {
3651 [VDD_DIG_LOW] = 192000000,
3652 [VDD_DIG_NOMINAL] = 325000000,
3653 [VDD_DIG_HIGH] = 440000000
3654};
3655
3656static unsigned long *fmax_gfx3d_8960ab[] = {
3657 [0] = fmax_gfx3d_8960ab_400,
3658 [1] = fmax_gfx3d_8960ab_440,
3659};
3660
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003661static struct bank_masks bmnd_info_gfx3d = {
3662 .bank_sel_mask = BIT(11),
3663 .bank0_mask = {
3664 .md_reg = GFX3D_MD0_REG,
3665 .ns_mask = BM(21, 18) | BM(5, 3),
3666 .rst_mask = BIT(23),
3667 .mnd_en_mask = BIT(8),
3668 .mode_mask = BM(10, 9),
3669 },
3670 .bank1_mask = {
3671 .md_reg = GFX3D_MD1_REG,
3672 .ns_mask = BM(17, 14) | BM(2, 0),
3673 .rst_mask = BIT(22),
3674 .mnd_en_mask = BIT(5),
3675 .mode_mask = BM(7, 6),
3676 },
3677};
3678
3679static struct rcg_clk gfx3d_clk = {
3680 .b = {
3681 .ctl_reg = GFX3D_CC_REG,
3682 .en_mask = BIT(0),
3683 .reset_reg = SW_RESET_CORE_REG,
3684 .reset_mask = BIT(12),
3685 .halt_reg = DBG_BUS_VEC_A_REG,
3686 .halt_bit = 4,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003687 .retain_reg = GFX3D_CC_REG,
3688 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003689 },
3690 .ns_reg = GFX3D_NS_REG,
3691 .root_en_mask = BIT(2),
3692 .set_rate = set_rate_mnd_banked,
Patrick Daly2c09c4c2012-10-25 19:47:56 -07003693 .freq_tbl = clk_tbl_gfx3d,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003694 .bank_info = &bmnd_info_gfx3d,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003695 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003696 .c = {
3697 .dbg_name = "gfx3d_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003698 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003699 VDD_DIG_FMAX_MAP3(LOW, 128000000, NOMINAL, 300000000,
3700 HIGH, 400000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003701 CLK_INIT(gfx3d_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003702 .depends = &gmem_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003703 },
3704};
3705
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003706#define F_VCAP(f, s, m, n) \
Tianyi Gou621f8742011-09-01 21:45:01 -07003707 { \
3708 .freq_hz = f, \
3709 .src_clk = &s##_clk.c, \
3710 .md_val = MD4(4, m, 0, n), \
3711 .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \
3712 .ctl_val = CC_BANKED(9, 6, n), \
Tianyi Gou621f8742011-09-01 21:45:01 -07003713 }
3714
3715static struct clk_freq_tbl clk_tbl_vcap[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003716 F_VCAP( 0, gnd, 0, 0),
3717 F_VCAP( 27000000, pxo, 0, 0),
3718 F_VCAP( 54860000, pll8, 1, 7),
3719 F_VCAP( 64000000, pll8, 1, 6),
3720 F_VCAP( 76800000, pll8, 1, 5),
3721 F_VCAP(128000000, pll8, 1, 3),
3722 F_VCAP(160000000, pll2, 1, 5),
3723 F_VCAP(200000000, pll2, 1, 4),
Tianyi Gou621f8742011-09-01 21:45:01 -07003724 F_END
3725};
3726
3727static struct bank_masks bmnd_info_vcap = {
3728 .bank_sel_mask = BIT(11),
3729 .bank0_mask = {
3730 .md_reg = VCAP_MD0_REG,
3731 .ns_mask = BM(21, 18) | BM(5, 3),
3732 .rst_mask = BIT(23),
3733 .mnd_en_mask = BIT(8),
3734 .mode_mask = BM(10, 9),
3735 },
3736 .bank1_mask = {
3737 .md_reg = VCAP_MD1_REG,
3738 .ns_mask = BM(17, 14) | BM(2, 0),
3739 .rst_mask = BIT(22),
3740 .mnd_en_mask = BIT(5),
3741 .mode_mask = BM(7, 6),
3742 },
3743};
3744
3745static struct rcg_clk vcap_clk = {
3746 .b = {
3747 .ctl_reg = VCAP_CC_REG,
3748 .en_mask = BIT(0),
3749 .halt_reg = DBG_BUS_VEC_J_REG,
3750 .halt_bit = 15,
3751 },
3752 .ns_reg = VCAP_NS_REG,
3753 .root_en_mask = BIT(2),
3754 .set_rate = set_rate_mnd_banked,
3755 .freq_tbl = clk_tbl_vcap,
3756 .bank_info = &bmnd_info_vcap,
3757 .current_freq = &rcg_dummy_freq,
3758 .c = {
3759 .dbg_name = "vcap_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003760 .ops = &clk_ops_rcg,
Tianyi Gou621f8742011-09-01 21:45:01 -07003761 .depends = &vcap_axi_clk.c,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003762 VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000),
Tianyi Gou621f8742011-09-01 21:45:01 -07003763 CLK_INIT(vcap_clk.c),
3764 },
3765};
3766
3767static struct branch_clk vcap_npl_clk = {
3768 .b = {
3769 .ctl_reg = VCAP_CC_REG,
3770 .en_mask = BIT(13),
3771 .halt_reg = DBG_BUS_VEC_J_REG,
3772 .halt_bit = 25,
3773 },
Tianyi Gou621f8742011-09-01 21:45:01 -07003774 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07003775 .parent = &vcap_clk.c,
Tianyi Gou621f8742011-09-01 21:45:01 -07003776 .dbg_name = "vcap_npl_clk",
3777 .ops = &clk_ops_branch,
3778 CLK_INIT(vcap_npl_clk.c),
3779 },
3780};
3781
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003782#define F_IJPEG(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003783 { \
3784 .freq_hz = f, \
3785 .src_clk = &s##_clk.c, \
3786 .md_val = MD8(8, m, 0, n), \
3787 .ns_val = NS_MM(23, 16, n, m, 15, 12, d, 2, 0, s##_to_mm_mux), \
3788 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003789 }
Tianyi Gou41515e22011-09-01 19:37:43 -07003790
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003791static struct clk_freq_tbl clk_tbl_ijpeg[] = {
3792 F_IJPEG( 0, gnd, 1, 0, 0),
3793 F_IJPEG( 27000000, pxo, 1, 0, 0),
3794 F_IJPEG( 36570000, pll8, 1, 2, 21),
3795 F_IJPEG( 54860000, pll8, 7, 0, 0),
3796 F_IJPEG( 96000000, pll8, 4, 0, 0),
3797 F_IJPEG(109710000, pll8, 1, 2, 7),
3798 F_IJPEG(128000000, pll8, 3, 0, 0),
3799 F_IJPEG(153600000, pll8, 1, 2, 5),
3800 F_IJPEG(200000000, pll2, 4, 0, 0),
3801 F_IJPEG(228571000, pll2, 1, 2, 7),
3802 F_IJPEG(266667000, pll2, 1, 1, 3),
3803 F_IJPEG(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003804 F_END
3805};
3806
Saravana Kannan55e959d2012-10-15 22:16:04 -07003807static unsigned long fmax_ijpeg_8064[VDD_DIG_NUM] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003808 [VDD_DIG_LOW] = 128000000,
3809 [VDD_DIG_NOMINAL] = 266667000,
3810 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07003811};
3812
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003813static struct rcg_clk ijpeg_clk = {
3814 .b = {
3815 .ctl_reg = IJPEG_CC_REG,
3816 .en_mask = BIT(0),
3817 .reset_reg = SW_RESET_CORE_REG,
3818 .reset_mask = BIT(9),
3819 .halt_reg = DBG_BUS_VEC_A_REG,
3820 .halt_bit = 24,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003821 .retain_reg = IJPEG_CC_REG,
3822 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003823 },
3824 .ns_reg = IJPEG_NS_REG,
3825 .md_reg = IJPEG_MD_REG,
3826 .root_en_mask = BIT(2),
3827 .ns_mask = (BM(23, 16) | BM(15, 12) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08003828 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003829 .ctl_mask = BM(7, 6),
3830 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003831 .freq_tbl = clk_tbl_ijpeg,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003832 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003833 .c = {
3834 .dbg_name = "ijpeg_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003835 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08003836 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
3837 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003838 CLK_INIT(ijpeg_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003839 .depends = &ijpeg_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003840 },
3841};
3842
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003843#define F_JPEGD(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003844 { \
3845 .freq_hz = f, \
3846 .src_clk = &s##_clk.c, \
3847 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003848 }
3849static struct clk_freq_tbl clk_tbl_jpegd[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003850 F_JPEGD( 0, gnd, 1),
3851 F_JPEGD( 64000000, pll8, 6),
3852 F_JPEGD( 76800000, pll8, 5),
3853 F_JPEGD( 96000000, pll8, 4),
3854 F_JPEGD(160000000, pll2, 5),
3855 F_JPEGD(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003856 F_END
3857};
3858
3859static struct rcg_clk jpegd_clk = {
3860 .b = {
3861 .ctl_reg = JPEGD_CC_REG,
3862 .en_mask = BIT(0),
3863 .reset_reg = SW_RESET_CORE_REG,
3864 .reset_mask = BIT(19),
3865 .halt_reg = DBG_BUS_VEC_A_REG,
3866 .halt_bit = 19,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003867 .retain_reg = JPEGD_CC_REG,
3868 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003869 },
3870 .ns_reg = JPEGD_NS_REG,
3871 .root_en_mask = BIT(2),
3872 .ns_mask = (BM(15, 12) | BM(2, 0)),
3873 .set_rate = set_rate_nop,
3874 .freq_tbl = clk_tbl_jpegd,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003875 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003876 .c = {
3877 .dbg_name = "jpegd_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003878 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003879 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003880 CLK_INIT(jpegd_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003881 .depends = &jpegd_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003882 },
3883};
3884
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003885#define F_MDP(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003886 { \
3887 .freq_hz = f, \
3888 .src_clk = &s##_clk.c, \
3889 .md_val = MD8(8, m, 0, n), \
3890 .ns_val = NS_MND_BANKED8(22, 14, n, m, 3, 0, s##_to_mm_mux), \
3891 .ctl_val = CC_BANKED(9, 6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003892 }
Patrick Dalye6f489042012-07-11 15:29:15 -07003893
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003894static struct clk_freq_tbl clk_tbl_mdp[] = {
3895 F_MDP( 0, gnd, 0, 0),
3896 F_MDP( 9600000, pll8, 1, 40),
3897 F_MDP( 13710000, pll8, 1, 28),
3898 F_MDP( 27000000, pxo, 0, 0),
3899 F_MDP( 29540000, pll8, 1, 13),
3900 F_MDP( 34910000, pll8, 1, 11),
3901 F_MDP( 38400000, pll8, 1, 10),
3902 F_MDP( 59080000, pll8, 2, 13),
3903 F_MDP( 76800000, pll8, 1, 5),
3904 F_MDP( 85330000, pll8, 2, 9),
3905 F_MDP( 96000000, pll8, 1, 4),
3906 F_MDP(128000000, pll8, 1, 3),
3907 F_MDP(160000000, pll2, 1, 5),
3908 F_MDP(177780000, pll2, 2, 9),
3909 F_MDP(200000000, pll2, 1, 4),
Patrick Daly6e034322012-10-26 18:18:32 -07003910 F_MDP(228571000, pll2, 2, 7),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003911 F_MDP(266667000, pll2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003912 F_END
3913};
3914
Saravana Kannan55e959d2012-10-15 22:16:04 -07003915static unsigned long fmax_mdp_8064[VDD_DIG_NUM] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003916 [VDD_DIG_LOW] = 128000000,
3917 [VDD_DIG_NOMINAL] = 266667000
Tianyi Gou621f8742011-09-01 21:45:01 -07003918};
3919
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003920static struct bank_masks bmnd_info_mdp = {
3921 .bank_sel_mask = BIT(11),
3922 .bank0_mask = {
3923 .md_reg = MDP_MD0_REG,
3924 .ns_mask = BM(29, 22) | BM(5, 3),
3925 .rst_mask = BIT(31),
3926 .mnd_en_mask = BIT(8),
3927 .mode_mask = BM(10, 9),
3928 },
3929 .bank1_mask = {
3930 .md_reg = MDP_MD1_REG,
3931 .ns_mask = BM(21, 14) | BM(2, 0),
3932 .rst_mask = BIT(30),
3933 .mnd_en_mask = BIT(5),
3934 .mode_mask = BM(7, 6),
3935 },
3936};
3937
3938static struct rcg_clk mdp_clk = {
3939 .b = {
3940 .ctl_reg = MDP_CC_REG,
3941 .en_mask = BIT(0),
3942 .reset_reg = SW_RESET_CORE_REG,
3943 .reset_mask = BIT(21),
3944 .halt_reg = DBG_BUS_VEC_C_REG,
3945 .halt_bit = 10,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003946 .retain_reg = MDP_CC_REG,
3947 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003948 },
3949 .ns_reg = MDP_NS_REG,
3950 .root_en_mask = BIT(2),
3951 .set_rate = set_rate_mnd_banked,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003952 .freq_tbl = clk_tbl_mdp,
Stephen Boydc78d9a72011-07-20 00:46:24 -07003953 .bank_info = &bmnd_info_mdp,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07003954 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003955 .c = {
3956 .dbg_name = "mdp_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07003957 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003958 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003959 CLK_INIT(mdp_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07003960 .depends = &mdp_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003961 },
3962};
3963
Patrick Daly6e034322012-10-26 18:18:32 -07003964static unsigned long fmax_mdp_8960ab[VDD_DIG_NUM] = {
3965 [VDD_DIG_LOW] = 128000000,
3966 [VDD_DIG_NOMINAL] = 266667000
3967};
3968
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003969static struct branch_clk lut_mdp_clk = {
3970 .b = {
3971 .ctl_reg = MDP_LUT_CC_REG,
3972 .en_mask = BIT(0),
3973 .halt_reg = DBG_BUS_VEC_I_REG,
3974 .halt_bit = 13,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08003975 .retain_reg = MDP_LUT_CC_REG,
3976 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003977 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003978 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07003979 .parent = &mdp_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003980 .dbg_name = "lut_mdp_clk",
3981 .ops = &clk_ops_branch,
3982 CLK_INIT(lut_mdp_clk.c),
3983 },
3984};
3985
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003986#define F_MDP_VSYNC(f, s) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003987 { \
3988 .freq_hz = f, \
3989 .src_clk = &s##_clk.c, \
3990 .ns_val = NS_SRC_SEL(13, 13, s##_to_bb_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003991 }
3992static struct clk_freq_tbl clk_tbl_mdp_vsync[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07003993 F_MDP_VSYNC(27000000, pxo),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003994 F_END
3995};
3996
3997static struct rcg_clk mdp_vsync_clk = {
3998 .b = {
3999 .ctl_reg = MISC_CC_REG,
4000 .en_mask = BIT(6),
4001 .reset_reg = SW_RESET_CORE_REG,
4002 .reset_mask = BIT(3),
4003 .halt_reg = DBG_BUS_VEC_B_REG,
4004 .halt_bit = 22,
4005 },
4006 .ns_reg = MISC_CC2_REG,
4007 .ns_mask = BIT(13),
4008 .set_rate = set_rate_nop,
4009 .freq_tbl = clk_tbl_mdp_vsync,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004010 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004011 .c = {
4012 .dbg_name = "mdp_vsync_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004013 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004014 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004015 CLK_INIT(mdp_vsync_clk.c),
4016 },
4017};
4018
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004019#define F_ROT(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004020 { \
4021 .freq_hz = f, \
4022 .src_clk = &s##_clk.c, \
4023 .ns_val = NS_DIVSRC_BANKED(29, 26, 25, 22, d, \
4024 21, 19, 18, 16, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004025 }
4026static struct clk_freq_tbl clk_tbl_rot[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004027 F_ROT( 0, gnd, 1),
4028 F_ROT( 27000000, pxo, 1),
4029 F_ROT( 29540000, pll8, 13),
4030 F_ROT( 32000000, pll8, 12),
4031 F_ROT( 38400000, pll8, 10),
4032 F_ROT( 48000000, pll8, 8),
4033 F_ROT( 54860000, pll8, 7),
4034 F_ROT( 64000000, pll8, 6),
4035 F_ROT( 76800000, pll8, 5),
4036 F_ROT( 96000000, pll8, 4),
4037 F_ROT(100000000, pll2, 8),
4038 F_ROT(114290000, pll2, 7),
4039 F_ROT(133330000, pll2, 6),
4040 F_ROT(160000000, pll2, 5),
4041 F_ROT(200000000, pll2, 4),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004042 F_END
4043};
4044
4045static struct bank_masks bdiv_info_rot = {
4046 .bank_sel_mask = BIT(30),
4047 .bank0_mask = {
4048 .ns_mask = BM(25, 22) | BM(18, 16),
4049 },
4050 .bank1_mask = {
4051 .ns_mask = BM(29, 26) | BM(21, 19),
4052 },
4053};
4054
4055static struct rcg_clk rot_clk = {
4056 .b = {
4057 .ctl_reg = ROT_CC_REG,
4058 .en_mask = BIT(0),
4059 .reset_reg = SW_RESET_CORE_REG,
4060 .reset_mask = BIT(2),
4061 .halt_reg = DBG_BUS_VEC_C_REG,
4062 .halt_bit = 15,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004063 .retain_reg = ROT_CC_REG,
4064 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004065 },
4066 .ns_reg = ROT_NS_REG,
4067 .root_en_mask = BIT(2),
4068 .set_rate = set_rate_div_banked,
4069 .freq_tbl = clk_tbl_rot,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004070 .bank_info = &bdiv_info_rot,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004071 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004072 .c = {
4073 .dbg_name = "rot_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004074 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004075 VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004076 CLK_INIT(rot_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004077 .depends = &rot_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004078 },
4079};
4080
Matt Wagantallf82f2942012-01-27 13:56:13 -08004081static int hdmi_pll_clk_enable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004082{
4083 int ret;
4084 unsigned long flags;
4085 spin_lock_irqsave(&local_clock_reg_lock, flags);
4086 ret = hdmi_pll_enable();
4087 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4088 return ret;
4089}
4090
Matt Wagantallf82f2942012-01-27 13:56:13 -08004091static void hdmi_pll_clk_disable(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004092{
4093 unsigned long flags;
4094 spin_lock_irqsave(&local_clock_reg_lock, flags);
4095 hdmi_pll_disable();
4096 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
4097}
4098
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004099static struct clk_ops clk_ops_hdmi_pll = {
4100 .enable = hdmi_pll_clk_enable,
4101 .disable = hdmi_pll_clk_disable,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004102};
4103
4104static struct clk hdmi_pll_clk = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07004105 .parent = &pxo_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004106 .dbg_name = "hdmi_pll_clk",
4107 .ops = &clk_ops_hdmi_pll,
Matt Wagantall82feaa12012-07-09 10:54:49 -07004108 .vdd_class = &vdd_sr2_hdmi_pll,
Saravana Kannan55e959d2012-10-15 22:16:04 -07004109 .fmax = (unsigned long [VDD_SR2_HDMI_PLL_NUM]) {
4110 [VDD_SR2_HDMI_PLL_ON] = ULONG_MAX,
4111 },
4112 .num_fmax = VDD_SR2_HDMI_PLL_NUM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004113 CLK_INIT(hdmi_pll_clk),
4114};
4115
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004116#define F_TV_GND(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004117 { \
4118 .freq_hz = f, \
4119 .src_clk = &s##_clk.c, \
4120 .md_val = MD8(8, m, 0, n), \
4121 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
4122 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004123 }
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004124#define F_TV(f, s, p_r, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004125 { \
4126 .freq_hz = f, \
4127 .src_clk = &s##_clk, \
4128 .md_val = MD8(8, m, 0, n), \
4129 .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \
4130 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004131 .extra_freq_data = (void *)p_r, \
4132 }
4133/* Switching TV freqs requires PLL reconfiguration. */
4134static struct clk_freq_tbl clk_tbl_tv[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004135 F_TV_GND( 0, gnd, 0, 1, 0, 0),
4136 F_TV( 25200000, hdmi_pll, 25200000, 1, 0, 0),
4137 F_TV( 27000000, hdmi_pll, 27000000, 1, 0, 0),
4138 F_TV( 27030000, hdmi_pll, 27030000, 1, 0, 0),
4139 F_TV( 74250000, hdmi_pll, 74250000, 1, 0, 0),
Ajay Singh Parmar25c91bb2013-01-23 18:47:04 +05304140 F_TV(108000000, hdmi_pll, 108000000, 1, 0, 0),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004141 F_TV(148500000, hdmi_pll, 148500000, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004142 F_END
4143};
4144
Saravana Kannan55e959d2012-10-15 22:16:04 -07004145static unsigned long fmax_tv_src_8064[VDD_DIG_NUM] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004146 [VDD_DIG_LOW] = 74250000,
4147 [VDD_DIG_NOMINAL] = 149000000
4148};
4149
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004150/*
4151 * Unlike other clocks, the TV rate is adjusted through PLL
4152 * re-programming. It is also routed through an MND divider.
4153 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08004154void set_rate_tv(struct rcg_clk *rcg, struct clk_freq_tbl *nf)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004155{
4156 unsigned long pll_rate = (unsigned long)nf->extra_freq_data;
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004157 if (pll_rate) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004158 hdmi_pll_set_rate(pll_rate);
Matt Wagantallf6c39a12012-07-09 19:24:42 -07004159 hdmi_pll_clk.rate = pll_rate;
4160 }
Matt Wagantallf82f2942012-01-27 13:56:13 -08004161 set_rate_mnd(rcg, nf);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004162}
4163
4164static struct rcg_clk tv_src_clk = {
4165 .ns_reg = TV_NS_REG,
4166 .b = {
4167 .ctl_reg = TV_CC_REG,
4168 .halt_check = NOCHECK,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004169 .retain_reg = TV_CC_REG,
4170 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004171 },
4172 .md_reg = TV_MD_REG,
4173 .root_en_mask = BIT(2),
4174 .ns_mask = (BM(23, 16) | BM(15, 14) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004175 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004176 .ctl_mask = BM(7, 6),
4177 .set_rate = set_rate_tv,
4178 .freq_tbl = clk_tbl_tv,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004179 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004180 .c = {
4181 .dbg_name = "tv_src_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004182 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004183 VDD_DIG_FMAX_MAP2(LOW, 27030000, NOMINAL, 149000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004184 CLK_INIT(tv_src_clk.c),
4185 },
4186};
4187
Tianyi Gou51918802012-01-26 14:05:43 -08004188static struct cdiv_clk tv_src_div_clk = {
4189 .b = {
4190 .ctl_reg = TV_NS_REG,
4191 .halt_check = NOCHECK,
4192 },
4193 .ns_reg = TV_NS_REG,
4194 .div_offset = 6,
4195 .max_div = 2,
4196 .c = {
4197 .dbg_name = "tv_src_div_clk",
4198 .ops = &clk_ops_cdiv,
4199 CLK_INIT(tv_src_div_clk.c),
Stephen Boydd51d5e82012-06-18 18:09:50 -07004200 .rate = ULONG_MAX,
Tianyi Gou51918802012-01-26 14:05:43 -08004201 },
4202};
4203
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004204static struct branch_clk tv_enc_clk = {
4205 .b = {
4206 .ctl_reg = TV_CC_REG,
4207 .en_mask = BIT(8),
4208 .reset_reg = SW_RESET_CORE_REG,
4209 .reset_mask = BIT(0),
4210 .halt_reg = DBG_BUS_VEC_D_REG,
4211 .halt_bit = 9,
4212 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004213 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07004214 .parent = &tv_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004215 .dbg_name = "tv_enc_clk",
4216 .ops = &clk_ops_branch,
4217 CLK_INIT(tv_enc_clk.c),
4218 },
4219};
4220
4221static struct branch_clk tv_dac_clk = {
4222 .b = {
4223 .ctl_reg = TV_CC_REG,
4224 .en_mask = BIT(10),
4225 .halt_reg = DBG_BUS_VEC_D_REG,
4226 .halt_bit = 10,
4227 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004228 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07004229 .parent = &tv_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004230 .dbg_name = "tv_dac_clk",
4231 .ops = &clk_ops_branch,
4232 CLK_INIT(tv_dac_clk.c),
4233 },
4234};
4235
4236static struct branch_clk mdp_tv_clk = {
4237 .b = {
4238 .ctl_reg = TV_CC_REG,
4239 .en_mask = BIT(0),
4240 .reset_reg = SW_RESET_CORE_REG,
4241 .reset_mask = BIT(4),
4242 .halt_reg = DBG_BUS_VEC_D_REG,
4243 .halt_bit = 12,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004244 .retain_reg = TV_CC2_REG,
4245 .retain_mask = BIT(10),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004246 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004247 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07004248 .parent = &tv_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004249 .dbg_name = "mdp_tv_clk",
4250 .ops = &clk_ops_branch,
4251 CLK_INIT(mdp_tv_clk.c),
4252 },
4253};
4254
4255static struct branch_clk hdmi_tv_clk = {
4256 .b = {
4257 .ctl_reg = TV_CC_REG,
4258 .en_mask = BIT(12),
4259 .reset_reg = SW_RESET_CORE_REG,
4260 .reset_mask = BIT(1),
4261 .halt_reg = DBG_BUS_VEC_D_REG,
4262 .halt_bit = 11,
4263 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004264 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07004265 .parent = &tv_src_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004266 .dbg_name = "hdmi_tv_clk",
4267 .ops = &clk_ops_branch,
4268 CLK_INIT(hdmi_tv_clk.c),
4269 },
4270};
4271
Tianyi Gou51918802012-01-26 14:05:43 -08004272static struct branch_clk rgb_tv_clk = {
4273 .b = {
4274 .ctl_reg = TV_CC2_REG,
4275 .en_mask = BIT(14),
4276 .halt_reg = DBG_BUS_VEC_J_REG,
4277 .halt_bit = 27,
4278 },
Tianyi Gou51918802012-01-26 14:05:43 -08004279 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07004280 .parent = &tv_src_clk.c,
Tianyi Gou51918802012-01-26 14:05:43 -08004281 .dbg_name = "rgb_tv_clk",
4282 .ops = &clk_ops_branch,
4283 CLK_INIT(rgb_tv_clk.c),
4284 },
4285};
4286
4287static struct branch_clk npl_tv_clk = {
4288 .b = {
4289 .ctl_reg = TV_CC2_REG,
4290 .en_mask = BIT(16),
4291 .halt_reg = DBG_BUS_VEC_J_REG,
4292 .halt_bit = 26,
4293 },
Tianyi Gou51918802012-01-26 14:05:43 -08004294 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07004295 .parent = &tv_src_clk.c,
Tianyi Gou51918802012-01-26 14:05:43 -08004296 .dbg_name = "npl_tv_clk",
4297 .ops = &clk_ops_branch,
4298 CLK_INIT(npl_tv_clk.c),
4299 },
4300};
4301
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004302static struct branch_clk hdmi_app_clk = {
4303 .b = {
4304 .ctl_reg = MISC_CC2_REG,
4305 .en_mask = BIT(11),
4306 .reset_reg = SW_RESET_CORE_REG,
4307 .reset_mask = BIT(11),
4308 .halt_reg = DBG_BUS_VEC_B_REG,
4309 .halt_bit = 25,
4310 },
4311 .c = {
4312 .dbg_name = "hdmi_app_clk",
4313 .ops = &clk_ops_branch,
4314 CLK_INIT(hdmi_app_clk.c),
4315 },
4316};
4317
4318static struct bank_masks bmnd_info_vcodec = {
4319 .bank_sel_mask = BIT(13),
4320 .bank0_mask = {
4321 .md_reg = VCODEC_MD0_REG,
4322 .ns_mask = BM(18, 11) | BM(2, 0),
4323 .rst_mask = BIT(31),
4324 .mnd_en_mask = BIT(5),
4325 .mode_mask = BM(7, 6),
4326 },
4327 .bank1_mask = {
4328 .md_reg = VCODEC_MD1_REG,
4329 .ns_mask = BM(26, 19) | BM(29, 27),
4330 .rst_mask = BIT(30),
4331 .mnd_en_mask = BIT(10),
4332 .mode_mask = BM(12, 11),
4333 },
4334};
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004335#define F_VCODEC(f, s, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004336 { \
4337 .freq_hz = f, \
4338 .src_clk = &s##_clk.c, \
4339 .md_val = MD8(8, m, 0, n), \
4340 .ns_val = NS_MND_BANKED8(11, 19, n, m, 0, 27, s##_to_mm_mux), \
4341 .ctl_val = CC_BANKED(6, 11, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004342 }
4343static struct clk_freq_tbl clk_tbl_vcodec[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004344 F_VCODEC( 0, gnd, 0, 0),
4345 F_VCODEC( 27000000, pxo, 0, 0),
4346 F_VCODEC( 32000000, pll8, 1, 12),
4347 F_VCODEC( 48000000, pll8, 1, 8),
4348 F_VCODEC( 54860000, pll8, 1, 7),
4349 F_VCODEC( 96000000, pll8, 1, 4),
4350 F_VCODEC(133330000, pll2, 1, 6),
4351 F_VCODEC(200000000, pll2, 1, 4),
4352 F_VCODEC(228570000, pll2, 2, 7),
Patrick Dalyb7c777a2012-08-23 19:07:30 -07004353 F_VCODEC(266670000, pll2, 1, 3),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004354 F_END
4355};
4356
4357static struct rcg_clk vcodec_clk = {
4358 .b = {
4359 .ctl_reg = VCODEC_CC_REG,
4360 .en_mask = BIT(0),
4361 .reset_reg = SW_RESET_CORE_REG,
4362 .reset_mask = BIT(6),
4363 .halt_reg = DBG_BUS_VEC_C_REG,
4364 .halt_bit = 29,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004365 .retain_reg = VCODEC_CC_REG,
4366 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004367 },
4368 .ns_reg = VCODEC_NS_REG,
4369 .root_en_mask = BIT(2),
4370 .set_rate = set_rate_mnd_banked,
Stephen Boydc78d9a72011-07-20 00:46:24 -07004371 .bank_info = &bmnd_info_vcodec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004372 .freq_tbl = clk_tbl_vcodec,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004373 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004374 .c = {
4375 .dbg_name = "vcodec_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004376 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004377 VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000,
4378 HIGH, 228571000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004379 CLK_INIT(vcodec_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004380 .depends = &vcodec_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004381 },
4382};
4383
Saravana Kannan55e959d2012-10-15 22:16:04 -07004384static unsigned long fmax_vcodec_8064v2[VDD_DIG_NUM] = {
Patrick Dalyb7c777a2012-08-23 19:07:30 -07004385 [VDD_DIG_LOW] = 100000000,
4386 [VDD_DIG_NOMINAL] = 200000000,
4387 [VDD_DIG_HIGH] = 266670000,
4388};
4389
Seemanta Dutta4dc17082012-10-24 18:37:42 -07004390static unsigned long fmax_vcodec_8930ab[VDD_DIG_NUM] = {
4391 [VDD_DIG_LOW] = 100000000,
4392 [VDD_DIG_NOMINAL] = 200000000,
4393 [VDD_DIG_HIGH] = 266670000
4394};
4395
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004396#define F_VPE(f, s, d) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004397 { \
4398 .freq_hz = f, \
4399 .src_clk = &s##_clk.c, \
4400 .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004401 }
4402static struct clk_freq_tbl clk_tbl_vpe[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004403 F_VPE( 0, gnd, 1),
4404 F_VPE( 27000000, pxo, 1),
4405 F_VPE( 34909000, pll8, 11),
4406 F_VPE( 38400000, pll8, 10),
4407 F_VPE( 64000000, pll8, 6),
4408 F_VPE( 76800000, pll8, 5),
4409 F_VPE( 96000000, pll8, 4),
4410 F_VPE(100000000, pll2, 8),
4411 F_VPE(160000000, pll2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004412 F_END
4413};
4414
4415static struct rcg_clk vpe_clk = {
4416 .b = {
4417 .ctl_reg = VPE_CC_REG,
4418 .en_mask = BIT(0),
4419 .reset_reg = SW_RESET_CORE_REG,
4420 .reset_mask = BIT(17),
4421 .halt_reg = DBG_BUS_VEC_A_REG,
4422 .halt_bit = 28,
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004423 .retain_reg = VPE_CC_REG,
4424 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004425 },
4426 .ns_reg = VPE_NS_REG,
4427 .root_en_mask = BIT(2),
4428 .ns_mask = (BM(15, 12) | BM(2, 0)),
4429 .set_rate = set_rate_nop,
4430 .freq_tbl = clk_tbl_vpe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004431 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004432 .c = {
4433 .dbg_name = "vpe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004434 .ops = &clk_ops_rcg,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004435 VDD_DIG_FMAX_MAP2(LOW, 76800000, NOMINAL, 160000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004436 CLK_INIT(vpe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004437 .depends = &vpe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004438 },
4439};
4440
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004441#define F_VFE(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004442 { \
4443 .freq_hz = f, \
4444 .src_clk = &s##_clk.c, \
4445 .md_val = MD8(8, m, 0, n), \
4446 .ns_val = NS_MM(23, 16, n, m, 11, 10, d, 2, 0, s##_to_mm_mux), \
4447 .ctl_val = CC(6, n), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004448 }
Tianyi Gou41515e22011-09-01 19:37:43 -07004449
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004450static struct clk_freq_tbl clk_tbl_vfe[] = {
4451 F_VFE( 0, gnd, 1, 0, 0),
4452 F_VFE( 13960000, pll8, 1, 2, 55),
4453 F_VFE( 27000000, pxo, 1, 0, 0),
4454 F_VFE( 36570000, pll8, 1, 2, 21),
4455 F_VFE( 38400000, pll8, 2, 1, 5),
4456 F_VFE( 45180000, pll8, 1, 2, 17),
4457 F_VFE( 48000000, pll8, 2, 1, 4),
4458 F_VFE( 54860000, pll8, 1, 1, 7),
4459 F_VFE( 64000000, pll8, 2, 1, 3),
4460 F_VFE( 76800000, pll8, 1, 1, 5),
4461 F_VFE( 96000000, pll8, 2, 1, 2),
4462 F_VFE(109710000, pll8, 1, 2, 7),
4463 F_VFE(128000000, pll8, 1, 1, 3),
4464 F_VFE(153600000, pll8, 1, 2, 5),
4465 F_VFE(200000000, pll2, 2, 1, 2),
4466 F_VFE(228570000, pll2, 1, 2, 7),
4467 F_VFE(266667000, pll2, 1, 1, 3),
4468 F_VFE(320000000, pll2, 1, 2, 5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004469 F_END
4470};
4471
Saravana Kannan55e959d2012-10-15 22:16:04 -07004472static unsigned long fmax_vfe_8064[VDD_DIG_NUM] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004473 [VDD_DIG_LOW] = 128000000,
4474 [VDD_DIG_NOMINAL] = 266667000,
4475 [VDD_DIG_HIGH] = 320000000
Tianyi Gou41515e22011-09-01 19:37:43 -07004476};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004477
4478static struct rcg_clk vfe_clk = {
4479 .b = {
4480 .ctl_reg = VFE_CC_REG,
4481 .reset_reg = SW_RESET_CORE_REG,
4482 .reset_mask = BIT(15),
4483 .halt_reg = DBG_BUS_VEC_B_REG,
4484 .halt_bit = 6,
4485 .en_mask = BIT(0),
Matt Wagantall7e0b6c92012-01-20 18:48:05 -08004486 .retain_reg = VFE_CC2_REG,
4487 .retain_mask = BIT(31),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004488 },
4489 .ns_reg = VFE_NS_REG,
4490 .md_reg = VFE_MD_REG,
4491 .root_en_mask = BIT(2),
4492 .ns_mask = (BM(23, 16) | BM(11, 10) | BM(2, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004493 .mnd_en_mask = BIT(5),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004494 .ctl_mask = BM(7, 6),
4495 .set_rate = set_rate_mnd,
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004496 .freq_tbl = clk_tbl_vfe,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004497 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004498 .c = {
4499 .dbg_name = "vfe_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004500 .ops = &clk_ops_rcg,
Tianyi Gou3022dfd2012-01-25 15:50:05 -08004501 VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 266667000,
4502 HIGH, 320000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004503 CLK_INIT(vfe_clk.c),
Stephen Boyd7fa26742011-08-11 23:22:29 -07004504 .depends = &vfe_axi_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004505 },
4506};
4507
Matt Wagantallc23eee92011-08-16 23:06:52 -07004508static struct branch_clk csi_vfe_clk = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004509 .b = {
4510 .ctl_reg = VFE_CC_REG,
4511 .en_mask = BIT(12),
4512 .reset_reg = SW_RESET_CORE_REG,
4513 .reset_mask = BIT(24),
4514 .halt_reg = DBG_BUS_VEC_B_REG,
4515 .halt_bit = 8,
4516 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004517 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07004518 .parent = &vfe_clk.c,
Matt Wagantallc23eee92011-08-16 23:06:52 -07004519 .dbg_name = "csi_vfe_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004520 .ops = &clk_ops_branch,
Matt Wagantallc23eee92011-08-16 23:06:52 -07004521 CLK_INIT(csi_vfe_clk.c),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004522 },
4523};
4524
4525/*
4526 * Low Power Audio Clocks
4527 */
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004528#define F_AIF_OSR(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004529 { \
4530 .freq_hz = f, \
4531 .src_clk = &s##_clk.c, \
4532 .md_val = MD8(8, m, 0, n), \
4533 .ns_val = NS(31, 24, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004534 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004535static struct clk_freq_tbl clk_tbl_aif_osr_492[] = {
4536 F_AIF_OSR( 0, gnd, 1, 0, 0),
4537 F_AIF_OSR( 512000, pll4, 4, 1, 240),
4538 F_AIF_OSR( 768000, pll4, 4, 1, 160),
4539 F_AIF_OSR( 1024000, pll4, 4, 1, 120),
4540 F_AIF_OSR( 1536000, pll4, 4, 1, 80),
4541 F_AIF_OSR( 2048000, pll4, 4, 1, 60),
4542 F_AIF_OSR( 3072000, pll4, 4, 1, 40),
4543 F_AIF_OSR( 4096000, pll4, 4, 1, 30),
4544 F_AIF_OSR( 6144000, pll4, 4, 1, 20),
4545 F_AIF_OSR( 8192000, pll4, 4, 1, 15),
4546 F_AIF_OSR(12288000, pll4, 4, 1, 10),
4547 F_AIF_OSR(24576000, pll4, 4, 1, 5),
Matt Wagantallac15a372012-10-10 23:36:20 -07004548 F_AIF_OSR(27000000, pxo, 1, 0, 0),
Matt Wagantall86e03822011-12-12 10:59:24 -08004549 F_END
4550};
4551
4552static struct clk_freq_tbl clk_tbl_aif_osr_393[] = {
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004553 F_AIF_OSR( 0, gnd, 1, 0, 0),
4554 F_AIF_OSR( 512000, pll4, 4, 1, 192),
4555 F_AIF_OSR( 768000, pll4, 4, 1, 128),
4556 F_AIF_OSR( 1024000, pll4, 4, 1, 96),
4557 F_AIF_OSR( 1536000, pll4, 4, 1, 64),
4558 F_AIF_OSR( 2048000, pll4, 4, 1, 48),
4559 F_AIF_OSR( 3072000, pll4, 4, 1, 32),
4560 F_AIF_OSR( 4096000, pll4, 4, 1, 24),
4561 F_AIF_OSR( 6144000, pll4, 4, 1, 16),
4562 F_AIF_OSR( 8192000, pll4, 4, 1, 12),
4563 F_AIF_OSR(12288000, pll4, 4, 1, 8),
4564 F_AIF_OSR(24576000, pll4, 4, 1, 4),
Matt Wagantallac15a372012-10-10 23:36:20 -07004565 F_AIF_OSR(27000000, pxo, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004566 F_END
4567};
4568
4569#define CLK_AIF_OSR(i, ns, md, h_r) \
4570 struct rcg_clk i##_clk = { \
4571 .b = { \
4572 .ctl_reg = ns, \
4573 .en_mask = BIT(17), \
4574 .reset_reg = ns, \
4575 .reset_mask = BIT(19), \
4576 .halt_reg = h_r, \
4577 .halt_check = ENABLE, \
4578 .halt_bit = 1, \
4579 }, \
4580 .ns_reg = ns, \
4581 .md_reg = md, \
4582 .root_en_mask = BIT(9), \
4583 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004584 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004585 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004586 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004587 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004588 .c = { \
4589 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004590 .ops = &clk_ops_rcg, \
Matt Wagantallac15a372012-10-10 23:36:20 -07004591 VDD_DIG_FMAX_MAP1(LOW, 27000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004592 CLK_INIT(i##_clk.c), \
4593 }, \
4594 }
4595#define CLK_AIF_OSR_DIV(i, ns, md, h_r) \
4596 struct rcg_clk i##_clk = { \
4597 .b = { \
4598 .ctl_reg = ns, \
4599 .en_mask = BIT(21), \
4600 .reset_reg = ns, \
4601 .reset_mask = BIT(23), \
4602 .halt_reg = h_r, \
4603 .halt_check = ENABLE, \
4604 .halt_bit = 1, \
4605 }, \
4606 .ns_reg = ns, \
4607 .md_reg = md, \
4608 .root_en_mask = BIT(9), \
4609 .ns_mask = (BM(31, 24) | BM(6, 0)), \
Matt Wagantall07c45472012-02-10 23:27:24 -08004610 .mnd_en_mask = BIT(8), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004611 .set_rate = set_rate_mnd, \
Matt Wagantall86e03822011-12-12 10:59:24 -08004612 .freq_tbl = clk_tbl_aif_osr_393, \
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004613 .current_freq = &rcg_dummy_freq, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004614 .c = { \
4615 .dbg_name = #i "_clk", \
Stephen Boyd409b8b42012-04-10 12:12:56 -07004616 .ops = &clk_ops_rcg, \
Matt Wagantallac15a372012-10-10 23:36:20 -07004617 VDD_DIG_FMAX_MAP1(LOW, 27000000), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004618 CLK_INIT(i##_clk.c), \
4619 }, \
4620 }
4621
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004622#define CLK_AIF_BIT(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004623 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004624 .b = { \
4625 .ctl_reg = ns, \
4626 .en_mask = BIT(15), \
4627 .halt_reg = h_r, \
4628 .halt_check = DELAY, \
4629 }, \
4630 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004631 .ext_mask = BIT(14), \
4632 .div_offset = 10, \
4633 .max_div = 16, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004634 .c = { \
4635 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004636 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004637 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004638 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004639 }, \
4640 }
4641
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004642#define CLK_AIF_BIT_DIV(i, ns, h_r) \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004643 struct cdiv_clk i##_clk = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004644 .b = { \
4645 .ctl_reg = ns, \
4646 .en_mask = BIT(19), \
4647 .halt_reg = h_r, \
Stephen Boyd7bb9cf82012-01-25 18:09:01 -08004648 .halt_check = DELAY, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004649 }, \
4650 .ns_reg = ns, \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004651 .ext_mask = BIT(18), \
4652 .div_offset = 10, \
4653 .max_div = 256, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004654 .c = { \
4655 .dbg_name = #i "_clk", \
Stephen Boyd9fd19642011-11-16 11:11:09 -08004656 .ops = &clk_ops_cdiv, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004657 CLK_INIT(i##_clk.c), \
Stephen Boydd51d5e82012-06-18 18:09:50 -07004658 .rate = ULONG_MAX, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004659 }, \
4660 }
4661
4662static CLK_AIF_OSR(mi2s_osr, LCC_MI2S_NS_REG, LCC_MI2S_MD_REG,
4663 LCC_MI2S_STATUS_REG);
4664static CLK_AIF_BIT(mi2s_bit, LCC_MI2S_NS_REG, LCC_MI2S_STATUS_REG);
4665
4666static CLK_AIF_OSR_DIV(codec_i2s_mic_osr, LCC_CODEC_I2S_MIC_NS_REG,
4667 LCC_CODEC_I2S_MIC_MD_REG, LCC_CODEC_I2S_MIC_STATUS_REG);
4668static CLK_AIF_BIT_DIV(codec_i2s_mic_bit, LCC_CODEC_I2S_MIC_NS_REG,
4669 LCC_CODEC_I2S_MIC_STATUS_REG);
4670
4671static CLK_AIF_OSR_DIV(spare_i2s_mic_osr, LCC_SPARE_I2S_MIC_NS_REG,
4672 LCC_SPARE_I2S_MIC_MD_REG, LCC_SPARE_I2S_MIC_STATUS_REG);
4673static CLK_AIF_BIT_DIV(spare_i2s_mic_bit, LCC_SPARE_I2S_MIC_NS_REG,
4674 LCC_SPARE_I2S_MIC_STATUS_REG);
4675
4676static CLK_AIF_OSR_DIV(codec_i2s_spkr_osr, LCC_CODEC_I2S_SPKR_NS_REG,
4677 LCC_CODEC_I2S_SPKR_MD_REG, LCC_CODEC_I2S_SPKR_STATUS_REG);
4678static CLK_AIF_BIT_DIV(codec_i2s_spkr_bit, LCC_CODEC_I2S_SPKR_NS_REG,
4679 LCC_CODEC_I2S_SPKR_STATUS_REG);
4680
4681static CLK_AIF_OSR_DIV(spare_i2s_spkr_osr, LCC_SPARE_I2S_SPKR_NS_REG,
4682 LCC_SPARE_I2S_SPKR_MD_REG, LCC_SPARE_I2S_SPKR_STATUS_REG);
4683static CLK_AIF_BIT_DIV(spare_i2s_spkr_bit, LCC_SPARE_I2S_SPKR_NS_REG,
4684 LCC_SPARE_I2S_SPKR_STATUS_REG);
4685
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004686#define F_PCM(f, s, d, m, n) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004687 { \
4688 .freq_hz = f, \
4689 .src_clk = &s##_clk.c, \
4690 .md_val = MD16(m, n), \
4691 .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004692 }
Matt Wagantall86e03822011-12-12 10:59:24 -08004693static struct clk_freq_tbl clk_tbl_pcm_492[] = {
4694 { .ns_val = BIT(10) /* external input */ },
Stephen Boyde9ed94d2012-08-02 10:57:11 -07004695 F_PCM( 256000, pll4, 4, 1, 480),
Matt Wagantall86e03822011-12-12 10:59:24 -08004696 F_PCM( 512000, pll4, 4, 1, 240),
4697 F_PCM( 768000, pll4, 4, 1, 160),
4698 F_PCM( 1024000, pll4, 4, 1, 120),
4699 F_PCM( 1536000, pll4, 4, 1, 80),
4700 F_PCM( 2048000, pll4, 4, 1, 60),
4701 F_PCM( 3072000, pll4, 4, 1, 40),
4702 F_PCM( 4096000, pll4, 4, 1, 30),
4703 F_PCM( 6144000, pll4, 4, 1, 20),
4704 F_PCM( 8192000, pll4, 4, 1, 15),
4705 F_PCM(12288000, pll4, 4, 1, 10),
4706 F_PCM(24576000, pll4, 4, 1, 5),
Matt Wagantallac15a372012-10-10 23:36:20 -07004707 F_PCM(27000000, pxo, 1, 0, 0),
Matt Wagantall86e03822011-12-12 10:59:24 -08004708 F_END
4709};
4710
4711static struct clk_freq_tbl clk_tbl_pcm_393[] = {
Stephen Boyd630f3252012-01-31 00:10:08 -08004712 { .ns_val = BIT(10) /* external input */ },
Stephen Boyde9ed94d2012-08-02 10:57:11 -07004713 F_PCM( 256000, pll4, 4, 1, 384),
Matt Wagantalle18bbc82011-10-06 10:07:28 -07004714 F_PCM( 512000, pll4, 4, 1, 192),
4715 F_PCM( 768000, pll4, 4, 1, 128),
4716 F_PCM( 1024000, pll4, 4, 1, 96),
4717 F_PCM( 1536000, pll4, 4, 1, 64),
4718 F_PCM( 2048000, pll4, 4, 1, 48),
4719 F_PCM( 3072000, pll4, 4, 1, 32),
4720 F_PCM( 4096000, pll4, 4, 1, 24),
4721 F_PCM( 6144000, pll4, 4, 1, 16),
4722 F_PCM( 8192000, pll4, 4, 1, 12),
4723 F_PCM(12288000, pll4, 4, 1, 8),
4724 F_PCM(24576000, pll4, 4, 1, 4),
Matt Wagantallac15a372012-10-10 23:36:20 -07004725 F_PCM(27000000, pxo, 1, 0, 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004726 F_END
4727};
4728
4729static struct rcg_clk pcm_clk = {
4730 .b = {
4731 .ctl_reg = LCC_PCM_NS_REG,
4732 .en_mask = BIT(11),
4733 .reset_reg = LCC_PCM_NS_REG,
4734 .reset_mask = BIT(13),
4735 .halt_reg = LCC_PCM_STATUS_REG,
4736 .halt_check = ENABLE,
4737 .halt_bit = 0,
4738 },
4739 .ns_reg = LCC_PCM_NS_REG,
4740 .md_reg = LCC_PCM_MD_REG,
4741 .root_en_mask = BIT(9),
Stephen Boyd630f3252012-01-31 00:10:08 -08004742 .ns_mask = BM(31, 16) | BIT(10) | BM(6, 0),
Matt Wagantall07c45472012-02-10 23:27:24 -08004743 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004744 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004745 .freq_tbl = clk_tbl_pcm_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004746 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004747 .c = {
4748 .dbg_name = "pcm_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004749 .ops = &clk_ops_rcg,
Matt Wagantallac15a372012-10-10 23:36:20 -07004750 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004751 CLK_INIT(pcm_clk.c),
Stephen Boydc5492fc2012-06-18 18:47:03 -07004752 .rate = ULONG_MAX,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004753 },
4754};
4755
4756static struct rcg_clk audio_slimbus_clk = {
4757 .b = {
4758 .ctl_reg = LCC_SLIMBUS_NS_REG,
4759 .en_mask = BIT(10),
4760 .reset_reg = LCC_AHBEX_BRANCH_CTL_REG,
4761 .reset_mask = BIT(5),
4762 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4763 .halt_check = ENABLE,
4764 .halt_bit = 0,
4765 },
4766 .ns_reg = LCC_SLIMBUS_NS_REG,
4767 .md_reg = LCC_SLIMBUS_MD_REG,
4768 .root_en_mask = BIT(9),
4769 .ns_mask = (BM(31, 24) | BM(6, 0)),
Matt Wagantall07c45472012-02-10 23:27:24 -08004770 .mnd_en_mask = BIT(8),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004771 .set_rate = set_rate_mnd,
Matt Wagantall86e03822011-12-12 10:59:24 -08004772 .freq_tbl = clk_tbl_aif_osr_393,
Matt Wagantall84f43fd2011-08-16 23:28:38 -07004773 .current_freq = &rcg_dummy_freq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004774 .c = {
4775 .dbg_name = "audio_slimbus_clk",
Stephen Boyd409b8b42012-04-10 12:12:56 -07004776 .ops = &clk_ops_rcg,
Matt Wagantallac15a372012-10-10 23:36:20 -07004777 VDD_DIG_FMAX_MAP1(LOW, 27000000),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004778 CLK_INIT(audio_slimbus_clk.c),
4779 },
4780};
4781
4782static struct branch_clk sps_slimbus_clk = {
4783 .b = {
4784 .ctl_reg = LCC_SLIMBUS_NS_REG,
4785 .en_mask = BIT(12),
4786 .halt_reg = LCC_SLIMBUS_STATUS_REG,
4787 .halt_check = ENABLE,
4788 .halt_bit = 1,
4789 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004790 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07004791 .parent = &audio_slimbus_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004792 .dbg_name = "sps_slimbus_clk",
4793 .ops = &clk_ops_branch,
4794 CLK_INIT(sps_slimbus_clk.c),
4795 },
4796};
4797
4798static struct branch_clk slimbus_xo_src_clk = {
4799 .b = {
4800 .ctl_reg = SLIMBUS_XO_SRC_CLK_CTL_REG,
4801 .en_mask = BIT(2),
4802 .halt_reg = CLK_HALT_DFAB_STATE_REG,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004803 .halt_bit = 28,
4804 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004805 .c = {
Saravana Kannan7a6532e2012-10-18 20:51:13 -07004806 .parent = &sps_slimbus_clk.c,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004807 .dbg_name = "slimbus_xo_src_clk",
4808 .ops = &clk_ops_branch,
4809 CLK_INIT(slimbus_xo_src_clk.c),
4810 },
4811};
4812
Matt Wagantall735f01a2011-08-12 12:40:28 -07004813DEFINE_CLK_RPM(afab_clk, afab_a_clk, APPS_FABRIC, NULL);
4814DEFINE_CLK_RPM(cfpb_clk, cfpb_a_clk, CFPB, NULL);
4815DEFINE_CLK_RPM(dfab_clk, dfab_a_clk, DAYTONA_FABRIC, NULL);
4816DEFINE_CLK_RPM(ebi1_clk, ebi1_a_clk, EBI1, NULL);
4817DEFINE_CLK_RPM(mmfab_clk, mmfab_a_clk, MM_FABRIC, NULL);
4818DEFINE_CLK_RPM(mmfpb_clk, mmfpb_a_clk, MMFPB, NULL);
4819DEFINE_CLK_RPM(sfab_clk, sfab_a_clk, SYSTEM_FABRIC, NULL);
4820DEFINE_CLK_RPM(sfpb_clk, sfpb_a_clk, SFPB, NULL);
Stephen Boydc7fc3b12012-05-17 14:42:46 -07004821DEFINE_CLK_RPM_QDSS(qdss_clk, qdss_a_clk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004822
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004823static DEFINE_CLK_VOTER(sfab_msmbus_a_clk, &sfab_a_clk.c, 0);
4824static DEFINE_CLK_VOTER(sfab_tmr_a_clk, &sfab_a_clk.c, 0);
Stephen Boydd7a143a2012-02-16 17:59:26 -08004825
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004826static DEFINE_CLK_VOTER(dfab_dsps_clk, &dfab_clk.c, 0);
4827static DEFINE_CLK_VOTER(dfab_usb_hs_clk, &dfab_clk.c, 0);
4828static DEFINE_CLK_VOTER(dfab_usb_hs3_clk, &dfab_clk.c, 0);
4829static DEFINE_CLK_VOTER(dfab_usb_hs4_clk, &dfab_clk.c, 0);
4830static DEFINE_CLK_VOTER(dfab_sdc1_clk, &dfab_clk.c, 0);
4831static DEFINE_CLK_VOTER(dfab_sdc2_clk, &dfab_clk.c, 0);
4832static DEFINE_CLK_VOTER(dfab_sdc3_clk, &dfab_clk.c, 0);
4833static DEFINE_CLK_VOTER(dfab_sdc4_clk, &dfab_clk.c, 0);
4834static DEFINE_CLK_VOTER(dfab_sdc5_clk, &dfab_clk.c, 0);
4835static DEFINE_CLK_VOTER(dfab_sps_clk, &dfab_clk.c, 0);
4836static DEFINE_CLK_VOTER(dfab_bam_dmux_clk, &dfab_clk.c, 0);
4837static DEFINE_CLK_VOTER(dfab_scm_clk, &dfab_clk.c, 0);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004838static DEFINE_CLK_VOTER(dfab_msmbus_clk, &dfab_clk.c, 0);
4839static DEFINE_CLK_VOTER(dfab_msmbus_a_clk, &dfab_a_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004840
Matt Wagantall42cd12a2012-03-30 18:02:40 -07004841static DEFINE_CLK_VOTER(ebi1_msmbus_clk, &ebi1_clk.c, LONG_MAX);
Matt Wagantall35e78fc2012-04-05 14:18:44 -07004842static DEFINE_CLK_VOTER(ebi1_adm_clk, &ebi1_clk.c, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004843
Matt Wagantall33bac7e2012-05-22 14:59:05 -07004844static DEFINE_CLK_VOTER(ebi1_acpu_a_clk, &ebi1_a_clk.c, LONG_MAX);
4845static DEFINE_CLK_VOTER(ebi1_msmbus_a_clk, &ebi1_a_clk.c, LONG_MAX);
4846static DEFINE_CLK_VOTER(afab_acpu_a_clk, &afab_a_clk.c, LONG_MAX);
4847static DEFINE_CLK_VOTER(afab_msmbus_a_clk, &afab_a_clk.c, LONG_MAX);
4848
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004849#ifdef CONFIG_DEBUG_FS
4850struct measure_sel {
4851 u32 test_vector;
Matt Wagantallf82f2942012-01-27 13:56:13 -08004852 struct clk *c;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004853};
4854
Matt Wagantall8b38f942011-08-02 18:23:18 -07004855static DEFINE_CLK_MEASURE(l2_m_clk);
4856static DEFINE_CLK_MEASURE(krait0_m_clk);
4857static DEFINE_CLK_MEASURE(krait1_m_clk);
Tianyi Gou455c13c2012-02-02 16:33:24 -08004858static DEFINE_CLK_MEASURE(krait2_m_clk);
4859static DEFINE_CLK_MEASURE(krait3_m_clk);
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004860static DEFINE_CLK_MEASURE(q6sw_clk);
4861static DEFINE_CLK_MEASURE(q6fw_clk);
4862static DEFINE_CLK_MEASURE(q6_func_clk);
Matt Wagantall8b38f942011-08-02 18:23:18 -07004863
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004864static struct measure_sel measure_mux[] = {
4865 { TEST_PER_LS(0x08), &slimbus_xo_src_clk.c },
4866 { TEST_PER_LS(0x12), &sdc1_p_clk.c },
4867 { TEST_PER_LS(0x13), &sdc1_clk.c },
4868 { TEST_PER_LS(0x14), &sdc2_p_clk.c },
4869 { TEST_PER_LS(0x15), &sdc2_clk.c },
4870 { TEST_PER_LS(0x16), &sdc3_p_clk.c },
4871 { TEST_PER_LS(0x17), &sdc3_clk.c },
4872 { TEST_PER_LS(0x18), &sdc4_p_clk.c },
4873 { TEST_PER_LS(0x19), &sdc4_clk.c },
4874 { TEST_PER_LS(0x1A), &sdc5_p_clk.c },
4875 { TEST_PER_LS(0x1B), &sdc5_clk.c },
Matt Wagantall7625a4c2011-11-01 16:17:53 -07004876 { TEST_PER_LS(0x1F), &gp0_clk.c },
4877 { TEST_PER_LS(0x20), &gp1_clk.c },
4878 { TEST_PER_LS(0x21), &gp2_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004879 { TEST_PER_LS(0x25), &dfab_clk.c },
4880 { TEST_PER_LS(0x25), &dfab_a_clk.c },
4881 { TEST_PER_LS(0x26), &pmem_clk.c },
4882 { TEST_PER_LS(0x32), &dma_bam_p_clk.c },
4883 { TEST_PER_LS(0x33), &cfpb_clk.c },
4884 { TEST_PER_LS(0x33), &cfpb_a_clk.c },
4885 { TEST_PER_LS(0x3D), &gsbi1_p_clk.c },
4886 { TEST_PER_LS(0x3E), &gsbi1_uart_clk.c },
4887 { TEST_PER_LS(0x3F), &gsbi1_qup_clk.c },
4888 { TEST_PER_LS(0x41), &gsbi2_p_clk.c },
4889 { TEST_PER_LS(0x42), &gsbi2_uart_clk.c },
4890 { TEST_PER_LS(0x44), &gsbi2_qup_clk.c },
4891 { TEST_PER_LS(0x45), &gsbi3_p_clk.c },
4892 { TEST_PER_LS(0x46), &gsbi3_uart_clk.c },
4893 { TEST_PER_LS(0x48), &gsbi3_qup_clk.c },
4894 { TEST_PER_LS(0x49), &gsbi4_p_clk.c },
4895 { TEST_PER_LS(0x4A), &gsbi4_uart_clk.c },
4896 { TEST_PER_LS(0x4C), &gsbi4_qup_clk.c },
4897 { TEST_PER_LS(0x4D), &gsbi5_p_clk.c },
4898 { TEST_PER_LS(0x4E), &gsbi5_uart_clk.c },
4899 { TEST_PER_LS(0x50), &gsbi5_qup_clk.c },
4900 { TEST_PER_LS(0x51), &gsbi6_p_clk.c },
4901 { TEST_PER_LS(0x52), &gsbi6_uart_clk.c },
4902 { TEST_PER_LS(0x54), &gsbi6_qup_clk.c },
4903 { TEST_PER_LS(0x55), &gsbi7_p_clk.c },
4904 { TEST_PER_LS(0x56), &gsbi7_uart_clk.c },
4905 { TEST_PER_LS(0x58), &gsbi7_qup_clk.c },
4906 { TEST_PER_LS(0x59), &gsbi8_p_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004907 { TEST_PER_LS(0x59), &sfab_sata_s_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004908 { TEST_PER_LS(0x5A), &gsbi8_uart_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004909 { TEST_PER_LS(0x5A), &sata_p_clk.c },
4910 { TEST_PER_LS(0x5B), &sata_rxoob_clk.c },
4911 { TEST_PER_LS(0x5C), &sata_pmalive_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004912 { TEST_PER_LS(0x5C), &gsbi8_qup_clk.c },
4913 { TEST_PER_LS(0x5D), &gsbi9_p_clk.c },
4914 { TEST_PER_LS(0x5E), &gsbi9_uart_clk.c },
4915 { TEST_PER_LS(0x60), &gsbi9_qup_clk.c },
4916 { TEST_PER_LS(0x61), &gsbi10_p_clk.c },
4917 { TEST_PER_LS(0x62), &gsbi10_uart_clk.c },
4918 { TEST_PER_LS(0x64), &gsbi10_qup_clk.c },
4919 { TEST_PER_LS(0x65), &gsbi11_p_clk.c },
4920 { TEST_PER_LS(0x66), &gsbi11_uart_clk.c },
4921 { TEST_PER_LS(0x68), &gsbi11_qup_clk.c },
4922 { TEST_PER_LS(0x69), &gsbi12_p_clk.c },
4923 { TEST_PER_LS(0x6A), &gsbi12_uart_clk.c },
4924 { TEST_PER_LS(0x6C), &gsbi12_qup_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07004925 { TEST_PER_LS(0x5E), &pcie_p_clk.c },
4926 { TEST_PER_LS(0x5F), &ce3_p_clk.c },
4927 { TEST_PER_LS(0x60), &ce3_core_clk.c },
4928 { TEST_PER_LS(0x63), &usb_hs3_p_clk.c },
4929 { TEST_PER_LS(0x64), &usb_hs3_xcvr_clk.c },
4930 { TEST_PER_LS(0x65), &usb_hs4_p_clk.c },
4931 { TEST_PER_LS(0x66), &usb_hs4_xcvr_clk.c },
4932 { TEST_PER_LS(0x6B), &sata_phy_ref_clk.c },
4933 { TEST_PER_LS(0x6C), &sata_phy_cfg_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004934 { TEST_PER_LS(0x78), &sfpb_clk.c },
4935 { TEST_PER_LS(0x78), &sfpb_a_clk.c },
4936 { TEST_PER_LS(0x7A), &pmic_ssbi2_clk.c },
4937 { TEST_PER_LS(0x7B), &pmic_arb0_p_clk.c },
4938 { TEST_PER_LS(0x7C), &pmic_arb1_p_clk.c },
4939 { TEST_PER_LS(0x7D), &prng_clk.c },
4940 { TEST_PER_LS(0x7F), &rpm_msg_ram_p_clk.c },
4941 { TEST_PER_LS(0x80), &adm0_p_clk.c },
4942 { TEST_PER_LS(0x84), &usb_hs1_p_clk.c },
4943 { TEST_PER_LS(0x85), &usb_hs1_xcvr_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004944 { TEST_PER_LS(0x86), &usb_hsic_p_clk.c },
4945 { TEST_PER_LS(0x87), &usb_hsic_system_clk.c },
4946 { TEST_PER_LS(0x88), &usb_hsic_xcvr_fs_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004947 { TEST_PER_LS(0x89), &usb_fs1_p_clk.c },
4948 { TEST_PER_LS(0x8A), &usb_fs1_sys_clk.c },
4949 { TEST_PER_LS(0x8B), &usb_fs1_xcvr_clk.c },
4950 { TEST_PER_LS(0x8C), &usb_fs2_p_clk.c },
4951 { TEST_PER_LS(0x8D), &usb_fs2_sys_clk.c },
4952 { TEST_PER_LS(0x8E), &usb_fs2_xcvr_clk.c },
4953 { TEST_PER_LS(0x8F), &tsif_p_clk.c },
4954 { TEST_PER_LS(0x91), &tsif_ref_clk.c },
4955 { TEST_PER_LS(0x92), &ce1_p_clk.c },
4956 { TEST_PER_LS(0x94), &tssc_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004957 { TEST_PER_LS(0x9D), &usb_hsic_hsio_cal_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004958 { TEST_PER_LS(0xA4), &ce1_core_clk.c },
4959
4960 { TEST_PER_HS(0x07), &afab_clk.c },
4961 { TEST_PER_HS(0x07), &afab_a_clk.c },
4962 { TEST_PER_HS(0x18), &sfab_clk.c },
4963 { TEST_PER_HS(0x18), &sfab_a_clk.c },
Stephen Boyd3939c8d2011-08-29 17:36:22 -07004964 { TEST_PER_HS(0x26), &q6sw_clk },
4965 { TEST_PER_HS(0x27), &q6fw_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004966 { TEST_PER_HS(0x2A), &adm0_clk.c },
Tianyi Gou352955d2012-05-18 19:44:01 -07004967 { TEST_PER_HS(0x31), &sata_a_clk.c },
Tianyi Gou6613de52012-01-27 17:57:53 -08004968 { TEST_PER_HS(0x2D), &pcie_phy_ref_clk.c },
4969 { TEST_PER_HS(0x32), &pcie_a_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004970 { TEST_PER_HS(0x34), &ebi1_clk.c },
4971 { TEST_PER_HS(0x34), &ebi1_a_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07004972 { TEST_PER_HS(0x50), &usb_hsic_hsic_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004973
4974 { TEST_MM_LS(0x00), &dsi1_byte_clk.c },
4975 { TEST_MM_LS(0x01), &dsi2_byte_clk.c },
4976 { TEST_MM_LS(0x02), &cam1_clk.c },
4977 { TEST_MM_LS(0x06), &amp_p_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07004978 { TEST_MM_LS(0x07), &csi_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004979 { TEST_MM_LS(0x08), &dsi2_s_p_clk.c },
4980 { TEST_MM_LS(0x09), &dsi1_m_p_clk.c },
4981 { TEST_MM_LS(0x0A), &dsi1_s_p_clk.c },
4982 { TEST_MM_LS(0x0C), &gfx2d0_p_clk.c },
4983 { TEST_MM_LS(0x0D), &gfx2d1_p_clk.c },
4984 { TEST_MM_LS(0x0E), &gfx3d_p_clk.c },
4985 { TEST_MM_LS(0x0F), &hdmi_m_p_clk.c },
4986 { TEST_MM_LS(0x10), &hdmi_s_p_clk.c },
4987 { TEST_MM_LS(0x11), &ijpeg_p_clk.c },
4988 { TEST_MM_LS(0x12), &imem_p_clk.c },
4989 { TEST_MM_LS(0x13), &jpegd_p_clk.c },
4990 { TEST_MM_LS(0x14), &mdp_p_clk.c },
4991 { TEST_MM_LS(0x16), &rot_p_clk.c },
4992 { TEST_MM_LS(0x17), &dsi1_esc_clk.c },
4993 { TEST_MM_LS(0x18), &smmu_p_clk.c },
4994 { TEST_MM_LS(0x19), &tv_enc_p_clk.c },
4995 { TEST_MM_LS(0x1A), &vcodec_p_clk.c },
4996 { TEST_MM_LS(0x1B), &vfe_p_clk.c },
4997 { TEST_MM_LS(0x1C), &vpe_p_clk.c },
4998 { TEST_MM_LS(0x1D), &cam0_clk.c },
4999 { TEST_MM_LS(0x1F), &hdmi_app_clk.c },
5000 { TEST_MM_LS(0x20), &mdp_vsync_clk.c },
5001 { TEST_MM_LS(0x21), &tv_dac_clk.c },
5002 { TEST_MM_LS(0x22), &tv_enc_clk.c },
5003 { TEST_MM_LS(0x23), &dsi2_esc_clk.c },
5004 { TEST_MM_LS(0x25), &mmfpb_clk.c },
5005 { TEST_MM_LS(0x25), &mmfpb_a_clk.c },
5006 { TEST_MM_LS(0x26), &dsi2_m_p_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07005007 { TEST_MM_LS(0x27), &cam2_clk.c },
Tianyi Gou41515e22011-09-01 19:37:43 -07005008 { TEST_MM_LS(0x28), &vcap_p_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005009
5010 { TEST_MM_HS(0x00), &csi0_clk.c },
5011 { TEST_MM_HS(0x01), &csi1_clk.c },
Matt Wagantallc23eee92011-08-16 23:06:52 -07005012 { TEST_MM_HS(0x04), &csi_vfe_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005013 { TEST_MM_HS(0x05), &ijpeg_clk.c },
5014 { TEST_MM_HS(0x06), &vfe_clk.c },
5015 { TEST_MM_HS(0x07), &gfx2d0_clk.c },
5016 { TEST_MM_HS(0x08), &gfx2d1_clk.c },
5017 { TEST_MM_HS(0x09), &gfx3d_clk.c },
5018 { TEST_MM_HS(0x0A), &jpegd_clk.c },
5019 { TEST_MM_HS(0x0B), &vcodec_clk.c },
5020 { TEST_MM_HS(0x0F), &mmfab_clk.c },
5021 { TEST_MM_HS(0x0F), &mmfab_a_clk.c },
5022 { TEST_MM_HS(0x11), &gmem_axi_clk.c },
5023 { TEST_MM_HS(0x12), &ijpeg_axi_clk.c },
5024 { TEST_MM_HS(0x13), &imem_axi_clk.c },
5025 { TEST_MM_HS(0x14), &jpegd_axi_clk.c },
5026 { TEST_MM_HS(0x15), &mdp_axi_clk.c },
5027 { TEST_MM_HS(0x16), &rot_axi_clk.c },
5028 { TEST_MM_HS(0x17), &vcodec_axi_clk.c },
5029 { TEST_MM_HS(0x18), &vfe_axi_clk.c },
5030 { TEST_MM_HS(0x19), &vpe_axi_clk.c },
5031 { TEST_MM_HS(0x1A), &mdp_clk.c },
5032 { TEST_MM_HS(0x1B), &rot_clk.c },
5033 { TEST_MM_HS(0x1C), &vpe_clk.c },
5034 { TEST_MM_HS(0x1E), &hdmi_tv_clk.c },
5035 { TEST_MM_HS(0x1F), &mdp_tv_clk.c },
5036 { TEST_MM_HS(0x24), &csi0_phy_clk.c },
5037 { TEST_MM_HS(0x25), &csi1_phy_clk.c },
5038 { TEST_MM_HS(0x26), &csi_pix_clk.c },
5039 { TEST_MM_HS(0x27), &csi_rdi_clk.c },
5040 { TEST_MM_HS(0x28), &lut_mdp_clk.c },
5041 { TEST_MM_HS(0x29), &vcodec_axi_a_clk.c },
5042 { TEST_MM_HS(0x2A), &vcodec_axi_b_clk.c },
5043 { TEST_MM_HS(0x2B), &csi1phy_timer_clk.c },
5044 { TEST_MM_HS(0x2C), &csi0phy_timer_clk.c },
Stephen Boyd94625ef2011-07-12 17:06:01 -07005045 { TEST_MM_HS(0x2D), &csi2_clk.c },
5046 { TEST_MM_HS(0x2E), &csi2_phy_clk.c },
5047 { TEST_MM_HS(0x2F), &csi2phy_timer_clk.c },
5048 { TEST_MM_HS(0x30), &csi_pix1_clk.c },
5049 { TEST_MM_HS(0x31), &csi_rdi1_clk.c },
5050 { TEST_MM_HS(0x32), &csi_rdi2_clk.c },
Tianyi Gou621f8742011-09-01 21:45:01 -07005051 { TEST_MM_HS(0x33), &vcap_clk.c },
5052 { TEST_MM_HS(0x34), &vcap_npl_clk.c },
Tianyi Goue3d4f542012-03-15 17:06:45 -07005053 { TEST_MM_HS(0x34), &gfx3d_axi_clk_8930.c },
Tianyi Gou7747a962012-02-03 15:03:55 -08005054 { TEST_MM_HS(0x35), &vcap_axi_clk.c },
Tianyi Gou51918802012-01-26 14:05:43 -08005055 { TEST_MM_HS(0x36), &rgb_tv_clk.c },
5056 { TEST_MM_HS(0x37), &npl_tv_clk.c },
Patrick Dalye6f489042012-07-11 15:29:15 -07005057 { TEST_MM_HS(0x38), &gfx3d_axi_clk.c },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005058
5059 { TEST_LPA(0x0F), &mi2s_bit_clk.c },
5060 { TEST_LPA(0x10), &codec_i2s_mic_bit_clk.c },
5061 { TEST_LPA(0x11), &codec_i2s_spkr_bit_clk.c },
5062 { TEST_LPA(0x12), &spare_i2s_mic_bit_clk.c },
5063 { TEST_LPA(0x13), &spare_i2s_spkr_bit_clk.c },
5064 { TEST_LPA(0x14), &pcm_clk.c },
5065 { TEST_LPA(0x1D), &audio_slimbus_clk.c },
Matt Wagantall8b38f942011-08-02 18:23:18 -07005066
Stephen Boyd3939c8d2011-08-29 17:36:22 -07005067 { TEST_LPA_HS(0x00), &q6_func_clk },
5068
Stephen Boyd46fdf0d2011-11-22 12:25:09 -08005069 { TEST_CPUL2(0x2), &l2_m_clk },
5070 { TEST_CPUL2(0x0), &krait0_m_clk },
5071 { TEST_CPUL2(0x1), &krait1_m_clk },
Tianyi Gou455c13c2012-02-02 16:33:24 -08005072 { TEST_CPUL2(0x4), &krait2_m_clk },
5073 { TEST_CPUL2(0x5), &krait3_m_clk },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005074};
5075
Matt Wagantallf82f2942012-01-27 13:56:13 -08005076static struct measure_sel *find_measure_sel(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005077{
5078 int i;
5079
5080 for (i = 0; i < ARRAY_SIZE(measure_mux); i++)
Matt Wagantallf82f2942012-01-27 13:56:13 -08005081 if (measure_mux[i].c == c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005082 return &measure_mux[i];
5083 return NULL;
5084}
5085
Matt Wagantall8b38f942011-08-02 18:23:18 -07005086static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005087{
5088 int ret = 0;
5089 u32 clk_sel;
5090 struct measure_sel *p;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005091 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005092 unsigned long flags;
5093
5094 if (!parent)
5095 return -EINVAL;
5096
5097 p = find_measure_sel(parent);
5098 if (!p)
5099 return -EINVAL;
5100
5101 spin_lock_irqsave(&local_clock_reg_lock, flags);
5102
Matt Wagantall8b38f942011-08-02 18:23:18 -07005103 /*
5104 * Program the test vector, measurement period (sample_ticks)
5105 * and scaling multiplier.
5106 */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005107 measure->sample_ticks = 0x10000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005108 clk_sel = p->test_vector & TEST_CLK_SEL_MASK;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005109 measure->multiplier = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005110 switch (p->test_vector >> TEST_TYPE_SHIFT) {
5111 case TEST_TYPE_PER_LS:
5112 writel_relaxed(0x4030D00|BVAL(7, 0, clk_sel), CLK_TEST_REG);
5113 break;
5114 case TEST_TYPE_PER_HS:
5115 writel_relaxed(0x4020000|BVAL(16, 10, clk_sel), CLK_TEST_REG);
5116 break;
5117 case TEST_TYPE_MM_LS:
5118 writel_relaxed(0x4030D97, CLK_TEST_REG);
5119 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_LS_REG);
5120 break;
5121 case TEST_TYPE_MM_HS:
5122 writel_relaxed(0x402B800, CLK_TEST_REG);
5123 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_HS_REG);
5124 break;
5125 case TEST_TYPE_LPA:
5126 writel_relaxed(0x4030D98, CLK_TEST_REG);
5127 writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0),
5128 LCC_CLK_LS_DEBUG_CFG_REG);
5129 break;
Stephen Boyd3939c8d2011-08-29 17:36:22 -07005130 case TEST_TYPE_LPA_HS:
5131 writel_relaxed(0x402BC00, CLK_TEST_REG);
5132 writel_relaxed(BVAL(2, 1, clk_sel)|BIT(0),
5133 LCC_CLK_HS_DEBUG_CFG_REG);
5134 break;
Matt Wagantall8b38f942011-08-02 18:23:18 -07005135 case TEST_TYPE_CPUL2:
5136 writel_relaxed(0x4030400, CLK_TEST_REG);
5137 writel_relaxed(0x80|BVAL(5, 3, clk_sel), GCC_APCS_CLK_DIAG);
Matt Wagantallf82f2942012-01-27 13:56:13 -08005138 measure->sample_ticks = 0x4000;
5139 measure->multiplier = 2;
Patrick Daly73db3ad2012-10-01 18:56:41 -07005140 if (cpu_is_krait_v3())
5141 measure->multiplier = 8;
Matt Wagantall8b38f942011-08-02 18:23:18 -07005142 break;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005143 default:
5144 ret = -EPERM;
5145 }
5146 /* Make sure test vector is set before starting measurements. */
5147 mb();
5148
5149 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5150
5151 return ret;
5152}
5153
5154/* Sample clock for 'ticks' reference clock ticks. */
5155static u32 run_measurement(unsigned ticks)
5156{
5157 /* Stop counters and set the XO4 counter start value. */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005158 writel_relaxed(ticks, RINGOSC_TCXO_CTL_REG);
5159
5160 /* Wait for timer to become ready. */
5161 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) != 0)
5162 cpu_relax();
5163
5164 /* Run measurement and wait for completion. */
5165 writel_relaxed(BIT(20)|ticks, RINGOSC_TCXO_CTL_REG);
5166 while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) == 0)
5167 cpu_relax();
5168
5169 /* Stop counters. */
5170 writel_relaxed(0x0, RINGOSC_TCXO_CTL_REG);
5171
5172 /* Return measured ticks. */
5173 return readl_relaxed(RINGOSC_STATUS_REG) & BM(24, 0);
5174}
5175
5176
5177/* Perform a hardware rate measurement for a given clock.
5178 FOR DEBUG USE ONLY: Measurements take ~15 ms! */
Matt Wagantall9de3bfb2011-11-03 20:13:12 -07005179static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005180{
5181 unsigned long flags;
5182 u32 pdm_reg_backup, ringosc_reg_backup;
5183 u64 raw_count_short, raw_count_full;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005184 struct measure_clk *measure = to_measure_clk(c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005185 unsigned ret;
5186
Stephen Boyde334aeb2012-01-24 12:17:29 -08005187 ret = clk_prepare_enable(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005188 if (ret) {
5189 pr_warning("CXO clock failed to enable. Can't measure\n");
5190 return 0;
5191 }
5192
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005193 spin_lock_irqsave(&local_clock_reg_lock, flags);
5194
5195 /* Enable CXO/4 and RINGOSC branch and root. */
5196 pdm_reg_backup = readl_relaxed(PDM_CLK_NS_REG);
5197 ringosc_reg_backup = readl_relaxed(RINGOSC_NS_REG);
5198 writel_relaxed(0x2898, PDM_CLK_NS_REG);
5199 writel_relaxed(0xA00, RINGOSC_NS_REG);
5200
5201 /*
5202 * The ring oscillator counter will not reset if the measured clock
5203 * is not running. To detect this, run a short measurement before
5204 * the full measurement. If the raw results of the two are the same
5205 * then the clock must be off.
5206 */
5207
5208 /* Run a short measurement. (~1 ms) */
5209 raw_count_short = run_measurement(0x1000);
5210 /* Run a full measurement. (~14 ms) */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005211 raw_count_full = run_measurement(measure->sample_ticks);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005212
5213 writel_relaxed(ringosc_reg_backup, RINGOSC_NS_REG);
5214 writel_relaxed(pdm_reg_backup, PDM_CLK_NS_REG);
5215
5216 /* Return 0 if the clock is off. */
5217 if (raw_count_full == raw_count_short)
5218 ret = 0;
5219 else {
5220 /* Compute rate in Hz. */
5221 raw_count_full = ((raw_count_full * 10) + 15) * 4800000;
Matt Wagantallf82f2942012-01-27 13:56:13 -08005222 do_div(raw_count_full, ((measure->sample_ticks * 10) + 35));
5223 ret = (raw_count_full * measure->multiplier);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005224 }
5225
5226 /* Route dbg_hs_clk to PLLTEST. 300mV single-ended amplitude. */
Stephen Boyd69da8402011-07-14 17:45:31 -07005227 writel_relaxed(0x38F8, PLLTEST_PAD_CFG_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005228 spin_unlock_irqrestore(&local_clock_reg_lock, flags);
5229
Stephen Boyde334aeb2012-01-24 12:17:29 -08005230 clk_disable_unprepare(&cxo_clk.c);
Stephen Boyd3a35f0b2012-01-11 16:18:26 -08005231
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005232 return ret;
5233}
5234#else /* !CONFIG_DEBUG_FS */
Matt Wagantallf82f2942012-01-27 13:56:13 -08005235static int measure_clk_set_parent(struct clk *c, struct clk *parent)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005236{
5237 return -EINVAL;
5238}
5239
Matt Wagantallf82f2942012-01-27 13:56:13 -08005240static unsigned long measure_clk_get_rate(struct clk *c)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005241{
5242 return 0;
5243}
5244#endif /* CONFIG_DEBUG_FS */
5245
Matt Wagantallae053222012-05-14 19:42:07 -07005246static struct clk_ops clk_ops_measure = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005247 .set_parent = measure_clk_set_parent,
5248 .get_rate = measure_clk_get_rate,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005249};
5250
Matt Wagantall8b38f942011-08-02 18:23:18 -07005251static struct measure_clk measure_clk = {
5252 .c = {
5253 .dbg_name = "measure_clk",
Matt Wagantallae053222012-05-14 19:42:07 -07005254 .ops = &clk_ops_measure,
Matt Wagantall8b38f942011-08-02 18:23:18 -07005255 CLK_INIT(measure_clk.c),
5256 },
5257 .multiplier = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005258};
5259
Tianyi Goua8b3cce2011-11-08 14:37:26 -08005260static struct clk_lookup msm_clocks_8064[] = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005261 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5262 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Mohan Pallaka804ca592012-06-14 14:37:38 +05305263 CLK_LOOKUP("pwm_clk", cxo_clk.c, "0-0048"),
Stephen Boyded630b02012-01-26 15:26:47 -08005264 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5265 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
Stephen Boydbdb53f32012-06-05 18:39:47 -07005266 CLK_LOOKUP("xo", pxo_clk.c, "pil-q6v4-lpass"),
Matt Wagantall292aace2012-01-26 19:12:34 -08005267 CLK_LOOKUP("xo", cxo_clk.c, "pil_gss"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005268 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005269 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
David Collinsa7d23532012-08-02 10:48:16 -07005270 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Stephen Boyded630b02012-01-26 15:26:47 -08005271 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5272 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5273 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5274 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005275
Matt Wagantalld75f1312012-05-23 16:17:35 -07005276 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5277 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5278 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5279 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5280 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5281 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5282 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5283 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5284 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5285 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5286 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5287 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5288 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5289 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5290 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5291 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5292
Tianyi Gou21a0e802012-02-04 22:34:10 -08005293 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005294 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005295 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5296 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5297 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005298 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005299 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5300 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5301 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5302 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5303 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005304 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005305 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5306 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005307 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005308 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5309 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5310 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5311 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5312 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5313 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5314 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005315
Tianyi Gou21a0e802012-02-04 22:34:10 -08005316 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005317 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, ""),
5318 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5319 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005320
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005321 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5322 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5323 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005324 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, "msm_serial_hsl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005325 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
Rohit Vaswani0454abb2013-01-09 13:39:37 -08005326 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, "msm_serial_hsl.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005327 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5328 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
Rohit Vaswani0454abb2013-01-09 13:39:37 -08005329 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, "msm_serial_hsl.4"),
Saket Saurabhd425a5d2012-11-06 16:08:28 +05305330 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.2"),
Mayank Rana262e9032012-05-10 15:14:00 -07005331 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005332 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, "msm_serial_hsl.0"),
David Keitel3c40fc52012-02-09 17:53:52 -08005333 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005334 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Jing Lin04601f92012-02-05 15:36:07 -08005335 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005336 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005337 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005338 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "qup_i2c.5"),
Bar Weinerf82c5872012-10-23 14:31:26 +02005339 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, "spi_qsd.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005340 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5341 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Tianyi Gou50f23812012-02-06 16:04:19 -08005342 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Tianyi Gou05e01102012-02-08 22:15:49 -08005343 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005344 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5345 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5346 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5347 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
Joel Nider6cbe66a2012-06-26 11:11:59 +03005348 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.0"),
5349 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.0"),
5350 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.1"),
5351 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005352 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005353 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5354 CLK_LOOKUP("alt_core_clk", usb_hs3_xcvr_clk.c, "msm_ehci_host.0"),
5355 CLK_LOOKUP("alt_core_clk", usb_hs4_xcvr_clk.c, "msm_ehci_host.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005356 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5357 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5358 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
Sujit Reddy Thummab0d51e72012-12-31 15:37:16 +05305359 CLK_LOOKUP("ref_clk", sata_phy_ref_clk.c, "msm_sata.0"),
5360 CLK_LOOKUP("cfg_clk", sata_phy_cfg_clk.c, "msm_sata.0"),
5361 CLK_LOOKUP("src_clk", sata_src_clk.c, "msm_sata.0"),
5362 CLK_LOOKUP("core_rxoob_clk", sata_rxoob_clk.c, "msm_sata.0"),
5363 CLK_LOOKUP("core_pmalive_clk", sata_pmalive_clk.c, "msm_sata.0"),
5364 CLK_LOOKUP("bus_clk", sata_a_clk.c, "msm_sata.0"),
5365 CLK_LOOKUP("iface_clk", sata_p_clk.c, "msm_sata.0"),
5366 CLK_LOOKUP("slave_iface_clk", sfab_sata_s_p_clk.c, "msm_sata.0"),
Ramesh Masavarapu28311912011-10-27 11:04:12 -07005367 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qce.0"),
5368 CLK_LOOKUP("iface_clk", ce3_p_clk.c, "qcrypto.0"),
5369 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qce.0"),
5370 CLK_LOOKUP("core_clk", ce3_core_clk.c, "qcrypto.0"),
5371 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qce.0"),
5372 CLK_LOOKUP("ce3_core_src_clk", ce3_src_clk.c, "qcrypto.0"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005373 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005374 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "msm_serial_hsl.1"),
David Keitel3c40fc52012-02-09 17:53:52 -08005375 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "qup_i2c.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005376 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Rohit Vaswani0454abb2013-01-09 13:39:37 -08005377 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, "msm_serial_hsl.3"),
Jing Lin04601f92012-02-05 15:36:07 -08005378 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
Kevin Chand07220e2012-02-13 15:52:22 -08005379 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Saket Saurabhd425a5d2012-11-06 16:08:28 +05305380 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.2"),
Stepan Moskovchenko64999002012-01-31 15:52:59 -08005381 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "spi_qsd.0"),
Joel King8f839b92012-04-01 14:37:46 -07005382 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "qup_i2c.5"),
Mayank Rana262e9032012-05-10 15:14:00 -07005383 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Bar Weinerf82c5872012-10-23 14:31:26 +02005384 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "spi_qsd.1"),
Jin Hong4bbbfba2012-02-02 21:48:07 -08005385 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, "msm_serial_hsl.0"),
Rohit Vaswani0454abb2013-01-09 13:39:37 -08005386 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, "msm_serial_hsl.4"),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005387 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5388 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005389 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005390 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Manu Gautam7483f172011-11-08 15:22:26 +05305391 CLK_LOOKUP("iface_clk", usb_hs3_p_clk.c, "msm_ehci_host.0"),
5392 CLK_LOOKUP("iface_clk", usb_hs4_p_clk.c, "msm_ehci_host.1"),
Tianyi Gou43208a02011-09-27 15:35:13 -07005393 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5394 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5395 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5396 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06005397 CLK_LOOKUP("iface_clk", pcie_p_clk.c, "msm_pcie"),
5398 CLK_LOOKUP("ref_clk", pcie_phy_ref_clk.c, "msm_pcie"),
5399 CLK_LOOKUP("bus_clk", pcie_a_clk.c, "msm_pcie"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005400 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5401 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005402 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5403 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5404 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5405 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chand07220e2012-02-13 15:52:22 -08005406 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Punit Soni57850102012-09-26 11:31:27 -07005407 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0010"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005408 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Sreesudhan Ramakrish Ramkumar8002a792012-04-09 17:42:58 -07005409 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -08005410 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Kevin Chand07220e2012-02-13 15:52:22 -08005411 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
Stephen Boyd85328b22012-09-19 17:07:16 -07005412 CLK_LOOKUP("cam_clk", cam2_clk.c, ""),
Kevin Chand07220e2012-02-13 15:52:22 -08005413 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5414 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
5415 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
5416 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5417 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
5418 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
5419 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5420 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
5421 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
Kevin Chand07220e2012-02-13 15:52:22 -08005422 CLK_LOOKUP("csiphy_timer_src_clk",
5423 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5424 CLK_LOOKUP("csiphy_timer_src_clk",
5425 csiphy_timer_src_clk.c, "msm_csiphy.1"),
5426 CLK_LOOKUP("csiphy_timer_src_clk",
5427 csiphy_timer_src_clk.c, "msm_csiphy.2"),
5428 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5429 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
5430 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005431 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5432 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5433 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5434 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Tianyi Gou51918802012-01-26 14:05:43 -08005435 CLK_LOOKUP("rgb_clk", rgb_tv_clk.c, ""),
5436 CLK_LOOKUP("npl_clk", npl_tv_clk.c, ""),
5437
Pu Chen86b4be92011-11-03 17:27:57 -07005438 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005439 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005440 CLK_LOOKUP("bus_clk",
Patrick Dalye6f489042012-07-11 15:29:15 -07005441 gfx3d_axi_clk.c, "footswitch-8x60.2"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005442 CLK_LOOKUP("iface_clk", vcap_p_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005443 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005444 CLK_LOOKUP("iface_clk", vcap_p_clk.c, "footswitch-8x60.10"),
5445 CLK_LOOKUP("bus_clk", vcap_axi_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005446 CLK_LOOKUP("core_clk", vcap_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005447 CLK_LOOKUP("core_clk", vcap_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005448 CLK_LOOKUP("core_clk", vcap_clk.c, "footswitch-8x60.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005449 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, ""),
Terence Hampson2e1705f2012-04-11 19:55:29 -04005450 CLK_LOOKUP("vcap_npl_clk", vcap_npl_clk.c, "msm_vcap.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005451 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005452 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5453 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005454 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005455 CLK_LOOKUP("core_clk", jpegd_clk.c, ""),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005456 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005457 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005458 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005459 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005460 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005461 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005462 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005463 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Matt Wagantall61286312012-02-22 15:55:09 -08005464 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005465 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5466 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
Greg Griscofa47b532011-11-11 10:32:06 -08005467 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005468 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005469 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
Tianyi Gou51918802012-01-26 14:05:43 -08005470 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005471 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005472 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Ujwal Pateld041f982012-03-27 19:51:44 -07005473 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005474 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chand07220e2012-02-13 15:52:22 -08005475 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005476 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chand07220e2012-02-13 15:52:22 -08005477 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005478 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5479 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5480 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5481 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5482 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5483 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5484 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005485 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5486 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chand07220e2012-02-13 15:52:22 -08005487 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5488 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
5489 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005490 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5491 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5492 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5493 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Pu Chen86b4be92011-11-03 17:27:57 -07005494 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005495 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08005496 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5497 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005498 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005499 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005500 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005501 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005502 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005503 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Olav Haugan0e22c482013-01-28 17:39:36 -08005504 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.0"),
5505 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.1"),
5506 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.2"),
5507 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.3"),
5508 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.4"),
5509 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.5"),
5510 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.6"),
5511 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.7"),
5512 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.8"),
5513 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.9"),
5514 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.10"),
5515 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.11"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005516 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005517 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Greg Griscofa47b532011-11-11 10:32:06 -08005518 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005519 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chand07220e2012-02-13 15:52:22 -08005520 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantallc9a780c2011-10-28 12:12:18 -07005521 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chanb20742b2012-02-27 15:47:35 -08005522 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall61286312012-02-22 15:55:09 -08005523 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005524
Patrick Lai04baee942012-05-01 14:38:47 -07005525 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5526 "msm-dai-q6-mi2s"),
5527 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5528 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005529 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5530 "msm-dai-q6.1"),
5531 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5532 "msm-dai-q6.1"),
5533 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5534 "msm-dai-q6.5"),
5535 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5536 "msm-dai-q6.5"),
5537 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wangdea7c822012-08-20 20:52:42 -07005538 "msm-dai-q6.0"),
5539 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5540 "msm-dai-q6.0"),
5541 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005542 "msm-dai-q6.16384"),
5543 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5544 "msm-dai-q6.16384"),
5545 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5546 "msm-dai-q6.4"),
5547 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5548 "msm-dai-q6.4"),
5549 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005550 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005551 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, ""),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005552 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005553 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, ""),
5554 CLK_LOOKUP("core_clk", vpe_axi_clk.c, ""),
5555 CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""),
5556 CLK_LOOKUP("core_clk", vcap_axi_clk.c, ""),
5557 CLK_LOOKUP("core_clk", rot_axi_clk.c, ""),
5558 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, ""),
5559 CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""),
5560 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, ""),
5561 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, ""),
Patrick Dalye6f489042012-07-11 15:29:15 -07005562 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, ""),
Tianyi Gou21a0e802012-02-04 22:34:10 -08005563
5564 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
5565 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
5566 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.0"),
5567 CLK_LOOKUP("core_clk", dfab_usb_hs3_clk.c, "msm_ehci_host.1"),
5568 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5569 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5570 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5571 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5572 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
5573 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
5574 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
5575
Manu Gautam5143b252012-01-05 19:25:23 -08005576 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5577 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5578 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5579 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5580 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Tianyi Gou41515e22011-09-01 19:37:43 -07005581
Olav Haugan0e22c482013-01-28 17:39:36 -08005582 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu-v0.0"),
5583 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu-v0.1"),
5584 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu-v0.2"),
5585 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu-v0.3"),
5586 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu-v0.4"),
5587 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu-v0.5"),
5588 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu-v0.6"),
5589 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu-v0.7"),
5590 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu-v0.8"),
5591 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu-v0.9"),
5592 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu-v0.10"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005593
Olav Haugan0e22c482013-01-28 17:39:36 -08005594 CLK_LOOKUP("core_clk", vcap_axi_clk.c, "msm_iommu-v0.11"),
Stepan Moskovchenko279b7852012-01-31 20:42:46 -08005595
Deepak Kotur954b1782012-04-24 17:58:19 -07005596 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5597 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5598 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5599 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5600 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005601 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5602 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
5603
Jeff Ohlstein8c116c72011-10-27 17:34:48 -07005604 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005605 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5606 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005607
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07005608 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
5609 CLK_LOOKUP("reset2_clk", dsi2_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07005610
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005611 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5612 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5613 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
Tianyi Gou455c13c2012-02-02 16:33:24 -08005614 CLK_LOOKUP("krait2_mclk", krait2_m_clk, ""),
5615 CLK_LOOKUP("krait3_mclk", krait3_m_clk, ""),
Tianyi Gou41515e22011-09-01 19:37:43 -07005616};
5617
Patrick Dalye6f489042012-07-11 15:29:15 -07005618static struct clk_lookup msm_clocks_8960_common[] __initdata = {
Stephen Boyd72a80352012-01-26 15:57:38 -08005619 CLK_LOOKUP("xo", cxo_a_clk.c, ""),
5620 CLK_LOOKUP("xo", pxo_a_clk.c, ""),
Stephen Boyded630b02012-01-26 15:26:47 -08005621 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5622 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
Stephen Boydbdb53f32012-06-05 18:39:47 -07005623 CLK_LOOKUP("xo", pxo_clk.c, "pil-q6v4-lpass"),
5624 CLK_LOOKUP("xo", cxo_clk.c, "pil-q6v4-modem"),
Stephen Boyd69d35e32012-02-14 15:33:30 -08005625 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
Stephen Boyd5a190a82012-03-01 14:45:15 -08005626 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
David Collinsa7d23532012-08-02 10:48:16 -07005627 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Stephen Boyded630b02012-01-26 15:26:47 -08005628 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5629 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5630 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5631 CLK_LOOKUP("measure", measure_clk.c, "debug"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005632
Matt Wagantalld75f1312012-05-23 16:17:35 -07005633 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5634 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5635 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
5636 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
5637 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
5638 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
5639 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
5640 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
5641 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
5642 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
5643 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
5644 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
5645 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
5646 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
5647 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
5648 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
5649
Matt Wagantallb2710b82011-11-16 19:55:17 -08005650 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005651 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005652 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
5653 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
5654 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
Stephen Boydd7a143a2012-02-16 17:59:26 -08005655 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005656 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
5657 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
5658 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
5659 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
5660 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005661 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06005662 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
5663 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07005664 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07005665 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
5666 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
5667 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
5668 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
5669 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
5670 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
5671 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005672
5673 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Matt Wagantallb2710b82011-11-16 19:55:17 -08005674 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
5675 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
5676 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005677
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005678 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
5679 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
5680 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
5681 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
5682 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
5683 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
5684 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
Matt Wagantalle2522372011-08-17 14:52:21 -07005685 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
5686 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005687 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
Mayank Rana1f02d952012-07-04 19:11:20 +05305688 /* used on 8960 SGLTE for console */
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005689 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hsl.1"),
Mayank Rana1f02d952012-07-04 19:11:20 +05305690 /* used on 8960 standalone with Atheros Bluetooth */
5691 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, "msm_serial_hs.2"),
Mayank Ranae009c922012-03-22 03:02:06 +05305692 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, "msm_serial_hs.1"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005693 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
5694 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
5695 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005696 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005697 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005698 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
5699 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005700 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
5701 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
5702 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
5703 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005704 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005705 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005706 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005707 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005708 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
Vikram Mulukutladd0a2372011-09-19 15:58:21 -07005709 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
Matt Wagantallc1205292011-08-11 17:19:31 -07005710 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005711 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
5712 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
5713 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
5714 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
5715 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005716 CLK_LOOKUP("slimbus_xo_src_clk", slimbus_xo_src_clk.c, NULL),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005717 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005718 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
5719 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005720 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
5721 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
5722 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
5723 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
5724 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
5725 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005726 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
5727 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
5728 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
5729 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
5730 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005731 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005732 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
Matt Wagantallc4b3a4d2011-08-17 16:58:39 -07005733 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
Matt Wagantalle0b11452011-09-13 17:25:33 -07005734 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005735 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
Matt Wagantallac294852011-08-17 15:44:58 -07005736 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005737 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005738 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
5739 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
Matt Wagantalle2522372011-08-17 14:52:21 -07005740 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
5741 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005742 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
Mayank Rana1f02d952012-07-04 19:11:20 +05305743 /* used on 8960 SGLTE for serial console */
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07005744 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hsl.1"),
Mayank Rana1f02d952012-07-04 19:11:20 +05305745 /* used on 8960 standalone with Atheros Bluetooth */
5746 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "msm_serial_hs.2"),
Mayank Ranae009c922012-03-22 03:02:06 +05305747 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "msm_serial_hs.1"),
Matt Wagantallac294852011-08-17 15:44:58 -07005748 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005749 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
Matt Wagantallac294852011-08-17 15:44:58 -07005750 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005751 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
Joel Nider6d7d16c2012-05-30 18:02:42 +03005752 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tspp.0"),
5753 CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tspp.0"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005754 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
5755 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
Manu Gautam5143b252012-01-05 19:25:23 -08005756 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005757 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
5758 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
5759 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
5760 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
5761 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
Matt Wagantalle1a86062011-08-18 17:46:10 -07005762 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
5763 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005764 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
5765 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
5766 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
5767 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Kevin Chan09f4e662011-12-16 08:17:02 -08005768 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
5769 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-006c"),
5770 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0048"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005771 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -08005772 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -08005773 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0034"),
Punit Soni57850102012-09-26 11:31:27 -07005774 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0010"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005775 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
5776 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005777 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005778 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
5779 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005780 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005781 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
5782 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005783 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
Kevin Chane12c6672011-10-26 11:55:26 -07005784 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
5785 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
Tianyi Gou3022dfd2012-01-25 15:50:05 -08005786 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
5787 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
5788 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
5789 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
5790 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
5791 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
5792 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
Kevin Chanf6216f22011-10-25 18:40:11 -07005793 CLK_LOOKUP("csiphy_timer_src_clk",
5794 csiphy_timer_src_clk.c, "msm_csiphy.0"),
5795 CLK_LOOKUP("csiphy_timer_src_clk",
5796 csiphy_timer_src_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005797 CLK_LOOKUP("csiphy_timer_src_clk",
5798 csiphy_timer_src_clk.c, "msm_csiphy.2"),
Kevin Chanf6216f22011-10-25 18:40:11 -07005799 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
5800 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005801 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005802 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
5803 CLK_LOOKUP("byte_clk", dsi2_byte_clk.c, "mipi_dsi.2"),
5804 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
5805 CLK_LOOKUP("esc_clk", dsi2_esc_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005806 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005807 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
5808 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005809 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
5810 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005811 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07005812 CLK_LOOKUP("core_clk", jpegd_clk.c, "msm_mercury.0"),
5813 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, "msm_mercury.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005814 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005815 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005816 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005817 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005818 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005819 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005820 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005821 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005822 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
5823 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005824 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005825 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005826 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005827 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
5828 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Matt Wagantallb82a5132011-12-12 22:26:41 -08005829 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005830 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005831 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
Kevin Chana0853122011-11-07 19:48:44 -08005832 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005833 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
Kevin Chan5827c552011-10-28 18:36:32 -07005834 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005835 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
Kevin Chan5827c552011-10-28 18:36:32 -07005836 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005837 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
5838 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
5839 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
5840 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
5841 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
5842 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
5843 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005844 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
5845 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.2"),
Kevin Chanc8b52e82011-10-25 23:20:21 -07005846 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
5847 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -08005848 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005849 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
5850 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
5851 CLK_LOOKUP("master_iface_clk", dsi2_m_p_clk.c, "mipi_dsi.2"),
5852 CLK_LOOKUP("slave_iface_clk", dsi2_s_p_clk.c, "mipi_dsi.2"),
Matt Wagantall9dc01632011-08-17 18:55:04 -07005853 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005854 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
Matt Wagantall5a4f1ba2011-08-18 18:13:03 -07005855 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
5856 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07005857 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005858 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005859 CLK_LOOKUP("iface_clk", jpegd_p_clk.c, ""),
Matt Wagantall5d44ef22012-01-23 11:01:05 -08005860 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07005861 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005862 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Olav Haugan0e22c482013-01-28 17:39:36 -08005863 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.0"),
5864 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.1"),
5865 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.2"),
5866 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.3"),
5867 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.4"),
5868 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.5"),
5869 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.6"),
5870 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.7"),
5871 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.8"),
5872 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.9"),
Matt Wagantallbb90da92011-10-25 15:07:52 -07005873 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005874 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
Matt Wagantall3f7660b2011-08-17 21:25:13 -07005875 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005876 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
Kevin Chan5827c552011-10-28 18:36:32 -07005877 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005878 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
Kevin Chana0853122011-11-07 19:48:44 -08005879 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
Matt Wagantall49722712011-08-17 18:50:53 -07005880 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
Patrick Lai04baee942012-05-01 14:38:47 -07005881 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c,
5882 "msm-dai-q6-mi2s"),
5883 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c,
5884 "msm-dai-q6-mi2s"),
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005885 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
5886 "msm-dai-q6.1"),
5887 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
5888 "msm-dai-q6.1"),
5889 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
5890 "msm-dai-q6.5"),
5891 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
5892 "msm-dai-q6.5"),
5893 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wangdea7c822012-08-20 20:52:42 -07005894 "msm-dai-q6.0"),
5895 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5896 "msm-dai-q6.0"),
5897 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wanga9c3acc2012-02-09 17:00:45 -08005898 "msm-dai-q6.16384"),
5899 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
5900 "msm-dai-q6.16384"),
5901 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
5902 "msm-dai-q6.4"),
5903 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
5904 "msm-dai-q6.4"),
5905 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
Kiran Kandi5f4ab692012-02-23 11:23:56 -08005906 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.3"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005907 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
Tianyi Gou44a81b02012-02-06 17:49:07 -08005908 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Olav Haugan0e22c482013-01-28 17:39:36 -08005909 CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu-v0.0"),
5910 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu-v0.1"),
5911 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu-v0.2"),
5912 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu-v0.3"),
5913 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu-v0.4"),
5914 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu-v0.5"),
5915 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu-v0.6"),
5916 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu-v0.7"),
5917 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu-v0.8"),
5918 CLK_LOOKUP("core_clk", gfx3d_clk.c, "msm_iommu-v0.9"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005919
5920 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
5921 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
5922 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
5923 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
5924 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08005925 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
5926 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Gopikrishnaiah Anandan4d05ed32012-01-13 11:08:44 -08005927
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005928 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
Manu Gautam5143b252012-01-05 19:25:23 -08005929 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
Matt Wagantall37ce3842011-08-17 16:00:36 -07005930 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
5931 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
5932 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
5933 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
5934 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
Yan He160633e2011-06-30 12:18:56 -07005935 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
Stephen Boyd1c51a492011-10-26 12:11:47 -07005936 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
Stephen Boydef5d1c42011-12-15 20:47:14 -08005937 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005938
Matt Wagantalle1a86062011-08-18 17:46:10 -07005939 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07005940 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
5941 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Matt Wagantall8b38f942011-08-02 18:23:18 -07005942
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07005943 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
5944 CLK_LOOKUP("reset2_clk", dsi2_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07005945
Matt Wagantallc00f95d2012-01-05 14:22:45 -08005946 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
5947 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
5948 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
5949 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
5950 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
5951 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005952};
5953
Patrick Dalye6f489042012-07-11 15:29:15 -07005954static struct clk_lookup msm_clocks_8960_only[] __initdata = {
5955 CLK_LOOKUP("enc_clk", tv_enc_clk.c, "tvenc.0"),
5956 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
5957 CLK_LOOKUP("iface_clk", tv_enc_p_clk.c, "tvenc.0"),
5958
5959 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "kgsl-2d0.0"),
5960 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "footswitch-8x60.0"),
5961 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "kgsl-2d1.1"),
5962 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "footswitch-8x60.1"),
5963 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "kgsl-2d0.0"),
5964 CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "footswitch-8x60.0"),
5965 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "kgsl-2d1.1"),
5966 CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "footswitch-8x60.1"),
Olav Haugan0e22c482013-01-28 17:39:36 -08005967 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.10"),
5968 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.11"),
5969 CLK_LOOKUP("core_clk", gfx2d0_clk.c, "msm_iommu-v0.10"),
5970 CLK_LOOKUP("core_clk", gfx2d1_clk.c, "msm_iommu-v0.11"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005971};
5972
5973static struct clk_lookup msm_clocks_8960ab_only[] __initdata = {
5974 CLK_LOOKUP("bus_clk", gfx3d_axi_clk.c, "footswitch-8x60.2"),
Olav Haugan0e22c482013-01-28 17:39:36 -08005975 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.10"),
5976 CLK_LOOKUP("core_clk", gfx3d_axi_clk.c, "msm_iommu-v0.10"),
Patrick Dalye6f489042012-07-11 15:29:15 -07005977 CLK_LOOKUP("div_clk", tv_src_div_clk.c, ""),
5978};
5979
5980static struct clk_lookup msm_clocks_8960[ARRAY_SIZE(msm_clocks_8960_common)
5981 + ARRAY_SIZE(msm_clocks_8960_only)
5982 + ARRAY_SIZE(msm_clocks_8960ab_only)];
5983
Tianyi Goue3d4f542012-03-15 17:06:45 -07005984static struct clk_lookup msm_clocks_8930[] = {
Stephen Boydbe1a7392012-04-02 20:17:11 -07005985 CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005986 CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
5987 CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
Stephen Boydbdb53f32012-06-05 18:39:47 -07005988 CLK_LOOKUP("xo", pxo_clk.c, "pil-q6v4-lpass"),
5989 CLK_LOOKUP("xo", cxo_clk.c, "pil-q6v4-modem"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005990 CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
David Collinsa7d23532012-08-02 10:48:16 -07005991 CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07005992 CLK_LOOKUP("pll2", pll2_clk.c, NULL),
5993 CLK_LOOKUP("pll8", pll8_clk.c, NULL),
5994 CLK_LOOKUP("pll4", pll4_clk.c, NULL),
5995 CLK_LOOKUP("measure", measure_clk.c, "debug"),
5996
Matt Wagantalld75f1312012-05-23 16:17:35 -07005997 CLK_LOOKUP("bus_clk", afab_clk.c, ""),
5998 CLK_LOOKUP("bus_clk", afab_a_clk.c, ""),
5999 CLK_LOOKUP("bus_clk", cfpb_clk.c, ""),
6000 CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""),
6001 CLK_LOOKUP("bus_clk", dfab_clk.c, ""),
6002 CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""),
6003 CLK_LOOKUP("mem_clk", ebi1_clk.c, ""),
6004 CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""),
6005 CLK_LOOKUP("bus_clk", mmfab_clk.c, ""),
6006 CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""),
6007 CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""),
6008 CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""),
6009 CLK_LOOKUP("bus_clk", sfab_clk.c, ""),
6010 CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""),
6011 CLK_LOOKUP("bus_clk", sfpb_clk.c, ""),
6012 CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""),
6013
Tianyi Goue3d4f542012-03-15 17:06:45 -07006014 CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07006015 CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006016 CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"),
6017 CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"),
6018 CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"),
6019 CLK_LOOKUP("bus_a_clk", sfab_msmbus_a_clk.c, "msm_sys_fab"),
6020 CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"),
6021 CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"),
6022 CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"),
6023 CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"),
6024 CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07006025 CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"),
Gagan Macbc5f81d2012-04-04 15:03:12 -06006026 CLK_LOOKUP("dfab_clk", dfab_msmbus_clk.c, "msm_bus"),
6027 CLK_LOOKUP("dfab_a_clk", dfab_msmbus_a_clk.c, "msm_bus"),
Pratik Patelf17b1472012-05-25 22:23:52 -07006028 CLK_LOOKUP("core_a_clk", qdss_a_clk.c, ""),
Pratik Patel3b0ca882012-06-01 16:54:14 -07006029 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-tpiu.0"),
6030 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etb.0"),
6031 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-funnel.0"),
6032 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.0"),
6033 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.1"),
6034 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.2"),
6035 CLK_LOOKUP("core_clk", qdss_clk.c, "coresight-etm.3"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006036
6037 CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006038 CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL),
6039 CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8960"),
6040 CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, "clock-8960"),
6041
6042 CLK_LOOKUP("core_clk", gp0_clk.c, ""),
6043 CLK_LOOKUP("core_clk", gp1_clk.c, ""),
6044 CLK_LOOKUP("core_clk", gp2_clk.c, ""),
6045 CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""),
6046 CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""),
6047 CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, ""),
6048 CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""),
6049 CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"),
6050 CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"),
6051 CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""),
6052 CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, ""),
6053 CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, ""),
6054 CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""),
6055 CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""),
6056 CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, ""),
6057 CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"),
6058 CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
6059 CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
6060 CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
6061 CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""),
6062 CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
6063 CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
6064 CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, ""),
6065 CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, "qup_i2c.0"),
6066 CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"),
6067 CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""),
6068 CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"),
6069 CLK_LOOKUP("core_clk", pdm_clk.c, ""),
6070 CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_sps"),
6071 CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"),
6072 CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"),
6073 CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"),
6074 CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"),
6075 CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"),
6076 CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"),
6077 CLK_LOOKUP("ref_clk", tsif_ref_clk.c, ""),
6078 CLK_LOOKUP("core_clk", tssc_clk.c, ""),
6079 CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"),
6080 CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"),
6081 CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""),
6082 CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""),
6083 CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""),
6084 CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""),
6085 CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""),
6086 CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""),
6087 CLK_LOOKUP("alt_core_clk", usb_hsic_xcvr_fs_clk.c, "msm_hsic_host"),
6088 CLK_LOOKUP("phy_clk", usb_hsic_hsic_clk.c, "msm_hsic_host"),
6089 CLK_LOOKUP("cal_clk", usb_hsic_hsio_cal_clk.c, "msm_hsic_host"),
6090 CLK_LOOKUP("core_clk", usb_hsic_system_clk.c, "msm_hsic_host"),
6091 CLK_LOOKUP("iface_clk", usb_hsic_p_clk.c, "msm_hsic_host"),
6092 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"),
6093 CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qcrypto.0"),
6094 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"),
6095 CLK_LOOKUP("core_clk", ce1_core_clk.c, "qcrypto.0"),
6096 CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL),
6097 CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"),
6098 CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
6099 CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
6100 CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
6101 CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"),
6102 CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"),
6103 CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, ""),
6104 CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, ""),
6105 CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "qup_i2c.0"),
6106 CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"),
6107 CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""),
6108 CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"),
6109 CLK_LOOKUP("iface_clk", tsif_p_clk.c, ""),
6110 CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""),
6111 CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""),
6112 CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"),
6113 CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"),
6114 CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"),
6115 CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"),
6116 CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"),
6117 CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"),
6118 CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"),
6119 CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"),
6120 CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""),
6121 CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""),
6122 CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
6123 CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006124 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
Hody Hung994f4622012-04-24 10:27:45 -07006125 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
Sreesudhan Ramakrish Ramkumar981c82c2012-04-30 17:31:37 -07006126 CLK_LOOKUP("cam_clk", cam1_clk.c, "4-0048"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006127 CLK_LOOKUP("cam_clk", cam2_clk.c, NULL),
6128 CLK_LOOKUP("cam_clk", cam0_clk.c, "4-0020"),
6129 CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
6130 CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
6131 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
6132 CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
6133 CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
6134 CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
6135 CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
6136 CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
6137 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
6138 CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
6139 CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
6140 CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL),
6141 CLK_LOOKUP("csi_clk", csi2_clk.c, NULL),
6142 CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
6143 CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
6144 CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
6145 CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL),
6146 CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL),
6147 CLK_LOOKUP("csiphy_timer_src_clk",
6148 csiphy_timer_src_clk.c, "msm_csiphy.0"),
6149 CLK_LOOKUP("csiphy_timer_src_clk",
6150 csiphy_timer_src_clk.c, "msm_csiphy.1"),
6151 CLK_LOOKUP("csiphy_timer_src_clk",
6152 csiphy_timer_src_clk.c, "msm_csiphy.2"),
6153 CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
6154 CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
6155 CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006156 CLK_LOOKUP("byte_clk", dsi1_byte_clk.c, "mipi_dsi.1"),
6157 CLK_LOOKUP("esc_clk", dsi1_esc_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006158 CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"),
6159 CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"),
6160 CLK_LOOKUP("bus_clk",
6161 gfx3d_axi_clk_8930.c, "footswitch-8x60.2"),
6162 CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006163 CLK_LOOKUP("mem_clk", imem_axi_clk.c, "msm_gemini.0"),
6164 CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006165 CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006166 CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006167 CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006168 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006169 CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006170 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006171 CLK_LOOKUP("lut_clk", lut_mdp_clk.c, "footswitch-8x60.4"),
6172 CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"),
6173 CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006174 CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"),
6175 CLK_LOOKUP("src_clk", tv_src_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006176 CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006177 CLK_LOOKUP("dac_clk", tv_dac_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006178 CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"),
6179 CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006180 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"),
6181 CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "tvenc.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006182 CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006183 CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006184 CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"),
6185 CLK_LOOKUP("vpe_clk", vpe_clk.c, "msm_vpe.0"),
6186 CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
6187 CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
6188 CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
6189 CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
6190 CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
6191 CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
6192 CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
6193 CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"),
6194 CLK_LOOKUP("bus_a_clk", vcodec_axi_a_clk.c, "footswitch-8x60.7"),
6195 CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
6196 CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006197 CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006198 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
6199 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
6200 CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006201 CLK_LOOKUP("master_iface_clk", dsi1_m_p_clk.c, "mipi_dsi.1"),
6202 CLK_LOOKUP("slave_iface_clk", dsi1_s_p_clk.c, "mipi_dsi.1"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006203 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"),
6204 CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"),
6205 CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"),
6206 CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"),
Matt Wagantallf45cd362012-05-03 21:09:44 -07006207 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006208 CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"),
6209 CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"),
Ravishangar Kalyanam1b064f52012-03-15 18:17:54 -07006210 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006211 CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"),
Olav Haugan0e22c482013-01-28 17:39:36 -08006212 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.0"),
6213 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.1"),
6214 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.2"),
6215 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.3"),
6216 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.4"),
6217 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.5"),
6218 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.6"),
6219 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.7"),
6220 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.8"),
6221 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.9"),
6222 CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu-v0.10"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006223 CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"),
6224 CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
6225 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
6226 CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
6227 CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
6228 CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
6229 CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, "msm_vpe.0"),
6230 CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"),
6231 CLK_LOOKUP("bit_clk", mi2s_bit_clk.c, "msm-dai-q6.6"),
6232 CLK_LOOKUP("osr_clk", mi2s_osr_clk.c, "msm-dai-q6.6"),
6233 CLK_LOOKUP("bit_clk", codec_i2s_mic_bit_clk.c,
6234 "msm-dai-q6.1"),
6235 CLK_LOOKUP("osr_clk", codec_i2s_mic_osr_clk.c,
6236 "msm-dai-q6.1"),
6237 CLK_LOOKUP("bit_clk", spare_i2s_mic_bit_clk.c,
6238 "msm-dai-q6.5"),
6239 CLK_LOOKUP("osr_clk", spare_i2s_mic_osr_clk.c,
6240 "msm-dai-q6.5"),
6241 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Kuirong Wangdea7c822012-08-20 20:52:42 -07006242 "msm-dai-q6.0"),
6243 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
6244 "msm-dai-q6.0"),
6245 CLK_LOOKUP("bit_clk", codec_i2s_spkr_bit_clk.c,
Tianyi Goue3d4f542012-03-15 17:06:45 -07006246 "msm-dai-q6.16384"),
6247 CLK_LOOKUP("osr_clk", codec_i2s_spkr_osr_clk.c,
6248 "msm-dai-q6.16384"),
6249 CLK_LOOKUP("bit_clk", spare_i2s_spkr_bit_clk.c,
6250 "msm-dai-q6.4"),
6251 CLK_LOOKUP("osr_clk", spare_i2s_spkr_osr_clk.c,
6252 "msm-dai-q6.4"),
6253 CLK_LOOKUP("pcm_clk", pcm_clk.c, "msm-dai-q6.2"),
6254 CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL),
6255 CLK_LOOKUP("core_clk", audio_slimbus_clk.c, "msm_slim_ctrl.1"),
Olav Haugan0e22c482013-01-28 17:39:36 -08006256 CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu-v0.1"),
6257 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu-v0.2"),
6258 CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu-v0.3"),
6259 CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu-v0.4"),
6260 CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu-v0.5"),
6261 CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu-v0.6"),
6262 CLK_LOOKUP("core_clk", vcodec_axi_a_clk.c, "msm_iommu-v0.7"),
6263 CLK_LOOKUP("core_clk", vcodec_axi_b_clk.c, "msm_iommu-v0.8"),
6264 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu-v0.9"),
6265 CLK_LOOKUP("core_clk", gfx3d_axi_clk_8930.c, "msm_iommu-v0.10"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006266
6267 CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"),
6268 CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"),
6269 CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_a_clk.c, "msm_vidc.0"),
6270 CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_b_clk.c, "msm_vidc.0"),
6271 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"),
Stephen Boyd7b973de2012-03-09 12:26:16 -08006272 CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"),
6273 CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006274
6275 CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL),
6276 CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"),
6277 CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"),
6278 CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"),
6279 CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"),
6280 CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"),
6281 CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"),
6282 CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"),
6283 CLK_LOOKUP("bus_clk", dfab_bam_dmux_clk.c, "BAM_RMNT"),
6284 CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006285
6286 CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"),
Matt Wagantall33bac7e2012-05-22 14:59:05 -07006287 CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""),
6288 CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""),
Tianyi Goue3d4f542012-03-15 17:06:45 -07006289
Matt Wagantallc33c1ed2012-07-23 17:19:08 -07006290 CLK_LOOKUP("reset1_clk", dsi1_reset_clk.c, "footswitch-8x60.4"),
Matt Wagantall735e41b2012-07-23 17:18:58 -07006291
Tianyi Goue3d4f542012-03-15 17:06:45 -07006292 CLK_LOOKUP("l2_mclk", l2_m_clk, ""),
6293 CLK_LOOKUP("krait0_mclk", krait0_m_clk, ""),
6294 CLK_LOOKUP("krait1_mclk", krait1_m_clk, ""),
6295 CLK_LOOKUP("q6sw_clk", q6sw_clk, ""),
6296 CLK_LOOKUP("q6fw_clk", q6fw_clk, ""),
6297 CLK_LOOKUP("q6_func_clk", q6_func_clk, ""),
6298};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006299/*
6300 * Miscellaneous clock register initializations
6301 */
6302
6303/* Read, modify, then write-back a register. */
6304static void __init rmwreg(uint32_t val, void *reg, uint32_t mask)
6305{
6306 uint32_t regval = readl_relaxed(reg);
6307 regval &= ~mask;
6308 regval |= val;
6309 writel_relaxed(regval, reg);
6310}
6311
Patrick Dalyaa614562013-01-23 16:39:45 -08006312static struct pll_config_regs pll3_regs __initdata = {
6313 .l_reg = BB_MMCC_PLL2_L_REG,
6314 .m_reg = BB_MMCC_PLL2_M_REG,
6315 .n_reg = BB_MMCC_PLL2_N_REG,
6316 .config_reg = BB_MMCC_PLL2_CONFIG_REG,
6317 .mode_reg = BB_MMCC_PLL2_MODE_REG,
6318};
6319
6320/* Program PLL3 to 880MHZ */
6321static struct pll_config pll3_config __initdata = {
6322 .l = (32 | BVAL(31, 7, 0x8)),
6323 .m = 16,
6324 .n = 27,
6325 .vco_val = 0x0,
6326 .vco_mask = BM(8, 7),
6327 .pre_div_val = 0x0,
6328 .pre_div_mask = BIT(15),
6329 .post_div_val = 0x0,
6330 .post_div_mask = BIT(16),
6331 .mn_ena_val = 0,
6332 .mn_ena_mask = 0,
6333 .main_output_val = 0,
6334 .main_output_mask = 0,
6335};
6336
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006337static struct pll_config_regs pll4_regs __initdata = {
6338 .l_reg = LCC_PLL0_L_VAL_REG,
6339 .m_reg = LCC_PLL0_M_VAL_REG,
6340 .n_reg = LCC_PLL0_N_VAL_REG,
6341 .config_reg = LCC_PLL0_CONFIG_REG,
6342 .mode_reg = LCC_PLL0_MODE_REG,
6343};
Tianyi Gou41515e22011-09-01 19:37:43 -07006344
Matt Wagantall86e03822011-12-12 10:59:24 -08006345static struct pll_config pll4_config_393 __initdata = {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006346 .l = 0xE,
6347 .m = 0x27A,
6348 .n = 0x465,
6349 .vco_val = 0x0,
6350 .vco_mask = BM(17, 16),
6351 .pre_div_val = 0x0,
6352 .pre_div_mask = BIT(19),
6353 .post_div_val = 0x0,
6354 .post_div_mask = BM(21, 20),
6355 .mn_ena_val = BIT(22),
6356 .mn_ena_mask = BIT(22),
6357 .main_output_val = BIT(23),
6358 .main_output_mask = BIT(23),
6359};
Tianyi Gou41515e22011-09-01 19:37:43 -07006360
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006361static struct pll_config_regs pll15_regs __initdata = {
6362 .l_reg = MM_PLL3_L_VAL_REG,
6363 .m_reg = MM_PLL3_M_VAL_REG,
6364 .n_reg = MM_PLL3_N_VAL_REG,
6365 .config_reg = MM_PLL3_CONFIG_REG,
6366 .mode_reg = MM_PLL3_MODE_REG,
6367};
Tianyi Gou358c3862011-10-18 17:03:41 -07006368
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006369static struct pll_config pll15_config __initdata = {
6370 .l = (0x24 | BVAL(31, 7, 0x620)),
6371 .m = 0x1,
6372 .n = 0x9,
6373 .vco_val = BVAL(17, 16, 0x2),
6374 .vco_mask = BM(17, 16),
6375 .pre_div_val = 0x0,
6376 .pre_div_mask = BIT(19),
6377 .post_div_val = 0x0,
6378 .post_div_mask = BM(21, 20),
6379 .mn_ena_val = BIT(22),
6380 .mn_ena_mask = BIT(22),
6381 .main_output_val = BIT(23),
6382 .main_output_mask = BIT(23),
6383};
Tianyi Gou41515e22011-09-01 19:37:43 -07006384
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006385static struct pll_config_regs pll14_regs __initdata = {
6386 .l_reg = BB_PLL14_L_VAL_REG,
6387 .m_reg = BB_PLL14_M_VAL_REG,
6388 .n_reg = BB_PLL14_N_VAL_REG,
6389 .config_reg = BB_PLL14_CONFIG_REG,
6390 .mode_reg = BB_PLL14_MODE_REG,
6391};
6392
6393static struct pll_config pll14_config __initdata = {
6394 .l = (0x11 | BVAL(31, 7, 0x620)),
6395 .m = 0x7,
6396 .n = 0x9,
6397 .vco_val = 0x0,
6398 .vco_mask = BM(17, 16),
6399 .pre_div_val = 0x0,
6400 .pre_div_mask = BIT(19),
6401 .post_div_val = 0x0,
6402 .post_div_mask = BM(21, 20),
6403 .mn_ena_val = BIT(22),
6404 .mn_ena_mask = BIT(22),
6405 .main_output_val = BIT(23),
6406 .main_output_mask = BIT(23),
6407};
Tianyi Gou41515e22011-09-01 19:37:43 -07006408
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006409static void __init reg_init(void)
6410{
Stephen Boydd471e7a2011-11-19 01:37:39 -08006411 void __iomem *imem_reg;
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006412
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006413 /* Deassert MM SW_RESET_ALL signal. */
6414 writel_relaxed(0, SW_RESET_ALL_REG);
6415
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006416 /*
Tianyi Goue3d4f542012-03-15 17:06:45 -07006417 * Some bits are only used on 8960 or 8064 or 8930 and are marked as
6418 * reserved bits on the other SoCs. Writing to these reserved bits
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006419 * should have no effect.
6420 */
Stephen Boydd471e7a2011-11-19 01:37:39 -08006421 /*
6422 * Initialize MM AHB registers: Enable the FPB clock and disable HW
Tianyi Gou40ce8892012-11-20 20:20:25 -08006423 * gating on 8627 and 8930ab for all clocks. Also set VFE_AHB's
Stephen Boydd471e7a2011-11-19 01:37:39 -08006424 * FORCE_CORE_ON bit to prevent its memory from being collapsed when
6425 * the clock is halted. The sleep and wake-up delays are set to safe
6426 * values.
6427 */
Tianyi Gou40ce8892012-11-20 20:20:25 -08006428 if (cpu_is_msm8627() || cpu_is_msm8930ab()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006429 rmwreg(0x00000003, AHB_EN_REG, 0x6C000103);
6430 writel_relaxed(0x000007F9, AHB_EN2_REG);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006431 } else {
David Garibaldif69836a2012-08-17 16:05:22 -07006432 rmwreg(0x40000000, AHB_EN_REG, 0x6C000103);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006433 writel_relaxed(0x3C7097F9, AHB_EN2_REG);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006434 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006435
Jay Chokshi9c232612013-01-17 15:14:46 -08006436 if (soc_class_is_apq8064())
Tianyi Gou64daed52012-08-23 11:00:47 -07006437 rmwreg(0x00000000, AHB_EN3_REG, 0x00000001);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006438
6439 /* Deassert all locally-owned MM AHB resets. */
6440 rmwreg(0, SW_RESET_AHB_REG, 0xFFF7DFFF);
Tianyi Gou41515e22011-09-01 19:37:43 -07006441 rmwreg(0, SW_RESET_AHB2_REG, 0x0000000F);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006442
6443 /* Initialize MM AXI registers: Enable HW gating for all clocks that
6444 * support it. Also set FORCE_CORE_ON bits, and any sleep and wake-up
6445 * delays to safe values. */
Tianyi Gou40ce8892012-11-20 20:20:25 -08006446 if ((cpu_is_msm8960() &&
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006447 SOCINFO_VERSION_MAJOR(socinfo_get_version()) < 3) ||
Tianyi Goud287a762012-11-02 12:35:49 -07006448 cpu_is_msm8627() || cpu_is_msm8930ab()) {
Stephen Boydd471e7a2011-11-19 01:37:39 -08006449 rmwreg(0x000007F9, MAXI_EN_REG, 0x0803FFFF);
6450 rmwreg(0x3027FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006451 } else {
6452 rmwreg(0x0003AFF9, MAXI_EN_REG, 0x0803FFFF);
6453 rmwreg(0x3A27FCFF, MAXI_EN2_REG, 0x3A3FFFFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006454 }
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006455
Matt Wagantall53d968f2011-07-19 13:22:53 -07006456 rmwreg(0x0027FCFF, MAXI_EN3_REG, 0x003FFFFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006457 rmwreg(0x0027FCFF, MAXI_EN4_REG, 0x017FFFFF);
6458
Jay Chokshi9c232612013-01-17 15:14:46 -08006459 if (soc_class_is_apq8064())
Tianyi Gouf3095ea2012-05-22 14:16:06 -07006460 rmwreg(0x019FECFF, MAXI_EN5_REG, 0x01FFEFFF);
Tianyi Goud287a762012-11-02 12:35:49 -07006461 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627() ||
6462 cpu_is_msm8930ab())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006463 rmwreg(0x000004FF, MAXI_EN5_REG, 0x00000FFF);
Patrick Dalye6f489042012-07-11 15:29:15 -07006464 if (cpu_is_msm8960ab())
6465 rmwreg(0x009FE000, MAXI_EN5_REG, 0x01FFE000);
6466
Tianyi Goud287a762012-11-02 12:35:49 -07006467 if (cpu_is_msm8627() || cpu_is_msm8930ab())
Stephen Boydd471e7a2011-11-19 01:37:39 -08006468 rmwreg(0x000003C7, SAXI_EN_REG, 0x00003FFF);
Tianyi Gou33caa5d2012-06-18 12:04:11 -07006469 else
6470 rmwreg(0x00003C38, SAXI_EN_REG, 0x00003FFF);
Stephen Boydd471e7a2011-11-19 01:37:39 -08006471
6472 /* Enable IMEM's clk_on signal */
6473 imem_reg = ioremap(0x04b00040, 4);
6474 if (imem_reg) {
6475 writel_relaxed(0x3, imem_reg);
6476 iounmap(imem_reg);
6477 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006478
6479 /* Initialize MM CC registers: Set MM FORCE_CORE_ON bits so that core
6480 * memories retain state even when not clocked. Also, set sleep and
6481 * wake-up delays to safe values. */
Matt Wagantall53d968f2011-07-19 13:22:53 -07006482 rmwreg(0x00000000, CSI0_CC_REG, 0x00000410);
6483 rmwreg(0x00000000, CSI1_CC_REG, 0x00000410);
6484 rmwreg(0x80FF0000, DSI1_BYTE_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006485 rmwreg(0x80FF0000, DSI_PIXEL_CC_REG, 0xE0FF0010);
Tarun Karra6fbc00a2011-12-13 09:23:47 -07006486 rmwreg(0xC0FF0000, GFX3D_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006487 rmwreg(0x80FF0000, IJPEG_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006488 rmwreg(0x80FF0000, MDP_CC_REG, 0xE1FF0010);
6489 rmwreg(0x80FF0000, MDP_LUT_CC_REG, 0xE0FF0010);
6490 rmwreg(0x80FF0000, ROT_CC_REG, 0xE0FF0010);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006491 rmwreg(0x000004FF, TV_CC2_REG, 0x000007FF);
6492 rmwreg(0xC0FF0000, VCODEC_CC_REG, 0xE0FF0010);
6493 rmwreg(0x80FF0000, VFE_CC_REG, 0xE0FF4010);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006494 rmwreg(0x800000FF, VFE_CC2_REG, 0xE00000FF);
Matt Wagantall53d968f2011-07-19 13:22:53 -07006495 rmwreg(0x80FF0000, VPE_CC_REG, 0xE0FF0010);
Jay Chokshi9c232612013-01-17 15:14:46 -08006496 if (cpu_is_msm8960ab() || cpu_is_msm8960() || soc_class_is_apq8064()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006497 rmwreg(0x80FF0000, DSI2_BYTE_CC_REG, 0xE0FF0010);
6498 rmwreg(0x80FF0000, DSI2_PIXEL_CC_REG, 0xE0FF0010);
6499 rmwreg(0x80FF0000, JPEGD_CC_REG, 0xE0FF0010);
6500 }
Patrick Dalye6f489042012-07-11 15:29:15 -07006501 if (cpu_is_msm8960ab())
6502 rmwreg(0x00000001, DSI2_PIXEL_CC2_REG, 0x00000001);
6503
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006504 if (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm8930aa() ||
Tianyi Goud287a762012-11-02 12:35:49 -07006505 cpu_is_msm8627() || cpu_is_msm8930ab())
Patrick Dalye6f489042012-07-11 15:29:15 -07006506 rmwreg(0x80FF0000, TV_CC_REG, 0xE1FFC010);
6507 if (cpu_is_msm8960ab())
6508 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Goue3d4f542012-03-15 17:06:45 -07006509
6510 if (cpu_is_msm8960()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006511 rmwreg(0x80FF0000, GFX2D0_CC_REG, 0xE0FF0010);
6512 rmwreg(0x80FF0000, GFX2D1_CC_REG, 0xE0FF0010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006513 }
Jay Chokshi9c232612013-01-17 15:14:46 -08006514 if (soc_class_is_apq8064()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006515 rmwreg(0x00000000, TV_CC_REG, 0x00004010);
Tianyi Gou621f8742011-09-01 21:45:01 -07006516 rmwreg(0x80FF0000, VCAP_CC_REG, 0xE0FF1010);
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006517 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006518
Tianyi Gou41515e22011-09-01 19:37:43 -07006519 /*
6520 * Initialize USB_HS_HCLK_FS registers: Set FORCE_C_ON bits so that
6521 * core remain active during halt state of the clk. Also, set sleep
6522 * and wake-up value to max.
6523 */
6524 rmwreg(0x0000004F, USB_HS1_HCLK_FS_REG, 0x0000007F);
Jay Chokshi9c232612013-01-17 15:14:46 -08006525 if (soc_class_is_apq8064()) {
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006526 rmwreg(0x0000004F, USB_HS3_HCLK_FS_REG, 0x0000007F);
6527 rmwreg(0x0000004F, USB_HS4_HCLK_FS_REG, 0x0000007F);
6528 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006529
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006530 /* De-assert MM AXI resets to all hardware blocks. */
6531 writel_relaxed(0, SW_RESET_AXI_REG);
6532
6533 /* Deassert all MM core resets. */
6534 writel_relaxed(0, SW_RESET_CORE_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006535 writel_relaxed(0, SW_RESET_CORE2_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006536
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006537 /* Enable TSSC and PDM PXO sources. */
6538 writel_relaxed(BIT(11), TSSC_CLK_CTL_REG);
6539 writel_relaxed(BIT(15), PDM_CLK_NS_REG);
6540
6541 /* Source SLIMBus xo src from slimbus reference clock */
Patrick Dalye6f489042012-07-11 15:29:15 -07006542 if (cpu_is_msm8960ab() || cpu_is_msm8960())
Tianyi Gou8c1a1182011-10-10 14:47:11 -07006543 writel_relaxed(0x3, SLIMBUS_XO_SRC_CLK_CTL_REG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006544
6545 /* Source the dsi_byte_clks from the DSI PHY PLLs */
6546 rmwreg(0x1, DSI1_BYTE_NS_REG, 0x7);
Jay Chokshi9c232612013-01-17 15:14:46 -08006547 if (cpu_is_msm8960ab() || cpu_is_msm8960() || soc_class_is_apq8064())
Tianyi Goue3d4f542012-03-15 17:06:45 -07006548 rmwreg(0x2, DSI2_BYTE_NS_REG, 0x7);
Tianyi Gou41515e22011-09-01 19:37:43 -07006549
Siddhartha Agrawal482459c2012-05-24 15:28:53 -07006550 /* Source the dsi1_esc_clk from the DSI1 PHY PLLs */
6551 rmwreg(0x1, DSI1_ESC_NS_REG, 0x7);
6552
Tianyi Gou352955d2012-05-18 19:44:01 -07006553 /*
6554 * Source the sata_phy_ref_clk from PXO and set predivider of
6555 * sata_pmalive_clk to 1.
6556 */
Jay Chokshi9c232612013-01-17 15:14:46 -08006557 if (soc_class_is_apq8064()) {
Tianyi Gou41515e22011-09-01 19:37:43 -07006558 rmwreg(0, SATA_PHY_REF_CLK_CTL_REG, 0x1);
Tianyi Gou352955d2012-05-18 19:44:01 -07006559 rmwreg(0, SATA_PMALIVE_CLK_CTL_REG, 0x3);
6560 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006561
6562 /*
Tianyi Gou05e01102012-02-08 22:15:49 -08006563 * TODO: Programming below PLLs and prng_clk is temporary and
6564 * needs to be removed after bootloaders program them.
Tianyi Gou41515e22011-09-01 19:37:43 -07006565 */
Jay Chokshi9c232612013-01-17 15:14:46 -08006566 if (soc_class_is_apq8064()) {
Tianyi Gou317aa862012-02-06 14:31:07 -08006567 u32 is_pll_enabled;
Tianyi Gou41515e22011-09-01 19:37:43 -07006568
6569 /* Program pxo_src_clk to source from PXO */
6570 rmwreg(0x1, PXO_SRC_CLK_CTL_REG, 0x7);
6571
Tianyi Gou41515e22011-09-01 19:37:43 -07006572 /* Check if PLL14 is active */
6573 is_pll_enabled = readl_relaxed(BB_PLL14_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006574 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006575 /* Ref clk = 27MHz and program pll14 to 480MHz */
Vikram Mulukutla6da35d32012-07-18 13:55:31 -07006576 configure_sr_pll(&pll14_config, &pll14_regs, 1);
Tianyi Gou621f8742011-09-01 21:45:01 -07006577
Tianyi Gouc29c3242011-10-12 21:02:15 -07006578 /* Check if PLL4 is active */
6579 is_pll_enabled = readl_relaxed(LCC_PLL0_STATUS_REG) & BIT(16);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006580 if (!is_pll_enabled)
Tianyi Goudf71f2e2011-10-24 22:25:04 -07006581 /* Ref clk = 27MHz and program pll4 to 393.2160MHz */
Vikram Mulukutla6da35d32012-07-18 13:55:31 -07006582 configure_sr_pll(&pll4_config_393, &pll4_regs, 1);
Tianyi Gouc29c3242011-10-12 21:02:15 -07006583
6584 /* Enable PLL4 source on the LPASS Primary PLL Mux */
6585 writel_relaxed(0x1, LCC_PRI_PLL_CLK_CTL_REG);
Tianyi Gou05e01102012-02-08 22:15:49 -08006586
6587 /* Program prng_clk to 64MHz if it isn't configured */
6588 if (!readl_relaxed(PRNG_CLK_NS_REG))
6589 writel_relaxed(0x2B, PRNG_CLK_NS_REG);
Tianyi Gou41515e22011-09-01 19:37:43 -07006590 }
Tianyi Gou65c536a2012-03-20 23:20:29 -07006591
Jay Chokshi9c232612013-01-17 15:14:46 -08006592 if (cpu_is_apq8064() || cpu_is_apq8064aa()) {
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006593 /* Program PLL15 to 975MHz with ref clk = 27MHz */
6594 configure_sr_pll(&pll15_config, &pll15_regs, 0);
6595 } else if (cpu_is_apq8064ab()) {
6596 /* Program PLL15 to 900MHZ */
6597 pll15_config.l = 0x21 | BVAL(31, 7, 0x620);
6598 pll15_config.m = 0x1;
6599 pll15_config.n = 0x3;
6600 configure_sr_pll(&pll15_config, &pll15_regs, 0);
Patrick Dalyaa614562013-01-23 16:39:45 -08006601 } else if (cpu_is_msm8960ab()) {
6602 pll3_clk.c.rate = 880000000;
6603 configure_sr_pll(&pll3_config, &pll3_regs, 0);
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006604 }
6605
Tianyi Gou65c536a2012-03-20 23:20:29 -07006606 /*
Seemanta Dutta4dc17082012-10-24 18:37:42 -07006607 * Change PLL15 configuration based on the SoC we're running on.
Tianyi Gou65c536a2012-03-20 23:20:29 -07006608 */
Stepan Moskovchenko0df9bb22012-07-06 18:19:15 -07006609 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006610 pll15_config.l = 0x21 | BVAL(31, 7, 0x600);
6611 pll15_config.m = 0x1;
6612 pll15_config.n = 0x3;
Vikram Mulukutla6da35d32012-07-18 13:55:31 -07006613 configure_sr_pll(&pll15_config, &pll15_regs, 0);
Vikram Mulukutla5b146722012-04-23 18:17:50 -07006614 /* Disable AUX and BIST outputs */
6615 writel_relaxed(0, MM_PLL3_TEST_CTL_REG);
Seemanta Dutta4dc17082012-10-24 18:37:42 -07006616 } else if (cpu_is_msm8930ab()) {
6617 pll15_config.l = 0x25 | BVAL(31, 7, 0x600);
6618 pll15_config.m = 0x25;
6619 pll15_config.n = 0x3E7;
6620 configure_sr_pll(&pll15_config, &pll15_regs, 0);
6621 /* Disable AUX and BIST outputs */
6622 writel_relaxed(0, MM_PLL3_TEST_CTL_REG);
Tianyi Gou65c536a2012-03-20 23:20:29 -07006623 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006624}
6625
Patrick Dalyaa614562013-01-23 16:39:45 -08006626#define PTE_EFUSE_GFX_PHYS (0x007000BC)
6627
6628static unsigned long *select_gfx_fmax_plan(unsigned long **gfx_fmax, int size)
6629{
6630 void __iomem *pte_efuse;
6631 u32 gfx_speed_bin;
6632
6633 pte_efuse = ioremap(PTE_EFUSE_GFX_PHYS, 4);
6634 gfx_speed_bin = readl_relaxed(pte_efuse);
6635 gfx_speed_bin = (gfx_speed_bin & BM(25, 24)) >> 24;
6636 iounmap(pte_efuse);
6637
6638 if (gfx_speed_bin >= size) {
6639 pr_err("GFX_SPEED_BIN: defaulting to 0\n");
6640 gfx_speed_bin = 0;
6641 }
6642
6643 pr_info("GFX_SPEED_BIN: %d\n", gfx_speed_bin);
6644 return gfx_fmax[gfx_speed_bin];
6645}
6646
Patrick Dalye6f489042012-07-11 15:29:15 -07006647struct clock_init_data msm8960_clock_init_data __initdata;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006648static void __init msm8960_clock_pre_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006649{
Matt Wagantall86e03822011-12-12 10:59:24 -08006650 /* Initialize clock registers. */
6651 reg_init();
6652
Jay Chokshi9c232612013-01-17 15:14:46 -08006653 if (soc_class_is_apq8064())
Matt Wagantall82feaa12012-07-09 10:54:49 -07006654 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8064;
Tianyi Goubf3d0b12012-01-23 14:37:28 -08006655
Matt Wagantall86e03822011-12-12 10:59:24 -08006656 /* Detect PLL4 programmed for alternate 491.52MHz clock plan. */
6657 if (readl_relaxed(LCC_PLL0_L_VAL_REG) == 0x12) {
6658 pll4_clk.c.rate = 491520000;
6659 audio_slimbus_clk.freq_tbl = clk_tbl_aif_osr_492;
6660 mi2s_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6661 codec_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6662 spare_i2s_mic_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6663 codec_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6664 spare_i2s_spkr_osr_clk.freq_tbl = clk_tbl_aif_osr_492;
6665 pcm_clk.freq_tbl = clk_tbl_pcm_492;
6666 }
6667
Patrick Dalye6f489042012-07-11 15:29:15 -07006668 if (cpu_is_msm8960() || cpu_is_msm8960ab())
6669 memcpy(msm_clocks_8960, msm_clocks_8960_common,
6670 sizeof(msm_clocks_8960_common));
6671 if (cpu_is_msm8960ab()) {
Patrick Dalyaa614562013-01-23 16:39:45 -08006672 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8960ab;
Patrick Daly6e034322012-10-26 18:18:32 -07006673 mdp_clk.c.fmax = fmax_mdp_8960ab;
Patrick Dalye6f489042012-07-11 15:29:15 -07006674
Patrick Dalyaa614562013-01-23 16:39:45 -08006675 gfx3d_clk.c.fmax = select_gfx_fmax_plan(fmax_gfx3d_8960ab,
6676 ARRAY_SIZE(fmax_gfx3d_8960ab));
6677
Patrick Dalye6f489042012-07-11 15:29:15 -07006678 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6679 msm_clocks_8960ab_only, sizeof(msm_clocks_8960ab_only));
6680 msm8960_clock_init_data.size -=
6681 ARRAY_SIZE(msm_clocks_8960_only);
Joel King9af070b2012-08-19 22:32:14 -07006682
6683 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Patrick Dalye6f489042012-07-11 15:29:15 -07006684 } else if (cpu_is_msm8960()) {
Patrick Daly2c09c4c2012-10-25 19:47:56 -07006685 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8960;
Patrick Dalye6f489042012-07-11 15:29:15 -07006686 memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_common),
6687 msm_clocks_8960_only, sizeof(msm_clocks_8960_only));
6688 msm8960_clock_init_data.size -=
6689 ARRAY_SIZE(msm_clocks_8960ab_only);
6690 }
Tianyi Gou41515e22011-09-01 19:37:43 -07006691 /*
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006692 * Change the freq tables for and voltage requirements for
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006693 * clocks which differ between chips.
Tianyi Gou41515e22011-09-01 19:37:43 -07006694 */
Jay Chokshi9c232612013-01-17 15:14:46 -08006695 if (cpu_is_apq8064() || cpu_is_apq8064aa())
Saravana Kannan55e959d2012-10-15 22:16:04 -07006696 gfx3d_clk.c.fmax = fmax_gfx3d_8064;
Jay Chokshi9c232612013-01-17 15:14:46 -08006697
6698 if (cpu_is_apq8064ab())
Saravana Kannan55e959d2012-10-15 22:16:04 -07006699 gfx3d_clk.c.fmax = fmax_gfx3d_8064ab;
Jay Chokshi9c232612013-01-17 15:14:46 -08006700
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006701 if ((cpu_is_apq8064() &&
6702 SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) ||
Jay Chokshi9c232612013-01-17 15:14:46 -08006703 cpu_is_apq8064ab() || cpu_is_apq8064aa()) {
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006704
Saravana Kannan55e959d2012-10-15 22:16:04 -07006705 vcodec_clk.c.fmax = fmax_vcodec_8064v2;
6706 ce3_src_clk.c.fmax = fmax_ce3_8064v2;
6707 sdc1_clk.c.fmax = fmax_sdc1_8064v2;
Patrick Dalyb7c777a2012-08-23 19:07:30 -07006708 }
Jay Chokshi9c232612013-01-17 15:14:46 -08006709 if (soc_class_is_apq8064()) {
Saravana Kannan55e959d2012-10-15 22:16:04 -07006710 ijpeg_clk.c.fmax = fmax_ijpeg_8064;
6711 mdp_clk.c.fmax = fmax_mdp_8064;
6712 tv_src_clk.c.fmax = fmax_tv_src_8064;
6713 vfe_clk.c.fmax = fmax_vfe_8064;
Patrick Dalye6f489042012-07-11 15:29:15 -07006714 gmem_axi_clk.c.depends = &gfx3d_axi_clk.c;
Tianyi Goue3d4f542012-03-15 17:06:45 -07006715 }
6716
6717 /*
6718 * Change the freq tables and voltage requirements for
6719 * clocks which differ between 8960 and 8930.
6720 */
Seemanta Dutta4dc17082012-10-24 18:37:42 -07006721 if (cpu_is_msm8930() || cpu_is_msm8627())
Saravana Kannan55e959d2012-10-15 22:16:04 -07006722 gfx3d_clk.c.fmax = fmax_gfx3d_8930;
Seemanta Dutta4dc17082012-10-24 18:37:42 -07006723 else if (cpu_is_msm8930aa())
Saravana Kannan55e959d2012-10-15 22:16:04 -07006724 gfx3d_clk.c.fmax = fmax_gfx3d_8930aa;
Patrick Dalyebe63c52012-08-07 15:41:30 -07006725 if (cpu_is_msm8930() || cpu_is_msm8930aa() || cpu_is_msm8627()) {
Tianyi Goue3d4f542012-03-15 17:06:45 -07006726 pll15_clk.c.rate = 900000000;
6727 gmem_axi_clk.c.depends = &gfx3d_axi_clk_8930.c;
Seemanta Dutta4dc17082012-10-24 18:37:42 -07006728 } else if (cpu_is_msm8930ab()) {
6729 gfx3d_clk.freq_tbl = clk_tbl_gfx3d_8930ab;
6730 pll15_clk.c.rate = 1000000000;
6731 gfx3d_clk.c.fmax = fmax_gfx3d_8930ab;
6732 gmem_axi_clk.c.depends = &gfx3d_axi_clk_8930.c;
6733 vcodec_clk.c.fmax = fmax_vcodec_8930ab;
Tianyi Gou41515e22011-09-01 19:37:43 -07006734 }
Stephen Boyd842a1f62012-04-26 19:07:38 -07006735 if ((readl_relaxed(PRNG_CLK_NS_REG) & 0x7F) == 0x2B)
6736 prng_clk.freq_tbl = clk_tbl_prng_64;
Stephen Boyd94625ef2011-07-12 17:06:01 -07006737
Vikram Mulukutla681d8682012-03-09 23:56:20 -08006738 clk_ops_local_pll.enable = sr_pll_clk_enable;
Matt Wagantallb64888f2012-04-02 21:35:07 -07006739}
6740
Patrick Daly1a3859f2012-08-27 16:10:26 -07006741static void __init msm8930_pm8917_clock_pre_init(void)
6742{
6743 /* detect pmic8917 from board file, and call this init function */
6744
6745 vdd_dig.set_vdd = set_vdd_dig_8930;
6746 rpm_vreg_dig_8930 = RPM_VREG_ID_PM8917_VDD_DIG_CORNER;
6747 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930_pm8917;
6748
6749 msm8960_clock_pre_init();
6750}
6751
6752static void __init msm8930_clock_pre_init(void)
6753{
6754 vdd_dig.set_vdd = set_vdd_dig_8930;
6755 vdd_sr2_hdmi_pll.set_vdd = set_vdd_sr2_hdmi_pll_8930;
6756
6757 msm8960_clock_pre_init();
6758}
6759
Matt Wagantallb64888f2012-04-02 21:35:07 -07006760static void __init msm8960_clock_post_init(void)
6761{
6762 /* Keep PXO on whenever APPS cpu is active */
6763 clk_prepare_enable(&pxo_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006764
Matt Wagantalle655cd72012-04-09 10:15:03 -07006765 /* Reset 3D core while clocked to ensure it resets completely. */
6766 clk_set_rate(&gfx3d_clk.c, 27000000);
6767 clk_prepare_enable(&gfx3d_clk.c);
6768 clk_reset(&gfx3d_clk.c, CLK_RESET_ASSERT);
6769 udelay(5);
6770 clk_reset(&gfx3d_clk.c, CLK_RESET_DEASSERT);
6771 clk_disable_unprepare(&gfx3d_clk.c);
6772
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006773 /* Initialize rates for clocks that only support one. */
6774 clk_set_rate(&pdm_clk.c, 27000000);
Stephen Boyd842a1f62012-04-26 19:07:38 -07006775 clk_set_rate(&prng_clk.c, prng_clk.freq_tbl->freq_hz);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006776 clk_set_rate(&mdp_vsync_clk.c, 27000000);
6777 clk_set_rate(&tsif_ref_clk.c, 105000);
6778 clk_set_rate(&tssc_clk.c, 27000000);
6779 clk_set_rate(&usb_hs1_xcvr_clk.c, 60000000);
Jay Chokshi9c232612013-01-17 15:14:46 -08006780 if (soc_class_is_apq8064()) {
Tianyi Gou41515e22011-09-01 19:37:43 -07006781 clk_set_rate(&usb_hs3_xcvr_clk.c, 60000000);
6782 clk_set_rate(&usb_hs4_xcvr_clk.c, 60000000);
6783 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006784 clk_set_rate(&usb_fs1_src_clk.c, 60000000);
Patrick Dalye6f489042012-07-11 15:29:15 -07006785 if (cpu_is_msm8960ab() || cpu_is_msm8960() || cpu_is_msm8930() ||
Tianyi Goud287a762012-11-02 12:35:49 -07006786 cpu_is_msm8930aa() || cpu_is_msm8627() || cpu_is_msm8930ab())
Tianyi Gou41515e22011-09-01 19:37:43 -07006787 clk_set_rate(&usb_fs2_src_clk.c, 60000000);
Stephen Boyd94625ef2011-07-12 17:06:01 -07006788 clk_set_rate(&usb_hsic_xcvr_fs_clk.c, 60000000);
6789 clk_set_rate(&usb_hsic_hsic_src_clk.c, 480000000);
6790 clk_set_rate(&usb_hsic_hsio_cal_clk.c, 9000000);
Lena Salman127823f2012-02-14 17:13:53 +02006791 clk_set_rate(&usb_hsic_system_clk.c, 60000000);
Stephen Boyd092fd182011-10-21 15:56:30 -07006792 /*
6793 * Set the CSI rates to a safe default to avoid warnings when
6794 * switching csi pix and rdi clocks.
6795 */
6796 clk_set_rate(&csi0_src_clk.c, 27000000);
6797 clk_set_rate(&csi1_src_clk.c, 27000000);
6798 clk_set_rate(&csi2_src_clk.c, 27000000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006799
6800 /*
Stephen Boyd60496bb2011-10-17 13:51:37 -07006801 * The halt status bits for these clocks may be incorrect at boot.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006802 * Toggle these clocks on and off to refresh them.
6803 */
Stephen Boyd409b8b42012-04-10 12:12:56 -07006804 clk_prepare_enable(&pdm_clk.c);
6805 clk_disable_unprepare(&pdm_clk.c);
6806 clk_prepare_enable(&tssc_clk.c);
6807 clk_disable_unprepare(&tssc_clk.c);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006808 clk_prepare_enable(&usb_hsic_hsic_clk.c);
6809 clk_disable_unprepare(&usb_hsic_hsic_clk.c);
Stephen Boydd7a143a2012-02-16 17:59:26 -08006810
6811 /*
6812 * Keep sfab floor @ 54MHz so that Krait AHB is at least 27MHz at all
6813 * times when Apps CPU is active. This ensures the timer's requirement
6814 * of Krait AHB running 4 times as fast as the timer itself.
6815 */
6816 clk_set_rate(&sfab_tmr_a_clk.c, 54000000);
Stephen Boyde334aeb2012-01-24 12:17:29 -08006817 clk_prepare_enable(&sfab_tmr_a_clk.c);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006818}
6819
Stephen Boydbb600ae2011-08-02 20:11:40 -07006820static int __init msm8960_clock_late_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006821{
Stephen Boyda3787f32011-09-16 18:55:13 -07006822 int rc;
6823 struct clk *mmfpb_a_clk = clk_get_sys("clock-8960", "mmfpb_a_clk");
Stephen Boyd85436132011-09-16 18:55:13 -07006824 struct clk *cfpb_a_clk = clk_get_sys("clock-8960", "cfpb_a_clk");
Stephen Boyda3787f32011-09-16 18:55:13 -07006825
Stephen Boyd9e497f02012-08-24 13:07:24 -07006826 /* Vote for MMFPB to be on when Apps is active. */
Stephen Boyda3787f32011-09-16 18:55:13 -07006827 if (WARN(IS_ERR(mmfpb_a_clk), "mmfpb_a_clk not found (%ld)\n",
6828 PTR_ERR(mmfpb_a_clk)))
6829 return PTR_ERR(mmfpb_a_clk);
Stephen Boyd9e497f02012-08-24 13:07:24 -07006830 rc = clk_set_rate(mmfpb_a_clk, 38400000);
Stephen Boyda3787f32011-09-16 18:55:13 -07006831 if (WARN(rc, "mmfpb_a_clk rate was not set (%d)\n", rc))
6832 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006833 rc = clk_prepare_enable(mmfpb_a_clk);
Stephen Boyda3787f32011-09-16 18:55:13 -07006834 if (WARN(rc, "mmfpb_a_clk not enabled (%d)\n", rc))
6835 return rc;
6836
Stephen Boyd9e497f02012-08-24 13:07:24 -07006837 /* Vote for CFPB to be on when Apps is active. */
Stephen Boyd85436132011-09-16 18:55:13 -07006838 if (WARN(IS_ERR(cfpb_a_clk), "cfpb_a_clk not found (%ld)\n",
6839 PTR_ERR(cfpb_a_clk)))
6840 return PTR_ERR(cfpb_a_clk);
Stephen Boyd9e497f02012-08-24 13:07:24 -07006841 rc = clk_set_rate(cfpb_a_clk, 32000000);
Stephen Boyd85436132011-09-16 18:55:13 -07006842 if (WARN(rc, "cfpb_a_clk rate was not set (%d)\n", rc))
6843 return rc;
Stephen Boyde334aeb2012-01-24 12:17:29 -08006844 rc = clk_prepare_enable(cfpb_a_clk);
Stephen Boyd85436132011-09-16 18:55:13 -07006845 if (WARN(rc, "cfpb_a_clk not enabled (%d)\n", rc))
6846 return rc;
Matt Wagantalle18bbc82011-10-06 10:07:28 -07006847
Patrick Daly441929e2013-02-14 11:48:26 -08006848 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07006849}
Stephen Boydbb600ae2011-08-02 20:11:40 -07006850
6851struct clock_init_data msm8960_clock_init_data __initdata = {
6852 .table = msm_clocks_8960,
6853 .size = ARRAY_SIZE(msm_clocks_8960),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006854 .pre_init = msm8960_clock_pre_init,
6855 .post_init = msm8960_clock_post_init,
Stephen Boydbb600ae2011-08-02 20:11:40 -07006856 .late_init = msm8960_clock_late_init,
6857};
Tianyi Gou41515e22011-09-01 19:37:43 -07006858
6859struct clock_init_data apq8064_clock_init_data __initdata = {
6860 .table = msm_clocks_8064,
6861 .size = ARRAY_SIZE(msm_clocks_8064),
Matt Wagantallb64888f2012-04-02 21:35:07 -07006862 .pre_init = msm8960_clock_pre_init,
6863 .post_init = msm8960_clock_post_init,
Tianyi Gou41515e22011-09-01 19:37:43 -07006864 .late_init = msm8960_clock_late_init,
6865};
Tianyi Goue3d4f542012-03-15 17:06:45 -07006866
6867struct clock_init_data msm8930_clock_init_data __initdata = {
6868 .table = msm_clocks_8930,
6869 .size = ARRAY_SIZE(msm_clocks_8930),
Patrick Daly1a3859f2012-08-27 16:10:26 -07006870 .pre_init = msm8930_clock_pre_init,
6871 .post_init = msm8960_clock_post_init,
6872 .late_init = msm8960_clock_late_init,
6873};
6874
6875struct clock_init_data msm8930_pm8917_clock_init_data __initdata = {
6876 .table = msm_clocks_8930,
6877 .size = ARRAY_SIZE(msm_clocks_8930),
6878 .pre_init = msm8930_pm8917_clock_pre_init,
Matt Wagantallb64888f2012-04-02 21:35:07 -07006879 .post_init = msm8960_clock_post_init,
Tianyi Goue3d4f542012-03-15 17:06:45 -07006880 .late_init = msm8960_clock_late_init,
6881};