Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved. |
| 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 | #include <linux/string.h> |
| 25 | |
| 26 | #include <mach/msm_iomap.h> |
| 27 | #include <mach/clk.h> |
| 28 | |
| 29 | #include "clock.h" |
| 30 | #include "clock-local.h" |
| 31 | #include "clock-pcom.h" |
| 32 | #include "clock-voter.h" |
| 33 | #include "proc_comm.h" |
| 34 | |
| 35 | #define REG_BASE(off) (MSM_CLK_CTL_BASE + (off)) |
| 36 | #define REG(off) (MSM_CLK_CTL_SH2_BASE + (off)) |
| 37 | |
| 38 | /* Shadow-region 2 (SH2) registers. */ |
| 39 | #define QUP_I2C_NS_REG REG(0x04F0) |
| 40 | #define CAM_NS_REG REG(0x0374) |
| 41 | #define CAM_VFE_NS_REG REG(0x0044) |
| 42 | #define CLK_HALT_STATEA_REG REG(0x0108) |
| 43 | #define CLK_HALT_STATEB_REG REG(0x010C) |
| 44 | #define CLK_HALT_STATEC_REG REG(0x02D4) |
| 45 | #define CSI_NS_REG REG(0x0174) |
| 46 | #define EMDH_NS_REG REG(0x0050) |
| 47 | #define GLBL_CLK_ENA_2_SC_REG REG(0x03C0) |
| 48 | #define GLBL_CLK_ENA_SC_REG REG(0x03BC) |
| 49 | #define GLBL_CLK_STATE_2_REG REG(0x037C) |
| 50 | #define GLBL_CLK_STATE_REG REG(0x0004) |
| 51 | #define GRP_2D_NS_REG REG(0x0034) |
| 52 | #define GRP_NS_REG REG(0x0084) |
| 53 | #define HDMI_NS_REG REG(0x0484) |
| 54 | #define I2C_2_NS_REG REG(0x02D8) |
| 55 | #define I2C_NS_REG REG(0x0068) |
| 56 | #define JPEG_NS_REG REG(0x0164) |
| 57 | #define LPA_CORE_CLK_MA0_REG REG(0x04F4) |
| 58 | #define LPA_CORE_CLK_MA2_REG REG(0x04FC) |
| 59 | #define LPA_NS_REG REG(0x02E8) |
| 60 | #define MDC_NS_REG REG(0x007C) |
| 61 | #define MDP_LCDC_NS_REG REG(0x0390) |
| 62 | #define MDP_NS_REG REG(0x014C) |
| 63 | #define MDP_VSYNC_REG REG(0x0460) |
| 64 | #define MFC_NS_REG REG(0x0154) |
| 65 | #define MI2S_CODEC_RX_DIV_REG REG(0x02EC) |
| 66 | #define MI2S_CODEC_TX_DIV_REG REG(0x02F0) |
| 67 | #define MI2S_DIV_REG REG(0x02E4) |
| 68 | #define MI2S_NS_REG REG(0x02E0) |
| 69 | #define MI2S_RX_NS_REG REG(0x0070) |
| 70 | #define MI2S_TX_NS_REG REG(0x0078) |
| 71 | #define MIDI_NS_REG REG(0x02D0) |
| 72 | #define PLL_ENA_REG REG(0x0264) |
| 73 | #define PMDH_NS_REG REG(0x008C) |
| 74 | #define SDAC_NS_REG REG(0x009C) |
| 75 | #define SDCn_NS_REG(n) REG(0x00A4+(0x8*((n)-1))) |
| 76 | #define SPI_NS_REG REG(0x02C8) |
| 77 | #define TSIF_NS_REG REG(0x00C4) |
| 78 | #define TV_NS_REG REG(0x00CC) |
| 79 | #define UART1DM_NS_REG REG(0x00D4) |
| 80 | #define UART2DM_NS_REG REG(0x00DC) |
| 81 | #define UART2_NS_REG REG(0x0464) |
| 82 | #define UART_NS_REG REG(0x00E0) |
| 83 | #define USBH2_NS_REG REG(0x046C) |
| 84 | #define USBH3_NS_REG REG(0x0470) |
| 85 | #define USBH_MD_REG REG(0x02BC) |
| 86 | #define USBH_NS_REG REG(0x02C0) |
| 87 | #define VPE_NS_REG REG(0x015C) |
| 88 | |
| 89 | /* Registers in the base (non-shadow) region. */ |
| 90 | #define CLK_TEST_BASE_REG REG_BASE(0x011C) |
| 91 | #define CLK_TEST_2_BASE_REG REG_BASE(0x0384) |
| 92 | #define MISC_CLK_CTL_BASE_REG REG_BASE(0x0110) |
| 93 | #define PRPH_WEB_NS_BASE_REG REG_BASE(0x0080) |
| 94 | #define PLL0_STATUS_BASE_REG REG_BASE(0x0318) |
| 95 | #define PLL1_STATUS_BASE_REG REG_BASE(0x0334) |
| 96 | #define PLL2_STATUS_BASE_REG REG_BASE(0x0350) |
| 97 | #define PLL3_STATUS_BASE_REG REG_BASE(0x036C) |
| 98 | #define PLL4_STATUS_BASE_REG REG_BASE(0x0254) |
| 99 | #define PLL5_STATUS_BASE_REG REG_BASE(0x0258) |
| 100 | #define PLL6_STATUS_BASE_REG REG_BASE(0x04EC) |
| 101 | #define RINGOSC_CNT_BASE_REG REG_BASE(0x00FC) |
| 102 | #define SH2_OWN_APPS1_BASE_REG REG_BASE(0x040C) |
| 103 | #define SH2_OWN_APPS2_BASE_REG REG_BASE(0x0414) |
| 104 | #define SH2_OWN_APPS3_BASE_REG REG_BASE(0x0444) |
| 105 | #define SH2_OWN_GLBL_BASE_REG REG_BASE(0x0404) |
| 106 | #define SH2_OWN_ROW1_BASE_REG REG_BASE(0x041C) |
| 107 | #define SH2_OWN_ROW2_BASE_REG REG_BASE(0x0424) |
| 108 | #define TCXO_CNT_BASE_REG REG_BASE(0x00F8) |
| 109 | #define TCXO_CNT_DONE_BASE_REG REG_BASE(0x00F8) |
| 110 | |
| 111 | |
| 112 | /* MUX source input identifiers. */ |
| 113 | #define SRC_SEL_pll0 4 /* Modem PLL */ |
| 114 | #define SRC_SEL_pll1 1 /* Global PLL */ |
| 115 | #define SRC_SEL_pll3 3 /* Multimedia/Peripheral PLL or Backup PLL1 */ |
| 116 | #define SRC_SEL_pll4 2 /* Display PLL */ |
| 117 | #define SRC_SEL_SDAC_lpxo 5 /* Low-power XO for SDAC */ |
| 118 | #define SRC_SEL_lpxo 6 /* Low-power XO */ |
| 119 | #define SRC_SEL_tcxo 0 /* Used for rates from TCXO */ |
| 120 | #define SRC_SEL_axi 0 /* Used for rates that sync to AXI */ |
| 121 | #define SRC_SEL_gnd 7 /* No clock */ |
| 122 | |
| 123 | /* Clock declaration macros. */ |
| 124 | #define MN_MODE_DUAL_EDGE 0x2 |
| 125 | #define MD8(m, n) (BVAL(15, 8, m) | BVAL(7, 0, ~(n))) |
| 126 | #define N8(msb, lsb, m, n) (BVAL(msb, lsb, ~(n-m)) | BVAL(6, 5, \ |
| 127 | (MN_MODE_DUAL_EDGE * !!(n)))) |
| 128 | #define MD16(m, n) (BVAL(31, 16, m) | BVAL(15, 0, ~(n))) |
| 129 | #define N16(m, n) (BVAL(31, 16, ~(n-m)) | BVAL(6, 5, \ |
| 130 | (MN_MODE_DUAL_EDGE * !!(n)))) |
| 131 | #define SPDIV(s, d) (BVAL(4, 3, d-1) | BVAL(2, 0, s)) |
| 132 | #define SDIV(s, d) (BVAL(6, 3, d-1) | BVAL(2, 0, s)) |
| 133 | #define F_MASK_BASIC (BM(6, 3)|BM(2, 0)) |
| 134 | #define F_MASK_MND16 (BM(31, 16)|BM(6, 5)|BM(4, 3)|BM(2, 0)) |
| 135 | #define F_MASK_MND8(m, l) (BM(m, l)|BM(6, 5)|BM(4, 3)|BM(2, 0)) |
| 136 | |
| 137 | /* |
| 138 | * Clock frequency definitions and macros |
| 139 | */ |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 140 | #define F_BASIC(f, s, div) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 141 | { \ |
| 142 | .freq_hz = f, \ |
| 143 | .src_clk = &s##_clk.c, \ |
| 144 | .ns_val = SDIV(SRC_SEL_##s, div), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 145 | } |
| 146 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 147 | #define F_MND16(f, s, div, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 148 | { \ |
| 149 | .freq_hz = f, \ |
| 150 | .src_clk = &s##_clk.c, \ |
| 151 | .md_val = MD16(m, n), \ |
| 152 | .ns_val = N16(m, n) | SPDIV(SRC_SEL_##s, div), \ |
| 153 | .mnd_en_mask = BIT(8) * !!(n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 154 | } |
| 155 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 156 | #define F_MND8(f, nmsb, nlsb, s, div, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 157 | { \ |
| 158 | .freq_hz = f, \ |
| 159 | .src_clk = &s##_clk.c, \ |
| 160 | .md_val = MD8(m, n), \ |
| 161 | .ns_val = N8(nmsb, nlsb, m, n) | SPDIV(SRC_SEL_##s, div), \ |
| 162 | .mnd_en_mask = BIT(8) * !!(n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 163 | } |
| 164 | |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 165 | static struct clk_ops clk_ops_rcg_7x30; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 166 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 167 | enum vdd_dig_levels { |
| 168 | VDD_DIG_NONE, |
| 169 | VDD_DIG_LOW, |
| 170 | VDD_DIG_NOMINAL, |
| 171 | VDD_DIG_HIGH |
| 172 | }; |
| 173 | |
| 174 | static int set_vdd_dig(struct clk_vdd_class *vdd_class, int level) |
| 175 | { |
| 176 | int rc, target_mv; |
| 177 | |
| 178 | static const int mv[] = { |
| 179 | [VDD_DIG_NONE] = 1000, |
| 180 | [VDD_DIG_LOW] = 1000, |
| 181 | [VDD_DIG_NOMINAL] = 1100, |
| 182 | [VDD_DIG_HIGH] = 1200 |
| 183 | }; |
| 184 | |
| 185 | target_mv = mv[level]; |
| 186 | rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_MSMC1, &target_mv, NULL); |
| 187 | if (rc) |
| 188 | return rc; |
| 189 | if (target_mv) |
| 190 | rc = -EINVAL; |
| 191 | |
| 192 | return rc; |
| 193 | } |
| 194 | |
| 195 | static DEFINE_VDD_CLASS(vdd_dig, set_vdd_dig); |
| 196 | |
| 197 | #define VDD_DIG_FMAX_MAP1(l1, f1) \ |
| 198 | .vdd_class = &vdd_dig, \ |
| 199 | .fmax[VDD_DIG_##l1] = (f1) |
| 200 | #define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \ |
| 201 | .vdd_class = &vdd_dig, \ |
| 202 | .fmax[VDD_DIG_##l1] = (f1), \ |
| 203 | .fmax[VDD_DIG_##l2] = (f2) |
| 204 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 205 | #define PCOM_XO_DISABLE 0 |
| 206 | #define PCOM_XO_ENABLE 1 |
| 207 | #define PCOM_XO_TCXO 0 |
| 208 | #define PCOM_XO_LPXO 1 |
| 209 | |
| 210 | static bool pcom_is_local(struct clk *clk) |
| 211 | { |
| 212 | return false; |
| 213 | } |
| 214 | |
| 215 | static int pcom_xo_enable(unsigned pcom_id, unsigned enable) |
| 216 | { |
| 217 | /* TODO: Check return code in pcom_id */ |
| 218 | return msm_proc_comm(PCOM_CLKCTL_RPC_SRC_REQUEST, &pcom_id, &enable); |
| 219 | } |
| 220 | |
| 221 | static int tcxo_clk_enable(struct clk *clk) |
| 222 | { |
| 223 | return pcom_xo_enable(PCOM_XO_TCXO, PCOM_XO_ENABLE); |
| 224 | } |
| 225 | |
| 226 | static void tcxo_clk_disable(struct clk *clk) |
| 227 | { |
| 228 | pcom_xo_enable(PCOM_XO_TCXO, PCOM_XO_DISABLE); |
| 229 | } |
| 230 | |
| 231 | static struct clk_ops clk_ops_tcxo = { |
| 232 | .enable = tcxo_clk_enable, |
| 233 | .disable = tcxo_clk_disable, |
| 234 | .get_rate = fixed_clk_get_rate, |
| 235 | .is_local = pcom_is_local, |
| 236 | }; |
| 237 | |
| 238 | static struct fixed_clk tcxo_clk = { |
| 239 | .rate = 19200000, |
| 240 | .c = { |
| 241 | .dbg_name = "tcxo_clk", |
| 242 | .ops = &clk_ops_tcxo, |
| 243 | CLK_INIT(tcxo_clk.c), |
| 244 | }, |
| 245 | }; |
| 246 | |
| 247 | static int lpxo_clk_enable(struct clk *clk) |
| 248 | { |
| 249 | return pcom_xo_enable(PCOM_XO_LPXO, PCOM_XO_ENABLE); |
| 250 | } |
| 251 | |
| 252 | static void lpxo_clk_disable(struct clk *clk) |
| 253 | { |
| 254 | pcom_xo_enable(PCOM_XO_LPXO, PCOM_XO_DISABLE); |
| 255 | } |
| 256 | |
| 257 | static struct clk_ops clk_ops_lpxo = { |
| 258 | .enable = lpxo_clk_enable, |
| 259 | .disable = lpxo_clk_disable, |
| 260 | .get_rate = fixed_clk_get_rate, |
| 261 | .is_local = pcom_is_local, |
| 262 | }; |
| 263 | |
| 264 | static struct fixed_clk lpxo_clk = { |
| 265 | .rate = 24576000, |
| 266 | .c = { |
| 267 | .dbg_name = "lpxo_clk", |
| 268 | .ops = &clk_ops_lpxo, |
| 269 | CLK_INIT(lpxo_clk.c), |
| 270 | }, |
| 271 | }; |
| 272 | |
| 273 | static struct pll_vote_clk pll1_clk = { |
| 274 | .rate = 768000000, |
| 275 | .en_reg = PLL_ENA_REG, |
| 276 | .en_mask = BIT(1), |
| 277 | .status_reg = PLL1_STATUS_BASE_REG, |
| 278 | .parent = &tcxo_clk.c, |
| 279 | .c = { |
| 280 | .dbg_name = "pll1_clk", |
| 281 | .ops = &clk_ops_pll_vote, |
| 282 | CLK_INIT(pll1_clk.c), |
| 283 | }, |
| 284 | }; |
| 285 | |
| 286 | static struct pll_vote_clk pll2_clk = { |
| 287 | .rate = 806400000, /* TODO: Support scaling */ |
| 288 | .en_reg = PLL_ENA_REG, |
| 289 | .en_mask = BIT(2), |
| 290 | .status_reg = PLL2_STATUS_BASE_REG, |
| 291 | .parent = &tcxo_clk.c, |
| 292 | .c = { |
| 293 | .dbg_name = "pll2_clk", |
| 294 | .ops = &clk_ops_pll_vote, |
| 295 | CLK_INIT(pll2_clk.c), |
| 296 | }, |
| 297 | }; |
| 298 | |
| 299 | static struct pll_vote_clk pll3_clk = { |
| 300 | .rate = 737280000, |
| 301 | .en_reg = PLL_ENA_REG, |
| 302 | .en_mask = BIT(3), |
| 303 | .status_reg = PLL3_STATUS_BASE_REG, |
| 304 | .parent = &lpxo_clk.c, |
| 305 | .c = { |
| 306 | .dbg_name = "pll3_clk", |
| 307 | .ops = &clk_ops_pll_vote, |
| 308 | CLK_INIT(pll3_clk.c), |
| 309 | }, |
| 310 | }; |
| 311 | |
| 312 | static struct pll_vote_clk pll4_clk = { |
| 313 | .rate = 891000000, |
| 314 | .en_reg = PLL_ENA_REG, |
| 315 | .en_mask = BIT(4), |
| 316 | .status_reg = PLL4_STATUS_BASE_REG, |
| 317 | .parent = &lpxo_clk.c, |
| 318 | .c = { |
| 319 | .dbg_name = "pll4_clk", |
| 320 | .ops = &clk_ops_pll_vote, |
| 321 | CLK_INIT(pll4_clk.c), |
| 322 | }, |
| 323 | }; |
| 324 | |
| 325 | static struct clk_ops clk_ops_branch; |
| 326 | |
| 327 | static struct clk_freq_tbl clk_tbl_axi[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 328 | F_RAW(1, &lpxo_clk.c, 0, 0, 0, 0, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 329 | F_END, |
| 330 | }; |
| 331 | |
| 332 | /* For global clocks to be on we must have GLBL_ROOT_ENA set */ |
| 333 | static struct rcg_clk glbl_root_clk = { |
| 334 | .b = { |
| 335 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 336 | .en_mask = BIT(29), |
| 337 | .halt_check = NOCHECK, |
| 338 | }, |
| 339 | .freq_tbl = clk_tbl_axi, |
| 340 | .set_rate = set_rate_nop, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 341 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 342 | .set_rate = set_rate_nop, |
| 343 | .c = { |
| 344 | .dbg_name = "glbl_root_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 345 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 346 | VDD_DIG_FMAX_MAP1(NOMINAL, 1), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 347 | CLK_INIT(glbl_root_clk.c), |
| 348 | }, |
| 349 | }; |
| 350 | |
| 351 | /* AXI bridge clocks. */ |
| 352 | static struct branch_clk axi_li_apps_clk = { |
| 353 | .b = { |
| 354 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 355 | .en_mask = BIT(2), |
| 356 | .halt_reg = GLBL_CLK_STATE_REG, |
| 357 | .halt_check = HALT_VOTED, |
| 358 | .halt_bit = 2, |
| 359 | }, |
| 360 | .parent = &glbl_root_clk.c, |
| 361 | .c = { |
| 362 | .dbg_name = "axi_li_apps_clk", |
| 363 | .ops = &clk_ops_branch, |
| 364 | CLK_INIT(axi_li_apps_clk.c), |
| 365 | }, |
| 366 | }; |
| 367 | |
| 368 | static struct branch_clk axi_li_adsp_a_clk = { |
| 369 | .b = { |
| 370 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 371 | .en_mask = BIT(14), |
| 372 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 373 | .halt_check = HALT_VOTED, |
| 374 | .halt_bit = 14, |
| 375 | }, |
| 376 | .parent = &axi_li_apps_clk.c, |
| 377 | .c = { |
| 378 | .dbg_name = "axi_li_adsp_a_clk", |
| 379 | .ops = &clk_ops_branch, |
| 380 | CLK_INIT(axi_li_adsp_a_clk.c), |
| 381 | }, |
| 382 | }; |
| 383 | |
| 384 | static struct branch_clk axi_li_jpeg_clk = { |
| 385 | .b = { |
| 386 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 387 | .en_mask = BIT(19), |
| 388 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 389 | .halt_check = HALT_VOTED, |
| 390 | .halt_bit = 19, |
| 391 | }, |
| 392 | .parent = &axi_li_apps_clk.c, |
| 393 | .c = { |
| 394 | .dbg_name = "axi_li_jpeg_clk", |
| 395 | .ops = &clk_ops_branch, |
| 396 | CLK_INIT(axi_li_jpeg_clk.c), |
| 397 | }, |
| 398 | }; |
| 399 | |
| 400 | static struct branch_clk axi_li_vfe_clk = { |
| 401 | .b = { |
| 402 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 403 | .en_mask = BIT(23), |
| 404 | .halt_reg = GLBL_CLK_STATE_REG, |
| 405 | .halt_check = HALT_VOTED, |
| 406 | .halt_bit = 23, |
| 407 | }, |
| 408 | .parent = &axi_li_apps_clk.c, |
| 409 | .c = { |
| 410 | .dbg_name = "axi_li_vfe_clk", |
| 411 | .ops = &clk_ops_branch, |
| 412 | CLK_INIT(axi_li_vfe_clk.c), |
| 413 | }, |
| 414 | }; |
| 415 | |
| 416 | static struct branch_clk axi_mdp_clk = { |
| 417 | .b = { |
| 418 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 419 | .en_mask = BIT(29), |
| 420 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 421 | .halt_check = HALT_VOTED, |
| 422 | .halt_bit = 29, |
| 423 | }, |
| 424 | .parent = &axi_li_apps_clk.c, |
| 425 | .c = { |
| 426 | .dbg_name = "axi_mdp_clk", |
| 427 | .ops = &clk_ops_branch, |
| 428 | CLK_INIT(axi_mdp_clk.c), |
| 429 | }, |
| 430 | }; |
| 431 | |
| 432 | static struct branch_clk axi_li_vg_clk = { |
| 433 | .b = { |
| 434 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 435 | .en_mask = BIT(3), |
| 436 | .halt_reg = GLBL_CLK_STATE_REG, |
| 437 | .halt_check = HALT_VOTED, |
| 438 | .halt_bit = 3, |
| 439 | }, |
| 440 | .parent = &glbl_root_clk.c, |
| 441 | .c = { |
| 442 | .dbg_name = "axi_li_vg_clk", |
| 443 | .ops = &clk_ops_branch, |
| 444 | CLK_INIT(axi_li_vg_clk.c), |
| 445 | }, |
| 446 | }; |
| 447 | |
| 448 | static struct branch_clk axi_grp_2d_clk = { |
| 449 | .b = { |
| 450 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 451 | .en_mask = BIT(21), |
| 452 | .halt_reg = GLBL_CLK_STATE_REG, |
| 453 | .halt_check = HALT_VOTED, |
| 454 | .halt_bit = 21, |
| 455 | }, |
| 456 | .parent = &axi_li_vg_clk.c, |
| 457 | .c = { |
| 458 | .dbg_name = "axi_grp_2d_clk", |
| 459 | .ops = &clk_ops_branch, |
| 460 | CLK_INIT(axi_grp_2d_clk.c), |
| 461 | }, |
| 462 | }; |
| 463 | |
| 464 | static struct branch_clk axi_li_grp_clk = { |
| 465 | .b = { |
| 466 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 467 | .en_mask = BIT(22), |
| 468 | .halt_reg = GLBL_CLK_STATE_REG, |
| 469 | .halt_check = HALT_VOTED, |
| 470 | .halt_bit = 22, |
| 471 | }, |
| 472 | .parent = &axi_li_vg_clk.c, |
| 473 | .c = { |
| 474 | .dbg_name = "axi_li_grp_clk", |
| 475 | .ops = &clk_ops_branch, |
| 476 | CLK_INIT(axi_li_grp_clk.c), |
| 477 | }, |
| 478 | }; |
| 479 | |
| 480 | static struct branch_clk axi_mfc_clk = { |
| 481 | .b = { |
| 482 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 483 | .en_mask = BIT(20), |
| 484 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 485 | .halt_check = HALT_VOTED, |
| 486 | .halt_bit = 20, |
| 487 | }, |
| 488 | .parent = &axi_li_vg_clk.c, |
| 489 | .c = { |
| 490 | .dbg_name = "axi_mfc_clk", |
| 491 | .ops = &clk_ops_branch, |
| 492 | CLK_INIT(axi_mfc_clk.c), |
| 493 | }, |
| 494 | }; |
| 495 | |
| 496 | static struct branch_clk axi_rotator_clk = { |
| 497 | .b = { |
| 498 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 499 | .en_mask = BIT(22), |
| 500 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 501 | .halt_check = HALT_VOTED, |
| 502 | .halt_bit = 22, |
| 503 | .reset_mask = P_AXI_ROTATOR_CLK, |
| 504 | }, |
| 505 | .parent = &axi_li_vg_clk.c, |
| 506 | .c = { |
| 507 | .dbg_name = "axi_rotator_clk", |
| 508 | .ops = &clk_ops_branch, |
| 509 | CLK_INIT(axi_rotator_clk.c), |
| 510 | }, |
| 511 | }; |
| 512 | |
| 513 | static struct branch_clk axi_vpe_clk = { |
| 514 | .b = { |
| 515 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 516 | .en_mask = BIT(21), |
| 517 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 518 | .halt_check = HALT_VOTED, |
| 519 | .halt_bit = 21, |
| 520 | }, |
| 521 | .parent = &axi_li_vg_clk.c, |
| 522 | .c = { |
| 523 | .dbg_name = "axi_vpe_clk", |
| 524 | .ops = &clk_ops_branch, |
| 525 | CLK_INIT(axi_vpe_clk.c), |
| 526 | }, |
| 527 | }; |
| 528 | |
| 529 | /* Peripheral bus clocks. */ |
| 530 | static struct branch_clk adm_clk = { |
| 531 | .b = { |
| 532 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 533 | .en_mask = BIT(5), |
| 534 | .halt_reg = GLBL_CLK_STATE_REG, |
| 535 | .halt_check = HALT_VOTED, |
| 536 | .halt_bit = 5, |
| 537 | .reset_mask = P_ADM_CLK, |
| 538 | }, |
| 539 | .parent = &axi_li_apps_clk.c, |
| 540 | .c = { |
| 541 | .dbg_name = "adm_clk", |
| 542 | .ops = &clk_ops_branch, |
| 543 | CLK_INIT(adm_clk.c), |
| 544 | }, |
| 545 | }; |
| 546 | |
| 547 | static struct branch_clk adm_p_clk = { |
| 548 | .b = { |
| 549 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 550 | .en_mask = BIT(15), |
| 551 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 552 | .halt_check = HALT_VOTED, |
| 553 | .halt_bit = 15, |
| 554 | }, |
| 555 | .parent = &glbl_root_clk.c, |
| 556 | .c = { |
| 557 | .dbg_name = "adm_p_clk", |
| 558 | .ops = &clk_ops_branch, |
| 559 | CLK_INIT(adm_p_clk.c), |
| 560 | }, |
| 561 | }; |
| 562 | |
| 563 | static struct branch_clk ce_clk = { |
| 564 | .b = { |
| 565 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 566 | .en_mask = BIT(6), |
| 567 | .halt_reg = GLBL_CLK_STATE_REG, |
| 568 | .halt_check = HALT_VOTED, |
| 569 | .halt_bit = 6, |
| 570 | .reset_mask = P_CE_CLK, |
| 571 | }, |
| 572 | .parent = &glbl_root_clk.c, |
| 573 | .c = { |
| 574 | .dbg_name = "ce_clk", |
| 575 | .ops = &clk_ops_branch, |
| 576 | CLK_INIT(ce_clk.c), |
| 577 | }, |
| 578 | }; |
| 579 | |
| 580 | static struct branch_clk camif_pad_p_clk = { |
| 581 | .b = { |
| 582 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 583 | .en_mask = BIT(9), |
| 584 | .halt_reg = GLBL_CLK_STATE_REG, |
| 585 | .halt_check = HALT_VOTED, |
| 586 | .halt_bit = 9, |
| 587 | .reset_mask = P_CAMIF_PAD_P_CLK, |
| 588 | }, |
| 589 | .parent = &glbl_root_clk.c, |
| 590 | .c = { |
| 591 | .dbg_name = "camif_pad_p_clk", |
| 592 | .ops = &clk_ops_branch, |
| 593 | CLK_INIT(camif_pad_p_clk.c), |
| 594 | }, |
| 595 | }; |
| 596 | |
| 597 | static struct branch_clk csi0_p_clk = { |
| 598 | .b = { |
| 599 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 600 | .en_mask = BIT(30), |
| 601 | .halt_reg = GLBL_CLK_STATE_REG, |
| 602 | .halt_check = HALT_VOTED, |
| 603 | .halt_bit = 30, |
| 604 | .reset_mask = P_CSI0_P_CLK, |
| 605 | }, |
| 606 | .parent = &glbl_root_clk.c, |
| 607 | .c = { |
| 608 | .dbg_name = "csi0_p_clk", |
| 609 | .ops = &clk_ops_branch, |
| 610 | CLK_INIT(csi0_p_clk.c), |
| 611 | }, |
| 612 | }; |
| 613 | |
| 614 | static struct branch_clk emdh_p_clk = { |
| 615 | .b = { |
| 616 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 617 | .en_mask = BIT(3), |
| 618 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 619 | .halt_check = HALT_VOTED, |
| 620 | .halt_bit = 3, |
| 621 | .reset_mask = P_EMDH_P_CLK, |
| 622 | }, |
| 623 | .parent = &glbl_root_clk.c, |
| 624 | .c = { |
| 625 | .dbg_name = "emdh_p_clk", |
| 626 | .ops = &clk_ops_branch, |
| 627 | CLK_INIT(emdh_p_clk.c), |
| 628 | }, |
| 629 | }; |
| 630 | |
| 631 | static struct branch_clk grp_2d_p_clk = { |
| 632 | .b = { |
| 633 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 634 | .en_mask = BIT(24), |
| 635 | .halt_reg = GLBL_CLK_STATE_REG, |
| 636 | .halt_check = HALT_VOTED, |
| 637 | .halt_bit = 24, |
| 638 | .reset_mask = P_GRP_2D_P_CLK, |
| 639 | }, |
| 640 | .parent = &glbl_root_clk.c, |
| 641 | .c = { |
| 642 | .dbg_name = "grp_2d_p_clk", |
| 643 | .ops = &clk_ops_branch, |
| 644 | CLK_INIT(grp_2d_p_clk.c), |
| 645 | }, |
| 646 | }; |
| 647 | |
| 648 | static struct branch_clk grp_3d_p_clk = { |
| 649 | .b = { |
| 650 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 651 | .en_mask = BIT(17), |
| 652 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 653 | .halt_check = HALT_VOTED, |
| 654 | .halt_bit = 17, |
| 655 | .reset_mask = P_GRP_3D_P_CLK, |
| 656 | }, |
| 657 | .parent = &glbl_root_clk.c, |
| 658 | .c = { |
| 659 | .dbg_name = "grp_3d_p_clk", |
| 660 | .ops = &clk_ops_branch, |
| 661 | CLK_INIT(grp_3d_p_clk.c), |
| 662 | }, |
| 663 | }; |
| 664 | |
| 665 | static struct branch_clk jpeg_p_clk = { |
| 666 | .b = { |
| 667 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 668 | .en_mask = BIT(24), |
| 669 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 670 | .halt_check = HALT_VOTED, |
| 671 | .halt_bit = 24, |
| 672 | .reset_mask = P_JPEG_P_CLK, |
| 673 | }, |
| 674 | .parent = &glbl_root_clk.c, |
| 675 | .c = { |
| 676 | .dbg_name = "jpeg_p_clk", |
| 677 | .ops = &clk_ops_branch, |
| 678 | CLK_INIT(jpeg_p_clk.c), |
| 679 | }, |
| 680 | }; |
| 681 | |
| 682 | static struct branch_clk lpa_p_clk = { |
| 683 | .b = { |
| 684 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 685 | .en_mask = BIT(7), |
| 686 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 687 | .halt_check = HALT_VOTED, |
| 688 | .halt_bit = 7, |
| 689 | .reset_mask = P_LPA_P_CLK, |
| 690 | }, |
| 691 | .parent = &glbl_root_clk.c, |
| 692 | .c = { |
| 693 | .dbg_name = "lpa_p_clk", |
| 694 | .ops = &clk_ops_branch, |
| 695 | CLK_INIT(lpa_p_clk.c), |
| 696 | }, |
| 697 | }; |
| 698 | |
| 699 | static struct branch_clk mdp_p_clk = { |
| 700 | .b = { |
| 701 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 702 | .en_mask = BIT(6), |
| 703 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 704 | .halt_check = HALT_VOTED, |
| 705 | .halt_bit = 6, |
| 706 | .reset_mask = P_MDP_P_CLK, |
| 707 | }, |
| 708 | .parent = &glbl_root_clk.c, |
| 709 | .c = { |
| 710 | .dbg_name = "mdp_p_clk", |
| 711 | .ops = &clk_ops_branch, |
| 712 | CLK_INIT(mdp_p_clk.c), |
| 713 | }, |
| 714 | }; |
| 715 | |
| 716 | static struct branch_clk mfc_p_clk = { |
| 717 | .b = { |
| 718 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 719 | .en_mask = BIT(26), |
| 720 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 721 | .halt_check = HALT_VOTED, |
| 722 | .halt_bit = 26, |
| 723 | .reset_mask = P_MFC_P_CLK, |
| 724 | }, |
| 725 | .parent = &glbl_root_clk.c, |
| 726 | .c = { |
| 727 | .dbg_name = "mfc_p_clk", |
| 728 | .ops = &clk_ops_branch, |
| 729 | CLK_INIT(mfc_p_clk.c), |
| 730 | }, |
| 731 | }; |
| 732 | |
| 733 | static struct branch_clk pmdh_p_clk = { |
| 734 | .b = { |
| 735 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 736 | .en_mask = BIT(4), |
| 737 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 738 | .halt_check = HALT_VOTED, |
| 739 | .halt_bit = 4, |
| 740 | .reset_mask = P_PMDH_P_CLK, |
| 741 | }, |
| 742 | .parent = &glbl_root_clk.c, |
| 743 | .c = { |
| 744 | .dbg_name = "pmdh_p_clk", |
| 745 | .ops = &clk_ops_branch, |
| 746 | CLK_INIT(pmdh_p_clk.c), |
| 747 | }, |
| 748 | }; |
| 749 | |
| 750 | static struct branch_clk rotator_imem_clk = { |
| 751 | .b = { |
| 752 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 753 | .en_mask = BIT(23), |
| 754 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 755 | .halt_check = HALT_VOTED, |
| 756 | .halt_bit = 23, |
| 757 | .reset_mask = P_ROTATOR_IMEM_CLK, |
| 758 | }, |
| 759 | .parent = &glbl_root_clk.c, |
| 760 | .c = { |
| 761 | .dbg_name = "rotator_imem_clk", |
| 762 | .ops = &clk_ops_branch, |
| 763 | CLK_INIT(rotator_imem_clk.c), |
| 764 | }, |
| 765 | }; |
| 766 | |
| 767 | static struct branch_clk rotator_p_clk = { |
| 768 | .b = { |
| 769 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 770 | .en_mask = BIT(25), |
| 771 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 772 | .halt_check = HALT_VOTED, |
| 773 | .halt_bit = 25, |
| 774 | .reset_mask = P_ROTATOR_P_CLK, |
| 775 | }, |
| 776 | .parent = &glbl_root_clk.c, |
| 777 | .c = { |
| 778 | .dbg_name = "rotator_p_clk", |
| 779 | .ops = &clk_ops_branch, |
| 780 | CLK_INIT(rotator_p_clk.c), |
| 781 | }, |
| 782 | }; |
| 783 | |
| 784 | static struct branch_clk sdc1_p_clk = { |
| 785 | .b = { |
| 786 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 787 | .en_mask = BIT(7), |
| 788 | .halt_reg = GLBL_CLK_STATE_REG, |
| 789 | .halt_check = HALT_VOTED, |
| 790 | .halt_bit = 7, |
| 791 | .reset_mask = P_SDC1_P_CLK, |
| 792 | }, |
| 793 | .parent = &glbl_root_clk.c, |
| 794 | .c = { |
| 795 | .dbg_name = "sdc1_p_clk", |
| 796 | .ops = &clk_ops_branch, |
| 797 | CLK_INIT(sdc1_p_clk.c), |
| 798 | }, |
| 799 | }; |
| 800 | |
| 801 | static struct branch_clk sdc2_p_clk = { |
| 802 | .b = { |
| 803 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 804 | .en_mask = BIT(8), |
| 805 | .halt_reg = GLBL_CLK_STATE_REG, |
| 806 | .halt_check = HALT_VOTED, |
| 807 | .halt_bit = 8, |
| 808 | .reset_mask = P_SDC2_P_CLK, |
| 809 | }, |
| 810 | .parent = &glbl_root_clk.c, |
| 811 | .c = { |
| 812 | .dbg_name = "sdc2_p_clk", |
| 813 | .ops = &clk_ops_branch, |
| 814 | CLK_INIT(sdc2_p_clk.c), |
| 815 | }, |
| 816 | }; |
| 817 | |
| 818 | static struct branch_clk sdc3_p_clk = { |
| 819 | .b = { |
| 820 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 821 | .en_mask = BIT(27), |
| 822 | .halt_reg = GLBL_CLK_STATE_REG, |
| 823 | .halt_check = HALT_VOTED, |
| 824 | .halt_bit = 27, |
| 825 | .reset_mask = P_SDC3_P_CLK, |
| 826 | }, |
| 827 | .parent = &glbl_root_clk.c, |
| 828 | .c = { |
| 829 | .dbg_name = "sdc3_p_clk", |
| 830 | .ops = &clk_ops_branch, |
| 831 | CLK_INIT(sdc3_p_clk.c), |
| 832 | }, |
| 833 | }; |
| 834 | |
| 835 | static struct branch_clk sdc4_p_clk = { |
| 836 | .b = { |
| 837 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 838 | .en_mask = BIT(28), |
| 839 | .halt_reg = GLBL_CLK_STATE_REG, |
| 840 | .halt_check = HALT_VOTED, |
| 841 | .halt_bit = 28, |
| 842 | .reset_mask = P_SDC4_P_CLK, |
| 843 | }, |
| 844 | .parent = &glbl_root_clk.c, |
| 845 | .c = { |
| 846 | .dbg_name = "sdc4_p_clk", |
| 847 | .ops = &clk_ops_branch, |
| 848 | CLK_INIT(sdc4_p_clk.c), |
| 849 | }, |
| 850 | }; |
| 851 | |
| 852 | static struct branch_clk spi_p_clk = { |
| 853 | .b = { |
| 854 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 855 | .en_mask = BIT(10), |
| 856 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 857 | .halt_check = HALT_VOTED, |
| 858 | .halt_bit = 10, |
| 859 | .reset_mask = P_SPI_P_CLK, |
| 860 | }, |
| 861 | .parent = &glbl_root_clk.c, |
| 862 | .c = { |
| 863 | .dbg_name = "spi_p_clk", |
| 864 | .ops = &clk_ops_branch, |
| 865 | CLK_INIT(spi_p_clk.c), |
| 866 | }, |
| 867 | }; |
| 868 | |
| 869 | static struct branch_clk tsif_p_clk = { |
| 870 | .b = { |
| 871 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 872 | .en_mask = BIT(18), |
| 873 | .halt_reg = GLBL_CLK_STATE_REG, |
| 874 | .halt_check = HALT_VOTED, |
| 875 | .halt_bit = 18, |
| 876 | .reset_mask = P_TSIF_P_CLK, |
| 877 | }, |
| 878 | .parent = &glbl_root_clk.c, |
| 879 | .c = { |
| 880 | .dbg_name = "tsif_p_clk", |
| 881 | .ops = &clk_ops_branch, |
| 882 | CLK_INIT(tsif_p_clk.c), |
| 883 | }, |
| 884 | }; |
| 885 | |
| 886 | static struct branch_clk uart1dm_p_clk = { |
| 887 | .b = { |
| 888 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 889 | .en_mask = BIT(17), |
| 890 | .halt_reg = GLBL_CLK_STATE_REG, |
| 891 | .halt_check = HALT_VOTED, |
| 892 | .halt_bit = 17, |
| 893 | }, |
| 894 | .parent = &glbl_root_clk.c, |
| 895 | .c = { |
| 896 | .dbg_name = "uart1dm_p_clk", |
| 897 | .ops = &clk_ops_branch, |
| 898 | CLK_INIT(uart1dm_p_clk.c), |
| 899 | }, |
| 900 | }; |
| 901 | |
| 902 | static struct branch_clk uart2dm_p_clk = { |
| 903 | .b = { |
| 904 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 905 | .en_mask = BIT(26), |
| 906 | .halt_reg = GLBL_CLK_STATE_REG, |
| 907 | .halt_check = HALT_VOTED, |
| 908 | .halt_bit = 26, |
| 909 | }, |
| 910 | .parent = &glbl_root_clk.c, |
| 911 | .c = { |
| 912 | .dbg_name = "uart2dm_p_clk", |
| 913 | .ops = &clk_ops_branch, |
| 914 | CLK_INIT(uart2dm_p_clk.c), |
| 915 | }, |
| 916 | }; |
| 917 | |
| 918 | static struct branch_clk usb_hs2_p_clk = { |
| 919 | .b = { |
| 920 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 921 | .en_mask = BIT(8), |
| 922 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 923 | .halt_check = HALT_VOTED, |
| 924 | .halt_bit = 8, |
| 925 | .reset_mask = P_USB_HS2_P_CLK, |
| 926 | }, |
| 927 | .parent = &glbl_root_clk.c, |
| 928 | .c = { |
| 929 | .dbg_name = "usb_hs2_p_clk", |
| 930 | .ops = &clk_ops_branch, |
| 931 | CLK_INIT(usb_hs2_p_clk.c), |
| 932 | }, |
| 933 | }; |
| 934 | |
| 935 | static struct branch_clk usb_hs3_p_clk = { |
| 936 | .b = { |
| 937 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 938 | .en_mask = BIT(9), |
| 939 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 940 | .halt_check = HALT_VOTED, |
| 941 | .halt_bit = 9, |
| 942 | .reset_mask = P_USB_HS3_P_CLK, |
| 943 | }, |
| 944 | .parent = &glbl_root_clk.c, |
| 945 | .c = { |
| 946 | .dbg_name = "usb_hs3_p_clk", |
| 947 | .ops = &clk_ops_branch, |
| 948 | CLK_INIT(usb_hs3_p_clk.c), |
| 949 | }, |
| 950 | }; |
| 951 | |
| 952 | static struct branch_clk usb_hs_p_clk = { |
| 953 | .b = { |
| 954 | .ctl_reg = GLBL_CLK_ENA_SC_REG, |
| 955 | .en_mask = BIT(25), |
| 956 | .halt_reg = GLBL_CLK_STATE_REG, |
| 957 | .halt_check = HALT_VOTED, |
| 958 | .halt_bit = 25, |
| 959 | .reset_mask = P_USB_HS_P_CLK, |
| 960 | }, |
| 961 | .parent = &glbl_root_clk.c, |
| 962 | .c = { |
| 963 | .dbg_name = "usb_hs_p_clk", |
| 964 | .ops = &clk_ops_branch, |
| 965 | CLK_INIT(usb_hs_p_clk.c), |
| 966 | }, |
| 967 | }; |
| 968 | |
| 969 | static struct branch_clk vfe_p_clk = { |
| 970 | .b = { |
| 971 | .ctl_reg = GLBL_CLK_ENA_2_SC_REG, |
| 972 | .en_mask = BIT(27), |
| 973 | .halt_reg = GLBL_CLK_STATE_2_REG, |
| 974 | .halt_check = HALT_VOTED, |
| 975 | .halt_bit = 27, |
| 976 | .reset_mask = P_VFE_P_CLK, |
| 977 | }, |
| 978 | .parent = &glbl_root_clk.c, |
| 979 | .c = { |
| 980 | .dbg_name = "vfe_p_clk", |
| 981 | .ops = &clk_ops_branch, |
| 982 | CLK_INIT(vfe_p_clk.c), |
| 983 | }, |
| 984 | }; |
| 985 | |
| 986 | static struct clk_freq_tbl clk_tbl_csi[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 987 | F_MND8( 0, 0, 0, gnd, 1, 0, 0), |
| 988 | F_MND8(153600000, 24, 17, pll1, 2, 2, 5), |
| 989 | F_MND8(192000000, 24, 17, pll1, 4, 0, 0), |
| 990 | F_MND8(384000000, 24, 17, pll1, 2, 0, 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 991 | F_END, |
| 992 | }; |
| 993 | |
| 994 | static struct rcg_clk csi0_clk = { |
| 995 | .b = { |
| 996 | .ctl_reg = CSI_NS_REG, |
| 997 | .en_mask = BIT(9), |
| 998 | .halt_reg = CLK_HALT_STATEC_REG, |
| 999 | .halt_bit = 17, |
| 1000 | .reset_mask = P_CSI0_CLK, |
| 1001 | }, |
| 1002 | .ns_reg = CSI_NS_REG, |
| 1003 | .md_reg = CSI_NS_REG - 4, |
| 1004 | .ns_mask = F_MASK_MND8(24, 17), |
| 1005 | .root_en_mask = BIT(11), |
| 1006 | .freq_tbl = clk_tbl_csi, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1007 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1008 | .set_rate = set_rate_mnd, |
| 1009 | .c = { |
| 1010 | .dbg_name = "csi0_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1011 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1012 | VDD_DIG_FMAX_MAP1(NOMINAL, 384000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1013 | CLK_INIT(csi0_clk.c), |
| 1014 | }, |
| 1015 | }; |
| 1016 | |
| 1017 | static struct clk_freq_tbl clk_tbl_tcxo[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1018 | F_RAW(19200000, &tcxo_clk.c, 0, 0, 0, 0, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1019 | F_END, |
| 1020 | }; |
| 1021 | |
| 1022 | static struct rcg_clk i2c_clk = { |
| 1023 | .b = { |
| 1024 | .ctl_reg = I2C_NS_REG, |
| 1025 | .en_mask = BIT(9), |
| 1026 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1027 | .halt_bit = 15, |
| 1028 | .reset_mask = P_I2C_CLK, |
| 1029 | }, |
| 1030 | .set_rate = set_rate_nop, |
| 1031 | .freq_tbl = clk_tbl_tcxo, |
| 1032 | .root_en_mask = BIT(11), |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1033 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1034 | .c = { |
| 1035 | .dbg_name = "i2c_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1036 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1037 | VDD_DIG_FMAX_MAP1(NOMINAL, 19200000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1038 | CLK_INIT(i2c_clk.c), |
| 1039 | }, |
| 1040 | }; |
| 1041 | |
| 1042 | static struct rcg_clk i2c_2_clk = { |
| 1043 | .b = { |
| 1044 | .ctl_reg = I2C_2_NS_REG, |
| 1045 | .en_mask = BIT(0), |
| 1046 | .halt_reg = CLK_HALT_STATEC_REG, |
| 1047 | .halt_bit = 2, |
| 1048 | .reset_mask = P_I2C_2_CLK, |
| 1049 | }, |
| 1050 | .root_en_mask = BIT(2), |
| 1051 | .freq_tbl = clk_tbl_tcxo, |
| 1052 | .set_rate = set_rate_nop, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1053 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1054 | .c = { |
| 1055 | .dbg_name = "i2c_2_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1056 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1057 | VDD_DIG_FMAX_MAP1(NOMINAL, 19200000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1058 | CLK_INIT(i2c_2_clk.c), |
| 1059 | }, |
| 1060 | }; |
| 1061 | |
| 1062 | static struct rcg_clk qup_i2c_clk = { |
| 1063 | .b = { |
| 1064 | .ctl_reg = QUP_I2C_NS_REG, |
| 1065 | .en_mask = BIT(0), |
| 1066 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1067 | .halt_bit = 31, |
| 1068 | .reset_mask = P_QUP_I2C_CLK, |
| 1069 | }, |
| 1070 | .root_en_mask = BIT(2), |
| 1071 | .freq_tbl = clk_tbl_tcxo, |
| 1072 | .set_rate = set_rate_nop, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1073 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1074 | .c = { |
| 1075 | .dbg_name = "qup_i2c_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1076 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1077 | VDD_DIG_FMAX_MAP1(NOMINAL, 19200000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1078 | CLK_INIT(qup_i2c_clk.c), |
| 1079 | }, |
| 1080 | }; |
| 1081 | |
| 1082 | static struct rcg_clk uart1_clk = { |
| 1083 | .b = { |
| 1084 | .ctl_reg = UART_NS_REG, |
| 1085 | .en_mask = BIT(5), |
| 1086 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1087 | .halt_bit = 7, |
| 1088 | .reset_mask = P_UART1_CLK, |
| 1089 | }, |
| 1090 | .root_en_mask = BIT(4), |
| 1091 | .freq_tbl = clk_tbl_tcxo, |
| 1092 | .set_rate = set_rate_nop, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1093 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1094 | .c = { |
| 1095 | .dbg_name = "uart1_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1096 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1097 | VDD_DIG_FMAX_MAP1(NOMINAL, 19200000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1098 | CLK_INIT(uart1_clk.c), |
| 1099 | }, |
| 1100 | }; |
| 1101 | |
| 1102 | static struct rcg_clk uart2_clk = { |
| 1103 | .b = { |
| 1104 | .ctl_reg = UART2_NS_REG, |
| 1105 | .en_mask = BIT(5), |
| 1106 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1107 | .halt_bit = 5, |
| 1108 | .reset_mask = P_UART2_CLK, |
| 1109 | }, |
| 1110 | .root_en_mask = BIT(4), |
| 1111 | .freq_tbl = clk_tbl_tcxo, |
| 1112 | .set_rate = set_rate_nop, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1113 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1114 | .c = { |
| 1115 | .dbg_name = "uart2_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1116 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1117 | VDD_DIG_FMAX_MAP1(NOMINAL, 19200000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1118 | CLK_INIT(uart2_clk.c), |
| 1119 | }, |
| 1120 | }; |
| 1121 | |
| 1122 | static struct clk_freq_tbl clk_tbl_uartdm[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1123 | F_MND16( 0, gnd, 1, 0, 0), |
| 1124 | F_MND16( 3686400, pll3, 3, 3, 200), |
| 1125 | F_MND16( 7372800, pll3, 3, 3, 100), |
| 1126 | F_MND16(14745600, pll3, 3, 3, 50), |
| 1127 | F_MND16(32000000, pll3, 3, 25, 192), |
| 1128 | F_MND16(40000000, pll3, 3, 125, 768), |
| 1129 | F_MND16(46400000, pll3, 3, 145, 768), |
| 1130 | F_MND16(48000000, pll3, 3, 25, 128), |
| 1131 | F_MND16(51200000, pll3, 3, 5, 24), |
| 1132 | F_MND16(56000000, pll3, 3, 175, 768), |
| 1133 | F_MND16(58982400, pll3, 3, 6, 25), |
| 1134 | F_MND16(64000000, pll1, 4, 1, 3), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1135 | F_END, |
| 1136 | }; |
| 1137 | |
| 1138 | static struct rcg_clk uart1dm_clk = { |
| 1139 | .b = { |
| 1140 | .ctl_reg = UART1DM_NS_REG, |
| 1141 | .en_mask = BIT(9), |
| 1142 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1143 | .halt_bit = 6, |
| 1144 | .reset_mask = P_UART1DM_CLK, |
| 1145 | }, |
| 1146 | .ns_reg = UART1DM_NS_REG, |
| 1147 | .md_reg = UART1DM_NS_REG - 4, |
| 1148 | .root_en_mask = BIT(11), |
| 1149 | .freq_tbl = clk_tbl_uartdm, |
| 1150 | .ns_mask = F_MASK_MND16, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1151 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1152 | .set_rate = set_rate_mnd, |
| 1153 | .c = { |
| 1154 | .dbg_name = "uart1dm_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1155 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1156 | VDD_DIG_FMAX_MAP1(NOMINAL, 64000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1157 | CLK_INIT(uart1dm_clk.c), |
| 1158 | }, |
| 1159 | }; |
| 1160 | |
| 1161 | static struct rcg_clk uart2dm_clk = { |
| 1162 | .b = { |
| 1163 | .ctl_reg = UART2DM_NS_REG, |
| 1164 | .en_mask = BIT(9), |
| 1165 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1166 | .halt_bit = 23, |
| 1167 | .reset_mask = P_UART2DM_CLK, |
| 1168 | }, |
| 1169 | .ns_reg = UART2DM_NS_REG, |
| 1170 | .md_reg = UART2DM_NS_REG - 4, |
| 1171 | .root_en_mask = BIT(11), |
| 1172 | .freq_tbl = clk_tbl_uartdm, |
| 1173 | .ns_mask = F_MASK_MND16, |
| 1174 | .set_rate = set_rate_mnd, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1175 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1176 | .c = { |
| 1177 | .dbg_name = "uart2dm_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1178 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1179 | VDD_DIG_FMAX_MAP1(NOMINAL, 64000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1180 | CLK_INIT(uart2dm_clk.c), |
| 1181 | }, |
| 1182 | }; |
| 1183 | |
| 1184 | static struct clk_freq_tbl clk_tbl_mdh[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1185 | F_BASIC( 0, gnd, 1), |
| 1186 | F_BASIC( 49150000, pll3, 15), |
| 1187 | F_BASIC( 92160000, pll3, 8), |
| 1188 | F_BASIC(122880000, pll3, 6), |
| 1189 | F_BASIC(184320000, pll3, 4), |
| 1190 | F_BASIC(245760000, pll3, 3), |
| 1191 | F_BASIC(368640000, pll3, 2), |
| 1192 | F_BASIC(384000000, pll1, 2), |
| 1193 | F_BASIC(445500000, pll4, 2), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1194 | F_END, |
| 1195 | }; |
| 1196 | |
| 1197 | static struct rcg_clk emdh_clk = { |
| 1198 | .b = { |
| 1199 | .ctl_reg = EMDH_NS_REG, |
| 1200 | .halt_check = DELAY, |
| 1201 | .reset_mask = P_EMDH_CLK, |
| 1202 | }, |
| 1203 | .root_en_mask = BIT(11), |
| 1204 | .ns_reg = EMDH_NS_REG, |
| 1205 | .ns_mask = F_MASK_BASIC, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1206 | .set_rate = set_rate_nop, |
| 1207 | .freq_tbl = clk_tbl_mdh, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1208 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1209 | .c = { |
| 1210 | .dbg_name = "emdh_clk", |
| 1211 | .flags = CLKFLAG_MIN | CLKFLAG_MAX, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1212 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1213 | VDD_DIG_FMAX_MAP1(NOMINAL, 445500000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1214 | CLK_INIT(emdh_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 1215 | .depends = &axi_li_adsp_a_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1216 | }, |
| 1217 | }; |
| 1218 | |
| 1219 | static struct rcg_clk pmdh_clk = { |
| 1220 | .b = { |
| 1221 | .ctl_reg = PMDH_NS_REG, |
| 1222 | .halt_check = DELAY, |
| 1223 | .reset_mask = P_PMDH_CLK, |
| 1224 | }, |
| 1225 | .root_en_mask = BIT(11), |
| 1226 | .ns_reg = PMDH_NS_REG, |
| 1227 | .ns_mask = F_MASK_BASIC, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1228 | .set_rate = set_rate_nop, |
| 1229 | .freq_tbl = clk_tbl_mdh, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1230 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1231 | .c = { |
| 1232 | .dbg_name = "pmdh_clk", |
| 1233 | .flags = CLKFLAG_MIN | CLKFLAG_MAX, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1234 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1235 | VDD_DIG_FMAX_MAP1(NOMINAL, 445500000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1236 | CLK_INIT(pmdh_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 1237 | .depends = &axi_li_adsp_a_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1238 | }, |
| 1239 | }; |
| 1240 | |
| 1241 | static struct clk_freq_tbl clk_tbl_grp[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1242 | F_BASIC( 24576000, lpxo, 1), |
| 1243 | F_BASIC( 46080000, pll3, 16), |
| 1244 | F_BASIC( 49152000, pll3, 15), |
| 1245 | F_BASIC( 52662875, pll3, 14), |
| 1246 | F_BASIC( 56713846, pll3, 13), |
| 1247 | F_BASIC( 61440000, pll3, 12), |
| 1248 | F_BASIC( 67025454, pll3, 11), |
| 1249 | F_BASIC( 73728000, pll3, 10), |
| 1250 | F_BASIC( 81920000, pll3, 9), |
| 1251 | F_BASIC( 92160000, pll3, 8), |
| 1252 | F_BASIC(105325714, pll3, 7), |
| 1253 | F_BASIC(122880000, pll3, 6), |
| 1254 | F_BASIC(147456000, pll3, 5), |
| 1255 | F_BASIC(184320000, pll3, 4), |
| 1256 | F_BASIC(192000000, pll1, 4), |
| 1257 | F_BASIC(245760000, pll3, 3), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1258 | /* Sync to AXI. Hence this "rate" is not fixed. */ |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1259 | F_RAW(1, &lpxo_clk.c, 0, BIT(14), 0, 0, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1260 | F_END, |
| 1261 | }; |
| 1262 | |
| 1263 | static struct rcg_clk grp_2d_clk = { |
| 1264 | .b = { |
| 1265 | .ctl_reg = GRP_2D_NS_REG, |
| 1266 | .en_mask = BIT(7), |
| 1267 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1268 | .halt_bit = 31, |
| 1269 | .reset_mask = P_GRP_2D_CLK, |
| 1270 | }, |
| 1271 | .ns_reg = GRP_2D_NS_REG, |
| 1272 | .root_en_mask = BIT(11), |
| 1273 | .ns_mask = F_MASK_BASIC | (7 << 12), |
| 1274 | .set_rate = set_rate_nop, |
| 1275 | .freq_tbl = clk_tbl_grp, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1276 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1277 | .c = { |
| 1278 | .dbg_name = "grp_2d_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1279 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1280 | VDD_DIG_FMAX_MAP2(NOMINAL, 192000000, HIGH, 245760000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1281 | CLK_INIT(grp_2d_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 1282 | .depends = &axi_grp_2d_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1283 | }, |
| 1284 | }; |
| 1285 | |
| 1286 | static struct rcg_clk grp_3d_src_clk = { |
| 1287 | .ns_reg = GRP_NS_REG, |
| 1288 | .b = { |
| 1289 | .ctl_reg = GRP_NS_REG, |
| 1290 | .halt_check = NOCHECK, |
| 1291 | }, |
| 1292 | .root_en_mask = BIT(11), |
| 1293 | .ns_mask = F_MASK_BASIC | (7 << 12), |
| 1294 | .set_rate = set_rate_nop, |
| 1295 | .freq_tbl = clk_tbl_grp, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1296 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1297 | .c = { |
| 1298 | .dbg_name = "grp_3d_src_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1299 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1300 | VDD_DIG_FMAX_MAP2(NOMINAL, 192000000, HIGH, 245760000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1301 | CLK_INIT(grp_3d_src_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 1302 | .depends = &axi_li_grp_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1303 | }, |
| 1304 | }; |
| 1305 | |
| 1306 | static struct branch_clk grp_3d_clk = { |
| 1307 | .b = { |
| 1308 | .ctl_reg = GRP_NS_REG, |
| 1309 | .en_mask = BIT(7), |
| 1310 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1311 | .halt_bit = 18, |
| 1312 | .reset_mask = P_GRP_3D_CLK, |
| 1313 | }, |
| 1314 | .parent = &grp_3d_src_clk.c, |
| 1315 | .c = { |
| 1316 | .dbg_name = "grp_3d_clk", |
| 1317 | .ops = &clk_ops_branch, |
| 1318 | CLK_INIT(grp_3d_clk.c), |
| 1319 | }, |
| 1320 | }; |
| 1321 | |
| 1322 | static struct branch_clk imem_clk = { |
| 1323 | .b = { |
| 1324 | .ctl_reg = GRP_NS_REG, |
| 1325 | .en_mask = BIT(9), |
| 1326 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1327 | .halt_bit = 19, |
| 1328 | .reset_mask = P_IMEM_CLK, |
| 1329 | }, |
| 1330 | .parent = &grp_3d_src_clk.c, |
| 1331 | .c = { |
| 1332 | .dbg_name = "imem_clk", |
| 1333 | .ops = &clk_ops_branch, |
| 1334 | CLK_INIT(imem_clk.c), |
| 1335 | }, |
| 1336 | }; |
| 1337 | |
| 1338 | static struct clk_freq_tbl clk_tbl_sdc1_3[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1339 | F_MND8( 0, 0, 0, gnd, 1, 0, 0), |
| 1340 | F_MND8( 144000, 19, 12, lpxo, 1, 1, 171), |
| 1341 | F_MND8( 400000, 19, 12, lpxo, 1, 2, 123), |
| 1342 | F_MND8(16027000, 19, 12, pll3, 3, 14, 215), |
| 1343 | F_MND8(17000000, 19, 12, pll3, 4, 19, 206), |
| 1344 | F_MND8(20480000, 19, 12, pll3, 4, 23, 212), |
| 1345 | F_MND8(24576000, 19, 12, lpxo, 1, 0, 0), |
| 1346 | F_MND8(49152000, 19, 12, pll3, 3, 1, 5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1347 | F_END, |
| 1348 | }; |
| 1349 | |
| 1350 | static struct rcg_clk sdc1_clk = { |
| 1351 | .b = { |
| 1352 | .ctl_reg = SDCn_NS_REG(1), |
| 1353 | .en_mask = BIT(9), |
| 1354 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1355 | .halt_bit = 1, |
| 1356 | .reset_mask = P_SDC1_CLK, |
| 1357 | }, |
| 1358 | .ns_reg = SDCn_NS_REG(1), |
| 1359 | .md_reg = SDCn_NS_REG(1) - 4, |
| 1360 | .ns_mask = F_MASK_MND8(19, 12), |
| 1361 | .root_en_mask = BIT(11), |
| 1362 | .freq_tbl = clk_tbl_sdc1_3, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1363 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1364 | .set_rate = set_rate_mnd, |
| 1365 | .c = { |
| 1366 | .dbg_name = "sdc1_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1367 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1368 | VDD_DIG_FMAX_MAP1(NOMINAL, 49152000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1369 | CLK_INIT(sdc1_clk.c), |
| 1370 | }, |
| 1371 | }; |
| 1372 | |
| 1373 | static struct rcg_clk sdc3_clk = { |
| 1374 | .b = { |
| 1375 | .ctl_reg = SDCn_NS_REG(3), |
| 1376 | .en_mask = BIT(9), |
| 1377 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1378 | .halt_bit = 24, |
| 1379 | .reset_mask = P_SDC3_CLK, |
| 1380 | }, |
| 1381 | .ns_reg = SDCn_NS_REG(3), |
| 1382 | .md_reg = SDCn_NS_REG(3) - 4, |
| 1383 | .ns_mask = F_MASK_MND8(19, 12), |
| 1384 | .root_en_mask = BIT(11), |
| 1385 | .freq_tbl = clk_tbl_sdc1_3, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1386 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1387 | .set_rate = set_rate_mnd, |
| 1388 | .c = { |
| 1389 | .dbg_name = "sdc3_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1390 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1391 | VDD_DIG_FMAX_MAP1(NOMINAL, 49152000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1392 | CLK_INIT(sdc3_clk.c), |
| 1393 | }, |
| 1394 | }; |
| 1395 | |
| 1396 | static struct clk_freq_tbl clk_tbl_sdc2_4[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1397 | F_MND8( 0, 0, 0, gnd, 1, 0, 0), |
| 1398 | F_MND8( 144000, 20, 13, lpxo, 1, 1, 171), |
| 1399 | F_MND8( 400000, 20, 13, lpxo, 1, 2, 123), |
| 1400 | F_MND8(16027000, 20, 13, pll3, 3, 14, 215), |
| 1401 | F_MND8(17000000, 20, 13, pll3, 4, 19, 206), |
| 1402 | F_MND8(20480000, 20, 13, pll3, 4, 23, 212), |
| 1403 | F_MND8(24576000, 20, 13, lpxo, 1, 0, 0), |
| 1404 | F_MND8(49152000, 20, 13, pll3, 3, 1, 5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1405 | F_END, |
| 1406 | }; |
| 1407 | |
| 1408 | static struct rcg_clk sdc2_clk = { |
| 1409 | .b = { |
| 1410 | .ctl_reg = SDCn_NS_REG(2), |
| 1411 | .en_mask = BIT(9), |
| 1412 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1413 | .halt_bit = 0, |
| 1414 | .reset_mask = P_SDC2_CLK, |
| 1415 | }, |
| 1416 | .ns_reg = SDCn_NS_REG(2), |
| 1417 | .md_reg = SDCn_NS_REG(2) - 4, |
| 1418 | .ns_mask = F_MASK_MND8(20, 13), |
| 1419 | .root_en_mask = BIT(11), |
| 1420 | .freq_tbl = clk_tbl_sdc2_4, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1421 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1422 | .set_rate = set_rate_mnd, |
| 1423 | .c = { |
| 1424 | .dbg_name = "sdc2_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1425 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1426 | VDD_DIG_FMAX_MAP1(NOMINAL, 49152000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1427 | CLK_INIT(sdc2_clk.c), |
| 1428 | }, |
| 1429 | }; |
| 1430 | |
| 1431 | static struct rcg_clk sdc4_clk = { |
| 1432 | .b = { |
| 1433 | .ctl_reg = SDCn_NS_REG(4), |
| 1434 | .en_mask = BIT(9), |
| 1435 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1436 | .halt_bit = 25, |
| 1437 | .reset_mask = P_SDC4_CLK, |
| 1438 | }, |
| 1439 | .ns_reg = SDCn_NS_REG(4), |
| 1440 | .md_reg = SDCn_NS_REG(4) - 4, |
| 1441 | .ns_mask = F_MASK_MND8(20, 13), |
| 1442 | .root_en_mask = BIT(11), |
| 1443 | .freq_tbl = clk_tbl_sdc2_4, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1444 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1445 | .set_rate = set_rate_mnd, |
| 1446 | .c = { |
| 1447 | .dbg_name = "sdc4_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1448 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1449 | VDD_DIG_FMAX_MAP1(NOMINAL, 49152000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1450 | CLK_INIT(sdc4_clk.c), |
| 1451 | }, |
| 1452 | }; |
| 1453 | |
| 1454 | static struct clk_freq_tbl clk_tbl_mdp_core[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1455 | F_BASIC( 24576000, lpxo, 1), |
| 1456 | F_BASIC( 46080000, pll3, 16), |
| 1457 | F_BASIC( 49152000, pll3, 15), |
| 1458 | F_BASIC( 52663000, pll3, 14), |
| 1459 | F_BASIC( 92160000, pll3, 8), |
| 1460 | F_BASIC(122880000, pll3, 6), |
| 1461 | F_BASIC(147456000, pll3, 5), |
| 1462 | F_BASIC(153600000, pll1, 5), |
| 1463 | F_BASIC(192000000, pll1, 4), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1464 | F_END, |
| 1465 | }; |
| 1466 | |
| 1467 | static struct rcg_clk mdp_clk = { |
| 1468 | .b = { |
| 1469 | .ctl_reg = MDP_NS_REG, |
| 1470 | .en_mask = BIT(9), |
| 1471 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1472 | .halt_bit = 16, |
| 1473 | .reset_mask = P_MDP_CLK, |
| 1474 | }, |
| 1475 | .ns_reg = MDP_NS_REG, |
| 1476 | .root_en_mask = BIT(11), |
| 1477 | .ns_mask = F_MASK_BASIC, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1478 | .set_rate = set_rate_nop, |
| 1479 | .freq_tbl = clk_tbl_mdp_core, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1480 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1481 | .c = { |
| 1482 | .dbg_name = "mdp_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1483 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1484 | VDD_DIG_FMAX_MAP2(NOMINAL, 153600000, HIGH, 192000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1485 | CLK_INIT(mdp_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 1486 | .depends = &axi_mdp_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1487 | }, |
| 1488 | }; |
| 1489 | |
| 1490 | static struct clk_freq_tbl clk_tbl_mdp_lcdc[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1491 | F_MND16( 0, gnd, 1, 0, 0), |
| 1492 | F_MND16(24576000, lpxo, 1, 0, 0), |
| 1493 | F_MND16(30720000, pll3, 4, 1, 6), |
| 1494 | F_MND16(32768000, pll3, 3, 2, 15), |
| 1495 | F_MND16(40960000, pll3, 2, 1, 9), |
| 1496 | F_MND16(73728000, pll3, 2, 1, 5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1497 | F_END, |
| 1498 | }; |
| 1499 | |
| 1500 | static struct rcg_clk mdp_lcdc_pclk_clk = { |
| 1501 | .b = { |
| 1502 | .ctl_reg = MDP_LCDC_NS_REG, |
| 1503 | .en_mask = BIT(9), |
| 1504 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1505 | .halt_bit = 28, |
| 1506 | .reset_mask = P_MDP_LCDC_PCLK_CLK, |
| 1507 | }, |
| 1508 | .ns_reg = MDP_LCDC_NS_REG, |
| 1509 | .md_reg = MDP_LCDC_NS_REG - 4, |
| 1510 | .root_en_mask = BIT(11), |
| 1511 | .ns_mask = F_MASK_MND16, |
| 1512 | .set_rate = set_rate_mnd, |
| 1513 | .freq_tbl = clk_tbl_mdp_lcdc, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1514 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1515 | .c = { |
| 1516 | .dbg_name = "mdp_lcdc_pclk_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1517 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1518 | VDD_DIG_FMAX_MAP1(NOMINAL, 73728000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1519 | CLK_INIT(mdp_lcdc_pclk_clk.c), |
| 1520 | }, |
| 1521 | }; |
| 1522 | |
| 1523 | static struct branch_clk mdp_lcdc_pad_pclk_clk = { |
| 1524 | .b = { |
| 1525 | .ctl_reg = MDP_LCDC_NS_REG, |
| 1526 | .en_mask = BIT(12), |
| 1527 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1528 | .halt_bit = 29, |
| 1529 | .reset_mask = P_MDP_LCDC_PAD_PCLK_CLK, |
| 1530 | }, |
| 1531 | .parent = &mdp_lcdc_pclk_clk.c, |
| 1532 | .c = { |
| 1533 | .dbg_name = "mdp_lcdc_pad_pclk_clk", |
| 1534 | .ops = &clk_ops_branch, |
| 1535 | CLK_INIT(mdp_lcdc_pad_pclk_clk.c), |
| 1536 | }, |
| 1537 | }; |
| 1538 | |
| 1539 | static struct clk_freq_tbl clk_tbl_mdp_vsync[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1540 | F_RAW( 0, &gnd_clk.c, 0, (0x3<<2), 0, 0, NULL), |
| 1541 | F_RAW(24576000, &lpxo_clk.c, 0, (0x1<<2), 0, 0, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1542 | F_END, |
| 1543 | }; |
| 1544 | |
| 1545 | static struct rcg_clk mdp_vsync_clk = { |
| 1546 | .b = { |
| 1547 | .ctl_reg = MDP_VSYNC_REG, |
| 1548 | .en_mask = BIT(0), |
| 1549 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1550 | .halt_bit = 30, |
| 1551 | .reset_mask = P_MDP_VSYNC_CLK, |
| 1552 | }, |
| 1553 | .ns_reg = MDP_VSYNC_REG, |
| 1554 | .ns_mask = BM(3, 2), |
| 1555 | .freq_tbl = clk_tbl_mdp_vsync, |
| 1556 | .set_rate = set_rate_nop, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1557 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1558 | .c = { |
| 1559 | .dbg_name = "mdp_vsync_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1560 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1561 | VDD_DIG_FMAX_MAP1(NOMINAL, 24576000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1562 | CLK_INIT(mdp_vsync_clk.c), |
| 1563 | }, |
| 1564 | }; |
| 1565 | |
| 1566 | static struct clk_freq_tbl clk_tbl_mi2s_codec[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1567 | F_MND16( 0, gnd, 1, 0, 0), |
| 1568 | F_MND16( 2048000, lpxo, 4, 1, 3), |
| 1569 | F_MND16(12288000, lpxo, 2, 0, 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1570 | F_END, |
| 1571 | }; |
| 1572 | |
| 1573 | static struct rcg_clk mi2s_codec_rx_m_clk = { |
| 1574 | .b = { |
| 1575 | .ctl_reg = MI2S_RX_NS_REG, |
| 1576 | .en_mask = BIT(12), |
| 1577 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1578 | .halt_bit = 12, |
| 1579 | .reset_mask = P_MI2S_CODEC_RX_M_CLK, |
| 1580 | }, |
| 1581 | .ns_reg = MI2S_RX_NS_REG, |
| 1582 | .md_reg = MI2S_RX_NS_REG - 4, |
| 1583 | .root_en_mask = BIT(11), |
| 1584 | .ns_mask = F_MASK_MND16, |
| 1585 | .set_rate = set_rate_mnd, |
| 1586 | .freq_tbl = clk_tbl_mi2s_codec, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1587 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1588 | .c = { |
| 1589 | .dbg_name = "mi2s_codec_rx_m_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1590 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1591 | VDD_DIG_FMAX_MAP1(NOMINAL, 12288000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1592 | CLK_INIT(mi2s_codec_rx_m_clk.c), |
| 1593 | }, |
| 1594 | }; |
| 1595 | |
| 1596 | static struct branch_clk mi2s_codec_rx_s_clk = { |
| 1597 | .b = { |
| 1598 | .ctl_reg = MI2S_RX_NS_REG, |
| 1599 | .en_mask = BIT(9), |
| 1600 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1601 | .halt_bit = 13, |
| 1602 | .reset_mask = P_MI2S_CODEC_RX_S_CLK, |
| 1603 | }, |
| 1604 | .parent = &mi2s_codec_rx_m_clk.c, |
| 1605 | .c = { |
| 1606 | .dbg_name = "mi2s_codec_rx_s_clk", |
| 1607 | .ops = &clk_ops_branch, |
| 1608 | CLK_INIT(mi2s_codec_rx_s_clk.c), |
| 1609 | }, |
| 1610 | }; |
| 1611 | |
| 1612 | static struct rcg_clk mi2s_codec_tx_m_clk = { |
| 1613 | .b = { |
| 1614 | .ctl_reg = MI2S_TX_NS_REG, |
| 1615 | .en_mask = BIT(12), |
| 1616 | .halt_reg = CLK_HALT_STATEC_REG, |
| 1617 | .halt_bit = 8, |
| 1618 | .reset_mask = P_MI2S_CODEC_TX_M_CLK, |
| 1619 | }, |
| 1620 | .ns_reg = MI2S_TX_NS_REG, |
| 1621 | .md_reg = MI2S_TX_NS_REG - 4, |
| 1622 | .root_en_mask = BIT(11), |
| 1623 | .ns_mask = F_MASK_MND16, |
| 1624 | .set_rate = set_rate_mnd, |
| 1625 | .freq_tbl = clk_tbl_mi2s_codec, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1626 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1627 | .c = { |
| 1628 | .dbg_name = "mi2s_codec_tx_m_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1629 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1630 | VDD_DIG_FMAX_MAP1(NOMINAL, 12288000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1631 | CLK_INIT(mi2s_codec_tx_m_clk.c), |
| 1632 | }, |
| 1633 | }; |
| 1634 | |
| 1635 | static struct branch_clk mi2s_codec_tx_s_clk = { |
| 1636 | .b = { |
| 1637 | .ctl_reg = MI2S_TX_NS_REG, |
| 1638 | .en_mask = BIT(9), |
| 1639 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1640 | .halt_bit = 11, |
| 1641 | .reset_mask = P_MI2S_CODEC_TX_S_CLK, |
| 1642 | }, |
| 1643 | .parent = &mi2s_codec_tx_m_clk.c, |
| 1644 | .c = { |
| 1645 | .dbg_name = "mi2s_codec_tx_s_clk", |
| 1646 | .ops = &clk_ops_branch, |
| 1647 | CLK_INIT(mi2s_codec_tx_s_clk.c), |
| 1648 | }, |
| 1649 | }; |
| 1650 | |
| 1651 | static struct clk_freq_tbl clk_tbl_mi2s[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1652 | F_MND16( 0, gnd, 1, 0, 0), |
| 1653 | F_MND16(12288000, lpxo, 2, 0, 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1654 | F_END, |
| 1655 | }; |
| 1656 | |
| 1657 | static struct rcg_clk mi2s_m_clk = { |
| 1658 | .b = { |
| 1659 | .ctl_reg = MI2S_NS_REG, |
| 1660 | .en_mask = BIT(12), |
| 1661 | .halt_reg = CLK_HALT_STATEC_REG, |
| 1662 | .halt_bit = 4, |
| 1663 | .reset_mask = P_MI2S_M_CLK, |
| 1664 | }, |
| 1665 | .ns_reg = MI2S_NS_REG, |
| 1666 | .md_reg = MI2S_NS_REG - 4, |
| 1667 | .root_en_mask = BIT(11), |
| 1668 | .ns_mask = F_MASK_MND16, |
| 1669 | .set_rate = set_rate_mnd, |
| 1670 | .freq_tbl = clk_tbl_mi2s, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1671 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1672 | .c = { |
| 1673 | .dbg_name = "mi2s_m_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1674 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1675 | VDD_DIG_FMAX_MAP1(NOMINAL, 12288000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1676 | CLK_INIT(mi2s_m_clk.c), |
| 1677 | }, |
| 1678 | }; |
| 1679 | |
| 1680 | static struct branch_clk mi2s_s_clk = { |
| 1681 | .b = { |
| 1682 | .ctl_reg = MI2S_NS_REG, |
| 1683 | .en_mask = BIT(9), |
| 1684 | .halt_reg = CLK_HALT_STATEC_REG, |
| 1685 | .halt_bit = 3, |
| 1686 | .reset_mask = P_MI2S_S_CLK, |
| 1687 | }, |
| 1688 | .parent = &mi2s_m_clk.c, |
| 1689 | .c = { |
| 1690 | .dbg_name = "mi2s_s_clk", |
| 1691 | .ops = &clk_ops_branch, |
| 1692 | CLK_INIT(mi2s_s_clk.c), |
| 1693 | }, |
| 1694 | }; |
| 1695 | |
| 1696 | static struct clk_freq_tbl clk_tbl_midi[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1697 | F_MND8( 0, 0, 0, gnd, 1, 0, 0), |
| 1698 | F_MND8(98304000, 19, 12, pll3, 3, 2, 5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1699 | F_END, |
| 1700 | }; |
| 1701 | |
| 1702 | static struct rcg_clk midi_clk = { |
| 1703 | .b = { |
| 1704 | .ctl_reg = MIDI_NS_REG, |
| 1705 | .en_mask = BIT(9), |
| 1706 | .halt_reg = CLK_HALT_STATEC_REG, |
| 1707 | .halt_bit = 1, |
| 1708 | }, |
| 1709 | .ns_reg = MIDI_NS_REG, |
| 1710 | .md_reg = MIDI_NS_REG - 4, |
| 1711 | .ns_mask = F_MASK_MND8(19, 12), |
| 1712 | .root_en_mask = BIT(11), |
| 1713 | .freq_tbl = clk_tbl_midi, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1714 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1715 | .set_rate = set_rate_mnd, |
| 1716 | .c = { |
| 1717 | .dbg_name = "midi_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1718 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1719 | VDD_DIG_FMAX_MAP1(NOMINAL, 98304000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1720 | CLK_INIT(midi_clk.c), |
| 1721 | }, |
| 1722 | }; |
| 1723 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1724 | #define F_SDAC(f, s, div, m, n) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1725 | { \ |
| 1726 | .freq_hz = f, \ |
| 1727 | .md_val = MD16(m, n), \ |
| 1728 | .ns_val = N16(m, n) | SPDIV(SRC_SEL_SDAC_##s, div), \ |
| 1729 | .mnd_en_mask = BIT(8) * !!(n), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1730 | .src_clk = &s##_clk.c, \ |
| 1731 | } |
| 1732 | |
| 1733 | static struct clk_freq_tbl clk_tbl_sdac[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1734 | F_SDAC( 256000, lpxo, 4, 1, 24), |
| 1735 | F_SDAC( 352800, lpxo, 1, 147, 10240), |
| 1736 | F_SDAC( 384000, lpxo, 4, 1, 16), |
| 1737 | F_SDAC( 512000, lpxo, 4, 1, 12), |
| 1738 | F_SDAC( 705600, lpxo, 1, 147, 5120), |
| 1739 | F_SDAC( 768000, lpxo, 4, 1, 8), |
| 1740 | F_SDAC(1024000, lpxo, 4, 1, 6), |
| 1741 | F_SDAC(1411200, lpxo, 1, 147, 2560), |
| 1742 | F_SDAC(1536000, lpxo, 4, 1, 4), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1743 | F_END, |
| 1744 | }; |
| 1745 | |
| 1746 | static struct rcg_clk sdac_clk = { |
| 1747 | .b = { |
| 1748 | .ctl_reg = SDAC_NS_REG, |
| 1749 | .en_mask = BIT(9), |
| 1750 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1751 | .halt_bit = 2, |
| 1752 | .reset_mask = P_SDAC_CLK, |
| 1753 | }, |
| 1754 | .ns_reg = SDAC_NS_REG, |
| 1755 | .md_reg = SDAC_NS_REG - 4, |
| 1756 | .root_en_mask = BIT(11), |
| 1757 | .freq_tbl = clk_tbl_sdac, |
| 1758 | .ns_mask = F_MASK_MND16, |
| 1759 | .set_rate = set_rate_mnd, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1760 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1761 | .c = { |
| 1762 | .dbg_name = "sdac_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1763 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1764 | VDD_DIG_FMAX_MAP1(NOMINAL, 1536000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1765 | CLK_INIT(sdac_clk.c), |
| 1766 | }, |
| 1767 | }; |
| 1768 | |
| 1769 | static struct branch_clk sdac_m_clk = { |
| 1770 | .b = { |
| 1771 | .ctl_reg = SDAC_NS_REG, |
| 1772 | .en_mask = BIT(12), |
| 1773 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1774 | .halt_bit = 17, |
| 1775 | .reset_mask = P_SDAC_M_CLK, |
| 1776 | }, |
| 1777 | .parent = &sdac_clk.c, |
| 1778 | .c = { |
| 1779 | .dbg_name = "sdac_m_clk", |
| 1780 | .ops = &clk_ops_branch, |
| 1781 | CLK_INIT(sdac_m_clk.c), |
| 1782 | }, |
| 1783 | }; |
| 1784 | |
| 1785 | static struct clk_freq_tbl clk_tbl_tv[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1786 | F_MND8( 0, 0, 0, gnd, 1, 0, 0), |
| 1787 | F_MND8(27000000, 23, 16, pll4, 2, 2, 33), |
| 1788 | F_MND8(74250000, 23, 16, pll4, 2, 1, 6), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1789 | F_END, |
| 1790 | }; |
| 1791 | |
| 1792 | static struct rcg_clk tv_clk = { |
| 1793 | .ns_reg = TV_NS_REG, |
| 1794 | .b = { |
| 1795 | .ctl_reg = TV_NS_REG, |
| 1796 | .halt_check = NOCHECK, |
| 1797 | }, |
| 1798 | .md_reg = TV_NS_REG - 4, |
| 1799 | .ns_mask = F_MASK_MND8(23, 16), |
| 1800 | .root_en_mask = BIT(11), |
| 1801 | .freq_tbl = clk_tbl_tv, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1802 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1803 | .set_rate = set_rate_mnd, |
| 1804 | .c = { |
| 1805 | .dbg_name = "tv_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1806 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1807 | VDD_DIG_FMAX_MAP1(NOMINAL, 74250000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1808 | CLK_INIT(tv_clk.c), |
| 1809 | }, |
| 1810 | }; |
| 1811 | |
| 1812 | static struct branch_clk hdmi_clk = { |
| 1813 | .b = { |
| 1814 | .ctl_reg = HDMI_NS_REG, |
| 1815 | .en_mask = BIT(9), |
| 1816 | .halt_reg = CLK_HALT_STATEC_REG, |
| 1817 | .halt_bit = 7, |
| 1818 | .reset_mask = P_HDMI_CLK, |
| 1819 | }, |
| 1820 | .parent = &tv_clk.c, |
| 1821 | .c = { |
| 1822 | .dbg_name = "hdmi_clk", |
| 1823 | .ops = &clk_ops_branch, |
| 1824 | CLK_INIT(hdmi_clk.c), |
| 1825 | }, |
| 1826 | }; |
| 1827 | |
| 1828 | static struct branch_clk tv_dac_clk = { |
| 1829 | .b = { |
| 1830 | .ctl_reg = TV_NS_REG, |
| 1831 | .en_mask = BIT(12), |
| 1832 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1833 | .halt_bit = 27, |
| 1834 | .reset_mask = P_TV_DAC_CLK, |
| 1835 | }, |
| 1836 | .parent = &tv_clk.c, |
| 1837 | .c = { |
| 1838 | .dbg_name = "tv_dac_clk", |
| 1839 | .ops = &clk_ops_branch, |
| 1840 | CLK_INIT(tv_dac_clk.c), |
| 1841 | }, |
| 1842 | }; |
| 1843 | |
| 1844 | static struct branch_clk tv_enc_clk = { |
| 1845 | .b = { |
| 1846 | .ctl_reg = TV_NS_REG, |
| 1847 | .en_mask = BIT(9), |
| 1848 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1849 | .halt_bit = 10, |
| 1850 | .reset_mask = P_TV_ENC_CLK, |
| 1851 | }, |
| 1852 | .parent = &tv_clk.c, |
| 1853 | .c = { |
| 1854 | .dbg_name = "tv_enc_clk", |
| 1855 | .ops = &clk_ops_branch, |
| 1856 | CLK_INIT(tv_enc_clk.c), |
| 1857 | }, |
| 1858 | }; |
| 1859 | |
| 1860 | /* Hacking root & branch into one param. */ |
| 1861 | static struct branch_clk tsif_ref_clk = { |
| 1862 | .b = { |
| 1863 | .ctl_reg = TSIF_NS_REG, |
| 1864 | .en_mask = BIT(9)|BIT(11), |
| 1865 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1866 | .halt_bit = 11, |
| 1867 | .reset_mask = P_TSIF_REF_CLK, |
| 1868 | }, |
| 1869 | .parent = &tv_clk.c, |
| 1870 | .c = { |
| 1871 | .dbg_name = "tsif_ref_clk", |
| 1872 | .ops = &clk_ops_branch, |
| 1873 | CLK_INIT(tsif_ref_clk.c), |
| 1874 | }, |
| 1875 | }; |
| 1876 | |
| 1877 | static struct clk_freq_tbl clk_tbl_usb[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1878 | F_MND8( 0, 0, 0, gnd, 1, 0, 0), |
| 1879 | F_MND8(60000000, 23, 16, pll1, 2, 5, 32), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1880 | F_END, |
| 1881 | }; |
| 1882 | |
| 1883 | static struct rcg_clk usb_hs_src_clk = { |
| 1884 | .ns_reg = USBH_NS_REG, |
| 1885 | .b = { |
| 1886 | .ctl_reg = USBH_NS_REG, |
| 1887 | .halt_check = NOCHECK, |
| 1888 | }, |
| 1889 | .md_reg = USBH_NS_REG - 4, |
| 1890 | .ns_mask = F_MASK_MND8(23, 16), |
| 1891 | .root_en_mask = BIT(11), |
| 1892 | .freq_tbl = clk_tbl_usb, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1893 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1894 | .set_rate = set_rate_mnd, |
| 1895 | .c = { |
| 1896 | .dbg_name = "usb_hs_src_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1897 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 1898 | VDD_DIG_FMAX_MAP1(NOMINAL, 60000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1899 | CLK_INIT(usb_hs_src_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 1900 | .depends = &axi_li_adsp_a_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1901 | }, |
| 1902 | }; |
| 1903 | |
| 1904 | static struct branch_clk usb_hs_clk = { |
| 1905 | .b = { |
| 1906 | .ctl_reg = USBH_NS_REG, |
| 1907 | .en_mask = BIT(9), |
| 1908 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1909 | .halt_bit = 26, |
| 1910 | .reset_mask = P_USB_HS_CLK, |
| 1911 | }, |
| 1912 | .c = { |
| 1913 | .dbg_name = "usb_hs_clk", |
| 1914 | .ops = &clk_ops_branch, |
| 1915 | CLK_INIT(usb_hs_clk.c), |
| 1916 | }, |
| 1917 | }; |
| 1918 | |
| 1919 | static struct branch_clk usb_hs_core_clk = { |
| 1920 | .b = { |
| 1921 | .ctl_reg = USBH_NS_REG, |
| 1922 | .en_mask = BIT(13), |
| 1923 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1924 | .halt_bit = 27, |
| 1925 | .reset_mask = P_USB_HS_CORE_CLK, |
| 1926 | }, |
| 1927 | .parent = &usb_hs_src_clk.c, |
| 1928 | .c = { |
| 1929 | .dbg_name = "usb_hs_core_clk", |
| 1930 | .ops = &clk_ops_branch, |
| 1931 | CLK_INIT(usb_hs_core_clk.c), |
| 1932 | }, |
| 1933 | }; |
| 1934 | |
| 1935 | static struct branch_clk usb_hs2_clk = { |
| 1936 | .b = { |
| 1937 | .ctl_reg = USBH2_NS_REG, |
| 1938 | .en_mask = BIT(9), |
| 1939 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1940 | .halt_bit = 3, |
| 1941 | .reset_mask = P_USB_HS2_CLK, |
| 1942 | }, |
| 1943 | .parent = &usb_hs_src_clk.c, |
| 1944 | .c = { |
| 1945 | .dbg_name = "usb_hs2_clk", |
| 1946 | .ops = &clk_ops_branch, |
| 1947 | CLK_INIT(usb_hs2_clk.c), |
| 1948 | }, |
| 1949 | }; |
| 1950 | |
| 1951 | static struct branch_clk usb_hs2_core_clk = { |
| 1952 | .b = { |
| 1953 | .ctl_reg = USBH2_NS_REG, |
| 1954 | .en_mask = BIT(4), |
| 1955 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1956 | .halt_bit = 28, |
| 1957 | .reset_mask = P_USB_HS2_CORE_CLK, |
| 1958 | }, |
| 1959 | .parent = &usb_hs_src_clk.c, |
| 1960 | .c = { |
| 1961 | .dbg_name = "usb_hs2_core_clk", |
| 1962 | .ops = &clk_ops_branch, |
| 1963 | CLK_INIT(usb_hs2_core_clk.c), |
| 1964 | }, |
| 1965 | }; |
| 1966 | |
| 1967 | static struct branch_clk usb_hs3_clk = { |
| 1968 | .b = { |
| 1969 | .ctl_reg = USBH3_NS_REG, |
| 1970 | .en_mask = BIT(9), |
| 1971 | .halt_reg = CLK_HALT_STATEB_REG, |
| 1972 | .halt_bit = 2, |
| 1973 | .reset_mask = P_USB_HS3_CLK, |
| 1974 | }, |
| 1975 | .parent = &usb_hs_src_clk.c, |
| 1976 | .c = { |
| 1977 | .dbg_name = "usb_hs3_clk", |
| 1978 | .ops = &clk_ops_branch, |
| 1979 | CLK_INIT(usb_hs3_clk.c), |
| 1980 | }, |
| 1981 | }; |
| 1982 | |
| 1983 | static struct branch_clk usb_hs3_core_clk = { |
| 1984 | .b = { |
| 1985 | .ctl_reg = USBH3_NS_REG, |
| 1986 | .en_mask = BIT(4), |
| 1987 | .halt_reg = CLK_HALT_STATEA_REG, |
| 1988 | .halt_bit = 29, |
| 1989 | .reset_mask = P_USB_HS3_CORE_CLK, |
| 1990 | }, |
| 1991 | .parent = &usb_hs_src_clk.c, |
| 1992 | .c = { |
| 1993 | .dbg_name = "usb_hs3_core_clk", |
| 1994 | .ops = &clk_ops_branch, |
| 1995 | CLK_INIT(usb_hs3_core_clk.c), |
| 1996 | }, |
| 1997 | }; |
| 1998 | |
| 1999 | static struct clk_freq_tbl clk_tbl_vfe_jpeg[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2000 | F_MND16( 24576000, lpxo, 1, 0, 0), |
| 2001 | F_MND16( 36864000, pll3, 4, 1, 5), |
| 2002 | F_MND16( 46080000, pll3, 4, 1, 4), |
| 2003 | F_MND16( 61440000, pll3, 4, 1, 3), |
| 2004 | F_MND16( 73728000, pll3, 2, 1, 5), |
| 2005 | F_MND16( 81920000, pll3, 3, 1, 3), |
| 2006 | F_MND16( 92160000, pll3, 4, 1, 2), |
| 2007 | F_MND16( 98304000, pll3, 3, 2, 5), |
| 2008 | F_MND16(105326000, pll3, 2, 2, 7), |
| 2009 | F_MND16(122880000, pll3, 2, 1, 3), |
| 2010 | F_MND16(147456000, pll3, 2, 2, 5), |
| 2011 | F_MND16(153600000, pll1, 2, 2, 5), |
| 2012 | F_MND16(192000000, pll1, 4, 0, 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2013 | F_END, |
| 2014 | }; |
| 2015 | |
| 2016 | static struct rcg_clk jpeg_clk = { |
| 2017 | .b = { |
| 2018 | .ctl_reg = JPEG_NS_REG, |
| 2019 | .en_mask = BIT(9), |
| 2020 | .halt_reg = CLK_HALT_STATEB_REG, |
| 2021 | .halt_bit = 1, |
| 2022 | .reset_mask = P_JPEG_CLK, |
| 2023 | }, |
| 2024 | .ns_reg = JPEG_NS_REG, |
| 2025 | .md_reg = JPEG_NS_REG - 4, |
| 2026 | .root_en_mask = BIT(11), |
| 2027 | .freq_tbl = clk_tbl_vfe_jpeg, |
| 2028 | .ns_mask = F_MASK_MND16, |
| 2029 | .set_rate = set_rate_mnd, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2030 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2031 | .c = { |
| 2032 | .dbg_name = "jpeg_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2033 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2034 | VDD_DIG_FMAX_MAP2(NOMINAL, 153600000, HIGH, 192000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2035 | CLK_INIT(jpeg_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2036 | .depends = &axi_li_jpeg_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2037 | }, |
| 2038 | }; |
| 2039 | |
| 2040 | static struct rcg_clk vfe_clk = { |
| 2041 | .b = { |
| 2042 | .ctl_reg = CAM_VFE_NS_REG, |
| 2043 | .en_mask = BIT(9), |
| 2044 | .halt_reg = CLK_HALT_STATEB_REG, |
| 2045 | .halt_bit = 0, |
| 2046 | .reset_mask = P_VFE_CLK, |
| 2047 | }, |
| 2048 | .ns_reg = CAM_VFE_NS_REG, |
| 2049 | .md_reg = CAM_VFE_NS_REG - 4, |
| 2050 | .root_en_mask = BIT(13), |
| 2051 | .freq_tbl = clk_tbl_vfe_jpeg, |
| 2052 | .ns_mask = F_MASK_MND16, |
| 2053 | .set_rate = set_rate_mnd, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2054 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2055 | .c = { |
| 2056 | .dbg_name = "vfe_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2057 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2058 | VDD_DIG_FMAX_MAP2(NOMINAL, 153600000, HIGH, 192000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2059 | CLK_INIT(vfe_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2060 | .depends = &axi_li_vfe_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2061 | }, |
| 2062 | }; |
| 2063 | |
| 2064 | static struct branch_clk vfe_mdc_clk = { |
| 2065 | .b = { |
| 2066 | .ctl_reg = CAM_VFE_NS_REG, |
| 2067 | .en_mask = BIT(11), |
| 2068 | .halt_reg = CLK_HALT_STATEA_REG, |
| 2069 | .halt_bit = 9, |
| 2070 | .reset_mask = P_VFE_MDC_CLK, |
| 2071 | }, |
| 2072 | .parent = &vfe_clk.c, |
| 2073 | .c = { |
| 2074 | .dbg_name = "vfe_mdc_clk", |
| 2075 | .ops = &clk_ops_branch, |
| 2076 | CLK_INIT(vfe_mdc_clk.c), |
| 2077 | }, |
| 2078 | }; |
| 2079 | |
| 2080 | static struct branch_clk vfe_camif_clk = { |
| 2081 | .b = { |
| 2082 | .ctl_reg = CAM_VFE_NS_REG, |
| 2083 | .en_mask = BIT(15), |
| 2084 | .halt_reg = CLK_HALT_STATEC_REG, |
| 2085 | .halt_bit = 13, |
| 2086 | .reset_mask = P_VFE_CAMIF_CLK, |
| 2087 | }, |
| 2088 | .parent = &vfe_clk.c, |
| 2089 | .c = { |
| 2090 | .dbg_name = "vfe_camif_clk", |
| 2091 | .ops = &clk_ops_branch, |
| 2092 | CLK_INIT(vfe_camif_clk.c), |
| 2093 | }, |
| 2094 | }; |
| 2095 | |
| 2096 | static struct branch_clk csi0_vfe_clk = { |
| 2097 | .b = { |
| 2098 | .ctl_reg = CSI_NS_REG, |
| 2099 | .en_mask = BIT(15), |
| 2100 | .halt_reg = CLK_HALT_STATEC_REG, |
| 2101 | .halt_bit = 16, |
| 2102 | .reset_mask = P_CSI0_VFE_CLK, |
| 2103 | }, |
| 2104 | .parent = &vfe_clk.c, |
| 2105 | .c = { |
| 2106 | .dbg_name = "csi0_vfe_clk", |
| 2107 | .ops = &clk_ops_branch, |
| 2108 | CLK_INIT(csi0_vfe_clk.c), |
| 2109 | }, |
| 2110 | }; |
| 2111 | |
| 2112 | static struct clk_freq_tbl clk_tbl_cam[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2113 | F_MND16( 0, gnd, 1, 0, 0), |
| 2114 | F_MND16( 6000000, pll1, 4, 1, 32), |
| 2115 | F_MND16( 8000000, pll1, 4, 1, 24), |
| 2116 | F_MND16(12000000, pll1, 4, 1, 16), |
| 2117 | F_MND16(16000000, pll1, 4, 1, 12), |
| 2118 | F_MND16(19200000, pll1, 4, 1, 10), |
| 2119 | F_MND16(24000000, pll1, 4, 1, 8), |
| 2120 | F_MND16(32000000, pll1, 4, 1, 6), |
| 2121 | F_MND16(48000000, pll1, 4, 1, 4), |
| 2122 | F_MND16(64000000, pll1, 4, 1, 3), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2123 | F_END, |
| 2124 | }; |
| 2125 | |
| 2126 | static struct rcg_clk cam_m_clk = { |
| 2127 | .b = { |
| 2128 | .ctl_reg = CAM_NS_REG, |
| 2129 | .halt_check = DELAY, |
| 2130 | .reset_mask = P_CAM_M_CLK, |
| 2131 | }, |
| 2132 | .ns_reg = CAM_NS_REG, |
| 2133 | .md_reg = CAM_NS_REG - 4, |
| 2134 | .root_en_mask = BIT(9), |
| 2135 | .freq_tbl = clk_tbl_cam, |
| 2136 | .ns_mask = F_MASK_MND16, |
| 2137 | .set_rate = set_rate_mnd, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2138 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2139 | .c = { |
| 2140 | .dbg_name = "cam_m_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2141 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2142 | VDD_DIG_FMAX_MAP1(NOMINAL, 64000000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2143 | CLK_INIT(cam_m_clk.c), |
| 2144 | }, |
| 2145 | }; |
| 2146 | |
| 2147 | static struct clk_freq_tbl clk_tbl_vpe[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2148 | F_MND8( 24576000, 22, 15, lpxo, 1, 0, 0), |
| 2149 | F_MND8( 30720000, 22, 15, pll3, 4, 1, 6), |
| 2150 | F_MND8( 61440000, 22, 15, pll3, 4, 1, 3), |
| 2151 | F_MND8( 81920000, 22, 15, pll3, 3, 1, 3), |
| 2152 | F_MND8(122880000, 22, 15, pll3, 3, 1, 2), |
| 2153 | F_MND8(147456000, 22, 15, pll3, 1, 1, 5), |
| 2154 | F_MND8(153600000, 22, 15, pll1, 1, 1, 5), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2155 | F_END, |
| 2156 | }; |
| 2157 | |
| 2158 | static struct rcg_clk vpe_clk = { |
| 2159 | .b = { |
| 2160 | .ctl_reg = VPE_NS_REG, |
| 2161 | .en_mask = BIT(9), |
| 2162 | .halt_reg = CLK_HALT_STATEC_REG, |
| 2163 | .halt_bit = 10, |
| 2164 | .reset_mask = P_VPE_CLK, |
| 2165 | }, |
| 2166 | .ns_reg = VPE_NS_REG, |
| 2167 | .md_reg = VPE_NS_REG - 4, |
| 2168 | .ns_mask = F_MASK_MND8(22, 15), |
| 2169 | .root_en_mask = BIT(11), |
| 2170 | .freq_tbl = clk_tbl_vpe, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2171 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2172 | .set_rate = set_rate_mnd, |
| 2173 | .c = { |
| 2174 | .dbg_name = "vpe_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2175 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2176 | VDD_DIG_FMAX_MAP1(NOMINAL, 153600000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2177 | CLK_INIT(vpe_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2178 | .depends = &axi_vpe_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2179 | }, |
| 2180 | }; |
| 2181 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2182 | static struct clk_freq_tbl clk_tbl_mfc[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2183 | F_MND8( 24576000, 24, 17, lpxo, 1, 0, 0), |
| 2184 | F_MND8( 30720000, 24, 17, pll3, 4, 1, 6), |
| 2185 | F_MND8( 61440000, 24, 17, pll3, 4, 1, 3), |
| 2186 | F_MND8( 81920000, 24, 17, pll3, 3, 1, 3), |
| 2187 | F_MND8(122880000, 24, 17, pll3, 3, 1, 2), |
| 2188 | F_MND8(147456000, 24, 17, pll3, 1, 1, 5), |
| 2189 | F_MND8(153600000, 24, 17, pll1, 1, 1, 5), |
| 2190 | F_MND8(170667000, 24, 17, pll1, 1, 2, 9), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2191 | F_END, |
| 2192 | }; |
| 2193 | |
| 2194 | static struct rcg_clk mfc_clk = { |
| 2195 | .b = { |
| 2196 | .ctl_reg = MFC_NS_REG, |
| 2197 | .en_mask = BIT(9), |
| 2198 | .halt_reg = CLK_HALT_STATEC_REG, |
| 2199 | .halt_bit = 12, |
| 2200 | .reset_mask = P_MFC_CLK, |
| 2201 | }, |
| 2202 | .ns_reg = MFC_NS_REG, |
| 2203 | .md_reg = MFC_NS_REG - 4, |
| 2204 | .ns_mask = F_MASK_MND8(24, 17), |
| 2205 | .root_en_mask = BIT(11), |
| 2206 | .freq_tbl = clk_tbl_mfc, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2207 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2208 | .set_rate = set_rate_mnd, |
| 2209 | .c = { |
| 2210 | .dbg_name = "mfc_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2211 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2212 | VDD_DIG_FMAX_MAP1(NOMINAL, 170667000), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2213 | CLK_INIT(mfc_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 2214 | .depends = &axi_mfc_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2215 | }, |
| 2216 | }; |
| 2217 | |
| 2218 | static struct branch_clk mfc_div2_clk = { |
| 2219 | .b = { |
| 2220 | .ctl_reg = MFC_NS_REG, |
| 2221 | .en_mask = BIT(15), |
| 2222 | .halt_reg = CLK_HALT_STATEC_REG, |
| 2223 | .halt_bit = 11, |
| 2224 | .reset_mask = P_MFC_DIV2_CLK, |
| 2225 | }, |
| 2226 | .parent = &mfc_clk.c, |
| 2227 | .c = { |
| 2228 | .dbg_name = "mfc_div2_clk", |
| 2229 | .ops = &clk_ops_branch, |
| 2230 | CLK_INIT(mfc_div2_clk.c), |
| 2231 | }, |
| 2232 | }; |
| 2233 | |
| 2234 | static struct clk_freq_tbl clk_tbl_spi[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2235 | F_MND8( 0, 0, 0, gnd, 1, 0, 0), |
| 2236 | F_MND8( 9963243, 19, 12, pll3, 4, 2, 37), |
| 2237 | F_MND8(26331429, 19, 12, pll3, 4, 1, 7), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2238 | F_END, |
| 2239 | }; |
| 2240 | |
| 2241 | static struct rcg_clk spi_clk = { |
| 2242 | .b = { |
| 2243 | .ctl_reg = SPI_NS_REG, |
| 2244 | .en_mask = BIT(9), |
| 2245 | .halt_reg = CLK_HALT_STATEC_REG, |
| 2246 | .halt_bit = 0, |
| 2247 | .reset_mask = P_SPI_CLK, |
| 2248 | }, |
| 2249 | .ns_reg = SPI_NS_REG, |
| 2250 | .md_reg = SPI_NS_REG - 4, |
| 2251 | .ns_mask = F_MASK_MND8(19, 12), |
| 2252 | .root_en_mask = BIT(11), |
| 2253 | .freq_tbl = clk_tbl_spi, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2254 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2255 | .set_rate = set_rate_mnd, |
| 2256 | .c = { |
| 2257 | .dbg_name = "spi_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2258 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2259 | VDD_DIG_FMAX_MAP1(NOMINAL, 26331429), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2260 | CLK_INIT(spi_clk.c), |
| 2261 | }, |
| 2262 | }; |
| 2263 | |
| 2264 | static struct clk_freq_tbl clk_tbl_lpa_codec[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2265 | F_RAW(1, NULL, 0, 0, 0, 0, NULL), /* src MI2S_CODEC_RX */ |
| 2266 | F_RAW(2, NULL, 0, 1, 0, 0, NULL), /* src ECODEC_CIF */ |
| 2267 | F_RAW(3, NULL, 0, 2, 0, 0, NULL), /* src MI2S */ |
| 2268 | F_RAW(4, NULL, 0, 3, 0, 0, NULL), /* src SDAC */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2269 | F_END, |
| 2270 | }; |
| 2271 | |
| 2272 | static struct rcg_clk lpa_codec_clk = { |
| 2273 | .b = { |
| 2274 | .ctl_reg = LPA_NS_REG, |
| 2275 | .en_mask = BIT(9), |
| 2276 | .halt_reg = CLK_HALT_STATEC_REG, |
| 2277 | .halt_bit = 6, |
| 2278 | .reset_mask = P_LPA_CODEC_CLK, |
| 2279 | }, |
| 2280 | .ns_reg = LPA_NS_REG, |
| 2281 | .ns_mask = BM(1, 0), |
| 2282 | .set_rate = set_rate_nop, |
| 2283 | .freq_tbl = clk_tbl_lpa_codec, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2284 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2285 | .c = { |
| 2286 | .dbg_name = "lpa_codec_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2287 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2288 | VDD_DIG_FMAX_MAP1(LOW, 4), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2289 | CLK_INIT(lpa_codec_clk.c), |
| 2290 | }, |
| 2291 | }; |
| 2292 | |
| 2293 | static struct clk_freq_tbl clk_tbl_mdc[] = { |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2294 | F_RAW(1, NULL, 0, 0, 0, 0, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2295 | F_END |
| 2296 | }; |
| 2297 | |
| 2298 | static struct rcg_clk mdc_clk = { |
| 2299 | .b = { |
| 2300 | .ctl_reg = MDC_NS_REG, |
| 2301 | .en_mask = BIT(9), |
| 2302 | .halt_reg = CLK_HALT_STATEA_REG, |
| 2303 | .halt_bit = 10, |
| 2304 | .reset_mask = P_MDC_CLK, |
| 2305 | }, |
| 2306 | .ns_reg = MDC_NS_REG, |
| 2307 | .root_en_mask = BIT(11), |
| 2308 | .freq_tbl = clk_tbl_mdc, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2309 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2310 | .set_rate = set_rate_nop, |
| 2311 | .c = { |
| 2312 | .dbg_name = "mdc_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2313 | .ops = &clk_ops_rcg_7x30, |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 2314 | VDD_DIG_FMAX_MAP1(LOW, 1), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2315 | CLK_INIT(mdc_clk.c), |
| 2316 | }, |
| 2317 | }; |
| 2318 | |
| 2319 | static struct branch_clk lpa_core_clk = { |
| 2320 | .b = { |
| 2321 | .ctl_reg = LPA_NS_REG, |
| 2322 | .en_mask = BIT(5), |
| 2323 | .halt_reg = CLK_HALT_STATEC_REG, |
| 2324 | .halt_bit = 5, |
| 2325 | .reset_mask = P_LPA_CORE_CLK, |
| 2326 | }, |
| 2327 | .c = { |
| 2328 | .dbg_name = "lpa_core_clk", |
| 2329 | .ops = &clk_ops_branch, |
| 2330 | CLK_INIT(lpa_core_clk.c), |
| 2331 | }, |
| 2332 | }; |
| 2333 | |
| 2334 | static DEFINE_CLK_PCOM(adsp_clk, ADSP_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2335 | static DEFINE_CLK_PCOM(codec_ssbi_clk, CODEC_SSBI_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2336 | static DEFINE_CLK_PCOM(ebi1_clk, EBI1_CLK, CLKFLAG_SKIP_AUTO_OFF | CLKFLAG_MIN); |
| 2337 | static DEFINE_CLK_PCOM(ebi1_fixed_clk, EBI1_FIXED_CLK, CLKFLAG_MIN | |
| 2338 | CLKFLAG_SKIP_AUTO_OFF); |
| 2339 | static DEFINE_CLK_PCOM(ecodec_clk, ECODEC_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2340 | static DEFINE_CLK_PCOM(gp_clk, GP_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2341 | static DEFINE_CLK_PCOM(uart3_clk, UART3_CLK, 0); |
| 2342 | static DEFINE_CLK_PCOM(usb_phy_clk, USB_PHY_CLK, CLKFLAG_MIN); |
| 2343 | |
| 2344 | static DEFINE_CLK_PCOM(p_grp_2d_clk, GRP_2D_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2345 | static DEFINE_CLK_PCOM(p_grp_2d_p_clk, GRP_2D_P_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2346 | static DEFINE_CLK_PCOM(p_hdmi_clk, HDMI_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2347 | static DEFINE_CLK_PCOM(p_jpeg_clk, JPEG_CLK, 0); |
| 2348 | static DEFINE_CLK_PCOM(p_jpeg_p_clk, JPEG_P_CLK, 0); |
| 2349 | static DEFINE_CLK_PCOM(p_lpa_codec_clk, LPA_CODEC_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2350 | static DEFINE_CLK_PCOM(p_lpa_core_clk, LPA_CORE_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2351 | static DEFINE_CLK_PCOM(p_lpa_p_clk, LPA_P_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2352 | static DEFINE_CLK_PCOM(p_mi2s_m_clk, MI2S_M_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2353 | static DEFINE_CLK_PCOM(p_mi2s_s_clk, MI2S_S_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2354 | static DEFINE_CLK_PCOM(p_mi2s_codec_rx_m_clk, MI2S_CODEC_RX_M_CLK, |
| 2355 | CLKFLAG_SKIP_AUTO_OFF); |
| 2356 | static DEFINE_CLK_PCOM(p_mi2s_codec_rx_s_clk, MI2S_CODEC_RX_S_CLK, |
| 2357 | CLKFLAG_SKIP_AUTO_OFF); |
| 2358 | static DEFINE_CLK_PCOM(p_mi2s_codec_tx_m_clk, MI2S_CODEC_TX_M_CLK, |
| 2359 | CLKFLAG_SKIP_AUTO_OFF); |
| 2360 | static DEFINE_CLK_PCOM(p_mi2s_codec_tx_s_clk, MI2S_CODEC_TX_S_CLK, |
| 2361 | CLKFLAG_SKIP_AUTO_OFF); |
| 2362 | static DEFINE_CLK_PCOM(p_sdac_clk, SDAC_CLK, 0); |
| 2363 | static DEFINE_CLK_PCOM(p_sdac_m_clk, SDAC_M_CLK, 0); |
| 2364 | static DEFINE_CLK_PCOM(p_vfe_clk, VFE_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2365 | static DEFINE_CLK_PCOM(p_vfe_camif_clk, VFE_CAMIF_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2366 | static DEFINE_CLK_PCOM(p_vfe_mdc_clk, VFE_MDC_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2367 | static DEFINE_CLK_PCOM(p_vfe_p_clk, VFE_P_CLK, 0); |
| 2368 | static DEFINE_CLK_PCOM(p_grp_3d_clk, GRP_3D_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2369 | static DEFINE_CLK_PCOM(p_grp_3d_p_clk, GRP_3D_P_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2370 | static DEFINE_CLK_PCOM(p_imem_clk, IMEM_CLK, 0); |
| 2371 | static DEFINE_CLK_PCOM(p_mdp_lcdc_pad_pclk_clk, MDP_LCDC_PAD_PCLK_CLK, |
| 2372 | CLKFLAG_SKIP_AUTO_OFF); |
| 2373 | static DEFINE_CLK_PCOM(p_mdp_lcdc_pclk_clk, MDP_LCDC_PCLK_CLK, |
| 2374 | CLKFLAG_SKIP_AUTO_OFF); |
| 2375 | static DEFINE_CLK_PCOM(p_mdp_p_clk, MDP_P_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2376 | static DEFINE_CLK_PCOM(p_mdp_vsync_clk, MDP_VSYNC_CLK, 0); |
| 2377 | static DEFINE_CLK_PCOM(p_tsif_ref_clk, TSIF_REF_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2378 | static DEFINE_CLK_PCOM(p_tsif_p_clk, TSIF_P_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2379 | static DEFINE_CLK_PCOM(p_tv_dac_clk, TV_DAC_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2380 | static DEFINE_CLK_PCOM(p_tv_enc_clk, TV_ENC_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2381 | static DEFINE_CLK_PCOM(p_emdh_clk, EMDH_CLK, CLKFLAG_MIN | CLKFLAG_MAX); |
| 2382 | static DEFINE_CLK_PCOM(p_emdh_p_clk, EMDH_P_CLK, 0); |
| 2383 | static DEFINE_CLK_PCOM(p_i2c_clk, I2C_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2384 | static DEFINE_CLK_PCOM(p_i2c_2_clk, I2C_2_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2385 | static DEFINE_CLK_PCOM(p_mdc_clk, MDC_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2386 | static DEFINE_CLK_PCOM(p_pmdh_clk, PMDH_CLK, CLKFLAG_MIN | CLKFLAG_MAX); |
| 2387 | static DEFINE_CLK_PCOM(p_pmdh_p_clk, PMDH_P_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2388 | static DEFINE_CLK_PCOM(p_sdc1_clk, SDC1_CLK, 0); |
| 2389 | static DEFINE_CLK_PCOM(p_sdc1_p_clk, SDC1_P_CLK, 0); |
| 2390 | static DEFINE_CLK_PCOM(p_sdc2_clk, SDC2_CLK, 0); |
| 2391 | static DEFINE_CLK_PCOM(p_sdc2_p_clk, SDC2_P_CLK, 0); |
| 2392 | static DEFINE_CLK_PCOM(p_sdc3_clk, SDC3_CLK, 0); |
| 2393 | static DEFINE_CLK_PCOM(p_sdc3_p_clk, SDC3_P_CLK, 0); |
| 2394 | static DEFINE_CLK_PCOM(p_sdc4_clk, SDC4_CLK, 0); |
| 2395 | static DEFINE_CLK_PCOM(p_sdc4_p_clk, SDC4_P_CLK, 0); |
| 2396 | static DEFINE_CLK_PCOM(p_uart2_clk, UART2_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2397 | static DEFINE_CLK_PCOM(p_usb_hs2_clk, USB_HS2_CLK, 0); |
| 2398 | static DEFINE_CLK_PCOM(p_usb_hs2_core_clk, USB_HS2_CORE_CLK, 0); |
| 2399 | static DEFINE_CLK_PCOM(p_usb_hs2_p_clk, USB_HS2_P_CLK, 0); |
| 2400 | static DEFINE_CLK_PCOM(p_usb_hs3_clk, USB_HS3_CLK, 0); |
| 2401 | static DEFINE_CLK_PCOM(p_usb_hs3_core_clk, USB_HS3_CORE_CLK, 0); |
| 2402 | static DEFINE_CLK_PCOM(p_usb_hs3_p_clk, USB_HS3_P_CLK, 0); |
| 2403 | static DEFINE_CLK_PCOM(p_qup_i2c_clk, QUP_I2C_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2404 | static DEFINE_CLK_PCOM(p_spi_clk, SPI_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2405 | static DEFINE_CLK_PCOM(p_spi_p_clk, SPI_P_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2406 | static DEFINE_CLK_PCOM(p_uart1_clk, UART1_CLK, 0); |
| 2407 | static DEFINE_CLK_PCOM(p_uart1dm_clk, UART1DM_CLK, 0); |
| 2408 | static DEFINE_CLK_PCOM(p_uart2dm_clk, UART2DM_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2409 | static DEFINE_CLK_PCOM(p_usb_hs_clk, USB_HS_CLK, 0); |
| 2410 | static DEFINE_CLK_PCOM(p_usb_hs_core_clk, USB_HS_CORE_CLK, 0); |
| 2411 | static DEFINE_CLK_PCOM(p_usb_hs_p_clk, USB_HS_P_CLK, 0); |
| 2412 | static DEFINE_CLK_PCOM(p_cam_m_clk, CAM_M_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2413 | static DEFINE_CLK_PCOM(p_camif_pad_p_clk, CAMIF_PAD_P_CLK, 0); |
| 2414 | static DEFINE_CLK_PCOM(p_csi0_clk, CSI0_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2415 | static DEFINE_CLK_PCOM(p_csi0_vfe_clk, CSI0_VFE_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2416 | static DEFINE_CLK_PCOM(p_csi0_p_clk, CSI0_P_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2417 | static DEFINE_CLK_PCOM(p_mdp_clk, MDP_CLK, 0); |
| 2418 | static DEFINE_CLK_PCOM(p_mfc_clk, MFC_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2419 | static DEFINE_CLK_PCOM(p_mfc_div2_clk, MFC_DIV2_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2420 | static DEFINE_CLK_PCOM(p_mfc_p_clk, MFC_P_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2421 | static DEFINE_CLK_PCOM(p_vpe_clk, VPE_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2422 | static DEFINE_CLK_PCOM(p_adm_clk, ADM_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2423 | static DEFINE_CLK_PCOM(p_ce_clk, CE_CLK, CLKFLAG_SKIP_AUTO_OFF); |
| 2424 | static DEFINE_CLK_PCOM(p_axi_rotator_clk, AXI_ROTATOR_CLK, |
| 2425 | CLKFLAG_SKIP_AUTO_OFF); |
| 2426 | static DEFINE_CLK_PCOM(p_rotator_imem_clk, ROTATOR_IMEM_CLK, 0); |
| 2427 | static DEFINE_CLK_PCOM(p_rotator_p_clk, ROTATOR_P_CLK, 0); |
| 2428 | |
| 2429 | static DEFINE_CLK_VOTER(ebi_dtv_clk, &ebi1_fixed_clk.c); |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 2430 | static DEFINE_CLK_VOTER(ebi_grp_3d_clk, &ebi1_fixed_clk.c); |
| 2431 | static DEFINE_CLK_VOTER(ebi_grp_2d_clk, &ebi1_fixed_clk.c); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2432 | static DEFINE_CLK_VOTER(ebi_lcdc_clk, &ebi1_fixed_clk.c); |
| 2433 | static DEFINE_CLK_VOTER(ebi_mddi_clk, &ebi1_fixed_clk.c); |
| 2434 | static DEFINE_CLK_VOTER(ebi_tv_clk, &ebi1_fixed_clk.c); |
| 2435 | static DEFINE_CLK_VOTER(ebi_vcd_clk, &ebi1_fixed_clk.c); |
| 2436 | static DEFINE_CLK_VOTER(ebi_vfe_clk, &ebi1_fixed_clk.c); |
| 2437 | static DEFINE_CLK_VOTER(ebi_adm_clk, &ebi1_fixed_clk.c); |
| 2438 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2439 | #ifdef CONFIG_DEBUG_FS |
| 2440 | |
| 2441 | #define CLK_TEST_2(s) (s) |
| 2442 | #define CLK_TEST_HS(s) (0x4000 | ((s) << 8)) |
| 2443 | #define CLK_TEST_LS(s) (0x4D40 | (s)) |
| 2444 | |
| 2445 | struct measure_sel { |
| 2446 | u32 test_vector; |
| 2447 | struct clk *clk; |
| 2448 | }; |
| 2449 | |
| 2450 | static struct measure_sel measure_mux[] = { |
| 2451 | { CLK_TEST_2(0x03), &emdh_p_clk.c }, |
| 2452 | { CLK_TEST_2(0x04), &pmdh_p_clk.c }, |
| 2453 | { CLK_TEST_2(0x06), &mdp_p_clk.c }, |
| 2454 | { CLK_TEST_2(0x07), &lpa_p_clk.c }, |
| 2455 | { CLK_TEST_2(0x08), &usb_hs2_p_clk.c }, |
| 2456 | { CLK_TEST_2(0x09), &spi_clk.c }, |
| 2457 | { CLK_TEST_2(0x0A), &midi_clk.c }, |
| 2458 | { CLK_TEST_2(0x0B), &i2c_2_clk.c }, |
| 2459 | { CLK_TEST_2(0x0D), &mi2s_m_clk.c }, |
| 2460 | { CLK_TEST_2(0x0E), &lpa_core_clk.c }, |
| 2461 | { CLK_TEST_2(0x0F), &lpa_codec_clk.c }, |
| 2462 | { CLK_TEST_2(0x10), &usb_hs3_p_clk.c }, |
| 2463 | { CLK_TEST_2(0x11), &adm_p_clk.c }, |
| 2464 | { CLK_TEST_2(0x13), &hdmi_clk.c }, |
| 2465 | { CLK_TEST_2(0x14), &usb_hs_core_clk.c }, |
| 2466 | { CLK_TEST_2(0x15), &usb_hs2_core_clk.c }, |
| 2467 | { CLK_TEST_2(0x16), &usb_hs3_core_clk.c }, |
| 2468 | { CLK_TEST_2(0x17), &mi2s_codec_tx_s_clk.c }, |
| 2469 | { CLK_TEST_2(0x18), &spi_p_clk.c }, |
| 2470 | { CLK_TEST_2(0x1A), &camif_pad_p_clk.c }, |
| 2471 | { CLK_TEST_2(0x1C), &qup_i2c_clk.c }, |
| 2472 | { CLK_TEST_2(0x1F), &mfc_div2_clk.c }, |
| 2473 | { CLK_TEST_2(0x38), &mfc_clk.c }, |
| 2474 | |
| 2475 | { CLK_TEST_HS(0x00), &adm_clk.c }, |
| 2476 | { CLK_TEST_HS(0x01), &mdp_lcdc_pad_pclk_clk.c }, |
| 2477 | { CLK_TEST_HS(0x02), &mdp_lcdc_pclk_clk.c }, |
| 2478 | { CLK_TEST_HS(0x03), &axi_rotator_clk.c }, |
| 2479 | { CLK_TEST_HS(0x07), &axi_li_vg_clk.c }, |
| 2480 | { CLK_TEST_HS(0x09), &axi_li_apps_clk.c }, |
| 2481 | { CLK_TEST_HS(0x0E), &axi_li_jpeg_clk.c }, |
| 2482 | { CLK_TEST_HS(0x0F), &emdh_clk.c }, |
| 2483 | { CLK_TEST_HS(0x14), &mdp_clk.c }, |
| 2484 | { CLK_TEST_HS(0x15), &pmdh_clk.c }, |
| 2485 | { CLK_TEST_HS(0x19), &axi_grp_2d_clk.c }, |
| 2486 | { CLK_TEST_HS(0x1A), &axi_li_grp_clk.c }, |
| 2487 | { CLK_TEST_HS(0x1B), &axi_li_vfe_clk.c }, |
| 2488 | { CLK_TEST_HS(0x1C), &grp_2d_clk.c }, |
| 2489 | { CLK_TEST_HS(0x1E), &grp_3d_clk.c }, |
| 2490 | { CLK_TEST_HS(0x1F), &imem_clk.c }, |
| 2491 | { CLK_TEST_HS(0x20), &jpeg_clk.c }, |
| 2492 | { CLK_TEST_HS(0x24), &axi_li_adsp_a_clk.c }, |
| 2493 | { CLK_TEST_HS(0x26), &rotator_imem_clk.c }, |
| 2494 | { CLK_TEST_HS(0x27), &axi_vpe_clk.c }, |
| 2495 | { CLK_TEST_HS(0x2A), &axi_mfc_clk.c }, |
| 2496 | { CLK_TEST_HS(0x2B), &axi_mdp_clk.c }, |
| 2497 | { CLK_TEST_HS(0x2C), &vpe_clk.c }, |
| 2498 | { CLK_TEST_HS(0x30), &vfe_camif_clk.c }, |
| 2499 | { CLK_TEST_HS(0x31), &csi0_clk.c }, |
| 2500 | { CLK_TEST_HS(0x32), &csi0_vfe_clk.c }, |
| 2501 | { CLK_TEST_HS(0x33), &csi0_p_clk.c }, |
| 2502 | |
| 2503 | { CLK_TEST_LS(0x03), &ce_clk.c }, |
| 2504 | { CLK_TEST_LS(0x04), &cam_m_clk.c }, |
| 2505 | { CLK_TEST_LS(0x0C), &grp_2d_p_clk.c }, |
| 2506 | { CLK_TEST_LS(0x0D), &i2c_clk.c }, |
| 2507 | { CLK_TEST_LS(0x0E), &mi2s_codec_rx_m_clk.c }, |
| 2508 | { CLK_TEST_LS(0x0F), &mi2s_codec_rx_s_clk.c }, |
| 2509 | { CLK_TEST_LS(0x10), &mi2s_codec_tx_m_clk.c }, |
| 2510 | { CLK_TEST_LS(0x13), &mdp_vsync_clk.c }, |
| 2511 | { CLK_TEST_LS(0x15), &vfe_p_clk.c }, |
| 2512 | { CLK_TEST_LS(0x16), &mdc_clk.c }, |
| 2513 | { CLK_TEST_LS(0x17), &vfe_mdc_clk.c }, |
| 2514 | { CLK_TEST_LS(0x18), &usb_hs_p_clk.c }, |
| 2515 | { CLK_TEST_LS(0x1C), &uart1dm_p_clk.c }, |
| 2516 | { CLK_TEST_LS(0x1E), &jpeg_p_clk.c }, |
| 2517 | { CLK_TEST_LS(0x20), &sdac_clk.c }, |
| 2518 | { CLK_TEST_LS(0x21), &sdc1_p_clk.c }, |
| 2519 | { CLK_TEST_LS(0x22), &sdc1_clk.c }, |
| 2520 | { CLK_TEST_LS(0x23), &sdc2_p_clk.c }, |
| 2521 | { CLK_TEST_LS(0x24), &sdc2_clk.c }, |
| 2522 | { CLK_TEST_LS(0x25), &tsif_p_clk.c }, |
| 2523 | { CLK_TEST_LS(0x26), &sdac_m_clk.c }, |
| 2524 | { CLK_TEST_LS(0x27), &grp_3d_p_clk.c }, |
| 2525 | { CLK_TEST_LS(0x2A), &tsif_ref_clk.c }, |
| 2526 | { CLK_TEST_LS(0x2B), &tv_enc_clk.c }, |
| 2527 | { CLK_TEST_LS(0x2C), &tv_dac_clk.c }, |
| 2528 | { CLK_TEST_LS(0x2D), &rotator_p_clk.c }, |
| 2529 | { CLK_TEST_LS(0x2F), &uart1_clk.c }, |
| 2530 | { CLK_TEST_LS(0x30), &uart1dm_clk.c }, |
| 2531 | { CLK_TEST_LS(0x31), &uart2_clk.c }, |
| 2532 | { CLK_TEST_LS(0x33), &usb_hs2_clk.c }, |
| 2533 | { CLK_TEST_LS(0x34), &usb_hs3_clk.c }, |
| 2534 | { CLK_TEST_LS(0x35), &mfc_p_clk.c }, |
| 2535 | { CLK_TEST_LS(0x36), &vfe_clk.c }, |
| 2536 | { CLK_TEST_LS(0x39), &sdc3_p_clk.c }, |
| 2537 | { CLK_TEST_LS(0x3A), &sdc3_clk.c }, |
| 2538 | { CLK_TEST_LS(0x3B), &sdc4_p_clk.c }, |
| 2539 | { CLK_TEST_LS(0x3C), &sdc4_clk.c }, |
| 2540 | { CLK_TEST_LS(0x3D), &uart2dm_clk.c }, |
| 2541 | { CLK_TEST_LS(0x3E), &uart2dm_p_clk.c }, |
| 2542 | { CLK_TEST_LS(0x3F), &usb_hs_clk.c }, |
| 2543 | }; |
| 2544 | |
| 2545 | static struct measure_sel *find_measure_sel(struct clk *clk) |
| 2546 | { |
| 2547 | int i; |
| 2548 | |
| 2549 | for (i = 0; i < ARRAY_SIZE(measure_mux); i++) |
| 2550 | if (measure_mux[i].clk == clk) |
| 2551 | return &measure_mux[i]; |
| 2552 | return NULL; |
| 2553 | } |
| 2554 | |
| 2555 | static int measure_clk_set_parent(struct clk *clk, struct clk *parent) |
| 2556 | { |
| 2557 | struct measure_sel *p; |
| 2558 | unsigned long flags; |
| 2559 | |
| 2560 | if (!parent) |
| 2561 | return -EINVAL; |
| 2562 | |
| 2563 | p = find_measure_sel(parent); |
| 2564 | if (!p) |
| 2565 | return -EINVAL; |
| 2566 | |
| 2567 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 2568 | |
| 2569 | /* Program test vector. */ |
| 2570 | if (p->test_vector <= 0xFF) { |
| 2571 | /* Select CLK_TEST_2 */ |
| 2572 | writel_relaxed(0x4D40, CLK_TEST_BASE_REG); |
| 2573 | writel_relaxed(p->test_vector, CLK_TEST_2_BASE_REG); |
| 2574 | } else |
| 2575 | writel_relaxed(p->test_vector, CLK_TEST_BASE_REG); |
| 2576 | |
| 2577 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 2578 | |
| 2579 | return 0; |
| 2580 | } |
| 2581 | |
| 2582 | /* Sample clock for 'tcxo4_ticks' reference clock ticks. */ |
| 2583 | static u32 run_measurement(unsigned tcxo4_ticks) |
| 2584 | { |
| 2585 | /* TCXO4_CNT_EN and RINGOSC_CNT_EN register values. */ |
| 2586 | u32 reg_val_enable = readl_relaxed(MISC_CLK_CTL_BASE_REG) | 0x3; |
| 2587 | u32 reg_val_disable = reg_val_enable & ~0x3; |
| 2588 | |
| 2589 | /* Stop counters and set the TCXO4 counter start value. */ |
| 2590 | writel_relaxed(reg_val_disable, MISC_CLK_CTL_BASE_REG); |
| 2591 | writel_relaxed(tcxo4_ticks, TCXO_CNT_BASE_REG); |
| 2592 | |
| 2593 | /* Run measurement and wait for completion. */ |
| 2594 | writel_relaxed(reg_val_enable, MISC_CLK_CTL_BASE_REG); |
| 2595 | while (readl_relaxed(TCXO_CNT_DONE_BASE_REG) == 0) |
| 2596 | cpu_relax(); |
| 2597 | |
| 2598 | /* Stop counters. */ |
| 2599 | writel_relaxed(reg_val_disable, MISC_CLK_CTL_BASE_REG); |
| 2600 | |
| 2601 | return readl_relaxed(RINGOSC_CNT_BASE_REG); |
| 2602 | } |
| 2603 | |
| 2604 | /* Perform a hardware rate measurement for a given clock. |
| 2605 | FOR DEBUG USE ONLY: Measurements take ~15 ms! */ |
| 2606 | static unsigned measure_clk_get_rate(struct clk *clk) |
| 2607 | { |
| 2608 | unsigned long flags; |
| 2609 | u32 regval, prph_web_reg_old; |
| 2610 | u64 raw_count_short, raw_count_full; |
| 2611 | unsigned ret; |
| 2612 | |
| 2613 | clk_enable(&tcxo_clk.c); |
| 2614 | |
| 2615 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 2616 | |
| 2617 | /* Enable TCXO4 clock branch and root. */ |
| 2618 | prph_web_reg_old = readl_relaxed(PRPH_WEB_NS_BASE_REG); |
| 2619 | regval = prph_web_reg_old | BIT(9) | BIT(11); |
| 2620 | writel_relaxed(regval, PRPH_WEB_NS_BASE_REG); |
| 2621 | |
| 2622 | /* |
| 2623 | * The ring oscillator counter will not reset if the measured clock |
| 2624 | * is not running. To detect this, run a short measurement before |
| 2625 | * the full measurement. If the raw results of the two are the same |
| 2626 | * then the clock must be off. |
| 2627 | */ |
| 2628 | |
| 2629 | /* Run a short measurement. (~1 ms) */ |
| 2630 | raw_count_short = run_measurement(0x1000); |
| 2631 | /* Run a full measurement. (~14 ms) */ |
| 2632 | raw_count_full = run_measurement(0x10000); |
| 2633 | |
| 2634 | /* Disable TCXO4 clock branch and root. */ |
| 2635 | writel_relaxed(prph_web_reg_old, PRPH_WEB_NS_BASE_REG); |
| 2636 | |
| 2637 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 2638 | |
| 2639 | /* Return 0 if the clock is off. */ |
| 2640 | if (raw_count_full == raw_count_short) |
| 2641 | ret = 0; |
| 2642 | else { |
| 2643 | /* Compute rate in Hz. */ |
| 2644 | raw_count_full = ((raw_count_full * 10) + 15) * 4800000; |
| 2645 | do_div(raw_count_full, ((0x10000 * 10) + 35)); |
| 2646 | ret = raw_count_full; |
| 2647 | } |
| 2648 | |
| 2649 | clk_disable(&tcxo_clk.c); |
| 2650 | |
| 2651 | return ret; |
| 2652 | } |
| 2653 | #else /* !CONFIG_DEBUG_FS */ |
| 2654 | static int measure_clk_set_parent(struct clk *clk, struct clk *parent) |
| 2655 | { |
| 2656 | return -EINVAL; |
| 2657 | } |
| 2658 | |
| 2659 | static unsigned measure_clk_get_rate(struct clk *clk) |
| 2660 | { |
| 2661 | return 0; |
| 2662 | } |
| 2663 | #endif /* CONFIG_DEBUG_FS */ |
| 2664 | |
| 2665 | static struct clk_ops measure_clk_ops = { |
| 2666 | .set_parent = measure_clk_set_parent, |
| 2667 | .get_rate = measure_clk_get_rate, |
| 2668 | .is_local = local_clk_is_local, |
| 2669 | }; |
| 2670 | |
| 2671 | static struct clk measure_clk = { |
| 2672 | .dbg_name = "measure_clk", |
| 2673 | .ops = &measure_clk_ops, |
| 2674 | CLK_INIT(measure_clk), |
| 2675 | }; |
| 2676 | |
| 2677 | /* Implementation for clk_set_flags(). */ |
| 2678 | int soc_clk_set_flags(struct clk *clk, unsigned clk_flags) |
| 2679 | { |
| 2680 | uint32_t regval, ret = 0; |
| 2681 | unsigned long flags; |
| 2682 | |
| 2683 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 2684 | |
| 2685 | if (clk == &vfe_clk.c) { |
| 2686 | regval = readl_relaxed(CAM_VFE_NS_REG); |
| 2687 | /* Flag values chosen for backward compatibility |
| 2688 | * with proc_comm remote clock control. */ |
| 2689 | if (clk_flags == 0x00000100) { |
| 2690 | /* Select external source. */ |
| 2691 | regval |= BIT(14); |
| 2692 | } else if (clk_flags == 0x00000200) { |
| 2693 | /* Select internal source. */ |
| 2694 | regval &= ~BIT(14); |
| 2695 | } else |
| 2696 | ret = -EINVAL; |
| 2697 | |
| 2698 | writel_relaxed(regval, CAM_VFE_NS_REG); |
| 2699 | /* Make sure write is issued before returning. */ |
| 2700 | mb(); |
| 2701 | } else |
| 2702 | ret = -EPERM; |
| 2703 | |
| 2704 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 2705 | |
| 2706 | return ret; |
| 2707 | } |
| 2708 | |
| 2709 | static int msm7x30_clk_reset(struct clk *clk, enum clk_reset_action action) |
| 2710 | { |
| 2711 | /* reset_mask is actually a proc_comm id */ |
| 2712 | unsigned id = to_rcg_clk(clk)->b.reset_mask; |
| 2713 | return pc_clk_reset(id, action); |
| 2714 | } |
| 2715 | |
| 2716 | static int soc_branch_clk_reset(struct clk *clk, enum clk_reset_action action) |
| 2717 | { |
| 2718 | unsigned id = to_branch_clk(clk)->b.reset_mask; |
| 2719 | return pc_clk_reset(id, action); |
| 2720 | } |
| 2721 | |
| 2722 | /* |
| 2723 | * Clock ownership detection code |
| 2724 | */ |
| 2725 | |
| 2726 | enum { |
| 2727 | SH2_OWN_GLBL, |
| 2728 | SH2_OWN_APPS1, |
| 2729 | SH2_OWN_APPS2, |
| 2730 | SH2_OWN_ROW1, |
| 2731 | SH2_OWN_ROW2, |
| 2732 | SH2_OWN_APPS3, |
| 2733 | NUM_OWNERSHIP |
| 2734 | }; |
| 2735 | static __initdata uint32_t ownership_regs[NUM_OWNERSHIP]; |
| 2736 | |
| 2737 | static void __init cache_ownership(void) |
| 2738 | { |
| 2739 | ownership_regs[SH2_OWN_GLBL] = readl_relaxed(SH2_OWN_GLBL_BASE_REG); |
| 2740 | ownership_regs[SH2_OWN_APPS1] = readl_relaxed(SH2_OWN_APPS1_BASE_REG); |
| 2741 | ownership_regs[SH2_OWN_APPS2] = readl_relaxed(SH2_OWN_APPS2_BASE_REG); |
| 2742 | ownership_regs[SH2_OWN_ROW1] = readl_relaxed(SH2_OWN_ROW1_BASE_REG); |
| 2743 | ownership_regs[SH2_OWN_ROW2] = readl_relaxed(SH2_OWN_ROW2_BASE_REG); |
| 2744 | ownership_regs[SH2_OWN_APPS3] = readl_relaxed(SH2_OWN_APPS3_BASE_REG); |
| 2745 | } |
| 2746 | |
| 2747 | static void __init print_ownership(void) |
| 2748 | { |
| 2749 | pr_info("Clock ownership\n"); |
| 2750 | pr_info(" GLBL : %08x\n", ownership_regs[SH2_OWN_GLBL]); |
| 2751 | pr_info(" APPS : %08x %08x %08x\n", ownership_regs[SH2_OWN_APPS1], |
| 2752 | ownership_regs[SH2_OWN_APPS2], ownership_regs[SH2_OWN_APPS3]); |
| 2753 | pr_info(" ROW : %08x %08x\n", ownership_regs[SH2_OWN_ROW1], |
| 2754 | ownership_regs[SH2_OWN_ROW2]); |
| 2755 | } |
| 2756 | |
| 2757 | #define O(x) (&ownership_regs[(SH2_OWN_##x)]) |
| 2758 | #define OWN(r, b, name, clk, dev) \ |
| 2759 | { \ |
| 2760 | .lk = CLK_LOOKUP(name, clk.c, dev), \ |
| 2761 | .remote = &p_##clk.c, \ |
| 2762 | .reg = O(r), \ |
| 2763 | .bit = BIT(b), \ |
| 2764 | } |
| 2765 | |
| 2766 | static struct clk_local_ownership { |
| 2767 | struct clk_lookup lk; |
| 2768 | const u32 *reg; |
| 2769 | const u32 bit; |
| 2770 | struct clk *remote; |
| 2771 | } ownership_map[] __initdata = { |
| 2772 | /* Sources */ |
| 2773 | { CLK_LOOKUP("pll1_clk", pll1_clk.c, "acpu") }, |
| 2774 | { CLK_LOOKUP("pll2_clk", pll2_clk.c, "acpu") }, |
| 2775 | { CLK_LOOKUP("pll3_clk", pll3_clk.c, "acpu") }, |
| 2776 | { CLK_LOOKUP("measure", measure_clk, "debug") }, |
| 2777 | |
| 2778 | /* PCOM */ |
| 2779 | { CLK_LOOKUP("adsp_clk", adsp_clk.c, NULL) }, |
| 2780 | { CLK_LOOKUP("codec_ssbi_clk", codec_ssbi_clk.c, NULL) }, |
| 2781 | { CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL) }, |
| 2782 | { CLK_LOOKUP("ebi1_fixed_clk", ebi1_fixed_clk.c, NULL) }, |
| 2783 | { CLK_LOOKUP("ecodec_clk", ecodec_clk.c, NULL) }, |
Matt Wagantall | b86ad26 | 2011-10-24 19:50:29 -0700 | [diff] [blame] | 2784 | { CLK_LOOKUP("core_clk", gp_clk.c, NULL) }, |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 2785 | { CLK_LOOKUP("core_clk", uart3_clk.c, "msm_serial.2") }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2786 | { CLK_LOOKUP("usb_phy_clk", usb_phy_clk.c, NULL) }, |
| 2787 | |
| 2788 | /* Voters */ |
| 2789 | { CLK_LOOKUP("ebi1_dtv_clk", ebi_dtv_clk.c, NULL) }, |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 2790 | { CLK_LOOKUP("bus_clk", ebi_grp_2d_clk.c, "kgsl-2d0.0") }, |
| 2791 | { CLK_LOOKUP("bus_clk", ebi_grp_3d_clk.c, "kgsl-3d0.0") }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2792 | { CLK_LOOKUP("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL) }, |
| 2793 | { CLK_LOOKUP("ebi1_mddi_clk", ebi_mddi_clk.c, NULL) }, |
| 2794 | { CLK_LOOKUP("ebi1_tv_clk", ebi_tv_clk.c, NULL) }, |
Matt Wagantall | 3f7660b | 2011-08-17 21:25:13 -0700 | [diff] [blame] | 2795 | { CLK_LOOKUP("mem_clk", ebi_vcd_clk.c, "msm_vidc.0") }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2796 | { CLK_LOOKUP("ebi1_vfe_clk", ebi_vfe_clk.c, NULL) }, |
Matt Wagantall | e1a8606 | 2011-08-18 17:46:10 -0700 | [diff] [blame] | 2797 | { CLK_LOOKUP("mem_clk", ebi_adm_clk.c, "msm_dmov") }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2798 | |
| 2799 | /* |
| 2800 | * This is a many-to-one mapping because we don't know how the remote |
| 2801 | * clock code has decided to handle the dependencies between clocks for |
| 2802 | * a particular hardware block. We determine the ownership for all the |
| 2803 | * clocks going into a block by checking the ownership bit of one |
| 2804 | * register (usually the ns register). |
| 2805 | */ |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 2806 | OWN(APPS1, 6, "core_clk", grp_2d_clk, "kgsl-2d0.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2807 | OWN(APPS1, 6, "core_clk", grp_2d_clk, "footswitch-pcom.0"), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 2808 | OWN(APPS1, 6, "iface_clk", grp_2d_p_clk, "kgsl-2d0.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2809 | OWN(APPS1, 6, "iface_clk", grp_2d_p_clk, "footswitch-pcom.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2810 | OWN(APPS1, 31, "hdmi_clk", hdmi_clk, NULL), |
| 2811 | OWN(APPS1, 0, "jpeg_clk", jpeg_clk, NULL), |
| 2812 | OWN(APPS1, 0, "jpeg_pclk", jpeg_p_clk, NULL), |
| 2813 | OWN(APPS1, 23, "lpa_codec_clk", lpa_codec_clk, NULL), |
| 2814 | OWN(APPS1, 23, "lpa_core_clk", lpa_core_clk, NULL), |
| 2815 | OWN(APPS1, 23, "lpa_pclk", lpa_p_clk, NULL), |
| 2816 | OWN(APPS1, 28, "mi2s_m_clk", mi2s_m_clk, NULL), |
| 2817 | OWN(APPS1, 28, "mi2s_s_clk", mi2s_s_clk, NULL), |
| 2818 | OWN(APPS1, 12, "mi2s_codec_rx_m_clk", mi2s_codec_rx_m_clk, NULL), |
| 2819 | OWN(APPS1, 12, "mi2s_codec_rx_s_clk", mi2s_codec_rx_s_clk, NULL), |
| 2820 | OWN(APPS1, 14, "mi2s_codec_tx_m_clk", mi2s_codec_tx_m_clk, NULL), |
| 2821 | OWN(APPS1, 14, "mi2s_codec_tx_s_clk", mi2s_codec_tx_s_clk, NULL), |
| 2822 | { CLK_LOOKUP("midi_clk", midi_clk.c, NULL), |
| 2823 | O(APPS1), BIT(22) }, |
| 2824 | OWN(APPS1, 26, "sdac_clk", sdac_clk, NULL), |
| 2825 | OWN(APPS1, 26, "sdac_m_clk", sdac_m_clk, NULL), |
| 2826 | OWN(APPS1, 8, "vfe_clk", vfe_clk, NULL), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2827 | OWN(APPS1, 8, "core_clk", vfe_clk, "footswitch-pcom.8"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2828 | OWN(APPS1, 8, "vfe_camif_clk", vfe_camif_clk, NULL), |
| 2829 | OWN(APPS1, 8, "vfe_mdc_clk", vfe_mdc_clk, NULL), |
| 2830 | OWN(APPS1, 8, "vfe_pclk", vfe_p_clk, NULL), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2831 | OWN(APPS1, 8, "iface_clk", vfe_p_clk, "footswitch-pcom.8"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2832 | |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 2833 | OWN(APPS2, 0, "core_clk", grp_3d_clk, "kgsl-3d0.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2834 | OWN(APPS2, 0, "core_clk", grp_3d_clk, "footswitch-pcom.2"), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 2835 | OWN(APPS2, 0, "iface_clk", grp_3d_p_clk, "kgsl-3d0.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2836 | OWN(APPS2, 0, "iface_clk", grp_3d_p_clk, "footswitch-pcom.2"), |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 2837 | { CLK_LOOKUP("src_clk", grp_3d_src_clk.c, "kgsl-3d0.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2838 | O(APPS2), BIT(0), &p_grp_3d_clk.c }, |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2839 | { CLK_LOOKUP("src_clk", grp_3d_src_clk.c, "footswitch-pcom.2"), |
| 2840 | O(APPS2), BIT(0), &p_grp_3d_clk.c }, |
Matt Wagantall | 9dc0163 | 2011-08-17 18:55:04 -0700 | [diff] [blame] | 2841 | OWN(APPS2, 0, "mem_clk", imem_clk, "kgsl-3d0.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2842 | OWN(APPS2, 4, "mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk, NULL), |
| 2843 | OWN(APPS2, 4, "mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk, NULL), |
| 2844 | OWN(APPS2, 4, "mdp_pclk", mdp_p_clk, NULL), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2845 | OWN(APPS2, 4, "iface_clk", mdp_p_clk, "footswitch-pcom.4"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2846 | OWN(APPS2, 28, "mdp_vsync_clk", mdp_vsync_clk, NULL), |
Matt Wagantall | 640e5fd | 2011-08-17 16:08:53 -0700 | [diff] [blame] | 2847 | OWN(APPS2, 5, "ref_clk", tsif_ref_clk, "msm_tsif.0"), |
| 2848 | OWN(APPS2, 5, "iface_clk", tsif_p_clk, "msm_tsif.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2849 | { CLK_LOOKUP("tv_src_clk", tv_clk.c, NULL), |
| 2850 | O(APPS2), BIT(2), &p_tv_enc_clk.c }, |
| 2851 | OWN(APPS2, 2, "tv_dac_clk", tv_dac_clk, NULL), |
| 2852 | OWN(APPS2, 2, "tv_enc_clk", tv_enc_clk, NULL), |
| 2853 | |
| 2854 | OWN(ROW1, 7, "emdh_clk", emdh_clk, "msm_mddi.1"), |
| 2855 | OWN(ROW1, 7, "emdh_pclk", emdh_p_clk, "msm_mddi.1"), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 2856 | OWN(ROW1, 11, "core_clk", i2c_clk, "msm_i2c.0"), |
| 2857 | OWN(ROW1, 12, "core_clk", i2c_2_clk, "msm_i2c.2"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2858 | OWN(ROW1, 17, "mdc_clk", mdc_clk, NULL), |
| 2859 | OWN(ROW1, 19, "mddi_clk", pmdh_clk, NULL), |
| 2860 | OWN(ROW1, 19, "mddi_pclk", pmdh_p_clk, NULL), |
Matt Wagantall | 37ce384 | 2011-08-17 16:00:36 -0700 | [diff] [blame] | 2861 | OWN(ROW1, 23, "core_clk", sdc1_clk, "msm_sdcc.1"), |
| 2862 | OWN(ROW1, 23, "iface_clk", sdc1_p_clk, "msm_sdcc.1"), |
| 2863 | OWN(ROW1, 25, "core_clk", sdc2_clk, "msm_sdcc.2"), |
| 2864 | OWN(ROW1, 25, "iface_clk", sdc2_p_clk, "msm_sdcc.2"), |
| 2865 | OWN(ROW1, 27, "core_clk", sdc3_clk, "msm_sdcc.3"), |
| 2866 | OWN(ROW1, 27, "iface_clk", sdc3_p_clk, "msm_sdcc.3"), |
| 2867 | OWN(ROW1, 29, "core_clk", sdc4_clk, "msm_sdcc.4"), |
| 2868 | OWN(ROW1, 29, "iface_clk", sdc4_p_clk, "msm_sdcc.4"), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 2869 | OWN(ROW1, 0, "core_clk", uart2_clk, "msm_serial.1"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2870 | OWN(ROW1, 2, "usb_hs2_clk", usb_hs2_clk, NULL), |
| 2871 | OWN(ROW1, 2, "usb_hs2_core_clk", usb_hs2_core_clk, NULL), |
| 2872 | OWN(ROW1, 2, "usb_hs2_pclk", usb_hs2_p_clk, NULL), |
| 2873 | OWN(ROW1, 4, "usb_hs3_clk", usb_hs3_clk, NULL), |
| 2874 | OWN(ROW1, 4, "usb_hs3_core_clk", usb_hs3_core_clk, NULL), |
| 2875 | OWN(ROW1, 4, "usb_hs3_pclk", usb_hs3_p_clk, NULL), |
| 2876 | |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 2877 | OWN(ROW2, 3, "core_clk", qup_i2c_clk, "qup_i2c.4"), |
| 2878 | OWN(ROW2, 1, "core_clk", spi_clk, "spi_qsd.0"), |
| 2879 | OWN(ROW2, 1, "iface_clk", spi_p_clk, "spi_qsd.0"), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 2880 | OWN(ROW2, 9, "core_clk", uart1_clk, "msm_serial.0"), |
| 2881 | OWN(ROW2, 6, "core_clk", uart1dm_clk, "msm_serial_hs.0"), |
| 2882 | OWN(ROW2, 8, "core_clk", uart2dm_clk, "msm_serial_hs.1"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2883 | OWN(ROW2, 11, "usb_hs_clk", usb_hs_clk, NULL), |
| 2884 | OWN(ROW2, 11, "usb_hs_core_clk", usb_hs_core_clk, NULL), |
| 2885 | OWN(ROW2, 11, "usb_hs_pclk", usb_hs_p_clk, NULL), |
| 2886 | |
| 2887 | OWN(APPS3, 6, "cam_m_clk", cam_m_clk, NULL), |
| 2888 | OWN(APPS3, 6, "camif_pad_pclk", camif_pad_p_clk, NULL), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 2889 | OWN(APPS3, 6, "iface_clk", camif_pad_p_clk, "qup_i2c.4"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2890 | OWN(APPS3, 11, "csi_clk", csi0_clk, NULL), |
| 2891 | OWN(APPS3, 11, "csi_vfe_clk", csi0_vfe_clk, NULL), |
| 2892 | OWN(APPS3, 11, "csi_pclk", csi0_p_clk, NULL), |
| 2893 | OWN(APPS3, 0, "mdp_clk", mdp_clk, NULL), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2894 | OWN(APPS3, 0, "core_clk", mdp_clk, "footswitch-pcom.4"), |
Matt Wagantall | 3f7660b | 2011-08-17 21:25:13 -0700 | [diff] [blame] | 2895 | OWN(APPS3, 2, "core_clk", mfc_clk, "msm_vidc.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2896 | OWN(APPS3, 2, "core_clk", mfc_clk, "footswitch-pcom.5"), |
Matt Wagantall | 3f7660b | 2011-08-17 21:25:13 -0700 | [diff] [blame] | 2897 | OWN(APPS3, 2, "core_div2_clk", mfc_div2_clk, "msm_vidc.0"), |
| 2898 | OWN(APPS3, 2, "iface_clk", mfc_p_clk, "msm_vidc.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2899 | OWN(APPS3, 2, "iface_clk", mfc_p_clk, "footswitch-pcom.5"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2900 | OWN(APPS3, 4, "vpe_clk", vpe_clk, NULL), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2901 | OWN(APPS3, 4, "core_clk", vpe_clk, "footswitch-pcom.9"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2902 | |
Matt Wagantall | e1a8606 | 2011-08-18 17:46:10 -0700 | [diff] [blame] | 2903 | OWN(GLBL, 8, "core_clk", adm_clk, "msm_dmov"), |
| 2904 | { CLK_LOOKUP("iface_clk", adm_p_clk.c, "msm_dmov"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2905 | O(GLBL), BIT(13), &dummy_clk }, |
Matt Wagantall | c4b3a4d | 2011-08-17 16:58:39 -0700 | [diff] [blame] | 2906 | OWN(GLBL, 8, "core_clk", ce_clk, "qce.0"), |
Matt Wagantall | e0b1145 | 2011-09-13 17:25:33 -0700 | [diff] [blame] | 2907 | OWN(GLBL, 8, "core_clk", ce_clk, "crypto.0"), |
Matt Wagantall | bb90da9 | 2011-10-25 15:07:52 -0700 | [diff] [blame^] | 2908 | OWN(GLBL, 13, "core_clk", axi_rotator_clk, "msm_rotator.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2909 | OWN(GLBL, 13, "core_clk", axi_rotator_clk, "footswitch-pcom.6"), |
Matt Wagantall | bb90da9 | 2011-10-25 15:07:52 -0700 | [diff] [blame^] | 2910 | OWN(GLBL, 13, "mem_clk", rotator_imem_clk, "msm_rotator.0"), |
| 2911 | OWN(GLBL, 13, "iface_clk", rotator_p_clk, "msm_rotator.0"), |
Matt Wagantall | 4972271 | 2011-08-17 18:50:53 -0700 | [diff] [blame] | 2912 | OWN(GLBL, 13, "iface_clk", rotator_p_clk, "footswitch-pcom.6"), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 2913 | { CLK_LOOKUP("iface_clk", uart1dm_p_clk.c, "msm_serial_hs.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2914 | O(GLBL), BIT(8), &dummy_clk }, |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 2915 | { CLK_LOOKUP("iface_clk", uart2dm_p_clk.c, "msm_serial_hs.1"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2916 | O(GLBL), BIT(8), &dummy_clk }, |
| 2917 | }; |
| 2918 | |
| 2919 | static struct clk_lookup msm_clocks_7x30[ARRAY_SIZE(ownership_map)]; |
| 2920 | |
| 2921 | static void __init set_clock_ownership(void) |
| 2922 | { |
| 2923 | unsigned i; |
| 2924 | struct clk_lookup *lk; |
| 2925 | |
| 2926 | for (i = 0; i < ARRAY_SIZE(ownership_map); i++) { |
| 2927 | const u32 *reg = ownership_map[i].reg; |
| 2928 | u32 bit = ownership_map[i].bit; |
| 2929 | struct clk *remote = ownership_map[i].remote; |
| 2930 | |
| 2931 | lk = &ownership_map[i].lk; |
| 2932 | memcpy(&msm_clocks_7x30[i], lk, sizeof(*lk)); |
| 2933 | |
| 2934 | if (reg && !(*reg & bit)) |
| 2935 | msm_clocks_7x30[i].clk = remote; |
| 2936 | } |
| 2937 | } |
| 2938 | |
| 2939 | /* |
| 2940 | * Miscellaneous clock register initializations |
| 2941 | */ |
| 2942 | static const struct reg_init { |
| 2943 | const void __iomem *reg; |
| 2944 | uint32_t mask; |
| 2945 | uint32_t val; |
| 2946 | } ri_list[] __initconst = { |
| 2947 | /* Enable UMDX_P clock. Known to causes issues, so never turn off. */ |
| 2948 | {GLBL_CLK_ENA_2_SC_REG, BIT(2), BIT(2)}, |
| 2949 | |
| 2950 | /* Disable all the child clocks of USB_HS_SRC. */ |
| 2951 | { USBH_NS_REG, BIT(13) | BIT(9), 0 }, |
| 2952 | { USBH2_NS_REG, BIT(9) | BIT(4), 0 }, |
| 2953 | { USBH3_NS_REG, BIT(9) | BIT(4), 0 }, |
| 2954 | |
| 2955 | {EMDH_NS_REG, BM(18, 17) , BVAL(18, 17, 0x3)}, /* RX div = div-4. */ |
| 2956 | {PMDH_NS_REG, BM(18, 17), BVAL(18, 17, 0x3)}, /* RX div = div-4. */ |
| 2957 | /* MI2S_CODEC_RX_S src = MI2S_CODEC_RX_M. */ |
| 2958 | {MI2S_RX_NS_REG, BIT(14), 0x0}, |
| 2959 | /* MI2S_CODEC_TX_S src = MI2S_CODEC_TX_M. */ |
| 2960 | {MI2S_TX_NS_REG, BIT(14), 0x0}, |
| 2961 | {MI2S_NS_REG, BIT(14), 0x0}, /* MI2S_S src = MI2S_M. */ |
| 2962 | /* Allow DSP to decide the LPA CORE src. */ |
| 2963 | {LPA_CORE_CLK_MA0_REG, BIT(0), BIT(0)}, |
| 2964 | {LPA_CORE_CLK_MA2_REG, BIT(0), BIT(0)}, |
| 2965 | {MI2S_CODEC_RX_DIV_REG, 0xF, 0xD}, /* MI2S_CODEC_RX_S div = div-8. */ |
| 2966 | {MI2S_CODEC_TX_DIV_REG, 0xF, 0xD}, /* MI2S_CODEC_TX_S div = div-8. */ |
| 2967 | {MI2S_DIV_REG, 0xF, 0x7}, /* MI2S_S div = div-8. */ |
| 2968 | {MDC_NS_REG, 0x3, 0x3}, /* MDC src = external MDH src. */ |
| 2969 | {SDAC_NS_REG, BM(15, 14), 0x0}, /* SDAC div = div-1. */ |
| 2970 | /* Disable sources TCXO/5 & TCXO/6. UART1 src = TCXO*/ |
| 2971 | {UART_NS_REG, BM(26, 25) | BM(2, 0), 0x0}, |
| 2972 | /* HDMI div = div-1, non-inverted. tv_enc_src = tv_clk_src */ |
| 2973 | {HDMI_NS_REG, 0x7, 0x0}, |
| 2974 | {TV_NS_REG, BM(15, 14), 0x0}, /* tv_clk_src_div2 = div-1 */ |
| 2975 | |
| 2976 | /* USBH core clocks src = USB_HS_SRC. */ |
| 2977 | {USBH_NS_REG, BIT(15), BIT(15)}, |
| 2978 | {USBH2_NS_REG, BIT(6), BIT(6)}, |
| 2979 | {USBH3_NS_REG, BIT(6), BIT(6)}, |
| 2980 | }; |
| 2981 | |
| 2982 | /* Local clock driver initialization. */ |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 2983 | static void __init msm7x30_clock_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2984 | { |
| 2985 | int i; |
| 2986 | uint32_t val; |
| 2987 | |
| 2988 | cache_ownership(); |
| 2989 | print_ownership(); |
| 2990 | set_clock_ownership(); |
| 2991 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2992 | /* When we have no local clock control, the rest of the code in this |
| 2993 | * function is a NOP since writes to shadow regions that we don't own |
| 2994 | * are ignored. */ |
| 2995 | |
| 2996 | clk_set_rate(&usb_hs_src_clk.c, clk_tbl_usb[1].freq_hz); |
| 2997 | |
| 2998 | for (i = 0; i < ARRAY_SIZE(ri_list); i++) { |
| 2999 | val = readl_relaxed(ri_list[i].reg); |
| 3000 | val &= ~ri_list[i].mask; |
| 3001 | val |= ri_list[i].val; |
| 3002 | writel_relaxed(val, ri_list[i].reg); |
| 3003 | } |
| 3004 | |
| 3005 | clk_set_rate(&i2c_clk.c, 19200000); |
| 3006 | clk_set_rate(&i2c_2_clk.c, 19200000); |
| 3007 | clk_set_rate(&qup_i2c_clk.c, 19200000); |
| 3008 | clk_set_rate(&uart1_clk.c, 19200000); |
| 3009 | clk_set_rate(&uart2_clk.c, 19200000); |
| 3010 | clk_set_rate(&mi2s_m_clk.c, 12288000); |
| 3011 | clk_set_rate(&midi_clk.c, 98304000); |
| 3012 | clk_set_rate(&mdp_vsync_clk.c, 24576000); |
| 3013 | clk_set_rate(&glbl_root_clk.c, 1); |
| 3014 | clk_set_rate(&mdc_clk.c, 1); |
| 3015 | /* Sync the LPA_CODEC clock to MI2S_CODEC_RX */ |
| 3016 | clk_set_rate(&lpa_codec_clk.c, 1); |
| 3017 | /* Sync the GRP2D clock to AXI */ |
| 3018 | clk_set_rate(&grp_2d_clk.c, 1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3019 | } |
| 3020 | |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 3021 | struct clock_init_data msm7x30_clock_init_data __initdata = { |
| 3022 | .table = msm_clocks_7x30, |
| 3023 | .size = ARRAY_SIZE(msm_clocks_7x30), |
| 3024 | .init = msm7x30_clock_init, |
| 3025 | }; |
| 3026 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3027 | /* |
| 3028 | * Clock operation handler registration |
| 3029 | */ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3030 | static struct clk_ops clk_ops_rcg_7x30 = { |
Matt Wagantall | 0625ea0 | 2011-07-13 18:51:56 -0700 | [diff] [blame] | 3031 | .enable = rcg_clk_enable, |
| 3032 | .disable = rcg_clk_disable, |
Matt Wagantall | 41af077 | 2011-09-17 12:21:39 -0700 | [diff] [blame] | 3033 | .auto_off = rcg_clk_disable, |
Matt Wagantall | 0625ea0 | 2011-07-13 18:51:56 -0700 | [diff] [blame] | 3034 | .set_rate = rcg_clk_set_rate, |
| 3035 | .set_min_rate = rcg_clk_set_min_rate, |
Matt Wagantall | 0625ea0 | 2011-07-13 18:51:56 -0700 | [diff] [blame] | 3036 | .get_rate = rcg_clk_get_rate, |
| 3037 | .list_rate = rcg_clk_list_rate, |
| 3038 | .is_enabled = rcg_clk_is_enabled, |
| 3039 | .round_rate = rcg_clk_round_rate, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3040 | .reset = msm7x30_clk_reset, |
| 3041 | .set_flags = soc_clk_set_flags, |
| 3042 | .is_local = local_clk_is_local, |
Matt Wagantall | 0625ea0 | 2011-07-13 18:51:56 -0700 | [diff] [blame] | 3043 | .get_parent = rcg_clk_get_parent, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3044 | }; |
| 3045 | |
| 3046 | static struct clk_ops clk_ops_branch = { |
| 3047 | .enable = branch_clk_enable, |
| 3048 | .disable = branch_clk_disable, |
Matt Wagantall | 41af077 | 2011-09-17 12:21:39 -0700 | [diff] [blame] | 3049 | .auto_off = branch_clk_disable, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3050 | .is_enabled = branch_clk_is_enabled, |
| 3051 | .reset = soc_branch_clk_reset, |
| 3052 | .set_flags = soc_clk_set_flags, |
| 3053 | .is_local = local_clk_is_local, |
| 3054 | .get_parent = branch_clk_get_parent, |
| 3055 | .set_parent = branch_clk_set_parent, |
| 3056 | }; |