Manu Gautam | 5143b25 | 2012-01-05 19:25:23 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 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 | |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/err.h> |
| 17 | #include <linux/ctype.h> |
| 18 | #include <linux/bitops.h> |
| 19 | #include <linux/io.h> |
| 20 | #include <linux/spinlock.h> |
| 21 | #include <linux/delay.h> |
| 22 | #include <linux/clk.h> |
| 23 | #include <linux/clkdev.h> |
| 24 | |
| 25 | #include <mach/msm_iomap.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 26 | #include <mach/scm-io.h> |
| 27 | #include <mach/rpm.h> |
| 28 | #include <mach/rpm-regulator.h> |
| 29 | |
Matt Wagantall | 33d01f5 | 2012-02-23 23:27:44 -0800 | [diff] [blame] | 30 | #include "clock.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 31 | #include "clock-local.h" |
| 32 | #include "clock-rpm.h" |
| 33 | #include "clock-voter.h" |
Vikram Mulukutla | 681d868 | 2012-03-09 23:56:20 -0800 | [diff] [blame] | 34 | #include "clock-pll.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 35 | |
| 36 | #ifdef CONFIG_MSM_SECURE_IO |
| 37 | #undef readl_relaxed |
| 38 | #undef writel_relaxed |
| 39 | #define readl_relaxed secure_readl |
| 40 | #define writel_relaxed secure_writel |
| 41 | #endif |
| 42 | |
| 43 | #define REG(off) (MSM_CLK_CTL_BASE + (off)) |
| 44 | #define REG_MM(off) (MSM_MMSS_CLK_CTL_BASE + (off)) |
| 45 | #define REG_LPA(off) (MSM_LPASS_CLK_CTL_BASE + (off)) |
| 46 | |
| 47 | /* Peripheral clock registers. */ |
| 48 | #define CE2_HCLK_CTL_REG REG(0x2740) |
| 49 | #define CLK_HALT_CFPB_STATEA_REG REG(0x2FCC) |
| 50 | #define CLK_HALT_CFPB_STATEB_REG REG(0x2FD0) |
| 51 | #define CLK_HALT_CFPB_STATEC_REG REG(0x2FD4) |
| 52 | #define CLK_HALT_DFAB_STATE_REG REG(0x2FC8) |
| 53 | #define CLK_HALT_MSS_SMPSS_MISC_STATE_REG REG(0x2FDC) |
| 54 | #define CLK_HALT_SFPB_MISC_STATE_REG REG(0x2FD8) |
| 55 | #define CLK_TEST_REG REG(0x2FA0) |
Matt Wagantall | 66cd093 | 2011-09-12 19:04:34 -0700 | [diff] [blame] | 56 | #define EBI2_2X_CLK_CTL_REG REG(0x2660) |
| 57 | #define EBI2_CLK_CTL_REG REG(0x2664) |
Matt Wagantall | 7625a4c | 2011-11-01 16:17:53 -0700 | [diff] [blame] | 58 | #define GPn_MD_REG(n) REG(0x2D00+(0x20*(n))) |
| 59 | #define GPn_NS_REG(n) REG(0x2D24+(0x20*(n))) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 60 | #define GSBIn_HCLK_CTL_REG(n) REG(0x29C0+(0x20*((n)-1))) |
| 61 | #define GSBIn_QUP_APPS_MD_REG(n) REG(0x29C8+(0x20*((n)-1))) |
| 62 | #define GSBIn_QUP_APPS_NS_REG(n) REG(0x29CC+(0x20*((n)-1))) |
| 63 | #define GSBIn_RESET_REG(n) REG(0x29DC+(0x20*((n)-1))) |
| 64 | #define GSBIn_UART_APPS_MD_REG(n) REG(0x29D0+(0x20*((n)-1))) |
| 65 | #define GSBIn_UART_APPS_NS_REG(n) REG(0x29D4+(0x20*((n)-1))) |
| 66 | #define PDM_CLK_NS_REG REG(0x2CC0) |
| 67 | #define BB_PLL_ENA_SC0_REG REG(0x34C0) |
| 68 | #define BB_PLL0_STATUS_REG REG(0x30D8) |
| 69 | #define BB_PLL6_STATUS_REG REG(0x3118) |
| 70 | #define BB_PLL8_L_VAL_REG REG(0x3144) |
| 71 | #define BB_PLL8_M_VAL_REG REG(0x3148) |
| 72 | #define BB_PLL8_MODE_REG REG(0x3140) |
| 73 | #define BB_PLL8_N_VAL_REG REG(0x314C) |
| 74 | #define BB_PLL8_STATUS_REG REG(0x3158) |
| 75 | #define PLLTEST_PAD_CFG_REG REG(0x2FA4) |
| 76 | #define PMEM_ACLK_CTL_REG REG(0x25A0) |
| 77 | #define PPSS_HCLK_CTL_REG REG(0x2580) |
Stephen Boyd | 842a1f6 | 2012-04-26 19:07:38 -0700 | [diff] [blame] | 78 | #define PRNG_CLK_NS_REG REG(0x2E80) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 79 | #define RINGOSC_NS_REG REG(0x2DC0) |
| 80 | #define RINGOSC_STATUS_REG REG(0x2DCC) |
| 81 | #define RINGOSC_TCXO_CTL_REG REG(0x2DC4) |
| 82 | #define SC0_U_CLK_BRANCH_ENA_VOTE_REG REG(0x3080) |
| 83 | #define SC1_U_CLK_BRANCH_ENA_VOTE_REG REG(0x30A0) |
| 84 | #define SC0_U_CLK_SLEEP_ENA_VOTE_REG REG(0x3084) |
| 85 | #define SC1_U_CLK_SLEEP_ENA_VOTE_REG REG(0x30A4) |
| 86 | #define SDCn_APPS_CLK_MD_REG(n) REG(0x2828+(0x20*((n)-1))) |
| 87 | #define SDCn_APPS_CLK_NS_REG(n) REG(0x282C+(0x20*((n)-1))) |
| 88 | #define SDCn_HCLK_CTL_REG(n) REG(0x2820+(0x20*((n)-1))) |
| 89 | #define SDCn_RESET_REG(n) REG(0x2830+(0x20*((n)-1))) |
| 90 | #define TSIF_HCLK_CTL_REG REG(0x2700) |
| 91 | #define TSIF_REF_CLK_MD_REG REG(0x270C) |
| 92 | #define TSIF_REF_CLK_NS_REG REG(0x2710) |
| 93 | #define TSSC_CLK_CTL_REG REG(0x2CA0) |
| 94 | #define USB_FSn_HCLK_CTL_REG(n) REG(0x2960+(0x20*((n)-1))) |
| 95 | #define USB_FSn_RESET_REG(n) REG(0x2974+(0x20*((n)-1))) |
| 96 | #define USB_FSn_SYSTEM_CLK_CTL_REG(n) REG(0x296C+(0x20*((n)-1))) |
| 97 | #define USB_FSn_XCVR_FS_CLK_MD_REG(n) REG(0x2964+(0x20*((n)-1))) |
| 98 | #define USB_FSn_XCVR_FS_CLK_NS_REG(n) REG(0x2968+(0x20*((n)-1))) |
| 99 | #define USB_HS1_HCLK_CTL_REG REG(0x2900) |
| 100 | #define USB_HS1_RESET_REG REG(0x2910) |
| 101 | #define USB_HS1_XCVR_FS_CLK_MD_REG REG(0x2908) |
| 102 | #define USB_HS1_XCVR_FS_CLK_NS_REG REG(0x290C) |
| 103 | #define USB_PHY0_RESET_REG REG(0x2E20) |
| 104 | |
| 105 | /* Multimedia clock registers. */ |
| 106 | #define AHB_EN_REG REG_MM(0x0008) |
| 107 | #define AHB_EN2_REG REG_MM(0x0038) |
| 108 | #define AHB_NS_REG REG_MM(0x0004) |
| 109 | #define AXI_NS_REG REG_MM(0x0014) |
| 110 | #define CAMCLK_CC_REG REG_MM(0x0140) |
| 111 | #define CAMCLK_MD_REG REG_MM(0x0144) |
| 112 | #define CAMCLK_NS_REG REG_MM(0x0148) |
| 113 | #define CSI_CC_REG REG_MM(0x0040) |
| 114 | #define CSI_NS_REG REG_MM(0x0048) |
| 115 | #define DBG_BUS_VEC_A_REG REG_MM(0x01C8) |
| 116 | #define DBG_BUS_VEC_B_REG REG_MM(0x01CC) |
| 117 | #define DBG_BUS_VEC_C_REG REG_MM(0x01D0) |
| 118 | #define DBG_BUS_VEC_D_REG REG_MM(0x01D4) |
| 119 | #define DBG_BUS_VEC_E_REG REG_MM(0x01D8) |
| 120 | #define DBG_BUS_VEC_F_REG REG_MM(0x01DC) |
| 121 | #define DBG_BUS_VEC_H_REG REG_MM(0x01E4) |
Matt Wagantall | f803260 | 2011-06-15 23:01:56 -0700 | [diff] [blame] | 122 | #define DBG_BUS_VEC_I_REG REG_MM(0x01E8) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 123 | #define DBG_CFG_REG_HS_REG REG_MM(0x01B4) |
| 124 | #define DBG_CFG_REG_LS_REG REG_MM(0x01B8) |
| 125 | #define GFX2D0_CC_REG REG_MM(0x0060) |
| 126 | #define GFX2D0_MD0_REG REG_MM(0x0064) |
| 127 | #define GFX2D0_MD1_REG REG_MM(0x0068) |
| 128 | #define GFX2D0_NS_REG REG_MM(0x0070) |
| 129 | #define GFX2D1_CC_REG REG_MM(0x0074) |
| 130 | #define GFX2D1_MD0_REG REG_MM(0x0078) |
| 131 | #define GFX2D1_MD1_REG REG_MM(0x006C) |
| 132 | #define GFX2D1_NS_REG REG_MM(0x007C) |
| 133 | #define GFX3D_CC_REG REG_MM(0x0080) |
| 134 | #define GFX3D_MD0_REG REG_MM(0x0084) |
| 135 | #define GFX3D_MD1_REG REG_MM(0x0088) |
| 136 | #define GFX3D_NS_REG REG_MM(0x008C) |
| 137 | #define IJPEG_CC_REG REG_MM(0x0098) |
| 138 | #define IJPEG_MD_REG REG_MM(0x009C) |
| 139 | #define IJPEG_NS_REG REG_MM(0x00A0) |
| 140 | #define JPEGD_CC_REG REG_MM(0x00A4) |
| 141 | #define JPEGD_NS_REG REG_MM(0x00AC) |
| 142 | #define MAXI_EN_REG REG_MM(0x0018) |
Matt Wagantall | f63a889 | 2011-06-15 16:44:46 -0700 | [diff] [blame] | 143 | #define MAXI_EN2_REG REG_MM(0x0020) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 144 | #define MAXI_EN3_REG REG_MM(0x002C) |
| 145 | #define MDP_CC_REG REG_MM(0x00C0) |
| 146 | #define MDP_MD0_REG REG_MM(0x00C4) |
| 147 | #define MDP_MD1_REG REG_MM(0x00C8) |
| 148 | #define MDP_NS_REG REG_MM(0x00D0) |
| 149 | #define MISC_CC_REG REG_MM(0x0058) |
| 150 | #define MISC_CC2_REG REG_MM(0x005C) |
| 151 | #define PIXEL_CC_REG REG_MM(0x00D4) |
| 152 | #define PIXEL_CC2_REG REG_MM(0x0120) |
| 153 | #define PIXEL_MD_REG REG_MM(0x00D8) |
| 154 | #define PIXEL_NS_REG REG_MM(0x00DC) |
| 155 | #define MM_PLL0_MODE_REG REG_MM(0x0300) |
| 156 | #define MM_PLL1_MODE_REG REG_MM(0x031C) |
| 157 | #define MM_PLL2_CONFIG_REG REG_MM(0x0348) |
| 158 | #define MM_PLL2_L_VAL_REG REG_MM(0x033C) |
| 159 | #define MM_PLL2_M_VAL_REG REG_MM(0x0340) |
| 160 | #define MM_PLL2_MODE_REG REG_MM(0x0338) |
| 161 | #define MM_PLL2_N_VAL_REG REG_MM(0x0344) |
| 162 | #define ROT_CC_REG REG_MM(0x00E0) |
| 163 | #define ROT_NS_REG REG_MM(0x00E8) |
| 164 | #define SAXI_EN_REG REG_MM(0x0030) |
| 165 | #define SW_RESET_AHB_REG REG_MM(0x020C) |
| 166 | #define SW_RESET_ALL_REG REG_MM(0x0204) |
| 167 | #define SW_RESET_AXI_REG REG_MM(0x0208) |
| 168 | #define SW_RESET_CORE_REG REG_MM(0x0210) |
| 169 | #define TV_CC_REG REG_MM(0x00EC) |
| 170 | #define TV_CC2_REG REG_MM(0x0124) |
| 171 | #define TV_MD_REG REG_MM(0x00F0) |
| 172 | #define TV_NS_REG REG_MM(0x00F4) |
| 173 | #define VCODEC_CC_REG REG_MM(0x00F8) |
| 174 | #define VCODEC_MD0_REG REG_MM(0x00FC) |
| 175 | #define VCODEC_MD1_REG REG_MM(0x0128) |
| 176 | #define VCODEC_NS_REG REG_MM(0x0100) |
| 177 | #define VFE_CC_REG REG_MM(0x0104) |
| 178 | #define VFE_MD_REG REG_MM(0x0108) |
| 179 | #define VFE_NS_REG REG_MM(0x010C) |
| 180 | #define VPE_CC_REG REG_MM(0x0110) |
| 181 | #define VPE_NS_REG REG_MM(0x0118) |
| 182 | |
| 183 | /* Low-power Audio clock registers. */ |
| 184 | #define LCC_CLK_LS_DEBUG_CFG_REG REG_LPA(0x00A8) |
| 185 | #define LCC_CODEC_I2S_MIC_MD_REG REG_LPA(0x0064) |
| 186 | #define LCC_CODEC_I2S_MIC_NS_REG REG_LPA(0x0060) |
| 187 | #define LCC_CODEC_I2S_MIC_STATUS_REG REG_LPA(0x0068) |
| 188 | #define LCC_CODEC_I2S_SPKR_MD_REG REG_LPA(0x0070) |
| 189 | #define LCC_CODEC_I2S_SPKR_NS_REG REG_LPA(0x006C) |
| 190 | #define LCC_CODEC_I2S_SPKR_STATUS_REG REG_LPA(0x0074) |
| 191 | #define LCC_MI2S_MD_REG REG_LPA(0x004C) |
| 192 | #define LCC_MI2S_NS_REG REG_LPA(0x0048) |
| 193 | #define LCC_MI2S_STATUS_REG REG_LPA(0x0050) |
| 194 | #define LCC_PCM_MD_REG REG_LPA(0x0058) |
| 195 | #define LCC_PCM_NS_REG REG_LPA(0x0054) |
| 196 | #define LCC_PCM_STATUS_REG REG_LPA(0x005C) |
| 197 | #define LCC_PLL0_CONFIG_REG REG_LPA(0x0014) |
| 198 | #define LCC_PLL0_L_VAL_REG REG_LPA(0x0004) |
| 199 | #define LCC_PLL0_M_VAL_REG REG_LPA(0x0008) |
| 200 | #define LCC_PLL0_MODE_REG REG_LPA(0x0000) |
| 201 | #define LCC_PLL0_N_VAL_REG REG_LPA(0x000C) |
| 202 | #define LCC_PRI_PLL_CLK_CTL_REG REG_LPA(0x00C4) |
| 203 | #define LCC_SPARE_I2S_MIC_MD_REG REG_LPA(0x007C) |
| 204 | #define LCC_SPARE_I2S_MIC_NS_REG REG_LPA(0x0078) |
| 205 | #define LCC_SPARE_I2S_MIC_STATUS_REG REG_LPA(0x0080) |
| 206 | #define LCC_SPARE_I2S_SPKR_MD_REG REG_LPA(0x0088) |
| 207 | #define LCC_SPARE_I2S_SPKR_NS_REG REG_LPA(0x0084) |
| 208 | #define LCC_SPARE_I2S_SPKR_STATUS_REG REG_LPA(0x008C) |
| 209 | |
| 210 | /* MUX source input identifiers. */ |
| 211 | #define pxo_to_bb_mux 0 |
| 212 | #define mxo_to_bb_mux 1 |
Matt Wagantall | 7625a4c | 2011-11-01 16:17:53 -0700 | [diff] [blame] | 213 | #define cxo_to_bb_mux 5 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 214 | #define pll0_to_bb_mux 2 |
| 215 | #define pll8_to_bb_mux 3 |
| 216 | #define pll6_to_bb_mux 4 |
| 217 | #define gnd_to_bb_mux 6 |
| 218 | #define pxo_to_mm_mux 0 |
| 219 | #define pll1_to_mm_mux 1 /* or MMSS_PLL0 */ |
| 220 | #define pll2_to_mm_mux 1 /* or MMSS_PLL1 */ |
| 221 | #define pll3_to_mm_mux 3 /* or MMSS_PLL2 */ |
| 222 | #define pll8_to_mm_mux 2 /* or MMSS_GPERF */ |
| 223 | #define pll0_to_mm_mux 3 /* or MMSS_GPLL0 */ |
| 224 | #define mxo_to_mm_mux 4 |
| 225 | #define gnd_to_mm_mux 6 |
| 226 | #define cxo_to_xo_mux 0 |
| 227 | #define pxo_to_xo_mux 1 |
| 228 | #define mxo_to_xo_mux 2 |
| 229 | #define gnd_to_xo_mux 3 |
| 230 | #define pxo_to_lpa_mux 0 |
| 231 | #define cxo_to_lpa_mux 1 |
| 232 | #define pll4_to_lpa_mux 2 /* or LPA_PLL0 */ |
| 233 | #define gnd_to_lpa_mux 6 |
| 234 | |
| 235 | /* Test Vector Macros */ |
| 236 | #define TEST_TYPE_PER_LS 1 |
| 237 | #define TEST_TYPE_PER_HS 2 |
| 238 | #define TEST_TYPE_MM_LS 3 |
| 239 | #define TEST_TYPE_MM_HS 4 |
| 240 | #define TEST_TYPE_LPA 5 |
| 241 | #define TEST_TYPE_SC 6 |
| 242 | #define TEST_TYPE_MM_HS2X 7 |
| 243 | #define TEST_TYPE_SHIFT 24 |
| 244 | #define TEST_CLK_SEL_MASK BM(23, 0) |
| 245 | #define TEST_VECTOR(s, t) (((t) << TEST_TYPE_SHIFT) | BVAL(23, 0, (s))) |
| 246 | #define TEST_PER_LS(s) TEST_VECTOR((s), TEST_TYPE_PER_LS) |
| 247 | #define TEST_PER_HS(s) TEST_VECTOR((s), TEST_TYPE_PER_HS) |
| 248 | #define TEST_MM_LS(s) TEST_VECTOR((s), TEST_TYPE_MM_LS) |
| 249 | #define TEST_MM_HS(s) TEST_VECTOR((s), TEST_TYPE_MM_HS) |
| 250 | #define TEST_LPA(s) TEST_VECTOR((s), TEST_TYPE_LPA) |
| 251 | #define TEST_SC(s) TEST_VECTOR((s), TEST_TYPE_SC) |
| 252 | #define TEST_MM_HS2X(s) TEST_VECTOR((s), TEST_TYPE_MM_HS2X) |
| 253 | |
| 254 | struct pll_rate { |
| 255 | const uint32_t l_val; |
| 256 | const uint32_t m_val; |
| 257 | const uint32_t n_val; |
| 258 | const uint32_t vco; |
| 259 | const uint32_t post_div; |
| 260 | const uint32_t i_bits; |
| 261 | }; |
| 262 | #define PLL_RATE(l, m, n, v, d, i) { l, m, n, v, (d>>1), i } |
| 263 | /* |
| 264 | * Clock frequency definitions and macros |
| 265 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 266 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 267 | enum vdd_dig_levels { |
| 268 | VDD_DIG_NONE, |
| 269 | VDD_DIG_LOW, |
| 270 | VDD_DIG_NOMINAL, |
Saravana Kannan | 55e959d | 2012-10-15 22:16:04 -0700 | [diff] [blame^] | 271 | VDD_DIG_HIGH, |
| 272 | VDD_DIG_NUM |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 273 | }; |
| 274 | |
| 275 | static int set_vdd_dig(struct clk_vdd_class *vdd_class, int level) |
| 276 | { |
| 277 | static const int vdd_uv[] = { |
| 278 | [VDD_DIG_NONE] = 500000, |
| 279 | [VDD_DIG_LOW] = 1000000, |
| 280 | [VDD_DIG_NOMINAL] = 1100000, |
| 281 | [VDD_DIG_HIGH] = 1200000 |
| 282 | }; |
| 283 | |
| 284 | return rpm_vreg_set_voltage(RPM_VREG_ID_PM8058_S1, RPM_VREG_VOTER3, |
| 285 | vdd_uv[level], 1200000, 1); |
| 286 | } |
| 287 | |
Saravana Kannan | 55e959d | 2012-10-15 22:16:04 -0700 | [diff] [blame^] | 288 | static DEFINE_VDD_CLASS(vdd_dig, set_vdd_dig, VDD_DIG_NUM); |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 289 | |
| 290 | #define VDD_DIG_FMAX_MAP1(l1, f1) \ |
Saravana Kannan | 55e959d | 2012-10-15 22:16:04 -0700 | [diff] [blame^] | 291 | .vdd_class = &vdd_dig, \ |
| 292 | .fmax = (unsigned long[VDD_DIG_NUM]) { \ |
| 293 | [VDD_DIG_##l1] = (f1), \ |
| 294 | }, \ |
| 295 | .num_fmax = VDD_DIG_NUM |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 296 | #define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \ |
Saravana Kannan | 55e959d | 2012-10-15 22:16:04 -0700 | [diff] [blame^] | 297 | .vdd_class = &vdd_dig, \ |
| 298 | .fmax = (unsigned long[VDD_DIG_NUM]) { \ |
| 299 | [VDD_DIG_##l1] = (f1), \ |
| 300 | [VDD_DIG_##l2] = (f2), \ |
| 301 | }, \ |
| 302 | .num_fmax = VDD_DIG_NUM |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 303 | #define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \ |
Saravana Kannan | 55e959d | 2012-10-15 22:16:04 -0700 | [diff] [blame^] | 304 | .vdd_class = &vdd_dig, \ |
| 305 | .fmax = (unsigned long[VDD_DIG_NUM]) { \ |
| 306 | [VDD_DIG_##l1] = (f1), \ |
| 307 | [VDD_DIG_##l2] = (f2), \ |
| 308 | [VDD_DIG_##l3] = (f3), \ |
| 309 | }, \ |
| 310 | .num_fmax = VDD_DIG_NUM |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 311 | |
Stephen Boyd | 72a8035 | 2012-01-26 15:57:38 -0800 | [diff] [blame] | 312 | DEFINE_CLK_RPM_BRANCH(pxo_clk, pxo_a_clk, PXO, 27000000); |
| 313 | DEFINE_CLK_RPM_BRANCH(cxo_clk, cxo_a_clk, CXO, 19200000); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 314 | |
| 315 | static struct pll_vote_clk pll8_clk = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 316 | .en_reg = BB_PLL_ENA_SC0_REG, |
| 317 | .en_mask = BIT(8), |
| 318 | .status_reg = BB_PLL8_STATUS_REG, |
Vikram Mulukutla | 681d868 | 2012-03-09 23:56:20 -0800 | [diff] [blame] | 319 | .status_mask = BIT(16), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 320 | .parent = &pxo_clk.c, |
| 321 | .c = { |
| 322 | .dbg_name = "pll8_clk", |
Tianyi Gou | 7949ecb | 2012-02-14 14:25:32 -0800 | [diff] [blame] | 323 | .rate = 384000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 324 | .ops = &clk_ops_pll_vote, |
| 325 | CLK_INIT(pll8_clk.c), |
| 326 | }, |
| 327 | }; |
| 328 | |
| 329 | static struct pll_clk pll2_clk = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 330 | .mode_reg = MM_PLL1_MODE_REG, |
| 331 | .parent = &pxo_clk.c, |
| 332 | .c = { |
| 333 | .dbg_name = "pll2_clk", |
Tianyi Gou | 7949ecb | 2012-02-14 14:25:32 -0800 | [diff] [blame] | 334 | .rate = 800000000, |
Vikram Mulukutla | 681d868 | 2012-03-09 23:56:20 -0800 | [diff] [blame] | 335 | .ops = &clk_ops_local_pll, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 336 | CLK_INIT(pll2_clk.c), |
| 337 | }, |
| 338 | }; |
| 339 | |
| 340 | static struct pll_clk pll3_clk = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 341 | .mode_reg = MM_PLL2_MODE_REG, |
| 342 | .parent = &pxo_clk.c, |
| 343 | .c = { |
| 344 | .dbg_name = "pll3_clk", |
Tianyi Gou | 7949ecb | 2012-02-14 14:25:32 -0800 | [diff] [blame] | 345 | .rate = 0, /* TODO: Detect rate dynamically */ |
Vikram Mulukutla | 681d868 | 2012-03-09 23:56:20 -0800 | [diff] [blame] | 346 | .ops = &clk_ops_local_pll, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 347 | CLK_INIT(pll3_clk.c), |
| 348 | }, |
| 349 | }; |
| 350 | |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 351 | static int pll4_clk_enable(struct clk *c) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 352 | { |
| 353 | struct msm_rpm_iv_pair iv = { MSM_RPM_ID_PLL_4, 1 }; |
| 354 | return msm_rpm_set_noirq(MSM_RPM_CTX_SET_0, &iv, 1); |
| 355 | } |
| 356 | |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 357 | static void pll4_clk_disable(struct clk *c) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 358 | { |
| 359 | struct msm_rpm_iv_pair iv = { MSM_RPM_ID_PLL_4, 0 }; |
| 360 | msm_rpm_set_noirq(MSM_RPM_CTX_SET_0, &iv, 1); |
| 361 | } |
| 362 | |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 363 | static struct clk *pll4_clk_get_parent(struct clk *c) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 364 | { |
| 365 | return &pxo_clk.c; |
| 366 | } |
| 367 | |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 368 | static bool pll4_clk_is_local(struct clk *c) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 369 | { |
| 370 | return false; |
| 371 | } |
| 372 | |
Matt Wagantall | 4a36a7e | 2012-05-14 17:03:21 -0700 | [diff] [blame] | 373 | static enum handoff pll4_clk_handoff(struct clk *clk) |
| 374 | { |
| 375 | struct msm_rpm_iv_pair iv = { MSM_RPM_ID_PLL_4 }; |
| 376 | int rc = msm_rpm_get_status(&iv, 1); |
| 377 | if (rc < 0 || !iv.value) |
| 378 | return HANDOFF_DISABLED_CLK; |
| 379 | |
| 380 | return HANDOFF_ENABLED_CLK; |
| 381 | } |
| 382 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 383 | static struct clk_ops clk_ops_pll4 = { |
| 384 | .enable = pll4_clk_enable, |
| 385 | .disable = pll4_clk_disable, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 386 | .get_parent = pll4_clk_get_parent, |
| 387 | .is_local = pll4_clk_is_local, |
Matt Wagantall | 4a36a7e | 2012-05-14 17:03:21 -0700 | [diff] [blame] | 388 | .handoff = pll4_clk_handoff, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 389 | }; |
| 390 | |
| 391 | static struct fixed_clk pll4_clk = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 392 | .c = { |
| 393 | .dbg_name = "pll4_clk", |
Tianyi Gou | 7949ecb | 2012-02-14 14:25:32 -0800 | [diff] [blame] | 394 | .rate = 540672000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 395 | .ops = &clk_ops_pll4, |
| 396 | CLK_INIT(pll4_clk.c), |
| 397 | }, |
| 398 | }; |
| 399 | |
| 400 | /* |
| 401 | * SoC-specific Set-Rate Functions |
| 402 | */ |
| 403 | |
| 404 | /* Unlike other clocks, the TV rate is adjusted through PLL |
| 405 | * re-programming. It is also routed through an MND divider. */ |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 406 | static void set_rate_tv(struct rcg_clk *rcg, struct clk_freq_tbl *nf) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 407 | { |
| 408 | struct pll_rate *rate = nf->extra_freq_data; |
| 409 | uint32_t pll_mode, pll_config, misc_cc2; |
| 410 | |
| 411 | /* Disable PLL output. */ |
| 412 | pll_mode = readl_relaxed(MM_PLL2_MODE_REG); |
| 413 | pll_mode &= ~BIT(0); |
| 414 | writel_relaxed(pll_mode, MM_PLL2_MODE_REG); |
| 415 | |
| 416 | /* Assert active-low PLL reset. */ |
| 417 | pll_mode &= ~BIT(2); |
| 418 | writel_relaxed(pll_mode, MM_PLL2_MODE_REG); |
| 419 | |
| 420 | /* Program L, M and N values. */ |
| 421 | writel_relaxed(rate->l_val, MM_PLL2_L_VAL_REG); |
| 422 | writel_relaxed(rate->m_val, MM_PLL2_M_VAL_REG); |
| 423 | writel_relaxed(rate->n_val, MM_PLL2_N_VAL_REG); |
| 424 | |
| 425 | /* Configure MN counter, post-divide, VCO, and i-bits. */ |
| 426 | pll_config = readl_relaxed(MM_PLL2_CONFIG_REG); |
| 427 | pll_config &= ~(BM(22, 20) | BM(18, 0)); |
| 428 | pll_config |= rate->n_val ? BIT(22) : 0; |
| 429 | pll_config |= BVAL(21, 20, rate->post_div); |
| 430 | pll_config |= BVAL(17, 16, rate->vco); |
| 431 | pll_config |= rate->i_bits; |
| 432 | writel_relaxed(pll_config, MM_PLL2_CONFIG_REG); |
| 433 | |
| 434 | /* Configure MND. */ |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 435 | set_rate_mnd(rcg, nf); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 436 | |
| 437 | /* Configure hdmi_ref_clk to be equal to the TV clock rate. */ |
| 438 | misc_cc2 = readl_relaxed(MISC_CC2_REG); |
| 439 | misc_cc2 &= ~(BIT(28)|BM(21, 18)); |
| 440 | misc_cc2 |= (BIT(28)|BVAL(21, 18, (nf->ns_val >> 14) & 0x3)); |
| 441 | writel_relaxed(misc_cc2, MISC_CC2_REG); |
| 442 | |
| 443 | /* De-assert active-low PLL reset. */ |
| 444 | pll_mode |= BIT(2); |
| 445 | writel_relaxed(pll_mode, MM_PLL2_MODE_REG); |
| 446 | |
| 447 | /* Enable PLL output. */ |
| 448 | pll_mode |= BIT(0); |
| 449 | writel_relaxed(pll_mode, MM_PLL2_MODE_REG); |
| 450 | } |
| 451 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 452 | /* |
| 453 | * Clock Descriptions |
| 454 | */ |
| 455 | |
| 456 | /* AXI Interfaces */ |
| 457 | static struct branch_clk gmem_axi_clk = { |
| 458 | .b = { |
| 459 | .ctl_reg = MAXI_EN_REG, |
| 460 | .en_mask = BIT(24), |
| 461 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 462 | .halt_bit = 6, |
| 463 | }, |
| 464 | .c = { |
| 465 | .dbg_name = "gmem_axi_clk", |
| 466 | .ops = &clk_ops_branch, |
| 467 | CLK_INIT(gmem_axi_clk.c), |
| 468 | }, |
| 469 | }; |
| 470 | |
| 471 | static struct branch_clk ijpeg_axi_clk = { |
| 472 | .b = { |
| 473 | .ctl_reg = MAXI_EN_REG, |
| 474 | .en_mask = BIT(21), |
| 475 | .reset_reg = SW_RESET_AXI_REG, |
| 476 | .reset_mask = BIT(14), |
| 477 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 478 | .halt_bit = 4, |
| 479 | }, |
| 480 | .c = { |
| 481 | .dbg_name = "ijpeg_axi_clk", |
| 482 | .ops = &clk_ops_branch, |
| 483 | CLK_INIT(ijpeg_axi_clk.c), |
| 484 | }, |
| 485 | }; |
| 486 | |
| 487 | static struct branch_clk imem_axi_clk = { |
| 488 | .b = { |
| 489 | .ctl_reg = MAXI_EN_REG, |
| 490 | .en_mask = BIT(22), |
| 491 | .reset_reg = SW_RESET_CORE_REG, |
| 492 | .reset_mask = BIT(10), |
| 493 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 494 | .halt_bit = 7, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 495 | .retain_reg = MAXI_EN2_REG, |
| 496 | .retain_mask = BIT(10), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 497 | }, |
| 498 | .c = { |
| 499 | .dbg_name = "imem_axi_clk", |
| 500 | .ops = &clk_ops_branch, |
| 501 | CLK_INIT(imem_axi_clk.c), |
| 502 | }, |
| 503 | }; |
| 504 | |
| 505 | static struct branch_clk jpegd_axi_clk = { |
| 506 | .b = { |
| 507 | .ctl_reg = MAXI_EN_REG, |
| 508 | .en_mask = BIT(25), |
| 509 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 510 | .halt_bit = 5, |
| 511 | }, |
| 512 | .c = { |
| 513 | .dbg_name = "jpegd_axi_clk", |
| 514 | .ops = &clk_ops_branch, |
| 515 | CLK_INIT(jpegd_axi_clk.c), |
| 516 | }, |
| 517 | }; |
| 518 | |
| 519 | static struct branch_clk mdp_axi_clk = { |
| 520 | .b = { |
| 521 | .ctl_reg = MAXI_EN_REG, |
| 522 | .en_mask = BIT(23), |
| 523 | .reset_reg = SW_RESET_AXI_REG, |
| 524 | .reset_mask = BIT(13), |
| 525 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 526 | .halt_bit = 8, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 527 | .retain_reg = MAXI_EN_REG, |
| 528 | .retain_mask = BIT(0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 529 | }, |
| 530 | .c = { |
| 531 | .dbg_name = "mdp_axi_clk", |
| 532 | .ops = &clk_ops_branch, |
| 533 | CLK_INIT(mdp_axi_clk.c), |
| 534 | }, |
| 535 | }; |
| 536 | |
| 537 | static struct branch_clk vcodec_axi_clk = { |
| 538 | .b = { |
| 539 | .ctl_reg = MAXI_EN_REG, |
| 540 | .en_mask = BIT(19), |
| 541 | .reset_reg = SW_RESET_AXI_REG, |
| 542 | .reset_mask = BIT(4)|BIT(5), |
| 543 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 544 | .halt_bit = 3, |
| 545 | }, |
| 546 | .c = { |
| 547 | .dbg_name = "vcodec_axi_clk", |
| 548 | .ops = &clk_ops_branch, |
| 549 | CLK_INIT(vcodec_axi_clk.c), |
| 550 | }, |
| 551 | }; |
| 552 | |
| 553 | static struct branch_clk vfe_axi_clk = { |
| 554 | .b = { |
| 555 | .ctl_reg = MAXI_EN_REG, |
| 556 | .en_mask = BIT(18), |
| 557 | .reset_reg = SW_RESET_AXI_REG, |
| 558 | .reset_mask = BIT(9), |
| 559 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 560 | .halt_bit = 0, |
| 561 | }, |
| 562 | .c = { |
| 563 | .dbg_name = "vfe_axi_clk", |
| 564 | .ops = &clk_ops_branch, |
| 565 | CLK_INIT(vfe_axi_clk.c), |
| 566 | }, |
| 567 | }; |
| 568 | |
| 569 | static struct branch_clk rot_axi_clk = { |
| 570 | .b = { |
Matt Wagantall | f63a889 | 2011-06-15 16:44:46 -0700 | [diff] [blame] | 571 | .ctl_reg = MAXI_EN2_REG, |
| 572 | .en_mask = BIT(24), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 573 | .reset_reg = SW_RESET_AXI_REG, |
| 574 | .reset_mask = BIT(6), |
Matt Wagantall | f63a889 | 2011-06-15 16:44:46 -0700 | [diff] [blame] | 575 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 576 | .halt_bit = 2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 577 | }, |
| 578 | .c = { |
| 579 | .dbg_name = "rot_axi_clk", |
Matt Wagantall | f63a889 | 2011-06-15 16:44:46 -0700 | [diff] [blame] | 580 | .ops = &clk_ops_branch, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 581 | CLK_INIT(rot_axi_clk.c), |
| 582 | }, |
| 583 | }; |
| 584 | |
| 585 | static struct branch_clk vpe_axi_clk = { |
| 586 | .b = { |
Matt Wagantall | f63a889 | 2011-06-15 16:44:46 -0700 | [diff] [blame] | 587 | .ctl_reg = MAXI_EN2_REG, |
| 588 | .en_mask = BIT(26), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 589 | .reset_reg = SW_RESET_AXI_REG, |
| 590 | .reset_mask = BIT(15), |
Matt Wagantall | f63a889 | 2011-06-15 16:44:46 -0700 | [diff] [blame] | 591 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 592 | .halt_bit = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 593 | }, |
| 594 | .c = { |
| 595 | .dbg_name = "vpe_axi_clk", |
Matt Wagantall | f63a889 | 2011-06-15 16:44:46 -0700 | [diff] [blame] | 596 | .ops = &clk_ops_branch, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 597 | CLK_INIT(vpe_axi_clk.c), |
| 598 | }, |
| 599 | }; |
| 600 | |
Matt Wagantall | f803260 | 2011-06-15 23:01:56 -0700 | [diff] [blame] | 601 | static struct branch_clk smi_2x_axi_clk = { |
| 602 | .b = { |
| 603 | .ctl_reg = MAXI_EN2_REG, |
| 604 | .en_mask = BIT(30), |
| 605 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 606 | .halt_bit = 0, |
| 607 | }, |
| 608 | .c = { |
| 609 | .dbg_name = "smi_2x_axi_clk", |
| 610 | .ops = &clk_ops_branch, |
Matt Wagantall | f803260 | 2011-06-15 23:01:56 -0700 | [diff] [blame] | 611 | CLK_INIT(smi_2x_axi_clk.c), |
| 612 | }, |
| 613 | }; |
| 614 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 615 | /* AHB Interfaces */ |
| 616 | static struct branch_clk amp_p_clk = { |
| 617 | .b = { |
| 618 | .ctl_reg = AHB_EN_REG, |
| 619 | .en_mask = BIT(24), |
Matt Wagantall | d40857a | 2012-04-10 19:15:43 -0700 | [diff] [blame] | 620 | .reset_reg = SW_RESET_CORE_REG, |
| 621 | .reset_mask = BIT(20), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 622 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 623 | .halt_bit = 18, |
| 624 | }, |
| 625 | .c = { |
| 626 | .dbg_name = "amp_p_clk", |
| 627 | .ops = &clk_ops_branch, |
| 628 | CLK_INIT(amp_p_clk.c), |
| 629 | }, |
| 630 | }; |
| 631 | |
| 632 | static struct branch_clk csi0_p_clk = { |
| 633 | .b = { |
| 634 | .ctl_reg = AHB_EN_REG, |
| 635 | .en_mask = BIT(7), |
| 636 | .reset_reg = SW_RESET_AHB_REG, |
| 637 | .reset_mask = BIT(17), |
| 638 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 639 | .halt_bit = 16, |
| 640 | }, |
| 641 | .c = { |
| 642 | .dbg_name = "csi0_p_clk", |
| 643 | .ops = &clk_ops_branch, |
| 644 | CLK_INIT(csi0_p_clk.c), |
| 645 | }, |
| 646 | }; |
| 647 | |
| 648 | static struct branch_clk csi1_p_clk = { |
| 649 | .b = { |
| 650 | .ctl_reg = AHB_EN_REG, |
| 651 | .en_mask = BIT(20), |
| 652 | .reset_reg = SW_RESET_AHB_REG, |
| 653 | .reset_mask = BIT(16), |
| 654 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 655 | .halt_bit = 17, |
| 656 | }, |
| 657 | .c = { |
| 658 | .dbg_name = "csi1_p_clk", |
| 659 | .ops = &clk_ops_branch, |
| 660 | CLK_INIT(csi1_p_clk.c), |
| 661 | }, |
| 662 | }; |
| 663 | |
| 664 | static struct branch_clk dsi_m_p_clk = { |
| 665 | .b = { |
| 666 | .ctl_reg = AHB_EN_REG, |
| 667 | .en_mask = BIT(9), |
| 668 | .reset_reg = SW_RESET_AHB_REG, |
| 669 | .reset_mask = BIT(6), |
| 670 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 671 | .halt_bit = 19, |
| 672 | }, |
| 673 | .c = { |
| 674 | .dbg_name = "dsi_m_p_clk", |
| 675 | .ops = &clk_ops_branch, |
| 676 | CLK_INIT(dsi_m_p_clk.c), |
| 677 | }, |
| 678 | }; |
| 679 | |
| 680 | static struct branch_clk dsi_s_p_clk = { |
| 681 | .b = { |
| 682 | .ctl_reg = AHB_EN_REG, |
| 683 | .en_mask = BIT(18), |
| 684 | .reset_reg = SW_RESET_AHB_REG, |
| 685 | .reset_mask = BIT(5), |
| 686 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 687 | .halt_bit = 20, |
| 688 | }, |
| 689 | .c = { |
| 690 | .dbg_name = "dsi_s_p_clk", |
| 691 | .ops = &clk_ops_branch, |
| 692 | CLK_INIT(dsi_s_p_clk.c), |
| 693 | }, |
| 694 | }; |
| 695 | |
| 696 | static struct branch_clk gfx2d0_p_clk = { |
| 697 | .b = { |
| 698 | .ctl_reg = AHB_EN_REG, |
| 699 | .en_mask = BIT(19), |
| 700 | .reset_reg = SW_RESET_AHB_REG, |
| 701 | .reset_mask = BIT(12), |
| 702 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 703 | .halt_bit = 2, |
| 704 | }, |
| 705 | .c = { |
| 706 | .dbg_name = "gfx2d0_p_clk", |
| 707 | .ops = &clk_ops_branch, |
Matt Wagantall | 158f73b | 2012-05-16 11:29:35 -0700 | [diff] [blame] | 708 | .flags = CLKFLAG_SKIP_HANDOFF, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 709 | CLK_INIT(gfx2d0_p_clk.c), |
| 710 | }, |
| 711 | }; |
| 712 | |
| 713 | static struct branch_clk gfx2d1_p_clk = { |
| 714 | .b = { |
| 715 | .ctl_reg = AHB_EN_REG, |
| 716 | .en_mask = BIT(2), |
| 717 | .reset_reg = SW_RESET_AHB_REG, |
| 718 | .reset_mask = BIT(11), |
| 719 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 720 | .halt_bit = 3, |
| 721 | }, |
| 722 | .c = { |
| 723 | .dbg_name = "gfx2d1_p_clk", |
| 724 | .ops = &clk_ops_branch, |
Matt Wagantall | 158f73b | 2012-05-16 11:29:35 -0700 | [diff] [blame] | 725 | .flags = CLKFLAG_SKIP_HANDOFF, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 726 | CLK_INIT(gfx2d1_p_clk.c), |
| 727 | }, |
| 728 | }; |
| 729 | |
| 730 | static struct branch_clk gfx3d_p_clk = { |
| 731 | .b = { |
| 732 | .ctl_reg = AHB_EN_REG, |
| 733 | .en_mask = BIT(3), |
| 734 | .reset_reg = SW_RESET_AHB_REG, |
| 735 | .reset_mask = BIT(10), |
| 736 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 737 | .halt_bit = 4, |
| 738 | }, |
| 739 | .c = { |
| 740 | .dbg_name = "gfx3d_p_clk", |
| 741 | .ops = &clk_ops_branch, |
| 742 | CLK_INIT(gfx3d_p_clk.c), |
| 743 | }, |
| 744 | }; |
| 745 | |
| 746 | static struct branch_clk hdmi_m_p_clk = { |
| 747 | .b = { |
| 748 | .ctl_reg = AHB_EN_REG, |
| 749 | .en_mask = BIT(14), |
| 750 | .reset_reg = SW_RESET_AHB_REG, |
| 751 | .reset_mask = BIT(9), |
| 752 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 753 | .halt_bit = 5, |
| 754 | }, |
| 755 | .c = { |
| 756 | .dbg_name = "hdmi_m_p_clk", |
| 757 | .ops = &clk_ops_branch, |
| 758 | CLK_INIT(hdmi_m_p_clk.c), |
| 759 | }, |
| 760 | }; |
| 761 | |
| 762 | static struct branch_clk hdmi_s_p_clk = { |
| 763 | .b = { |
| 764 | .ctl_reg = AHB_EN_REG, |
| 765 | .en_mask = BIT(4), |
| 766 | .reset_reg = SW_RESET_AHB_REG, |
| 767 | .reset_mask = BIT(9), |
| 768 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 769 | .halt_bit = 6, |
| 770 | }, |
| 771 | .c = { |
| 772 | .dbg_name = "hdmi_s_p_clk", |
| 773 | .ops = &clk_ops_branch, |
| 774 | CLK_INIT(hdmi_s_p_clk.c), |
| 775 | }, |
| 776 | }; |
| 777 | |
| 778 | static struct branch_clk ijpeg_p_clk = { |
| 779 | .b = { |
| 780 | .ctl_reg = AHB_EN_REG, |
| 781 | .en_mask = BIT(5), |
| 782 | .reset_reg = SW_RESET_AHB_REG, |
| 783 | .reset_mask = BIT(7), |
| 784 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 785 | .halt_bit = 9, |
| 786 | }, |
| 787 | .c = { |
| 788 | .dbg_name = "ijpeg_p_clk", |
| 789 | .ops = &clk_ops_branch, |
| 790 | CLK_INIT(ijpeg_p_clk.c), |
| 791 | }, |
| 792 | }; |
| 793 | |
| 794 | static struct branch_clk imem_p_clk = { |
| 795 | .b = { |
| 796 | .ctl_reg = AHB_EN_REG, |
| 797 | .en_mask = BIT(6), |
| 798 | .reset_reg = SW_RESET_AHB_REG, |
| 799 | .reset_mask = BIT(8), |
| 800 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 801 | .halt_bit = 10, |
| 802 | }, |
| 803 | .c = { |
| 804 | .dbg_name = "imem_p_clk", |
| 805 | .ops = &clk_ops_branch, |
| 806 | CLK_INIT(imem_p_clk.c), |
| 807 | }, |
| 808 | }; |
| 809 | |
| 810 | static struct branch_clk jpegd_p_clk = { |
| 811 | .b = { |
| 812 | .ctl_reg = AHB_EN_REG, |
| 813 | .en_mask = BIT(21), |
| 814 | .reset_reg = SW_RESET_AHB_REG, |
| 815 | .reset_mask = BIT(4), |
| 816 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 817 | .halt_bit = 7, |
| 818 | }, |
| 819 | .c = { |
| 820 | .dbg_name = "jpegd_p_clk", |
| 821 | .ops = &clk_ops_branch, |
| 822 | CLK_INIT(jpegd_p_clk.c), |
| 823 | }, |
| 824 | }; |
| 825 | |
| 826 | static struct branch_clk mdp_p_clk = { |
| 827 | .b = { |
| 828 | .ctl_reg = AHB_EN_REG, |
| 829 | .en_mask = BIT(10), |
| 830 | .reset_reg = SW_RESET_AHB_REG, |
| 831 | .reset_mask = BIT(3), |
| 832 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 833 | .halt_bit = 11, |
| 834 | }, |
| 835 | .c = { |
| 836 | .dbg_name = "mdp_p_clk", |
| 837 | .ops = &clk_ops_branch, |
| 838 | CLK_INIT(mdp_p_clk.c), |
| 839 | }, |
| 840 | }; |
| 841 | |
| 842 | static struct branch_clk rot_p_clk = { |
| 843 | .b = { |
| 844 | .ctl_reg = AHB_EN_REG, |
| 845 | .en_mask = BIT(12), |
| 846 | .reset_reg = SW_RESET_AHB_REG, |
| 847 | .reset_mask = BIT(2), |
| 848 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 849 | .halt_bit = 13, |
| 850 | }, |
| 851 | .c = { |
| 852 | .dbg_name = "rot_p_clk", |
| 853 | .ops = &clk_ops_branch, |
| 854 | CLK_INIT(rot_p_clk.c), |
| 855 | }, |
| 856 | }; |
| 857 | |
| 858 | static struct branch_clk smmu_p_clk = { |
| 859 | .b = { |
| 860 | .ctl_reg = AHB_EN_REG, |
| 861 | .en_mask = BIT(15), |
| 862 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 863 | .halt_bit = 22, |
| 864 | }, |
| 865 | .c = { |
| 866 | .dbg_name = "smmu_p_clk", |
| 867 | .ops = &clk_ops_branch, |
| 868 | CLK_INIT(smmu_p_clk.c), |
| 869 | }, |
| 870 | }; |
| 871 | |
| 872 | static struct branch_clk tv_enc_p_clk = { |
| 873 | .b = { |
| 874 | .ctl_reg = AHB_EN_REG, |
| 875 | .en_mask = BIT(25), |
| 876 | .reset_reg = SW_RESET_AHB_REG, |
| 877 | .reset_mask = BIT(15), |
| 878 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 879 | .halt_bit = 23, |
| 880 | }, |
| 881 | .c = { |
| 882 | .dbg_name = "tv_enc_p_clk", |
| 883 | .ops = &clk_ops_branch, |
| 884 | CLK_INIT(tv_enc_p_clk.c), |
| 885 | }, |
| 886 | }; |
| 887 | |
| 888 | static struct branch_clk vcodec_p_clk = { |
| 889 | .b = { |
| 890 | .ctl_reg = AHB_EN_REG, |
| 891 | .en_mask = BIT(11), |
| 892 | .reset_reg = SW_RESET_AHB_REG, |
| 893 | .reset_mask = BIT(1), |
| 894 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 895 | .halt_bit = 12, |
| 896 | }, |
| 897 | .c = { |
| 898 | .dbg_name = "vcodec_p_clk", |
| 899 | .ops = &clk_ops_branch, |
| 900 | CLK_INIT(vcodec_p_clk.c), |
| 901 | }, |
| 902 | }; |
| 903 | |
| 904 | static struct branch_clk vfe_p_clk = { |
| 905 | .b = { |
| 906 | .ctl_reg = AHB_EN_REG, |
| 907 | .en_mask = BIT(13), |
| 908 | .reset_reg = SW_RESET_AHB_REG, |
| 909 | .reset_mask = BIT(0), |
| 910 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 911 | .halt_bit = 14, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 912 | .retain_reg = AHB_EN2_REG, |
| 913 | .retain_mask = BIT(0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 914 | }, |
| 915 | .c = { |
| 916 | .dbg_name = "vfe_p_clk", |
| 917 | .ops = &clk_ops_branch, |
| 918 | CLK_INIT(vfe_p_clk.c), |
| 919 | }, |
| 920 | }; |
| 921 | |
| 922 | static struct branch_clk vpe_p_clk = { |
| 923 | .b = { |
| 924 | .ctl_reg = AHB_EN_REG, |
| 925 | .en_mask = BIT(16), |
| 926 | .reset_reg = SW_RESET_AHB_REG, |
| 927 | .reset_mask = BIT(14), |
| 928 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 929 | .halt_bit = 15, |
| 930 | }, |
| 931 | .c = { |
| 932 | .dbg_name = "vpe_p_clk", |
| 933 | .ops = &clk_ops_branch, |
| 934 | CLK_INIT(vpe_p_clk.c), |
| 935 | }, |
| 936 | }; |
| 937 | |
| 938 | /* |
| 939 | * Peripheral Clocks |
| 940 | */ |
Matt Wagantall | 7625a4c | 2011-11-01 16:17:53 -0700 | [diff] [blame] | 941 | #define CLK_GP(i, n, h_r, h_b) \ |
| 942 | struct rcg_clk i##_clk = { \ |
| 943 | .b = { \ |
| 944 | .ctl_reg = GPn_NS_REG(n), \ |
| 945 | .en_mask = BIT(9), \ |
| 946 | .halt_reg = h_r, \ |
| 947 | .halt_bit = h_b, \ |
| 948 | }, \ |
| 949 | .ns_reg = GPn_NS_REG(n), \ |
| 950 | .md_reg = GPn_MD_REG(n), \ |
| 951 | .root_en_mask = BIT(11), \ |
| 952 | .ns_mask = (BM(23, 16) | BM(6, 0)), \ |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 953 | .mnd_en_mask = BIT(8), \ |
Matt Wagantall | 7625a4c | 2011-11-01 16:17:53 -0700 | [diff] [blame] | 954 | .set_rate = set_rate_mnd, \ |
| 955 | .freq_tbl = clk_tbl_gp, \ |
| 956 | .current_freq = &rcg_dummy_freq, \ |
| 957 | .c = { \ |
| 958 | .dbg_name = #i "_clk", \ |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 959 | .ops = &clk_ops_rcg, \ |
Matt Wagantall | 7625a4c | 2011-11-01 16:17:53 -0700 | [diff] [blame] | 960 | VDD_DIG_FMAX_MAP1(LOW, 27000000), \ |
| 961 | CLK_INIT(i##_clk.c), \ |
| 962 | }, \ |
| 963 | } |
| 964 | #define F_GP(f, s, d, m, n) \ |
| 965 | { \ |
| 966 | .freq_hz = f, \ |
| 967 | .src_clk = &s##_clk.c, \ |
| 968 | .md_val = MD8(16, m, 0, n), \ |
| 969 | .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
Matt Wagantall | 7625a4c | 2011-11-01 16:17:53 -0700 | [diff] [blame] | 970 | } |
| 971 | static struct clk_freq_tbl clk_tbl_gp[] = { |
| 972 | F_GP( 0, gnd, 1, 0, 0), |
| 973 | F_GP( 9600000, cxo, 2, 0, 0), |
| 974 | F_GP( 13500000, pxo, 2, 0, 0), |
| 975 | F_GP( 19200000, cxo, 1, 0, 0), |
| 976 | F_GP( 27000000, pxo, 1, 0, 0), |
| 977 | F_END |
| 978 | }; |
| 979 | |
| 980 | static CLK_GP(gp0, 0, CLK_HALT_SFPB_MISC_STATE_REG, 7); |
| 981 | static CLK_GP(gp1, 1, CLK_HALT_SFPB_MISC_STATE_REG, 6); |
| 982 | static CLK_GP(gp2, 2, CLK_HALT_SFPB_MISC_STATE_REG, 5); |
| 983 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 984 | #define CLK_GSBI_UART(i, n, h_r, h_b) \ |
| 985 | struct rcg_clk i##_clk = { \ |
| 986 | .b = { \ |
| 987 | .ctl_reg = GSBIn_UART_APPS_NS_REG(n), \ |
| 988 | .en_mask = BIT(9), \ |
| 989 | .reset_reg = GSBIn_RESET_REG(n), \ |
| 990 | .reset_mask = BIT(0), \ |
| 991 | .halt_reg = h_r, \ |
| 992 | .halt_bit = h_b, \ |
| 993 | }, \ |
| 994 | .ns_reg = GSBIn_UART_APPS_NS_REG(n), \ |
| 995 | .md_reg = GSBIn_UART_APPS_MD_REG(n), \ |
| 996 | .root_en_mask = BIT(11), \ |
| 997 | .ns_mask = (BM(31, 16) | BM(6, 0)), \ |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 998 | .mnd_en_mask = BIT(8), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 999 | .set_rate = set_rate_mnd, \ |
| 1000 | .freq_tbl = clk_tbl_gsbi_uart, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1001 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1002 | .c = { \ |
| 1003 | .dbg_name = #i "_clk", \ |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 1004 | .ops = &clk_ops_rcg, \ |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1005 | VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1006 | CLK_INIT(i##_clk.c), \ |
| 1007 | }, \ |
| 1008 | } |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1009 | #define F_GSBI_UART(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1010 | { \ |
| 1011 | .freq_hz = f, \ |
| 1012 | .src_clk = &s##_clk.c, \ |
| 1013 | .md_val = MD16(m, n), \ |
| 1014 | .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1015 | } |
| 1016 | static struct clk_freq_tbl clk_tbl_gsbi_uart[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1017 | F_GSBI_UART( 0, gnd, 1, 0, 0), |
| 1018 | F_GSBI_UART( 1843200, pll8, 1, 3, 625), |
| 1019 | F_GSBI_UART( 3686400, pll8, 1, 6, 625), |
| 1020 | F_GSBI_UART( 7372800, pll8, 1, 12, 625), |
| 1021 | F_GSBI_UART(14745600, pll8, 1, 24, 625), |
| 1022 | F_GSBI_UART(16000000, pll8, 4, 1, 6), |
| 1023 | F_GSBI_UART(24000000, pll8, 4, 1, 4), |
| 1024 | F_GSBI_UART(32000000, pll8, 4, 1, 3), |
| 1025 | F_GSBI_UART(40000000, pll8, 1, 5, 48), |
| 1026 | F_GSBI_UART(46400000, pll8, 1, 29, 240), |
| 1027 | F_GSBI_UART(48000000, pll8, 4, 1, 2), |
| 1028 | F_GSBI_UART(51200000, pll8, 1, 2, 15), |
| 1029 | F_GSBI_UART(56000000, pll8, 1, 7, 48), |
| 1030 | F_GSBI_UART(58982400, pll8, 1, 96, 625), |
| 1031 | F_GSBI_UART(64000000, pll8, 2, 1, 3), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1032 | F_END |
| 1033 | }; |
| 1034 | |
| 1035 | static CLK_GSBI_UART(gsbi1_uart, 1, CLK_HALT_CFPB_STATEA_REG, 10); |
| 1036 | static CLK_GSBI_UART(gsbi2_uart, 2, CLK_HALT_CFPB_STATEA_REG, 6); |
| 1037 | static CLK_GSBI_UART(gsbi3_uart, 3, CLK_HALT_CFPB_STATEA_REG, 2); |
| 1038 | static CLK_GSBI_UART(gsbi4_uart, 4, CLK_HALT_CFPB_STATEB_REG, 26); |
| 1039 | static CLK_GSBI_UART(gsbi5_uart, 5, CLK_HALT_CFPB_STATEB_REG, 22); |
| 1040 | static CLK_GSBI_UART(gsbi6_uart, 6, CLK_HALT_CFPB_STATEB_REG, 18); |
| 1041 | static CLK_GSBI_UART(gsbi7_uart, 7, CLK_HALT_CFPB_STATEB_REG, 14); |
| 1042 | static CLK_GSBI_UART(gsbi8_uart, 8, CLK_HALT_CFPB_STATEB_REG, 10); |
| 1043 | static CLK_GSBI_UART(gsbi9_uart, 9, CLK_HALT_CFPB_STATEB_REG, 6); |
| 1044 | static CLK_GSBI_UART(gsbi10_uart, 10, CLK_HALT_CFPB_STATEB_REG, 2); |
| 1045 | static CLK_GSBI_UART(gsbi11_uart, 11, CLK_HALT_CFPB_STATEC_REG, 17); |
| 1046 | static CLK_GSBI_UART(gsbi12_uart, 12, CLK_HALT_CFPB_STATEC_REG, 13); |
| 1047 | |
| 1048 | #define CLK_GSBI_QUP(i, n, h_r, h_b) \ |
| 1049 | struct rcg_clk i##_clk = { \ |
| 1050 | .b = { \ |
| 1051 | .ctl_reg = GSBIn_QUP_APPS_NS_REG(n), \ |
| 1052 | .en_mask = BIT(9), \ |
| 1053 | .reset_reg = GSBIn_RESET_REG(n), \ |
| 1054 | .reset_mask = BIT(0), \ |
| 1055 | .halt_reg = h_r, \ |
| 1056 | .halt_bit = h_b, \ |
| 1057 | }, \ |
| 1058 | .ns_reg = GSBIn_QUP_APPS_NS_REG(n), \ |
| 1059 | .md_reg = GSBIn_QUP_APPS_MD_REG(n), \ |
| 1060 | .root_en_mask = BIT(11), \ |
| 1061 | .ns_mask = (BM(23, 16) | BM(6, 0)), \ |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 1062 | .mnd_en_mask = BIT(8), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1063 | .set_rate = set_rate_mnd, \ |
| 1064 | .freq_tbl = clk_tbl_gsbi_qup, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1065 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1066 | .c = { \ |
| 1067 | .dbg_name = #i "_clk", \ |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 1068 | .ops = &clk_ops_rcg, \ |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1069 | VDD_DIG_FMAX_MAP2(LOW, 24000000, NOMINAL, 52000000), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1070 | CLK_INIT(i##_clk.c), \ |
| 1071 | }, \ |
| 1072 | } |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1073 | #define F_GSBI_QUP(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1074 | { \ |
| 1075 | .freq_hz = f, \ |
| 1076 | .src_clk = &s##_clk.c, \ |
| 1077 | .md_val = MD8(16, m, 0, n), \ |
| 1078 | .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1079 | } |
| 1080 | static struct clk_freq_tbl clk_tbl_gsbi_qup[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1081 | F_GSBI_QUP( 0, gnd, 1, 0, 0), |
| 1082 | F_GSBI_QUP( 1100000, pxo, 1, 2, 49), |
| 1083 | F_GSBI_QUP( 5400000, pxo, 1, 1, 5), |
| 1084 | F_GSBI_QUP(10800000, pxo, 1, 2, 5), |
| 1085 | F_GSBI_QUP(15060000, pll8, 1, 2, 51), |
| 1086 | F_GSBI_QUP(24000000, pll8, 4, 1, 4), |
| 1087 | F_GSBI_QUP(25600000, pll8, 1, 1, 15), |
| 1088 | F_GSBI_QUP(27000000, pxo, 1, 0, 0), |
| 1089 | F_GSBI_QUP(48000000, pll8, 4, 1, 2), |
| 1090 | F_GSBI_QUP(51200000, pll8, 1, 2, 15), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1091 | F_END |
| 1092 | }; |
| 1093 | |
| 1094 | static CLK_GSBI_QUP(gsbi1_qup, 1, CLK_HALT_CFPB_STATEA_REG, 9); |
| 1095 | static CLK_GSBI_QUP(gsbi2_qup, 2, CLK_HALT_CFPB_STATEA_REG, 4); |
| 1096 | static CLK_GSBI_QUP(gsbi3_qup, 3, CLK_HALT_CFPB_STATEA_REG, 0); |
| 1097 | static CLK_GSBI_QUP(gsbi4_qup, 4, CLK_HALT_CFPB_STATEB_REG, 24); |
| 1098 | static CLK_GSBI_QUP(gsbi5_qup, 5, CLK_HALT_CFPB_STATEB_REG, 20); |
| 1099 | static CLK_GSBI_QUP(gsbi6_qup, 6, CLK_HALT_CFPB_STATEB_REG, 16); |
| 1100 | static CLK_GSBI_QUP(gsbi7_qup, 7, CLK_HALT_CFPB_STATEB_REG, 12); |
| 1101 | static CLK_GSBI_QUP(gsbi8_qup, 8, CLK_HALT_CFPB_STATEB_REG, 8); |
| 1102 | static CLK_GSBI_QUP(gsbi9_qup, 9, CLK_HALT_CFPB_STATEB_REG, 4); |
| 1103 | static CLK_GSBI_QUP(gsbi10_qup, 10, CLK_HALT_CFPB_STATEB_REG, 0); |
| 1104 | static CLK_GSBI_QUP(gsbi11_qup, 11, CLK_HALT_CFPB_STATEC_REG, 15); |
| 1105 | static CLK_GSBI_QUP(gsbi12_qup, 12, CLK_HALT_CFPB_STATEC_REG, 11); |
| 1106 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1107 | #define F_PDM(f, s, d) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1108 | { \ |
| 1109 | .freq_hz = f, \ |
| 1110 | .src_clk = &s##_clk.c, \ |
| 1111 | .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1112 | } |
| 1113 | static struct clk_freq_tbl clk_tbl_pdm[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1114 | F_PDM( 0, gnd, 1), |
| 1115 | F_PDM(27000000, pxo, 1), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1116 | F_END |
| 1117 | }; |
| 1118 | |
| 1119 | static struct rcg_clk pdm_clk = { |
| 1120 | .b = { |
| 1121 | .ctl_reg = PDM_CLK_NS_REG, |
| 1122 | .en_mask = BIT(9), |
| 1123 | .reset_reg = PDM_CLK_NS_REG, |
| 1124 | .reset_mask = BIT(12), |
| 1125 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1126 | .halt_bit = 3, |
| 1127 | }, |
| 1128 | .ns_reg = PDM_CLK_NS_REG, |
| 1129 | .root_en_mask = BIT(11), |
| 1130 | .ns_mask = BM(1, 0), |
| 1131 | .set_rate = set_rate_nop, |
| 1132 | .freq_tbl = clk_tbl_pdm, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1133 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1134 | .c = { |
| 1135 | .dbg_name = "pdm_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 1136 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1137 | VDD_DIG_FMAX_MAP1(LOW, 27000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1138 | CLK_INIT(pdm_clk.c), |
| 1139 | }, |
| 1140 | }; |
| 1141 | |
| 1142 | static struct branch_clk pmem_clk = { |
| 1143 | .b = { |
| 1144 | .ctl_reg = PMEM_ACLK_CTL_REG, |
| 1145 | .en_mask = BIT(4), |
| 1146 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1147 | .halt_bit = 20, |
| 1148 | }, |
| 1149 | .c = { |
| 1150 | .dbg_name = "pmem_clk", |
| 1151 | .ops = &clk_ops_branch, |
| 1152 | CLK_INIT(pmem_clk.c), |
| 1153 | }, |
| 1154 | }; |
| 1155 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1156 | #define F_PRNG(f, s) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1157 | { \ |
| 1158 | .freq_hz = f, \ |
| 1159 | .src_clk = &s##_clk.c, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1160 | } |
Stephen Boyd | 842a1f6 | 2012-04-26 19:07:38 -0700 | [diff] [blame] | 1161 | static struct clk_freq_tbl clk_tbl_prng_32[] = { |
| 1162 | F_PRNG(32000000, pll8), |
| 1163 | F_END |
| 1164 | }; |
| 1165 | |
| 1166 | static struct clk_freq_tbl clk_tbl_prng_64[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1167 | F_PRNG(64000000, pll8), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1168 | F_END |
| 1169 | }; |
| 1170 | |
| 1171 | static struct rcg_clk prng_clk = { |
| 1172 | .b = { |
| 1173 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1174 | .en_mask = BIT(10), |
| 1175 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 1176 | .halt_check = HALT_VOTED, |
| 1177 | .halt_bit = 10, |
| 1178 | }, |
| 1179 | .set_rate = set_rate_nop, |
Stephen Boyd | 842a1f6 | 2012-04-26 19:07:38 -0700 | [diff] [blame] | 1180 | .freq_tbl = clk_tbl_prng_32, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1181 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1182 | .c = { |
| 1183 | .dbg_name = "prng_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 1184 | .ops = &clk_ops_rcg, |
Stephen Boyd | 842a1f6 | 2012-04-26 19:07:38 -0700 | [diff] [blame] | 1185 | VDD_DIG_FMAX_MAP2(LOW, 32000000, NOMINAL, 64000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1186 | CLK_INIT(prng_clk.c), |
| 1187 | }, |
| 1188 | }; |
| 1189 | |
| 1190 | #define CLK_SDC(i, n, h_r, h_b) \ |
| 1191 | struct rcg_clk i##_clk = { \ |
| 1192 | .b = { \ |
| 1193 | .ctl_reg = SDCn_APPS_CLK_NS_REG(n), \ |
| 1194 | .en_mask = BIT(9), \ |
| 1195 | .reset_reg = SDCn_RESET_REG(n), \ |
| 1196 | .reset_mask = BIT(0), \ |
| 1197 | .halt_reg = h_r, \ |
| 1198 | .halt_bit = h_b, \ |
| 1199 | }, \ |
| 1200 | .ns_reg = SDCn_APPS_CLK_NS_REG(n), \ |
| 1201 | .md_reg = SDCn_APPS_CLK_MD_REG(n), \ |
| 1202 | .root_en_mask = BIT(11), \ |
| 1203 | .ns_mask = (BM(23, 16) | BM(6, 0)), \ |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 1204 | .mnd_en_mask = BIT(8), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1205 | .set_rate = set_rate_mnd, \ |
| 1206 | .freq_tbl = clk_tbl_sdc, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1207 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1208 | .c = { \ |
| 1209 | .dbg_name = #i "_clk", \ |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 1210 | .ops = &clk_ops_rcg, \ |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1211 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1212 | CLK_INIT(i##_clk.c), \ |
| 1213 | }, \ |
| 1214 | } |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1215 | #define F_SDC(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1216 | { \ |
| 1217 | .freq_hz = f, \ |
| 1218 | .src_clk = &s##_clk.c, \ |
| 1219 | .md_val = MD8(16, m, 0, n), \ |
| 1220 | .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1221 | } |
| 1222 | static struct clk_freq_tbl clk_tbl_sdc[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1223 | F_SDC( 0, gnd, 1, 0, 0), |
| 1224 | F_SDC( 144000, pxo, 3, 2, 125), |
| 1225 | F_SDC( 400000, pll8, 4, 1, 240), |
| 1226 | F_SDC(16000000, pll8, 4, 1, 6), |
| 1227 | F_SDC(17070000, pll8, 1, 2, 45), |
| 1228 | F_SDC(20210000, pll8, 1, 1, 19), |
| 1229 | F_SDC(24000000, pll8, 4, 1, 4), |
| 1230 | F_SDC(48000000, pll8, 4, 1, 2), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1231 | F_END |
| 1232 | }; |
| 1233 | |
| 1234 | static CLK_SDC(sdc1, 1, CLK_HALT_DFAB_STATE_REG, 6); |
| 1235 | static CLK_SDC(sdc2, 2, CLK_HALT_DFAB_STATE_REG, 5); |
| 1236 | static CLK_SDC(sdc3, 3, CLK_HALT_DFAB_STATE_REG, 4); |
| 1237 | static CLK_SDC(sdc4, 4, CLK_HALT_DFAB_STATE_REG, 3); |
| 1238 | static CLK_SDC(sdc5, 5, CLK_HALT_DFAB_STATE_REG, 2); |
| 1239 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1240 | #define F_TSIF_REF(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1241 | { \ |
| 1242 | .freq_hz = f, \ |
| 1243 | .src_clk = &s##_clk.c, \ |
| 1244 | .md_val = MD16(m, n), \ |
| 1245 | .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1246 | } |
| 1247 | static struct clk_freq_tbl clk_tbl_tsif_ref[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1248 | F_TSIF_REF( 0, gnd, 1, 0, 0), |
| 1249 | F_TSIF_REF(105000, pxo, 1, 1, 256), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1250 | F_END |
| 1251 | }; |
| 1252 | |
| 1253 | static struct rcg_clk tsif_ref_clk = { |
| 1254 | .b = { |
| 1255 | .ctl_reg = TSIF_REF_CLK_NS_REG, |
| 1256 | .en_mask = BIT(9), |
| 1257 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1258 | .halt_bit = 5, |
| 1259 | }, |
| 1260 | .ns_reg = TSIF_REF_CLK_NS_REG, |
| 1261 | .md_reg = TSIF_REF_CLK_MD_REG, |
| 1262 | .root_en_mask = BIT(11), |
| 1263 | .ns_mask = (BM(31, 16) | BM(6, 0)), |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 1264 | .mnd_en_mask = BIT(8), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1265 | .set_rate = set_rate_mnd, |
| 1266 | .freq_tbl = clk_tbl_tsif_ref, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1267 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1268 | .c = { |
| 1269 | .dbg_name = "tsif_ref_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 1270 | .ops = &clk_ops_rcg, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1271 | CLK_INIT(tsif_ref_clk.c), |
| 1272 | }, |
| 1273 | }; |
| 1274 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1275 | #define F_TSSC(f, s) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1276 | { \ |
| 1277 | .freq_hz = f, \ |
| 1278 | .src_clk = &s##_clk.c, \ |
| 1279 | .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1280 | } |
| 1281 | static struct clk_freq_tbl clk_tbl_tssc[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1282 | F_TSSC( 0, gnd), |
| 1283 | F_TSSC(27000000, pxo), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1284 | F_END |
| 1285 | }; |
| 1286 | |
| 1287 | static struct rcg_clk tssc_clk = { |
| 1288 | .b = { |
| 1289 | .ctl_reg = TSSC_CLK_CTL_REG, |
| 1290 | .en_mask = BIT(4), |
| 1291 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1292 | .halt_bit = 4, |
| 1293 | }, |
| 1294 | .ns_reg = TSSC_CLK_CTL_REG, |
| 1295 | .ns_mask = BM(1, 0), |
| 1296 | .set_rate = set_rate_nop, |
| 1297 | .freq_tbl = clk_tbl_tssc, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1298 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1299 | .c = { |
| 1300 | .dbg_name = "tssc_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 1301 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1302 | VDD_DIG_FMAX_MAP1(LOW, 27000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1303 | CLK_INIT(tssc_clk.c), |
| 1304 | }, |
| 1305 | }; |
| 1306 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1307 | #define F_USB(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1308 | { \ |
| 1309 | .freq_hz = f, \ |
| 1310 | .src_clk = &s##_clk.c, \ |
| 1311 | .md_val = MD8(16, m, 0, n), \ |
| 1312 | .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1313 | } |
| 1314 | static struct clk_freq_tbl clk_tbl_usb[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1315 | F_USB( 0, gnd, 1, 0, 0), |
| 1316 | F_USB(60000000, pll8, 1, 5, 32), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1317 | F_END |
| 1318 | }; |
| 1319 | |
| 1320 | static struct rcg_clk usb_hs1_xcvr_clk = { |
| 1321 | .b = { |
| 1322 | .ctl_reg = USB_HS1_XCVR_FS_CLK_NS_REG, |
| 1323 | .en_mask = BIT(9), |
| 1324 | .reset_reg = USB_HS1_RESET_REG, |
| 1325 | .reset_mask = BIT(0), |
| 1326 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1327 | .halt_bit = 0, |
| 1328 | }, |
| 1329 | .ns_reg = USB_HS1_XCVR_FS_CLK_NS_REG, |
| 1330 | .md_reg = USB_HS1_XCVR_FS_CLK_MD_REG, |
| 1331 | .root_en_mask = BIT(11), |
| 1332 | .ns_mask = (BM(23, 16) | BM(6, 0)), |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 1333 | .mnd_en_mask = BIT(8), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1334 | .set_rate = set_rate_mnd, |
| 1335 | .freq_tbl = clk_tbl_usb, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1336 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1337 | .c = { |
| 1338 | .dbg_name = "usb_hs1_xcvr_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 1339 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1340 | VDD_DIG_FMAX_MAP1(NOMINAL, 60000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1341 | CLK_INIT(usb_hs1_xcvr_clk.c), |
| 1342 | }, |
| 1343 | }; |
| 1344 | |
| 1345 | static struct branch_clk usb_phy0_clk = { |
| 1346 | .b = { |
| 1347 | .reset_reg = USB_PHY0_RESET_REG, |
| 1348 | .reset_mask = BIT(0), |
| 1349 | }, |
| 1350 | .c = { |
| 1351 | .dbg_name = "usb_phy0_clk", |
| 1352 | .ops = &clk_ops_reset, |
| 1353 | CLK_INIT(usb_phy0_clk.c), |
| 1354 | }, |
| 1355 | }; |
| 1356 | |
| 1357 | #define CLK_USB_FS(i, n) \ |
| 1358 | struct rcg_clk i##_clk = { \ |
| 1359 | .ns_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \ |
| 1360 | .b = { \ |
| 1361 | .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \ |
| 1362 | .halt_check = NOCHECK, \ |
| 1363 | }, \ |
| 1364 | .md_reg = USB_FSn_XCVR_FS_CLK_MD_REG(n), \ |
| 1365 | .root_en_mask = BIT(11), \ |
| 1366 | .ns_mask = (BM(23, 16) | BM(6, 0)), \ |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 1367 | .mnd_en_mask = BIT(8), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1368 | .set_rate = set_rate_mnd, \ |
| 1369 | .freq_tbl = clk_tbl_usb, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1370 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1371 | .c = { \ |
| 1372 | .dbg_name = #i "_clk", \ |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 1373 | .ops = &clk_ops_rcg, \ |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1374 | VDD_DIG_FMAX_MAP1(NOMINAL, 60000000), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1375 | CLK_INIT(i##_clk.c), \ |
| 1376 | }, \ |
| 1377 | } |
| 1378 | |
| 1379 | static CLK_USB_FS(usb_fs1_src, 1); |
| 1380 | static struct branch_clk usb_fs1_xcvr_clk = { |
| 1381 | .b = { |
| 1382 | .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(1), |
| 1383 | .en_mask = BIT(9), |
| 1384 | .reset_reg = USB_FSn_RESET_REG(1), |
| 1385 | .reset_mask = BIT(1), |
| 1386 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1387 | .halt_bit = 15, |
| 1388 | }, |
| 1389 | .parent = &usb_fs1_src_clk.c, |
| 1390 | .c = { |
| 1391 | .dbg_name = "usb_fs1_xcvr_clk", |
| 1392 | .ops = &clk_ops_branch, |
| 1393 | CLK_INIT(usb_fs1_xcvr_clk.c), |
| 1394 | }, |
| 1395 | }; |
| 1396 | |
| 1397 | static struct branch_clk usb_fs1_sys_clk = { |
| 1398 | .b = { |
| 1399 | .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(1), |
| 1400 | .en_mask = BIT(4), |
| 1401 | .reset_reg = USB_FSn_RESET_REG(1), |
| 1402 | .reset_mask = BIT(0), |
| 1403 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1404 | .halt_bit = 16, |
| 1405 | }, |
| 1406 | .parent = &usb_fs1_src_clk.c, |
| 1407 | .c = { |
| 1408 | .dbg_name = "usb_fs1_sys_clk", |
| 1409 | .ops = &clk_ops_branch, |
| 1410 | CLK_INIT(usb_fs1_sys_clk.c), |
| 1411 | }, |
| 1412 | }; |
| 1413 | |
| 1414 | static CLK_USB_FS(usb_fs2_src, 2); |
| 1415 | static struct branch_clk usb_fs2_xcvr_clk = { |
| 1416 | .b = { |
| 1417 | .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(2), |
| 1418 | .en_mask = BIT(9), |
| 1419 | .reset_reg = USB_FSn_RESET_REG(2), |
| 1420 | .reset_mask = BIT(1), |
| 1421 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1422 | .halt_bit = 12, |
| 1423 | }, |
| 1424 | .parent = &usb_fs2_src_clk.c, |
| 1425 | .c = { |
| 1426 | .dbg_name = "usb_fs2_xcvr_clk", |
| 1427 | .ops = &clk_ops_branch, |
| 1428 | CLK_INIT(usb_fs2_xcvr_clk.c), |
| 1429 | }, |
| 1430 | }; |
| 1431 | |
| 1432 | static struct branch_clk usb_fs2_sys_clk = { |
| 1433 | .b = { |
| 1434 | .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(2), |
| 1435 | .en_mask = BIT(4), |
| 1436 | .reset_reg = USB_FSn_RESET_REG(2), |
| 1437 | .reset_mask = BIT(0), |
| 1438 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1439 | .halt_bit = 13, |
| 1440 | }, |
| 1441 | .parent = &usb_fs2_src_clk.c, |
| 1442 | .c = { |
| 1443 | .dbg_name = "usb_fs2_sys_clk", |
| 1444 | .ops = &clk_ops_branch, |
| 1445 | CLK_INIT(usb_fs2_sys_clk.c), |
| 1446 | }, |
| 1447 | }; |
| 1448 | |
| 1449 | /* Fast Peripheral Bus Clocks */ |
| 1450 | static struct branch_clk ce2_p_clk = { |
| 1451 | .b = { |
| 1452 | .ctl_reg = CE2_HCLK_CTL_REG, |
| 1453 | .en_mask = BIT(4), |
| 1454 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1455 | .halt_bit = 0, |
| 1456 | }, |
| 1457 | .parent = &pxo_clk.c, |
| 1458 | .c = { |
| 1459 | .dbg_name = "ce2_p_clk", |
| 1460 | .ops = &clk_ops_branch, |
| 1461 | CLK_INIT(ce2_p_clk.c), |
| 1462 | }, |
| 1463 | }; |
| 1464 | |
| 1465 | static struct branch_clk gsbi1_p_clk = { |
| 1466 | .b = { |
| 1467 | .ctl_reg = GSBIn_HCLK_CTL_REG(1), |
| 1468 | .en_mask = BIT(4), |
| 1469 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1470 | .halt_bit = 11, |
| 1471 | }, |
| 1472 | .c = { |
| 1473 | .dbg_name = "gsbi1_p_clk", |
| 1474 | .ops = &clk_ops_branch, |
| 1475 | CLK_INIT(gsbi1_p_clk.c), |
| 1476 | }, |
| 1477 | }; |
| 1478 | |
| 1479 | static struct branch_clk gsbi2_p_clk = { |
| 1480 | .b = { |
| 1481 | .ctl_reg = GSBIn_HCLK_CTL_REG(2), |
| 1482 | .en_mask = BIT(4), |
| 1483 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1484 | .halt_bit = 7, |
| 1485 | }, |
| 1486 | .c = { |
| 1487 | .dbg_name = "gsbi2_p_clk", |
| 1488 | .ops = &clk_ops_branch, |
| 1489 | CLK_INIT(gsbi2_p_clk.c), |
| 1490 | }, |
| 1491 | }; |
| 1492 | |
| 1493 | static struct branch_clk gsbi3_p_clk = { |
| 1494 | .b = { |
| 1495 | .ctl_reg = GSBIn_HCLK_CTL_REG(3), |
| 1496 | .en_mask = BIT(4), |
| 1497 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1498 | .halt_bit = 3, |
| 1499 | }, |
| 1500 | .c = { |
| 1501 | .dbg_name = "gsbi3_p_clk", |
| 1502 | .ops = &clk_ops_branch, |
| 1503 | CLK_INIT(gsbi3_p_clk.c), |
| 1504 | }, |
| 1505 | }; |
| 1506 | |
| 1507 | static struct branch_clk gsbi4_p_clk = { |
| 1508 | .b = { |
| 1509 | .ctl_reg = GSBIn_HCLK_CTL_REG(4), |
| 1510 | .en_mask = BIT(4), |
| 1511 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 1512 | .halt_bit = 27, |
| 1513 | }, |
| 1514 | .c = { |
| 1515 | .dbg_name = "gsbi4_p_clk", |
| 1516 | .ops = &clk_ops_branch, |
| 1517 | CLK_INIT(gsbi4_p_clk.c), |
| 1518 | }, |
| 1519 | }; |
| 1520 | |
| 1521 | static struct branch_clk gsbi5_p_clk = { |
| 1522 | .b = { |
| 1523 | .ctl_reg = GSBIn_HCLK_CTL_REG(5), |
| 1524 | .en_mask = BIT(4), |
| 1525 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 1526 | .halt_bit = 23, |
| 1527 | }, |
| 1528 | .c = { |
| 1529 | .dbg_name = "gsbi5_p_clk", |
| 1530 | .ops = &clk_ops_branch, |
| 1531 | CLK_INIT(gsbi5_p_clk.c), |
| 1532 | }, |
| 1533 | }; |
| 1534 | |
| 1535 | static struct branch_clk gsbi6_p_clk = { |
| 1536 | .b = { |
| 1537 | .ctl_reg = GSBIn_HCLK_CTL_REG(6), |
| 1538 | .en_mask = BIT(4), |
| 1539 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 1540 | .halt_bit = 19, |
| 1541 | }, |
| 1542 | .c = { |
| 1543 | .dbg_name = "gsbi6_p_clk", |
| 1544 | .ops = &clk_ops_branch, |
| 1545 | CLK_INIT(gsbi6_p_clk.c), |
| 1546 | }, |
| 1547 | }; |
| 1548 | |
| 1549 | static struct branch_clk gsbi7_p_clk = { |
| 1550 | .b = { |
| 1551 | .ctl_reg = GSBIn_HCLK_CTL_REG(7), |
| 1552 | .en_mask = BIT(4), |
| 1553 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 1554 | .halt_bit = 15, |
| 1555 | }, |
| 1556 | .c = { |
| 1557 | .dbg_name = "gsbi7_p_clk", |
| 1558 | .ops = &clk_ops_branch, |
| 1559 | CLK_INIT(gsbi7_p_clk.c), |
| 1560 | }, |
| 1561 | }; |
| 1562 | |
| 1563 | static struct branch_clk gsbi8_p_clk = { |
| 1564 | .b = { |
| 1565 | .ctl_reg = GSBIn_HCLK_CTL_REG(8), |
| 1566 | .en_mask = BIT(4), |
| 1567 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 1568 | .halt_bit = 11, |
| 1569 | }, |
| 1570 | .c = { |
| 1571 | .dbg_name = "gsbi8_p_clk", |
| 1572 | .ops = &clk_ops_branch, |
| 1573 | CLK_INIT(gsbi8_p_clk.c), |
| 1574 | }, |
| 1575 | }; |
| 1576 | |
| 1577 | static struct branch_clk gsbi9_p_clk = { |
| 1578 | .b = { |
| 1579 | .ctl_reg = GSBIn_HCLK_CTL_REG(9), |
| 1580 | .en_mask = BIT(4), |
| 1581 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 1582 | .halt_bit = 7, |
| 1583 | }, |
| 1584 | .c = { |
| 1585 | .dbg_name = "gsbi9_p_clk", |
| 1586 | .ops = &clk_ops_branch, |
| 1587 | CLK_INIT(gsbi9_p_clk.c), |
| 1588 | }, |
| 1589 | }; |
| 1590 | |
| 1591 | static struct branch_clk gsbi10_p_clk = { |
| 1592 | .b = { |
| 1593 | .ctl_reg = GSBIn_HCLK_CTL_REG(10), |
| 1594 | .en_mask = BIT(4), |
| 1595 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 1596 | .halt_bit = 3, |
| 1597 | }, |
| 1598 | .c = { |
| 1599 | .dbg_name = "gsbi10_p_clk", |
| 1600 | .ops = &clk_ops_branch, |
| 1601 | CLK_INIT(gsbi10_p_clk.c), |
| 1602 | }, |
| 1603 | }; |
| 1604 | |
| 1605 | static struct branch_clk gsbi11_p_clk = { |
| 1606 | .b = { |
| 1607 | .ctl_reg = GSBIn_HCLK_CTL_REG(11), |
| 1608 | .en_mask = BIT(4), |
| 1609 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1610 | .halt_bit = 18, |
| 1611 | }, |
| 1612 | .c = { |
| 1613 | .dbg_name = "gsbi11_p_clk", |
| 1614 | .ops = &clk_ops_branch, |
| 1615 | CLK_INIT(gsbi11_p_clk.c), |
| 1616 | }, |
| 1617 | }; |
| 1618 | |
| 1619 | static struct branch_clk gsbi12_p_clk = { |
| 1620 | .b = { |
| 1621 | .ctl_reg = GSBIn_HCLK_CTL_REG(12), |
| 1622 | .en_mask = BIT(4), |
| 1623 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1624 | .halt_bit = 14, |
| 1625 | }, |
| 1626 | .c = { |
| 1627 | .dbg_name = "gsbi12_p_clk", |
| 1628 | .ops = &clk_ops_branch, |
| 1629 | CLK_INIT(gsbi12_p_clk.c), |
| 1630 | }, |
| 1631 | }; |
| 1632 | |
| 1633 | static struct branch_clk ppss_p_clk = { |
| 1634 | .b = { |
| 1635 | .ctl_reg = PPSS_HCLK_CTL_REG, |
| 1636 | .en_mask = BIT(4), |
| 1637 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1638 | .halt_bit = 19, |
| 1639 | }, |
| 1640 | .c = { |
| 1641 | .dbg_name = "ppss_p_clk", |
| 1642 | .ops = &clk_ops_branch, |
| 1643 | CLK_INIT(ppss_p_clk.c), |
| 1644 | }, |
| 1645 | }; |
| 1646 | |
| 1647 | static struct branch_clk tsif_p_clk = { |
| 1648 | .b = { |
| 1649 | .ctl_reg = TSIF_HCLK_CTL_REG, |
| 1650 | .en_mask = BIT(4), |
| 1651 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1652 | .halt_bit = 7, |
| 1653 | }, |
| 1654 | .c = { |
| 1655 | .dbg_name = "tsif_p_clk", |
| 1656 | .ops = &clk_ops_branch, |
| 1657 | CLK_INIT(tsif_p_clk.c), |
| 1658 | }, |
| 1659 | }; |
| 1660 | |
| 1661 | static struct branch_clk usb_fs1_p_clk = { |
| 1662 | .b = { |
| 1663 | .ctl_reg = USB_FSn_HCLK_CTL_REG(1), |
| 1664 | .en_mask = BIT(4), |
| 1665 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1666 | .halt_bit = 17, |
| 1667 | }, |
| 1668 | .c = { |
| 1669 | .dbg_name = "usb_fs1_p_clk", |
| 1670 | .ops = &clk_ops_branch, |
| 1671 | CLK_INIT(usb_fs1_p_clk.c), |
| 1672 | }, |
| 1673 | }; |
| 1674 | |
| 1675 | static struct branch_clk usb_fs2_p_clk = { |
| 1676 | .b = { |
| 1677 | .ctl_reg = USB_FSn_HCLK_CTL_REG(2), |
| 1678 | .en_mask = BIT(4), |
| 1679 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1680 | .halt_bit = 14, |
| 1681 | }, |
| 1682 | .c = { |
| 1683 | .dbg_name = "usb_fs2_p_clk", |
| 1684 | .ops = &clk_ops_branch, |
| 1685 | CLK_INIT(usb_fs2_p_clk.c), |
| 1686 | }, |
| 1687 | }; |
| 1688 | |
| 1689 | static struct branch_clk usb_hs1_p_clk = { |
| 1690 | .b = { |
| 1691 | .ctl_reg = USB_HS1_HCLK_CTL_REG, |
| 1692 | .en_mask = BIT(4), |
| 1693 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1694 | .halt_bit = 1, |
| 1695 | }, |
| 1696 | .c = { |
| 1697 | .dbg_name = "usb_hs1_p_clk", |
| 1698 | .ops = &clk_ops_branch, |
| 1699 | CLK_INIT(usb_hs1_p_clk.c), |
| 1700 | }, |
| 1701 | }; |
| 1702 | |
| 1703 | static struct branch_clk sdc1_p_clk = { |
| 1704 | .b = { |
| 1705 | .ctl_reg = SDCn_HCLK_CTL_REG(1), |
| 1706 | .en_mask = BIT(4), |
| 1707 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1708 | .halt_bit = 11, |
| 1709 | }, |
| 1710 | .c = { |
| 1711 | .dbg_name = "sdc1_p_clk", |
| 1712 | .ops = &clk_ops_branch, |
| 1713 | CLK_INIT(sdc1_p_clk.c), |
| 1714 | }, |
| 1715 | }; |
| 1716 | |
| 1717 | static struct branch_clk sdc2_p_clk = { |
| 1718 | .b = { |
| 1719 | .ctl_reg = SDCn_HCLK_CTL_REG(2), |
| 1720 | .en_mask = BIT(4), |
| 1721 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1722 | .halt_bit = 10, |
| 1723 | }, |
| 1724 | .c = { |
| 1725 | .dbg_name = "sdc2_p_clk", |
| 1726 | .ops = &clk_ops_branch, |
| 1727 | CLK_INIT(sdc2_p_clk.c), |
| 1728 | }, |
| 1729 | }; |
| 1730 | |
| 1731 | static struct branch_clk sdc3_p_clk = { |
| 1732 | .b = { |
| 1733 | .ctl_reg = SDCn_HCLK_CTL_REG(3), |
| 1734 | .en_mask = BIT(4), |
| 1735 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1736 | .halt_bit = 9, |
| 1737 | }, |
| 1738 | .c = { |
| 1739 | .dbg_name = "sdc3_p_clk", |
| 1740 | .ops = &clk_ops_branch, |
| 1741 | CLK_INIT(sdc3_p_clk.c), |
| 1742 | }, |
| 1743 | }; |
| 1744 | |
| 1745 | static struct branch_clk sdc4_p_clk = { |
| 1746 | .b = { |
| 1747 | .ctl_reg = SDCn_HCLK_CTL_REG(4), |
| 1748 | .en_mask = BIT(4), |
| 1749 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1750 | .halt_bit = 8, |
| 1751 | }, |
| 1752 | .c = { |
| 1753 | .dbg_name = "sdc4_p_clk", |
| 1754 | .ops = &clk_ops_branch, |
| 1755 | CLK_INIT(sdc4_p_clk.c), |
| 1756 | }, |
| 1757 | }; |
| 1758 | |
| 1759 | static struct branch_clk sdc5_p_clk = { |
| 1760 | .b = { |
| 1761 | .ctl_reg = SDCn_HCLK_CTL_REG(5), |
| 1762 | .en_mask = BIT(4), |
| 1763 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1764 | .halt_bit = 7, |
| 1765 | }, |
| 1766 | .c = { |
| 1767 | .dbg_name = "sdc5_p_clk", |
| 1768 | .ops = &clk_ops_branch, |
| 1769 | CLK_INIT(sdc5_p_clk.c), |
| 1770 | }, |
| 1771 | }; |
| 1772 | |
Matt Wagantall | 66cd093 | 2011-09-12 19:04:34 -0700 | [diff] [blame] | 1773 | static struct branch_clk ebi2_2x_clk = { |
| 1774 | .b = { |
| 1775 | .ctl_reg = EBI2_2X_CLK_CTL_REG, |
| 1776 | .en_mask = BIT(4), |
| 1777 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1778 | .halt_bit = 18, |
| 1779 | }, |
| 1780 | .c = { |
| 1781 | .dbg_name = "ebi2_2x_clk", |
| 1782 | .ops = &clk_ops_branch, |
| 1783 | CLK_INIT(ebi2_2x_clk.c), |
| 1784 | }, |
| 1785 | }; |
| 1786 | |
| 1787 | static struct branch_clk ebi2_clk = { |
| 1788 | .b = { |
| 1789 | .ctl_reg = EBI2_CLK_CTL_REG, |
| 1790 | .en_mask = BIT(4), |
| 1791 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1792 | .halt_bit = 19, |
| 1793 | }, |
| 1794 | .c = { |
| 1795 | .dbg_name = "ebi2_clk", |
| 1796 | .ops = &clk_ops_branch, |
| 1797 | CLK_INIT(ebi2_clk.c), |
| 1798 | .depends = &ebi2_2x_clk.c, |
| 1799 | }, |
| 1800 | }; |
| 1801 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1802 | /* HW-Voteable Clocks */ |
| 1803 | static struct branch_clk adm0_clk = { |
| 1804 | .b = { |
| 1805 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1806 | .en_mask = BIT(2), |
| 1807 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 1808 | .halt_check = HALT_VOTED, |
| 1809 | .halt_bit = 14, |
| 1810 | }, |
| 1811 | .parent = &pxo_clk.c, |
| 1812 | .c = { |
| 1813 | .dbg_name = "adm0_clk", |
| 1814 | .ops = &clk_ops_branch, |
| 1815 | CLK_INIT(adm0_clk.c), |
| 1816 | }, |
| 1817 | }; |
| 1818 | |
| 1819 | static struct branch_clk adm0_p_clk = { |
| 1820 | .b = { |
| 1821 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1822 | .en_mask = BIT(3), |
| 1823 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 1824 | .halt_check = HALT_VOTED, |
| 1825 | .halt_bit = 13, |
| 1826 | }, |
| 1827 | .c = { |
| 1828 | .dbg_name = "adm0_p_clk", |
| 1829 | .ops = &clk_ops_branch, |
| 1830 | CLK_INIT(adm0_p_clk.c), |
| 1831 | }, |
| 1832 | }; |
| 1833 | |
| 1834 | static struct branch_clk adm1_clk = { |
| 1835 | .b = { |
| 1836 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1837 | .en_mask = BIT(4), |
| 1838 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 1839 | .halt_check = HALT_VOTED, |
| 1840 | .halt_bit = 12, |
| 1841 | }, |
| 1842 | .parent = &pxo_clk.c, |
| 1843 | .c = { |
| 1844 | .dbg_name = "adm1_clk", |
| 1845 | .ops = &clk_ops_branch, |
| 1846 | CLK_INIT(adm1_clk.c), |
| 1847 | }, |
| 1848 | }; |
| 1849 | |
| 1850 | static struct branch_clk adm1_p_clk = { |
| 1851 | .b = { |
| 1852 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1853 | .en_mask = BIT(5), |
| 1854 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 1855 | .halt_check = HALT_VOTED, |
| 1856 | .halt_bit = 11, |
| 1857 | }, |
| 1858 | .c = { |
| 1859 | .dbg_name = "adm1_p_clk", |
| 1860 | .ops = &clk_ops_branch, |
| 1861 | CLK_INIT(adm1_p_clk.c), |
| 1862 | }, |
| 1863 | }; |
| 1864 | |
| 1865 | static struct branch_clk modem_ahb1_p_clk = { |
| 1866 | .b = { |
| 1867 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1868 | .en_mask = BIT(0), |
| 1869 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 1870 | .halt_check = HALT_VOTED, |
| 1871 | .halt_bit = 8, |
| 1872 | }, |
| 1873 | .c = { |
| 1874 | .dbg_name = "modem_ahb1_p_clk", |
| 1875 | .ops = &clk_ops_branch, |
| 1876 | CLK_INIT(modem_ahb1_p_clk.c), |
| 1877 | }, |
| 1878 | }; |
| 1879 | |
| 1880 | static struct branch_clk modem_ahb2_p_clk = { |
| 1881 | .b = { |
| 1882 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1883 | .en_mask = BIT(1), |
| 1884 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 1885 | .halt_check = HALT_VOTED, |
| 1886 | .halt_bit = 7, |
| 1887 | }, |
| 1888 | .c = { |
| 1889 | .dbg_name = "modem_ahb2_p_clk", |
| 1890 | .ops = &clk_ops_branch, |
| 1891 | CLK_INIT(modem_ahb2_p_clk.c), |
| 1892 | }, |
| 1893 | }; |
| 1894 | |
| 1895 | static struct branch_clk pmic_arb0_p_clk = { |
| 1896 | .b = { |
| 1897 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1898 | .en_mask = BIT(8), |
| 1899 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 1900 | .halt_check = HALT_VOTED, |
| 1901 | .halt_bit = 22, |
| 1902 | }, |
| 1903 | .c = { |
| 1904 | .dbg_name = "pmic_arb0_p_clk", |
| 1905 | .ops = &clk_ops_branch, |
| 1906 | CLK_INIT(pmic_arb0_p_clk.c), |
| 1907 | }, |
| 1908 | }; |
| 1909 | |
| 1910 | static struct branch_clk pmic_arb1_p_clk = { |
| 1911 | .b = { |
| 1912 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1913 | .en_mask = BIT(9), |
| 1914 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 1915 | .halt_check = HALT_VOTED, |
| 1916 | .halt_bit = 21, |
| 1917 | }, |
| 1918 | .c = { |
| 1919 | .dbg_name = "pmic_arb1_p_clk", |
| 1920 | .ops = &clk_ops_branch, |
| 1921 | CLK_INIT(pmic_arb1_p_clk.c), |
| 1922 | }, |
| 1923 | }; |
| 1924 | |
| 1925 | static struct branch_clk pmic_ssbi2_clk = { |
| 1926 | .b = { |
| 1927 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1928 | .en_mask = BIT(7), |
| 1929 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 1930 | .halt_check = HALT_VOTED, |
| 1931 | .halt_bit = 23, |
| 1932 | }, |
| 1933 | .c = { |
| 1934 | .dbg_name = "pmic_ssbi2_clk", |
| 1935 | .ops = &clk_ops_branch, |
| 1936 | CLK_INIT(pmic_ssbi2_clk.c), |
| 1937 | }, |
| 1938 | }; |
| 1939 | |
| 1940 | static struct branch_clk rpm_msg_ram_p_clk = { |
| 1941 | .b = { |
| 1942 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1943 | .en_mask = BIT(6), |
| 1944 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 1945 | .halt_check = HALT_VOTED, |
| 1946 | .halt_bit = 12, |
| 1947 | }, |
| 1948 | .c = { |
| 1949 | .dbg_name = "rpm_msg_ram_p_clk", |
| 1950 | .ops = &clk_ops_branch, |
| 1951 | CLK_INIT(rpm_msg_ram_p_clk.c), |
| 1952 | }, |
| 1953 | }; |
| 1954 | |
| 1955 | /* |
| 1956 | * Multimedia Clocks |
| 1957 | */ |
| 1958 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1959 | #define F_CAM(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1960 | { \ |
| 1961 | .freq_hz = f, \ |
| 1962 | .src_clk = &s##_clk.c, \ |
| 1963 | .md_val = MD8(8, m, 0, n), \ |
| 1964 | .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \ |
| 1965 | .ctl_val = CC(6, n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1966 | } |
| 1967 | static struct clk_freq_tbl clk_tbl_cam[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1968 | F_CAM( 0, gnd, 1, 0, 0), |
| 1969 | F_CAM( 6000000, pll8, 4, 1, 16), |
| 1970 | F_CAM( 8000000, pll8, 4, 1, 12), |
| 1971 | F_CAM( 12000000, pll8, 4, 1, 8), |
| 1972 | F_CAM( 16000000, pll8, 4, 1, 6), |
| 1973 | F_CAM( 19200000, pll8, 4, 1, 5), |
| 1974 | F_CAM( 24000000, pll8, 4, 1, 4), |
| 1975 | F_CAM( 32000000, pll8, 4, 1, 3), |
| 1976 | F_CAM( 48000000, pll8, 4, 1, 2), |
| 1977 | F_CAM( 64000000, pll8, 3, 1, 2), |
| 1978 | F_CAM( 96000000, pll8, 4, 0, 0), |
| 1979 | F_CAM(128000000, pll8, 3, 0, 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1980 | F_END |
| 1981 | }; |
| 1982 | |
| 1983 | static struct rcg_clk cam_clk = { |
| 1984 | .b = { |
| 1985 | .ctl_reg = CAMCLK_CC_REG, |
| 1986 | .en_mask = BIT(0), |
| 1987 | .halt_check = DELAY, |
| 1988 | }, |
| 1989 | .ns_reg = CAMCLK_NS_REG, |
| 1990 | .md_reg = CAMCLK_MD_REG, |
| 1991 | .root_en_mask = BIT(2), |
| 1992 | .ns_mask = (BM(31, 24) | BM(15, 14) | BM(2, 0)), |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 1993 | .mnd_en_mask = BIT(5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1994 | .ctl_mask = BM(7, 6), |
| 1995 | .set_rate = set_rate_mnd_8, |
| 1996 | .freq_tbl = clk_tbl_cam, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1997 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1998 | .c = { |
| 1999 | .dbg_name = "cam_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2000 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2001 | VDD_DIG_FMAX_MAP2(LOW, 64000000, NOMINAL, 128000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2002 | CLK_INIT(cam_clk.c), |
| 2003 | }, |
| 2004 | }; |
| 2005 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2006 | #define F_CSI(f, s, d) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2007 | { \ |
| 2008 | .freq_hz = f, \ |
| 2009 | .src_clk = &s##_clk.c, \ |
| 2010 | .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2011 | } |
| 2012 | static struct clk_freq_tbl clk_tbl_csi[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2013 | F_CSI( 0, gnd, 1), |
| 2014 | F_CSI(192000000, pll8, 2), |
| 2015 | F_CSI(384000000, pll8, 1), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2016 | F_END |
| 2017 | }; |
| 2018 | |
| 2019 | static struct rcg_clk csi_src_clk = { |
| 2020 | .ns_reg = CSI_NS_REG, |
| 2021 | .b = { |
| 2022 | .ctl_reg = CSI_CC_REG, |
| 2023 | .halt_check = NOCHECK, |
| 2024 | }, |
| 2025 | .root_en_mask = BIT(2), |
| 2026 | .ns_mask = (BM(15, 12) | BM(2, 0)), |
| 2027 | .set_rate = set_rate_nop, |
| 2028 | .freq_tbl = clk_tbl_csi, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2029 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2030 | .c = { |
| 2031 | .dbg_name = "csi_src_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2032 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2033 | VDD_DIG_FMAX_MAP2(LOW, 192000000, NOMINAL, 384000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2034 | CLK_INIT(csi_src_clk.c), |
| 2035 | }, |
| 2036 | }; |
| 2037 | |
| 2038 | static struct branch_clk csi0_clk = { |
| 2039 | .b = { |
| 2040 | .ctl_reg = CSI_CC_REG, |
| 2041 | .en_mask = BIT(0), |
| 2042 | .reset_reg = SW_RESET_CORE_REG, |
| 2043 | .reset_mask = BIT(8), |
| 2044 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2045 | .halt_bit = 13, |
| 2046 | }, |
| 2047 | .parent = &csi_src_clk.c, |
| 2048 | .c = { |
| 2049 | .dbg_name = "csi0_clk", |
| 2050 | .ops = &clk_ops_branch, |
| 2051 | CLK_INIT(csi0_clk.c), |
| 2052 | }, |
| 2053 | }; |
| 2054 | |
| 2055 | static struct branch_clk csi1_clk = { |
| 2056 | .b = { |
| 2057 | .ctl_reg = CSI_CC_REG, |
| 2058 | .en_mask = BIT(7), |
| 2059 | .reset_reg = SW_RESET_CORE_REG, |
| 2060 | .reset_mask = BIT(18), |
| 2061 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2062 | .halt_bit = 14, |
| 2063 | }, |
| 2064 | .parent = &csi_src_clk.c, |
| 2065 | .c = { |
| 2066 | .dbg_name = "csi1_clk", |
| 2067 | .ops = &clk_ops_branch, |
| 2068 | CLK_INIT(csi1_clk.c), |
| 2069 | }, |
| 2070 | }; |
| 2071 | |
| 2072 | #define F_DSI(d) \ |
| 2073 | { \ |
| 2074 | .freq_hz = d, \ |
| 2075 | .ns_val = BVAL(27, 24, (d-1)), \ |
| 2076 | } |
| 2077 | /* The DSI_BYTE clock is sourced from the DSI PHY PLL, which may change rate |
| 2078 | * without this clock driver knowing. So, overload the clk_set_rate() to set |
| 2079 | * the divider (1 to 16) of the clock with respect to the PLL rate. */ |
| 2080 | static struct clk_freq_tbl clk_tbl_dsi_byte[] = { |
| 2081 | F_DSI(1), F_DSI(2), F_DSI(3), F_DSI(4), |
| 2082 | F_DSI(5), F_DSI(6), F_DSI(7), F_DSI(8), |
| 2083 | F_DSI(9), F_DSI(10), F_DSI(11), F_DSI(12), |
| 2084 | F_DSI(13), F_DSI(14), F_DSI(15), F_DSI(16), |
| 2085 | F_END |
| 2086 | }; |
| 2087 | |
| 2088 | |
| 2089 | static struct rcg_clk dsi_byte_clk = { |
| 2090 | .b = { |
| 2091 | .ctl_reg = MISC_CC_REG, |
| 2092 | .halt_check = DELAY, |
| 2093 | .reset_reg = SW_RESET_CORE_REG, |
| 2094 | .reset_mask = BIT(7), |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2095 | .retain_reg = MISC_CC2_REG, |
| 2096 | .retain_mask = BIT(10), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2097 | }, |
| 2098 | .ns_reg = MISC_CC2_REG, |
| 2099 | .root_en_mask = BIT(2), |
| 2100 | .ns_mask = BM(27, 24), |
| 2101 | .set_rate = set_rate_nop, |
| 2102 | .freq_tbl = clk_tbl_dsi_byte, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2103 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2104 | .c = { |
| 2105 | .dbg_name = "dsi_byte_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2106 | .ops = &clk_ops_rcg, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2107 | CLK_INIT(dsi_byte_clk.c), |
| 2108 | }, |
| 2109 | }; |
| 2110 | |
| 2111 | static struct branch_clk dsi_esc_clk = { |
| 2112 | .b = { |
| 2113 | .ctl_reg = MISC_CC_REG, |
| 2114 | .en_mask = BIT(0), |
| 2115 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2116 | .halt_bit = 24, |
| 2117 | }, |
| 2118 | .c = { |
| 2119 | .dbg_name = "dsi_esc_clk", |
| 2120 | .ops = &clk_ops_branch, |
| 2121 | CLK_INIT(dsi_esc_clk.c), |
| 2122 | }, |
| 2123 | }; |
| 2124 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2125 | #define F_GFX2D(f, s, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2126 | { \ |
| 2127 | .freq_hz = f, \ |
| 2128 | .src_clk = &s##_clk.c, \ |
| 2129 | .md_val = MD4(4, m, 0, n), \ |
| 2130 | .ns_val = NS_MND_BANKED4(20, 16, n, m, 3, 0, s##_to_mm_mux), \ |
| 2131 | .ctl_val = CC_BANKED(9, 6, n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2132 | } |
| 2133 | static struct clk_freq_tbl clk_tbl_gfx2d[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2134 | F_GFX2D( 0, gnd, 0, 0), |
| 2135 | F_GFX2D( 27000000, pxo, 0, 0), |
| 2136 | F_GFX2D( 48000000, pll8, 1, 8), |
| 2137 | F_GFX2D( 54857000, pll8, 1, 7), |
| 2138 | F_GFX2D( 64000000, pll8, 1, 6), |
| 2139 | F_GFX2D( 76800000, pll8, 1, 5), |
| 2140 | F_GFX2D( 96000000, pll8, 1, 4), |
| 2141 | F_GFX2D(128000000, pll8, 1, 3), |
| 2142 | F_GFX2D(145455000, pll2, 2, 11), |
| 2143 | F_GFX2D(160000000, pll2, 1, 5), |
| 2144 | F_GFX2D(177778000, pll2, 2, 9), |
| 2145 | F_GFX2D(200000000, pll2, 1, 4), |
| 2146 | F_GFX2D(228571000, pll2, 2, 7), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2147 | F_END |
| 2148 | }; |
| 2149 | |
| 2150 | static struct bank_masks bmnd_info_gfx2d0 = { |
| 2151 | .bank_sel_mask = BIT(11), |
| 2152 | .bank0_mask = { |
| 2153 | .md_reg = GFX2D0_MD0_REG, |
| 2154 | .ns_mask = BM(23, 20) | BM(5, 3), |
| 2155 | .rst_mask = BIT(25), |
| 2156 | .mnd_en_mask = BIT(8), |
| 2157 | .mode_mask = BM(10, 9), |
| 2158 | }, |
| 2159 | .bank1_mask = { |
| 2160 | .md_reg = GFX2D0_MD1_REG, |
| 2161 | .ns_mask = BM(19, 16) | BM(2, 0), |
| 2162 | .rst_mask = BIT(24), |
| 2163 | .mnd_en_mask = BIT(5), |
| 2164 | .mode_mask = BM(7, 6), |
| 2165 | }, |
| 2166 | }; |
| 2167 | |
| 2168 | static struct rcg_clk gfx2d0_clk = { |
| 2169 | .b = { |
| 2170 | .ctl_reg = GFX2D0_CC_REG, |
| 2171 | .en_mask = BIT(0), |
| 2172 | .reset_reg = SW_RESET_CORE_REG, |
| 2173 | .reset_mask = BIT(14), |
| 2174 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 2175 | .halt_bit = 9, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2176 | .retain_reg = GFX2D0_CC_REG, |
| 2177 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2178 | }, |
| 2179 | .ns_reg = GFX2D0_NS_REG, |
| 2180 | .root_en_mask = BIT(2), |
| 2181 | .set_rate = set_rate_mnd_banked, |
| 2182 | .freq_tbl = clk_tbl_gfx2d, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 2183 | .bank_info = &bmnd_info_gfx2d0, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2184 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2185 | .c = { |
| 2186 | .dbg_name = "gfx2d0_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2187 | .ops = &clk_ops_rcg, |
Matt Wagantall | 158f73b | 2012-05-16 11:29:35 -0700 | [diff] [blame] | 2188 | .flags = CLKFLAG_SKIP_HANDOFF, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2189 | VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000, |
| 2190 | HIGH, 228571000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2191 | CLK_INIT(gfx2d0_clk.c), |
| 2192 | }, |
| 2193 | }; |
| 2194 | |
| 2195 | static struct bank_masks bmnd_info_gfx2d1 = { |
| 2196 | .bank_sel_mask = BIT(11), |
| 2197 | .bank0_mask = { |
| 2198 | .md_reg = GFX2D1_MD0_REG, |
| 2199 | .ns_mask = BM(23, 20) | BM(5, 3), |
| 2200 | .rst_mask = BIT(25), |
| 2201 | .mnd_en_mask = BIT(8), |
| 2202 | .mode_mask = BM(10, 9), |
| 2203 | }, |
| 2204 | .bank1_mask = { |
| 2205 | .md_reg = GFX2D1_MD1_REG, |
| 2206 | .ns_mask = BM(19, 16) | BM(2, 0), |
| 2207 | .rst_mask = BIT(24), |
| 2208 | .mnd_en_mask = BIT(5), |
| 2209 | .mode_mask = BM(7, 6), |
| 2210 | }, |
| 2211 | }; |
| 2212 | |
| 2213 | static struct rcg_clk gfx2d1_clk = { |
| 2214 | .b = { |
| 2215 | .ctl_reg = GFX2D1_CC_REG, |
| 2216 | .en_mask = BIT(0), |
| 2217 | .reset_reg = SW_RESET_CORE_REG, |
| 2218 | .reset_mask = BIT(13), |
| 2219 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 2220 | .halt_bit = 14, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2221 | .retain_reg = GFX2D1_CC_REG, |
| 2222 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2223 | }, |
| 2224 | .ns_reg = GFX2D1_NS_REG, |
| 2225 | .root_en_mask = BIT(2), |
| 2226 | .set_rate = set_rate_mnd_banked, |
| 2227 | .freq_tbl = clk_tbl_gfx2d, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 2228 | .bank_info = &bmnd_info_gfx2d1, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2229 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2230 | .c = { |
| 2231 | .dbg_name = "gfx2d1_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2232 | .ops = &clk_ops_rcg, |
Matt Wagantall | 158f73b | 2012-05-16 11:29:35 -0700 | [diff] [blame] | 2233 | .flags = CLKFLAG_SKIP_HANDOFF, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2234 | VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000, |
| 2235 | HIGH, 228571000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2236 | CLK_INIT(gfx2d1_clk.c), |
| 2237 | }, |
| 2238 | }; |
| 2239 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2240 | #define F_GFX3D(f, s, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2241 | { \ |
| 2242 | .freq_hz = f, \ |
| 2243 | .src_clk = &s##_clk.c, \ |
| 2244 | .md_val = MD4(4, m, 0, n), \ |
| 2245 | .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \ |
| 2246 | .ctl_val = CC_BANKED(9, 6, n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2247 | } |
| 2248 | static struct clk_freq_tbl clk_tbl_gfx3d[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2249 | F_GFX3D( 0, gnd, 0, 0), |
| 2250 | F_GFX3D( 27000000, pxo, 0, 0), |
| 2251 | F_GFX3D( 48000000, pll8, 1, 8), |
| 2252 | F_GFX3D( 54857000, pll8, 1, 7), |
| 2253 | F_GFX3D( 64000000, pll8, 1, 6), |
| 2254 | F_GFX3D( 76800000, pll8, 1, 5), |
| 2255 | F_GFX3D( 96000000, pll8, 1, 4), |
| 2256 | F_GFX3D(128000000, pll8, 1, 3), |
| 2257 | F_GFX3D(145455000, pll2, 2, 11), |
| 2258 | F_GFX3D(160000000, pll2, 1, 5), |
| 2259 | F_GFX3D(177778000, pll2, 2, 9), |
| 2260 | F_GFX3D(200000000, pll2, 1, 4), |
| 2261 | F_GFX3D(228571000, pll2, 2, 7), |
| 2262 | F_GFX3D(266667000, pll2, 1, 3), |
| 2263 | F_GFX3D(320000000, pll2, 2, 5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2264 | F_END |
| 2265 | }; |
| 2266 | |
| 2267 | static struct bank_masks bmnd_info_gfx3d = { |
| 2268 | .bank_sel_mask = BIT(11), |
| 2269 | .bank0_mask = { |
| 2270 | .md_reg = GFX3D_MD0_REG, |
| 2271 | .ns_mask = BM(21, 18) | BM(5, 3), |
| 2272 | .rst_mask = BIT(23), |
| 2273 | .mnd_en_mask = BIT(8), |
| 2274 | .mode_mask = BM(10, 9), |
| 2275 | }, |
| 2276 | .bank1_mask = { |
| 2277 | .md_reg = GFX3D_MD1_REG, |
| 2278 | .ns_mask = BM(17, 14) | BM(2, 0), |
| 2279 | .rst_mask = BIT(22), |
| 2280 | .mnd_en_mask = BIT(5), |
| 2281 | .mode_mask = BM(7, 6), |
| 2282 | }, |
| 2283 | }; |
| 2284 | |
| 2285 | static struct rcg_clk gfx3d_clk = { |
| 2286 | .b = { |
| 2287 | .ctl_reg = GFX3D_CC_REG, |
| 2288 | .en_mask = BIT(0), |
| 2289 | .reset_reg = SW_RESET_CORE_REG, |
| 2290 | .reset_mask = BIT(12), |
| 2291 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 2292 | .halt_bit = 4, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2293 | .retain_reg = GFX3D_CC_REG, |
| 2294 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2295 | }, |
| 2296 | .ns_reg = GFX3D_NS_REG, |
| 2297 | .root_en_mask = BIT(2), |
| 2298 | .set_rate = set_rate_mnd_banked, |
| 2299 | .freq_tbl = clk_tbl_gfx3d, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 2300 | .bank_info = &bmnd_info_gfx3d, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2301 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2302 | .c = { |
| 2303 | .dbg_name = "gfx3d_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2304 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2305 | VDD_DIG_FMAX_MAP3(LOW, 96000000, NOMINAL, 200000000, |
| 2306 | HIGH, 320000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2307 | CLK_INIT(gfx3d_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2308 | .depends = &gmem_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2309 | }, |
| 2310 | }; |
| 2311 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2312 | #define F_IJPEG(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2313 | { \ |
| 2314 | .freq_hz = f, \ |
| 2315 | .src_clk = &s##_clk.c, \ |
| 2316 | .md_val = MD8(8, m, 0, n), \ |
| 2317 | .ns_val = NS_MM(23, 16, n, m, 15, 12, d, 2, 0, s##_to_mm_mux), \ |
| 2318 | .ctl_val = CC(6, n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2319 | } |
| 2320 | static struct clk_freq_tbl clk_tbl_ijpeg[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2321 | F_IJPEG( 0, gnd, 1, 0, 0), |
| 2322 | F_IJPEG( 27000000, pxo, 1, 0, 0), |
| 2323 | F_IJPEG( 36570000, pll8, 1, 2, 21), |
| 2324 | F_IJPEG( 54860000, pll8, 7, 0, 0), |
| 2325 | F_IJPEG( 96000000, pll8, 4, 0, 0), |
| 2326 | F_IJPEG(109710000, pll8, 1, 2, 7), |
| 2327 | F_IJPEG(128000000, pll8, 3, 0, 0), |
| 2328 | F_IJPEG(153600000, pll8, 1, 2, 5), |
| 2329 | F_IJPEG(200000000, pll2, 4, 0, 0), |
| 2330 | F_IJPEG(228571000, pll2, 1, 2, 7), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2331 | F_END |
| 2332 | }; |
| 2333 | |
| 2334 | static struct rcg_clk ijpeg_clk = { |
| 2335 | .b = { |
| 2336 | .ctl_reg = IJPEG_CC_REG, |
| 2337 | .en_mask = BIT(0), |
| 2338 | .reset_reg = SW_RESET_CORE_REG, |
| 2339 | .reset_mask = BIT(9), |
| 2340 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 2341 | .halt_bit = 24, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2342 | .retain_reg = IJPEG_CC_REG, |
| 2343 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2344 | }, |
| 2345 | .ns_reg = IJPEG_NS_REG, |
| 2346 | .md_reg = IJPEG_MD_REG, |
| 2347 | .root_en_mask = BIT(2), |
| 2348 | .ns_mask = (BM(23, 16) | BM(15, 12) | BM(2, 0)), |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 2349 | .mnd_en_mask = BIT(5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2350 | .ctl_mask = BM(7, 6), |
| 2351 | .set_rate = set_rate_mnd, |
| 2352 | .freq_tbl = clk_tbl_ijpeg, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2353 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2354 | .c = { |
| 2355 | .dbg_name = "ijpeg_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2356 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2357 | VDD_DIG_FMAX_MAP2(LOW, 110000000, NOMINAL, 228571000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2358 | CLK_INIT(ijpeg_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2359 | .depends = &ijpeg_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2360 | }, |
| 2361 | }; |
| 2362 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2363 | #define F_JPEGD(f, s, d) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2364 | { \ |
| 2365 | .freq_hz = f, \ |
| 2366 | .src_clk = &s##_clk.c, \ |
| 2367 | .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2368 | } |
| 2369 | static struct clk_freq_tbl clk_tbl_jpegd[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2370 | F_JPEGD( 0, gnd, 1), |
| 2371 | F_JPEGD( 64000000, pll8, 6), |
| 2372 | F_JPEGD( 76800000, pll8, 5), |
| 2373 | F_JPEGD( 96000000, pll8, 4), |
| 2374 | F_JPEGD(160000000, pll2, 5), |
| 2375 | F_JPEGD(200000000, pll2, 4), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2376 | F_END |
| 2377 | }; |
| 2378 | |
| 2379 | static struct rcg_clk jpegd_clk = { |
| 2380 | .b = { |
| 2381 | .ctl_reg = JPEGD_CC_REG, |
| 2382 | .en_mask = BIT(0), |
| 2383 | .reset_reg = SW_RESET_CORE_REG, |
| 2384 | .reset_mask = BIT(19), |
| 2385 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 2386 | .halt_bit = 19, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2387 | .retain_reg = JPEGD_CC_REG, |
| 2388 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2389 | }, |
| 2390 | .ns_reg = JPEGD_NS_REG, |
| 2391 | .root_en_mask = BIT(2), |
| 2392 | .ns_mask = (BM(15, 12) | BM(2, 0)), |
| 2393 | .set_rate = set_rate_nop, |
| 2394 | .freq_tbl = clk_tbl_jpegd, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2395 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2396 | .c = { |
| 2397 | .dbg_name = "jpegd_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2398 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2399 | VDD_DIG_FMAX_MAP2(LOW, 96000000, NOMINAL, 200000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2400 | CLK_INIT(jpegd_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2401 | .depends = &jpegd_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2402 | }, |
| 2403 | }; |
| 2404 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2405 | #define F_MDP(f, s, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2406 | { \ |
| 2407 | .freq_hz = f, \ |
| 2408 | .src_clk = &s##_clk.c, \ |
| 2409 | .md_val = MD8(8, m, 0, n), \ |
| 2410 | .ns_val = NS_MND_BANKED8(22, 14, n, m, 3, 0, s##_to_mm_mux), \ |
| 2411 | .ctl_val = CC_BANKED(9, 6, n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2412 | } |
| 2413 | static struct clk_freq_tbl clk_tbl_mdp[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2414 | F_MDP( 0, gnd, 0, 0), |
| 2415 | F_MDP( 9600000, pll8, 1, 40), |
| 2416 | F_MDP( 13710000, pll8, 1, 28), |
| 2417 | F_MDP( 27000000, pxo, 0, 0), |
| 2418 | F_MDP( 29540000, pll8, 1, 13), |
| 2419 | F_MDP( 34910000, pll8, 1, 11), |
| 2420 | F_MDP( 38400000, pll8, 1, 10), |
| 2421 | F_MDP( 59080000, pll8, 2, 13), |
| 2422 | F_MDP( 76800000, pll8, 1, 5), |
| 2423 | F_MDP( 85330000, pll8, 2, 9), |
| 2424 | F_MDP( 96000000, pll8, 1, 4), |
| 2425 | F_MDP(128000000, pll8, 1, 3), |
| 2426 | F_MDP(160000000, pll2, 1, 5), |
| 2427 | F_MDP(177780000, pll2, 2, 9), |
| 2428 | F_MDP(200000000, pll2, 1, 4), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2429 | F_END |
| 2430 | }; |
| 2431 | |
| 2432 | static struct bank_masks bmnd_info_mdp = { |
| 2433 | .bank_sel_mask = BIT(11), |
| 2434 | .bank0_mask = { |
| 2435 | .md_reg = MDP_MD0_REG, |
| 2436 | .ns_mask = BM(29, 22) | BM(5, 3), |
| 2437 | .rst_mask = BIT(31), |
| 2438 | .mnd_en_mask = BIT(8), |
| 2439 | .mode_mask = BM(10, 9), |
| 2440 | }, |
| 2441 | .bank1_mask = { |
| 2442 | .md_reg = MDP_MD1_REG, |
| 2443 | .ns_mask = BM(21, 14) | BM(2, 0), |
| 2444 | .rst_mask = BIT(30), |
| 2445 | .mnd_en_mask = BIT(5), |
| 2446 | .mode_mask = BM(7, 6), |
| 2447 | }, |
| 2448 | }; |
| 2449 | |
| 2450 | static struct rcg_clk mdp_clk = { |
| 2451 | .b = { |
| 2452 | .ctl_reg = MDP_CC_REG, |
| 2453 | .en_mask = BIT(0), |
| 2454 | .reset_reg = SW_RESET_CORE_REG, |
| 2455 | .reset_mask = BIT(21), |
| 2456 | .halt_reg = DBG_BUS_VEC_C_REG, |
| 2457 | .halt_bit = 10, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2458 | .retain_reg = MDP_CC_REG, |
| 2459 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2460 | }, |
| 2461 | .ns_reg = MDP_NS_REG, |
| 2462 | .root_en_mask = BIT(2), |
| 2463 | .set_rate = set_rate_mnd_banked, |
| 2464 | .freq_tbl = clk_tbl_mdp, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 2465 | .bank_info = &bmnd_info_mdp, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2466 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2467 | .c = { |
| 2468 | .dbg_name = "mdp_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2469 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2470 | VDD_DIG_FMAX_MAP3(LOW, 85330000, NOMINAL, 200000000, |
| 2471 | HIGH, 228571000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2472 | CLK_INIT(mdp_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2473 | .depends = &mdp_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2474 | }, |
| 2475 | }; |
| 2476 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2477 | #define F_MDP_VSYNC(f, s) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2478 | { \ |
| 2479 | .freq_hz = f, \ |
| 2480 | .src_clk = &s##_clk.c, \ |
| 2481 | .ns_val = NS_SRC_SEL(13, 13, s##_to_bb_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2482 | } |
| 2483 | static struct clk_freq_tbl clk_tbl_mdp_vsync[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2484 | F_MDP_VSYNC(27000000, pxo), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2485 | F_END |
| 2486 | }; |
| 2487 | |
| 2488 | static struct rcg_clk mdp_vsync_clk = { |
| 2489 | .b = { |
| 2490 | .ctl_reg = MISC_CC_REG, |
| 2491 | .en_mask = BIT(6), |
| 2492 | .reset_reg = SW_RESET_CORE_REG, |
| 2493 | .reset_mask = BIT(3), |
| 2494 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2495 | .halt_bit = 22, |
| 2496 | }, |
| 2497 | .ns_reg = MISC_CC2_REG, |
| 2498 | .ns_mask = BIT(13), |
| 2499 | .set_rate = set_rate_nop, |
| 2500 | .freq_tbl = clk_tbl_mdp_vsync, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2501 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2502 | .c = { |
| 2503 | .dbg_name = "mdp_vsync_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2504 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2505 | VDD_DIG_FMAX_MAP1(LOW, 27000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2506 | CLK_INIT(mdp_vsync_clk.c), |
| 2507 | }, |
| 2508 | }; |
| 2509 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2510 | #define F_PIXEL_MDP(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2511 | { \ |
| 2512 | .freq_hz = f, \ |
| 2513 | .src_clk = &s##_clk.c, \ |
| 2514 | .md_val = MD16(m, n), \ |
| 2515 | .ns_val = NS_MM(31, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \ |
| 2516 | .ctl_val = CC(6, n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2517 | } |
| 2518 | static struct clk_freq_tbl clk_tbl_pixel_mdp[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2519 | F_PIXEL_MDP( 0, gnd, 1, 0, 0), |
| 2520 | F_PIXEL_MDP( 25600000, pll8, 3, 1, 5), |
| 2521 | F_PIXEL_MDP( 42667000, pll8, 1, 1, 9), |
| 2522 | F_PIXEL_MDP( 43192000, pll8, 1, 64, 569), |
| 2523 | F_PIXEL_MDP( 48000000, pll8, 4, 1, 2), |
| 2524 | F_PIXEL_MDP( 53990000, pll8, 2, 169, 601), |
| 2525 | F_PIXEL_MDP( 64000000, pll8, 2, 1, 3), |
| 2526 | F_PIXEL_MDP( 69300000, pll8, 1, 231, 1280), |
| 2527 | F_PIXEL_MDP( 76800000, pll8, 1, 1, 5), |
| 2528 | F_PIXEL_MDP( 85333000, pll8, 1, 2, 9), |
| 2529 | F_PIXEL_MDP(106500000, pll8, 1, 71, 256), |
| 2530 | F_PIXEL_MDP(109714000, pll8, 1, 2, 7), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2531 | F_END |
| 2532 | }; |
| 2533 | |
| 2534 | static struct rcg_clk pixel_mdp_clk = { |
| 2535 | .ns_reg = PIXEL_NS_REG, |
| 2536 | .md_reg = PIXEL_MD_REG, |
| 2537 | .b = { |
| 2538 | .ctl_reg = PIXEL_CC_REG, |
| 2539 | .en_mask = BIT(0), |
| 2540 | .reset_reg = SW_RESET_CORE_REG, |
| 2541 | .reset_mask = BIT(5), |
| 2542 | .halt_reg = DBG_BUS_VEC_C_REG, |
| 2543 | .halt_bit = 23, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2544 | .retain_reg = PIXEL_CC_REG, |
| 2545 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2546 | }, |
| 2547 | .root_en_mask = BIT(2), |
| 2548 | .ns_mask = (BM(31, 16) | BM(15, 14) | BM(2, 0)), |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 2549 | .mnd_en_mask = BIT(5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2550 | .ctl_mask = BM(7, 6), |
| 2551 | .set_rate = set_rate_mnd, |
| 2552 | .freq_tbl = clk_tbl_pixel_mdp, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2553 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2554 | .c = { |
| 2555 | .dbg_name = "pixel_mdp_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2556 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2557 | VDD_DIG_FMAX_MAP2(LOW, 85333000, NOMINAL, 170000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2558 | CLK_INIT(pixel_mdp_clk.c), |
| 2559 | }, |
| 2560 | }; |
| 2561 | |
| 2562 | static struct branch_clk pixel_lcdc_clk = { |
| 2563 | .b = { |
| 2564 | .ctl_reg = PIXEL_CC_REG, |
| 2565 | .en_mask = BIT(8), |
| 2566 | .halt_reg = DBG_BUS_VEC_C_REG, |
| 2567 | .halt_bit = 21, |
| 2568 | }, |
| 2569 | .parent = &pixel_mdp_clk.c, |
| 2570 | .c = { |
| 2571 | .dbg_name = "pixel_lcdc_clk", |
| 2572 | .ops = &clk_ops_branch, |
| 2573 | CLK_INIT(pixel_lcdc_clk.c), |
| 2574 | }, |
| 2575 | }; |
| 2576 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2577 | #define F_ROT(f, s, d) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2578 | { \ |
| 2579 | .freq_hz = f, \ |
| 2580 | .src_clk = &s##_clk.c, \ |
| 2581 | .ns_val = NS_DIVSRC_BANKED(29, 26, 25, 22, d, \ |
| 2582 | 21, 19, 18, 16, s##_to_mm_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2583 | } |
| 2584 | static struct clk_freq_tbl clk_tbl_rot[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2585 | F_ROT( 0, gnd, 1), |
| 2586 | F_ROT( 27000000, pxo, 1), |
| 2587 | F_ROT( 29540000, pll8, 13), |
| 2588 | F_ROT( 32000000, pll8, 12), |
| 2589 | F_ROT( 38400000, pll8, 10), |
| 2590 | F_ROT( 48000000, pll8, 8), |
| 2591 | F_ROT( 54860000, pll8, 7), |
| 2592 | F_ROT( 64000000, pll8, 6), |
| 2593 | F_ROT( 76800000, pll8, 5), |
| 2594 | F_ROT( 96000000, pll8, 4), |
| 2595 | F_ROT(100000000, pll2, 8), |
| 2596 | F_ROT(114290000, pll2, 7), |
| 2597 | F_ROT(133330000, pll2, 6), |
| 2598 | F_ROT(160000000, pll2, 5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2599 | F_END |
| 2600 | }; |
| 2601 | |
| 2602 | static struct bank_masks bdiv_info_rot = { |
| 2603 | .bank_sel_mask = BIT(30), |
| 2604 | .bank0_mask = { |
| 2605 | .ns_mask = BM(25, 22) | BM(18, 16), |
| 2606 | }, |
| 2607 | .bank1_mask = { |
| 2608 | .ns_mask = BM(29, 26) | BM(21, 19), |
| 2609 | }, |
| 2610 | }; |
| 2611 | |
| 2612 | static struct rcg_clk rot_clk = { |
| 2613 | .b = { |
| 2614 | .ctl_reg = ROT_CC_REG, |
| 2615 | .en_mask = BIT(0), |
| 2616 | .reset_reg = SW_RESET_CORE_REG, |
| 2617 | .reset_mask = BIT(2), |
| 2618 | .halt_reg = DBG_BUS_VEC_C_REG, |
| 2619 | .halt_bit = 15, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2620 | .retain_reg = ROT_CC_REG, |
| 2621 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2622 | }, |
| 2623 | .ns_reg = ROT_NS_REG, |
| 2624 | .root_en_mask = BIT(2), |
| 2625 | .set_rate = set_rate_div_banked, |
| 2626 | .freq_tbl = clk_tbl_rot, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 2627 | .bank_info = &bdiv_info_rot, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2628 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2629 | .c = { |
| 2630 | .dbg_name = "rot_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2631 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2632 | VDD_DIG_FMAX_MAP2(LOW, 80000000, NOMINAL, 160000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2633 | CLK_INIT(rot_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2634 | .depends = &rot_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2635 | }, |
| 2636 | }; |
| 2637 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2638 | #define F_TV(f, s, p_r, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2639 | { \ |
| 2640 | .freq_hz = f, \ |
| 2641 | .src_clk = &s##_clk.c, \ |
| 2642 | .md_val = MD8(8, m, 0, n), \ |
| 2643 | .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \ |
| 2644 | .ctl_val = CC(6, n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2645 | .extra_freq_data = p_r, \ |
| 2646 | } |
| 2647 | /* Switching TV freqs requires PLL reconfiguration. */ |
| 2648 | static struct pll_rate mm_pll2_rate[] = { |
| 2649 | [0] = PLL_RATE( 7, 6301, 13500, 0, 4, 0x4248B), /* 50400500 Hz */ |
| 2650 | [1] = PLL_RATE( 8, 0, 0, 0, 4, 0x4248B), /* 54000000 Hz */ |
| 2651 | [2] = PLL_RATE(16, 2, 125, 0, 4, 0x5248F), /* 108108000 Hz */ |
| 2652 | [3] = PLL_RATE(22, 0, 0, 2, 4, 0x6248B), /* 148500000 Hz */ |
| 2653 | [4] = PLL_RATE(44, 0, 0, 2, 4, 0x6248F), /* 297000000 Hz */ |
| 2654 | }; |
| 2655 | static struct clk_freq_tbl clk_tbl_tv[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2656 | F_TV( 0, gnd, &mm_pll2_rate[0], 1, 0, 0), |
| 2657 | F_TV( 25200000, pll3, &mm_pll2_rate[0], 2, 0, 0), |
| 2658 | F_TV( 27000000, pll3, &mm_pll2_rate[1], 2, 0, 0), |
| 2659 | F_TV( 27030000, pll3, &mm_pll2_rate[2], 4, 0, 0), |
| 2660 | F_TV( 74250000, pll3, &mm_pll2_rate[3], 2, 0, 0), |
| 2661 | F_TV(148500000, pll3, &mm_pll2_rate[4], 2, 0, 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2662 | F_END |
| 2663 | }; |
| 2664 | |
| 2665 | static struct rcg_clk tv_src_clk = { |
| 2666 | .ns_reg = TV_NS_REG, |
| 2667 | .b = { |
| 2668 | .ctl_reg = TV_CC_REG, |
| 2669 | .halt_check = NOCHECK, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2670 | .retain_reg = TV_CC_REG, |
| 2671 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2672 | }, |
| 2673 | .md_reg = TV_MD_REG, |
| 2674 | .root_en_mask = BIT(2), |
| 2675 | .ns_mask = (BM(23, 16) | BM(15, 14) | BM(2, 0)), |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 2676 | .mnd_en_mask = BIT(5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2677 | .ctl_mask = BM(7, 6), |
| 2678 | .set_rate = set_rate_tv, |
| 2679 | .freq_tbl = clk_tbl_tv, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2680 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2681 | .c = { |
| 2682 | .dbg_name = "tv_src_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2683 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2684 | VDD_DIG_FMAX_MAP2(LOW, 27030000, NOMINAL, 149000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2685 | CLK_INIT(tv_src_clk.c), |
| 2686 | }, |
| 2687 | }; |
| 2688 | |
| 2689 | static struct branch_clk tv_enc_clk = { |
| 2690 | .b = { |
| 2691 | .ctl_reg = TV_CC_REG, |
| 2692 | .en_mask = BIT(8), |
| 2693 | .reset_reg = SW_RESET_CORE_REG, |
| 2694 | .reset_mask = BIT(0), |
| 2695 | .halt_reg = DBG_BUS_VEC_D_REG, |
| 2696 | .halt_bit = 8, |
| 2697 | }, |
| 2698 | .parent = &tv_src_clk.c, |
| 2699 | .c = { |
| 2700 | .dbg_name = "tv_enc_clk", |
| 2701 | .ops = &clk_ops_branch, |
| 2702 | CLK_INIT(tv_enc_clk.c), |
| 2703 | }, |
| 2704 | }; |
| 2705 | |
| 2706 | static struct branch_clk tv_dac_clk = { |
| 2707 | .b = { |
| 2708 | .ctl_reg = TV_CC_REG, |
| 2709 | .en_mask = BIT(10), |
| 2710 | .halt_reg = DBG_BUS_VEC_D_REG, |
| 2711 | .halt_bit = 9, |
| 2712 | }, |
| 2713 | .parent = &tv_src_clk.c, |
| 2714 | .c = { |
| 2715 | .dbg_name = "tv_dac_clk", |
| 2716 | .ops = &clk_ops_branch, |
| 2717 | CLK_INIT(tv_dac_clk.c), |
| 2718 | }, |
| 2719 | }; |
| 2720 | |
| 2721 | static struct branch_clk mdp_tv_clk = { |
| 2722 | .b = { |
| 2723 | .ctl_reg = TV_CC_REG, |
| 2724 | .en_mask = BIT(0), |
| 2725 | .reset_reg = SW_RESET_CORE_REG, |
| 2726 | .reset_mask = BIT(4), |
| 2727 | .halt_reg = DBG_BUS_VEC_D_REG, |
| 2728 | .halt_bit = 11, |
| 2729 | }, |
| 2730 | .parent = &tv_src_clk.c, |
| 2731 | .c = { |
| 2732 | .dbg_name = "mdp_tv_clk", |
| 2733 | .ops = &clk_ops_branch, |
| 2734 | CLK_INIT(mdp_tv_clk.c), |
| 2735 | }, |
| 2736 | }; |
| 2737 | |
| 2738 | static struct branch_clk hdmi_tv_clk = { |
| 2739 | .b = { |
| 2740 | .ctl_reg = TV_CC_REG, |
| 2741 | .en_mask = BIT(12), |
| 2742 | .reset_reg = SW_RESET_CORE_REG, |
| 2743 | .reset_mask = BIT(1), |
| 2744 | .halt_reg = DBG_BUS_VEC_D_REG, |
| 2745 | .halt_bit = 10, |
| 2746 | }, |
| 2747 | .parent = &tv_src_clk.c, |
| 2748 | .c = { |
| 2749 | .dbg_name = "hdmi_tv_clk", |
| 2750 | .ops = &clk_ops_branch, |
| 2751 | CLK_INIT(hdmi_tv_clk.c), |
| 2752 | }, |
| 2753 | }; |
| 2754 | |
| 2755 | static struct branch_clk hdmi_app_clk = { |
| 2756 | .b = { |
| 2757 | .ctl_reg = MISC_CC2_REG, |
| 2758 | .en_mask = BIT(11), |
| 2759 | .reset_reg = SW_RESET_CORE_REG, |
| 2760 | .reset_mask = BIT(11), |
| 2761 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2762 | .halt_bit = 25, |
| 2763 | }, |
| 2764 | .c = { |
| 2765 | .dbg_name = "hdmi_app_clk", |
| 2766 | .ops = &clk_ops_branch, |
| 2767 | CLK_INIT(hdmi_app_clk.c), |
| 2768 | }, |
| 2769 | }; |
| 2770 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2771 | #define F_VCODEC(f, s, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2772 | { \ |
| 2773 | .freq_hz = f, \ |
| 2774 | .src_clk = &s##_clk.c, \ |
| 2775 | .md_val = MD8(8, m, 0, n), \ |
| 2776 | .ns_val = NS_MM(18, 11, n, m, 0, 0, 1, 2, 0, s##_to_mm_mux), \ |
| 2777 | .ctl_val = CC(6, n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2778 | } |
| 2779 | static struct clk_freq_tbl clk_tbl_vcodec[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2780 | F_VCODEC( 0, gnd, 0, 0), |
| 2781 | F_VCODEC( 27000000, pxo, 0, 0), |
| 2782 | F_VCODEC( 32000000, pll8, 1, 12), |
| 2783 | F_VCODEC( 48000000, pll8, 1, 8), |
| 2784 | F_VCODEC( 54860000, pll8, 1, 7), |
| 2785 | F_VCODEC( 96000000, pll8, 1, 4), |
| 2786 | F_VCODEC(133330000, pll2, 1, 6), |
| 2787 | F_VCODEC(200000000, pll2, 1, 4), |
| 2788 | F_VCODEC(228570000, pll2, 2, 7), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2789 | F_END |
| 2790 | }; |
| 2791 | |
| 2792 | static struct rcg_clk vcodec_clk = { |
| 2793 | .b = { |
| 2794 | .ctl_reg = VCODEC_CC_REG, |
| 2795 | .en_mask = BIT(0), |
| 2796 | .reset_reg = SW_RESET_CORE_REG, |
| 2797 | .reset_mask = BIT(6), |
| 2798 | .halt_reg = DBG_BUS_VEC_C_REG, |
| 2799 | .halt_bit = 29, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2800 | .retain_reg = VCODEC_CC_REG, |
| 2801 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2802 | }, |
| 2803 | .ns_reg = VCODEC_NS_REG, |
| 2804 | .md_reg = VCODEC_MD0_REG, |
| 2805 | .root_en_mask = BIT(2), |
| 2806 | .ns_mask = (BM(18, 11) | BM(2, 0)), |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 2807 | .mnd_en_mask = BIT(5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2808 | .ctl_mask = BM(7, 6), |
| 2809 | .set_rate = set_rate_mnd, |
| 2810 | .freq_tbl = clk_tbl_vcodec, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2811 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2812 | .c = { |
| 2813 | .dbg_name = "vcodec_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2814 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2815 | VDD_DIG_FMAX_MAP3(LOW, 100000000, NOMINAL, 200000000, |
| 2816 | HIGH, 228571000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2817 | CLK_INIT(vcodec_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2818 | .depends = &vcodec_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2819 | }, |
| 2820 | }; |
| 2821 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2822 | #define F_VPE(f, s, d) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2823 | { \ |
| 2824 | .freq_hz = f, \ |
| 2825 | .src_clk = &s##_clk.c, \ |
| 2826 | .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2827 | } |
| 2828 | static struct clk_freq_tbl clk_tbl_vpe[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2829 | F_VPE( 0, gnd, 1), |
| 2830 | F_VPE( 27000000, pxo, 1), |
| 2831 | F_VPE( 34909000, pll8, 11), |
| 2832 | F_VPE( 38400000, pll8, 10), |
| 2833 | F_VPE( 64000000, pll8, 6), |
| 2834 | F_VPE( 76800000, pll8, 5), |
| 2835 | F_VPE( 96000000, pll8, 4), |
| 2836 | F_VPE(100000000, pll2, 8), |
| 2837 | F_VPE(160000000, pll2, 5), |
| 2838 | F_VPE(200000000, pll2, 4), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2839 | F_END |
| 2840 | }; |
| 2841 | |
| 2842 | static struct rcg_clk vpe_clk = { |
| 2843 | .b = { |
| 2844 | .ctl_reg = VPE_CC_REG, |
| 2845 | .en_mask = BIT(0), |
| 2846 | .reset_reg = SW_RESET_CORE_REG, |
| 2847 | .reset_mask = BIT(17), |
| 2848 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 2849 | .halt_bit = 28, |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2850 | .retain_reg = VPE_CC_REG, |
| 2851 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2852 | }, |
| 2853 | .ns_reg = VPE_NS_REG, |
| 2854 | .root_en_mask = BIT(2), |
| 2855 | .ns_mask = (BM(15, 12) | BM(2, 0)), |
| 2856 | .set_rate = set_rate_nop, |
| 2857 | .freq_tbl = clk_tbl_vpe, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2858 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2859 | .c = { |
| 2860 | .dbg_name = "vpe_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2861 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2862 | VDD_DIG_FMAX_MAP3(LOW, 76800000, NOMINAL, 160000000, |
| 2863 | HIGH, 200000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2864 | CLK_INIT(vpe_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2865 | .depends = &vpe_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2866 | }, |
| 2867 | }; |
| 2868 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2869 | #define F_VFE(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2870 | { \ |
| 2871 | .freq_hz = f, \ |
| 2872 | .src_clk = &s##_clk.c, \ |
| 2873 | .md_val = MD8(8, m, 0, n), \ |
| 2874 | .ns_val = NS_MM(23, 16, n, m, 11, 10, d, 2, 0, s##_to_mm_mux), \ |
| 2875 | .ctl_val = CC(6, n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2876 | } |
| 2877 | static struct clk_freq_tbl clk_tbl_vfe[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2878 | F_VFE( 0, gnd, 1, 0, 0), |
| 2879 | F_VFE( 13960000, pll8, 1, 2, 55), |
| 2880 | F_VFE( 27000000, pxo, 1, 0, 0), |
| 2881 | F_VFE( 36570000, pll8, 1, 2, 21), |
| 2882 | F_VFE( 38400000, pll8, 2, 1, 5), |
| 2883 | F_VFE( 45180000, pll8, 1, 2, 17), |
| 2884 | F_VFE( 48000000, pll8, 2, 1, 4), |
| 2885 | F_VFE( 54860000, pll8, 1, 1, 7), |
| 2886 | F_VFE( 64000000, pll8, 2, 1, 3), |
| 2887 | F_VFE( 76800000, pll8, 1, 1, 5), |
| 2888 | F_VFE( 96000000, pll8, 2, 1, 2), |
| 2889 | F_VFE(109710000, pll8, 1, 2, 7), |
| 2890 | F_VFE(128000000, pll8, 1, 1, 3), |
| 2891 | F_VFE(153600000, pll8, 1, 2, 5), |
| 2892 | F_VFE(200000000, pll2, 2, 1, 2), |
| 2893 | F_VFE(228570000, pll2, 1, 2, 7), |
| 2894 | F_VFE(266667000, pll2, 1, 1, 3), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2895 | F_END |
| 2896 | }; |
| 2897 | |
| 2898 | static struct rcg_clk vfe_clk = { |
| 2899 | .b = { |
| 2900 | .ctl_reg = VFE_CC_REG, |
| 2901 | .reset_reg = SW_RESET_CORE_REG, |
| 2902 | .reset_mask = BIT(15), |
| 2903 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2904 | .halt_bit = 6, |
| 2905 | .en_mask = BIT(0), |
Matt Wagantall | 6bc8f10 | 2012-01-20 19:20:44 -0800 | [diff] [blame] | 2906 | .retain_reg = VFE_CC_REG, |
| 2907 | .retain_mask = BIT(31), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2908 | }, |
| 2909 | .ns_reg = VFE_NS_REG, |
| 2910 | .md_reg = VFE_MD_REG, |
| 2911 | .root_en_mask = BIT(2), |
| 2912 | .ns_mask = (BM(23, 16) | BM(11, 10) | BM(2, 0)), |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 2913 | .mnd_en_mask = BIT(5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2914 | .ctl_mask = BM(7, 6), |
| 2915 | .set_rate = set_rate_mnd, |
| 2916 | .freq_tbl = clk_tbl_vfe, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2917 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2918 | .c = { |
| 2919 | .dbg_name = "vfe_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 2920 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2921 | VDD_DIG_FMAX_MAP3(LOW, 110000000, NOMINAL, 228570000, |
| 2922 | HIGH, 266667000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2923 | CLK_INIT(vfe_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2924 | .depends = &vfe_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2925 | }, |
| 2926 | }; |
| 2927 | |
| 2928 | static struct branch_clk csi0_vfe_clk = { |
| 2929 | .b = { |
| 2930 | .ctl_reg = VFE_CC_REG, |
| 2931 | .en_mask = BIT(12), |
| 2932 | .reset_reg = SW_RESET_CORE_REG, |
| 2933 | .reset_mask = BIT(24), |
| 2934 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2935 | .halt_bit = 7, |
| 2936 | }, |
| 2937 | .parent = &vfe_clk.c, |
| 2938 | .c = { |
| 2939 | .dbg_name = "csi0_vfe_clk", |
| 2940 | .ops = &clk_ops_branch, |
| 2941 | CLK_INIT(csi0_vfe_clk.c), |
| 2942 | }, |
| 2943 | }; |
| 2944 | |
| 2945 | static struct branch_clk csi1_vfe_clk = { |
| 2946 | .b = { |
| 2947 | .ctl_reg = VFE_CC_REG, |
| 2948 | .en_mask = BIT(10), |
| 2949 | .reset_reg = SW_RESET_CORE_REG, |
| 2950 | .reset_mask = BIT(23), |
| 2951 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2952 | .halt_bit = 8, |
| 2953 | }, |
| 2954 | .parent = &vfe_clk.c, |
| 2955 | .c = { |
| 2956 | .dbg_name = "csi1_vfe_clk", |
| 2957 | .ops = &clk_ops_branch, |
| 2958 | CLK_INIT(csi1_vfe_clk.c), |
| 2959 | }, |
| 2960 | }; |
| 2961 | |
| 2962 | /* |
| 2963 | * Low Power Audio Clocks |
| 2964 | */ |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2965 | #define F_AIF_OSR(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2966 | { \ |
| 2967 | .freq_hz = f, \ |
| 2968 | .src_clk = &s##_clk.c, \ |
| 2969 | .md_val = MD8(8, m, 0, n), \ |
| 2970 | .ns_val = NS(31, 24, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2971 | } |
| 2972 | static struct clk_freq_tbl clk_tbl_aif_osr[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2973 | F_AIF_OSR( 0, gnd, 1, 0, 0), |
| 2974 | F_AIF_OSR( 768000, pll4, 4, 1, 176), |
| 2975 | F_AIF_OSR( 1024000, pll4, 4, 1, 132), |
| 2976 | F_AIF_OSR( 1536000, pll4, 4, 1, 88), |
| 2977 | F_AIF_OSR( 2048000, pll4, 4, 1, 66), |
| 2978 | F_AIF_OSR( 3072000, pll4, 4, 1, 44), |
| 2979 | F_AIF_OSR( 4096000, pll4, 4, 1, 33), |
| 2980 | F_AIF_OSR( 6144000, pll4, 4, 1, 22), |
| 2981 | F_AIF_OSR( 8192000, pll4, 2, 1, 33), |
| 2982 | F_AIF_OSR(12288000, pll4, 4, 1, 11), |
| 2983 | F_AIF_OSR(24576000, pll4, 2, 1, 11), |
Matt Wagantall | ac15a37 | 2012-10-10 23:36:20 -0700 | [diff] [blame] | 2984 | F_AIF_OSR(27000000, pxo, 1, 0, 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2985 | F_END |
| 2986 | }; |
| 2987 | |
| 2988 | #define CLK_AIF_OSR(i, ns, md, h_r) \ |
| 2989 | struct rcg_clk i##_clk = { \ |
| 2990 | .b = { \ |
| 2991 | .ctl_reg = ns, \ |
| 2992 | .en_mask = BIT(17), \ |
| 2993 | .reset_reg = ns, \ |
| 2994 | .reset_mask = BIT(19), \ |
| 2995 | .halt_reg = h_r, \ |
| 2996 | .halt_check = ENABLE, \ |
| 2997 | .halt_bit = 1, \ |
| 2998 | }, \ |
| 2999 | .ns_reg = ns, \ |
| 3000 | .md_reg = md, \ |
| 3001 | .root_en_mask = BIT(9), \ |
| 3002 | .ns_mask = (BM(31, 24) | BM(6, 0)), \ |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 3003 | .mnd_en_mask = BIT(8), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3004 | .set_rate = set_rate_mnd, \ |
| 3005 | .freq_tbl = clk_tbl_aif_osr, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3006 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3007 | .c = { \ |
| 3008 | .dbg_name = #i "_clk", \ |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 3009 | .ops = &clk_ops_rcg, \ |
Matt Wagantall | ac15a37 | 2012-10-10 23:36:20 -0700 | [diff] [blame] | 3010 | VDD_DIG_FMAX_MAP1(LOW, 27000000), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3011 | CLK_INIT(i##_clk.c), \ |
| 3012 | }, \ |
| 3013 | } |
| 3014 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3015 | #define CLK_AIF_BIT(i, ns, h_r) \ |
Stephen Boyd | 9fd1964 | 2011-11-16 11:11:09 -0800 | [diff] [blame] | 3016 | struct cdiv_clk i##_clk = { \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3017 | .b = { \ |
| 3018 | .ctl_reg = ns, \ |
| 3019 | .en_mask = BIT(15), \ |
| 3020 | .halt_reg = h_r, \ |
| 3021 | .halt_check = DELAY, \ |
| 3022 | }, \ |
| 3023 | .ns_reg = ns, \ |
Stephen Boyd | 9fd1964 | 2011-11-16 11:11:09 -0800 | [diff] [blame] | 3024 | .ext_mask = BIT(14), \ |
| 3025 | .div_offset = 10, \ |
| 3026 | .max_div = 16, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3027 | .c = { \ |
| 3028 | .dbg_name = #i "_clk", \ |
Stephen Boyd | 9fd1964 | 2011-11-16 11:11:09 -0800 | [diff] [blame] | 3029 | .ops = &clk_ops_cdiv, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3030 | CLK_INIT(i##_clk.c), \ |
Stephen Boyd | d51d5e8 | 2012-06-18 18:09:50 -0700 | [diff] [blame] | 3031 | .rate = ULONG_MAX, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3032 | }, \ |
| 3033 | } |
| 3034 | |
| 3035 | static CLK_AIF_OSR(mi2s_osr, LCC_MI2S_NS_REG, LCC_MI2S_MD_REG, |
| 3036 | LCC_MI2S_STATUS_REG); |
| 3037 | static CLK_AIF_BIT(mi2s_bit, LCC_MI2S_NS_REG, LCC_MI2S_STATUS_REG); |
| 3038 | |
| 3039 | static CLK_AIF_OSR(codec_i2s_mic_osr, LCC_CODEC_I2S_MIC_NS_REG, |
| 3040 | LCC_CODEC_I2S_MIC_MD_REG, LCC_CODEC_I2S_MIC_STATUS_REG); |
| 3041 | static CLK_AIF_BIT(codec_i2s_mic_bit, LCC_CODEC_I2S_MIC_NS_REG, |
| 3042 | LCC_CODEC_I2S_MIC_STATUS_REG); |
| 3043 | |
| 3044 | static CLK_AIF_OSR(spare_i2s_mic_osr, LCC_SPARE_I2S_MIC_NS_REG, |
| 3045 | LCC_SPARE_I2S_MIC_MD_REG, LCC_SPARE_I2S_MIC_STATUS_REG); |
| 3046 | static CLK_AIF_BIT(spare_i2s_mic_bit, LCC_SPARE_I2S_MIC_NS_REG, |
| 3047 | LCC_SPARE_I2S_MIC_STATUS_REG); |
| 3048 | |
| 3049 | static CLK_AIF_OSR(codec_i2s_spkr_osr, LCC_CODEC_I2S_SPKR_NS_REG, |
| 3050 | LCC_CODEC_I2S_SPKR_MD_REG, LCC_CODEC_I2S_SPKR_STATUS_REG); |
| 3051 | static CLK_AIF_BIT(codec_i2s_spkr_bit, LCC_CODEC_I2S_SPKR_NS_REG, |
| 3052 | LCC_CODEC_I2S_SPKR_STATUS_REG); |
| 3053 | |
| 3054 | static CLK_AIF_OSR(spare_i2s_spkr_osr, LCC_SPARE_I2S_SPKR_NS_REG, |
| 3055 | LCC_SPARE_I2S_SPKR_MD_REG, LCC_SPARE_I2S_SPKR_STATUS_REG); |
| 3056 | static CLK_AIF_BIT(spare_i2s_spkr_bit, LCC_SPARE_I2S_SPKR_NS_REG, |
| 3057 | LCC_SPARE_I2S_SPKR_STATUS_REG); |
| 3058 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 3059 | #define F_PCM(f, s, d, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3060 | { \ |
| 3061 | .freq_hz = f, \ |
| 3062 | .src_clk = &s##_clk.c, \ |
| 3063 | .md_val = MD16(m, n), \ |
| 3064 | .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3065 | } |
| 3066 | static struct clk_freq_tbl clk_tbl_pcm[] = { |
Stephen Boyd | 630f325 | 2012-01-31 00:10:08 -0800 | [diff] [blame] | 3067 | { .ns_val = BIT(10) /* external input */ }, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 3068 | F_PCM( 512000, pll4, 4, 1, 264), |
| 3069 | F_PCM( 768000, pll4, 4, 1, 176), |
| 3070 | F_PCM( 1024000, pll4, 4, 1, 132), |
| 3071 | F_PCM( 1536000, pll4, 4, 1, 88), |
| 3072 | F_PCM( 2048000, pll4, 4, 1, 66), |
| 3073 | F_PCM( 3072000, pll4, 4, 1, 44), |
| 3074 | F_PCM( 4096000, pll4, 4, 1, 33), |
| 3075 | F_PCM( 6144000, pll4, 4, 1, 22), |
| 3076 | F_PCM( 8192000, pll4, 2, 1, 33), |
| 3077 | F_PCM(12288000, pll4, 4, 1, 11), |
| 3078 | F_PCM(24580000, pll4, 2, 1, 11), |
Matt Wagantall | ac15a37 | 2012-10-10 23:36:20 -0700 | [diff] [blame] | 3079 | F_PCM(27000000, pxo, 1, 0, 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3080 | F_END |
| 3081 | }; |
| 3082 | |
| 3083 | static struct rcg_clk pcm_clk = { |
| 3084 | .b = { |
| 3085 | .ctl_reg = LCC_PCM_NS_REG, |
| 3086 | .en_mask = BIT(11), |
| 3087 | .reset_reg = LCC_PCM_NS_REG, |
| 3088 | .reset_mask = BIT(13), |
| 3089 | .halt_reg = LCC_PCM_STATUS_REG, |
| 3090 | .halt_check = ENABLE, |
| 3091 | .halt_bit = 0, |
| 3092 | }, |
| 3093 | .ns_reg = LCC_PCM_NS_REG, |
| 3094 | .md_reg = LCC_PCM_MD_REG, |
| 3095 | .root_en_mask = BIT(9), |
Stephen Boyd | 630f325 | 2012-01-31 00:10:08 -0800 | [diff] [blame] | 3096 | .ns_mask = BM(31, 16) | BIT(10) | BM(6, 0), |
Matt Wagantall | 07c4547 | 2012-02-10 23:27:24 -0800 | [diff] [blame] | 3097 | .mnd_en_mask = BIT(8), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3098 | .set_rate = set_rate_mnd, |
| 3099 | .freq_tbl = clk_tbl_pcm, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3100 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3101 | .c = { |
| 3102 | .dbg_name = "pcm_clk", |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 3103 | .ops = &clk_ops_rcg, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 3104 | VDD_DIG_FMAX_MAP1(LOW, 24580000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3105 | CLK_INIT(pcm_clk.c), |
Stephen Boyd | c5492fc | 2012-06-18 18:47:03 -0700 | [diff] [blame] | 3106 | .rate = ULONG_MAX, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3107 | }, |
| 3108 | }; |
| 3109 | |
Matt Wagantall | 735f01a | 2011-08-12 12:40:28 -0700 | [diff] [blame] | 3110 | DEFINE_CLK_RPM(afab_clk, afab_a_clk, APPS_FABRIC, NULL); |
| 3111 | DEFINE_CLK_RPM(cfpb_clk, cfpb_a_clk, CFPB, NULL); |
| 3112 | DEFINE_CLK_RPM(dfab_clk, dfab_a_clk, DAYTONA_FABRIC, NULL); |
| 3113 | DEFINE_CLK_RPM(ebi1_clk, ebi1_a_clk, EBI1, NULL); |
| 3114 | DEFINE_CLK_RPM(mmfab_clk, mmfab_a_clk, MM_FABRIC, NULL); |
| 3115 | DEFINE_CLK_RPM(mmfpb_clk, mmfpb_a_clk, MMFPB, NULL); |
| 3116 | DEFINE_CLK_RPM(sfab_clk, sfab_a_clk, SYSTEM_FABRIC, NULL); |
| 3117 | DEFINE_CLK_RPM(sfpb_clk, sfpb_a_clk, SFPB, NULL); |
Matt Wagantall | f803260 | 2011-06-15 23:01:56 -0700 | [diff] [blame] | 3118 | DEFINE_CLK_RPM(smi_clk, smi_a_clk, SMI, &smi_2x_axi_clk.c); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3119 | |
Matt Wagantall | 35e78fc | 2012-04-05 14:18:44 -0700 | [diff] [blame] | 3120 | static DEFINE_CLK_VOTER(dfab_dsps_clk, &dfab_clk.c, 0); |
| 3121 | static DEFINE_CLK_VOTER(dfab_usb_hs_clk, &dfab_clk.c, 0); |
| 3122 | static DEFINE_CLK_VOTER(dfab_sdc1_clk, &dfab_clk.c, 0); |
| 3123 | static DEFINE_CLK_VOTER(dfab_sdc2_clk, &dfab_clk.c, 0); |
| 3124 | static DEFINE_CLK_VOTER(dfab_sdc3_clk, &dfab_clk.c, 0); |
| 3125 | static DEFINE_CLK_VOTER(dfab_sdc4_clk, &dfab_clk.c, 0); |
| 3126 | static DEFINE_CLK_VOTER(dfab_sdc5_clk, &dfab_clk.c, 0); |
| 3127 | static DEFINE_CLK_VOTER(dfab_scm_clk, &dfab_clk.c, 0); |
Ramesh Masavarapu | ed4e601 | 2012-04-12 16:30:40 -0700 | [diff] [blame] | 3128 | static DEFINE_CLK_VOTER(dfab_qseecom_clk, &dfab_clk.c, 0); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3129 | |
Matt Wagantall | 42cd12a | 2012-03-30 18:02:40 -0700 | [diff] [blame] | 3130 | static DEFINE_CLK_VOTER(ebi1_msmbus_clk, &ebi1_clk.c, LONG_MAX); |
Matt Wagantall | 35e78fc | 2012-04-05 14:18:44 -0700 | [diff] [blame] | 3131 | static DEFINE_CLK_VOTER(ebi1_adm0_clk, &ebi1_clk.c, 0); |
| 3132 | static DEFINE_CLK_VOTER(ebi1_adm1_clk, &ebi1_clk.c, 0); |
Matt Wagantall | 33bac7e | 2012-05-22 14:59:05 -0700 | [diff] [blame] | 3133 | static DEFINE_CLK_VOTER(ebi1_acpu_a_clk, &ebi1_a_clk.c, LONG_MAX); |
| 3134 | static DEFINE_CLK_VOTER(ebi1_msmbus_a_clk, &ebi1_a_clk.c, LONG_MAX); |
| 3135 | static DEFINE_CLK_VOTER(afab_acpu_a_clk, &afab_a_clk.c, LONG_MAX); |
| 3136 | static DEFINE_CLK_VOTER(afab_msmbus_a_clk, &afab_a_clk.c, LONG_MAX); |
| 3137 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3138 | static DEFINE_CLK_MEASURE(sc0_m_clk); |
| 3139 | static DEFINE_CLK_MEASURE(sc1_m_clk); |
| 3140 | static DEFINE_CLK_MEASURE(l2_m_clk); |
| 3141 | |
| 3142 | #ifdef CONFIG_DEBUG_FS |
| 3143 | struct measure_sel { |
| 3144 | u32 test_vector; |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3145 | struct clk *c; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3146 | }; |
| 3147 | |
| 3148 | static struct measure_sel measure_mux[] = { |
| 3149 | { TEST_PER_LS(0x08), &modem_ahb1_p_clk.c }, |
| 3150 | { TEST_PER_LS(0x09), &modem_ahb2_p_clk.c }, |
| 3151 | { TEST_PER_LS(0x12), &sdc1_p_clk.c }, |
| 3152 | { TEST_PER_LS(0x13), &sdc1_clk.c }, |
| 3153 | { TEST_PER_LS(0x14), &sdc2_p_clk.c }, |
| 3154 | { TEST_PER_LS(0x15), &sdc2_clk.c }, |
| 3155 | { TEST_PER_LS(0x16), &sdc3_p_clk.c }, |
| 3156 | { TEST_PER_LS(0x17), &sdc3_clk.c }, |
| 3157 | { TEST_PER_LS(0x18), &sdc4_p_clk.c }, |
| 3158 | { TEST_PER_LS(0x19), &sdc4_clk.c }, |
| 3159 | { TEST_PER_LS(0x1A), &sdc5_p_clk.c }, |
| 3160 | { TEST_PER_LS(0x1B), &sdc5_clk.c }, |
Matt Wagantall | 66cd093 | 2011-09-12 19:04:34 -0700 | [diff] [blame] | 3161 | { TEST_PER_LS(0x1D), &ebi2_2x_clk.c }, |
| 3162 | { TEST_PER_LS(0x1E), &ebi2_clk.c }, |
Matt Wagantall | 7625a4c | 2011-11-01 16:17:53 -0700 | [diff] [blame] | 3163 | { TEST_PER_LS(0x1F), &gp0_clk.c }, |
| 3164 | { TEST_PER_LS(0x20), &gp1_clk.c }, |
| 3165 | { TEST_PER_LS(0x21), &gp2_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3166 | { TEST_PER_LS(0x25), &dfab_clk.c }, |
| 3167 | { TEST_PER_LS(0x25), &dfab_a_clk.c }, |
| 3168 | { TEST_PER_LS(0x26), &pmem_clk.c }, |
| 3169 | { TEST_PER_LS(0x2B), &ppss_p_clk.c }, |
| 3170 | { TEST_PER_LS(0x33), &cfpb_clk.c }, |
| 3171 | { TEST_PER_LS(0x33), &cfpb_a_clk.c }, |
| 3172 | { TEST_PER_LS(0x3D), &gsbi1_p_clk.c }, |
| 3173 | { TEST_PER_LS(0x3E), &gsbi1_uart_clk.c }, |
| 3174 | { TEST_PER_LS(0x3F), &gsbi1_qup_clk.c }, |
| 3175 | { TEST_PER_LS(0x41), &gsbi2_p_clk.c }, |
| 3176 | { TEST_PER_LS(0x42), &gsbi2_uart_clk.c }, |
| 3177 | { TEST_PER_LS(0x44), &gsbi2_qup_clk.c }, |
| 3178 | { TEST_PER_LS(0x45), &gsbi3_p_clk.c }, |
| 3179 | { TEST_PER_LS(0x46), &gsbi3_uart_clk.c }, |
| 3180 | { TEST_PER_LS(0x48), &gsbi3_qup_clk.c }, |
| 3181 | { TEST_PER_LS(0x49), &gsbi4_p_clk.c }, |
| 3182 | { TEST_PER_LS(0x4A), &gsbi4_uart_clk.c }, |
| 3183 | { TEST_PER_LS(0x4C), &gsbi4_qup_clk.c }, |
| 3184 | { TEST_PER_LS(0x4D), &gsbi5_p_clk.c }, |
| 3185 | { TEST_PER_LS(0x4E), &gsbi5_uart_clk.c }, |
| 3186 | { TEST_PER_LS(0x50), &gsbi5_qup_clk.c }, |
| 3187 | { TEST_PER_LS(0x51), &gsbi6_p_clk.c }, |
| 3188 | { TEST_PER_LS(0x52), &gsbi6_uart_clk.c }, |
| 3189 | { TEST_PER_LS(0x54), &gsbi6_qup_clk.c }, |
| 3190 | { TEST_PER_LS(0x55), &gsbi7_p_clk.c }, |
| 3191 | { TEST_PER_LS(0x56), &gsbi7_uart_clk.c }, |
| 3192 | { TEST_PER_LS(0x58), &gsbi7_qup_clk.c }, |
| 3193 | { TEST_PER_LS(0x59), &gsbi8_p_clk.c }, |
| 3194 | { TEST_PER_LS(0x5A), &gsbi8_uart_clk.c }, |
| 3195 | { TEST_PER_LS(0x5C), &gsbi8_qup_clk.c }, |
| 3196 | { TEST_PER_LS(0x5D), &gsbi9_p_clk.c }, |
| 3197 | { TEST_PER_LS(0x5E), &gsbi9_uart_clk.c }, |
| 3198 | { TEST_PER_LS(0x60), &gsbi9_qup_clk.c }, |
| 3199 | { TEST_PER_LS(0x61), &gsbi10_p_clk.c }, |
| 3200 | { TEST_PER_LS(0x62), &gsbi10_uart_clk.c }, |
| 3201 | { TEST_PER_LS(0x64), &gsbi10_qup_clk.c }, |
| 3202 | { TEST_PER_LS(0x65), &gsbi11_p_clk.c }, |
| 3203 | { TEST_PER_LS(0x66), &gsbi11_uart_clk.c }, |
| 3204 | { TEST_PER_LS(0x68), &gsbi11_qup_clk.c }, |
| 3205 | { TEST_PER_LS(0x69), &gsbi12_p_clk.c }, |
| 3206 | { TEST_PER_LS(0x6A), &gsbi12_uart_clk.c }, |
| 3207 | { TEST_PER_LS(0x6C), &gsbi12_qup_clk.c }, |
| 3208 | { TEST_PER_LS(0x78), &sfpb_clk.c }, |
| 3209 | { TEST_PER_LS(0x78), &sfpb_a_clk.c }, |
| 3210 | { TEST_PER_LS(0x7A), &pmic_ssbi2_clk.c }, |
| 3211 | { TEST_PER_LS(0x7B), &pmic_arb0_p_clk.c }, |
| 3212 | { TEST_PER_LS(0x7C), &pmic_arb1_p_clk.c }, |
| 3213 | { TEST_PER_LS(0x7D), &prng_clk.c }, |
| 3214 | { TEST_PER_LS(0x7F), &rpm_msg_ram_p_clk.c }, |
| 3215 | { TEST_PER_LS(0x80), &adm0_p_clk.c }, |
| 3216 | { TEST_PER_LS(0x81), &adm1_p_clk.c }, |
| 3217 | { TEST_PER_LS(0x84), &usb_hs1_p_clk.c }, |
| 3218 | { TEST_PER_LS(0x85), &usb_hs1_xcvr_clk.c }, |
| 3219 | { TEST_PER_LS(0x89), &usb_fs1_p_clk.c }, |
| 3220 | { TEST_PER_LS(0x8A), &usb_fs1_sys_clk.c }, |
| 3221 | { TEST_PER_LS(0x8B), &usb_fs1_xcvr_clk.c }, |
| 3222 | { TEST_PER_LS(0x8C), &usb_fs2_p_clk.c }, |
| 3223 | { TEST_PER_LS(0x8D), &usb_fs2_sys_clk.c }, |
| 3224 | { TEST_PER_LS(0x8E), &usb_fs2_xcvr_clk.c }, |
| 3225 | { TEST_PER_LS(0x8F), &tsif_p_clk.c }, |
| 3226 | { TEST_PER_LS(0x91), &tsif_ref_clk.c }, |
| 3227 | { TEST_PER_LS(0x93), &ce2_p_clk.c }, |
| 3228 | { TEST_PER_LS(0x94), &tssc_clk.c }, |
| 3229 | |
| 3230 | { TEST_PER_HS(0x07), &afab_clk.c }, |
| 3231 | { TEST_PER_HS(0x07), &afab_a_clk.c }, |
| 3232 | { TEST_PER_HS(0x18), &sfab_clk.c }, |
| 3233 | { TEST_PER_HS(0x18), &sfab_a_clk.c }, |
| 3234 | { TEST_PER_HS(0x2A), &adm0_clk.c }, |
| 3235 | { TEST_PER_HS(0x2B), &adm1_clk.c }, |
| 3236 | { TEST_PER_HS(0x34), &ebi1_clk.c }, |
| 3237 | { TEST_PER_HS(0x34), &ebi1_a_clk.c }, |
| 3238 | |
| 3239 | { TEST_MM_LS(0x00), &dsi_byte_clk.c }, |
| 3240 | { TEST_MM_LS(0x01), &pixel_lcdc_clk.c }, |
| 3241 | { TEST_MM_LS(0x04), &pixel_mdp_clk.c }, |
| 3242 | { TEST_MM_LS(0x06), &_p_clk.c }, |
| 3243 | { TEST_MM_LS(0x07), &csi0_p_clk.c }, |
| 3244 | { TEST_MM_LS(0x08), &csi1_p_clk.c }, |
| 3245 | { TEST_MM_LS(0x09), &dsi_m_p_clk.c }, |
| 3246 | { TEST_MM_LS(0x0A), &dsi_s_p_clk.c }, |
| 3247 | { TEST_MM_LS(0x0C), &gfx2d0_p_clk.c }, |
| 3248 | { TEST_MM_LS(0x0D), &gfx2d1_p_clk.c }, |
| 3249 | { TEST_MM_LS(0x0E), &gfx3d_p_clk.c }, |
| 3250 | { TEST_MM_LS(0x0F), &hdmi_m_p_clk.c }, |
| 3251 | { TEST_MM_LS(0x10), &hdmi_s_p_clk.c }, |
| 3252 | { TEST_MM_LS(0x11), &ijpeg_p_clk.c }, |
| 3253 | { TEST_MM_LS(0x12), &imem_p_clk.c }, |
| 3254 | { TEST_MM_LS(0x13), &jpegd_p_clk.c }, |
| 3255 | { TEST_MM_LS(0x14), &mdp_p_clk.c }, |
| 3256 | { TEST_MM_LS(0x16), &rot_p_clk.c }, |
| 3257 | { TEST_MM_LS(0x18), &smmu_p_clk.c }, |
| 3258 | { TEST_MM_LS(0x19), &tv_enc_p_clk.c }, |
| 3259 | { TEST_MM_LS(0x1A), &vcodec_p_clk.c }, |
| 3260 | { TEST_MM_LS(0x1B), &vfe_p_clk.c }, |
| 3261 | { TEST_MM_LS(0x1C), &vpe_p_clk.c }, |
| 3262 | { TEST_MM_LS(0x1D), &cam_clk.c }, |
| 3263 | { TEST_MM_LS(0x1F), &hdmi_app_clk.c }, |
| 3264 | { TEST_MM_LS(0x20), &mdp_vsync_clk.c }, |
| 3265 | { TEST_MM_LS(0x21), &tv_dac_clk.c }, |
| 3266 | { TEST_MM_LS(0x22), &tv_enc_clk.c }, |
| 3267 | { TEST_MM_LS(0x23), &dsi_esc_clk.c }, |
| 3268 | { TEST_MM_LS(0x25), &mmfpb_clk.c }, |
| 3269 | { TEST_MM_LS(0x25), &mmfpb_a_clk.c }, |
| 3270 | |
| 3271 | { TEST_MM_HS(0x00), &csi0_clk.c }, |
| 3272 | { TEST_MM_HS(0x01), &csi1_clk.c }, |
| 3273 | { TEST_MM_HS(0x03), &csi0_vfe_clk.c }, |
| 3274 | { TEST_MM_HS(0x04), &csi1_vfe_clk.c }, |
| 3275 | { TEST_MM_HS(0x05), &ijpeg_clk.c }, |
| 3276 | { TEST_MM_HS(0x06), &vfe_clk.c }, |
| 3277 | { TEST_MM_HS(0x07), &gfx2d0_clk.c }, |
| 3278 | { TEST_MM_HS(0x08), &gfx2d1_clk.c }, |
| 3279 | { TEST_MM_HS(0x09), &gfx3d_clk.c }, |
| 3280 | { TEST_MM_HS(0x0A), &jpegd_clk.c }, |
| 3281 | { TEST_MM_HS(0x0B), &vcodec_clk.c }, |
| 3282 | { TEST_MM_HS(0x0F), &mmfab_clk.c }, |
| 3283 | { TEST_MM_HS(0x0F), &mmfab_a_clk.c }, |
| 3284 | { TEST_MM_HS(0x11), &gmem_axi_clk.c }, |
| 3285 | { TEST_MM_HS(0x12), &ijpeg_axi_clk.c }, |
| 3286 | { TEST_MM_HS(0x13), &imem_axi_clk.c }, |
| 3287 | { TEST_MM_HS(0x14), &jpegd_axi_clk.c }, |
| 3288 | { TEST_MM_HS(0x15), &mdp_axi_clk.c }, |
Matt Wagantall | f63a889 | 2011-06-15 16:44:46 -0700 | [diff] [blame] | 3289 | { TEST_MM_HS(0x16), &rot_axi_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3290 | { TEST_MM_HS(0x17), &vcodec_axi_clk.c }, |
| 3291 | { TEST_MM_HS(0x18), &vfe_axi_clk.c }, |
Matt Wagantall | f63a889 | 2011-06-15 16:44:46 -0700 | [diff] [blame] | 3292 | { TEST_MM_HS(0x19), &vpe_axi_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3293 | { TEST_MM_HS(0x1A), &mdp_clk.c }, |
| 3294 | { TEST_MM_HS(0x1B), &rot_clk.c }, |
| 3295 | { TEST_MM_HS(0x1C), &vpe_clk.c }, |
| 3296 | { TEST_MM_HS(0x1E), &hdmi_tv_clk.c }, |
| 3297 | { TEST_MM_HS(0x1F), &mdp_tv_clk.c }, |
Matt Wagantall | f803260 | 2011-06-15 23:01:56 -0700 | [diff] [blame] | 3298 | { TEST_MM_HS(0x24), &smi_2x_axi_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3299 | |
| 3300 | { TEST_MM_HS2X(0x24), &smi_clk.c }, |
| 3301 | { TEST_MM_HS2X(0x24), &smi_a_clk.c }, |
| 3302 | |
| 3303 | { TEST_LPA(0x0A), &mi2s_osr_clk.c }, |
| 3304 | { TEST_LPA(0x0B), &mi2s_bit_clk.c }, |
| 3305 | { TEST_LPA(0x0C), &codec_i2s_mic_osr_clk.c }, |
| 3306 | { TEST_LPA(0x0D), &codec_i2s_mic_bit_clk.c }, |
| 3307 | { TEST_LPA(0x0E), &codec_i2s_spkr_osr_clk.c }, |
| 3308 | { TEST_LPA(0x0F), &codec_i2s_spkr_bit_clk.c }, |
| 3309 | { TEST_LPA(0x10), &spare_i2s_mic_osr_clk.c }, |
| 3310 | { TEST_LPA(0x11), &spare_i2s_mic_bit_clk.c }, |
| 3311 | { TEST_LPA(0x12), &spare_i2s_spkr_osr_clk.c }, |
| 3312 | { TEST_LPA(0x13), &spare_i2s_spkr_bit_clk.c }, |
| 3313 | { TEST_LPA(0x14), &pcm_clk.c }, |
| 3314 | |
| 3315 | { TEST_SC(0x40), &sc0_m_clk }, |
| 3316 | { TEST_SC(0x41), &sc1_m_clk }, |
| 3317 | { TEST_SC(0x42), &l2_m_clk }, |
| 3318 | }; |
| 3319 | |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3320 | static struct measure_sel *find_measure_sel(struct clk *c) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3321 | { |
| 3322 | int i; |
| 3323 | |
| 3324 | for (i = 0; i < ARRAY_SIZE(measure_mux); i++) |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3325 | if (measure_mux[i].c == c) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3326 | return &measure_mux[i]; |
| 3327 | return NULL; |
| 3328 | } |
| 3329 | |
| 3330 | static int measure_clk_set_parent(struct clk *c, struct clk *parent) |
| 3331 | { |
| 3332 | int ret = 0; |
| 3333 | u32 clk_sel; |
| 3334 | struct measure_sel *p; |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3335 | struct measure_clk *measure = to_measure_clk(c); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3336 | unsigned long flags; |
| 3337 | |
| 3338 | if (!parent) |
| 3339 | return -EINVAL; |
| 3340 | |
| 3341 | p = find_measure_sel(parent); |
| 3342 | if (!p) |
| 3343 | return -EINVAL; |
| 3344 | |
| 3345 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 3346 | |
| 3347 | /* |
| 3348 | * Program the test vector, measurement period (sample_ticks) |
| 3349 | * and scaling factors (multiplier, divider). |
| 3350 | */ |
| 3351 | clk_sel = p->test_vector & TEST_CLK_SEL_MASK; |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3352 | measure->sample_ticks = 0x10000; |
| 3353 | measure->multiplier = 1; |
| 3354 | measure->divider = 1; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3355 | switch (p->test_vector >> TEST_TYPE_SHIFT) { |
| 3356 | case TEST_TYPE_PER_LS: |
| 3357 | writel_relaxed(0x4030D00|BVAL(7, 0, clk_sel), CLK_TEST_REG); |
| 3358 | break; |
| 3359 | case TEST_TYPE_PER_HS: |
| 3360 | writel_relaxed(0x4020000|BVAL(16, 10, clk_sel), CLK_TEST_REG); |
| 3361 | break; |
| 3362 | case TEST_TYPE_MM_LS: |
| 3363 | writel_relaxed(0x4030D97, CLK_TEST_REG); |
| 3364 | writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_LS_REG); |
| 3365 | break; |
| 3366 | case TEST_TYPE_MM_HS2X: |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3367 | measure->divider = 2; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3368 | case TEST_TYPE_MM_HS: |
| 3369 | writel_relaxed(0x402B800, CLK_TEST_REG); |
| 3370 | writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_HS_REG); |
| 3371 | break; |
| 3372 | case TEST_TYPE_LPA: |
| 3373 | writel_relaxed(0x4030D98, CLK_TEST_REG); |
| 3374 | writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), |
| 3375 | LCC_CLK_LS_DEBUG_CFG_REG); |
| 3376 | break; |
| 3377 | case TEST_TYPE_SC: |
| 3378 | writel_relaxed(0x5020000|BVAL(16, 10, clk_sel), CLK_TEST_REG); |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3379 | measure->sample_ticks = 0x4000; |
| 3380 | measure->multiplier = 2; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3381 | break; |
| 3382 | default: |
| 3383 | ret = -EPERM; |
| 3384 | } |
| 3385 | /* Make sure test vector is set before starting measurements. */ |
| 3386 | mb(); |
| 3387 | |
| 3388 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 3389 | |
| 3390 | return ret; |
| 3391 | } |
| 3392 | |
| 3393 | /* Sample clock for 'ticks' reference clock ticks. */ |
| 3394 | static u32 run_measurement(unsigned ticks) |
| 3395 | { |
| 3396 | /* Stop counters and set the XO4 counter start value. */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3397 | writel_relaxed(ticks, RINGOSC_TCXO_CTL_REG); |
| 3398 | |
| 3399 | /* Wait for timer to become ready. */ |
| 3400 | while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) != 0) |
| 3401 | cpu_relax(); |
| 3402 | |
| 3403 | /* Run measurement and wait for completion. */ |
| 3404 | writel_relaxed(BIT(20)|ticks, RINGOSC_TCXO_CTL_REG); |
| 3405 | while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) == 0) |
| 3406 | cpu_relax(); |
| 3407 | |
| 3408 | /* Stop counters. */ |
| 3409 | writel_relaxed(0x0, RINGOSC_TCXO_CTL_REG); |
| 3410 | |
| 3411 | /* Return measured ticks. */ |
| 3412 | return readl_relaxed(RINGOSC_STATUS_REG) & BM(24, 0); |
| 3413 | } |
| 3414 | |
| 3415 | /* Perform a hardware rate measurement for a given clock. |
| 3416 | FOR DEBUG USE ONLY: Measurements take ~15 ms! */ |
Matt Wagantall | 9de3bfb | 2011-11-03 20:13:12 -0700 | [diff] [blame] | 3417 | static unsigned long measure_clk_get_rate(struct clk *c) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3418 | { |
| 3419 | unsigned long flags; |
| 3420 | u32 pdm_reg_backup, ringosc_reg_backup; |
| 3421 | u64 raw_count_short, raw_count_full; |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3422 | struct measure_clk *measure = to_measure_clk(c); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3423 | unsigned ret; |
| 3424 | |
| 3425 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 3426 | |
| 3427 | /* Enable CXO/4 and RINGOSC branch and root. */ |
| 3428 | pdm_reg_backup = readl_relaxed(PDM_CLK_NS_REG); |
| 3429 | ringosc_reg_backup = readl_relaxed(RINGOSC_NS_REG); |
| 3430 | writel_relaxed(0x2898, PDM_CLK_NS_REG); |
| 3431 | writel_relaxed(0xA00, RINGOSC_NS_REG); |
| 3432 | |
| 3433 | /* |
| 3434 | * The ring oscillator counter will not reset if the measured clock |
| 3435 | * is not running. To detect this, run a short measurement before |
| 3436 | * the full measurement. If the raw results of the two are the same |
| 3437 | * then the clock must be off. |
| 3438 | */ |
| 3439 | |
| 3440 | /* Run a short measurement. (~1 ms) */ |
| 3441 | raw_count_short = run_measurement(0x1000); |
| 3442 | /* Run a full measurement. (~14 ms) */ |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3443 | raw_count_full = run_measurement(measure->sample_ticks); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3444 | |
| 3445 | writel_relaxed(ringosc_reg_backup, RINGOSC_NS_REG); |
| 3446 | writel_relaxed(pdm_reg_backup, PDM_CLK_NS_REG); |
| 3447 | |
| 3448 | /* Return 0 if the clock is off. */ |
| 3449 | if (raw_count_full == raw_count_short) |
| 3450 | ret = 0; |
| 3451 | else { |
| 3452 | /* Compute rate in Hz. */ |
| 3453 | raw_count_full = ((raw_count_full * 10) + 15) * 4800000; |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3454 | do_div(raw_count_full, (((measure->sample_ticks * 10) + 35) |
| 3455 | * measure->divider)); |
| 3456 | ret = (raw_count_full * measure->multiplier); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3457 | } |
| 3458 | |
| 3459 | /* Route dbg_hs_clk to PLLTEST. 300mV single-ended amplitude. */ |
| 3460 | writel_relaxed(0x3CF8, PLLTEST_PAD_CFG_REG); |
| 3461 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 3462 | |
| 3463 | return ret; |
| 3464 | } |
| 3465 | #else /* !CONFIG_DEBUG_FS */ |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3466 | static int measure_clk_set_parent(struct clk *c, struct clk *parent) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3467 | { |
| 3468 | return -EINVAL; |
| 3469 | } |
| 3470 | |
Matt Wagantall | f82f294 | 2012-01-27 13:56:13 -0800 | [diff] [blame] | 3471 | static unsigned long measure_clk_get_rate(struct clk *c) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3472 | { |
| 3473 | return 0; |
| 3474 | } |
| 3475 | #endif /* CONFIG_DEBUG_FS */ |
| 3476 | |
Matt Wagantall | ae05322 | 2012-05-14 19:42:07 -0700 | [diff] [blame] | 3477 | static struct clk_ops clk_ops_measure = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3478 | .set_parent = measure_clk_set_parent, |
| 3479 | .get_rate = measure_clk_get_rate, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3480 | }; |
| 3481 | |
| 3482 | static struct measure_clk measure_clk = { |
| 3483 | .c = { |
| 3484 | .dbg_name = "measure_clk", |
Matt Wagantall | ae05322 | 2012-05-14 19:42:07 -0700 | [diff] [blame] | 3485 | .ops = &clk_ops_measure, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3486 | CLK_INIT(measure_clk.c), |
| 3487 | }, |
| 3488 | .multiplier = 1, |
| 3489 | .divider = 1, |
| 3490 | }; |
| 3491 | |
| 3492 | static struct clk_lookup msm_clocks_8x60[] = { |
Stephen Boyd | 72a8035 | 2012-01-26 15:57:38 -0800 | [diff] [blame] | 3493 | CLK_LOOKUP("xo", cxo_clk.c, ""), |
| 3494 | CLK_LOOKUP("xo", cxo_a_clk.c, ""), |
| 3495 | CLK_LOOKUP("xo", pxo_a_clk.c, ""), |
Stephen Boyd | 6703653 | 2012-01-26 15:43:51 -0800 | [diff] [blame] | 3496 | CLK_LOOKUP("xo", pxo_clk.c, "pil_modem"), |
David Collins | a7d2353 | 2012-08-02 10:48:16 -0700 | [diff] [blame] | 3497 | CLK_LOOKUP("vref_buff", cxo_clk.c, "rpm-regulator"), |
Stephen Boyd | 3acc9e4 | 2011-09-28 16:46:40 -0700 | [diff] [blame] | 3498 | CLK_LOOKUP("pll4", pll4_clk.c, "pil_qdsp6v3"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3499 | CLK_LOOKUP("measure", measure_clk.c, "debug"), |
| 3500 | |
Matt Wagantall | d75f131 | 2012-05-23 16:17:35 -0700 | [diff] [blame] | 3501 | CLK_LOOKUP("bus_clk", afab_clk.c, ""), |
| 3502 | CLK_LOOKUP("bus_clk", afab_a_clk.c, ""), |
| 3503 | CLK_LOOKUP("bus_clk", cfpb_clk.c, ""), |
| 3504 | CLK_LOOKUP("bus_clk", cfpb_a_clk.c, ""), |
| 3505 | CLK_LOOKUP("bus_clk", dfab_clk.c, ""), |
| 3506 | CLK_LOOKUP("bus_clk", dfab_a_clk.c, ""), |
| 3507 | CLK_LOOKUP("mem_clk", ebi1_clk.c, ""), |
| 3508 | CLK_LOOKUP("mem_clk", ebi1_a_clk.c, ""), |
| 3509 | CLK_LOOKUP("bus_clk", mmfab_clk.c, ""), |
| 3510 | CLK_LOOKUP("bus_clk", mmfab_a_clk.c, ""), |
| 3511 | CLK_LOOKUP("bus_clk", mmfpb_clk.c, ""), |
| 3512 | CLK_LOOKUP("bus_clk", mmfpb_a_clk.c, ""), |
| 3513 | CLK_LOOKUP("bus_clk", sfab_clk.c, ""), |
| 3514 | CLK_LOOKUP("bus_clk", sfab_a_clk.c, ""), |
| 3515 | CLK_LOOKUP("bus_clk", sfpb_clk.c, ""), |
| 3516 | CLK_LOOKUP("bus_clk", sfpb_a_clk.c, ""), |
| 3517 | CLK_LOOKUP("mem_clk", smi_clk.c, ""), |
| 3518 | CLK_LOOKUP("mem_clk", smi_a_clk.c, ""), |
| 3519 | |
Matt Wagantall | b2710b8 | 2011-11-16 19:55:17 -0800 | [diff] [blame] | 3520 | CLK_LOOKUP("bus_clk", afab_clk.c, "msm_apps_fab"), |
Matt Wagantall | 33bac7e | 2012-05-22 14:59:05 -0700 | [diff] [blame] | 3521 | CLK_LOOKUP("bus_a_clk", afab_msmbus_a_clk.c, "msm_apps_fab"), |
Matt Wagantall | b2710b8 | 2011-11-16 19:55:17 -0800 | [diff] [blame] | 3522 | CLK_LOOKUP("bus_clk", sfab_clk.c, "msm_sys_fab"), |
| 3523 | CLK_LOOKUP("bus_a_clk", sfab_a_clk.c, "msm_sys_fab"), |
| 3524 | CLK_LOOKUP("bus_clk", sfpb_clk.c, "msm_sys_fpb"), |
| 3525 | CLK_LOOKUP("bus_a_clk", sfpb_a_clk.c, "msm_sys_fpb"), |
| 3526 | CLK_LOOKUP("bus_clk", mmfab_clk.c, "msm_mm_fab"), |
| 3527 | CLK_LOOKUP("bus_a_clk", mmfab_a_clk.c, "msm_mm_fab"), |
| 3528 | CLK_LOOKUP("bus_clk", cfpb_clk.c, "msm_cpss_fpb"), |
| 3529 | CLK_LOOKUP("bus_a_clk", cfpb_a_clk.c, "msm_cpss_fpb"), |
| 3530 | CLK_LOOKUP("mem_clk", ebi1_msmbus_clk.c, "msm_bus"), |
Matt Wagantall | 33bac7e | 2012-05-22 14:59:05 -0700 | [diff] [blame] | 3531 | CLK_LOOKUP("mem_a_clk", ebi1_msmbus_a_clk.c, "msm_bus"), |
Matt Wagantall | b2710b8 | 2011-11-16 19:55:17 -0800 | [diff] [blame] | 3532 | CLK_LOOKUP("smi_clk", smi_clk.c, "msm_bus"), |
| 3533 | CLK_LOOKUP("smi_a_clk", smi_a_clk.c, "msm_bus"), |
Stephen Boyd | 279196e | 2012-07-12 16:09:02 -0700 | [diff] [blame] | 3534 | CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, "clock-8x60"), |
Matt Wagantall | b2710b8 | 2011-11-16 19:55:17 -0800 | [diff] [blame] | 3535 | |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3536 | CLK_LOOKUP("core_clk", gp0_clk.c, ""), |
| 3537 | CLK_LOOKUP("core_clk", gp1_clk.c, ""), |
| 3538 | CLK_LOOKUP("core_clk", gp2_clk.c, ""), |
| 3539 | CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, ""), |
| 3540 | CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, ""), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 3541 | CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, "msm_serial_hsl.2"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3542 | CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, ""), |
| 3543 | CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, ""), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 3544 | CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3545 | CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, ""), |
| 3546 | CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, ""), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 3547 | CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, "msm_serial_hsl.1"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3548 | CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, ""), |
| 3549 | CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, ""), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 3550 | CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, "msm_serial_hsl.0"), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 3551 | CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3552 | CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 3553 | CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.0"), |
| 3554 | CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.1"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3555 | CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, ""), |
| 3556 | CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 3557 | CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, "qup_i2c.4"), |
| 3558 | CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, "qup_i2c.3"), |
| 3559 | CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, "qup_i2c.2"), |
| 3560 | CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "spi_qsd.1"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3561 | CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, ""), |
Wentao Xu | 4a05304 | 2011-10-03 14:06:34 -0400 | [diff] [blame] | 3562 | CLK_LOOKUP("gsbi_qup_clk", gsbi12_qup_clk.c, "msm_dsps"), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 3563 | CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.5"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3564 | CLK_LOOKUP("core_clk", pdm_clk.c, ""), |
Wentao Xu | 4a05304 | 2011-10-03 14:06:34 -0400 | [diff] [blame] | 3565 | CLK_LOOKUP("mem_clk", pmem_clk.c, "msm_dsps"), |
Matt Wagantall | c120529 | 2011-08-11 17:19:31 -0700 | [diff] [blame] | 3566 | CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"), |
Matt Wagantall | 37ce384 | 2011-08-17 16:00:36 -0700 | [diff] [blame] | 3567 | CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"), |
| 3568 | CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"), |
| 3569 | CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"), |
| 3570 | CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"), |
| 3571 | CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"), |
Matt Wagantall | 640e5fd | 2011-08-17 16:08:53 -0700 | [diff] [blame] | 3572 | CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.0"), |
| 3573 | CLK_LOOKUP("ref_clk", tsif_ref_clk.c, "msm_tsif.1"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3574 | CLK_LOOKUP("core_clk", tssc_clk.c, ""), |
Manu Gautam | 5143b25 | 2012-01-05 19:25:23 -0800 | [diff] [blame] | 3575 | CLK_LOOKUP("alt_core_clk", usb_hs1_xcvr_clk.c, "msm_otg"), |
| 3576 | CLK_LOOKUP("phy_clk", usb_phy0_clk.c, "msm_otg"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3577 | CLK_LOOKUP("alt_core_clk", usb_fs1_xcvr_clk.c, ""), |
| 3578 | CLK_LOOKUP("sys_clk", usb_fs1_sys_clk.c, ""), |
| 3579 | CLK_LOOKUP("src_clk", usb_fs1_src_clk.c, ""), |
| 3580 | CLK_LOOKUP("alt_core_clk", usb_fs2_xcvr_clk.c, ""), |
| 3581 | CLK_LOOKUP("sys_clk", usb_fs2_sys_clk.c, ""), |
| 3582 | CLK_LOOKUP("src_clk", usb_fs2_src_clk.c, ""), |
Matt Wagantall | c4b3a4d | 2011-08-17 16:58:39 -0700 | [diff] [blame] | 3583 | CLK_LOOKUP("core_clk", ce2_p_clk.c, "qce.0"), |
Matt Wagantall | e0b1145 | 2011-09-13 17:25:33 -0700 | [diff] [blame] | 3584 | CLK_LOOKUP("core_clk", ce2_p_clk.c, "qcrypto.0"), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 3585 | CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3586 | CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 3587 | CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "msm_serial_hsl.2"), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 3588 | CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.0"), |
| 3589 | CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.1"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3590 | CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, ""), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 3591 | CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 3592 | CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, "qup_i2c.4"), |
| 3593 | CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, "qup_i2c.3"), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 3594 | CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "msm_serial_hsl.1"), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 3595 | CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, "qup_i2c.2"), |
| 3596 | CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "spi_qsd.1"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3597 | CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, ""), |
| 3598 | CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, ""), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 3599 | CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "msm_serial_hsl.0"), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 3600 | CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.5"), |
Matt Wagantall | 5bb16ca | 2012-04-19 11:34:01 -0700 | [diff] [blame] | 3601 | CLK_LOOKUP("iface_clk", ppss_p_clk.c, "msm_dsps"), |
Matt Wagantall | 640e5fd | 2011-08-17 16:08:53 -0700 | [diff] [blame] | 3602 | CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.0"), |
| 3603 | CLK_LOOKUP("iface_clk", tsif_p_clk.c, "msm_tsif.1"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3604 | CLK_LOOKUP("iface_clk", usb_fs1_p_clk.c, ""), |
| 3605 | CLK_LOOKUP("iface_clk", usb_fs2_p_clk.c, ""), |
Manu Gautam | 5143b25 | 2012-01-05 19:25:23 -0800 | [diff] [blame] | 3606 | CLK_LOOKUP("iface_clk", usb_hs1_p_clk.c, "msm_otg"), |
Matt Wagantall | 37ce384 | 2011-08-17 16:00:36 -0700 | [diff] [blame] | 3607 | CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"), |
| 3608 | CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"), |
| 3609 | CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"), |
| 3610 | CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"), |
| 3611 | CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3612 | CLK_LOOKUP("mem_clk", ebi2_2x_clk.c, ""), |
Terence Hampson | b36a38c | 2011-09-19 19:10:40 -0400 | [diff] [blame] | 3613 | CLK_LOOKUP("mem_clk", ebi2_clk.c, "msm_ebi2"), |
Matt Wagantall | e1a8606 | 2011-08-18 17:46:10 -0700 | [diff] [blame] | 3614 | CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov.0"), |
| 3615 | CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov.0"), |
| 3616 | CLK_LOOKUP("core_clk", adm1_clk.c, "msm_dmov.1"), |
| 3617 | CLK_LOOKUP("iface_clk", adm1_p_clk.c, "msm_dmov.1"), |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3618 | CLK_LOOKUP("iface_clk", modem_ahb1_p_clk.c, ""), |
| 3619 | CLK_LOOKUP("iface_clk", modem_ahb2_p_clk.c, ""), |
| 3620 | CLK_LOOKUP("iface_clk", pmic_arb0_p_clk.c, ""), |
| 3621 | CLK_LOOKUP("iface_clk", pmic_arb1_p_clk.c, ""), |
| 3622 | CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""), |
| 3623 | CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3624 | CLK_LOOKUP("cam_clk", cam_clk.c, NULL), |
| 3625 | CLK_LOOKUP("csi_clk", csi0_clk.c, NULL), |
| 3626 | CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_camera_ov7692.0"), |
| 3627 | CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_camera_ov9726.0"), |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 3628 | CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csic.1"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3629 | CLK_LOOKUP("csi_src_clk", csi_src_clk.c, NULL), |
Ravishangar Kalyanam | 1b064f5 | 2012-03-15 18:17:54 -0700 | [diff] [blame] | 3630 | CLK_LOOKUP("byte_clk", dsi_byte_clk.c, "mipi_dsi.1"), |
| 3631 | CLK_LOOKUP("esc_clk", dsi_esc_clk.c, "mipi_dsi.1"), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 3632 | CLK_LOOKUP("core_clk", gfx2d0_clk.c, "kgsl-2d0.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3633 | CLK_LOOKUP("core_clk", gfx2d0_clk.c, "footswitch-8x60.0"), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 3634 | CLK_LOOKUP("core_clk", gfx2d1_clk.c, "kgsl-2d1.1"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3635 | CLK_LOOKUP("core_clk", gfx2d1_clk.c, "footswitch-8x60.1"), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 3636 | CLK_LOOKUP("core_clk", gfx3d_clk.c, "kgsl-3d0.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3637 | CLK_LOOKUP("core_clk", gfx3d_clk.c, "footswitch-8x60.2"), |
Matt Wagantall | f45cd36 | 2012-05-03 21:09:44 -0700 | [diff] [blame] | 3638 | CLK_LOOKUP("core_clk", ijpeg_clk.c, "msm_gemini.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3639 | CLK_LOOKUP("core_clk", ijpeg_clk.c, "footswitch-8x60.3"), |
Matt Wagantall | b86ad26 | 2011-10-24 19:50:29 -0700 | [diff] [blame] | 3640 | CLK_LOOKUP("core_clk", jpegd_clk.c, NULL), |
Ravishangar Kalyanam | 1b064f5 | 2012-03-15 18:17:54 -0700 | [diff] [blame] | 3641 | CLK_LOOKUP("core_clk", mdp_clk.c, "mdp.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3642 | CLK_LOOKUP("core_clk", mdp_clk.c, "footswitch-8x60.4"), |
Ravishangar Kalyanam | 1b064f5 | 2012-03-15 18:17:54 -0700 | [diff] [blame] | 3643 | CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "mdp.0"), |
Matt Wagantall | b82a513 | 2011-12-12 22:26:41 -0800 | [diff] [blame] | 3644 | CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "footswitch-8x60.4"), |
Ravishangar Kalyanam | 1b064f5 | 2012-03-15 18:17:54 -0700 | [diff] [blame] | 3645 | CLK_LOOKUP("lcdc_clk", pixel_lcdc_clk.c, "lcdc.0"), |
Matt Wagantall | b82a513 | 2011-12-12 22:26:41 -0800 | [diff] [blame] | 3646 | CLK_LOOKUP("pixel_lcdc_clk", pixel_lcdc_clk.c, "footswitch-8x60.4"), |
Ravishangar Kalyanam | 1b064f5 | 2012-03-15 18:17:54 -0700 | [diff] [blame] | 3647 | CLK_LOOKUP("mdp_clk", pixel_mdp_clk.c, "lcdc.0"), |
Matt Wagantall | b82a513 | 2011-12-12 22:26:41 -0800 | [diff] [blame] | 3648 | CLK_LOOKUP("pixel_mdp_clk", pixel_mdp_clk.c, "footswitch-8x60.4"), |
Matt Wagantall | bb90da9 | 2011-10-25 15:07:52 -0700 | [diff] [blame] | 3649 | CLK_LOOKUP("core_clk", rot_clk.c, "msm_rotator.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3650 | CLK_LOOKUP("core_clk", rot_clk.c, "footswitch-8x60.6"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3651 | CLK_LOOKUP("tv_enc_clk", tv_enc_clk.c, NULL), |
| 3652 | CLK_LOOKUP("tv_dac_clk", tv_dac_clk.c, NULL), |
Matt Wagantall | 3f7660b | 2011-08-17 21:25:13 -0700 | [diff] [blame] | 3653 | CLK_LOOKUP("core_clk", vcodec_clk.c, "msm_vidc.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3654 | CLK_LOOKUP("core_clk", vcodec_clk.c, "footswitch-8x60.7"), |
Ravishangar Kalyanam | 1b064f5 | 2012-03-15 18:17:54 -0700 | [diff] [blame] | 3655 | CLK_LOOKUP("mdp_clk", mdp_tv_clk.c, "dtv.0"), |
Matt Wagantall | b82a513 | 2011-12-12 22:26:41 -0800 | [diff] [blame] | 3656 | CLK_LOOKUP("tv_clk", mdp_tv_clk.c, "footswitch-8x60.4"), |
Ravishangar Kalyanam | 1b064f5 | 2012-03-15 18:17:54 -0700 | [diff] [blame] | 3657 | CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, "dtv.0"), |
| 3658 | CLK_LOOKUP("src_clk", tv_src_clk.c, "dtv.0"), |
Matt Wagantall | b82a513 | 2011-12-12 22:26:41 -0800 | [diff] [blame] | 3659 | CLK_LOOKUP("tv_src_clk", tv_src_clk.c, "footswitch-8x60.4"), |
Matt Wagantall | 5a4f1ba | 2011-08-18 18:13:03 -0700 | [diff] [blame] | 3660 | CLK_LOOKUP("core_clk", hdmi_app_clk.c, "hdmi_msm.1"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3661 | CLK_LOOKUP("vpe_clk", vpe_clk.c, NULL), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3662 | CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3663 | CLK_LOOKUP("csi_vfe_clk", csi0_vfe_clk.c, NULL), |
| 3664 | CLK_LOOKUP("csi_vfe_clk", csi1_vfe_clk.c, "msm_camera_ov7692.0"), |
| 3665 | CLK_LOOKUP("csi_vfe_clk", csi1_vfe_clk.c, "msm_camera_ov9726.0"), |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 3666 | CLK_LOOKUP("csi_vfe_clk", csi1_vfe_clk.c, "msm_csic.1"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3667 | CLK_LOOKUP("vfe_clk", vfe_clk.c, NULL), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3668 | CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3669 | CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"), |
| 3670 | CLK_LOOKUP("bus_clk", ijpeg_axi_clk.c, "footswitch-8x60.3"), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 3671 | CLK_LOOKUP("mem_clk", imem_axi_clk.c, "kgsl-3d0.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3672 | CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"), |
| 3673 | CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"), |
| 3674 | CLK_LOOKUP("bus_clk", vcodec_axi_clk.c, "footswitch-8x60.7"), |
| 3675 | CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"), |
Ravishangar Kalyanam | 1b064f5 | 2012-03-15 18:17:54 -0700 | [diff] [blame] | 3676 | CLK_LOOKUP("arb_clk", amp_p_clk.c, "mipi_dsi.1"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3677 | CLK_LOOKUP("csi_pclk", csi0_p_clk.c, NULL), |
| 3678 | CLK_LOOKUP("csi_pclk", csi1_p_clk.c, "msm_camera_ov7692.0"), |
| 3679 | CLK_LOOKUP("csi_pclk", csi1_p_clk.c, "msm_camera_ov9726.0"), |
Kevin Chan | 3be1161 | 2012-03-22 20:05:40 -0700 | [diff] [blame] | 3680 | CLK_LOOKUP("csi_pclk", csi1_p_clk.c, "msm_csic.1"), |
Ravishangar Kalyanam | 1b064f5 | 2012-03-15 18:17:54 -0700 | [diff] [blame] | 3681 | CLK_LOOKUP("master_iface_clk", dsi_m_p_clk.c, "mipi_dsi.1"), |
| 3682 | CLK_LOOKUP("slave_iface_clk", dsi_s_p_clk.c, "mipi_dsi.1"), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 3683 | CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "kgsl-2d0.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3684 | CLK_LOOKUP("iface_clk", gfx2d0_p_clk.c, "footswitch-8x60.0"), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 3685 | CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "kgsl-2d1.1"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3686 | CLK_LOOKUP("iface_clk", gfx2d1_p_clk.c, "footswitch-8x60.1"), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 3687 | CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "kgsl-3d0.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3688 | CLK_LOOKUP("iface_clk", gfx3d_p_clk.c, "footswitch-8x60.2"), |
Matt Wagantall | 5a4f1ba | 2011-08-18 18:13:03 -0700 | [diff] [blame] | 3689 | CLK_LOOKUP("master_iface_clk", hdmi_m_p_clk.c, "hdmi_msm.1"), |
| 3690 | CLK_LOOKUP("slave_iface_clk", hdmi_s_p_clk.c, "hdmi_msm.1"), |
Matt Wagantall | f45cd36 | 2012-05-03 21:09:44 -0700 | [diff] [blame] | 3691 | CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "msm_gemini.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3692 | CLK_LOOKUP("iface_clk", ijpeg_p_clk.c, "footswitch-8x60.3"), |
Matt Wagantall | b86ad26 | 2011-10-24 19:50:29 -0700 | [diff] [blame] | 3693 | CLK_LOOKUP("iface_clk", jpegd_p_clk.c, NULL), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 3694 | CLK_LOOKUP("mem_iface_clk", imem_p_clk.c, "kgsl-3d0.0"), |
Ravishangar Kalyanam | 1b064f5 | 2012-03-15 18:17:54 -0700 | [diff] [blame] | 3695 | CLK_LOOKUP("iface_clk", mdp_p_clk.c, "mdp.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3696 | CLK_LOOKUP("iface_clk", mdp_p_clk.c, "footswitch-8x60.4"), |
Matt Wagantall | e604d71 | 2011-10-21 15:38:18 -0700 | [diff] [blame] | 3697 | CLK_LOOKUP("iface_clk", smmu_p_clk.c, "msm_iommu"), |
Matt Wagantall | bb90da9 | 2011-10-25 15:07:52 -0700 | [diff] [blame] | 3698 | CLK_LOOKUP("iface_clk", rot_p_clk.c, "msm_rotator.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3699 | CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3700 | CLK_LOOKUP("tv_enc_pclk", tv_enc_p_clk.c, NULL), |
Matt Wagantall | 3f7660b | 2011-08-17 21:25:13 -0700 | [diff] [blame] | 3701 | CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3702 | CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3703 | CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, NULL), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3704 | CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3705 | CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, NULL), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 3706 | CLK_LOOKUP("iface_clk", vpe_p_clk.c, "footswitch-8x60.9"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3707 | CLK_LOOKUP("mi2s_osr_clk", mi2s_osr_clk.c, NULL), |
| 3708 | CLK_LOOKUP("mi2s_bit_clk", mi2s_bit_clk.c, NULL), |
| 3709 | CLK_LOOKUP("i2s_mic_osr_clk", codec_i2s_mic_osr_clk.c, NULL), |
| 3710 | CLK_LOOKUP("i2s_mic_bit_clk", codec_i2s_mic_bit_clk.c, NULL), |
| 3711 | CLK_LOOKUP("i2s_mic_osr_clk", spare_i2s_mic_osr_clk.c, NULL), |
| 3712 | CLK_LOOKUP("i2s_mic_bit_clk", spare_i2s_mic_bit_clk.c, NULL), |
| 3713 | CLK_LOOKUP("i2s_spkr_osr_clk", codec_i2s_spkr_osr_clk.c, NULL), |
| 3714 | CLK_LOOKUP("i2s_spkr_bit_clk", codec_i2s_spkr_bit_clk.c, NULL), |
| 3715 | CLK_LOOKUP("i2s_spkr_osr_clk", spare_i2s_spkr_osr_clk.c, NULL), |
| 3716 | CLK_LOOKUP("i2s_spkr_bit_clk", spare_i2s_spkr_bit_clk.c, NULL), |
| 3717 | CLK_LOOKUP("pcm_clk", pcm_clk.c, NULL), |
Matt Wagantall | e604d71 | 2011-10-21 15:38:18 -0700 | [diff] [blame] | 3718 | CLK_LOOKUP("core_clk", jpegd_axi_clk.c, "msm_iommu.0"), |
Matt Wagantall | 21903c0 | 2012-04-17 16:39:58 -0700 | [diff] [blame] | 3719 | CLK_LOOKUP("core_clk", vpe_axi_clk.c, "msm_iommu.1"), |
Matt Wagantall | e604d71 | 2011-10-21 15:38:18 -0700 | [diff] [blame] | 3720 | CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.2"), |
| 3721 | CLK_LOOKUP("core_clk", mdp_axi_clk.c, "msm_iommu.3"), |
Matt Wagantall | 21903c0 | 2012-04-17 16:39:58 -0700 | [diff] [blame] | 3722 | CLK_LOOKUP("core_clk", rot_axi_clk.c, "msm_iommu.4"), |
Matt Wagantall | e604d71 | 2011-10-21 15:38:18 -0700 | [diff] [blame] | 3723 | CLK_LOOKUP("core_clk", ijpeg_axi_clk.c, "msm_iommu.5"), |
| 3724 | CLK_LOOKUP("core_clk", vfe_axi_clk.c, "msm_iommu.6"), |
| 3725 | CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "msm_iommu.7"), |
| 3726 | CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "msm_iommu.8"), |
| 3727 | CLK_LOOKUP("core_clk", gfx3d_clk.c, "msm_iommu.9"), |
| 3728 | CLK_LOOKUP("core_clk", gfx2d0_clk.c, "msm_iommu.10"), |
| 3729 | CLK_LOOKUP("core_clk", gfx2d1_clk.c, "msm_iommu.11"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3730 | |
Riaz Rahaman | 966922b | 2012-02-21 10:48:01 -0800 | [diff] [blame] | 3731 | CLK_LOOKUP("mdp_iommu_clk", mdp_axi_clk.c, "msm_vidc.0"), |
| 3732 | CLK_LOOKUP("rot_iommu_clk", rot_axi_clk.c, "msm_vidc.0"), |
| 3733 | CLK_LOOKUP("vcodec_iommu0_clk", vcodec_axi_clk.c, "msm_vidc.0"), |
| 3734 | CLK_LOOKUP("vcodec_iommu1_clk", vcodec_axi_clk.c, "msm_vidc.0"), |
| 3735 | CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "msm_vidc.0"), |
Riaz Rahaman | dd18ebf | 2012-06-27 16:06:34 +0530 | [diff] [blame] | 3736 | CLK_LOOKUP("core_clk", vcodec_axi_clk.c, "pil_vidc"), |
| 3737 | CLK_LOOKUP("smmu_iface_clk", smmu_p_clk.c, "pil_vidc"), |
Riaz Rahaman | 966922b | 2012-02-21 10:48:01 -0800 | [diff] [blame] | 3738 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3739 | CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL), |
Manu Gautam | 5143b25 | 2012-01-05 19:25:23 -0800 | [diff] [blame] | 3740 | CLK_LOOKUP("core_clk", dfab_usb_hs_clk.c, "msm_otg"), |
Matt Wagantall | 37ce384 | 2011-08-17 16:00:36 -0700 | [diff] [blame] | 3741 | CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"), |
| 3742 | CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"), |
| 3743 | CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"), |
| 3744 | CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"), |
| 3745 | CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"), |
Stephen Boyd | ef5d1c4 | 2011-12-15 20:47:14 -0800 | [diff] [blame] | 3746 | CLK_LOOKUP("bus_clk", dfab_scm_clk.c, "scm"), |
Ramesh Masavarapu | ed4e601 | 2012-04-12 16:30:40 -0700 | [diff] [blame] | 3747 | CLK_LOOKUP("bus_clk", dfab_qseecom_clk.c, "qseecom"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3748 | |
Matt Wagantall | e1a8606 | 2011-08-18 17:46:10 -0700 | [diff] [blame] | 3749 | CLK_LOOKUP("mem_clk", ebi1_adm0_clk.c, "msm_dmov.0"), |
| 3750 | CLK_LOOKUP("mem_clk", ebi1_adm1_clk.c, "msm_dmov.1"), |
Matt Wagantall | 33bac7e | 2012-05-22 14:59:05 -0700 | [diff] [blame] | 3751 | CLK_LOOKUP("mem_clk", ebi1_acpu_a_clk.c, ""), |
| 3752 | CLK_LOOKUP("bus_clk", afab_acpu_a_clk.c, ""), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3753 | |
Matt Wagantall | c00f95d | 2012-01-05 14:22:45 -0800 | [diff] [blame] | 3754 | CLK_LOOKUP("sc0_mclk", sc0_m_clk, ""), |
| 3755 | CLK_LOOKUP("sc1_mclk", sc1_m_clk, ""), |
| 3756 | CLK_LOOKUP("l2_mclk", l2_m_clk, ""), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3757 | }; |
| 3758 | |
| 3759 | /* |
| 3760 | * Miscellaneous clock register initializations |
| 3761 | */ |
| 3762 | |
| 3763 | /* Read, modify, then write-back a register. */ |
| 3764 | static void __init rmwreg(uint32_t val, void *reg, uint32_t mask) |
| 3765 | { |
| 3766 | uint32_t regval = readl_relaxed(reg); |
| 3767 | regval &= ~mask; |
| 3768 | regval |= val; |
| 3769 | writel_relaxed(regval, reg); |
| 3770 | } |
| 3771 | |
Matt Wagantall | b64888f | 2012-04-02 21:35:07 -0700 | [diff] [blame] | 3772 | static void __init msm8660_clock_pre_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3773 | { |
Matt Wagantall | b64888f | 2012-04-02 21:35:07 -0700 | [diff] [blame] | 3774 | vote_vdd_level(&vdd_dig, VDD_DIG_HIGH); |
| 3775 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3776 | /* Setup MM_PLL2 (PLL3), but turn it off. Rate set by set_rate_tv(). */ |
| 3777 | rmwreg(0, MM_PLL2_MODE_REG, BIT(0)); /* Disable output */ |
| 3778 | /* Set ref, bypass, assert reset, disable output, disable test mode */ |
| 3779 | writel_relaxed(0, MM_PLL2_MODE_REG); /* PXO */ |
| 3780 | writel_relaxed(0x00800000, MM_PLL2_CONFIG_REG); /* Enable main out. */ |
| 3781 | |
| 3782 | /* The clock driver doesn't use SC1's voting register to control |
| 3783 | * HW-voteable clocks. Clear its bits so that disabling bits in the |
| 3784 | * SC0 register will cause the corresponding clocks to be disabled. */ |
| 3785 | rmwreg(BIT(12)|BIT(11), SC0_U_CLK_BRANCH_ENA_VOTE_REG, BM(12, 11)); |
| 3786 | writel_relaxed(BIT(12)|BIT(11), SC1_U_CLK_BRANCH_ENA_VOTE_REG); |
| 3787 | /* Let sc_aclk and sc_clk halt when both Scorpions are collapsed. */ |
| 3788 | writel_relaxed(BIT(12)|BIT(11), SC0_U_CLK_SLEEP_ENA_VOTE_REG); |
| 3789 | writel_relaxed(BIT(12)|BIT(11), SC1_U_CLK_SLEEP_ENA_VOTE_REG); |
| 3790 | |
| 3791 | /* Deassert MM SW_RESET_ALL signal. */ |
| 3792 | writel_relaxed(0, SW_RESET_ALL_REG); |
| 3793 | |
| 3794 | /* Initialize MM AHB registers: Enable the FPB clock and disable HW |
| 3795 | * gating for all clocks. Also set VFE_AHB's FORCE_CORE_ON bit to |
| 3796 | * prevent its memory from being collapsed when the clock is halted. |
| 3797 | * The sleep and wake-up delays are set to safe values. */ |
Matt Wagantall | 30011d2 | 2011-07-25 20:32:04 -0700 | [diff] [blame] | 3798 | rmwreg(0x00000003, AHB_EN_REG, 0x6C000003); |
| 3799 | writel_relaxed(0x000007F9, AHB_EN2_REG); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3800 | |
| 3801 | /* Deassert all locally-owned MM AHB resets. */ |
| 3802 | rmwreg(0, SW_RESET_AHB_REG, 0xFFF7DFFF); |
| 3803 | |
| 3804 | /* Initialize MM AXI registers: Enable HW gating for all clocks that |
| 3805 | * support it. Also set FORCE_CORE_ON bits, and any sleep and wake-up |
| 3806 | * delays to safe values. */ |
Matt Wagantall | 30011d2 | 2011-07-25 20:32:04 -0700 | [diff] [blame] | 3807 | rmwreg(0x100207F9, MAXI_EN_REG, 0x1803FFFF); |
| 3808 | rmwreg(0x7027FCFF, MAXI_EN2_REG, 0x7A3FFFFF); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3809 | writel_relaxed(0x3FE7FCFF, MAXI_EN3_REG); |
| 3810 | writel_relaxed(0x000001D8, SAXI_EN_REG); |
| 3811 | |
| 3812 | /* Initialize MM CC registers: Set MM FORCE_CORE_ON bits so that core |
| 3813 | * memories retain state even when not clocked. Also, set sleep and |
| 3814 | * wake-up delays to safe values. */ |
Matt Wagantall | 30011d2 | 2011-07-25 20:32:04 -0700 | [diff] [blame] | 3815 | rmwreg(0x00000000, CSI_CC_REG, 0x00000018); |
| 3816 | rmwreg(0x00000400, MISC_CC_REG, 0x017C0400); |
| 3817 | rmwreg(0x000007FD, MISC_CC2_REG, 0x70C2E7FF); |
| 3818 | rmwreg(0x80FF0000, GFX2D0_CC_REG, 0xE0FF0010); |
| 3819 | rmwreg(0x80FF0000, GFX2D1_CC_REG, 0xE0FF0010); |
| 3820 | rmwreg(0x80FF0000, GFX3D_CC_REG, 0xE0FF0010); |
| 3821 | rmwreg(0x80FF0000, IJPEG_CC_REG, 0xE0FF0018); |
| 3822 | rmwreg(0x80FF0000, JPEGD_CC_REG, 0xE0FF0018); |
| 3823 | rmwreg(0x80FF0000, MDP_CC_REG, 0xE1FF0010); |
| 3824 | rmwreg(0x80FF0000, PIXEL_CC_REG, 0xE1FF0010); |
| 3825 | rmwreg(0x000004FF, PIXEL_CC2_REG, 0x000007FF); |
| 3826 | rmwreg(0x80FF0000, ROT_CC_REG, 0xE0FF0010); |
| 3827 | rmwreg(0x80FF0000, TV_CC_REG, 0xE1FFC010); |
| 3828 | rmwreg(0x000004FF, TV_CC2_REG, 0x000027FF); |
| 3829 | rmwreg(0xC0FF0000, VCODEC_CC_REG, 0xE0FF0010); |
| 3830 | rmwreg(0x80FF0000, VFE_CC_REG, 0xE0FFC010); |
| 3831 | rmwreg(0x80FF0000, VPE_CC_REG, 0xE0FF0010); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3832 | |
| 3833 | /* De-assert MM AXI resets to all hardware blocks. */ |
| 3834 | writel_relaxed(0, SW_RESET_AXI_REG); |
| 3835 | |
| 3836 | /* Deassert all MM core resets. */ |
| 3837 | writel_relaxed(0, SW_RESET_CORE_REG); |
| 3838 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3839 | /* Enable TSSC and PDM PXO sources. */ |
| 3840 | writel_relaxed(BIT(11), TSSC_CLK_CTL_REG); |
| 3841 | writel_relaxed(BIT(15), PDM_CLK_NS_REG); |
| 3842 | /* Set the dsi_byte_clk src to the DSI PHY PLL, |
| 3843 | * dsi_esc_clk to PXO/2, and the hdmi_app_clk src to PXO */ |
| 3844 | rmwreg(0x400001, MISC_CC2_REG, 0x424003); |
Stephen Boyd | 842a1f6 | 2012-04-26 19:07:38 -0700 | [diff] [blame] | 3845 | |
| 3846 | if ((readl_relaxed(PRNG_CLK_NS_REG) & 0x7F) == 0x2B) |
| 3847 | prng_clk.freq_tbl = clk_tbl_prng_64; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3848 | } |
| 3849 | |
Matt Wagantall | b64888f | 2012-04-02 21:35:07 -0700 | [diff] [blame] | 3850 | static void __init msm8660_clock_post_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3851 | { |
Stephen Boyd | 72a8035 | 2012-01-26 15:57:38 -0800 | [diff] [blame] | 3852 | /* Keep PXO on whenever APPS cpu is active */ |
| 3853 | clk_prepare_enable(&pxo_a_clk.c); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3854 | |
Matt Wagantall | e655cd7 | 2012-04-09 10:15:03 -0700 | [diff] [blame] | 3855 | /* Reset 3D core while clocked to ensure it resets completely. */ |
| 3856 | clk_set_rate(&gfx3d_clk.c, 27000000); |
| 3857 | clk_prepare_enable(&gfx3d_clk.c); |
| 3858 | clk_reset(&gfx3d_clk.c, CLK_RESET_ASSERT); |
| 3859 | udelay(5); |
| 3860 | clk_reset(&gfx3d_clk.c, CLK_RESET_DEASSERT); |
| 3861 | clk_disable_unprepare(&gfx3d_clk.c); |
| 3862 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3863 | /* Initialize rates for clocks that only support one. */ |
| 3864 | clk_set_rate(&pdm_clk.c, 27000000); |
Stephen Boyd | 842a1f6 | 2012-04-26 19:07:38 -0700 | [diff] [blame] | 3865 | clk_set_rate(&prng_clk.c, prng_clk.freq_tbl->freq_hz); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3866 | clk_set_rate(&mdp_vsync_clk.c, 27000000); |
| 3867 | clk_set_rate(&tsif_ref_clk.c, 105000); |
| 3868 | clk_set_rate(&tssc_clk.c, 27000000); |
| 3869 | clk_set_rate(&usb_hs1_xcvr_clk.c, 60000000); |
| 3870 | clk_set_rate(&usb_fs1_src_clk.c, 60000000); |
| 3871 | clk_set_rate(&usb_fs2_src_clk.c, 60000000); |
| 3872 | |
| 3873 | /* The halt status bits for PDM and TSSC may be incorrect at boot. |
| 3874 | * Toggle these clocks on and off to refresh them. */ |
Stephen Boyd | 409b8b4 | 2012-04-10 12:12:56 -0700 | [diff] [blame] | 3875 | clk_prepare_enable(&pdm_clk.c); |
| 3876 | clk_disable_unprepare(&pdm_clk.c); |
| 3877 | clk_prepare_enable(&tssc_clk.c); |
| 3878 | clk_disable_unprepare(&tssc_clk.c); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3879 | } |
| 3880 | |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 3881 | static int __init msm8660_clock_late_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3882 | { |
| 3883 | int rc; |
| 3884 | |
| 3885 | /* Vote for MMFPB to be at least 64MHz when an Apps CPU is active. */ |
Stephen Boyd | 279196e | 2012-07-12 16:09:02 -0700 | [diff] [blame] | 3886 | struct clk *mmfpb_a_clk = clk_get_sys("clock-8x60", "mmfpb_a_clk"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3887 | if (WARN(IS_ERR(mmfpb_a_clk), "mmfpb_a_clk not found (%ld)\n", |
| 3888 | PTR_ERR(mmfpb_a_clk))) |
| 3889 | return PTR_ERR(mmfpb_a_clk); |
Matt Wagantall | de555f56 | 2011-11-08 14:18:07 -0800 | [diff] [blame] | 3890 | rc = clk_set_rate(mmfpb_a_clk, 64000000); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3891 | if (WARN(rc, "mmfpb_a_clk rate was not set (%d)\n", rc)) |
| 3892 | return rc; |
Stephen Boyd | e334aeb | 2012-01-24 12:17:29 -0800 | [diff] [blame] | 3893 | rc = clk_prepare_enable(mmfpb_a_clk); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3894 | if (WARN(rc, "mmfpb_a_clk not enabled (%d)\n", rc)) |
| 3895 | return rc; |
| 3896 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 3897 | return unvote_vdd_level(&vdd_dig, VDD_DIG_HIGH); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3898 | } |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 3899 | |
| 3900 | struct clock_init_data msm8x60_clock_init_data __initdata = { |
| 3901 | .table = msm_clocks_8x60, |
| 3902 | .size = ARRAY_SIZE(msm_clocks_8x60), |
Matt Wagantall | b64888f | 2012-04-02 21:35:07 -0700 | [diff] [blame] | 3903 | .pre_init = msm8660_clock_pre_init, |
| 3904 | .post_init = msm8660_clock_post_init, |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 3905 | .late_init = msm8660_clock_late_init, |
| 3906 | }; |