Sricharan | 2e5ba48 | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Clock initialization for OMAP4 |
| 4 | * |
| 5 | * (C) Copyright 2010 |
| 6 | * Texas Instruments, <www.ti.com> |
| 7 | * |
| 8 | * Aneesh V <aneesh@ti.com> |
| 9 | * |
| 10 | * Based on previous work by: |
| 11 | * Santosh Shilimkar <santosh.shilimkar@ti.com> |
| 12 | * Rajendra Nayak <rnayak@ti.com> |
| 13 | * |
| 14 | * See file CREDITS for list of people who contributed to this |
| 15 | * project. |
| 16 | * |
| 17 | * This program is free software; you can redistribute it and/or |
| 18 | * modify it under the terms of the GNU General Public License as |
| 19 | * published by the Free Software Foundation; either version 2 of |
| 20 | * the License, or (at your option) any later version. |
| 21 | * |
| 22 | * This program is distributed in the hope that it will be useful, |
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 | * GNU General Public License for more details. |
| 26 | * |
| 27 | * You should have received a copy of the GNU General Public License |
| 28 | * along with this program; if not, write to the Free Software |
| 29 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 30 | * MA 02111-1307 USA |
| 31 | */ |
| 32 | #include <common.h> |
| 33 | #include <asm/omap_common.h> |
| 34 | #include <asm/gpio.h> |
| 35 | #include <asm/arch/clocks.h> |
| 36 | #include <asm/arch/sys_proto.h> |
| 37 | #include <asm/utils.h> |
| 38 | #include <asm/omap_gpio.h> |
| 39 | |
| 40 | #ifndef CONFIG_SPL_BUILD |
| 41 | /* |
| 42 | * printing to console doesn't work unless |
| 43 | * this code is executed from SPL |
| 44 | */ |
| 45 | #define printf(fmt, args...) |
| 46 | #define puts(s) |
| 47 | #endif |
| 48 | |
| 49 | #define abs(x) (((x) < 0) ? ((x)*-1) : (x)) |
| 50 | |
| 51 | struct omap4_prcm_regs *const prcm = (struct omap4_prcm_regs *)0x4A004100; |
| 52 | |
| 53 | const u32 sys_clk_array[8] = { |
| 54 | 12000000, /* 12 MHz */ |
| 55 | 13000000, /* 13 MHz */ |
| 56 | 16800000, /* 16.8 MHz */ |
| 57 | 19200000, /* 19.2 MHz */ |
| 58 | 26000000, /* 26 MHz */ |
| 59 | 27000000, /* 27 MHz */ |
| 60 | 38400000, /* 38.4 MHz */ |
| 61 | }; |
| 62 | |
| 63 | /* |
| 64 | * The M & N values in the following tables are created using the |
| 65 | * following tool: |
| 66 | * tools/omap/clocks_get_m_n.c |
| 67 | * Please use this tool for creating the table for any new frequency. |
| 68 | */ |
| 69 | |
Aneesh V | c8ff6a9 | 2012-02-06 05:07:43 +0000 | [diff] [blame^] | 70 | /* dpll locked at 1400 MHz MPU clk at 700 MHz(OPP100) - DCC OFF */ |
| 71 | static const struct dpll_params mpu_dpll_params_1400mhz[NUM_SYS_CLKS] = { |
| 72 | {175, 2, 1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 73 | {700, 12, 1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 74 | {125, 2, 1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 75 | {401, 10, 1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 76 | {350, 12, 1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 77 | {700, 26, 1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 78 | {638, 34, 1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
Sricharan | 2e5ba48 | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 79 | }; |
| 80 | |
| 81 | /* dpll locked at 1584 MHz - MPU clk at 792 MHz(OPP Turbo 4430) */ |
| 82 | static const struct dpll_params mpu_dpll_params_1600mhz[NUM_SYS_CLKS] = { |
| 83 | {200, 2, 1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 84 | {800, 12, 1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 85 | {619, 12, 1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 86 | {125, 2, 1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 87 | {400, 12, 1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 88 | {800, 26, 1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 89 | {125, 5, 1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
| 90 | }; |
| 91 | |
| 92 | /* dpll locked at 1200 MHz - MPU clk at 600 MHz */ |
| 93 | static const struct dpll_params mpu_dpll_params_1200mhz[NUM_SYS_CLKS] = { |
| 94 | {50, 0, 1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 95 | {600, 12, 1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 96 | {250, 6, 1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 97 | {125, 3, 1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 98 | {300, 12, 1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 99 | {200, 8, 1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 100 | {125, 7, 1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
| 101 | }; |
| 102 | |
| 103 | static const struct dpll_params core_dpll_params_1600mhz[NUM_SYS_CLKS] = { |
| 104 | {200, 2, 1, 5, 8, 4, 6, 5}, /* 12 MHz */ |
| 105 | {800, 12, 1, 5, 8, 4, 6, 5}, /* 13 MHz */ |
| 106 | {619, 12, 1, 5, 8, 4, 6, 5}, /* 16.8 MHz */ |
| 107 | {125, 2, 1, 5, 8, 4, 6, 5}, /* 19.2 MHz */ |
| 108 | {400, 12, 1, 5, 8, 4, 6, 5}, /* 26 MHz */ |
| 109 | {800, 26, 1, 5, 8, 4, 6, 5}, /* 27 MHz */ |
| 110 | {125, 5, 1, 5, 8, 4, 6, 5} /* 38.4 MHz */ |
| 111 | }; |
| 112 | |
| 113 | static const struct dpll_params core_dpll_params_es1_1524mhz[NUM_SYS_CLKS] = { |
| 114 | {127, 1, 1, 5, 8, 4, 6, 5}, /* 12 MHz */ |
| 115 | {762, 12, 1, 5, 8, 4, 6, 5}, /* 13 MHz */ |
| 116 | {635, 13, 1, 5, 8, 4, 6, 5}, /* 16.8 MHz */ |
| 117 | {635, 15, 1, 5, 8, 4, 6, 5}, /* 19.2 MHz */ |
| 118 | {381, 12, 1, 5, 8, 4, 6, 5}, /* 26 MHz */ |
| 119 | {254, 8, 1, 5, 8, 4, 6, 5}, /* 27 MHz */ |
| 120 | {496, 24, 1, 5, 8, 4, 6, 5} /* 38.4 MHz */ |
| 121 | }; |
| 122 | |
| 123 | static const struct dpll_params |
| 124 | core_dpll_params_es2_1600mhz_ddr200mhz[NUM_SYS_CLKS] = { |
| 125 | {200, 2, 2, 5, 8, 4, 6, 5}, /* 12 MHz */ |
| 126 | {800, 12, 2, 5, 8, 4, 6, 5}, /* 13 MHz */ |
| 127 | {619, 12, 2, 5, 8, 4, 6, 5}, /* 16.8 MHz */ |
| 128 | {125, 2, 2, 5, 8, 4, 6, 5}, /* 19.2 MHz */ |
| 129 | {400, 12, 2, 5, 8, 4, 6, 5}, /* 26 MHz */ |
| 130 | {800, 26, 2, 5, 8, 4, 6, 5}, /* 27 MHz */ |
| 131 | {125, 5, 2, 5, 8, 4, 6, 5} /* 38.4 MHz */ |
| 132 | }; |
| 133 | |
| 134 | static const struct dpll_params per_dpll_params_1536mhz[NUM_SYS_CLKS] = { |
| 135 | {64, 0, 8, 6, 12, 9, 4, 5}, /* 12 MHz */ |
| 136 | {768, 12, 8, 6, 12, 9, 4, 5}, /* 13 MHz */ |
| 137 | {320, 6, 8, 6, 12, 9, 4, 5}, /* 16.8 MHz */ |
| 138 | {40, 0, 8, 6, 12, 9, 4, 5}, /* 19.2 MHz */ |
| 139 | {384, 12, 8, 6, 12, 9, 4, 5}, /* 26 MHz */ |
| 140 | {256, 8, 8, 6, 12, 9, 4, 5}, /* 27 MHz */ |
| 141 | {20, 0, 8, 6, 12, 9, 4, 5} /* 38.4 MHz */ |
| 142 | }; |
| 143 | |
| 144 | static const struct dpll_params iva_dpll_params_1862mhz[NUM_SYS_CLKS] = { |
| 145 | {931, 11, -1, -1, 4, 7, -1, -1}, /* 12 MHz */ |
| 146 | {931, 12, -1, -1, 4, 7, -1, -1}, /* 13 MHz */ |
| 147 | {665, 11, -1, -1, 4, 7, -1, -1}, /* 16.8 MHz */ |
| 148 | {727, 14, -1, -1, 4, 7, -1, -1}, /* 19.2 MHz */ |
| 149 | {931, 25, -1, -1, 4, 7, -1, -1}, /* 26 MHz */ |
| 150 | {931, 26, -1, -1, 4, 7, -1, -1}, /* 27 MHz */ |
| 151 | {412, 16, -1, -1, 4, 7, -1, -1} /* 38.4 MHz */ |
| 152 | }; |
| 153 | |
| 154 | /* ABE M & N values with sys_clk as source */ |
| 155 | static const struct dpll_params |
| 156 | abe_dpll_params_sysclk_196608khz[NUM_SYS_CLKS] = { |
| 157 | {49, 5, 1, 1, -1, -1, -1, -1}, /* 12 MHz */ |
| 158 | {68, 8, 1, 1, -1, -1, -1, -1}, /* 13 MHz */ |
| 159 | {35, 5, 1, 1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 160 | {46, 8, 1, 1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 161 | {34, 8, 1, 1, -1, -1, -1, -1}, /* 26 MHz */ |
| 162 | {29, 7, 1, 1, -1, -1, -1, -1}, /* 27 MHz */ |
| 163 | {64, 24, 1, 1, -1, -1, -1, -1} /* 38.4 MHz */ |
| 164 | }; |
| 165 | |
| 166 | /* ABE M & N values with 32K clock as source */ |
| 167 | static const struct dpll_params abe_dpll_params_32k_196608khz = { |
| 168 | 750, 0, 1, 1, -1, -1, -1, -1 |
| 169 | }; |
| 170 | |
| 171 | static const struct dpll_params usb_dpll_params_1920mhz[NUM_SYS_CLKS] = { |
| 172 | {80, 0, 2, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 173 | {960, 12, 2, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 174 | {400, 6, 2, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 175 | {50, 0, 2, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 176 | {480, 12, 2, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 177 | {320, 8, 2, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 178 | {25, 0, 2, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
| 179 | }; |
| 180 | |
| 181 | void setup_post_dividers(u32 *const base, const struct dpll_params *params) |
| 182 | { |
| 183 | struct dpll_regs *const dpll_regs = (struct dpll_regs *)base; |
| 184 | |
| 185 | /* Setup post-dividers */ |
| 186 | if (params->m2 >= 0) |
| 187 | writel(params->m2, &dpll_regs->cm_div_m2_dpll); |
| 188 | if (params->m3 >= 0) |
| 189 | writel(params->m3, &dpll_regs->cm_div_m3_dpll); |
| 190 | if (params->m4 >= 0) |
| 191 | writel(params->m4, &dpll_regs->cm_div_m4_dpll); |
| 192 | if (params->m5 >= 0) |
| 193 | writel(params->m5, &dpll_regs->cm_div_m5_dpll); |
| 194 | if (params->m6 >= 0) |
| 195 | writel(params->m6, &dpll_regs->cm_div_m6_dpll); |
| 196 | if (params->m7 >= 0) |
| 197 | writel(params->m7, &dpll_regs->cm_div_m7_dpll); |
| 198 | } |
| 199 | |
| 200 | /* |
| 201 | * Lock MPU dpll |
| 202 | * |
| 203 | * Resulting MPU frequencies: |
| 204 | * 4430 ES1.0 : 600 MHz |
| 205 | * 4430 ES2.x : 792 MHz (OPP Turbo) |
| 206 | * 4460 : 920 MHz (OPP Turbo) - DCC disabled |
| 207 | */ |
| 208 | const struct dpll_params *get_mpu_dpll_params(void) |
| 209 | { |
| 210 | u32 omap_rev, sysclk_ind; |
| 211 | |
| 212 | omap_rev = omap_revision(); |
| 213 | sysclk_ind = get_sys_clk_index(); |
| 214 | |
| 215 | if (omap_rev == OMAP4430_ES1_0) |
| 216 | return &mpu_dpll_params_1200mhz[sysclk_ind]; |
| 217 | else if (omap_rev < OMAP4460_ES1_0) |
| 218 | return &mpu_dpll_params_1600mhz[sysclk_ind]; |
| 219 | else |
Aneesh V | c8ff6a9 | 2012-02-06 05:07:43 +0000 | [diff] [blame^] | 220 | return &mpu_dpll_params_1400mhz[sysclk_ind]; |
Sricharan | 2e5ba48 | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | const struct dpll_params *get_core_dpll_params(void) |
| 224 | { |
| 225 | u32 sysclk_ind = get_sys_clk_index(); |
| 226 | |
| 227 | switch (omap_revision()) { |
| 228 | case OMAP4430_ES1_0: |
| 229 | return &core_dpll_params_es1_1524mhz[sysclk_ind]; |
| 230 | case OMAP4430_ES2_0: |
| 231 | case OMAP4430_SILICON_ID_INVALID: |
| 232 | /* safest */ |
| 233 | return &core_dpll_params_es2_1600mhz_ddr200mhz[sysclk_ind]; |
| 234 | default: |
| 235 | return &core_dpll_params_1600mhz[sysclk_ind]; |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | |
| 240 | const struct dpll_params *get_per_dpll_params(void) |
| 241 | { |
| 242 | u32 sysclk_ind = get_sys_clk_index(); |
| 243 | return &per_dpll_params_1536mhz[sysclk_ind]; |
| 244 | } |
| 245 | |
| 246 | const struct dpll_params *get_iva_dpll_params(void) |
| 247 | { |
| 248 | u32 sysclk_ind = get_sys_clk_index(); |
| 249 | return &iva_dpll_params_1862mhz[sysclk_ind]; |
| 250 | } |
| 251 | |
| 252 | const struct dpll_params *get_usb_dpll_params(void) |
| 253 | { |
| 254 | u32 sysclk_ind = get_sys_clk_index(); |
| 255 | return &usb_dpll_params_1920mhz[sysclk_ind]; |
| 256 | } |
| 257 | |
| 258 | const struct dpll_params *get_abe_dpll_params(void) |
| 259 | { |
| 260 | #ifdef CONFIG_SYS_OMAP_ABE_SYSCK |
| 261 | u32 sysclk_ind = get_sys_clk_index(); |
| 262 | return &abe_dpll_params_sysclk_196608khz[sysclk_ind]; |
| 263 | #else |
| 264 | return &abe_dpll_params_32k_196608khz; |
| 265 | #endif |
| 266 | } |
| 267 | |
| 268 | /* |
| 269 | * Setup the voltages for vdd_mpu, vdd_core, and vdd_iva |
| 270 | * We set the maximum voltages allowed here because Smart-Reflex is not |
| 271 | * enabled in bootloader. Voltage initialization in the kernel will set |
| 272 | * these to the nominal values after enabling Smart-Reflex |
| 273 | */ |
| 274 | void scale_vcores(void) |
| 275 | { |
| 276 | u32 volt, omap_rev; |
| 277 | |
| 278 | setup_sri2c(); |
| 279 | |
| 280 | omap_rev = omap_revision(); |
| 281 | /* TPS - supplies vdd_mpu on 4460 */ |
| 282 | if (omap_rev >= OMAP4460_ES1_0) { |
Aneesh V | c8ff6a9 | 2012-02-06 05:07:43 +0000 | [diff] [blame^] | 283 | volt = 1203; |
Sricharan | 2e5ba48 | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 284 | do_scale_tps62361(TPS62361_REG_ADDR_SET1, volt); |
| 285 | } |
| 286 | |
| 287 | /* |
| 288 | * VCORE 1 |
| 289 | * |
| 290 | * 4430 : supplies vdd_mpu |
| 291 | * Setting a high voltage for Nitro mode as smart reflex is not enabled. |
| 292 | * We use the maximum possible value in the AVS range because the next |
| 293 | * higher voltage in the discrete range (code >= 0b111010) is way too |
| 294 | * high |
| 295 | * |
| 296 | * 4460 : supplies vdd_core |
| 297 | */ |
| 298 | if (omap_rev < OMAP4460_ES1_0) { |
| 299 | volt = 1325; |
| 300 | do_scale_vcore(SMPS_REG_ADDR_VCORE1, volt); |
| 301 | } else { |
| 302 | volt = 1200; |
| 303 | do_scale_vcore(SMPS_REG_ADDR_VCORE1, volt); |
| 304 | } |
| 305 | |
| 306 | /* VCORE 2 - supplies vdd_iva */ |
| 307 | volt = 1200; |
| 308 | do_scale_vcore(SMPS_REG_ADDR_VCORE2, volt); |
| 309 | |
| 310 | /* |
| 311 | * VCORE 3 |
| 312 | * 4430 : supplies vdd_core |
| 313 | * 4460 : not connected |
| 314 | */ |
| 315 | if (omap_rev < OMAP4460_ES1_0) { |
| 316 | volt = 1200; |
| 317 | do_scale_vcore(SMPS_REG_ADDR_VCORE3, volt); |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | /* |
| 322 | * Enable essential clock domains, modules and |
| 323 | * do some additional special settings needed |
| 324 | */ |
| 325 | void enable_basic_clocks(void) |
| 326 | { |
| 327 | u32 *const clk_domains_essential[] = { |
| 328 | &prcm->cm_l4per_clkstctrl, |
| 329 | &prcm->cm_l3init_clkstctrl, |
| 330 | &prcm->cm_memif_clkstctrl, |
| 331 | &prcm->cm_l4cfg_clkstctrl, |
| 332 | 0 |
| 333 | }; |
| 334 | |
| 335 | u32 *const clk_modules_hw_auto_essential[] = { |
Sricharan | 78f455c | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 336 | &prcm->cm_memif_emif_1_clkctrl, |
| 337 | &prcm->cm_memif_emif_2_clkctrl, |
| 338 | &prcm->cm_l4cfg_l4_cfg_clkctrl, |
Sricharan | 2e5ba48 | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 339 | &prcm->cm_wkup_gpio1_clkctrl, |
| 340 | &prcm->cm_l4per_gpio2_clkctrl, |
| 341 | &prcm->cm_l4per_gpio3_clkctrl, |
| 342 | &prcm->cm_l4per_gpio4_clkctrl, |
| 343 | &prcm->cm_l4per_gpio5_clkctrl, |
| 344 | &prcm->cm_l4per_gpio6_clkctrl, |
Govindraj.R | 95f8791 | 2012-02-06 03:55:35 +0000 | [diff] [blame] | 345 | &prcm->cm_l3init_usbphy_clkctrl, |
| 346 | &prcm->cm_clksel_usb_60mhz, |
| 347 | &prcm->cm_l3init_hsusbtll_clkctrl, |
Sricharan | 2e5ba48 | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 348 | 0 |
| 349 | }; |
| 350 | |
| 351 | u32 *const clk_modules_explicit_en_essential[] = { |
Sricharan | 78f455c | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 352 | &prcm->cm_wkup_gptimer1_clkctrl, |
Sricharan | 2e5ba48 | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 353 | &prcm->cm_l3init_hsmmc1_clkctrl, |
| 354 | &prcm->cm_l3init_hsmmc2_clkctrl, |
Sricharan | 78f455c | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 355 | &prcm->cm_l4per_gptimer2_clkctrl, |
Sricharan | 2e5ba48 | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 356 | &prcm->cm_wkup_wdtimer2_clkctrl, |
| 357 | &prcm->cm_l4per_uart3_clkctrl, |
Govindraj.R | 95f8791 | 2012-02-06 03:55:35 +0000 | [diff] [blame] | 358 | &prcm->cm_l3init_fsusb_clkctrl, |
| 359 | &prcm->cm_l3init_hsusbhost_clkctrl, |
Sricharan | 2e5ba48 | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 360 | 0 |
| 361 | }; |
| 362 | |
| 363 | /* Enable optional additional functional clock for GPIO4 */ |
| 364 | setbits_le32(&prcm->cm_l4per_gpio4_clkctrl, |
| 365 | GPIO4_CLKCTRL_OPTFCLKEN_MASK); |
| 366 | |
| 367 | /* Enable 96 MHz clock for MMC1 & MMC2 */ |
| 368 | setbits_le32(&prcm->cm_l3init_hsmmc1_clkctrl, |
| 369 | HSMMC_CLKCTRL_CLKSEL_MASK); |
| 370 | setbits_le32(&prcm->cm_l3init_hsmmc2_clkctrl, |
| 371 | HSMMC_CLKCTRL_CLKSEL_MASK); |
| 372 | |
| 373 | /* Select 32KHz clock as the source of GPTIMER1 */ |
| 374 | setbits_le32(&prcm->cm_wkup_gptimer1_clkctrl, |
| 375 | GPTIMER1_CLKCTRL_CLKSEL_MASK); |
| 376 | |
| 377 | /* Enable optional 48M functional clock for USB PHY */ |
| 378 | setbits_le32(&prcm->cm_l3init_usbphy_clkctrl, |
| 379 | USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK); |
| 380 | |
| 381 | do_enable_clocks(clk_domains_essential, |
| 382 | clk_modules_hw_auto_essential, |
| 383 | clk_modules_explicit_en_essential, |
| 384 | 1); |
| 385 | } |
| 386 | |
Sricharan | 78f455c | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 387 | void enable_basic_uboot_clocks(void) |
| 388 | { |
| 389 | u32 *const clk_domains_essential[] = { |
| 390 | 0 |
| 391 | }; |
| 392 | |
| 393 | u32 *const clk_modules_hw_auto_essential[] = { |
| 394 | &prcm->cm_l3init_hsusbotg_clkctrl, |
| 395 | &prcm->cm_l3init_usbphy_clkctrl, |
| 396 | 0 |
| 397 | }; |
| 398 | |
| 399 | u32 *const clk_modules_explicit_en_essential[] = { |
| 400 | &prcm->cm_l4per_mcspi1_clkctrl, |
| 401 | &prcm->cm_l4per_i2c1_clkctrl, |
| 402 | &prcm->cm_l4per_i2c2_clkctrl, |
| 403 | &prcm->cm_l4per_i2c3_clkctrl, |
| 404 | &prcm->cm_l4per_i2c4_clkctrl, |
| 405 | 0 |
| 406 | }; |
| 407 | |
| 408 | do_enable_clocks(clk_domains_essential, |
| 409 | clk_modules_hw_auto_essential, |
| 410 | clk_modules_explicit_en_essential, |
| 411 | 1); |
| 412 | } |
| 413 | |
Sricharan | 2e5ba48 | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 414 | /* |
| 415 | * Enable non-essential clock domains, modules and |
| 416 | * do some additional special settings needed |
| 417 | */ |
| 418 | void enable_non_essential_clocks(void) |
| 419 | { |
| 420 | u32 *const clk_domains_non_essential[] = { |
| 421 | &prcm->cm_mpu_m3_clkstctrl, |
| 422 | &prcm->cm_ivahd_clkstctrl, |
| 423 | &prcm->cm_dsp_clkstctrl, |
| 424 | &prcm->cm_dss_clkstctrl, |
| 425 | &prcm->cm_sgx_clkstctrl, |
| 426 | &prcm->cm1_abe_clkstctrl, |
| 427 | &prcm->cm_c2c_clkstctrl, |
| 428 | &prcm->cm_cam_clkstctrl, |
| 429 | &prcm->cm_dss_clkstctrl, |
| 430 | &prcm->cm_sdma_clkstctrl, |
| 431 | 0 |
| 432 | }; |
| 433 | |
| 434 | u32 *const clk_modules_hw_auto_non_essential[] = { |
| 435 | &prcm->cm_mpu_m3_mpu_m3_clkctrl, |
| 436 | &prcm->cm_ivahd_ivahd_clkctrl, |
| 437 | &prcm->cm_ivahd_sl2_clkctrl, |
| 438 | &prcm->cm_dsp_dsp_clkctrl, |
| 439 | &prcm->cm_l3_2_gpmc_clkctrl, |
| 440 | &prcm->cm_l3instr_l3_3_clkctrl, |
| 441 | &prcm->cm_l3instr_l3_instr_clkctrl, |
| 442 | &prcm->cm_l3instr_intrconn_wp1_clkctrl, |
| 443 | &prcm->cm_l3init_hsi_clkctrl, |
| 444 | &prcm->cm_l3init_hsusbtll_clkctrl, |
| 445 | 0 |
| 446 | }; |
| 447 | |
| 448 | u32 *const clk_modules_explicit_en_non_essential[] = { |
| 449 | &prcm->cm1_abe_aess_clkctrl, |
| 450 | &prcm->cm1_abe_pdm_clkctrl, |
| 451 | &prcm->cm1_abe_dmic_clkctrl, |
| 452 | &prcm->cm1_abe_mcasp_clkctrl, |
| 453 | &prcm->cm1_abe_mcbsp1_clkctrl, |
| 454 | &prcm->cm1_abe_mcbsp2_clkctrl, |
| 455 | &prcm->cm1_abe_mcbsp3_clkctrl, |
| 456 | &prcm->cm1_abe_slimbus_clkctrl, |
| 457 | &prcm->cm1_abe_timer5_clkctrl, |
| 458 | &prcm->cm1_abe_timer6_clkctrl, |
| 459 | &prcm->cm1_abe_timer7_clkctrl, |
| 460 | &prcm->cm1_abe_timer8_clkctrl, |
| 461 | &prcm->cm1_abe_wdt3_clkctrl, |
| 462 | &prcm->cm_l4per_gptimer9_clkctrl, |
| 463 | &prcm->cm_l4per_gptimer10_clkctrl, |
| 464 | &prcm->cm_l4per_gptimer11_clkctrl, |
| 465 | &prcm->cm_l4per_gptimer3_clkctrl, |
| 466 | &prcm->cm_l4per_gptimer4_clkctrl, |
| 467 | &prcm->cm_l4per_hdq1w_clkctrl, |
| 468 | &prcm->cm_l4per_mcbsp4_clkctrl, |
| 469 | &prcm->cm_l4per_mcspi2_clkctrl, |
| 470 | &prcm->cm_l4per_mcspi3_clkctrl, |
| 471 | &prcm->cm_l4per_mcspi4_clkctrl, |
| 472 | &prcm->cm_l4per_mmcsd3_clkctrl, |
| 473 | &prcm->cm_l4per_mmcsd4_clkctrl, |
| 474 | &prcm->cm_l4per_mmcsd5_clkctrl, |
| 475 | &prcm->cm_l4per_uart1_clkctrl, |
| 476 | &prcm->cm_l4per_uart2_clkctrl, |
| 477 | &prcm->cm_l4per_uart4_clkctrl, |
| 478 | &prcm->cm_wkup_keyboard_clkctrl, |
| 479 | &prcm->cm_wkup_wdtimer2_clkctrl, |
| 480 | &prcm->cm_cam_iss_clkctrl, |
| 481 | &prcm->cm_cam_fdif_clkctrl, |
| 482 | &prcm->cm_dss_dss_clkctrl, |
| 483 | &prcm->cm_sgx_sgx_clkctrl, |
| 484 | &prcm->cm_l3init_hsusbhost_clkctrl, |
| 485 | &prcm->cm_l3init_fsusb_clkctrl, |
| 486 | 0 |
| 487 | }; |
| 488 | |
| 489 | /* Enable optional functional clock for ISS */ |
| 490 | setbits_le32(&prcm->cm_cam_iss_clkctrl, ISS_CLKCTRL_OPTFCLKEN_MASK); |
| 491 | |
| 492 | /* Enable all optional functional clocks of DSS */ |
| 493 | setbits_le32(&prcm->cm_dss_dss_clkctrl, DSS_CLKCTRL_OPTFCLKEN_MASK); |
| 494 | |
| 495 | do_enable_clocks(clk_domains_non_essential, |
| 496 | clk_modules_hw_auto_non_essential, |
| 497 | clk_modules_explicit_en_non_essential, |
| 498 | 0); |
| 499 | |
| 500 | /* Put camera module in no sleep mode */ |
| 501 | clrsetbits_le32(&prcm->cm_cam_clkstctrl, MODULE_CLKCTRL_MODULEMODE_MASK, |
| 502 | CD_CLKCTRL_CLKTRCTRL_NO_SLEEP << |
| 503 | MODULE_CLKCTRL_MODULEMODE_SHIFT); |
| 504 | } |