Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Clock initialization for OMAP5 |
| 4 | * |
| 5 | * (C) Copyright 2010 |
| 6 | * Texas Instruments, <www.ti.com> |
| 7 | * |
| 8 | * Aneesh V <aneesh@ti.com> |
| 9 | * Sricharan R <r.sricharan@ti.com> |
| 10 | * |
| 11 | * Based on previous work by: |
| 12 | * Santosh Shilimkar <santosh.shilimkar@ti.com> |
| 13 | * Rajendra Nayak <rnayak@ti.com> |
| 14 | * |
| 15 | * See file CREDITS for list of people who contributed to this |
| 16 | * project. |
| 17 | * |
| 18 | * This program is free software; you can redistribute it and/or |
| 19 | * modify it under the terms of the GNU General Public License as |
| 20 | * published by the Free Software Foundation; either version 2 of |
| 21 | * the License, or (at your option) any later version. |
| 22 | * |
| 23 | * This program is distributed in the hope that it will be useful, |
| 24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 26 | * GNU General Public License for more details. |
| 27 | * |
| 28 | * You should have received a copy of the GNU General Public License |
| 29 | * along with this program; if not, write to the Free Software |
| 30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 31 | * MA 02111-1307 USA |
| 32 | */ |
| 33 | #include <common.h> |
| 34 | #include <asm/omap_common.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 | struct omap5_prcm_regs *const prcm = (struct omap5_prcm_regs *)0x4A004100; |
| 50 | |
| 51 | const u32 sys_clk_array[8] = { |
| 52 | 12000000, /* 12 MHz */ |
| 53 | 0, /* NA */ |
| 54 | 16800000, /* 16.8 MHz */ |
| 55 | 19200000, /* 19.2 MHz */ |
| 56 | 26000000, /* 26 MHz */ |
| 57 | 0, /* NA */ |
| 58 | 38400000, /* 38.4 MHz */ |
| 59 | }; |
| 60 | |
| 61 | static const struct dpll_params mpu_dpll_params_1_5ghz[NUM_SYS_CLKS] = { |
| 62 | {125, 0, 1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 63 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 64 | {625, 6, 1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 65 | {625, 7, 1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 66 | {750, 12, 1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 67 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 68 | {625, 15, 1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
| 69 | }; |
| 70 | |
| 71 | static const struct dpll_params mpu_dpll_params_2ghz[NUM_SYS_CLKS] = { |
| 72 | {500, 2, 1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 73 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 74 | {2024, 16, 1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 75 | {625, 5, 1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 76 | {1000, 12, 1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 77 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 78 | {625, 11, 1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
| 79 | }; |
| 80 | |
| 81 | static const struct dpll_params mpu_dpll_params_1100mhz[NUM_SYS_CLKS] = { |
| 82 | {275, 2, 1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 83 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 84 | {1375, 20, 1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 85 | {1375, 23, 1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 86 | {550, 12, 1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 87 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 88 | {1375, 47, 1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
| 89 | }; |
| 90 | |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 91 | static const struct dpll_params mpu_dpll_params_800mhz[NUM_SYS_CLKS] = { |
| 92 | {200, 2, 1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 93 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 94 | {1000, 20, 1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 95 | {375, 8, 1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 96 | {400, 12, 1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 97 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 98 | {375, 17, 1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
| 99 | }; |
| 100 | |
| 101 | static const struct dpll_params mpu_dpll_params_400mhz[NUM_SYS_CLKS] = { |
| 102 | {200, 2, 2, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 103 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 104 | {1000, 20, 2, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 105 | {375, 8, 2, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 106 | {400, 12, 2, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 107 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 108 | {375, 17, 2, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
| 109 | }; |
| 110 | |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 111 | static const struct dpll_params mpu_dpll_params_550mhz[NUM_SYS_CLKS] = { |
| 112 | {275, 2, 2, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 113 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 114 | {1375, 20, 2, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 115 | {1375, 23, 2, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 116 | {550, 12, 2, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 117 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 118 | {1375, 47, 2, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
| 119 | }; |
| 120 | |
| 121 | static const struct dpll_params |
| 122 | core_dpll_params_2128mhz_ddr532[NUM_SYS_CLKS] = { |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 123 | {266, 2, 2, 5, 8, 4, 62, 5, 5, 7}, /* 12 MHz */ |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 124 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 125 | {570, 8, 2, 5, 8, 4, 62, 5, 5, 7}, /* 16.8 MHz */ |
| 126 | {665, 11, 2, 5, 8, 4, 62, 5, 5, 7}, /* 19.2 MHz */ |
| 127 | {532, 12, 2, 5, 8, 4, 62, 5, 5, 7}, /* 26 MHz */ |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 128 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 129 | {665, 23, 2, 5, 8, 4, 62, 5, 5, 7} /* 38.4 MHz */ |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | static const struct dpll_params |
| 133 | core_dpll_params_2128mhz_ddr266[NUM_SYS_CLKS] = { |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 134 | {266, 2, 4, 5, 8, 8, 62, 10, 10, 14}, /* 12 MHz */ |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 135 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 136 | {570, 8, 4, 5, 8, 8, 62, 10, 10, 14}, /* 16.8 MHz */ |
| 137 | {665, 11, 4, 5, 8, 8, 62, 10, 10, 14}, /* 19.2 MHz */ |
| 138 | {532, 12, 4, 8, 8, 8, 62, 10, 10, 14}, /* 26 MHz */ |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 139 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 140 | {665, 23, 4, 8, 8, 8, 62, 10, 10, 14} /* 38.4 MHz */ |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 141 | }; |
| 142 | |
| 143 | static const struct dpll_params per_dpll_params_768mhz[NUM_SYS_CLKS] = { |
| 144 | {32, 0, 4, 3, 6, 4, -1, 2, -1, -1}, /* 12 MHz */ |
| 145 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 146 | {160, 6, 4, 3, 6, 4, -1, 2, -1, -1}, /* 16.8 MHz */ |
| 147 | {20, 0, 4, 3, 6, 4, -1, 2, -1, -1}, /* 19.2 MHz */ |
| 148 | {192, 12, 4, 3, 6, 4, -1, 2, -1, -1}, /* 26 MHz */ |
| 149 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 150 | {10, 0, 4, 3, 6, 4, -1, 2, -1, -1} /* 38.4 MHz */ |
| 151 | }; |
| 152 | |
| 153 | static const struct dpll_params iva_dpll_params_2330mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 154 | {1165, 11, -1, -1, 5, 6, -1, -1, -1, -1}, /* 12 MHz */ |
| 155 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 156 | {2011, 28, -1, -1, 5, 6, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 157 | {1881, 30, -1, -1, 5, 6, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 158 | {1165, 25, -1, -1, 5, 6, -1, -1, -1, -1}, /* 26 MHz */ |
| 159 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 160 | {1972, 64, -1, -1, 5, 6, -1, -1, -1, -1} /* 38.4 MHz */ |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 161 | }; |
| 162 | |
| 163 | /* ABE M & N values with sys_clk as source */ |
| 164 | static const struct dpll_params |
| 165 | abe_dpll_params_sysclk_196608khz[NUM_SYS_CLKS] = { |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 166 | {49, 5, 1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 167 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 168 | {35, 5, 1, 1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 169 | {46, 8, 1, 1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 170 | {34, 8, 1, 1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 171 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 172 | {64, 24, 1, 1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 173 | }; |
| 174 | |
| 175 | /* ABE M & N values with 32K clock as source */ |
| 176 | static const struct dpll_params abe_dpll_params_32k_196608khz = { |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 177 | 750, 0, 1, 1, -1, -1, -1, -1, -1, -1 |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 178 | }; |
| 179 | |
| 180 | static const struct dpll_params usb_dpll_params_1920mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 181 | {400, 4, 2, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 182 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 183 | {400, 6, 2, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 184 | {400, 7, 2, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 185 | {480, 12, 2, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 186 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 187 | {400, 15, 2, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 188 | }; |
| 189 | |
| 190 | void setup_post_dividers(u32 *const base, const struct dpll_params *params) |
| 191 | { |
| 192 | struct dpll_regs *const dpll_regs = (struct dpll_regs *)base; |
| 193 | |
| 194 | /* Setup post-dividers */ |
| 195 | if (params->m2 >= 0) |
| 196 | writel(params->m2, &dpll_regs->cm_div_m2_dpll); |
| 197 | if (params->m3 >= 0) |
| 198 | writel(params->m3, &dpll_regs->cm_div_m3_dpll); |
| 199 | if (params->h11 >= 0) |
| 200 | writel(params->h11, &dpll_regs->cm_div_h11_dpll); |
| 201 | if (params->h12 >= 0) |
| 202 | writel(params->h12, &dpll_regs->cm_div_h12_dpll); |
| 203 | if (params->h13 >= 0) |
| 204 | writel(params->h13, &dpll_regs->cm_div_h13_dpll); |
| 205 | if (params->h14 >= 0) |
| 206 | writel(params->h14, &dpll_regs->cm_div_h14_dpll); |
| 207 | if (params->h22 >= 0) |
| 208 | writel(params->h22, &dpll_regs->cm_div_h22_dpll); |
| 209 | if (params->h23 >= 0) |
| 210 | writel(params->h23, &dpll_regs->cm_div_h23_dpll); |
| 211 | } |
| 212 | |
| 213 | const struct dpll_params *get_mpu_dpll_params(void) |
| 214 | { |
| 215 | u32 sysclk_ind = get_sys_clk_index(); |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 216 | return &mpu_dpll_params_800mhz[sysclk_ind]; |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | const struct dpll_params *get_core_dpll_params(void) |
| 220 | { |
| 221 | u32 sysclk_ind = get_sys_clk_index(); |
| 222 | |
| 223 | /* Configuring the DDR to be at 532mhz */ |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 224 | return &core_dpll_params_2128mhz_ddr532[sysclk_ind]; |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | const struct dpll_params *get_per_dpll_params(void) |
| 228 | { |
| 229 | u32 sysclk_ind = get_sys_clk_index(); |
| 230 | return &per_dpll_params_768mhz[sysclk_ind]; |
| 231 | } |
| 232 | |
| 233 | const struct dpll_params *get_iva_dpll_params(void) |
| 234 | { |
| 235 | u32 sysclk_ind = get_sys_clk_index(); |
| 236 | return &iva_dpll_params_2330mhz[sysclk_ind]; |
| 237 | } |
| 238 | |
| 239 | const struct dpll_params *get_usb_dpll_params(void) |
| 240 | { |
| 241 | u32 sysclk_ind = get_sys_clk_index(); |
| 242 | return &usb_dpll_params_1920mhz[sysclk_ind]; |
| 243 | } |
| 244 | |
| 245 | const struct dpll_params *get_abe_dpll_params(void) |
| 246 | { |
| 247 | #ifdef CONFIG_SYS_OMAP_ABE_SYSCK |
| 248 | u32 sysclk_ind = get_sys_clk_index(); |
| 249 | return &abe_dpll_params_sysclk_196608khz[sysclk_ind]; |
| 250 | #else |
| 251 | return &abe_dpll_params_32k_196608khz; |
| 252 | #endif |
| 253 | } |
| 254 | |
| 255 | /* |
| 256 | * Setup the voltages for vdd_mpu, vdd_core, and vdd_iva |
| 257 | * We set the maximum voltages allowed here because Smart-Reflex is not |
| 258 | * enabled in bootloader. Voltage initialization in the kernel will set |
| 259 | * these to the nominal values after enabling Smart-Reflex |
| 260 | */ |
| 261 | void scale_vcores(void) |
| 262 | { |
| 263 | u32 volt; |
| 264 | |
Nishanth Menon | 41d7ab1 | 2012-03-01 14:17:37 +0000 | [diff] [blame] | 265 | omap_vc_init(PRM_VC_I2C_CHANNEL_FREQ_KHZ); |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 266 | |
| 267 | /* Enable 1.22V from TPS for vdd_mpu */ |
| 268 | volt = 1220; |
Nishanth Menon | a0f45c1 | 2012-03-01 14:17:38 +0000 | [diff] [blame] | 269 | do_scale_tps62361(-1, TPS62361_REG_ADDR_SET1, volt); |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 270 | |
| 271 | /* VCORE 1 - for vdd_core */ |
| 272 | volt = 1000; |
| 273 | do_scale_vcore(SMPS_REG_ADDR_VCORE1, volt); |
| 274 | |
| 275 | /* VCORE 2 - for vdd_MM */ |
| 276 | volt = 1125; |
| 277 | do_scale_vcore(SMPS_REG_ADDR_VCORE2, volt); |
| 278 | } |
| 279 | |
| 280 | /* |
| 281 | * Enable essential clock domains, modules and |
| 282 | * do some additional special settings needed |
| 283 | */ |
| 284 | void enable_basic_clocks(void) |
| 285 | { |
| 286 | u32 *const clk_domains_essential[] = { |
| 287 | &prcm->cm_l4per_clkstctrl, |
| 288 | &prcm->cm_l3init_clkstctrl, |
| 289 | &prcm->cm_memif_clkstctrl, |
| 290 | &prcm->cm_l4cfg_clkstctrl, |
| 291 | 0 |
| 292 | }; |
| 293 | |
| 294 | u32 *const clk_modules_hw_auto_essential[] = { |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 295 | &prcm->cm_memif_emif_1_clkctrl, |
| 296 | &prcm->cm_memif_emif_2_clkctrl, |
| 297 | &prcm->cm_l4cfg_l4_cfg_clkctrl, |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 298 | &prcm->cm_wkup_gpio1_clkctrl, |
| 299 | &prcm->cm_l4per_gpio2_clkctrl, |
| 300 | &prcm->cm_l4per_gpio3_clkctrl, |
| 301 | &prcm->cm_l4per_gpio4_clkctrl, |
| 302 | &prcm->cm_l4per_gpio5_clkctrl, |
| 303 | &prcm->cm_l4per_gpio6_clkctrl, |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 304 | 0 |
| 305 | }; |
| 306 | |
| 307 | u32 *const clk_modules_explicit_en_essential[] = { |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 308 | &prcm->cm_wkup_gptimer1_clkctrl, |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 309 | &prcm->cm_l3init_hsmmc1_clkctrl, |
| 310 | &prcm->cm_l3init_hsmmc2_clkctrl, |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 311 | &prcm->cm_l4per_gptimer2_clkctrl, |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 312 | &prcm->cm_wkup_wdtimer2_clkctrl, |
| 313 | &prcm->cm_l4per_uart3_clkctrl, |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 314 | &prcm->cm_l4per_i2c1_clkctrl, |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 315 | 0 |
| 316 | }; |
| 317 | |
| 318 | /* Enable optional additional functional clock for GPIO4 */ |
| 319 | setbits_le32(&prcm->cm_l4per_gpio4_clkctrl, |
| 320 | GPIO4_CLKCTRL_OPTFCLKEN_MASK); |
| 321 | |
| 322 | /* Enable 96 MHz clock for MMC1 & MMC2 */ |
| 323 | setbits_le32(&prcm->cm_l3init_hsmmc1_clkctrl, |
| 324 | HSMMC_CLKCTRL_CLKSEL_MASK); |
| 325 | setbits_le32(&prcm->cm_l3init_hsmmc2_clkctrl, |
| 326 | HSMMC_CLKCTRL_CLKSEL_MASK); |
| 327 | |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 328 | /* Set the correct clock dividers for mmc */ |
| 329 | setbits_le32(&prcm->cm_l3init_hsmmc1_clkctrl, |
| 330 | HSMMC_CLKCTRL_CLKSEL_DIV_MASK); |
| 331 | setbits_le32(&prcm->cm_l3init_hsmmc2_clkctrl, |
| 332 | HSMMC_CLKCTRL_CLKSEL_DIV_MASK); |
| 333 | |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 334 | /* Select 32KHz clock as the source of GPTIMER1 */ |
| 335 | setbits_le32(&prcm->cm_wkup_gptimer1_clkctrl, |
| 336 | GPTIMER1_CLKCTRL_CLKSEL_MASK); |
| 337 | |
| 338 | do_enable_clocks(clk_domains_essential, |
| 339 | clk_modules_hw_auto_essential, |
| 340 | clk_modules_explicit_en_essential, |
| 341 | 1); |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 342 | |
| 343 | /* Select 384Mhz for GPU as its the POR for ES1.0 */ |
| 344 | setbits_le32(&prcm->cm_sgx_sgx_clkctrl, |
| 345 | CLKSEL_GPU_HYD_GCLK_MASK); |
| 346 | setbits_le32(&prcm->cm_sgx_sgx_clkctrl, |
| 347 | CLKSEL_GPU_CORE_GCLK_MASK); |
| 348 | |
| 349 | /* Enable SCRM OPT clocks for PER and CORE dpll */ |
| 350 | setbits_le32(&prcm->cm_wkupaon_scrm_clkctrl, |
| 351 | OPTFCLKEN_SCRM_PER_MASK); |
| 352 | setbits_le32(&prcm->cm_wkupaon_scrm_clkctrl, |
| 353 | OPTFCLKEN_SCRM_CORE_MASK); |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 354 | } |
| 355 | |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 356 | void enable_basic_uboot_clocks(void) |
| 357 | { |
| 358 | u32 *const clk_domains_essential[] = { |
| 359 | 0 |
| 360 | }; |
| 361 | |
| 362 | u32 *const clk_modules_hw_auto_essential[] = { |
| 363 | 0 |
| 364 | }; |
| 365 | |
| 366 | u32 *const clk_modules_explicit_en_essential[] = { |
| 367 | &prcm->cm_l4per_mcspi1_clkctrl, |
| 368 | &prcm->cm_l4per_i2c2_clkctrl, |
| 369 | &prcm->cm_l4per_i2c3_clkctrl, |
| 370 | &prcm->cm_l4per_i2c4_clkctrl, |
| 371 | 0 |
| 372 | }; |
| 373 | |
| 374 | do_enable_clocks(clk_domains_essential, |
| 375 | clk_modules_hw_auto_essential, |
| 376 | clk_modules_explicit_en_essential, |
| 377 | 1); |
| 378 | } |
| 379 | |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 380 | /* |
| 381 | * Enable non-essential clock domains, modules and |
| 382 | * do some additional special settings needed |
| 383 | */ |
| 384 | void enable_non_essential_clocks(void) |
| 385 | { |
| 386 | u32 *const clk_domains_non_essential[] = { |
| 387 | &prcm->cm_mpu_m3_clkstctrl, |
| 388 | &prcm->cm_ivahd_clkstctrl, |
| 389 | &prcm->cm_dsp_clkstctrl, |
| 390 | &prcm->cm_dss_clkstctrl, |
| 391 | &prcm->cm_sgx_clkstctrl, |
| 392 | &prcm->cm1_abe_clkstctrl, |
| 393 | &prcm->cm_c2c_clkstctrl, |
| 394 | &prcm->cm_cam_clkstctrl, |
| 395 | &prcm->cm_dss_clkstctrl, |
| 396 | &prcm->cm_sdma_clkstctrl, |
| 397 | 0 |
| 398 | }; |
| 399 | |
| 400 | u32 *const clk_modules_hw_auto_non_essential[] = { |
| 401 | &prcm->cm_mpu_m3_mpu_m3_clkctrl, |
| 402 | &prcm->cm_ivahd_ivahd_clkctrl, |
| 403 | &prcm->cm_ivahd_sl2_clkctrl, |
| 404 | &prcm->cm_dsp_dsp_clkctrl, |
| 405 | &prcm->cm_l3_2_gpmc_clkctrl, |
| 406 | &prcm->cm_l3instr_l3_3_clkctrl, |
| 407 | &prcm->cm_l3instr_l3_instr_clkctrl, |
| 408 | &prcm->cm_l3instr_intrconn_wp1_clkctrl, |
| 409 | &prcm->cm_l3init_hsi_clkctrl, |
| 410 | &prcm->cm_l3init_hsusbtll_clkctrl, |
SRICHARAN R | b1ee0bc | 2012-03-12 02:25:34 +0000 | [diff] [blame^] | 411 | &prcm->cm_l4per_hdq1w_clkctrl, |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 412 | 0 |
| 413 | }; |
| 414 | |
| 415 | u32 *const clk_modules_explicit_en_non_essential[] = { |
| 416 | &prcm->cm1_abe_aess_clkctrl, |
| 417 | &prcm->cm1_abe_pdm_clkctrl, |
| 418 | &prcm->cm1_abe_dmic_clkctrl, |
| 419 | &prcm->cm1_abe_mcasp_clkctrl, |
| 420 | &prcm->cm1_abe_mcbsp1_clkctrl, |
| 421 | &prcm->cm1_abe_mcbsp2_clkctrl, |
| 422 | &prcm->cm1_abe_mcbsp3_clkctrl, |
| 423 | &prcm->cm1_abe_slimbus_clkctrl, |
| 424 | &prcm->cm1_abe_timer5_clkctrl, |
| 425 | &prcm->cm1_abe_timer6_clkctrl, |
| 426 | &prcm->cm1_abe_timer7_clkctrl, |
| 427 | &prcm->cm1_abe_timer8_clkctrl, |
| 428 | &prcm->cm1_abe_wdt3_clkctrl, |
| 429 | &prcm->cm_l4per_gptimer9_clkctrl, |
| 430 | &prcm->cm_l4per_gptimer10_clkctrl, |
| 431 | &prcm->cm_l4per_gptimer11_clkctrl, |
| 432 | &prcm->cm_l4per_gptimer3_clkctrl, |
| 433 | &prcm->cm_l4per_gptimer4_clkctrl, |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 434 | &prcm->cm_l4per_mcspi2_clkctrl, |
| 435 | &prcm->cm_l4per_mcspi3_clkctrl, |
| 436 | &prcm->cm_l4per_mcspi4_clkctrl, |
| 437 | &prcm->cm_l4per_mmcsd3_clkctrl, |
| 438 | &prcm->cm_l4per_mmcsd4_clkctrl, |
| 439 | &prcm->cm_l4per_mmcsd5_clkctrl, |
| 440 | &prcm->cm_l4per_uart1_clkctrl, |
| 441 | &prcm->cm_l4per_uart2_clkctrl, |
| 442 | &prcm->cm_l4per_uart4_clkctrl, |
| 443 | &prcm->cm_wkup_keyboard_clkctrl, |
| 444 | &prcm->cm_wkup_wdtimer2_clkctrl, |
| 445 | &prcm->cm_cam_iss_clkctrl, |
| 446 | &prcm->cm_cam_fdif_clkctrl, |
| 447 | &prcm->cm_dss_dss_clkctrl, |
| 448 | &prcm->cm_sgx_sgx_clkctrl, |
| 449 | &prcm->cm_l3init_hsusbhost_clkctrl, |
| 450 | &prcm->cm_l3init_fsusb_clkctrl, |
| 451 | 0 |
| 452 | }; |
| 453 | |
| 454 | /* Enable optional functional clock for ISS */ |
| 455 | setbits_le32(&prcm->cm_cam_iss_clkctrl, ISS_CLKCTRL_OPTFCLKEN_MASK); |
| 456 | |
| 457 | /* Enable all optional functional clocks of DSS */ |
| 458 | setbits_le32(&prcm->cm_dss_dss_clkctrl, DSS_CLKCTRL_OPTFCLKEN_MASK); |
| 459 | |
| 460 | do_enable_clocks(clk_domains_non_essential, |
| 461 | clk_modules_hw_auto_non_essential, |
| 462 | clk_modules_explicit_en_non_essential, |
| 463 | 0); |
| 464 | |
| 465 | /* Put camera module in no sleep mode */ |
| 466 | clrsetbits_le32(&prcm->cm_cam_clkstctrl, MODULE_CLKCTRL_MODULEMODE_MASK, |
| 467 | CD_CLKCTRL_CLKTRCTRL_NO_SLEEP << |
| 468 | MODULE_CLKCTRL_MODULEMODE_SHIFT); |
| 469 | } |