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