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