Kukjin Kim | f7d7707 | 2011-06-01 14:18:22 -0700 | [diff] [blame] | 1 | /* |
Kukjin Kim | 7d30e8b | 2011-02-14 16:33:10 +0900 | [diff] [blame] | 2 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 3 | * http://www.samsung.com |
| 4 | * |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 5 | * EXYNOS4210 - CPU frequency scaling support |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/types.h> |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/err.h> |
| 15 | #include <linux/clk.h> |
| 16 | #include <linux/io.h> |
| 17 | #include <linux/slab.h> |
| 18 | #include <linux/regulator/consumer.h> |
| 19 | #include <linux/cpufreq.h> |
MyungJoo Ham | 0073f53 | 2011-08-18 19:45:16 +0900 | [diff] [blame] | 20 | #include <linux/notifier.h> |
| 21 | #include <linux/suspend.h> |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 22 | |
| 23 | #include <mach/map.h> |
| 24 | #include <mach/regs-clock.h> |
| 25 | #include <mach/regs-mem.h> |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 26 | #include <mach/cpufreq.h> |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 27 | |
| 28 | #include <plat/clock.h> |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 29 | #include <plat/pm.h> |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 30 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 31 | #define CPUFREQ_LEVEL_END L5 |
| 32 | |
| 33 | static int max_support_idx = L0; |
| 34 | static int min_support_idx = (CPUFREQ_LEVEL_END - 1); |
| 35 | |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 36 | static struct clk *cpu_clk; |
| 37 | static struct clk *moutcore; |
| 38 | static struct clk *mout_mpll; |
| 39 | static struct clk *mout_apll; |
| 40 | |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 41 | static struct regulator *arm_regulator; |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 42 | |
| 43 | static struct cpufreq_freqs freqs; |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 44 | |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 45 | struct cpufreq_clkdiv { |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 46 | unsigned int index; |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 47 | unsigned int clkdiv; |
| 48 | }; |
| 49 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 50 | static unsigned int exynos4210_volt_table[CPUFREQ_LEVEL_END] = { |
| 51 | 1250000, 1150000, 1050000, 975000, 950000, |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 52 | }; |
| 53 | |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 54 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 55 | static struct cpufreq_clkdiv exynos4210_clkdiv_table[CPUFREQ_LEVEL_END]; |
| 56 | |
| 57 | static struct cpufreq_frequency_table exynos4210_freq_table[] = { |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 58 | {L0, 1200*1000}, |
| 59 | {L1, 1000*1000}, |
| 60 | {L2, 800*1000}, |
| 61 | {L3, 500*1000}, |
| 62 | {L4, 200*1000}, |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 63 | {0, CPUFREQ_TABLE_END}, |
| 64 | }; |
| 65 | |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 66 | static unsigned int clkdiv_cpu0[CPUFREQ_LEVEL_END][7] = { |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 67 | /* |
| 68 | * Clock divider value for following |
| 69 | * { DIVCORE, DIVCOREM0, DIVCOREM1, DIVPERIPH, |
| 70 | * DIVATB, DIVPCLK_DBG, DIVAPLL } |
| 71 | */ |
| 72 | |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 73 | /* ARM L0: 1200MHz */ |
| 74 | { 0, 3, 7, 3, 4, 1, 7 }, |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 75 | |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 76 | /* ARM L1: 1000MHz */ |
| 77 | { 0, 3, 7, 3, 4, 1, 7 }, |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 78 | |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 79 | /* ARM L2: 800MHz */ |
| 80 | { 0, 3, 7, 3, 3, 1, 7 }, |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 81 | |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 82 | /* ARM L3: 500MHz */ |
| 83 | { 0, 3, 7, 3, 3, 1, 7 }, |
| 84 | |
| 85 | /* ARM L4: 200MHz */ |
| 86 | { 0, 1, 3, 1, 3, 1, 0 }, |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 87 | }; |
| 88 | |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 89 | static unsigned int clkdiv_cpu1[CPUFREQ_LEVEL_END][2] = { |
| 90 | /* |
| 91 | * Clock divider value for following |
| 92 | * { DIVCOPY, DIVHPM } |
| 93 | */ |
| 94 | |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 95 | /* ARM L0: 1200MHz */ |
| 96 | { 5, 0 }, |
| 97 | |
| 98 | /* ARM L1: 1000MHz */ |
| 99 | { 4, 0 }, |
| 100 | |
| 101 | /* ARM L2: 800MHz */ |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 102 | { 3, 0 }, |
| 103 | |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 104 | /* ARM L3: 500MHz */ |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 105 | { 3, 0 }, |
| 106 | |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 107 | /* ARM L4: 200MHz */ |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 108 | { 3, 0 }, |
| 109 | }; |
| 110 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 111 | static unsigned int exynos4210_apll_pms_table[CPUFREQ_LEVEL_END] = { |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 112 | /* APLL FOUT L0: 1200MHz */ |
| 113 | ((150 << 16) | (3 << 8) | 1), |
| 114 | |
| 115 | /* APLL FOUT L1: 1000MHz */ |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 116 | ((250 << 16) | (6 << 8) | 1), |
| 117 | |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 118 | /* APLL FOUT L2: 800MHz */ |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 119 | ((200 << 16) | (6 << 8) | 1), |
| 120 | |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 121 | /* APLL FOUT L3: 500MHz */ |
| 122 | ((250 << 16) | (6 << 8) | 2), |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 123 | |
Jaecheol Lee | ba9d780 | 2011-12-07 11:43:56 +0900 | [diff] [blame] | 124 | /* APLL FOUT L4: 200MHz */ |
| 125 | ((200 << 16) | (6 << 8) | 3), |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 126 | }; |
| 127 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 128 | static void exynos4210_set_clkdiv(unsigned int div_index) |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 129 | { |
| 130 | unsigned int tmp; |
| 131 | |
| 132 | /* Change Divider - CPU0 */ |
| 133 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 134 | tmp = exynos4210_clkdiv_table[div_index].clkdiv; |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 135 | |
| 136 | __raw_writel(tmp, S5P_CLKDIV_CPU); |
| 137 | |
| 138 | do { |
| 139 | tmp = __raw_readl(S5P_CLKDIV_STATCPU); |
| 140 | } while (tmp & 0x1111111); |
| 141 | |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 142 | /* Change Divider - CPU1 */ |
| 143 | |
| 144 | tmp = __raw_readl(S5P_CLKDIV_CPU1); |
| 145 | |
| 146 | tmp &= ~((0x7 << 4) | 0x7); |
| 147 | |
| 148 | tmp |= ((clkdiv_cpu1[div_index][0] << 4) | |
| 149 | (clkdiv_cpu1[div_index][1] << 0)); |
| 150 | |
| 151 | __raw_writel(tmp, S5P_CLKDIV_CPU1); |
| 152 | |
| 153 | do { |
| 154 | tmp = __raw_readl(S5P_CLKDIV_STATCPU1); |
| 155 | } while (tmp & 0x11); |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 156 | } |
| 157 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 158 | static void exynos4210_set_apll(unsigned int index) |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 159 | { |
| 160 | unsigned int tmp; |
| 161 | |
| 162 | /* 1. MUX_CORE_SEL = MPLL, ARMCLK uses MPLL for lock time */ |
| 163 | clk_set_parent(moutcore, mout_mpll); |
| 164 | |
| 165 | do { |
| 166 | tmp = (__raw_readl(S5P_CLKMUX_STATCPU) |
| 167 | >> S5P_CLKSRC_CPU_MUXCORE_SHIFT); |
| 168 | tmp &= 0x7; |
| 169 | } while (tmp != 0x2); |
| 170 | |
| 171 | /* 2. Set APLL Lock time */ |
| 172 | __raw_writel(S5P_APLL_LOCKTIME, S5P_APLL_LOCK); |
| 173 | |
| 174 | /* 3. Change PLL PMS values */ |
| 175 | tmp = __raw_readl(S5P_APLL_CON0); |
| 176 | tmp &= ~((0x3ff << 16) | (0x3f << 8) | (0x7 << 0)); |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 177 | tmp |= exynos4210_apll_pms_table[index]; |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 178 | __raw_writel(tmp, S5P_APLL_CON0); |
| 179 | |
| 180 | /* 4. wait_lock_time */ |
| 181 | do { |
| 182 | tmp = __raw_readl(S5P_APLL_CON0); |
| 183 | } while (!(tmp & (0x1 << S5P_APLLCON0_LOCKED_SHIFT))); |
| 184 | |
| 185 | /* 5. MUX_CORE_SEL = APLL */ |
| 186 | clk_set_parent(moutcore, mout_apll); |
| 187 | |
| 188 | do { |
| 189 | tmp = __raw_readl(S5P_CLKMUX_STATCPU); |
| 190 | tmp &= S5P_CLKMUX_STATCPU_MUXCORE_MASK; |
| 191 | } while (tmp != (0x1 << S5P_CLKSRC_CPU_MUXCORE_SHIFT)); |
| 192 | } |
| 193 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 194 | bool exynos4210_pms_change(unsigned int old_index, unsigned int new_index) |
| 195 | { |
| 196 | unsigned int old_pm = (exynos4210_apll_pms_table[old_index] >> 8); |
| 197 | unsigned int new_pm = (exynos4210_apll_pms_table[new_index] >> 8); |
| 198 | |
| 199 | return (old_pm == new_pm) ? 0 : 1; |
| 200 | } |
| 201 | |
| 202 | static void exynos4210_set_frequency(unsigned int old_index, |
| 203 | unsigned int new_index) |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 204 | { |
| 205 | unsigned int tmp; |
| 206 | |
| 207 | if (old_index > new_index) { |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 208 | if (!exynos4210_pms_change(old_index, new_index)) { |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 209 | /* 1. Change the system clock divider values */ |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 210 | exynos4210_set_clkdiv(new_index); |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 211 | |
| 212 | /* 2. Change just s value in apll m,p,s value */ |
| 213 | tmp = __raw_readl(S5P_APLL_CON0); |
| 214 | tmp &= ~(0x7 << 0); |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 215 | tmp |= (exynos4210_apll_pms_table[new_index] & 0x7); |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 216 | __raw_writel(tmp, S5P_APLL_CON0); |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 217 | } else { |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 218 | /* Clock Configuration Procedure */ |
| 219 | /* 1. Change the system clock divider values */ |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 220 | exynos4210_set_clkdiv(new_index); |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 221 | /* 2. Change the apll m,p,s value */ |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 222 | exynos4210_set_apll(new_index); |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 223 | } |
| 224 | } else if (old_index < new_index) { |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 225 | if (!exynos4210_pms_change(old_index, new_index)) { |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 226 | /* 1. Change just s value in apll m,p,s value */ |
| 227 | tmp = __raw_readl(S5P_APLL_CON0); |
| 228 | tmp &= ~(0x7 << 0); |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 229 | tmp |= (exynos4210_apll_pms_table[new_index] & 0x7); |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 230 | __raw_writel(tmp, S5P_APLL_CON0); |
| 231 | |
| 232 | /* 2. Change the system clock divider values */ |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 233 | exynos4210_set_clkdiv(new_index); |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 234 | } else { |
| 235 | /* Clock Configuration Procedure */ |
| 236 | /* 1. Change the apll m,p,s value */ |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 237 | exynos4210_set_apll(new_index); |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 238 | /* 2. Change the system clock divider values */ |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 239 | exynos4210_set_clkdiv(new_index); |
Sangwook Ju | bf5ce05 | 2010-12-22 16:49:32 +0900 | [diff] [blame] | 240 | } |
| 241 | } |
| 242 | } |
| 243 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 244 | int exynos4210_cpufreq_init(struct exynos_dvfs_info *info) |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 245 | { |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 246 | int i; |
| 247 | unsigned int tmp; |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 248 | unsigned long rate; |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 249 | |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 250 | cpu_clk = clk_get(NULL, "armclk"); |
| 251 | if (IS_ERR(cpu_clk)) |
| 252 | return PTR_ERR(cpu_clk); |
| 253 | |
| 254 | moutcore = clk_get(NULL, "moutcore"); |
| 255 | if (IS_ERR(moutcore)) |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 256 | goto err_moutcore; |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 257 | |
| 258 | mout_mpll = clk_get(NULL, "mout_mpll"); |
| 259 | if (IS_ERR(mout_mpll)) |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 260 | goto err_mout_mpll; |
| 261 | |
| 262 | rate = clk_get_rate(mout_mpll) / 1000; |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 263 | |
| 264 | mout_apll = clk_get(NULL, "mout_apll"); |
| 265 | if (IS_ERR(mout_apll)) |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 266 | goto err_mout_apll; |
MyungJoo Ham | 0073f53 | 2011-08-18 19:45:16 +0900 | [diff] [blame] | 267 | |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 268 | tmp = __raw_readl(S5P_CLKDIV_CPU); |
| 269 | |
| 270 | for (i = L0; i < CPUFREQ_LEVEL_END; i++) { |
| 271 | tmp &= ~(S5P_CLKDIV_CPU0_CORE_MASK | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 272 | S5P_CLKDIV_CPU0_COREM0_MASK | |
| 273 | S5P_CLKDIV_CPU0_COREM1_MASK | |
| 274 | S5P_CLKDIV_CPU0_PERIPH_MASK | |
| 275 | S5P_CLKDIV_CPU0_ATB_MASK | |
| 276 | S5P_CLKDIV_CPU0_PCLKDBG_MASK | |
| 277 | S5P_CLKDIV_CPU0_APLL_MASK); |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 278 | |
| 279 | tmp |= ((clkdiv_cpu0[i][0] << S5P_CLKDIV_CPU0_CORE_SHIFT) | |
| 280 | (clkdiv_cpu0[i][1] << S5P_CLKDIV_CPU0_COREM0_SHIFT) | |
| 281 | (clkdiv_cpu0[i][2] << S5P_CLKDIV_CPU0_COREM1_SHIFT) | |
| 282 | (clkdiv_cpu0[i][3] << S5P_CLKDIV_CPU0_PERIPH_SHIFT) | |
| 283 | (clkdiv_cpu0[i][4] << S5P_CLKDIV_CPU0_ATB_SHIFT) | |
| 284 | (clkdiv_cpu0[i][5] << S5P_CLKDIV_CPU0_PCLKDBG_SHIFT) | |
| 285 | (clkdiv_cpu0[i][6] << S5P_CLKDIV_CPU0_APLL_SHIFT)); |
| 286 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 287 | exynos4210_clkdiv_table[i].clkdiv = tmp; |
Jaecheol Lee | 27f805d | 2011-12-07 11:44:09 +0900 | [diff] [blame] | 288 | } |
| 289 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 290 | info->mpll_freq_khz = rate; |
| 291 | info->pm_lock_idx = L2; |
| 292 | info->pll_safe_idx = L2; |
| 293 | info->max_support_idx = max_support_idx; |
| 294 | info->min_support_idx = min_support_idx; |
| 295 | info->cpu_clk = cpu_clk; |
| 296 | info->volt_table = exynos4210_volt_table; |
| 297 | info->freq_table = exynos4210_freq_table; |
| 298 | info->set_freq = exynos4210_set_frequency; |
| 299 | info->need_apll_change = exynos4210_pms_change; |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 300 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 301 | return 0; |
| 302 | |
| 303 | err_mout_apll: |
| 304 | if (!IS_ERR(mout_mpll)) |
| 305 | clk_put(mout_mpll); |
| 306 | err_mout_mpll: |
| 307 | if (!IS_ERR(moutcore)) |
| 308 | clk_put(moutcore); |
| 309 | err_moutcore: |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 310 | if (!IS_ERR(cpu_clk)) |
| 311 | clk_put(cpu_clk); |
| 312 | |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 313 | pr_debug("%s: failed initialization\n", __func__); |
Sunyoung Kang | f40f91f | 2010-09-16 17:59:21 +0900 | [diff] [blame] | 314 | return -EINVAL; |
| 315 | } |
Jaecheol Lee | a125a17 | 2012-01-07 20:18:35 +0900 | [diff] [blame^] | 316 | EXPORT_SYMBOL(exynos4210_cpufreq_init); |