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