Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms and conditions of the GNU General Public License, |
| 6 | * version 2, as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | * more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ |
| 16 | |
| 17 | #include <linux/io.h> |
| 18 | #include <linux/clk.h> |
| 19 | #include <linux/clk-provider.h> |
| 20 | #include <linux/clkdev.h> |
| 21 | #include <linux/of.h> |
| 22 | #include <linux/of_address.h> |
| 23 | #include <linux/delay.h> |
Paul Walmsley | 25c9ded | 2013-06-07 06:18:58 -0600 | [diff] [blame] | 24 | #include <linux/export.h> |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 25 | #include <linux/clk/tegra.h> |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 26 | #include <dt-bindings/clock/tegra114-car.h> |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 27 | |
| 28 | #include "clk.h" |
| 29 | |
Paul Walmsley | 1c472d8 | 2013-06-07 06:19:09 -0600 | [diff] [blame] | 30 | #define RST_DFLL_DVCO 0x2F4 |
Paul Walmsley | 25c9ded | 2013-06-07 06:18:58 -0600 | [diff] [blame] | 31 | #define CPU_FINETRIM_SELECT 0x4d4 /* override default prop dlys */ |
| 32 | #define CPU_FINETRIM_DR 0x4d8 /* rise->rise prop dly A */ |
| 33 | #define CPU_FINETRIM_R 0x4e4 /* rise->rise prop dly inc A */ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 34 | |
Paul Walmsley | 1c472d8 | 2013-06-07 06:19:09 -0600 | [diff] [blame] | 35 | /* RST_DFLL_DVCO bitfields */ |
| 36 | #define DVFS_DFLL_RESET_SHIFT 0 |
| 37 | |
Paul Walmsley | 25c9ded | 2013-06-07 06:18:58 -0600 | [diff] [blame] | 38 | /* CPU_FINETRIM_SELECT and CPU_FINETRIM_DR bitfields */ |
| 39 | #define CPU_FINETRIM_1_FCPU_1 BIT(0) /* fcpu0 */ |
| 40 | #define CPU_FINETRIM_1_FCPU_2 BIT(1) /* fcpu1 */ |
| 41 | #define CPU_FINETRIM_1_FCPU_3 BIT(2) /* fcpu2 */ |
| 42 | #define CPU_FINETRIM_1_FCPU_4 BIT(3) /* fcpu3 */ |
| 43 | #define CPU_FINETRIM_1_FCPU_5 BIT(4) /* fl2 */ |
| 44 | #define CPU_FINETRIM_1_FCPU_6 BIT(5) /* ftop */ |
| 45 | |
| 46 | /* CPU_FINETRIM_R bitfields */ |
| 47 | #define CPU_FINETRIM_R_FCPU_1_SHIFT 0 /* fcpu0 */ |
| 48 | #define CPU_FINETRIM_R_FCPU_1_MASK (0x3 << CPU_FINETRIM_R_FCPU_1_SHIFT) |
| 49 | #define CPU_FINETRIM_R_FCPU_2_SHIFT 2 /* fcpu1 */ |
| 50 | #define CPU_FINETRIM_R_FCPU_2_MASK (0x3 << CPU_FINETRIM_R_FCPU_2_SHIFT) |
| 51 | #define CPU_FINETRIM_R_FCPU_3_SHIFT 4 /* fcpu2 */ |
| 52 | #define CPU_FINETRIM_R_FCPU_3_MASK (0x3 << CPU_FINETRIM_R_FCPU_3_SHIFT) |
| 53 | #define CPU_FINETRIM_R_FCPU_4_SHIFT 6 /* fcpu3 */ |
| 54 | #define CPU_FINETRIM_R_FCPU_4_MASK (0x3 << CPU_FINETRIM_R_FCPU_4_SHIFT) |
| 55 | #define CPU_FINETRIM_R_FCPU_5_SHIFT 8 /* fl2 */ |
| 56 | #define CPU_FINETRIM_R_FCPU_5_MASK (0x3 << CPU_FINETRIM_R_FCPU_5_SHIFT) |
| 57 | #define CPU_FINETRIM_R_FCPU_6_SHIFT 10 /* ftop */ |
| 58 | #define CPU_FINETRIM_R_FCPU_6_MASK (0x3 << CPU_FINETRIM_R_FCPU_6_SHIFT) |
| 59 | |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 60 | #define TEGRA114_CLK_PERIPH_BANKS 5 |
| 61 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 62 | #define PLLC_BASE 0x80 |
| 63 | #define PLLC_MISC2 0x88 |
| 64 | #define PLLC_MISC 0x8c |
| 65 | #define PLLC2_BASE 0x4e8 |
| 66 | #define PLLC2_MISC 0x4ec |
| 67 | #define PLLC3_BASE 0x4fc |
| 68 | #define PLLC3_MISC 0x500 |
| 69 | #define PLLM_BASE 0x90 |
| 70 | #define PLLM_MISC 0x9c |
| 71 | #define PLLP_BASE 0xa0 |
| 72 | #define PLLP_MISC 0xac |
| 73 | #define PLLX_BASE 0xe0 |
| 74 | #define PLLX_MISC 0xe4 |
| 75 | #define PLLX_MISC2 0x514 |
| 76 | #define PLLX_MISC3 0x518 |
| 77 | #define PLLD_BASE 0xd0 |
| 78 | #define PLLD_MISC 0xdc |
| 79 | #define PLLD2_BASE 0x4b8 |
| 80 | #define PLLD2_MISC 0x4bc |
| 81 | #define PLLE_BASE 0xe8 |
| 82 | #define PLLE_MISC 0xec |
| 83 | #define PLLA_BASE 0xb0 |
| 84 | #define PLLA_MISC 0xbc |
| 85 | #define PLLU_BASE 0xc0 |
| 86 | #define PLLU_MISC 0xcc |
| 87 | #define PLLRE_BASE 0x4c4 |
| 88 | #define PLLRE_MISC 0x4c8 |
| 89 | |
| 90 | #define PLL_MISC_LOCK_ENABLE 18 |
| 91 | #define PLLC_MISC_LOCK_ENABLE 24 |
| 92 | #define PLLDU_MISC_LOCK_ENABLE 22 |
| 93 | #define PLLE_MISC_LOCK_ENABLE 9 |
| 94 | #define PLLRE_MISC_LOCK_ENABLE 30 |
| 95 | |
| 96 | #define PLLC_IDDQ_BIT 26 |
| 97 | #define PLLX_IDDQ_BIT 3 |
| 98 | #define PLLRE_IDDQ_BIT 16 |
| 99 | |
| 100 | #define PLL_BASE_LOCK BIT(27) |
| 101 | #define PLLE_MISC_LOCK BIT(11) |
| 102 | #define PLLRE_MISC_LOCK BIT(24) |
| 103 | #define PLLCX_BASE_LOCK (BIT(26)|BIT(27)) |
| 104 | |
| 105 | #define PLLE_AUX 0x48c |
| 106 | #define PLLC_OUT 0x84 |
| 107 | #define PLLM_OUT 0x94 |
| 108 | #define PLLP_OUTA 0xa4 |
| 109 | #define PLLP_OUTB 0xa8 |
| 110 | #define PLLA_OUT 0xb4 |
| 111 | |
| 112 | #define AUDIO_SYNC_CLK_I2S0 0x4a0 |
| 113 | #define AUDIO_SYNC_CLK_I2S1 0x4a4 |
| 114 | #define AUDIO_SYNC_CLK_I2S2 0x4a8 |
| 115 | #define AUDIO_SYNC_CLK_I2S3 0x4ac |
| 116 | #define AUDIO_SYNC_CLK_I2S4 0x4b0 |
| 117 | #define AUDIO_SYNC_CLK_SPDIF 0x4b4 |
| 118 | |
| 119 | #define AUDIO_SYNC_DOUBLER 0x49c |
| 120 | |
| 121 | #define PMC_CLK_OUT_CNTRL 0x1a8 |
| 122 | #define PMC_DPD_PADS_ORIDE 0x1c |
| 123 | #define PMC_DPD_PADS_ORIDE_BLINK_ENB 20 |
| 124 | #define PMC_CTRL 0 |
| 125 | #define PMC_CTRL_BLINK_ENB 7 |
Alexandre Courbot | 9139227 | 2013-05-26 11:56:31 +0900 | [diff] [blame] | 126 | #define PMC_BLINK_TIMER 0x40 |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 127 | |
| 128 | #define OSC_CTRL 0x50 |
| 129 | #define OSC_CTRL_OSC_FREQ_SHIFT 28 |
| 130 | #define OSC_CTRL_PLL_REF_DIV_SHIFT 26 |
| 131 | |
| 132 | #define PLLXC_SW_MAX_P 6 |
| 133 | |
| 134 | #define CCLKG_BURST_POLICY 0x368 |
| 135 | #define CCLKLP_BURST_POLICY 0x370 |
| 136 | #define SCLK_BURST_POLICY 0x028 |
| 137 | #define SYSTEM_CLK_RATE 0x030 |
| 138 | |
| 139 | #define UTMIP_PLL_CFG2 0x488 |
| 140 | #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6) |
| 141 | #define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18) |
| 142 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN BIT(0) |
| 143 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN BIT(2) |
| 144 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN BIT(4) |
| 145 | |
| 146 | #define UTMIP_PLL_CFG1 0x484 |
| 147 | #define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6) |
| 148 | #define UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(x) (((x) & 0xfff) << 0) |
| 149 | #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP BIT(17) |
| 150 | #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN BIT(16) |
| 151 | #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP BIT(15) |
| 152 | #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN BIT(14) |
| 153 | #define UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN BIT(12) |
| 154 | |
| 155 | #define UTMIPLL_HW_PWRDN_CFG0 0x52c |
| 156 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE BIT(25) |
| 157 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE BIT(24) |
| 158 | #define UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET BIT(6) |
| 159 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_RESET_INPUT_VALUE BIT(5) |
| 160 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_IN_SWCTL BIT(4) |
| 161 | #define UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2) |
| 162 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1) |
| 163 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0) |
| 164 | |
| 165 | #define CLK_SOURCE_I2S0 0x1d8 |
| 166 | #define CLK_SOURCE_I2S1 0x100 |
| 167 | #define CLK_SOURCE_I2S2 0x104 |
| 168 | #define CLK_SOURCE_NDFLASH 0x160 |
| 169 | #define CLK_SOURCE_I2S3 0x3bc |
| 170 | #define CLK_SOURCE_I2S4 0x3c0 |
| 171 | #define CLK_SOURCE_SPDIF_OUT 0x108 |
| 172 | #define CLK_SOURCE_SPDIF_IN 0x10c |
| 173 | #define CLK_SOURCE_PWM 0x110 |
| 174 | #define CLK_SOURCE_ADX 0x638 |
| 175 | #define CLK_SOURCE_AMX 0x63c |
| 176 | #define CLK_SOURCE_HDA 0x428 |
| 177 | #define CLK_SOURCE_HDA2CODEC_2X 0x3e4 |
| 178 | #define CLK_SOURCE_SBC1 0x134 |
| 179 | #define CLK_SOURCE_SBC2 0x118 |
| 180 | #define CLK_SOURCE_SBC3 0x11c |
| 181 | #define CLK_SOURCE_SBC4 0x1b4 |
| 182 | #define CLK_SOURCE_SBC5 0x3c8 |
| 183 | #define CLK_SOURCE_SBC6 0x3cc |
| 184 | #define CLK_SOURCE_SATA_OOB 0x420 |
| 185 | #define CLK_SOURCE_SATA 0x424 |
| 186 | #define CLK_SOURCE_NDSPEED 0x3f8 |
| 187 | #define CLK_SOURCE_VFIR 0x168 |
| 188 | #define CLK_SOURCE_SDMMC1 0x150 |
| 189 | #define CLK_SOURCE_SDMMC2 0x154 |
| 190 | #define CLK_SOURCE_SDMMC3 0x1bc |
| 191 | #define CLK_SOURCE_SDMMC4 0x164 |
| 192 | #define CLK_SOURCE_VDE 0x1c8 |
| 193 | #define CLK_SOURCE_CSITE 0x1d4 |
| 194 | #define CLK_SOURCE_LA 0x1f8 |
| 195 | #define CLK_SOURCE_TRACE 0x634 |
| 196 | #define CLK_SOURCE_OWR 0x1cc |
| 197 | #define CLK_SOURCE_NOR 0x1d0 |
| 198 | #define CLK_SOURCE_MIPI 0x174 |
| 199 | #define CLK_SOURCE_I2C1 0x124 |
| 200 | #define CLK_SOURCE_I2C2 0x198 |
| 201 | #define CLK_SOURCE_I2C3 0x1b8 |
| 202 | #define CLK_SOURCE_I2C4 0x3c4 |
| 203 | #define CLK_SOURCE_I2C5 0x128 |
| 204 | #define CLK_SOURCE_UARTA 0x178 |
| 205 | #define CLK_SOURCE_UARTB 0x17c |
| 206 | #define CLK_SOURCE_UARTC 0x1a0 |
| 207 | #define CLK_SOURCE_UARTD 0x1c0 |
| 208 | #define CLK_SOURCE_UARTE 0x1c4 |
| 209 | #define CLK_SOURCE_UARTA_DBG 0x178 |
| 210 | #define CLK_SOURCE_UARTB_DBG 0x17c |
| 211 | #define CLK_SOURCE_UARTC_DBG 0x1a0 |
| 212 | #define CLK_SOURCE_UARTD_DBG 0x1c0 |
| 213 | #define CLK_SOURCE_UARTE_DBG 0x1c4 |
| 214 | #define CLK_SOURCE_3D 0x158 |
| 215 | #define CLK_SOURCE_2D 0x15c |
| 216 | #define CLK_SOURCE_VI_SENSOR 0x1a8 |
| 217 | #define CLK_SOURCE_VI 0x148 |
| 218 | #define CLK_SOURCE_EPP 0x16c |
| 219 | #define CLK_SOURCE_MSENC 0x1f0 |
| 220 | #define CLK_SOURCE_TSEC 0x1f4 |
| 221 | #define CLK_SOURCE_HOST1X 0x180 |
| 222 | #define CLK_SOURCE_HDMI 0x18c |
| 223 | #define CLK_SOURCE_DISP1 0x138 |
| 224 | #define CLK_SOURCE_DISP2 0x13c |
| 225 | #define CLK_SOURCE_CILAB 0x614 |
| 226 | #define CLK_SOURCE_CILCD 0x618 |
| 227 | #define CLK_SOURCE_CILE 0x61c |
| 228 | #define CLK_SOURCE_DSIALP 0x620 |
| 229 | #define CLK_SOURCE_DSIBLP 0x624 |
| 230 | #define CLK_SOURCE_TSENSOR 0x3b8 |
| 231 | #define CLK_SOURCE_D_AUDIO 0x3d0 |
| 232 | #define CLK_SOURCE_DAM0 0x3d8 |
| 233 | #define CLK_SOURCE_DAM1 0x3dc |
| 234 | #define CLK_SOURCE_DAM2 0x3e0 |
| 235 | #define CLK_SOURCE_ACTMON 0x3e8 |
| 236 | #define CLK_SOURCE_EXTERN1 0x3ec |
| 237 | #define CLK_SOURCE_EXTERN2 0x3f0 |
| 238 | #define CLK_SOURCE_EXTERN3 0x3f4 |
| 239 | #define CLK_SOURCE_I2CSLOW 0x3fc |
| 240 | #define CLK_SOURCE_SE 0x42c |
| 241 | #define CLK_SOURCE_MSELECT 0x3b4 |
Paul Walmsley | 9e60121 | 2013-06-07 06:19:01 -0600 | [diff] [blame] | 242 | #define CLK_SOURCE_DFLL_REF 0x62c |
| 243 | #define CLK_SOURCE_DFLL_SOC 0x630 |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 244 | #define CLK_SOURCE_SOC_THERM 0x644 |
| 245 | #define CLK_SOURCE_XUSB_HOST_SRC 0x600 |
| 246 | #define CLK_SOURCE_XUSB_FALCON_SRC 0x604 |
| 247 | #define CLK_SOURCE_XUSB_FS_SRC 0x608 |
| 248 | #define CLK_SOURCE_XUSB_SS_SRC 0x610 |
| 249 | #define CLK_SOURCE_XUSB_DEV_SRC 0x60c |
| 250 | #define CLK_SOURCE_EMC 0x19c |
| 251 | |
Peter De Schrijver | d53442e | 2013-06-06 13:47:29 +0300 | [diff] [blame] | 252 | /* PLLM override registers */ |
| 253 | #define PMC_PLLM_WB0_OVERRIDE 0x1dc |
| 254 | #define PMC_PLLM_WB0_OVERRIDE_2 0x2b0 |
| 255 | |
Joseph Lo | 31972fd | 2013-05-20 18:39:28 +0800 | [diff] [blame] | 256 | /* Tegra CPU clock and reset control regs */ |
| 257 | #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470 |
| 258 | |
Joseph Lo | ad7d114 | 2013-07-03 17:50:44 +0800 | [diff] [blame] | 259 | #ifdef CONFIG_PM_SLEEP |
| 260 | static struct cpu_clk_suspend_context { |
| 261 | u32 clk_csite_src; |
Joseph Lo | 0017f44 | 2013-08-12 17:40:02 +0800 | [diff] [blame] | 262 | u32 cclkg_burst; |
| 263 | u32 cclkg_divider; |
Joseph Lo | ad7d114 | 2013-07-03 17:50:44 +0800 | [diff] [blame] | 264 | } tegra114_cpu_clk_sctx; |
| 265 | #endif |
| 266 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 267 | static void __iomem *clk_base; |
| 268 | static void __iomem *pmc_base; |
| 269 | |
| 270 | static DEFINE_SPINLOCK(pll_d_lock); |
| 271 | static DEFINE_SPINLOCK(pll_d2_lock); |
| 272 | static DEFINE_SPINLOCK(pll_u_lock); |
| 273 | static DEFINE_SPINLOCK(pll_div_lock); |
| 274 | static DEFINE_SPINLOCK(pll_re_lock); |
| 275 | static DEFINE_SPINLOCK(clk_doubler_lock); |
| 276 | static DEFINE_SPINLOCK(clk_out_lock); |
| 277 | static DEFINE_SPINLOCK(sysrate_lock); |
| 278 | |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 279 | static struct div_nmp pllxc_nmp = { |
| 280 | .divm_shift = 0, |
| 281 | .divm_width = 8, |
| 282 | .divn_shift = 8, |
| 283 | .divn_width = 8, |
| 284 | .divp_shift = 20, |
| 285 | .divp_width = 4, |
| 286 | }; |
| 287 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 288 | static struct pdiv_map pllxc_p[] = { |
| 289 | { .pdiv = 1, .hw_val = 0 }, |
| 290 | { .pdiv = 2, .hw_val = 1 }, |
| 291 | { .pdiv = 3, .hw_val = 2 }, |
| 292 | { .pdiv = 4, .hw_val = 3 }, |
| 293 | { .pdiv = 5, .hw_val = 4 }, |
| 294 | { .pdiv = 6, .hw_val = 5 }, |
| 295 | { .pdiv = 8, .hw_val = 6 }, |
| 296 | { .pdiv = 10, .hw_val = 7 }, |
| 297 | { .pdiv = 12, .hw_val = 8 }, |
| 298 | { .pdiv = 16, .hw_val = 9 }, |
| 299 | { .pdiv = 12, .hw_val = 10 }, |
| 300 | { .pdiv = 16, .hw_val = 11 }, |
| 301 | { .pdiv = 20, .hw_val = 12 }, |
| 302 | { .pdiv = 24, .hw_val = 13 }, |
| 303 | { .pdiv = 32, .hw_val = 14 }, |
| 304 | { .pdiv = 0, .hw_val = 0 }, |
| 305 | }; |
| 306 | |
| 307 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { |
| 308 | { 12000000, 624000000, 104, 0, 2}, |
| 309 | { 12000000, 600000000, 100, 0, 2}, |
| 310 | { 13000000, 600000000, 92, 0, 2}, /* actual: 598.0 MHz */ |
| 311 | { 16800000, 600000000, 71, 0, 2}, /* actual: 596.4 MHz */ |
| 312 | { 19200000, 600000000, 62, 0, 2}, /* actual: 595.2 MHz */ |
| 313 | { 26000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */ |
| 314 | { 0, 0, 0, 0, 0, 0 }, |
| 315 | }; |
| 316 | |
| 317 | static struct tegra_clk_pll_params pll_c_params = { |
| 318 | .input_min = 12000000, |
| 319 | .input_max = 800000000, |
| 320 | .cf_min = 12000000, |
| 321 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ |
| 322 | .vco_min = 600000000, |
| 323 | .vco_max = 1400000000, |
| 324 | .base_reg = PLLC_BASE, |
| 325 | .misc_reg = PLLC_MISC, |
| 326 | .lock_mask = PLL_BASE_LOCK, |
| 327 | .lock_enable_bit_idx = PLLC_MISC_LOCK_ENABLE, |
| 328 | .lock_delay = 300, |
| 329 | .iddq_reg = PLLC_MISC, |
| 330 | .iddq_bit_idx = PLLC_IDDQ_BIT, |
| 331 | .max_p = PLLXC_SW_MAX_P, |
| 332 | .dyn_ramp_reg = PLLC_MISC2, |
| 333 | .stepa_shift = 17, |
| 334 | .stepb_shift = 9, |
| 335 | .pdiv_tohw = pllxc_p, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 336 | .div_nmp = &pllxc_nmp, |
| 337 | }; |
| 338 | |
| 339 | static struct div_nmp pllcx_nmp = { |
| 340 | .divm_shift = 0, |
| 341 | .divm_width = 2, |
| 342 | .divn_shift = 8, |
| 343 | .divn_width = 8, |
| 344 | .divp_shift = 20, |
| 345 | .divp_width = 3, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 346 | }; |
| 347 | |
| 348 | static struct pdiv_map pllc_p[] = { |
| 349 | { .pdiv = 1, .hw_val = 0 }, |
| 350 | { .pdiv = 2, .hw_val = 1 }, |
| 351 | { .pdiv = 4, .hw_val = 3 }, |
| 352 | { .pdiv = 8, .hw_val = 5 }, |
| 353 | { .pdiv = 16, .hw_val = 7 }, |
| 354 | { .pdiv = 0, .hw_val = 0 }, |
| 355 | }; |
| 356 | |
| 357 | static struct tegra_clk_pll_freq_table pll_cx_freq_table[] = { |
| 358 | {12000000, 600000000, 100, 0, 2}, |
| 359 | {13000000, 600000000, 92, 0, 2}, /* actual: 598.0 MHz */ |
| 360 | {16800000, 600000000, 71, 0, 2}, /* actual: 596.4 MHz */ |
| 361 | {19200000, 600000000, 62, 0, 2}, /* actual: 595.2 MHz */ |
| 362 | {26000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */ |
| 363 | {0, 0, 0, 0, 0, 0}, |
| 364 | }; |
| 365 | |
| 366 | static struct tegra_clk_pll_params pll_c2_params = { |
| 367 | .input_min = 12000000, |
| 368 | .input_max = 48000000, |
| 369 | .cf_min = 12000000, |
| 370 | .cf_max = 19200000, |
| 371 | .vco_min = 600000000, |
| 372 | .vco_max = 1200000000, |
| 373 | .base_reg = PLLC2_BASE, |
| 374 | .misc_reg = PLLC2_MISC, |
| 375 | .lock_mask = PLL_BASE_LOCK, |
| 376 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
| 377 | .lock_delay = 300, |
| 378 | .pdiv_tohw = pllc_p, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 379 | .div_nmp = &pllcx_nmp, |
| 380 | .max_p = 7, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 381 | .ext_misc_reg[0] = 0x4f0, |
| 382 | .ext_misc_reg[1] = 0x4f4, |
| 383 | .ext_misc_reg[2] = 0x4f8, |
| 384 | }; |
| 385 | |
| 386 | static struct tegra_clk_pll_params pll_c3_params = { |
| 387 | .input_min = 12000000, |
| 388 | .input_max = 48000000, |
| 389 | .cf_min = 12000000, |
| 390 | .cf_max = 19200000, |
| 391 | .vco_min = 600000000, |
| 392 | .vco_max = 1200000000, |
| 393 | .base_reg = PLLC3_BASE, |
| 394 | .misc_reg = PLLC3_MISC, |
| 395 | .lock_mask = PLL_BASE_LOCK, |
| 396 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
| 397 | .lock_delay = 300, |
| 398 | .pdiv_tohw = pllc_p, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 399 | .div_nmp = &pllcx_nmp, |
| 400 | .max_p = 7, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 401 | .ext_misc_reg[0] = 0x504, |
| 402 | .ext_misc_reg[1] = 0x508, |
| 403 | .ext_misc_reg[2] = 0x50c, |
| 404 | }; |
| 405 | |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 406 | static struct div_nmp pllm_nmp = { |
| 407 | .divm_shift = 0, |
| 408 | .divm_width = 8, |
Peter De Schrijver | d53442e | 2013-06-06 13:47:29 +0300 | [diff] [blame] | 409 | .override_divm_shift = 0, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 410 | .divn_shift = 8, |
| 411 | .divn_width = 8, |
Peter De Schrijver | d53442e | 2013-06-06 13:47:29 +0300 | [diff] [blame] | 412 | .override_divn_shift = 8, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 413 | .divp_shift = 20, |
| 414 | .divp_width = 1, |
Peter De Schrijver | d53442e | 2013-06-06 13:47:29 +0300 | [diff] [blame] | 415 | .override_divp_shift = 27, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 416 | }; |
| 417 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 418 | static struct pdiv_map pllm_p[] = { |
| 419 | { .pdiv = 1, .hw_val = 0 }, |
| 420 | { .pdiv = 2, .hw_val = 1 }, |
| 421 | { .pdiv = 0, .hw_val = 0 }, |
| 422 | }; |
| 423 | |
| 424 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { |
| 425 | {12000000, 800000000, 66, 0, 1}, /* actual: 792.0 MHz */ |
| 426 | {13000000, 800000000, 61, 0, 1}, /* actual: 793.0 MHz */ |
| 427 | {16800000, 800000000, 47, 0, 1}, /* actual: 789.6 MHz */ |
| 428 | {19200000, 800000000, 41, 0, 1}, /* actual: 787.2 MHz */ |
| 429 | {26000000, 800000000, 61, 1, 1}, /* actual: 793.0 MHz */ |
| 430 | {0, 0, 0, 0, 0, 0}, |
| 431 | }; |
| 432 | |
| 433 | static struct tegra_clk_pll_params pll_m_params = { |
| 434 | .input_min = 12000000, |
| 435 | .input_max = 500000000, |
| 436 | .cf_min = 12000000, |
| 437 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ |
| 438 | .vco_min = 400000000, |
| 439 | .vco_max = 1066000000, |
| 440 | .base_reg = PLLM_BASE, |
| 441 | .misc_reg = PLLM_MISC, |
| 442 | .lock_mask = PLL_BASE_LOCK, |
| 443 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
| 444 | .lock_delay = 300, |
| 445 | .max_p = 2, |
| 446 | .pdiv_tohw = pllm_p, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 447 | .div_nmp = &pllm_nmp, |
Peter De Schrijver | d53442e | 2013-06-06 13:47:29 +0300 | [diff] [blame] | 448 | .pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE, |
| 449 | .pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE_2, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 450 | }; |
| 451 | |
| 452 | static struct div_nmp pllp_nmp = { |
| 453 | .divm_shift = 0, |
| 454 | .divm_width = 5, |
| 455 | .divn_shift = 8, |
| 456 | .divn_width = 10, |
| 457 | .divp_shift = 20, |
| 458 | .divp_width = 3, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 459 | }; |
| 460 | |
| 461 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { |
| 462 | {12000000, 216000000, 432, 12, 1, 8}, |
| 463 | {13000000, 216000000, 432, 13, 1, 8}, |
| 464 | {16800000, 216000000, 360, 14, 1, 8}, |
| 465 | {19200000, 216000000, 360, 16, 1, 8}, |
| 466 | {26000000, 216000000, 432, 26, 1, 8}, |
| 467 | {0, 0, 0, 0, 0, 0}, |
| 468 | }; |
| 469 | |
| 470 | static struct tegra_clk_pll_params pll_p_params = { |
| 471 | .input_min = 2000000, |
| 472 | .input_max = 31000000, |
| 473 | .cf_min = 1000000, |
| 474 | .cf_max = 6000000, |
| 475 | .vco_min = 200000000, |
| 476 | .vco_max = 700000000, |
| 477 | .base_reg = PLLP_BASE, |
| 478 | .misc_reg = PLLP_MISC, |
| 479 | .lock_mask = PLL_BASE_LOCK, |
| 480 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
| 481 | .lock_delay = 300, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 482 | .div_nmp = &pllp_nmp, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 483 | }; |
| 484 | |
| 485 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { |
| 486 | {9600000, 282240000, 147, 5, 0, 4}, |
| 487 | {9600000, 368640000, 192, 5, 0, 4}, |
| 488 | {9600000, 240000000, 200, 8, 0, 8}, |
| 489 | |
| 490 | {28800000, 282240000, 245, 25, 0, 8}, |
| 491 | {28800000, 368640000, 320, 25, 0, 8}, |
| 492 | {28800000, 240000000, 200, 24, 0, 8}, |
| 493 | {0, 0, 0, 0, 0, 0}, |
| 494 | }; |
| 495 | |
| 496 | |
| 497 | static struct tegra_clk_pll_params pll_a_params = { |
| 498 | .input_min = 2000000, |
| 499 | .input_max = 31000000, |
| 500 | .cf_min = 1000000, |
| 501 | .cf_max = 6000000, |
| 502 | .vco_min = 200000000, |
| 503 | .vco_max = 700000000, |
| 504 | .base_reg = PLLA_BASE, |
| 505 | .misc_reg = PLLA_MISC, |
| 506 | .lock_mask = PLL_BASE_LOCK, |
| 507 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
| 508 | .lock_delay = 300, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 509 | .div_nmp = &pllp_nmp, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 510 | }; |
| 511 | |
| 512 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { |
| 513 | {12000000, 216000000, 864, 12, 2, 12}, |
| 514 | {13000000, 216000000, 864, 13, 2, 12}, |
| 515 | {16800000, 216000000, 720, 14, 2, 12}, |
| 516 | {19200000, 216000000, 720, 16, 2, 12}, |
| 517 | {26000000, 216000000, 864, 26, 2, 12}, |
| 518 | |
| 519 | {12000000, 594000000, 594, 12, 0, 12}, |
| 520 | {13000000, 594000000, 594, 13, 0, 12}, |
| 521 | {16800000, 594000000, 495, 14, 0, 12}, |
| 522 | {19200000, 594000000, 495, 16, 0, 12}, |
| 523 | {26000000, 594000000, 594, 26, 0, 12}, |
| 524 | |
| 525 | {12000000, 1000000000, 1000, 12, 0, 12}, |
| 526 | {13000000, 1000000000, 1000, 13, 0, 12}, |
| 527 | {19200000, 1000000000, 625, 12, 0, 12}, |
| 528 | {26000000, 1000000000, 1000, 26, 0, 12}, |
| 529 | |
| 530 | {0, 0, 0, 0, 0, 0}, |
| 531 | }; |
| 532 | |
| 533 | static struct tegra_clk_pll_params pll_d_params = { |
| 534 | .input_min = 2000000, |
| 535 | .input_max = 40000000, |
| 536 | .cf_min = 1000000, |
| 537 | .cf_max = 6000000, |
| 538 | .vco_min = 500000000, |
| 539 | .vco_max = 1000000000, |
| 540 | .base_reg = PLLD_BASE, |
| 541 | .misc_reg = PLLD_MISC, |
| 542 | .lock_mask = PLL_BASE_LOCK, |
| 543 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
| 544 | .lock_delay = 1000, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 545 | .div_nmp = &pllp_nmp, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 546 | }; |
| 547 | |
| 548 | static struct tegra_clk_pll_params pll_d2_params = { |
| 549 | .input_min = 2000000, |
| 550 | .input_max = 40000000, |
| 551 | .cf_min = 1000000, |
| 552 | .cf_max = 6000000, |
| 553 | .vco_min = 500000000, |
| 554 | .vco_max = 1000000000, |
| 555 | .base_reg = PLLD2_BASE, |
| 556 | .misc_reg = PLLD2_MISC, |
| 557 | .lock_mask = PLL_BASE_LOCK, |
| 558 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
| 559 | .lock_delay = 1000, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 560 | .div_nmp = &pllp_nmp, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 561 | }; |
| 562 | |
| 563 | static struct pdiv_map pllu_p[] = { |
| 564 | { .pdiv = 1, .hw_val = 1 }, |
| 565 | { .pdiv = 2, .hw_val = 0 }, |
| 566 | { .pdiv = 0, .hw_val = 0 }, |
| 567 | }; |
| 568 | |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 569 | static struct div_nmp pllu_nmp = { |
| 570 | .divm_shift = 0, |
| 571 | .divm_width = 5, |
| 572 | .divn_shift = 8, |
| 573 | .divn_width = 10, |
| 574 | .divp_shift = 20, |
| 575 | .divp_width = 1, |
| 576 | }; |
| 577 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 578 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { |
| 579 | {12000000, 480000000, 960, 12, 0, 12}, |
| 580 | {13000000, 480000000, 960, 13, 0, 12}, |
| 581 | {16800000, 480000000, 400, 7, 0, 5}, |
| 582 | {19200000, 480000000, 200, 4, 0, 3}, |
| 583 | {26000000, 480000000, 960, 26, 0, 12}, |
| 584 | {0, 0, 0, 0, 0, 0}, |
| 585 | }; |
| 586 | |
| 587 | static struct tegra_clk_pll_params pll_u_params = { |
| 588 | .input_min = 2000000, |
| 589 | .input_max = 40000000, |
| 590 | .cf_min = 1000000, |
| 591 | .cf_max = 6000000, |
| 592 | .vco_min = 480000000, |
| 593 | .vco_max = 960000000, |
| 594 | .base_reg = PLLU_BASE, |
| 595 | .misc_reg = PLLU_MISC, |
| 596 | .lock_mask = PLL_BASE_LOCK, |
| 597 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
| 598 | .lock_delay = 1000, |
| 599 | .pdiv_tohw = pllu_p, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 600 | .div_nmp = &pllu_nmp, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 601 | }; |
| 602 | |
| 603 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { |
| 604 | /* 1 GHz */ |
| 605 | {12000000, 1000000000, 83, 0, 1}, /* actual: 996.0 MHz */ |
| 606 | {13000000, 1000000000, 76, 0, 1}, /* actual: 988.0 MHz */ |
| 607 | {16800000, 1000000000, 59, 0, 1}, /* actual: 991.2 MHz */ |
| 608 | {19200000, 1000000000, 52, 0, 1}, /* actual: 998.4 MHz */ |
| 609 | {26000000, 1000000000, 76, 1, 1}, /* actual: 988.0 MHz */ |
| 610 | |
| 611 | {0, 0, 0, 0, 0, 0}, |
| 612 | }; |
| 613 | |
| 614 | static struct tegra_clk_pll_params pll_x_params = { |
| 615 | .input_min = 12000000, |
| 616 | .input_max = 800000000, |
| 617 | .cf_min = 12000000, |
| 618 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ |
| 619 | .vco_min = 700000000, |
| 620 | .vco_max = 2400000000U, |
| 621 | .base_reg = PLLX_BASE, |
| 622 | .misc_reg = PLLX_MISC, |
| 623 | .lock_mask = PLL_BASE_LOCK, |
| 624 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
| 625 | .lock_delay = 300, |
| 626 | .iddq_reg = PLLX_MISC3, |
| 627 | .iddq_bit_idx = PLLX_IDDQ_BIT, |
| 628 | .max_p = PLLXC_SW_MAX_P, |
| 629 | .dyn_ramp_reg = PLLX_MISC2, |
| 630 | .stepa_shift = 16, |
| 631 | .stepb_shift = 24, |
| 632 | .pdiv_tohw = pllxc_p, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 633 | .div_nmp = &pllxc_nmp, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 634 | }; |
| 635 | |
| 636 | static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { |
| 637 | /* PLLE special case: use cpcon field to store cml divider value */ |
| 638 | {336000000, 100000000, 100, 21, 16, 11}, |
| 639 | {312000000, 100000000, 200, 26, 24, 13}, |
| 640 | {0, 0, 0, 0, 0, 0}, |
| 641 | }; |
| 642 | |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 643 | static struct div_nmp plle_nmp = { |
| 644 | .divm_shift = 0, |
| 645 | .divm_width = 8, |
| 646 | .divn_shift = 8, |
| 647 | .divn_width = 8, |
| 648 | .divp_shift = 24, |
| 649 | .divp_width = 4, |
| 650 | }; |
| 651 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 652 | static struct tegra_clk_pll_params pll_e_params = { |
| 653 | .input_min = 12000000, |
| 654 | .input_max = 1000000000, |
| 655 | .cf_min = 12000000, |
| 656 | .cf_max = 75000000, |
| 657 | .vco_min = 1600000000, |
| 658 | .vco_max = 2400000000U, |
| 659 | .base_reg = PLLE_BASE, |
| 660 | .misc_reg = PLLE_MISC, |
| 661 | .aux_reg = PLLE_AUX, |
| 662 | .lock_mask = PLLE_MISC_LOCK, |
| 663 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, |
| 664 | .lock_delay = 300, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 665 | .div_nmp = &plle_nmp, |
| 666 | }; |
| 667 | |
| 668 | static struct div_nmp pllre_nmp = { |
| 669 | .divm_shift = 0, |
| 670 | .divm_width = 8, |
| 671 | .divn_shift = 8, |
| 672 | .divn_width = 8, |
| 673 | .divp_shift = 16, |
| 674 | .divp_width = 4, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 675 | }; |
| 676 | |
| 677 | static struct tegra_clk_pll_params pll_re_vco_params = { |
| 678 | .input_min = 12000000, |
| 679 | .input_max = 1000000000, |
| 680 | .cf_min = 12000000, |
| 681 | .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */ |
| 682 | .vco_min = 300000000, |
| 683 | .vco_max = 600000000, |
| 684 | .base_reg = PLLRE_BASE, |
| 685 | .misc_reg = PLLRE_MISC, |
| 686 | .lock_mask = PLLRE_MISC_LOCK, |
| 687 | .lock_enable_bit_idx = PLLRE_MISC_LOCK_ENABLE, |
| 688 | .lock_delay = 300, |
| 689 | .iddq_reg = PLLRE_MISC, |
| 690 | .iddq_bit_idx = PLLRE_IDDQ_BIT, |
Peter De Schrijver | fd428ad | 2013-06-05 16:51:26 +0300 | [diff] [blame] | 691 | .div_nmp = &pllre_nmp, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 692 | }; |
| 693 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 694 | /* possible OSC frequencies in Hz */ |
| 695 | static unsigned long tegra114_input_freq[] = { |
| 696 | [0] = 13000000, |
| 697 | [1] = 16800000, |
| 698 | [4] = 19200000, |
| 699 | [5] = 38400000, |
| 700 | [8] = 12000000, |
| 701 | [9] = 48000000, |
| 702 | [12] = 260000000, |
| 703 | }; |
| 704 | |
| 705 | #define MASK(x) (BIT(x) - 1) |
| 706 | |
| 707 | #define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 708 | _clk_num, _gate_flags, _clk_id) \ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 709 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | 252d0d2 | 2013-11-26 13:48:09 +0200 | [diff] [blame] | 710 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, \ |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 711 | _clk_num, _gate_flags, _clk_id, _parents##_idx, 0) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 712 | |
| 713 | #define TEGRA_INIT_DATA_MUX_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 714 | _clk_num, _gate_flags, _clk_id, flags)\ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 715 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | 252d0d2 | 2013-11-26 13:48:09 +0200 | [diff] [blame] | 716 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\ |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 717 | _clk_num, _gate_flags, _clk_id, _parents##_idx, flags) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 718 | |
| 719 | #define TEGRA_INIT_DATA_MUX8(_name, _con_id, _dev_id, _parents, _offset, \ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 720 | _clk_num, _gate_flags, _clk_id) \ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 721 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | 252d0d2 | 2013-11-26 13:48:09 +0200 | [diff] [blame] | 722 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\ |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 723 | _clk_num, _gate_flags, _clk_id, _parents##_idx, 0) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 724 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 725 | #define TEGRA_INIT_DATA_INT_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 726 | _clk_num, _gate_flags, _clk_id, flags)\ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 727 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | 252d0d2 | 2013-11-26 13:48:09 +0200 | [diff] [blame] | 728 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT | \ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 729 | TEGRA_DIVIDER_ROUND_UP, _clk_num, \ |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 730 | _gate_flags, _clk_id, _parents##_idx, flags) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 731 | |
| 732 | #define TEGRA_INIT_DATA_INT8(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 733 | _clk_num, _gate_flags, _clk_id) \ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 734 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | 252d0d2 | 2013-11-26 13:48:09 +0200 | [diff] [blame] | 735 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT | \ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 736 | TEGRA_DIVIDER_ROUND_UP, _clk_num, \ |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 737 | _gate_flags, _clk_id, _parents##_idx, 0) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 738 | |
| 739 | #define TEGRA_INIT_DATA_UART(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 740 | _clk_num, _clk_id) \ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 741 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | 252d0d2 | 2013-11-26 13:48:09 +0200 | [diff] [blame] | 742 | 30, MASK(2), 0, 0, 16, 1, TEGRA_DIVIDER_UART | \ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 743 | TEGRA_DIVIDER_ROUND_UP, _clk_num, \ |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 744 | 0, _clk_id, _parents##_idx, 0) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 745 | |
| 746 | #define TEGRA_INIT_DATA_I2C(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 747 | _clk_num, _clk_id) \ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 748 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | 252d0d2 | 2013-11-26 13:48:09 +0200 | [diff] [blame] | 749 | 30, MASK(2), 0, 0, 16, 0, TEGRA_DIVIDER_ROUND_UP,\ |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 750 | _clk_num, 0, _clk_id, _parents##_idx, 0) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 751 | |
| 752 | #define TEGRA_INIT_DATA_NODIV(_name, _con_id, _dev_id, _parents, _offset, \ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 753 | _mux_shift, _mux_mask, _clk_num, \ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 754 | _gate_flags, _clk_id) \ |
| 755 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 756 | _mux_shift, _mux_mask, 0, 0, 0, 0, 0,\ |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 757 | _clk_num, _gate_flags, \ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 758 | _clk_id, _parents##_idx, 0) |
| 759 | |
| 760 | #define TEGRA_INIT_DATA_XUSB(_name, _con_id, _dev_id, _parents, _offset, \ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 761 | _clk_num, _gate_flags, _clk_id) \ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 762 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset, \ |
Peter De Schrijver | 252d0d2 | 2013-11-26 13:48:09 +0200 | [diff] [blame] | 763 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT | \ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 764 | TEGRA_DIVIDER_ROUND_UP, _clk_num, \ |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 765 | _gate_flags, _clk_id, _parents##_idx, 0) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 766 | |
| 767 | #define TEGRA_INIT_DATA_AUDIO(_name, _con_id, _dev_id, _offset, _clk_num,\ |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 768 | _gate_flags, _clk_id) \ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 769 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, mux_d_audio_clk, \ |
Peter De Schrijver | 252d0d2 | 2013-11-26 13:48:09 +0200 | [diff] [blame] | 770 | _offset, 16, 0xE01F, 0, 0, 8, 1, \ |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 771 | TEGRA_DIVIDER_ROUND_UP, _clk_num, \ |
| 772 | _gate_flags , _clk_id, mux_d_audio_clk_idx, 0) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 773 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 774 | struct utmi_clk_param { |
| 775 | /* Oscillator Frequency in KHz */ |
| 776 | u32 osc_frequency; |
| 777 | /* UTMIP PLL Enable Delay Count */ |
| 778 | u8 enable_delay_count; |
| 779 | /* UTMIP PLL Stable count */ |
| 780 | u8 stable_count; |
| 781 | /* UTMIP PLL Active delay count */ |
| 782 | u8 active_delay_count; |
| 783 | /* UTMIP PLL Xtal frequency count */ |
| 784 | u8 xtal_freq_count; |
| 785 | }; |
| 786 | |
| 787 | static const struct utmi_clk_param utmi_parameters[] = { |
| 788 | {.osc_frequency = 13000000, .enable_delay_count = 0x02, |
| 789 | .stable_count = 0x33, .active_delay_count = 0x05, |
| 790 | .xtal_freq_count = 0x7F}, |
| 791 | {.osc_frequency = 19200000, .enable_delay_count = 0x03, |
| 792 | .stable_count = 0x4B, .active_delay_count = 0x06, |
| 793 | .xtal_freq_count = 0xBB}, |
| 794 | {.osc_frequency = 12000000, .enable_delay_count = 0x02, |
| 795 | .stable_count = 0x2F, .active_delay_count = 0x04, |
| 796 | .xtal_freq_count = 0x76}, |
| 797 | {.osc_frequency = 26000000, .enable_delay_count = 0x04, |
| 798 | .stable_count = 0x66, .active_delay_count = 0x09, |
| 799 | .xtal_freq_count = 0xFE}, |
| 800 | {.osc_frequency = 16800000, .enable_delay_count = 0x03, |
| 801 | .stable_count = 0x41, .active_delay_count = 0x0A, |
| 802 | .xtal_freq_count = 0xA4}, |
| 803 | }; |
| 804 | |
| 805 | /* peripheral mux definitions */ |
| 806 | |
| 807 | #define MUX_I2S_SPDIF(_id) \ |
| 808 | static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \ |
| 809 | #_id, "pll_p",\ |
| 810 | "clk_m"}; |
| 811 | MUX_I2S_SPDIF(audio0) |
| 812 | MUX_I2S_SPDIF(audio1) |
| 813 | MUX_I2S_SPDIF(audio2) |
| 814 | MUX_I2S_SPDIF(audio3) |
| 815 | MUX_I2S_SPDIF(audio4) |
| 816 | MUX_I2S_SPDIF(audio) |
| 817 | |
| 818 | #define mux_pllaout0_audio0_2x_pllp_clkm_idx NULL |
| 819 | #define mux_pllaout0_audio1_2x_pllp_clkm_idx NULL |
| 820 | #define mux_pllaout0_audio2_2x_pllp_clkm_idx NULL |
| 821 | #define mux_pllaout0_audio3_2x_pllp_clkm_idx NULL |
| 822 | #define mux_pllaout0_audio4_2x_pllp_clkm_idx NULL |
| 823 | #define mux_pllaout0_audio_2x_pllp_clkm_idx NULL |
| 824 | |
| 825 | static const char *mux_pllp_pllc_pllm_clkm[] = { |
| 826 | "pll_p", "pll_c", "pll_m", "clk_m" |
| 827 | }; |
| 828 | #define mux_pllp_pllc_pllm_clkm_idx NULL |
| 829 | |
| 830 | static const char *mux_pllp_pllc_pllm[] = { "pll_p", "pll_c", "pll_m" }; |
| 831 | #define mux_pllp_pllc_pllm_idx NULL |
| 832 | |
| 833 | static const char *mux_pllp_pllc_clk32_clkm[] = { |
| 834 | "pll_p", "pll_c", "clk_32k", "clk_m" |
| 835 | }; |
| 836 | #define mux_pllp_pllc_clk32_clkm_idx NULL |
| 837 | |
| 838 | static const char *mux_plla_pllc_pllp_clkm[] = { |
| 839 | "pll_a_out0", "pll_c", "pll_p", "clk_m" |
| 840 | }; |
| 841 | #define mux_plla_pllc_pllp_clkm_idx mux_pllp_pllc_pllm_clkm_idx |
| 842 | |
| 843 | static const char *mux_pllp_pllc2_c_c3_pllm_clkm[] = { |
| 844 | "pll_p", "pll_c2", "pll_c", "pll_c3", "pll_m", "clk_m" |
| 845 | }; |
| 846 | static u32 mux_pllp_pllc2_c_c3_pllm_clkm_idx[] = { |
| 847 | [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, |
| 848 | }; |
| 849 | |
| 850 | static const char *mux_pllp_clkm[] = { |
| 851 | "pll_p", "clk_m" |
| 852 | }; |
| 853 | static u32 mux_pllp_clkm_idx[] = { |
| 854 | [0] = 0, [1] = 3, |
| 855 | }; |
| 856 | |
| 857 | static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = { |
| 858 | "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0" |
| 859 | }; |
| 860 | #define mux_pllm_pllc2_c_c3_pllp_plla_idx mux_pllp_pllc2_c_c3_pllm_clkm_idx |
| 861 | |
| 862 | static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = { |
| 863 | "pll_p", "pll_m", "pll_d_out0", "pll_a_out0", "pll_c", |
| 864 | "pll_d2_out0", "clk_m" |
| 865 | }; |
| 866 | #define mux_pllp_pllm_plld_plla_pllc_plld2_clkm_idx NULL |
| 867 | |
| 868 | static const char *mux_pllm_pllc_pllp_plla[] = { |
| 869 | "pll_m", "pll_c", "pll_p", "pll_a_out0" |
| 870 | }; |
| 871 | #define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx |
| 872 | |
| 873 | static const char *mux_pllp_pllc_clkm[] = { |
| 874 | "pll_p", "pll_c", "pll_m" |
| 875 | }; |
| 876 | static u32 mux_pllp_pllc_clkm_idx[] = { |
| 877 | [0] = 0, [1] = 1, [2] = 3, |
| 878 | }; |
| 879 | |
| 880 | static const char *mux_pllp_pllc_clkm_clk32[] = { |
| 881 | "pll_p", "pll_c", "clk_m", "clk_32k" |
| 882 | }; |
| 883 | #define mux_pllp_pllc_clkm_clk32_idx NULL |
| 884 | |
| 885 | static const char *mux_plla_clk32_pllp_clkm_plle[] = { |
| 886 | "pll_a_out0", "clk_32k", "pll_p", "clk_m", "pll_e_out0" |
| 887 | }; |
| 888 | #define mux_plla_clk32_pllp_clkm_plle_idx NULL |
| 889 | |
| 890 | static const char *mux_clkm_pllp_pllc_pllre[] = { |
| 891 | "clk_m", "pll_p", "pll_c", "pll_re_out" |
| 892 | }; |
| 893 | static u32 mux_clkm_pllp_pllc_pllre_idx[] = { |
| 894 | [0] = 0, [1] = 1, [2] = 3, [3] = 5, |
| 895 | }; |
| 896 | |
| 897 | static const char *mux_clkm_48M_pllp_480M[] = { |
| 898 | "clk_m", "pll_u_48M", "pll_p", "pll_u_480M" |
| 899 | }; |
| 900 | #define mux_clkm_48M_pllp_480M_idx NULL |
| 901 | |
| 902 | static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = { |
| 903 | "clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref" |
| 904 | }; |
| 905 | static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = { |
| 906 | [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7, |
| 907 | }; |
| 908 | |
| 909 | static const char *mux_plld_out0_plld2_out0[] = { |
| 910 | "pll_d_out0", "pll_d2_out0", |
| 911 | }; |
| 912 | #define mux_plld_out0_plld2_out0_idx NULL |
| 913 | |
| 914 | static const char *mux_d_audio_clk[] = { |
| 915 | "pll_a_out0", "pll_p", "clk_m", "spdif_in_sync", "i2s0_sync", |
| 916 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", |
| 917 | }; |
| 918 | static u32 mux_d_audio_clk_idx[] = { |
| 919 | [0] = 0, [1] = 0x8000, [2] = 0xc000, [3] = 0xE000, [4] = 0xE001, |
| 920 | [5] = 0xE002, [6] = 0xE003, [7] = 0xE004, [8] = 0xE005, [9] = 0xE007, |
| 921 | }; |
| 922 | |
| 923 | static const char *mux_pllmcp_clkm[] = { |
| 924 | "pll_m_out0", "pll_c_out0", "pll_p_out0", "clk_m", "pll_m_ud", |
| 925 | }; |
| 926 | |
| 927 | static const struct clk_div_table pll_re_div_table[] = { |
| 928 | { .val = 0, .div = 1 }, |
| 929 | { .val = 1, .div = 2 }, |
| 930 | { .val = 2, .div = 3 }, |
| 931 | { .val = 3, .div = 4 }, |
| 932 | { .val = 4, .div = 5 }, |
| 933 | { .val = 5, .div = 6 }, |
| 934 | { .val = 0, .div = 0 }, |
| 935 | }; |
| 936 | |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 937 | static struct clk **clks; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 938 | |
| 939 | static unsigned long osc_freq; |
| 940 | static unsigned long pll_ref_freq; |
| 941 | |
| 942 | static int __init tegra114_osc_clk_init(void __iomem *clk_base) |
| 943 | { |
| 944 | struct clk *clk; |
| 945 | u32 val, pll_ref_div; |
| 946 | |
| 947 | val = readl_relaxed(clk_base + OSC_CTRL); |
| 948 | |
| 949 | osc_freq = tegra114_input_freq[val >> OSC_CTRL_OSC_FREQ_SHIFT]; |
| 950 | if (!osc_freq) { |
| 951 | WARN_ON(1); |
| 952 | return -EINVAL; |
| 953 | } |
| 954 | |
| 955 | /* clk_m */ |
| 956 | clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT, |
| 957 | osc_freq); |
| 958 | clk_register_clkdev(clk, "clk_m", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 959 | clks[TEGRA114_CLK_CLK_M] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 960 | |
| 961 | /* pll_ref */ |
| 962 | val = (val >> OSC_CTRL_PLL_REF_DIV_SHIFT) & 3; |
| 963 | pll_ref_div = 1 << val; |
| 964 | clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m", |
| 965 | CLK_SET_RATE_PARENT, 1, pll_ref_div); |
| 966 | clk_register_clkdev(clk, "pll_ref", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 967 | clks[TEGRA114_CLK_PLL_REF] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 968 | |
| 969 | pll_ref_freq = osc_freq / pll_ref_div; |
| 970 | |
| 971 | return 0; |
| 972 | } |
| 973 | |
| 974 | static void __init tegra114_fixed_clk_init(void __iomem *clk_base) |
| 975 | { |
| 976 | struct clk *clk; |
| 977 | |
| 978 | /* clk_32k */ |
| 979 | clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT, |
| 980 | 32768); |
| 981 | clk_register_clkdev(clk, "clk_32k", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 982 | clks[TEGRA114_CLK_CLK_32K] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 983 | |
| 984 | /* clk_m_div2 */ |
| 985 | clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m", |
| 986 | CLK_SET_RATE_PARENT, 1, 2); |
| 987 | clk_register_clkdev(clk, "clk_m_div2", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 988 | clks[TEGRA114_CLK_CLK_M_DIV2] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 989 | |
| 990 | /* clk_m_div4 */ |
| 991 | clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m", |
| 992 | CLK_SET_RATE_PARENT, 1, 4); |
| 993 | clk_register_clkdev(clk, "clk_m_div4", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 994 | clks[TEGRA114_CLK_CLK_M_DIV4] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 995 | |
| 996 | } |
| 997 | |
| 998 | static __init void tegra114_utmi_param_configure(void __iomem *clk_base) |
| 999 | { |
| 1000 | u32 reg; |
| 1001 | int i; |
| 1002 | |
| 1003 | for (i = 0; i < ARRAY_SIZE(utmi_parameters); i++) { |
| 1004 | if (osc_freq == utmi_parameters[i].osc_frequency) |
| 1005 | break; |
| 1006 | } |
| 1007 | |
| 1008 | if (i >= ARRAY_SIZE(utmi_parameters)) { |
| 1009 | pr_err("%s: Unexpected oscillator freq %lu\n", __func__, |
| 1010 | osc_freq); |
| 1011 | return; |
| 1012 | } |
| 1013 | |
| 1014 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG2); |
| 1015 | |
| 1016 | /* Program UTMIP PLL stable and active counts */ |
| 1017 | /* [FIXME] arclk_rst.h says WRONG! This should be 1ms -> 0x50 Check! */ |
| 1018 | reg &= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0); |
| 1019 | reg |= UTMIP_PLL_CFG2_STABLE_COUNT(utmi_parameters[i].stable_count); |
| 1020 | |
| 1021 | reg &= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0); |
| 1022 | |
| 1023 | reg |= UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(utmi_parameters[i]. |
| 1024 | active_delay_count); |
| 1025 | |
| 1026 | /* Remove power downs from UTMIP PLL control bits */ |
| 1027 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN; |
| 1028 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN; |
| 1029 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN; |
| 1030 | |
| 1031 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG2); |
| 1032 | |
| 1033 | /* Program UTMIP PLL delay and oscillator frequency counts */ |
| 1034 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1); |
| 1035 | reg &= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0); |
| 1036 | |
| 1037 | reg |= UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(utmi_parameters[i]. |
| 1038 | enable_delay_count); |
| 1039 | |
| 1040 | reg &= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0); |
| 1041 | reg |= UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(utmi_parameters[i]. |
| 1042 | xtal_freq_count); |
| 1043 | |
| 1044 | /* Remove power downs from UTMIP PLL control bits */ |
| 1045 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN; |
| 1046 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN; |
| 1047 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP; |
| 1048 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN; |
| 1049 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1); |
| 1050 | |
| 1051 | /* Setup HW control of UTMIPLL */ |
| 1052 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); |
| 1053 | reg |= UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET; |
| 1054 | reg &= ~UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL; |
| 1055 | reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE; |
| 1056 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); |
| 1057 | |
| 1058 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1); |
| 1059 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP; |
| 1060 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN; |
| 1061 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1); |
| 1062 | |
| 1063 | udelay(1); |
| 1064 | |
| 1065 | /* Setup SW override of UTMIPLL assuming USB2.0 |
| 1066 | ports are assigned to USB2 */ |
| 1067 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); |
| 1068 | reg |= UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL; |
| 1069 | reg &= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE; |
| 1070 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); |
| 1071 | |
| 1072 | udelay(1); |
| 1073 | |
| 1074 | /* Enable HW control UTMIPLL */ |
| 1075 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); |
| 1076 | reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE; |
| 1077 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); |
| 1078 | } |
| 1079 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1080 | static void __init tegra114_pll_init(void __iomem *clk_base, |
| 1081 | void __iomem *pmc) |
| 1082 | { |
| 1083 | u32 val; |
| 1084 | struct clk *clk; |
| 1085 | |
| 1086 | /* PLLC */ |
Peter De Schrijver | 04edb09 | 2013-09-06 14:37:37 +0300 | [diff] [blame^] | 1087 | clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base, |
| 1088 | pmc, 0, 0, &pll_c_params, TEGRA_PLL_USE_LOCK, |
| 1089 | pll_c_freq_table, NULL); |
| 1090 | clk_register_clkdev(clk, "pll_c", NULL); |
| 1091 | clks[TEGRA114_CLK_PLL_C] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1092 | |
Peter De Schrijver | 04edb09 | 2013-09-06 14:37:37 +0300 | [diff] [blame^] | 1093 | /* PLLC_OUT1 */ |
| 1094 | clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", |
| 1095 | clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP, |
| 1096 | 8, 8, 1, NULL); |
| 1097 | clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", |
| 1098 | clk_base + PLLC_OUT, 1, 0, |
| 1099 | CLK_SET_RATE_PARENT, 0, NULL); |
| 1100 | clk_register_clkdev(clk, "pll_c_out1", NULL); |
| 1101 | clks[TEGRA114_CLK_PLL_C_OUT1] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1102 | |
| 1103 | /* PLLC2 */ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1104 | clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0, 0, |
| 1105 | &pll_c2_params, TEGRA_PLL_USE_LOCK, |
| 1106 | pll_cx_freq_table, NULL); |
| 1107 | clk_register_clkdev(clk, "pll_c2", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1108 | clks[TEGRA114_CLK_PLL_C2] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1109 | |
| 1110 | /* PLLC3 */ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1111 | clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0, 0, |
| 1112 | &pll_c3_params, TEGRA_PLL_USE_LOCK, |
| 1113 | pll_cx_freq_table, NULL); |
| 1114 | clk_register_clkdev(clk, "pll_c3", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1115 | clks[TEGRA114_CLK_PLL_C3] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1116 | |
| 1117 | /* PLLP */ |
| 1118 | clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, pmc, 0, |
| 1119 | 408000000, &pll_p_params, |
| 1120 | TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK, |
| 1121 | pll_p_freq_table, NULL); |
| 1122 | clk_register_clkdev(clk, "pll_p", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1123 | clks[TEGRA114_CLK_PLL_P] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1124 | |
| 1125 | /* PLLP_OUT1 */ |
| 1126 | clk = tegra_clk_register_divider("pll_p_out1_div", "pll_p", |
| 1127 | clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | |
| 1128 | TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock); |
| 1129 | clk = tegra_clk_register_pll_out("pll_p_out1", "pll_p_out1_div", |
| 1130 | clk_base + PLLP_OUTA, 1, 0, |
| 1131 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, |
| 1132 | &pll_div_lock); |
| 1133 | clk_register_clkdev(clk, "pll_p_out1", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1134 | clks[TEGRA114_CLK_PLL_P_OUT1] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1135 | |
| 1136 | /* PLLP_OUT2 */ |
| 1137 | clk = tegra_clk_register_divider("pll_p_out2_div", "pll_p", |
| 1138 | clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | |
Peter De Schrijver | c388eee | 2013-06-05 16:37:17 +0300 | [diff] [blame] | 1139 | TEGRA_DIVIDER_ROUND_UP | TEGRA_DIVIDER_INT, 24, |
| 1140 | 8, 1, &pll_div_lock); |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1141 | clk = tegra_clk_register_pll_out("pll_p_out2", "pll_p_out2_div", |
| 1142 | clk_base + PLLP_OUTA, 17, 16, |
| 1143 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, |
| 1144 | &pll_div_lock); |
| 1145 | clk_register_clkdev(clk, "pll_p_out2", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1146 | clks[TEGRA114_CLK_PLL_P_OUT2] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1147 | |
| 1148 | /* PLLP_OUT3 */ |
| 1149 | clk = tegra_clk_register_divider("pll_p_out3_div", "pll_p", |
| 1150 | clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | |
| 1151 | TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock); |
| 1152 | clk = tegra_clk_register_pll_out("pll_p_out3", "pll_p_out3_div", |
| 1153 | clk_base + PLLP_OUTB, 1, 0, |
| 1154 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, |
| 1155 | &pll_div_lock); |
| 1156 | clk_register_clkdev(clk, "pll_p_out3", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1157 | clks[TEGRA114_CLK_PLL_P_OUT3] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1158 | |
| 1159 | /* PLLP_OUT4 */ |
| 1160 | clk = tegra_clk_register_divider("pll_p_out4_div", "pll_p", |
| 1161 | clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | |
| 1162 | TEGRA_DIVIDER_ROUND_UP, 24, 8, 1, |
| 1163 | &pll_div_lock); |
| 1164 | clk = tegra_clk_register_pll_out("pll_p_out4", "pll_p_out4_div", |
| 1165 | clk_base + PLLP_OUTB, 17, 16, |
| 1166 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, |
| 1167 | &pll_div_lock); |
| 1168 | clk_register_clkdev(clk, "pll_p_out4", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1169 | clks[TEGRA114_CLK_PLL_P_OUT4] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1170 | |
| 1171 | /* PLLM */ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1172 | clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc, |
| 1173 | CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, 0, |
| 1174 | &pll_m_params, TEGRA_PLL_USE_LOCK, |
| 1175 | pll_m_freq_table, NULL); |
| 1176 | clk_register_clkdev(clk, "pll_m", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1177 | clks[TEGRA114_CLK_PLL_M] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1178 | |
| 1179 | /* PLLM_OUT1 */ |
| 1180 | clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", |
| 1181 | clk_base + PLLM_OUT, 0, TEGRA_DIVIDER_ROUND_UP, |
| 1182 | 8, 8, 1, NULL); |
| 1183 | clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", |
| 1184 | clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | |
| 1185 | CLK_SET_RATE_PARENT, 0, NULL); |
| 1186 | clk_register_clkdev(clk, "pll_m_out1", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1187 | clks[TEGRA114_CLK_PLL_M_OUT1] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1188 | |
| 1189 | /* PLLM_UD */ |
| 1190 | clk = clk_register_fixed_factor(NULL, "pll_m_ud", "pll_m", |
| 1191 | CLK_SET_RATE_PARENT, 1, 1); |
| 1192 | |
| 1193 | /* PLLX */ |
Peter De Schrijver | 04edb09 | 2013-09-06 14:37:37 +0300 | [diff] [blame^] | 1194 | clk = tegra_clk_register_pllxc("pll_x", "pll_ref", clk_base, |
| 1195 | pmc, CLK_IGNORE_UNUSED, 0, &pll_x_params, |
| 1196 | TEGRA_PLL_USE_LOCK, pll_x_freq_table, NULL); |
| 1197 | clk_register_clkdev(clk, "pll_x", NULL); |
| 1198 | clks[TEGRA114_CLK_PLL_X] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1199 | |
| 1200 | /* PLLX_OUT0 */ |
| 1201 | clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x", |
| 1202 | CLK_SET_RATE_PARENT, 1, 2); |
| 1203 | clk_register_clkdev(clk, "pll_x_out0", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1204 | clks[TEGRA114_CLK_PLL_X_OUT0] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1205 | |
| 1206 | /* PLLU */ |
| 1207 | val = readl(clk_base + pll_u_params.base_reg); |
| 1208 | val &= ~BIT(24); /* disable PLLU_OVERRIDE */ |
| 1209 | writel(val, clk_base + pll_u_params.base_reg); |
| 1210 | |
| 1211 | clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0, |
| 1212 | 0, &pll_u_params, TEGRA_PLLU | |
| 1213 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | |
| 1214 | TEGRA_PLL_USE_LOCK, pll_u_freq_table, &pll_u_lock); |
| 1215 | clk_register_clkdev(clk, "pll_u", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1216 | clks[TEGRA114_CLK_PLL_U] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1217 | |
| 1218 | tegra114_utmi_param_configure(clk_base); |
| 1219 | |
| 1220 | /* PLLU_480M */ |
| 1221 | clk = clk_register_gate(NULL, "pll_u_480M", "pll_u", |
| 1222 | CLK_SET_RATE_PARENT, clk_base + PLLU_BASE, |
| 1223 | 22, 0, &pll_u_lock); |
| 1224 | clk_register_clkdev(clk, "pll_u_480M", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1225 | clks[TEGRA114_CLK_PLL_U_480M] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1226 | |
| 1227 | /* PLLU_60M */ |
| 1228 | clk = clk_register_fixed_factor(NULL, "pll_u_60M", "pll_u", |
| 1229 | CLK_SET_RATE_PARENT, 1, 8); |
| 1230 | clk_register_clkdev(clk, "pll_u_60M", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1231 | clks[TEGRA114_CLK_PLL_U_60M] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1232 | |
| 1233 | /* PLLU_48M */ |
| 1234 | clk = clk_register_fixed_factor(NULL, "pll_u_48M", "pll_u", |
| 1235 | CLK_SET_RATE_PARENT, 1, 10); |
| 1236 | clk_register_clkdev(clk, "pll_u_48M", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1237 | clks[TEGRA114_CLK_PLL_U_48M] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1238 | |
| 1239 | /* PLLU_12M */ |
| 1240 | clk = clk_register_fixed_factor(NULL, "pll_u_12M", "pll_u", |
| 1241 | CLK_SET_RATE_PARENT, 1, 40); |
| 1242 | clk_register_clkdev(clk, "pll_u_12M", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1243 | clks[TEGRA114_CLK_PLL_U_12M] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1244 | |
| 1245 | /* PLLD */ |
| 1246 | clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0, |
| 1247 | 0, &pll_d_params, |
| 1248 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | |
| 1249 | TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d_lock); |
| 1250 | clk_register_clkdev(clk, "pll_d", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1251 | clks[TEGRA114_CLK_PLL_D] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1252 | |
| 1253 | /* PLLD_OUT0 */ |
| 1254 | clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", |
| 1255 | CLK_SET_RATE_PARENT, 1, 2); |
| 1256 | clk_register_clkdev(clk, "pll_d_out0", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1257 | clks[TEGRA114_CLK_PLL_D_OUT0] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1258 | |
| 1259 | /* PLLD2 */ |
| 1260 | clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc, 0, |
| 1261 | 0, &pll_d2_params, |
| 1262 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | |
| 1263 | TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d2_lock); |
| 1264 | clk_register_clkdev(clk, "pll_d2", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1265 | clks[TEGRA114_CLK_PLL_D2] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1266 | |
| 1267 | /* PLLD2_OUT0 */ |
| 1268 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", |
| 1269 | CLK_SET_RATE_PARENT, 1, 2); |
| 1270 | clk_register_clkdev(clk, "pll_d2_out0", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1271 | clks[TEGRA114_CLK_PLL_D2_OUT0] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1272 | |
| 1273 | /* PLLA */ |
| 1274 | clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, pmc, 0, |
| 1275 | 0, &pll_a_params, TEGRA_PLL_HAS_CPCON | |
| 1276 | TEGRA_PLL_USE_LOCK, pll_a_freq_table, NULL); |
| 1277 | clk_register_clkdev(clk, "pll_a", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1278 | clks[TEGRA114_CLK_PLL_A] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1279 | |
| 1280 | /* PLLA_OUT0 */ |
| 1281 | clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a", |
| 1282 | clk_base + PLLA_OUT, 0, TEGRA_DIVIDER_ROUND_UP, |
| 1283 | 8, 8, 1, NULL); |
| 1284 | clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div", |
| 1285 | clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED | |
| 1286 | CLK_SET_RATE_PARENT, 0, NULL); |
| 1287 | clk_register_clkdev(clk, "pll_a_out0", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1288 | clks[TEGRA114_CLK_PLL_A_OUT0] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1289 | |
| 1290 | /* PLLRE */ |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1291 | clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc, |
| 1292 | 0, 0, &pll_re_vco_params, TEGRA_PLL_USE_LOCK, |
| 1293 | NULL, &pll_re_lock, pll_ref_freq); |
| 1294 | clk_register_clkdev(clk, "pll_re_vco", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1295 | clks[TEGRA114_CLK_PLL_RE_VCO] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1296 | |
| 1297 | clk = clk_register_divider_table(NULL, "pll_re_out", "pll_re_vco", 0, |
| 1298 | clk_base + PLLRE_BASE, 16, 4, 0, |
| 1299 | pll_re_div_table, &pll_re_lock); |
| 1300 | clk_register_clkdev(clk, "pll_re_out", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1301 | clks[TEGRA114_CLK_PLL_RE_OUT] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1302 | |
| 1303 | /* PLLE */ |
| 1304 | clk = tegra_clk_register_plle_tegra114("pll_e_out0", "pll_re_vco", |
| 1305 | clk_base, 0, 100000000, &pll_e_params, |
| 1306 | pll_e_freq_table, NULL); |
| 1307 | clk_register_clkdev(clk, "pll_e_out0", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1308 | clks[TEGRA114_CLK_PLL_E_OUT0] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1309 | } |
| 1310 | |
| 1311 | static const char *mux_audio_sync_clk[] = { "spdif_in_sync", "i2s0_sync", |
| 1312 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", |
| 1313 | }; |
| 1314 | |
| 1315 | static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2", |
| 1316 | "clk_m_div4", "extern1", |
| 1317 | }; |
| 1318 | |
| 1319 | static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2", |
| 1320 | "clk_m_div4", "extern2", |
| 1321 | }; |
| 1322 | |
| 1323 | static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2", |
| 1324 | "clk_m_div4", "extern3", |
| 1325 | }; |
| 1326 | |
| 1327 | static void __init tegra114_audio_clk_init(void __iomem *clk_base) |
| 1328 | { |
| 1329 | struct clk *clk; |
| 1330 | |
| 1331 | /* spdif_in_sync */ |
| 1332 | clk = tegra_clk_register_sync_source("spdif_in_sync", 24000000, |
| 1333 | 24000000); |
| 1334 | clk_register_clkdev(clk, "spdif_in_sync", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1335 | clks[TEGRA114_CLK_SPDIF_IN_SYNC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1336 | |
| 1337 | /* i2s0_sync */ |
| 1338 | clk = tegra_clk_register_sync_source("i2s0_sync", 24000000, 24000000); |
| 1339 | clk_register_clkdev(clk, "i2s0_sync", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1340 | clks[TEGRA114_CLK_I2S0_SYNC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1341 | |
| 1342 | /* i2s1_sync */ |
| 1343 | clk = tegra_clk_register_sync_source("i2s1_sync", 24000000, 24000000); |
| 1344 | clk_register_clkdev(clk, "i2s1_sync", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1345 | clks[TEGRA114_CLK_I2S1_SYNC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1346 | |
| 1347 | /* i2s2_sync */ |
| 1348 | clk = tegra_clk_register_sync_source("i2s2_sync", 24000000, 24000000); |
| 1349 | clk_register_clkdev(clk, "i2s2_sync", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1350 | clks[TEGRA114_CLK_I2S2_SYNC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1351 | |
| 1352 | /* i2s3_sync */ |
| 1353 | clk = tegra_clk_register_sync_source("i2s3_sync", 24000000, 24000000); |
| 1354 | clk_register_clkdev(clk, "i2s3_sync", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1355 | clks[TEGRA114_CLK_I2S3_SYNC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1356 | |
| 1357 | /* i2s4_sync */ |
| 1358 | clk = tegra_clk_register_sync_source("i2s4_sync", 24000000, 24000000); |
| 1359 | clk_register_clkdev(clk, "i2s4_sync", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1360 | clks[TEGRA114_CLK_I2S4_SYNC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1361 | |
| 1362 | /* vimclk_sync */ |
| 1363 | clk = tegra_clk_register_sync_source("vimclk_sync", 24000000, 24000000); |
| 1364 | clk_register_clkdev(clk, "vimclk_sync", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1365 | clks[TEGRA114_CLK_VIMCLK_SYNC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1366 | |
| 1367 | /* audio0 */ |
| 1368 | clk = clk_register_mux(NULL, "audio0_mux", mux_audio_sync_clk, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1369 | ARRAY_SIZE(mux_audio_sync_clk), |
| 1370 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1371 | clk_base + AUDIO_SYNC_CLK_I2S0, 0, 3, 0, |
| 1372 | NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1373 | clks[TEGRA114_CLK_AUDIO0_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1374 | clk = clk_register_gate(NULL, "audio0", "audio0_mux", 0, |
| 1375 | clk_base + AUDIO_SYNC_CLK_I2S0, 4, |
| 1376 | CLK_GATE_SET_TO_DISABLE, NULL); |
| 1377 | clk_register_clkdev(clk, "audio0", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1378 | clks[TEGRA114_CLK_AUDIO0] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1379 | |
| 1380 | /* audio1 */ |
| 1381 | clk = clk_register_mux(NULL, "audio1_mux", mux_audio_sync_clk, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1382 | ARRAY_SIZE(mux_audio_sync_clk), |
| 1383 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1384 | clk_base + AUDIO_SYNC_CLK_I2S1, 0, 3, 0, |
| 1385 | NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1386 | clks[TEGRA114_CLK_AUDIO1_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1387 | clk = clk_register_gate(NULL, "audio1", "audio1_mux", 0, |
| 1388 | clk_base + AUDIO_SYNC_CLK_I2S1, 4, |
| 1389 | CLK_GATE_SET_TO_DISABLE, NULL); |
| 1390 | clk_register_clkdev(clk, "audio1", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1391 | clks[TEGRA114_CLK_AUDIO1] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1392 | |
| 1393 | /* audio2 */ |
| 1394 | clk = clk_register_mux(NULL, "audio2_mux", mux_audio_sync_clk, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1395 | ARRAY_SIZE(mux_audio_sync_clk), |
| 1396 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1397 | clk_base + AUDIO_SYNC_CLK_I2S2, 0, 3, 0, |
| 1398 | NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1399 | clks[TEGRA114_CLK_AUDIO2_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1400 | clk = clk_register_gate(NULL, "audio2", "audio2_mux", 0, |
| 1401 | clk_base + AUDIO_SYNC_CLK_I2S2, 4, |
| 1402 | CLK_GATE_SET_TO_DISABLE, NULL); |
| 1403 | clk_register_clkdev(clk, "audio2", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1404 | clks[TEGRA114_CLK_AUDIO2] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1405 | |
| 1406 | /* audio3 */ |
| 1407 | clk = clk_register_mux(NULL, "audio3_mux", mux_audio_sync_clk, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1408 | ARRAY_SIZE(mux_audio_sync_clk), |
| 1409 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1410 | clk_base + AUDIO_SYNC_CLK_I2S3, 0, 3, 0, |
| 1411 | NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1412 | clks[TEGRA114_CLK_AUDIO3_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1413 | clk = clk_register_gate(NULL, "audio3", "audio3_mux", 0, |
| 1414 | clk_base + AUDIO_SYNC_CLK_I2S3, 4, |
| 1415 | CLK_GATE_SET_TO_DISABLE, NULL); |
| 1416 | clk_register_clkdev(clk, "audio3", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1417 | clks[TEGRA114_CLK_AUDIO3] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1418 | |
| 1419 | /* audio4 */ |
| 1420 | clk = clk_register_mux(NULL, "audio4_mux", mux_audio_sync_clk, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1421 | ARRAY_SIZE(mux_audio_sync_clk), |
| 1422 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1423 | clk_base + AUDIO_SYNC_CLK_I2S4, 0, 3, 0, |
| 1424 | NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1425 | clks[TEGRA114_CLK_AUDIO4_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1426 | clk = clk_register_gate(NULL, "audio4", "audio4_mux", 0, |
| 1427 | clk_base + AUDIO_SYNC_CLK_I2S4, 4, |
| 1428 | CLK_GATE_SET_TO_DISABLE, NULL); |
| 1429 | clk_register_clkdev(clk, "audio4", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1430 | clks[TEGRA114_CLK_AUDIO4] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1431 | |
| 1432 | /* spdif */ |
| 1433 | clk = clk_register_mux(NULL, "spdif_mux", mux_audio_sync_clk, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1434 | ARRAY_SIZE(mux_audio_sync_clk), |
| 1435 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1436 | clk_base + AUDIO_SYNC_CLK_SPDIF, 0, 3, 0, |
| 1437 | NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1438 | clks[TEGRA114_CLK_SPDIF_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1439 | clk = clk_register_gate(NULL, "spdif", "spdif_mux", 0, |
| 1440 | clk_base + AUDIO_SYNC_CLK_SPDIF, 4, |
| 1441 | CLK_GATE_SET_TO_DISABLE, NULL); |
| 1442 | clk_register_clkdev(clk, "spdif", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1443 | clks[TEGRA114_CLK_SPDIF] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1444 | |
| 1445 | /* audio0_2x */ |
| 1446 | clk = clk_register_fixed_factor(NULL, "audio0_doubler", "audio0", |
| 1447 | CLK_SET_RATE_PARENT, 2, 1); |
| 1448 | clk = tegra_clk_register_divider("audio0_div", "audio0_doubler", |
| 1449 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 24, 1, |
| 1450 | 0, &clk_doubler_lock); |
| 1451 | clk = tegra_clk_register_periph_gate("audio0_2x", "audio0_div", |
| 1452 | TEGRA_PERIPH_NO_RESET, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1453 | CLK_SET_RATE_PARENT, 113, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1454 | periph_clk_enb_refcnt); |
| 1455 | clk_register_clkdev(clk, "audio0_2x", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1456 | clks[TEGRA114_CLK_AUDIO0_2X] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1457 | |
| 1458 | /* audio1_2x */ |
| 1459 | clk = clk_register_fixed_factor(NULL, "audio1_doubler", "audio1", |
| 1460 | CLK_SET_RATE_PARENT, 2, 1); |
| 1461 | clk = tegra_clk_register_divider("audio1_div", "audio1_doubler", |
| 1462 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 25, 1, |
| 1463 | 0, &clk_doubler_lock); |
| 1464 | clk = tegra_clk_register_periph_gate("audio1_2x", "audio1_div", |
| 1465 | TEGRA_PERIPH_NO_RESET, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1466 | CLK_SET_RATE_PARENT, 114, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1467 | periph_clk_enb_refcnt); |
| 1468 | clk_register_clkdev(clk, "audio1_2x", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1469 | clks[TEGRA114_CLK_AUDIO1_2X] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1470 | |
| 1471 | /* audio2_2x */ |
| 1472 | clk = clk_register_fixed_factor(NULL, "audio2_doubler", "audio2", |
| 1473 | CLK_SET_RATE_PARENT, 2, 1); |
| 1474 | clk = tegra_clk_register_divider("audio2_div", "audio2_doubler", |
| 1475 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 26, 1, |
| 1476 | 0, &clk_doubler_lock); |
| 1477 | clk = tegra_clk_register_periph_gate("audio2_2x", "audio2_div", |
| 1478 | TEGRA_PERIPH_NO_RESET, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1479 | CLK_SET_RATE_PARENT, 115, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1480 | periph_clk_enb_refcnt); |
| 1481 | clk_register_clkdev(clk, "audio2_2x", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1482 | clks[TEGRA114_CLK_AUDIO2_2X] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1483 | |
| 1484 | /* audio3_2x */ |
| 1485 | clk = clk_register_fixed_factor(NULL, "audio3_doubler", "audio3", |
| 1486 | CLK_SET_RATE_PARENT, 2, 1); |
| 1487 | clk = tegra_clk_register_divider("audio3_div", "audio3_doubler", |
| 1488 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 27, 1, |
| 1489 | 0, &clk_doubler_lock); |
| 1490 | clk = tegra_clk_register_periph_gate("audio3_2x", "audio3_div", |
| 1491 | TEGRA_PERIPH_NO_RESET, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1492 | CLK_SET_RATE_PARENT, 116, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1493 | periph_clk_enb_refcnt); |
| 1494 | clk_register_clkdev(clk, "audio3_2x", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1495 | clks[TEGRA114_CLK_AUDIO3_2X] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1496 | |
| 1497 | /* audio4_2x */ |
| 1498 | clk = clk_register_fixed_factor(NULL, "audio4_doubler", "audio4", |
| 1499 | CLK_SET_RATE_PARENT, 2, 1); |
| 1500 | clk = tegra_clk_register_divider("audio4_div", "audio4_doubler", |
| 1501 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 28, 1, |
| 1502 | 0, &clk_doubler_lock); |
| 1503 | clk = tegra_clk_register_periph_gate("audio4_2x", "audio4_div", |
| 1504 | TEGRA_PERIPH_NO_RESET, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1505 | CLK_SET_RATE_PARENT, 117, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1506 | periph_clk_enb_refcnt); |
| 1507 | clk_register_clkdev(clk, "audio4_2x", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1508 | clks[TEGRA114_CLK_AUDIO4_2X] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1509 | |
| 1510 | /* spdif_2x */ |
| 1511 | clk = clk_register_fixed_factor(NULL, "spdif_doubler", "spdif", |
| 1512 | CLK_SET_RATE_PARENT, 2, 1); |
| 1513 | clk = tegra_clk_register_divider("spdif_div", "spdif_doubler", |
| 1514 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 29, 1, |
| 1515 | 0, &clk_doubler_lock); |
| 1516 | clk = tegra_clk_register_periph_gate("spdif_2x", "spdif_div", |
| 1517 | TEGRA_PERIPH_NO_RESET, clk_base, |
| 1518 | CLK_SET_RATE_PARENT, 118, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1519 | periph_clk_enb_refcnt); |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1520 | clk_register_clkdev(clk, "spdif_2x", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1521 | clks[TEGRA114_CLK_SPDIF_2X] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1522 | } |
| 1523 | |
| 1524 | static void __init tegra114_pmc_clk_init(void __iomem *pmc_base) |
| 1525 | { |
| 1526 | struct clk *clk; |
| 1527 | |
| 1528 | /* clk_out_1 */ |
| 1529 | clk = clk_register_mux(NULL, "clk_out_1_mux", clk_out1_parents, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1530 | ARRAY_SIZE(clk_out1_parents), |
| 1531 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1532 | pmc_base + PMC_CLK_OUT_CNTRL, 6, 3, 0, |
| 1533 | &clk_out_lock); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1534 | clks[TEGRA114_CLK_CLK_OUT_1_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1535 | clk = clk_register_gate(NULL, "clk_out_1", "clk_out_1_mux", 0, |
| 1536 | pmc_base + PMC_CLK_OUT_CNTRL, 2, 0, |
| 1537 | &clk_out_lock); |
| 1538 | clk_register_clkdev(clk, "extern1", "clk_out_1"); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1539 | clks[TEGRA114_CLK_CLK_OUT_1] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1540 | |
| 1541 | /* clk_out_2 */ |
| 1542 | clk = clk_register_mux(NULL, "clk_out_2_mux", clk_out2_parents, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1543 | ARRAY_SIZE(clk_out2_parents), |
| 1544 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1545 | pmc_base + PMC_CLK_OUT_CNTRL, 14, 3, 0, |
| 1546 | &clk_out_lock); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1547 | clks[TEGRA114_CLK_CLK_OUT_2_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1548 | clk = clk_register_gate(NULL, "clk_out_2", "clk_out_2_mux", 0, |
| 1549 | pmc_base + PMC_CLK_OUT_CNTRL, 10, 0, |
| 1550 | &clk_out_lock); |
| 1551 | clk_register_clkdev(clk, "extern2", "clk_out_2"); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1552 | clks[TEGRA114_CLK_CLK_OUT_2] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1553 | |
| 1554 | /* clk_out_3 */ |
| 1555 | clk = clk_register_mux(NULL, "clk_out_3_mux", clk_out3_parents, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1556 | ARRAY_SIZE(clk_out3_parents), |
| 1557 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1558 | pmc_base + PMC_CLK_OUT_CNTRL, 22, 3, 0, |
| 1559 | &clk_out_lock); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1560 | clks[TEGRA114_CLK_CLK_OUT_3_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1561 | clk = clk_register_gate(NULL, "clk_out_3", "clk_out_3_mux", 0, |
| 1562 | pmc_base + PMC_CLK_OUT_CNTRL, 18, 0, |
| 1563 | &clk_out_lock); |
| 1564 | clk_register_clkdev(clk, "extern3", "clk_out_3"); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1565 | clks[TEGRA114_CLK_CLK_OUT_3] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1566 | |
| 1567 | /* blink */ |
Alexandre Courbot | 9139227 | 2013-05-26 11:56:31 +0900 | [diff] [blame] | 1568 | /* clear the blink timer register to directly output clk_32k */ |
| 1569 | writel_relaxed(0, pmc_base + PMC_BLINK_TIMER); |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1570 | clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0, |
| 1571 | pmc_base + PMC_DPD_PADS_ORIDE, |
| 1572 | PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL); |
| 1573 | clk = clk_register_gate(NULL, "blink", "blink_override", 0, |
| 1574 | pmc_base + PMC_CTRL, |
| 1575 | PMC_CTRL_BLINK_ENB, 0, NULL); |
| 1576 | clk_register_clkdev(clk, "blink", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1577 | clks[TEGRA114_CLK_BLINK] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1578 | |
| 1579 | } |
| 1580 | |
| 1581 | static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4", |
Peter De Schrijver | 29b0944 | 2013-06-05 17:29:28 +0300 | [diff] [blame] | 1582 | "pll_p", "pll_p_out2", "unused", |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1583 | "clk_32k", "pll_m_out1" }; |
| 1584 | |
| 1585 | static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", |
| 1586 | "pll_p", "pll_p_out4", "unused", |
| 1587 | "unused", "pll_x" }; |
| 1588 | |
| 1589 | static const char *cclk_lp_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", |
| 1590 | "pll_p", "pll_p_out4", "unused", |
| 1591 | "unused", "pll_x", "pll_x_out0" }; |
| 1592 | |
| 1593 | static void __init tegra114_super_clk_init(void __iomem *clk_base) |
| 1594 | { |
| 1595 | struct clk *clk; |
| 1596 | |
| 1597 | /* CCLKG */ |
| 1598 | clk = tegra_clk_register_super_mux("cclk_g", cclk_g_parents, |
| 1599 | ARRAY_SIZE(cclk_g_parents), |
| 1600 | CLK_SET_RATE_PARENT, |
| 1601 | clk_base + CCLKG_BURST_POLICY, |
| 1602 | 0, 4, 0, 0, NULL); |
| 1603 | clk_register_clkdev(clk, "cclk_g", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1604 | clks[TEGRA114_CLK_CCLK_G] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1605 | |
| 1606 | /* CCLKLP */ |
| 1607 | clk = tegra_clk_register_super_mux("cclk_lp", cclk_lp_parents, |
| 1608 | ARRAY_SIZE(cclk_lp_parents), |
| 1609 | CLK_SET_RATE_PARENT, |
| 1610 | clk_base + CCLKLP_BURST_POLICY, |
| 1611 | 0, 4, 8, 9, NULL); |
| 1612 | clk_register_clkdev(clk, "cclk_lp", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1613 | clks[TEGRA114_CLK_CCLK_LP] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1614 | |
| 1615 | /* SCLK */ |
| 1616 | clk = tegra_clk_register_super_mux("sclk", sclk_parents, |
| 1617 | ARRAY_SIZE(sclk_parents), |
| 1618 | CLK_SET_RATE_PARENT, |
| 1619 | clk_base + SCLK_BURST_POLICY, |
| 1620 | 0, 4, 0, 0, NULL); |
| 1621 | clk_register_clkdev(clk, "sclk", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1622 | clks[TEGRA114_CLK_SCLK] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1623 | |
| 1624 | /* HCLK */ |
| 1625 | clk = clk_register_divider(NULL, "hclk_div", "sclk", 0, |
| 1626 | clk_base + SYSTEM_CLK_RATE, 4, 2, 0, |
| 1627 | &sysrate_lock); |
| 1628 | clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT | |
| 1629 | CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, |
| 1630 | 7, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); |
| 1631 | clk_register_clkdev(clk, "hclk", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1632 | clks[TEGRA114_CLK_HCLK] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1633 | |
| 1634 | /* PCLK */ |
| 1635 | clk = clk_register_divider(NULL, "pclk_div", "hclk", 0, |
| 1636 | clk_base + SYSTEM_CLK_RATE, 0, 2, 0, |
| 1637 | &sysrate_lock); |
| 1638 | clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT | |
| 1639 | CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, |
| 1640 | 3, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); |
| 1641 | clk_register_clkdev(clk, "pclk", NULL); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1642 | clks[TEGRA114_CLK_PCLK] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1643 | } |
| 1644 | |
| 1645 | static struct tegra_periph_init_data tegra_periph_clk_list[] = { |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1646 | TEGRA_INIT_DATA_MUX("i2s0", NULL, "tegra30-i2s.0", mux_pllaout0_audio0_2x_pllp_clkm, CLK_SOURCE_I2S0, 30, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_I2S0), |
| 1647 | TEGRA_INIT_DATA_MUX("i2s1", NULL, "tegra30-i2s.1", mux_pllaout0_audio1_2x_pllp_clkm, CLK_SOURCE_I2S1, 11, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_I2S1), |
| 1648 | TEGRA_INIT_DATA_MUX("i2s2", NULL, "tegra30-i2s.2", mux_pllaout0_audio2_2x_pllp_clkm, CLK_SOURCE_I2S2, 18, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_I2S2), |
| 1649 | TEGRA_INIT_DATA_MUX("i2s3", NULL, "tegra30-i2s.3", mux_pllaout0_audio3_2x_pllp_clkm, CLK_SOURCE_I2S3, 101, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_I2S3), |
| 1650 | TEGRA_INIT_DATA_MUX("i2s4", NULL, "tegra30-i2s.4", mux_pllaout0_audio4_2x_pllp_clkm, CLK_SOURCE_I2S4, 102, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_I2S4), |
| 1651 | TEGRA_INIT_DATA_MUX("spdif_out", "spdif_out", "tegra30-spdif", mux_pllaout0_audio_2x_pllp_clkm, CLK_SOURCE_SPDIF_OUT, 10, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_SPDIF_OUT), |
| 1652 | TEGRA_INIT_DATA_MUX("spdif_in", "spdif_in", "tegra30-spdif", mux_pllp_pllc_pllm, CLK_SOURCE_SPDIF_IN, 10, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_SPDIF_IN), |
| 1653 | TEGRA_INIT_DATA_MUX("pwm", NULL, "pwm", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_PWM, 17, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_PWM), |
| 1654 | TEGRA_INIT_DATA_MUX("adx", NULL, "adx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX, 154, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_ADX), |
| 1655 | TEGRA_INIT_DATA_MUX("amx", NULL, "amx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX, 153, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_AMX), |
| 1656 | TEGRA_INIT_DATA_MUX("hda", "hda", "tegra30-hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA, 125, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_HDA), |
| 1657 | TEGRA_INIT_DATA_MUX("hda2codec_2x", "hda2codec", "tegra30-hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_HDA2CODEC_2X), |
| 1658 | TEGRA_INIT_DATA_MUX8("sbc1", NULL, "tegra11-spi.0", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_SBC1), |
| 1659 | TEGRA_INIT_DATA_MUX8("sbc2", NULL, "tegra11-spi.1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_SBC2), |
| 1660 | TEGRA_INIT_DATA_MUX8("sbc3", NULL, "tegra11-spi.2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_SBC3), |
| 1661 | TEGRA_INIT_DATA_MUX8("sbc4", NULL, "tegra11-spi.3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC4, 68, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_SBC4), |
| 1662 | TEGRA_INIT_DATA_MUX8("sbc5", NULL, "tegra11-spi.4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC5, 104, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_SBC5), |
| 1663 | TEGRA_INIT_DATA_MUX8("sbc6", NULL, "tegra11-spi.5", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC6, 105, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_SBC6), |
| 1664 | TEGRA_INIT_DATA_MUX8("ndflash", NULL, "tegra_nand", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDFLASH, 13, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_NDSPEED), |
| 1665 | TEGRA_INIT_DATA_MUX8("ndspeed", NULL, "tegra_nand_speed", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDSPEED, 80, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_NDSPEED), |
| 1666 | TEGRA_INIT_DATA_MUX("vfir", NULL, "vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_VFIR), |
| 1667 | TEGRA_INIT_DATA_MUX("sdmmc1", NULL, "sdhci-tegra.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, 0, TEGRA114_CLK_SDMMC1), |
| 1668 | TEGRA_INIT_DATA_MUX("sdmmc2", NULL, "sdhci-tegra.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, 0, TEGRA114_CLK_SDMMC2), |
| 1669 | TEGRA_INIT_DATA_MUX("sdmmc3", NULL, "sdhci-tegra.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, 0, TEGRA114_CLK_SDMMC3), |
| 1670 | TEGRA_INIT_DATA_MUX("sdmmc4", NULL, "sdhci-tegra.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, 0, TEGRA114_CLK_SDMMC4), |
| 1671 | TEGRA_INIT_DATA_INT8("vde", NULL, "vde", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_VDE, 61, 0, TEGRA114_CLK_VDE), |
| 1672 | TEGRA_INIT_DATA_MUX_FLAGS("csite", NULL, "csite", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_CSITE, 73, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_CSITE, CLK_IGNORE_UNUSED), |
| 1673 | TEGRA_INIT_DATA_MUX("la", NULL, "la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_LA), |
| 1674 | TEGRA_INIT_DATA_MUX("trace", NULL, "trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_TRACE), |
| 1675 | TEGRA_INIT_DATA_MUX("owr", NULL, "tegra_w1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_OWR, 71, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_OWR), |
| 1676 | TEGRA_INIT_DATA_MUX("nor", NULL, "tegra-nor", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NOR, 42, 0, TEGRA114_CLK_NOR), |
| 1677 | TEGRA_INIT_DATA_MUX("mipi", NULL, "mipi", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_MIPI, 50, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_MIPI), |
| 1678 | TEGRA_INIT_DATA_I2C("i2c1", "div-clk", "tegra11-i2c.0", mux_pllp_clkm, CLK_SOURCE_I2C1, 12, TEGRA114_CLK_I2C1), |
| 1679 | TEGRA_INIT_DATA_I2C("i2c2", "div-clk", "tegra11-i2c.1", mux_pllp_clkm, CLK_SOURCE_I2C2, 54, TEGRA114_CLK_I2C2), |
| 1680 | TEGRA_INIT_DATA_I2C("i2c3", "div-clk", "tegra11-i2c.2", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, TEGRA114_CLK_I2C3), |
| 1681 | TEGRA_INIT_DATA_I2C("i2c4", "div-clk", "tegra11-i2c.3", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, TEGRA114_CLK_I2C4), |
| 1682 | TEGRA_INIT_DATA_I2C("i2c5", "div-clk", "tegra11-i2c.4", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, TEGRA114_CLK_I2C5), |
| 1683 | TEGRA_INIT_DATA_UART("uarta", NULL, "tegra_uart.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTA, 6, TEGRA114_CLK_UARTA), |
| 1684 | TEGRA_INIT_DATA_UART("uartb", NULL, "tegra_uart.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, TEGRA114_CLK_UARTB), |
| 1685 | TEGRA_INIT_DATA_UART("uartc", NULL, "tegra_uart.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, TEGRA114_CLK_UARTC), |
| 1686 | TEGRA_INIT_DATA_UART("uartd", NULL, "tegra_uart.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, TEGRA114_CLK_UARTD), |
| 1687 | TEGRA_INIT_DATA_INT8("3d", NULL, "3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, 0, TEGRA114_CLK_GR3D), |
| 1688 | TEGRA_INIT_DATA_INT8("2d", NULL, "2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, 0, TEGRA114_CLK_GR2D), |
| 1689 | TEGRA_INIT_DATA_MUX("vi_sensor", "vi_sensor", "tegra_camera", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, TEGRA114_CLK_VI_SENSOR), |
| 1690 | TEGRA_INIT_DATA_INT8("vi", "vi", "tegra_camera", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI, 20, 0, TEGRA114_CLK_VI), |
| 1691 | TEGRA_INIT_DATA_INT8("epp", NULL, "epp", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_EPP, 19, 0, TEGRA114_CLK_EPP), |
| 1692 | TEGRA_INIT_DATA_INT8("msenc", NULL, "msenc", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_MSENC, 91, TEGRA_PERIPH_WAR_1005168, TEGRA114_CLK_MSENC), |
| 1693 | TEGRA_INIT_DATA_INT8("tsec", NULL, "tsec", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_TSEC, 83, 0, TEGRA114_CLK_TSEC), |
| 1694 | TEGRA_INIT_DATA_INT8("host1x", NULL, "host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, TEGRA114_CLK_HOST1X), |
| 1695 | TEGRA_INIT_DATA_MUX8("hdmi", NULL, "hdmi", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_HDMI, 51, 0, TEGRA114_CLK_HDMI), |
| 1696 | TEGRA_INIT_DATA_MUX("cilab", "cilab", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILAB, 144, 0, TEGRA114_CLK_CILAB), |
| 1697 | TEGRA_INIT_DATA_MUX("cilcd", "cilcd", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILCD, 145, 0, TEGRA114_CLK_CILCD), |
| 1698 | TEGRA_INIT_DATA_MUX("cile", "cile", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILE, 146, 0, TEGRA114_CLK_CILE), |
| 1699 | TEGRA_INIT_DATA_MUX("dsialp", "dsialp", "tegradc.0", mux_pllp_pllc_clkm, CLK_SOURCE_DSIALP, 147, 0, TEGRA114_CLK_DSIALP), |
| 1700 | TEGRA_INIT_DATA_MUX("dsiblp", "dsiblp", "tegradc.1", mux_pllp_pllc_clkm, CLK_SOURCE_DSIBLP, 148, 0, TEGRA114_CLK_DSIBLP), |
| 1701 | TEGRA_INIT_DATA_MUX("tsensor", NULL, "tegra-tsensor", mux_pllp_pllc_clkm_clk32, CLK_SOURCE_TSENSOR, 100, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_TSENSOR), |
| 1702 | TEGRA_INIT_DATA_MUX("actmon", NULL, "actmon", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_ACTMON, 119, 0, TEGRA114_CLK_ACTMON), |
| 1703 | TEGRA_INIT_DATA_MUX8("extern1", NULL, "extern1", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN1, 120, 0, TEGRA114_CLK_EXTERN1), |
| 1704 | TEGRA_INIT_DATA_MUX8("extern2", NULL, "extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, 0, TEGRA114_CLK_EXTERN2), |
| 1705 | TEGRA_INIT_DATA_MUX8("extern3", NULL, "extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, 0, TEGRA114_CLK_EXTERN3), |
| 1706 | TEGRA_INIT_DATA_MUX("i2cslow", NULL, "i2cslow", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_I2CSLOW, 81, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_I2CSLOW), |
| 1707 | TEGRA_INIT_DATA_INT8("se", NULL, "se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_SE), |
| 1708 | TEGRA_INIT_DATA_INT_FLAGS("mselect", NULL, "mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, 0, TEGRA114_CLK_MSELECT, CLK_IGNORE_UNUSED), |
| 1709 | TEGRA_INIT_DATA_MUX("dfll_ref", "ref", "t114_dfll", mux_pllp_clkm, CLK_SOURCE_DFLL_REF, 155, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_DFLL_REF), |
| 1710 | TEGRA_INIT_DATA_MUX("dfll_soc", "soc", "t114_dfll", mux_pllp_clkm, CLK_SOURCE_DFLL_SOC, 155, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_DFLL_SOC), |
| 1711 | TEGRA_INIT_DATA_MUX8("soc_therm", NULL, "soc_therm", mux_pllm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_SOC_THERM), |
| 1712 | TEGRA_INIT_DATA_XUSB("xusb_host_src", "host_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, TEGRA114_CLK_XUSB_HOST_SRC), |
| 1713 | TEGRA_INIT_DATA_XUSB("xusb_falcon_src", "falcon_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, TEGRA114_CLK_XUSB_FALCON_SRC), |
| 1714 | TEGRA_INIT_DATA_XUSB("xusb_fs_src", "fs_src", "tegra_xhci", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, TEGRA114_CLK_XUSB_FS_SRC), |
| 1715 | TEGRA_INIT_DATA_XUSB("xusb_ss_src", "ss_src", "tegra_xhci", mux_clkm_pllre_clk32_480M_pllc_ref, CLK_SOURCE_XUSB_SS_SRC, 143, TEGRA_PERIPH_NO_RESET, TEGRA114_CLK_XUSB_SS_SRC), |
| 1716 | TEGRA_INIT_DATA_XUSB("xusb_dev_src", "dev_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, TEGRA114_CLK_XUSB_DEV_SRC), |
| 1717 | TEGRA_INIT_DATA_AUDIO("d_audio", "d_audio", "tegra30-ahub", CLK_SOURCE_D_AUDIO, 106, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_D_AUDIO), |
| 1718 | TEGRA_INIT_DATA_AUDIO("dam0", NULL, "tegra30-dam.0", CLK_SOURCE_DAM0, 108, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_DAM0), |
| 1719 | TEGRA_INIT_DATA_AUDIO("dam1", NULL, "tegra30-dam.1", CLK_SOURCE_DAM1, 109, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_DAM1), |
| 1720 | TEGRA_INIT_DATA_AUDIO("dam2", NULL, "tegra30-dam.2", CLK_SOURCE_DAM2, 110, TEGRA_PERIPH_ON_APB, TEGRA114_CLK_DAM2), |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1721 | }; |
| 1722 | |
| 1723 | static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = { |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1724 | TEGRA_INIT_DATA_NODIV("disp1", NULL, "tegradc.0", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP1, 29, 7, 27, 0, TEGRA114_CLK_DISP1), |
| 1725 | TEGRA_INIT_DATA_NODIV("disp2", NULL, "tegradc.1", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, 0, TEGRA114_CLK_DISP2), |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1726 | }; |
| 1727 | |
| 1728 | static __init void tegra114_periph_clk_init(void __iomem *clk_base) |
| 1729 | { |
| 1730 | struct tegra_periph_init_data *data; |
| 1731 | struct clk *clk; |
| 1732 | int i; |
| 1733 | u32 val; |
| 1734 | |
| 1735 | /* apbdma */ |
| 1736 | clk = tegra_clk_register_periph_gate("apbdma", "clk_m", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1737 | 0, 34, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1738 | clks[TEGRA114_CLK_APBDMA] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1739 | |
| 1740 | /* rtc */ |
| 1741 | clk = tegra_clk_register_periph_gate("rtc", "clk_32k", |
| 1742 | TEGRA_PERIPH_ON_APB | |
| 1743 | TEGRA_PERIPH_NO_RESET, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1744 | 0, 4, periph_clk_enb_refcnt); |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1745 | clk_register_clkdev(clk, NULL, "rtc-tegra"); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1746 | clks[TEGRA114_CLK_RTC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1747 | |
| 1748 | /* kbc */ |
| 1749 | clk = tegra_clk_register_periph_gate("kbc", "clk_32k", |
| 1750 | TEGRA_PERIPH_ON_APB | |
| 1751 | TEGRA_PERIPH_NO_RESET, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1752 | 0, 36, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1753 | clks[TEGRA114_CLK_KBC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1754 | |
| 1755 | /* timer */ |
| 1756 | clk = tegra_clk_register_periph_gate("timer", "clk_m", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1757 | 0, 5, periph_clk_enb_refcnt); |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1758 | clk_register_clkdev(clk, NULL, "timer"); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1759 | clks[TEGRA114_CLK_TIMER] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1760 | |
| 1761 | /* kfuse */ |
| 1762 | clk = tegra_clk_register_periph_gate("kfuse", "clk_m", |
| 1763 | TEGRA_PERIPH_ON_APB, clk_base, 0, 40, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1764 | periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1765 | clks[TEGRA114_CLK_KFUSE] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1766 | |
| 1767 | /* fuse */ |
| 1768 | clk = tegra_clk_register_periph_gate("fuse", "clk_m", |
| 1769 | TEGRA_PERIPH_ON_APB, clk_base, 0, 39, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1770 | periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1771 | clks[TEGRA114_CLK_FUSE] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1772 | |
| 1773 | /* fuse_burn */ |
| 1774 | clk = tegra_clk_register_periph_gate("fuse_burn", "clk_m", |
| 1775 | TEGRA_PERIPH_ON_APB, clk_base, 0, 39, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1776 | periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1777 | clks[TEGRA114_CLK_FUSE_BURN] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1778 | |
| 1779 | /* apbif */ |
| 1780 | clk = tegra_clk_register_periph_gate("apbif", "clk_m", |
| 1781 | TEGRA_PERIPH_ON_APB, clk_base, 0, 107, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1782 | periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1783 | clks[TEGRA114_CLK_APBIF] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1784 | |
| 1785 | /* hda2hdmi */ |
| 1786 | clk = tegra_clk_register_periph_gate("hda2hdmi", "clk_m", |
| 1787 | TEGRA_PERIPH_ON_APB, clk_base, 0, 128, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1788 | periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1789 | clks[TEGRA114_CLK_HDA2HDMI] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1790 | |
| 1791 | /* vcp */ |
| 1792 | clk = tegra_clk_register_periph_gate("vcp", "clk_m", 0, clk_base, 0, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1793 | 29, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1794 | clks[TEGRA114_CLK_VCP] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1795 | |
| 1796 | /* bsea */ |
| 1797 | clk = tegra_clk_register_periph_gate("bsea", "clk_m", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1798 | 0, 62, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1799 | clks[TEGRA114_CLK_BSEA] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1800 | |
| 1801 | /* bsev */ |
| 1802 | clk = tegra_clk_register_periph_gate("bsev", "clk_m", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1803 | 0, 63, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1804 | clks[TEGRA114_CLK_BSEV] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1805 | |
| 1806 | /* mipi-cal */ |
| 1807 | clk = tegra_clk_register_periph_gate("mipi-cal", "clk_m", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1808 | 0, 56, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1809 | clks[TEGRA114_CLK_MIPI_CAL] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1810 | |
| 1811 | /* usbd */ |
| 1812 | clk = tegra_clk_register_periph_gate("usbd", "clk_m", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1813 | 0, 22, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1814 | clks[TEGRA114_CLK_USBD] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1815 | |
| 1816 | /* usb2 */ |
| 1817 | clk = tegra_clk_register_periph_gate("usb2", "clk_m", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1818 | 0, 58, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1819 | clks[TEGRA114_CLK_USB2] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1820 | |
| 1821 | /* usb3 */ |
| 1822 | clk = tegra_clk_register_periph_gate("usb3", "clk_m", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1823 | 0, 59, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1824 | clks[TEGRA114_CLK_USB3] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1825 | |
| 1826 | /* csi */ |
| 1827 | clk = tegra_clk_register_periph_gate("csi", "pll_p_out3", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1828 | 0, 52, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1829 | clks[TEGRA114_CLK_CSI] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1830 | |
| 1831 | /* isp */ |
| 1832 | clk = tegra_clk_register_periph_gate("isp", "clk_m", 0, clk_base, 0, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1833 | 23, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1834 | clks[TEGRA114_CLK_ISP] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1835 | |
| 1836 | /* csus */ |
| 1837 | clk = tegra_clk_register_periph_gate("csus", "clk_m", |
| 1838 | TEGRA_PERIPH_NO_RESET, clk_base, 0, 92, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1839 | periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1840 | clks[TEGRA114_CLK_CSUS] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1841 | |
| 1842 | /* dds */ |
| 1843 | clk = tegra_clk_register_periph_gate("dds", "clk_m", |
| 1844 | TEGRA_PERIPH_ON_APB, clk_base, 0, 150, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1845 | periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1846 | clks[TEGRA114_CLK_DDS] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1847 | |
| 1848 | /* dp2 */ |
| 1849 | clk = tegra_clk_register_periph_gate("dp2", "clk_m", |
| 1850 | TEGRA_PERIPH_ON_APB, clk_base, 0, 152, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1851 | periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1852 | clks[TEGRA114_CLK_DP2] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1853 | |
| 1854 | /* dtv */ |
| 1855 | clk = tegra_clk_register_periph_gate("dtv", "clk_m", |
| 1856 | TEGRA_PERIPH_ON_APB, clk_base, 0, 79, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1857 | periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1858 | clks[TEGRA114_CLK_DTV] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1859 | |
| 1860 | /* dsia */ |
| 1861 | clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1862 | ARRAY_SIZE(mux_plld_out0_plld2_out0), |
| 1863 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1864 | clk_base + PLLD_BASE, 25, 1, 0, &pll_d_lock); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1865 | clks[TEGRA114_CLK_DSIA_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1866 | clk = tegra_clk_register_periph_gate("dsia", "dsia_mux", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1867 | 0, 48, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1868 | clks[TEGRA114_CLK_DSIA] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1869 | |
| 1870 | /* dsib */ |
| 1871 | clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1872 | ARRAY_SIZE(mux_plld_out0_plld2_out0), |
| 1873 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1874 | clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1875 | clks[TEGRA114_CLK_DSIB_MUX] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1876 | clk = tegra_clk_register_periph_gate("dsib", "dsib_mux", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1877 | 0, 82, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1878 | clks[TEGRA114_CLK_DSIB] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1879 | |
| 1880 | /* xusb_hs_src */ |
| 1881 | val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC); |
| 1882 | val |= BIT(25); /* always select PLLU_60M */ |
| 1883 | writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC); |
| 1884 | |
| 1885 | clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0, |
| 1886 | 1, 1); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1887 | clks[TEGRA114_CLK_XUSB_HS_SRC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1888 | |
| 1889 | /* xusb_host */ |
| 1890 | clk = tegra_clk_register_periph_gate("xusb_host", "xusb_host_src", 0, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1891 | clk_base, 0, 89, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1892 | clks[TEGRA114_CLK_XUSB_HOST] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1893 | |
| 1894 | /* xusb_ss */ |
| 1895 | clk = tegra_clk_register_periph_gate("xusb_ss", "xusb_ss_src", 0, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1896 | clk_base, 0, 156, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1897 | clks[TEGRA114_CLK_XUSB_HOST] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1898 | |
| 1899 | /* xusb_dev */ |
| 1900 | clk = tegra_clk_register_periph_gate("xusb_dev", "xusb_dev_src", 0, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1901 | clk_base, 0, 95, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1902 | clks[TEGRA114_CLK_XUSB_DEV] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1903 | |
| 1904 | /* emc */ |
| 1905 | clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 1906 | ARRAY_SIZE(mux_pllmcp_clkm), |
| 1907 | CLK_SET_RATE_NO_REPARENT, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1908 | clk_base + CLK_SOURCE_EMC, |
| 1909 | 29, 3, 0, NULL); |
| 1910 | clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1911 | CLK_IGNORE_UNUSED, 57, periph_clk_enb_refcnt); |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1912 | clks[TEGRA114_CLK_EMC] = clk; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1913 | |
| 1914 | for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) { |
| 1915 | data = &tegra_periph_clk_list[i]; |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1916 | |
| 1917 | clk = tegra_clk_register_periph(data->name, |
| 1918 | data->parent_names, data->num_parents, &data->periph, |
| 1919 | clk_base, data->offset, data->flags); |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1920 | clks[data->clk_id] = clk; |
| 1921 | } |
| 1922 | |
| 1923 | for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) { |
| 1924 | data = &tegra_periph_nodiv_clk_list[i]; |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 1925 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1926 | clk = tegra_clk_register_periph_nodiv(data->name, |
| 1927 | data->parent_names, data->num_parents, |
| 1928 | &data->periph, clk_base, data->offset); |
| 1929 | clks[data->clk_id] = clk; |
| 1930 | } |
| 1931 | } |
| 1932 | |
Joseph Lo | 31972fd | 2013-05-20 18:39:28 +0800 | [diff] [blame] | 1933 | /* Tegra114 CPU clock and reset control functions */ |
| 1934 | static void tegra114_wait_cpu_in_reset(u32 cpu) |
| 1935 | { |
| 1936 | unsigned int reg; |
| 1937 | |
| 1938 | do { |
| 1939 | reg = readl(clk_base + CLK_RST_CONTROLLER_CPU_CMPLX_STATUS); |
| 1940 | cpu_relax(); |
| 1941 | } while (!(reg & (1 << cpu))); /* check CPU been reset or not */ |
| 1942 | } |
| 1943 | static void tegra114_disable_cpu_clock(u32 cpu) |
| 1944 | { |
| 1945 | /* flow controller would take care in the power sequence. */ |
| 1946 | } |
| 1947 | |
Joseph Lo | ad7d114 | 2013-07-03 17:50:44 +0800 | [diff] [blame] | 1948 | #ifdef CONFIG_PM_SLEEP |
| 1949 | static void tegra114_cpu_clock_suspend(void) |
| 1950 | { |
| 1951 | /* switch coresite to clk_m, save off original source */ |
| 1952 | tegra114_cpu_clk_sctx.clk_csite_src = |
| 1953 | readl(clk_base + CLK_SOURCE_CSITE); |
| 1954 | writel(3 << 30, clk_base + CLK_SOURCE_CSITE); |
Joseph Lo | 0017f44 | 2013-08-12 17:40:02 +0800 | [diff] [blame] | 1955 | |
| 1956 | tegra114_cpu_clk_sctx.cclkg_burst = |
| 1957 | readl(clk_base + CCLKG_BURST_POLICY); |
| 1958 | tegra114_cpu_clk_sctx.cclkg_divider = |
| 1959 | readl(clk_base + CCLKG_BURST_POLICY + 4); |
Joseph Lo | ad7d114 | 2013-07-03 17:50:44 +0800 | [diff] [blame] | 1960 | } |
| 1961 | |
| 1962 | static void tegra114_cpu_clock_resume(void) |
| 1963 | { |
| 1964 | writel(tegra114_cpu_clk_sctx.clk_csite_src, |
| 1965 | clk_base + CLK_SOURCE_CSITE); |
Joseph Lo | 0017f44 | 2013-08-12 17:40:02 +0800 | [diff] [blame] | 1966 | |
| 1967 | writel(tegra114_cpu_clk_sctx.cclkg_burst, |
| 1968 | clk_base + CCLKG_BURST_POLICY); |
| 1969 | writel(tegra114_cpu_clk_sctx.cclkg_divider, |
| 1970 | clk_base + CCLKG_BURST_POLICY + 4); |
Joseph Lo | ad7d114 | 2013-07-03 17:50:44 +0800 | [diff] [blame] | 1971 | } |
| 1972 | #endif |
| 1973 | |
Joseph Lo | 31972fd | 2013-05-20 18:39:28 +0800 | [diff] [blame] | 1974 | static struct tegra_cpu_car_ops tegra114_cpu_car_ops = { |
| 1975 | .wait_for_reset = tegra114_wait_cpu_in_reset, |
| 1976 | .disable_clock = tegra114_disable_cpu_clock, |
Joseph Lo | ad7d114 | 2013-07-03 17:50:44 +0800 | [diff] [blame] | 1977 | #ifdef CONFIG_PM_SLEEP |
| 1978 | .suspend = tegra114_cpu_clock_suspend, |
| 1979 | .resume = tegra114_cpu_clock_resume, |
| 1980 | #endif |
Joseph Lo | 31972fd | 2013-05-20 18:39:28 +0800 | [diff] [blame] | 1981 | }; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 1982 | |
| 1983 | static const struct of_device_id pmc_match[] __initconst = { |
| 1984 | { .compatible = "nvidia,tegra114-pmc" }, |
| 1985 | {}, |
| 1986 | }; |
| 1987 | |
Paul Walmsley | 9e60121 | 2013-06-07 06:19:01 -0600 | [diff] [blame] | 1988 | /* |
| 1989 | * dfll_soc/dfll_ref apparently must be kept enabled, otherwise I2C5 |
| 1990 | * breaks |
| 1991 | */ |
Sachin Kamat | 056dfcf | 2013-08-08 09:55:47 +0530 | [diff] [blame] | 1992 | static struct tegra_clk_init_table init_table[] __initdata = { |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 1993 | {TEGRA114_CLK_UARTA, TEGRA114_CLK_PLL_P, 408000000, 0}, |
| 1994 | {TEGRA114_CLK_UARTB, TEGRA114_CLK_PLL_P, 408000000, 0}, |
| 1995 | {TEGRA114_CLK_UARTC, TEGRA114_CLK_PLL_P, 408000000, 0}, |
| 1996 | {TEGRA114_CLK_UARTD, TEGRA114_CLK_PLL_P, 408000000, 0}, |
| 1997 | {TEGRA114_CLK_PLL_A, TEGRA114_CLK_CLK_MAX, 564480000, 1}, |
| 1998 | {TEGRA114_CLK_PLL_A_OUT0, TEGRA114_CLK_CLK_MAX, 11289600, 1}, |
| 1999 | {TEGRA114_CLK_EXTERN1, TEGRA114_CLK_PLL_A_OUT0, 0, 1}, |
| 2000 | {TEGRA114_CLK_CLK_OUT_1_MUX, TEGRA114_CLK_EXTERN1, 0, 1}, |
| 2001 | {TEGRA114_CLK_CLK_OUT_1, TEGRA114_CLK_CLK_MAX, 0, 1}, |
| 2002 | {TEGRA114_CLK_I2S0, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0}, |
| 2003 | {TEGRA114_CLK_I2S1, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0}, |
| 2004 | {TEGRA114_CLK_I2S2, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0}, |
| 2005 | {TEGRA114_CLK_I2S3, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0}, |
| 2006 | {TEGRA114_CLK_I2S4, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0}, |
Andrew Chew | 897e1dd | 2013-08-07 19:25:09 +0800 | [diff] [blame] | 2007 | {TEGRA114_CLK_HOST1X, TEGRA114_CLK_PLL_P, 136000000, 0}, |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 2008 | {TEGRA114_CLK_DFLL_SOC, TEGRA114_CLK_PLL_P, 51000000, 1}, |
| 2009 | {TEGRA114_CLK_DFLL_REF, TEGRA114_CLK_PLL_P, 51000000, 1}, |
Thierry Reding | f67a8d2 | 2013-10-02 23:12:40 +0200 | [diff] [blame] | 2010 | {TEGRA114_CLK_GR2D, TEGRA114_CLK_PLL_C2, 300000000, 0}, |
| 2011 | {TEGRA114_CLK_GR3D, TEGRA114_CLK_PLL_C2, 300000000, 0}, |
Mark Zhang | fc20eef | 2013-08-07 19:25:08 +0800 | [diff] [blame] | 2012 | |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 2013 | /* This MUST be the last entry. */ |
| 2014 | {TEGRA114_CLK_CLK_MAX, TEGRA114_CLK_CLK_MAX, 0, 0}, |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 2015 | }; |
| 2016 | |
| 2017 | static void __init tegra114_clock_apply_init_table(void) |
| 2018 | { |
Peter De Schrijver | c9e2d69 | 2013-08-22 15:27:46 +0300 | [diff] [blame] | 2019 | tegra_init_from_table(init_table, clks, TEGRA114_CLK_CLK_MAX); |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 2020 | } |
| 2021 | |
Paul Walmsley | 25c9ded | 2013-06-07 06:18:58 -0600 | [diff] [blame] | 2022 | |
| 2023 | /** |
| 2024 | * tegra114_car_barrier - wait for pending writes to the CAR to complete |
| 2025 | * |
| 2026 | * Wait for any outstanding writes to the CAR MMIO space from this CPU |
| 2027 | * to complete before continuing execution. No return value. |
| 2028 | */ |
| 2029 | static void tegra114_car_barrier(void) |
| 2030 | { |
| 2031 | wmb(); /* probably unnecessary */ |
| 2032 | readl_relaxed(clk_base + CPU_FINETRIM_SELECT); |
| 2033 | } |
| 2034 | |
| 2035 | /** |
| 2036 | * tegra114_clock_tune_cpu_trimmers_high - use high-voltage propagation delays |
| 2037 | * |
| 2038 | * When the CPU rail voltage is in the high-voltage range, use the |
| 2039 | * built-in hardwired clock propagation delays in the CPU clock |
| 2040 | * shaper. No return value. |
| 2041 | */ |
| 2042 | void tegra114_clock_tune_cpu_trimmers_high(void) |
| 2043 | { |
| 2044 | u32 select = 0; |
| 2045 | |
| 2046 | /* Use hardwired rise->rise & fall->fall clock propagation delays */ |
| 2047 | select |= ~(CPU_FINETRIM_1_FCPU_1 | CPU_FINETRIM_1_FCPU_2 | |
| 2048 | CPU_FINETRIM_1_FCPU_3 | CPU_FINETRIM_1_FCPU_4 | |
| 2049 | CPU_FINETRIM_1_FCPU_5 | CPU_FINETRIM_1_FCPU_6); |
| 2050 | writel_relaxed(select, clk_base + CPU_FINETRIM_SELECT); |
| 2051 | |
| 2052 | tegra114_car_barrier(); |
| 2053 | } |
| 2054 | EXPORT_SYMBOL(tegra114_clock_tune_cpu_trimmers_high); |
| 2055 | |
| 2056 | /** |
| 2057 | * tegra114_clock_tune_cpu_trimmers_low - use low-voltage propagation delays |
| 2058 | * |
| 2059 | * When the CPU rail voltage is in the low-voltage range, use the |
| 2060 | * extended clock propagation delays set by |
| 2061 | * tegra114_clock_tune_cpu_trimmers_init(). The intention is to |
| 2062 | * maintain the input clock duty cycle that the FCPU subsystem |
| 2063 | * expects. No return value. |
| 2064 | */ |
| 2065 | void tegra114_clock_tune_cpu_trimmers_low(void) |
| 2066 | { |
| 2067 | u32 select = 0; |
| 2068 | |
| 2069 | /* |
| 2070 | * Use software-specified rise->rise & fall->fall clock |
| 2071 | * propagation delays (from |
| 2072 | * tegra114_clock_tune_cpu_trimmers_init() |
| 2073 | */ |
| 2074 | select |= (CPU_FINETRIM_1_FCPU_1 | CPU_FINETRIM_1_FCPU_2 | |
| 2075 | CPU_FINETRIM_1_FCPU_3 | CPU_FINETRIM_1_FCPU_4 | |
| 2076 | CPU_FINETRIM_1_FCPU_5 | CPU_FINETRIM_1_FCPU_6); |
| 2077 | writel_relaxed(select, clk_base + CPU_FINETRIM_SELECT); |
| 2078 | |
| 2079 | tegra114_car_barrier(); |
| 2080 | } |
| 2081 | EXPORT_SYMBOL(tegra114_clock_tune_cpu_trimmers_low); |
| 2082 | |
| 2083 | /** |
| 2084 | * tegra114_clock_tune_cpu_trimmers_init - set up and enable clk prop delays |
| 2085 | * |
| 2086 | * Program extended clock propagation delays into the FCPU clock |
| 2087 | * shaper and enable them. XXX Define the purpose - peak current |
| 2088 | * reduction? No return value. |
| 2089 | */ |
| 2090 | /* XXX Initial voltage rail state assumption issues? */ |
| 2091 | void tegra114_clock_tune_cpu_trimmers_init(void) |
| 2092 | { |
| 2093 | u32 dr = 0, r = 0; |
| 2094 | |
| 2095 | /* Increment the rise->rise clock delay by four steps */ |
| 2096 | r |= (CPU_FINETRIM_R_FCPU_1_MASK | CPU_FINETRIM_R_FCPU_2_MASK | |
| 2097 | CPU_FINETRIM_R_FCPU_3_MASK | CPU_FINETRIM_R_FCPU_4_MASK | |
| 2098 | CPU_FINETRIM_R_FCPU_5_MASK | CPU_FINETRIM_R_FCPU_6_MASK); |
| 2099 | writel_relaxed(r, clk_base + CPU_FINETRIM_R); |
| 2100 | |
| 2101 | /* |
| 2102 | * Use the rise->rise clock propagation delay specified in the |
| 2103 | * r field |
| 2104 | */ |
| 2105 | dr |= (CPU_FINETRIM_1_FCPU_1 | CPU_FINETRIM_1_FCPU_2 | |
| 2106 | CPU_FINETRIM_1_FCPU_3 | CPU_FINETRIM_1_FCPU_4 | |
| 2107 | CPU_FINETRIM_1_FCPU_5 | CPU_FINETRIM_1_FCPU_6); |
| 2108 | writel_relaxed(dr, clk_base + CPU_FINETRIM_DR); |
| 2109 | |
| 2110 | tegra114_clock_tune_cpu_trimmers_low(); |
| 2111 | } |
| 2112 | EXPORT_SYMBOL(tegra114_clock_tune_cpu_trimmers_init); |
| 2113 | |
Paul Walmsley | 1c472d8 | 2013-06-07 06:19:09 -0600 | [diff] [blame] | 2114 | /** |
| 2115 | * tegra114_clock_assert_dfll_dvco_reset - assert the DFLL's DVCO reset |
| 2116 | * |
| 2117 | * Assert the reset line of the DFLL's DVCO. No return value. |
| 2118 | */ |
| 2119 | void tegra114_clock_assert_dfll_dvco_reset(void) |
| 2120 | { |
| 2121 | u32 v; |
| 2122 | |
| 2123 | v = readl_relaxed(clk_base + RST_DFLL_DVCO); |
| 2124 | v |= (1 << DVFS_DFLL_RESET_SHIFT); |
| 2125 | writel_relaxed(v, clk_base + RST_DFLL_DVCO); |
| 2126 | tegra114_car_barrier(); |
| 2127 | } |
| 2128 | EXPORT_SYMBOL(tegra114_clock_assert_dfll_dvco_reset); |
| 2129 | |
| 2130 | /** |
| 2131 | * tegra114_clock_deassert_dfll_dvco_reset - deassert the DFLL's DVCO reset |
| 2132 | * |
| 2133 | * Deassert the reset line of the DFLL's DVCO, allowing the DVCO to |
| 2134 | * operate. No return value. |
| 2135 | */ |
| 2136 | void tegra114_clock_deassert_dfll_dvco_reset(void) |
| 2137 | { |
| 2138 | u32 v; |
| 2139 | |
| 2140 | v = readl_relaxed(clk_base + RST_DFLL_DVCO); |
| 2141 | v &= ~(1 << DVFS_DFLL_RESET_SHIFT); |
| 2142 | writel_relaxed(v, clk_base + RST_DFLL_DVCO); |
| 2143 | tegra114_car_barrier(); |
| 2144 | } |
| 2145 | EXPORT_SYMBOL(tegra114_clock_deassert_dfll_dvco_reset); |
| 2146 | |
Prashant Gaikwad | 061cec9 | 2013-05-27 13:10:09 +0530 | [diff] [blame] | 2147 | static void __init tegra114_clock_init(struct device_node *np) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 2148 | { |
| 2149 | struct device_node *node; |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 2150 | |
| 2151 | clk_base = of_iomap(np, 0); |
| 2152 | if (!clk_base) { |
| 2153 | pr_err("ioremap tegra114 CAR failed\n"); |
| 2154 | return; |
| 2155 | } |
| 2156 | |
| 2157 | node = of_find_matching_node(NULL, pmc_match); |
| 2158 | if (!node) { |
| 2159 | pr_err("Failed to find pmc node\n"); |
| 2160 | WARN_ON(1); |
| 2161 | return; |
| 2162 | } |
| 2163 | |
| 2164 | pmc_base = of_iomap(node, 0); |
| 2165 | if (!pmc_base) { |
| 2166 | pr_err("Can't map pmc registers\n"); |
| 2167 | WARN_ON(1); |
| 2168 | return; |
| 2169 | } |
| 2170 | |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 2171 | clks = tegra_clk_init(TEGRA114_CLK_CLK_MAX, TEGRA114_CLK_PERIPH_BANKS); |
| 2172 | if (!clks) |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 2173 | return; |
| 2174 | |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 2175 | if (tegra114_osc_clk_init(clk_base) < 0) |
Peter De Schrijver | d5ff89a | 2013-08-22 18:44:06 +0300 | [diff] [blame] | 2176 | return; |
| 2177 | |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 2178 | tegra114_fixed_clk_init(clk_base); |
| 2179 | tegra114_pll_init(clk_base, pmc_base); |
| 2180 | tegra114_periph_clk_init(clk_base); |
| 2181 | tegra114_audio_clk_init(clk_base); |
| 2182 | tegra114_pmc_clk_init(pmc_base); |
| 2183 | tegra114_super_clk_init(clk_base); |
| 2184 | |
Peter De Schrijver | 343a607 | 2013-09-02 15:22:02 +0300 | [diff] [blame] | 2185 | tegra_add_of_provider(np); |
Peter De Schrijver | 2cb5efe | 2013-04-03 17:40:45 +0300 | [diff] [blame] | 2186 | |
| 2187 | tegra_clk_apply_init_table = tegra114_clock_apply_init_table; |
| 2188 | |
| 2189 | tegra_cpu_car_ops = &tegra114_cpu_car_ops; |
| 2190 | } |
Prashant Gaikwad | 061cec9 | 2013-05-27 13:10:09 +0530 | [diff] [blame] | 2191 | CLK_OF_DECLARE(tegra114, "nvidia,tegra114-car", tegra114_clock_init); |