Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [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 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 14 | * SPDX-License-Identifier: GPL-2.0+ |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 15 | */ |
| 16 | #include <common.h> |
Lokesh Vutla | 3685297 | 2013-05-30 03:19:29 +0000 | [diff] [blame] | 17 | #include <i2c.h> |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 18 | #include <asm/omap_common.h> |
Sanjeev Premi | 0c2c8ac | 2011-09-08 10:48:39 -0400 | [diff] [blame] | 19 | #include <asm/gpio.h> |
Lokesh Vutla | 61c517f | 2013-05-30 02:54:32 +0000 | [diff] [blame] | 20 | #include <asm/arch/clock.h> |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 21 | #include <asm/arch/sys_proto.h> |
| 22 | #include <asm/utils.h> |
Aneesh V | 0fa1d1b | 2011-07-21 09:29:32 -0400 | [diff] [blame] | 23 | #include <asm/omap_gpio.h> |
Lokesh Vutla | fef54c3 | 2013-02-04 04:21:59 +0000 | [diff] [blame] | 24 | #include <asm/emif.h> |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 25 | |
| 26 | #ifndef CONFIG_SPL_BUILD |
| 27 | /* |
| 28 | * printing to console doesn't work unless |
| 29 | * this code is executed from SPL |
| 30 | */ |
| 31 | #define printf(fmt, args...) |
| 32 | #define puts(s) |
| 33 | #endif |
| 34 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 35 | const u32 sys_clk_array[8] = { |
| 36 | 12000000, /* 12 MHz */ |
Lokesh Vutla | 1652326 | 2013-05-30 03:19:38 +0000 | [diff] [blame] | 37 | 20000000, /* 20 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 38 | 16800000, /* 16.8 MHz */ |
| 39 | 19200000, /* 19.2 MHz */ |
| 40 | 26000000, /* 26 MHz */ |
| 41 | 27000000, /* 27 MHz */ |
| 42 | 38400000, /* 38.4 MHz */ |
| 43 | }; |
| 44 | |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 45 | static inline u32 __get_sys_clk_index(void) |
| 46 | { |
Lokesh Vutla | 5e70e29 | 2013-02-12 21:29:05 +0000 | [diff] [blame] | 47 | s8 ind; |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 48 | /* |
| 49 | * For ES1 the ROM code calibration of sys clock is not reliable |
| 50 | * due to hw issue. So, use hard-coded value. If this value is not |
| 51 | * correct for any board over-ride this function in board file |
| 52 | * From ES2.0 onwards you will get this information from |
| 53 | * CM_SYS_CLKSEL |
| 54 | */ |
| 55 | if (omap_revision() == OMAP4430_ES1_0) |
| 56 | ind = OMAP_SYS_CLK_IND_38_4_MHZ; |
| 57 | else { |
| 58 | /* SYS_CLKSEL - 1 to match the dpll param array indices */ |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 59 | ind = (readl((*prcm)->cm_sys_clksel) & |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 60 | CM_SYS_CLKSEL_SYS_CLKSEL_MASK) - 1; |
| 61 | } |
| 62 | return ind; |
| 63 | } |
| 64 | |
| 65 | u32 get_sys_clk_index(void) |
| 66 | __attribute__ ((weak, alias("__get_sys_clk_index"))); |
| 67 | |
| 68 | u32 get_sys_clk_freq(void) |
| 69 | { |
| 70 | u8 index = get_sys_clk_index(); |
| 71 | return sys_clk_array[index]; |
| 72 | } |
| 73 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 74 | void setup_post_dividers(u32 const base, const struct dpll_params *params) |
| 75 | { |
| 76 | struct dpll_regs *const dpll_regs = (struct dpll_regs *)base; |
| 77 | |
| 78 | /* Setup post-dividers */ |
| 79 | if (params->m2 >= 0) |
| 80 | writel(params->m2, &dpll_regs->cm_div_m2_dpll); |
| 81 | if (params->m3 >= 0) |
| 82 | writel(params->m3, &dpll_regs->cm_div_m3_dpll); |
| 83 | if (params->m4_h11 >= 0) |
| 84 | writel(params->m4_h11, &dpll_regs->cm_div_m4_h11_dpll); |
| 85 | if (params->m5_h12 >= 0) |
| 86 | writel(params->m5_h12, &dpll_regs->cm_div_m5_h12_dpll); |
| 87 | if (params->m6_h13 >= 0) |
| 88 | writel(params->m6_h13, &dpll_regs->cm_div_m6_h13_dpll); |
| 89 | if (params->m7_h14 >= 0) |
| 90 | writel(params->m7_h14, &dpll_regs->cm_div_m7_h14_dpll); |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 91 | if (params->h21 >= 0) |
| 92 | writel(params->h21, &dpll_regs->cm_div_h21_dpll); |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 93 | if (params->h22 >= 0) |
| 94 | writel(params->h22, &dpll_regs->cm_div_h22_dpll); |
| 95 | if (params->h23 >= 0) |
| 96 | writel(params->h23, &dpll_regs->cm_div_h23_dpll); |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 97 | if (params->h24 >= 0) |
| 98 | writel(params->h24, &dpll_regs->cm_div_h24_dpll); |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 99 | } |
| 100 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 101 | static inline void do_bypass_dpll(u32 const base) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 102 | { |
| 103 | struct dpll_regs *dpll_regs = (struct dpll_regs *)base; |
| 104 | |
| 105 | clrsetbits_le32(&dpll_regs->cm_clkmode_dpll, |
| 106 | CM_CLKMODE_DPLL_DPLL_EN_MASK, |
| 107 | DPLL_EN_FAST_RELOCK_BYPASS << |
| 108 | CM_CLKMODE_DPLL_EN_SHIFT); |
| 109 | } |
| 110 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 111 | static inline void wait_for_bypass(u32 const base) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 112 | { |
| 113 | struct dpll_regs *const dpll_regs = (struct dpll_regs *)base; |
| 114 | |
| 115 | if (!wait_on_value(ST_DPLL_CLK_MASK, 0, &dpll_regs->cm_idlest_dpll, |
| 116 | LDELAY)) { |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 117 | printf("Bypassing DPLL failed %x\n", base); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 118 | } |
| 119 | } |
| 120 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 121 | static inline void do_lock_dpll(u32 const base) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 122 | { |
| 123 | struct dpll_regs *const dpll_regs = (struct dpll_regs *)base; |
| 124 | |
| 125 | clrsetbits_le32(&dpll_regs->cm_clkmode_dpll, |
| 126 | CM_CLKMODE_DPLL_DPLL_EN_MASK, |
| 127 | DPLL_EN_LOCK << CM_CLKMODE_DPLL_EN_SHIFT); |
| 128 | } |
| 129 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 130 | static inline void wait_for_lock(u32 const base) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 131 | { |
| 132 | struct dpll_regs *const dpll_regs = (struct dpll_regs *)base; |
| 133 | |
| 134 | if (!wait_on_value(ST_DPLL_CLK_MASK, ST_DPLL_CLK_MASK, |
| 135 | &dpll_regs->cm_idlest_dpll, LDELAY)) { |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 136 | printf("DPLL locking failed for %x\n", base); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 137 | hang(); |
| 138 | } |
| 139 | } |
| 140 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 141 | inline u32 check_for_lock(u32 const base) |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 142 | { |
| 143 | struct dpll_regs *const dpll_regs = (struct dpll_regs *)base; |
| 144 | u32 lock = readl(&dpll_regs->cm_idlest_dpll) & ST_DPLL_CLK_MASK; |
| 145 | |
| 146 | return lock; |
| 147 | } |
| 148 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 149 | const struct dpll_params *get_mpu_dpll_params(struct dplls const *dpll_data) |
| 150 | { |
| 151 | u32 sysclk_ind = get_sys_clk_index(); |
| 152 | return &dpll_data->mpu[sysclk_ind]; |
| 153 | } |
| 154 | |
| 155 | const struct dpll_params *get_core_dpll_params(struct dplls const *dpll_data) |
| 156 | { |
| 157 | u32 sysclk_ind = get_sys_clk_index(); |
| 158 | return &dpll_data->core[sysclk_ind]; |
| 159 | } |
| 160 | |
| 161 | const struct dpll_params *get_per_dpll_params(struct dplls const *dpll_data) |
| 162 | { |
| 163 | u32 sysclk_ind = get_sys_clk_index(); |
| 164 | return &dpll_data->per[sysclk_ind]; |
| 165 | } |
| 166 | |
| 167 | const struct dpll_params *get_iva_dpll_params(struct dplls const *dpll_data) |
| 168 | { |
| 169 | u32 sysclk_ind = get_sys_clk_index(); |
| 170 | return &dpll_data->iva[sysclk_ind]; |
| 171 | } |
| 172 | |
| 173 | const struct dpll_params *get_usb_dpll_params(struct dplls const *dpll_data) |
| 174 | { |
| 175 | u32 sysclk_ind = get_sys_clk_index(); |
| 176 | return &dpll_data->usb[sysclk_ind]; |
| 177 | } |
| 178 | |
| 179 | const struct dpll_params *get_abe_dpll_params(struct dplls const *dpll_data) |
| 180 | { |
| 181 | #ifdef CONFIG_SYS_OMAP_ABE_SYSCK |
| 182 | u32 sysclk_ind = get_sys_clk_index(); |
| 183 | return &dpll_data->abe[sysclk_ind]; |
| 184 | #else |
| 185 | return dpll_data->abe; |
| 186 | #endif |
| 187 | } |
| 188 | |
Lokesh Vutla | 5e70e29 | 2013-02-12 21:29:05 +0000 | [diff] [blame] | 189 | static const struct dpll_params *get_ddr_dpll_params |
| 190 | (struct dplls const *dpll_data) |
| 191 | { |
| 192 | u32 sysclk_ind = get_sys_clk_index(); |
| 193 | |
| 194 | if (!dpll_data->ddr) |
| 195 | return NULL; |
| 196 | return &dpll_data->ddr[sysclk_ind]; |
| 197 | } |
| 198 | |
Lokesh Vutla | adc52df | 2013-07-08 16:04:39 +0530 | [diff] [blame] | 199 | #ifdef CONFIG_DRIVER_TI_CPSW |
| 200 | static const struct dpll_params *get_gmac_dpll_params |
| 201 | (struct dplls const *dpll_data) |
| 202 | { |
| 203 | u32 sysclk_ind = get_sys_clk_index(); |
| 204 | |
| 205 | if (!dpll_data->gmac) |
| 206 | return NULL; |
| 207 | return &dpll_data->gmac[sysclk_ind]; |
| 208 | } |
| 209 | #endif |
| 210 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 211 | static void do_setup_dpll(u32 const base, const struct dpll_params *params, |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 212 | u8 lock, char *dpll) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 213 | { |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 214 | u32 temp, M, N; |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 215 | struct dpll_regs *const dpll_regs = (struct dpll_regs *)base; |
| 216 | |
Lokesh Vutla | 5e70e29 | 2013-02-12 21:29:05 +0000 | [diff] [blame] | 217 | if (!params) |
| 218 | return; |
| 219 | |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 220 | temp = readl(&dpll_regs->cm_clksel_dpll); |
| 221 | |
| 222 | if (check_for_lock(base)) { |
| 223 | /* |
| 224 | * The Dpll has already been locked by rom code using CH. |
| 225 | * Check if M,N are matching with Ideal nominal opp values. |
| 226 | * If matches, skip the rest otherwise relock. |
| 227 | */ |
| 228 | M = (temp & CM_CLKSEL_DPLL_M_MASK) >> CM_CLKSEL_DPLL_M_SHIFT; |
| 229 | N = (temp & CM_CLKSEL_DPLL_N_MASK) >> CM_CLKSEL_DPLL_N_SHIFT; |
| 230 | if ((M != (params->m)) || (N != (params->n))) { |
| 231 | debug("\n %s Dpll locked, but not for ideal M = %d," |
| 232 | "N = %d values, current values are M = %d," |
| 233 | "N= %d" , dpll, params->m, params->n, |
| 234 | M, N); |
| 235 | } else { |
| 236 | /* Dpll locked with ideal values for nominal opps. */ |
| 237 | debug("\n %s Dpll already locked with ideal" |
| 238 | "nominal opp values", dpll); |
Lokesh Vutla | 9bd0f9a | 2016-05-23 13:31:19 +0530 | [diff] [blame] | 239 | |
| 240 | bypass_dpll(base); |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 241 | goto setup_post_dividers; |
| 242 | } |
| 243 | } |
| 244 | |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 245 | bypass_dpll(base); |
| 246 | |
| 247 | /* Set M & N */ |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 248 | temp &= ~CM_CLKSEL_DPLL_M_MASK; |
| 249 | temp |= (params->m << CM_CLKSEL_DPLL_M_SHIFT) & CM_CLKSEL_DPLL_M_MASK; |
| 250 | |
| 251 | temp &= ~CM_CLKSEL_DPLL_N_MASK; |
| 252 | temp |= (params->n << CM_CLKSEL_DPLL_N_SHIFT) & CM_CLKSEL_DPLL_N_MASK; |
| 253 | |
| 254 | writel(temp, &dpll_regs->cm_clksel_dpll); |
| 255 | |
Lokesh Vutla | 9bd0f9a | 2016-05-23 13:31:19 +0530 | [diff] [blame] | 256 | setup_post_dividers: |
| 257 | setup_post_dividers(base, params); |
| 258 | |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 259 | /* Lock */ |
| 260 | if (lock) |
| 261 | do_lock_dpll(base); |
| 262 | |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 263 | /* Wait till the DPLL locks */ |
| 264 | if (lock) |
| 265 | wait_for_lock(base); |
| 266 | } |
| 267 | |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 268 | u32 omap_ddr_clk(void) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 269 | { |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 270 | u32 ddr_clk, sys_clk_khz, omap_rev, divider; |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 271 | const struct dpll_params *core_dpll_params; |
| 272 | |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 273 | omap_rev = omap_revision(); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 274 | sys_clk_khz = get_sys_clk_freq() / 1000; |
| 275 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 276 | core_dpll_params = get_core_dpll_params(*dplls_data); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 277 | |
| 278 | debug("sys_clk %d\n ", sys_clk_khz * 1000); |
| 279 | |
| 280 | /* Find Core DPLL locked frequency first */ |
| 281 | ddr_clk = sys_clk_khz * 2 * core_dpll_params->m / |
| 282 | (core_dpll_params->n + 1); |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 283 | |
| 284 | if (omap_rev < OMAP5430_ES1_0) { |
| 285 | /* |
| 286 | * DDR frequency is PHY_ROOT_CLK/2 |
| 287 | * PHY_ROOT_CLK = Fdpll/2/M2 |
| 288 | */ |
| 289 | divider = 4; |
| 290 | } else { |
| 291 | /* |
| 292 | * DDR frequency is PHY_ROOT_CLK |
| 293 | * PHY_ROOT_CLK = Fdpll/2/M2 |
| 294 | */ |
| 295 | divider = 2; |
| 296 | } |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 297 | |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 298 | ddr_clk = ddr_clk / divider / core_dpll_params->m2; |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 299 | ddr_clk *= 1000; /* convert to Hz */ |
| 300 | debug("ddr_clk %d\n ", ddr_clk); |
| 301 | |
| 302 | return ddr_clk; |
| 303 | } |
| 304 | |
Aneesh V | a47a79f | 2011-07-21 09:29:36 -0400 | [diff] [blame] | 305 | /* |
| 306 | * Lock MPU dpll |
| 307 | * |
| 308 | * Resulting MPU frequencies: |
| 309 | * 4430 ES1.0 : 600 MHz |
| 310 | * 4430 ES2.x : 792 MHz (OPP Turbo) |
| 311 | * 4460 : 920 MHz (OPP Turbo) - DCC disabled |
| 312 | */ |
| 313 | void configure_mpu_dpll(void) |
| 314 | { |
| 315 | const struct dpll_params *params; |
| 316 | struct dpll_regs *mpu_dpll_regs; |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 317 | u32 omap_rev; |
| 318 | omap_rev = omap_revision(); |
Aneesh V | a47a79f | 2011-07-21 09:29:36 -0400 | [diff] [blame] | 319 | |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 320 | /* |
| 321 | * DCC and clock divider settings for 4460. |
| 322 | * DCC is required, if more than a certain frequency is required. |
| 323 | * For, 4460 > 1GHZ. |
| 324 | * 5430 > 1.4GHZ. |
| 325 | */ |
| 326 | if ((omap_rev >= OMAP4460_ES1_0) && (omap_rev < OMAP5430_ES1_0)) { |
Aneesh V | a47a79f | 2011-07-21 09:29:36 -0400 | [diff] [blame] | 327 | mpu_dpll_regs = |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 328 | (struct dpll_regs *)((*prcm)->cm_clkmode_dpll_mpu); |
| 329 | bypass_dpll((*prcm)->cm_clkmode_dpll_mpu); |
| 330 | clrbits_le32((*prcm)->cm_mpu_mpu_clkctrl, |
Aneesh V | a47a79f | 2011-07-21 09:29:36 -0400 | [diff] [blame] | 331 | MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK); |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 332 | setbits_le32((*prcm)->cm_mpu_mpu_clkctrl, |
Aneesh V | a47a79f | 2011-07-21 09:29:36 -0400 | [diff] [blame] | 333 | MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_MASK); |
| 334 | clrbits_le32(&mpu_dpll_regs->cm_clksel_dpll, |
| 335 | CM_CLKSEL_DCC_EN_MASK); |
| 336 | } |
| 337 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 338 | params = get_mpu_dpll_params(*dplls_data); |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 339 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 340 | do_setup_dpll((*prcm)->cm_clkmode_dpll_mpu, params, DPLL_LOCK, "mpu"); |
Aneesh V | a47a79f | 2011-07-21 09:29:36 -0400 | [diff] [blame] | 341 | debug("MPU DPLL locked\n"); |
| 342 | } |
| 343 | |
Paul Kocialkowski | ec3ec83 | 2016-02-27 19:19:01 +0100 | [diff] [blame] | 344 | #if defined(CONFIG_USB_EHCI_OMAP) || defined(CONFIG_USB_XHCI_OMAP) || \ |
| 345 | defined(CONFIG_USB_MUSB_OMAP2PLUS) |
Govindraj.R | ad4426b | 2012-02-06 03:55:36 +0000 | [diff] [blame] | 346 | static void setup_usb_dpll(void) |
| 347 | { |
| 348 | const struct dpll_params *params; |
| 349 | u32 sys_clk_khz, sd_div, num, den; |
| 350 | |
| 351 | sys_clk_khz = get_sys_clk_freq() / 1000; |
| 352 | /* |
| 353 | * USB: |
| 354 | * USB dpll is J-type. Need to set DPLL_SD_DIV for jitter correction |
| 355 | * DPLL_SD_DIV = CEILING ([DPLL_MULT/(DPLL_DIV+1)]* CLKINP / 250) |
| 356 | * - where CLKINP is sys_clk in MHz |
| 357 | * Use CLKINP in KHz and adjust the denominator accordingly so |
| 358 | * that we have enough accuracy and at the same time no overflow |
| 359 | */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 360 | params = get_usb_dpll_params(*dplls_data); |
Govindraj.R | ad4426b | 2012-02-06 03:55:36 +0000 | [diff] [blame] | 361 | num = params->m * sys_clk_khz; |
| 362 | den = (params->n + 1) * 250 * 1000; |
| 363 | num += den - 1; |
| 364 | sd_div = num / den; |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 365 | clrsetbits_le32((*prcm)->cm_clksel_dpll_usb, |
Govindraj.R | ad4426b | 2012-02-06 03:55:36 +0000 | [diff] [blame] | 366 | CM_CLKSEL_DPLL_DPLL_SD_DIV_MASK, |
| 367 | sd_div << CM_CLKSEL_DPLL_DPLL_SD_DIV_SHIFT); |
| 368 | |
| 369 | /* Now setup the dpll with the regular function */ |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 370 | do_setup_dpll((*prcm)->cm_clkmode_dpll_usb, params, DPLL_LOCK, "usb"); |
Govindraj.R | ad4426b | 2012-02-06 03:55:36 +0000 | [diff] [blame] | 371 | } |
| 372 | #endif |
| 373 | |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 374 | static void setup_dplls(void) |
| 375 | { |
Anatolij Gustschin | 20f2351 | 2011-12-03 06:46:14 +0000 | [diff] [blame] | 376 | u32 temp; |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 377 | const struct dpll_params *params; |
Tom Rini | be8d635 | 2015-06-05 15:51:11 +0530 | [diff] [blame] | 378 | struct emif_reg_struct *emif = (struct emif_reg_struct *)EMIF1_BASE; |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 379 | |
Anatolij Gustschin | 20f2351 | 2011-12-03 06:46:14 +0000 | [diff] [blame] | 380 | debug("setup_dplls\n"); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 381 | |
| 382 | /* CORE dpll */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 383 | params = get_core_dpll_params(*dplls_data); /* default - safest */ |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 384 | /* |
| 385 | * Do not lock the core DPLL now. Just set it up. |
| 386 | * Core DPLL will be locked after setting up EMIF |
| 387 | * using the FREQ_UPDATE method(freq_update_core()) |
| 388 | */ |
Tom Rini | be8d635 | 2015-06-05 15:51:11 +0530 | [diff] [blame] | 389 | if (emif_sdram_type(readl(&emif->emif_sdram_config)) == |
| 390 | EMIF_SDRAM_TYPE_LPDDR2) |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 391 | do_setup_dpll((*prcm)->cm_clkmode_dpll_core, params, |
Lokesh Vutla | cdfc4ea | 2012-05-22 00:03:26 +0000 | [diff] [blame] | 392 | DPLL_NO_LOCK, "core"); |
| 393 | else |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 394 | do_setup_dpll((*prcm)->cm_clkmode_dpll_core, params, |
Lokesh Vutla | cdfc4ea | 2012-05-22 00:03:26 +0000 | [diff] [blame] | 395 | DPLL_LOCK, "core"); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 396 | /* Set the ratios for CORE_CLK, L3_CLK, L4_CLK */ |
| 397 | temp = (CLKSEL_CORE_X2_DIV_1 << CLKSEL_CORE_SHIFT) | |
| 398 | (CLKSEL_L3_CORE_DIV_2 << CLKSEL_L3_SHIFT) | |
| 399 | (CLKSEL_L4_L3_DIV_2 << CLKSEL_L4_SHIFT); |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 400 | writel(temp, (*prcm)->cm_clksel_core); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 401 | debug("Core DPLL configured\n"); |
| 402 | |
| 403 | /* lock PER dpll */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 404 | params = get_per_dpll_params(*dplls_data); |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 405 | do_setup_dpll((*prcm)->cm_clkmode_dpll_per, |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 406 | params, DPLL_LOCK, "per"); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 407 | debug("PER DPLL locked\n"); |
| 408 | |
| 409 | /* MPU dpll */ |
Aneesh V | a47a79f | 2011-07-21 09:29:36 -0400 | [diff] [blame] | 410 | configure_mpu_dpll(); |
Govindraj.R | ad4426b | 2012-02-06 03:55:36 +0000 | [diff] [blame] | 411 | |
Paul Kocialkowski | ec3ec83 | 2016-02-27 19:19:01 +0100 | [diff] [blame] | 412 | #if defined(CONFIG_USB_EHCI_OMAP) || defined(CONFIG_USB_XHCI_OMAP) || \ |
| 413 | defined(CONFIG_USB_MUSB_OMAP2PLUS) |
Govindraj.R | ad4426b | 2012-02-06 03:55:36 +0000 | [diff] [blame] | 414 | setup_usb_dpll(); |
| 415 | #endif |
Lokesh Vutla | 5e70e29 | 2013-02-12 21:29:05 +0000 | [diff] [blame] | 416 | params = get_ddr_dpll_params(*dplls_data); |
| 417 | do_setup_dpll((*prcm)->cm_clkmode_dpll_ddrphy, |
| 418 | params, DPLL_LOCK, "ddr"); |
Lokesh Vutla | adc52df | 2013-07-08 16:04:39 +0530 | [diff] [blame] | 419 | |
| 420 | #ifdef CONFIG_DRIVER_TI_CPSW |
| 421 | params = get_gmac_dpll_params(*dplls_data); |
| 422 | do_setup_dpll((*prcm)->cm_clkmode_dpll_gmac, params, |
| 423 | DPLL_LOCK, "gmac"); |
| 424 | #endif |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 425 | } |
| 426 | |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 427 | u32 get_offset_code(u32 volt_offset, struct pmic_data *pmic) |
Aneesh V | 0fa1d1b | 2011-07-21 09:29:32 -0400 | [diff] [blame] | 428 | { |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 429 | u32 offset_code; |
Aneesh V | 0fa1d1b | 2011-07-21 09:29:32 -0400 | [diff] [blame] | 430 | |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 431 | volt_offset -= pmic->base_offset; |
Aneesh V | 0fa1d1b | 2011-07-21 09:29:32 -0400 | [diff] [blame] | 432 | |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 433 | offset_code = (volt_offset + pmic->step - 1) / pmic->step; |
Nishanth Menon | a0f45c1 | 2012-03-01 14:17:38 +0000 | [diff] [blame] | 434 | |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 435 | /* |
| 436 | * Offset codes 1-6 all give the base voltage in Palmas |
| 437 | * Offset code 0 switches OFF the SMPS |
| 438 | */ |
| 439 | return offset_code + pmic->start_code; |
Aneesh V | 0fa1d1b | 2011-07-21 09:29:32 -0400 | [diff] [blame] | 440 | } |
| 441 | |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 442 | void do_scale_vcore(u32 vcore_reg, u32 volt_mv, struct pmic_data *pmic) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 443 | { |
Nishanth Menon | 41d7ab1 | 2012-03-01 14:17:37 +0000 | [diff] [blame] | 444 | u32 offset_code; |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 445 | u32 offset = volt_mv; |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 446 | int ret = 0; |
| 447 | |
Lokesh Vutla | 3685297 | 2013-05-30 03:19:29 +0000 | [diff] [blame] | 448 | if (!volt_mv) |
| 449 | return; |
| 450 | |
Lokesh Vutla | ae49f6d | 2013-05-30 02:54:33 +0000 | [diff] [blame] | 451 | pmic->pmic_bus_init(); |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 452 | /* See if we can first get the GPIO if needed */ |
| 453 | if (pmic->gpio_en) |
| 454 | ret = gpio_request(pmic->gpio, "PMIC_GPIO"); |
| 455 | |
| 456 | if (ret < 0) { |
| 457 | printf("%s: gpio %d request failed %d\n", __func__, |
| 458 | pmic->gpio, ret); |
| 459 | return; |
| 460 | } |
| 461 | |
| 462 | /* Pull the GPIO low to select SET0 register, while we program SET1 */ |
| 463 | if (pmic->gpio_en) |
| 464 | gpio_direction_output(pmic->gpio, 0); |
Lokesh Vutla | 266b23a | 2016-08-17 16:25:35 +0530 | [diff] [blame^] | 465 | |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 466 | /* convert to uV for better accuracy in the calculations */ |
| 467 | offset *= 1000; |
| 468 | |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 469 | offset_code = get_offset_code(offset, pmic); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 470 | |
| 471 | debug("do_scale_vcore: volt - %d offset_code - 0x%x\n", volt_mv, |
| 472 | offset_code); |
SRICHARAN R | 698a1f2 | 2012-03-12 02:25:38 +0000 | [diff] [blame] | 473 | |
Lokesh Vutla | ae49f6d | 2013-05-30 02:54:33 +0000 | [diff] [blame] | 474 | if (pmic->pmic_write(pmic->i2c_slave_addr, vcore_reg, offset_code)) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 475 | printf("Scaling voltage failed for 0x%x\n", vcore_reg); |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 476 | if (pmic->gpio_en) |
| 477 | gpio_direction_output(pmic->gpio, 1); |
| 478 | } |
| 479 | |
Nishanth Menon | 93cdb28 | 2013-05-30 03:19:31 +0000 | [diff] [blame] | 480 | static u32 optimize_vcore_voltage(struct volts const *v) |
| 481 | { |
| 482 | u32 val; |
| 483 | if (!v->value) |
| 484 | return 0; |
| 485 | if (!v->efuse.reg) |
| 486 | return v->value; |
| 487 | |
| 488 | switch (v->efuse.reg_bits) { |
| 489 | case 16: |
| 490 | val = readw(v->efuse.reg); |
| 491 | break; |
| 492 | case 32: |
| 493 | val = readl(v->efuse.reg); |
| 494 | break; |
| 495 | default: |
| 496 | printf("Error: efuse 0x%08x bits=%d unknown\n", |
| 497 | v->efuse.reg, v->efuse.reg_bits); |
| 498 | return v->value; |
| 499 | } |
| 500 | |
| 501 | if (!val) { |
| 502 | printf("Error: efuse 0x%08x bits=%d val=0, using %d\n", |
| 503 | v->efuse.reg, v->efuse.reg_bits, v->value); |
| 504 | return v->value; |
| 505 | } |
| 506 | |
| 507 | debug("%s:efuse 0x%08x bits=%d Vnom=%d, using efuse value %d\n", |
| 508 | __func__, v->efuse.reg, v->efuse.reg_bits, v->value, val); |
| 509 | return val; |
| 510 | } |
| 511 | |
Lokesh Vutla | 3de40ac | 2015-06-04 16:42:36 +0530 | [diff] [blame] | 512 | #ifdef CONFIG_IODELAY_RECALIBRATION |
| 513 | void __weak recalibrate_iodelay(void) |
| 514 | { |
| 515 | } |
| 516 | #endif |
| 517 | |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 518 | /* |
Lubomir Popov | 21f3406 | 2014-12-19 17:34:31 +0200 | [diff] [blame] | 519 | * Setup the voltages for the main SoC core power domains. |
| 520 | * We start with the maximum voltages allowed here, as set in the corresponding |
| 521 | * vcores_data struct, and then scale (usually down) to the fused values that |
| 522 | * are retrieved from the SoC. The scaling happens only if the efuse.reg fields |
| 523 | * are initialised. |
| 524 | * Rail grouping is supported for the DRA7xx SoCs only, therefore the code is |
| 525 | * compiled conditionally. Note that the new code writes the scaled (or zeroed) |
| 526 | * values back to the vcores_data struct for eventual reuse. Zero values mean |
| 527 | * that the corresponding rails are not controlled separately, and are not sent |
| 528 | * to the PMIC. |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 529 | */ |
| 530 | void scale_vcores(struct vcores_data const *vcores) |
| 531 | { |
Lubomir Popov | 21f3406 | 2014-12-19 17:34:31 +0200 | [diff] [blame] | 532 | #if defined(CONFIG_DRA7XX) |
| 533 | int i; |
| 534 | struct volts *pv = (struct volts *)vcores; |
| 535 | struct volts *px; |
| 536 | |
| 537 | for (i=0; i<(sizeof(struct vcores_data)/sizeof(struct volts)); i++) { |
| 538 | debug("%d -> ", pv->value); |
| 539 | if (pv->value) { |
| 540 | /* Handle non-empty members only */ |
| 541 | pv->value = optimize_vcore_voltage(pv); |
| 542 | px = (struct volts *)vcores; |
| 543 | while (px < pv) { |
| 544 | /* |
| 545 | * Scan already handled non-empty members to see |
| 546 | * if we have a group and find the max voltage, |
| 547 | * which is set to the first occurance of the |
| 548 | * particular SMPS; the other group voltages are |
| 549 | * zeroed. |
| 550 | */ |
| 551 | if (px->value) { |
| 552 | if ((pv->pmic->i2c_slave_addr == |
| 553 | px->pmic->i2c_slave_addr) && |
| 554 | (pv->addr == px->addr)) { |
| 555 | /* Same PMIC, same SMPS */ |
| 556 | if (pv->value > px->value) |
| 557 | px->value = pv->value; |
| 558 | |
| 559 | pv->value = 0; |
| 560 | } |
| 561 | } |
| 562 | px++; |
| 563 | } |
| 564 | } |
| 565 | debug("%d\n", pv->value); |
| 566 | pv++; |
| 567 | } |
| 568 | |
| 569 | debug("cor: %d\n", vcores->core.value); |
| 570 | do_scale_vcore(vcores->core.addr, vcores->core.value, vcores->core.pmic); |
Lokesh Vutla | 3de40ac | 2015-06-04 16:42:36 +0530 | [diff] [blame] | 571 | /* |
| 572 | * IO delay recalibration should be done immediately after |
| 573 | * adjusting AVS voltages for VDD_CORE_L. |
| 574 | * Respective boards should call __recalibrate_iodelay() |
| 575 | * with proper mux, virtual and manual mode configurations. |
| 576 | */ |
| 577 | #ifdef CONFIG_IODELAY_RECALIBRATION |
| 578 | recalibrate_iodelay(); |
| 579 | #endif |
| 580 | |
Lubomir Popov | 21f3406 | 2014-12-19 17:34:31 +0200 | [diff] [blame] | 581 | debug("mpu: %d\n", vcores->mpu.value); |
| 582 | do_scale_vcore(vcores->mpu.addr, vcores->mpu.value, vcores->mpu.pmic); |
| 583 | /* Configure MPU ABB LDO after scale */ |
Nishanth Menon | 4493e7d | 2016-04-21 14:34:22 -0500 | [diff] [blame] | 584 | abb_setup(vcores->mpu.efuse.reg, |
Lubomir Popov | 21f3406 | 2014-12-19 17:34:31 +0200 | [diff] [blame] | 585 | (*ctrl)->control_wkup_ldovbb_mpu_voltage_ctrl, |
| 586 | (*prcm)->prm_abbldo_mpu_setup, |
| 587 | (*prcm)->prm_abbldo_mpu_ctrl, |
| 588 | (*prcm)->prm_irqstatus_mpu_2, |
Nishanth Menon | 1eb62b4 | 2016-04-21 14:34:23 -0500 | [diff] [blame] | 589 | vcores->mpu.abb_tx_done_mask, |
Lubomir Popov | 21f3406 | 2014-12-19 17:34:31 +0200 | [diff] [blame] | 590 | OMAP_ABB_FAST_OPP); |
| 591 | |
| 592 | /* The .mm member is not used for the DRA7xx */ |
| 593 | |
| 594 | debug("gpu: %d\n", vcores->gpu.value); |
| 595 | do_scale_vcore(vcores->gpu.addr, vcores->gpu.value, vcores->gpu.pmic); |
Nishanth Menon | 59b92af | 2016-04-21 14:34:25 -0500 | [diff] [blame] | 596 | /* Configure GPU ABB LDO after scale */ |
| 597 | abb_setup(vcores->gpu.efuse.reg, |
| 598 | (*ctrl)->control_wkup_ldovbb_gpu_voltage_ctrl, |
| 599 | (*prcm)->prm_abbldo_gpu_setup, |
| 600 | (*prcm)->prm_abbldo_gpu_ctrl, |
| 601 | (*prcm)->prm_irqstatus_mpu, |
| 602 | vcores->gpu.abb_tx_done_mask, |
| 603 | OMAP_ABB_FAST_OPP); |
Lubomir Popov | 21f3406 | 2014-12-19 17:34:31 +0200 | [diff] [blame] | 604 | debug("eve: %d\n", vcores->eve.value); |
| 605 | do_scale_vcore(vcores->eve.addr, vcores->eve.value, vcores->eve.pmic); |
Nishanth Menon | 59b92af | 2016-04-21 14:34:25 -0500 | [diff] [blame] | 606 | /* Configure EVE ABB LDO after scale */ |
| 607 | abb_setup(vcores->eve.efuse.reg, |
| 608 | (*ctrl)->control_wkup_ldovbb_eve_voltage_ctrl, |
| 609 | (*prcm)->prm_abbldo_eve_setup, |
| 610 | (*prcm)->prm_abbldo_eve_ctrl, |
| 611 | (*prcm)->prm_irqstatus_mpu, |
| 612 | vcores->eve.abb_tx_done_mask, |
| 613 | OMAP_ABB_FAST_OPP); |
Lubomir Popov | 21f3406 | 2014-12-19 17:34:31 +0200 | [diff] [blame] | 614 | debug("iva: %d\n", vcores->iva.value); |
| 615 | do_scale_vcore(vcores->iva.addr, vcores->iva.value, vcores->iva.pmic); |
Nishanth Menon | 59b92af | 2016-04-21 14:34:25 -0500 | [diff] [blame] | 616 | /* Configure IVA ABB LDO after scale */ |
| 617 | abb_setup(vcores->iva.efuse.reg, |
| 618 | (*ctrl)->control_wkup_ldovbb_iva_voltage_ctrl, |
| 619 | (*prcm)->prm_abbldo_iva_setup, |
| 620 | (*prcm)->prm_abbldo_iva_ctrl, |
| 621 | (*prcm)->prm_irqstatus_mpu, |
| 622 | vcores->iva.abb_tx_done_mask, |
| 623 | OMAP_ABB_FAST_OPP); |
Lubomir Popov | 21f3406 | 2014-12-19 17:34:31 +0200 | [diff] [blame] | 624 | /* Might need udelay(1000) here if debug is enabled to see all prints */ |
| 625 | #else |
Nishanth Menon | 93cdb28 | 2013-05-30 03:19:31 +0000 | [diff] [blame] | 626 | u32 val; |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 627 | |
Nishanth Menon | 93cdb28 | 2013-05-30 03:19:31 +0000 | [diff] [blame] | 628 | val = optimize_vcore_voltage(&vcores->core); |
| 629 | do_scale_vcore(vcores->core.addr, val, vcores->core.pmic); |
| 630 | |
Lokesh Vutla | 3de40ac | 2015-06-04 16:42:36 +0530 | [diff] [blame] | 631 | /* |
| 632 | * IO delay recalibration should be done immediately after |
| 633 | * adjusting AVS voltages for VDD_CORE_L. |
| 634 | * Respective boards should call __recalibrate_iodelay() |
| 635 | * with proper mux, virtual and manual mode configurations. |
| 636 | */ |
| 637 | #ifdef CONFIG_IODELAY_RECALIBRATION |
| 638 | recalibrate_iodelay(); |
| 639 | #endif |
| 640 | |
Nishanth Menon | 93cdb28 | 2013-05-30 03:19:31 +0000 | [diff] [blame] | 641 | val = optimize_vcore_voltage(&vcores->mpu); |
| 642 | do_scale_vcore(vcores->mpu.addr, val, vcores->mpu.pmic); |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 643 | |
Andrii Tseglytskyi | 84bd325 | 2013-05-20 22:42:09 +0000 | [diff] [blame] | 644 | /* Configure MPU ABB LDO after scale */ |
Nishanth Menon | 4493e7d | 2016-04-21 14:34:22 -0500 | [diff] [blame] | 645 | abb_setup(vcores->mpu.efuse.reg, |
Andrii Tseglytskyi | 84bd325 | 2013-05-20 22:42:09 +0000 | [diff] [blame] | 646 | (*ctrl)->control_wkup_ldovbb_mpu_voltage_ctrl, |
| 647 | (*prcm)->prm_abbldo_mpu_setup, |
| 648 | (*prcm)->prm_abbldo_mpu_ctrl, |
| 649 | (*prcm)->prm_irqstatus_mpu_2, |
Nishanth Menon | 1eb62b4 | 2016-04-21 14:34:23 -0500 | [diff] [blame] | 650 | vcores->mpu.abb_tx_done_mask, |
Andrii Tseglytskyi | 84bd325 | 2013-05-20 22:42:09 +0000 | [diff] [blame] | 651 | OMAP_ABB_FAST_OPP); |
| 652 | |
Nishanth Menon | 93cdb28 | 2013-05-30 03:19:31 +0000 | [diff] [blame] | 653 | val = optimize_vcore_voltage(&vcores->mm); |
| 654 | do_scale_vcore(vcores->mm.addr, val, vcores->mm.pmic); |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 655 | |
Nishanth Menon | 07be757 | 2016-04-21 14:34:24 -0500 | [diff] [blame] | 656 | /* Configure MM ABB LDO after scale */ |
| 657 | abb_setup(vcores->mm.efuse.reg, |
| 658 | (*ctrl)->control_wkup_ldovbb_mm_voltage_ctrl, |
| 659 | (*prcm)->prm_abbldo_mm_setup, |
| 660 | (*prcm)->prm_abbldo_mm_ctrl, |
| 661 | (*prcm)->prm_irqstatus_mpu, |
| 662 | vcores->mm.abb_tx_done_mask, |
| 663 | OMAP_ABB_FAST_OPP); |
| 664 | |
Nishanth Menon | 93cdb28 | 2013-05-30 03:19:31 +0000 | [diff] [blame] | 665 | val = optimize_vcore_voltage(&vcores->gpu); |
| 666 | do_scale_vcore(vcores->gpu.addr, val, vcores->gpu.pmic); |
Lokesh Vutla | 3685297 | 2013-05-30 03:19:29 +0000 | [diff] [blame] | 667 | |
Nishanth Menon | 93cdb28 | 2013-05-30 03:19:31 +0000 | [diff] [blame] | 668 | val = optimize_vcore_voltage(&vcores->eve); |
| 669 | do_scale_vcore(vcores->eve.addr, val, vcores->eve.pmic); |
Lokesh Vutla | 3685297 | 2013-05-30 03:19:29 +0000 | [diff] [blame] | 670 | |
Nishanth Menon | 93cdb28 | 2013-05-30 03:19:31 +0000 | [diff] [blame] | 671 | val = optimize_vcore_voltage(&vcores->iva); |
| 672 | do_scale_vcore(vcores->iva.addr, val, vcores->iva.pmic); |
Lubomir Popov | 21f3406 | 2014-12-19 17:34:31 +0200 | [diff] [blame] | 673 | #endif |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 674 | } |
| 675 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 676 | static inline void enable_clock_domain(u32 const clkctrl_reg, u32 enable_mode) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 677 | { |
| 678 | clrsetbits_le32(clkctrl_reg, CD_CLKCTRL_CLKTRCTRL_MASK, |
| 679 | enable_mode << CD_CLKCTRL_CLKTRCTRL_SHIFT); |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 680 | debug("Enable clock domain - %x\n", clkctrl_reg); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 681 | } |
| 682 | |
Kishon Vijay Abraham I | 920f156f | 2015-08-17 13:29:51 +0530 | [diff] [blame] | 683 | static inline void disable_clock_domain(u32 const clkctrl_reg) |
| 684 | { |
| 685 | clrsetbits_le32(clkctrl_reg, CD_CLKCTRL_CLKTRCTRL_MASK, |
| 686 | CD_CLKCTRL_CLKTRCTRL_SW_SLEEP << |
| 687 | CD_CLKCTRL_CLKTRCTRL_SHIFT); |
| 688 | debug("Disable clock domain - %x\n", clkctrl_reg); |
| 689 | } |
| 690 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 691 | static inline void wait_for_clk_enable(u32 clkctrl_addr) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 692 | { |
| 693 | u32 clkctrl, idlest = MODULE_CLKCTRL_IDLEST_DISABLED; |
| 694 | u32 bound = LDELAY; |
| 695 | |
| 696 | while ((idlest == MODULE_CLKCTRL_IDLEST_DISABLED) || |
| 697 | (idlest == MODULE_CLKCTRL_IDLEST_TRANSITIONING)) { |
| 698 | |
| 699 | clkctrl = readl(clkctrl_addr); |
| 700 | idlest = (clkctrl & MODULE_CLKCTRL_IDLEST_MASK) >> |
| 701 | MODULE_CLKCTRL_IDLEST_SHIFT; |
| 702 | if (--bound == 0) { |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 703 | printf("Clock enable failed for 0x%x idlest 0x%x\n", |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 704 | clkctrl_addr, clkctrl); |
| 705 | return; |
| 706 | } |
| 707 | } |
| 708 | } |
| 709 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 710 | static inline void enable_clock_module(u32 const clkctrl_addr, u32 enable_mode, |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 711 | u32 wait_for_enable) |
| 712 | { |
| 713 | clrsetbits_le32(clkctrl_addr, MODULE_CLKCTRL_MODULEMODE_MASK, |
| 714 | enable_mode << MODULE_CLKCTRL_MODULEMODE_SHIFT); |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 715 | debug("Enable clock module - %x\n", clkctrl_addr); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 716 | if (wait_for_enable) |
| 717 | wait_for_clk_enable(clkctrl_addr); |
| 718 | } |
| 719 | |
Kishon Vijay Abraham I | 920f156f | 2015-08-17 13:29:51 +0530 | [diff] [blame] | 720 | static inline void wait_for_clk_disable(u32 clkctrl_addr) |
| 721 | { |
| 722 | u32 clkctrl, idlest = MODULE_CLKCTRL_IDLEST_FULLY_FUNCTIONAL; |
| 723 | u32 bound = LDELAY; |
| 724 | |
| 725 | while ((idlest != MODULE_CLKCTRL_IDLEST_DISABLED)) { |
| 726 | clkctrl = readl(clkctrl_addr); |
| 727 | idlest = (clkctrl & MODULE_CLKCTRL_IDLEST_MASK) >> |
| 728 | MODULE_CLKCTRL_IDLEST_SHIFT; |
| 729 | if (--bound == 0) { |
| 730 | printf("Clock disable failed for 0x%x idlest 0x%x\n", |
| 731 | clkctrl_addr, clkctrl); |
| 732 | return; |
| 733 | } |
| 734 | } |
| 735 | } |
| 736 | |
| 737 | static inline void disable_clock_module(u32 const clkctrl_addr, |
| 738 | u32 wait_for_disable) |
| 739 | { |
| 740 | clrsetbits_le32(clkctrl_addr, MODULE_CLKCTRL_MODULEMODE_MASK, |
| 741 | MODULE_CLKCTRL_MODULEMODE_SW_DISABLE << |
| 742 | MODULE_CLKCTRL_MODULEMODE_SHIFT); |
| 743 | debug("Disable clock module - %x\n", clkctrl_addr); |
| 744 | if (wait_for_disable) |
| 745 | wait_for_clk_disable(clkctrl_addr); |
| 746 | } |
| 747 | |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 748 | void freq_update_core(void) |
| 749 | { |
| 750 | u32 freq_config1 = 0; |
| 751 | const struct dpll_params *core_dpll_params; |
SRICHARAN R | 3d53496 | 2012-03-12 02:25:37 +0000 | [diff] [blame] | 752 | u32 omap_rev = omap_revision(); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 753 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 754 | core_dpll_params = get_core_dpll_params(*dplls_data); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 755 | /* Put EMIF clock domain in sw wakeup mode */ |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 756 | enable_clock_domain((*prcm)->cm_memif_clkstctrl, |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 757 | CD_CLKCTRL_CLKTRCTRL_SW_WKUP); |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 758 | wait_for_clk_enable((*prcm)->cm_memif_emif_1_clkctrl); |
| 759 | wait_for_clk_enable((*prcm)->cm_memif_emif_2_clkctrl); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 760 | |
| 761 | freq_config1 = SHADOW_FREQ_CONFIG1_FREQ_UPDATE_MASK | |
| 762 | SHADOW_FREQ_CONFIG1_DLL_RESET_MASK; |
| 763 | |
| 764 | freq_config1 |= (DPLL_EN_LOCK << SHADOW_FREQ_CONFIG1_DPLL_EN_SHIFT) & |
| 765 | SHADOW_FREQ_CONFIG1_DPLL_EN_MASK; |
| 766 | |
| 767 | freq_config1 |= (core_dpll_params->m2 << |
| 768 | SHADOW_FREQ_CONFIG1_M2_DIV_SHIFT) & |
| 769 | SHADOW_FREQ_CONFIG1_M2_DIV_MASK; |
| 770 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 771 | writel(freq_config1, (*prcm)->cm_shadow_freq_config1); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 772 | if (!wait_on_value(SHADOW_FREQ_CONFIG1_FREQ_UPDATE_MASK, 0, |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 773 | (u32 *) (*prcm)->cm_shadow_freq_config1, LDELAY)) { |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 774 | puts("FREQ UPDATE procedure failed!!"); |
| 775 | hang(); |
| 776 | } |
| 777 | |
SRICHARAN R | 3d53496 | 2012-03-12 02:25:37 +0000 | [diff] [blame] | 778 | /* |
| 779 | * Putting EMIF in HW_AUTO is seen to be causing issues with |
Lubomir Popov | a01f0b0 | 2013-04-04 05:51:45 +0000 | [diff] [blame] | 780 | * EMIF clocks and the master DLL. Keep EMIF in SW_WKUP |
SRICHARAN R | 3d53496 | 2012-03-12 02:25:37 +0000 | [diff] [blame] | 781 | * in OMAP5430 ES1.0 silicon |
| 782 | */ |
| 783 | if (omap_rev != OMAP5430_ES1_0) { |
| 784 | /* Put EMIF clock domain back in hw auto mode */ |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 785 | enable_clock_domain((*prcm)->cm_memif_clkstctrl, |
SRICHARAN R | 3d53496 | 2012-03-12 02:25:37 +0000 | [diff] [blame] | 786 | CD_CLKCTRL_CLKTRCTRL_HW_AUTO); |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 787 | wait_for_clk_enable((*prcm)->cm_memif_emif_1_clkctrl); |
| 788 | wait_for_clk_enable((*prcm)->cm_memif_emif_2_clkctrl); |
SRICHARAN R | 3d53496 | 2012-03-12 02:25:37 +0000 | [diff] [blame] | 789 | } |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 790 | } |
| 791 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 792 | void bypass_dpll(u32 const base) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 793 | { |
| 794 | do_bypass_dpll(base); |
| 795 | wait_for_bypass(base); |
| 796 | } |
| 797 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 798 | void lock_dpll(u32 const base) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 799 | { |
| 800 | do_lock_dpll(base); |
| 801 | wait_for_lock(base); |
| 802 | } |
| 803 | |
Kipisz, Steven | ebe86dc | 2016-02-24 12:30:52 -0600 | [diff] [blame] | 804 | static void setup_clocks_for_console(void) |
Aneesh V | b8e60b9 | 2011-07-21 09:10:21 -0400 | [diff] [blame] | 805 | { |
| 806 | /* Do not add any spl_debug prints in this function */ |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 807 | clrsetbits_le32((*prcm)->cm_l4per_clkstctrl, CD_CLKCTRL_CLKTRCTRL_MASK, |
Aneesh V | b8e60b9 | 2011-07-21 09:10:21 -0400 | [diff] [blame] | 808 | CD_CLKCTRL_CLKTRCTRL_SW_WKUP << |
| 809 | CD_CLKCTRL_CLKTRCTRL_SHIFT); |
| 810 | |
| 811 | /* Enable all UARTs - console will be on one of them */ |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 812 | clrsetbits_le32((*prcm)->cm_l4per_uart1_clkctrl, |
Aneesh V | b8e60b9 | 2011-07-21 09:10:21 -0400 | [diff] [blame] | 813 | MODULE_CLKCTRL_MODULEMODE_MASK, |
| 814 | MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN << |
| 815 | MODULE_CLKCTRL_MODULEMODE_SHIFT); |
| 816 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 817 | clrsetbits_le32((*prcm)->cm_l4per_uart2_clkctrl, |
Aneesh V | b8e60b9 | 2011-07-21 09:10:21 -0400 | [diff] [blame] | 818 | MODULE_CLKCTRL_MODULEMODE_MASK, |
| 819 | MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN << |
| 820 | MODULE_CLKCTRL_MODULEMODE_SHIFT); |
| 821 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 822 | clrsetbits_le32((*prcm)->cm_l4per_uart3_clkctrl, |
Aneesh V | b8e60b9 | 2011-07-21 09:10:21 -0400 | [diff] [blame] | 823 | MODULE_CLKCTRL_MODULEMODE_MASK, |
| 824 | MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN << |
| 825 | MODULE_CLKCTRL_MODULEMODE_SHIFT); |
| 826 | |
Lubomir Popov | a01f0b0 | 2013-04-04 05:51:45 +0000 | [diff] [blame] | 827 | clrsetbits_le32((*prcm)->cm_l4per_uart4_clkctrl, |
Aneesh V | b8e60b9 | 2011-07-21 09:10:21 -0400 | [diff] [blame] | 828 | MODULE_CLKCTRL_MODULEMODE_MASK, |
| 829 | MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN << |
| 830 | MODULE_CLKCTRL_MODULEMODE_SHIFT); |
| 831 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 832 | clrsetbits_le32((*prcm)->cm_l4per_clkstctrl, CD_CLKCTRL_CLKTRCTRL_MASK, |
Aneesh V | b8e60b9 | 2011-07-21 09:10:21 -0400 | [diff] [blame] | 833 | CD_CLKCTRL_CLKTRCTRL_HW_AUTO << |
| 834 | CD_CLKCTRL_CLKTRCTRL_SHIFT); |
| 835 | } |
| 836 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 837 | void do_enable_clocks(u32 const *clk_domains, |
| 838 | u32 const *clk_modules_hw_auto, |
| 839 | u32 const *clk_modules_explicit_en, |
Sricharan | 9784f1f | 2011-11-15 09:49:58 -0500 | [diff] [blame] | 840 | u8 wait_for_enable) |
| 841 | { |
| 842 | u32 i, max = 100; |
| 843 | |
| 844 | /* Put the clock domains in SW_WKUP mode */ |
| 845 | for (i = 0; (i < max) && clk_domains[i]; i++) { |
| 846 | enable_clock_domain(clk_domains[i], |
| 847 | CD_CLKCTRL_CLKTRCTRL_SW_WKUP); |
| 848 | } |
| 849 | |
| 850 | /* Clock modules that need to be put in HW_AUTO */ |
| 851 | for (i = 0; (i < max) && clk_modules_hw_auto[i]; i++) { |
| 852 | enable_clock_module(clk_modules_hw_auto[i], |
| 853 | MODULE_CLKCTRL_MODULEMODE_HW_AUTO, |
| 854 | wait_for_enable); |
| 855 | }; |
| 856 | |
| 857 | /* Clock modules that need to be put in SW_EXPLICIT_EN mode */ |
| 858 | for (i = 0; (i < max) && clk_modules_explicit_en[i]; i++) { |
| 859 | enable_clock_module(clk_modules_explicit_en[i], |
| 860 | MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN, |
| 861 | wait_for_enable); |
| 862 | }; |
| 863 | |
| 864 | /* Put the clock domains in HW_AUTO mode now */ |
| 865 | for (i = 0; (i < max) && clk_domains[i]; i++) { |
| 866 | enable_clock_domain(clk_domains[i], |
| 867 | CD_CLKCTRL_CLKTRCTRL_HW_AUTO); |
| 868 | } |
| 869 | } |
| 870 | |
Kishon Vijay Abraham I | 920f156f | 2015-08-17 13:29:51 +0530 | [diff] [blame] | 871 | void do_disable_clocks(u32 const *clk_domains, |
| 872 | u32 const *clk_modules_disable, |
| 873 | u8 wait_for_disable) |
| 874 | { |
| 875 | u32 i, max = 100; |
| 876 | |
| 877 | |
| 878 | /* Clock modules that need to be put in SW_DISABLE */ |
| 879 | for (i = 0; (i < max) && clk_modules_disable[i]; i++) |
| 880 | disable_clock_module(clk_modules_disable[i], |
| 881 | wait_for_disable); |
| 882 | |
| 883 | /* Put the clock domains in SW_SLEEP mode */ |
| 884 | for (i = 0; (i < max) && clk_domains[i]; i++) |
| 885 | disable_clock_domain(clk_domains[i]); |
| 886 | } |
| 887 | |
Kipisz, Steven | ebe86dc | 2016-02-24 12:30:52 -0600 | [diff] [blame] | 888 | /** |
| 889 | * setup_early_clocks() - Setup early clocks needed for SoC |
| 890 | * |
| 891 | * Setup clocks for console, SPL basic initialization clocks and initialize |
| 892 | * the timer. This is invoked prior prcm_init. |
| 893 | */ |
| 894 | void setup_early_clocks(void) |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 895 | { |
Sricharan | 9310ff7 | 2011-11-15 09:49:55 -0500 | [diff] [blame] | 896 | switch (omap_hw_init_context()) { |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 897 | case OMAP_INIT_CONTEXT_SPL: |
| 898 | case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR: |
| 899 | case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH: |
Kipisz, Steven | ebe86dc | 2016-02-24 12:30:52 -0600 | [diff] [blame] | 900 | setup_clocks_for_console(); |
Aneesh V | 9a39088 | 2011-07-21 09:29:29 -0400 | [diff] [blame] | 901 | enable_basic_clocks(); |
Lokesh Vutla | d9c839a | 2013-05-30 03:19:30 +0000 | [diff] [blame] | 902 | timer_init(); |
Kipisz, Steven | ebe86dc | 2016-02-24 12:30:52 -0600 | [diff] [blame] | 903 | /* Fall through */ |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | void prcm_init(void) |
| 908 | { |
| 909 | switch (omap_hw_init_context()) { |
| 910 | case OMAP_INIT_CONTEXT_SPL: |
| 911 | case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR: |
| 912 | case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH: |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 913 | scale_vcores(*omap_vcores); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 914 | setup_dplls(); |
Lokesh Vutla | 100c2d8 | 2013-04-17 20:49:40 +0000 | [diff] [blame] | 915 | setup_warmreset_time(); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 916 | break; |
| 917 | default: |
| 918 | break; |
| 919 | } |
Sricharan | 308fe92 | 2011-11-15 09:50:03 -0500 | [diff] [blame] | 920 | |
| 921 | if (OMAP_INIT_CONTEXT_SPL != omap_hw_init_context()) |
| 922 | enable_basic_uboot_clocks(); |
Aneesh V | 0d2628b | 2011-07-21 09:10:07 -0400 | [diff] [blame] | 923 | } |
Lokesh Vutla | 3685297 | 2013-05-30 03:19:29 +0000 | [diff] [blame] | 924 | |
| 925 | void gpi2c_init(void) |
| 926 | { |
| 927 | static int gpi2c = 1; |
| 928 | |
| 929 | if (gpi2c) { |
Heiko Schocher | f53f2b8 | 2013-10-22 11:03:18 +0200 | [diff] [blame] | 930 | i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, |
| 931 | CONFIG_SYS_OMAP24_I2C_SLAVE); |
Lokesh Vutla | 3685297 | 2013-05-30 03:19:29 +0000 | [diff] [blame] | 932 | gpi2c = 0; |
| 933 | } |
| 934 | } |