summaryrefstree
path: root/kernel/drivers/cpufreq/exynos5430-kfc-cpufreq.c
blob: d478c77625b808d4596ad273699787d2267fedc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
/*
 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
 *
 * EXYNOS5430 - KFC Core frequency scaling support
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
*/

#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/cpufreq.h>
#include <linux/clk-private.h>

#include <mach/map.h>
#include <mach/regs-clock.h>
#include <mach/regs-clock-exynos5430.h>
#include <mach/regs-pmu.h>
#include <mach/cpufreq.h>
#include <mach/asv-exynos.h>

#define CPUFREQ_LEVEL_END_CA7	(L18 + 1)
#define L2_LOCAL_PWR_EN		0x7

#undef PRINT_DIV_VAL
#undef ENABLE_CLKOUT

static int max_support_idx_CA7;
static int min_support_idx_CA7 = (CPUFREQ_LEVEL_END_CA7 - 1);

static struct clk *mout_kfc;
static struct clk *mout_kfc_pll;
static struct clk *sclk_bus_pll;
static struct clk *mout_bus_pll_user;
static struct clk *fout_kfc_pll;

static unsigned int exynos5430_volt_table_CA7[CPUFREQ_LEVEL_END_CA7];
static unsigned int exynos5430_abb_table_CA7[CPUFREQ_LEVEL_END_CA7];

static struct cpufreq_frequency_table exynos5430_freq_table_CA7[] = {
	{L0,  2000 * 1000},
	{L1,  1900 * 1000},
	{L2,  1800 * 1000},
	{L3,  1700 * 1000},
	{L4,  1600 * 1000},
	{L5,  1500 * 1000},
	{L6,  1400 * 1000},
	{L7,  1300 * 1000},
	{L8,  1200 * 1000},
	{L9,  1100 * 1000},
	{L10, 1000 * 1000},
	{L11,  900 * 1000},
	{L12,  800 * 1000},
	{L13,  700 * 1000},
	{L14,  600 * 1000},
	{L15,  500 * 1000},
	{L16,  400 * 1000},
	{L17,  300 * 1000},
	{L18,  200 * 1000},
	{0, CPUFREQ_TABLE_END},
};

static struct cpufreq_clkdiv exynos5430_clkdiv_table_CA7[CPUFREQ_LEVEL_END_CA7];

static unsigned int clkdiv_cpu0_5430_CA7[CPUFREQ_LEVEL_END_CA7][7] = {
	/*
	 * Clock divider value for following
	 * { KFC1, KFC2, ACLK_KFC, PCLK_KFC,
	 *   ATCLK, PCLK_DBG_KFC, SCLK_CNTCLK }
	 */

	/* ARM L0: 2.0GHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L1: 1.9GMHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L2: 1.8GMHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L3: 1.7GHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L4: 1.6GHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L5: 1.5GMHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L6: 1.4GMHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L7: 1.3GHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L8: 1.2GHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L9: 1.1GHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L10: 1000MHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L11: 900MHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L12: 800MHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L13: 700MHz */
	{ 0, 0, 2, 7, 7, 7, 3 },

	/* ARM L14: 600MHz */
	{ 0, 0, 1, 7, 7, 7, 3 },

	/* ARM L15: 500MHz */
	{ 0, 0, 1, 7, 7, 7, 3 },

	/* ARM L16: 400MHz */
	{ 0, 0, 1, 7, 7, 7, 3 },

	/* ARM L17: 300MHz */
	{ 0, 0, 1, 7, 7, 7, 3 },

	/* ARM L18: 200MHz */
	{ 0, 0, 1, 7, 7, 7, 3 },
};

static unsigned int clkdiv_cpu1_5430_CA7[CPUFREQ_LEVEL_END_CA7][2] = {
	/*
	 * Clock divider value for following
	 * { SCLK_KFC_PLL, SCLK_HPM_KFC }
	 */

	/* ARM L0: 2.0GHz */
	{ 2, 7 },

	/* ARM L1: 1.9GMHz */
	{ 2, 7 },

	/* ARM L2: 1.8GMHz */
	{ 2, 7 },

	/* ARM L3: 1.7GHz */
	{ 2, 7 },

	/* ARM L4: 1.6GHz */
	{ 2, 7 },

	/* ARM L5: 1.5GMHz */
	{ 2, 7 },

	/* ARM L6: 1.4GMHz */
	{ 2, 7 },

	/* ARM L7: 1.3GHz */
	{ 2, 7 },

	/* ARM L8: 1.2GHz */
	{ 2, 7 },

	/* ARM L9: 1.1GHz */
	{ 2, 7 },

	/* ARM L10: 1000MHz */
	{ 2, 7 },

	/* ARM L11: 900MHz */
	{ 2, 7 },

	/* ARM L12: 800MHz */
	{ 2, 7 },

	/* ARM L13: 700MHz */
	{ 2, 7 },

	/* ARM L14: 600MHz */
	{ 2, 7 },

	/* ARM L15: 500MHz */
	{ 2, 7 },

	/* ARM L16: 400MHz */
	{ 2, 7 },

	/* ARM L17: 300MHz */
	{ 2, 7 },

	/* ARM L18: 200MHz */
	{ 2, 7 },
};

static unsigned int exynos5430_kfc_pll_pms_table_CA7[CPUFREQ_LEVEL_END_CA7] = {
	/* MDIV | PDIV | SDIV */
	/* KPLL FOUT L0: 2.0GHz */
	PLL2450X_PMS(500, 6, 0),

	/* KPLL FOUT L1: 1.9GHz */
	PLL2450X_PMS(475, 6, 0),

	/* KPLL FOUT L2: 1.8GHz */
	PLL2450X_PMS(375, 5, 0),

	/* KPLL FOUT L3: 1.7GHz */
	PLL2450X_PMS(425, 6, 0),

	/* KPLL FOUT L4: 1.6GHz */
	PLL2450X_PMS(400, 6, 0),

	/* KPLL FOUT L5: 1.5GHz */
	PLL2450X_PMS(250, 4, 0),

	/* KPLL FOUT L6: 1.4GHz */
	PLL2450X_PMS(350, 6, 0),

	/* KPLL FOUT L7: 1.3GHz */
	PLL2450X_PMS(325, 6, 0),

	/* KPLL FOUT L8: 1.2GHz */
	PLL2450X_PMS(500, 5, 1),

	/* KPLL FOUT L9: 1.1GHz */
	PLL2450X_PMS(550, 6, 1),

	/* KPLL FOUT L10: 1000MHz */
	PLL2450X_PMS(500, 6, 1),

	/* KPLL FOUT L11: 900MHz */
	PLL2450X_PMS(375, 5, 1),

	/* KPLL FOUT L12: 800MHz */
	PLL2450X_PMS(400, 6, 1),

	/* KPLL FOUT L13: 700MHz */
	PLL2450X_PMS(350, 6, 1),

	/* KPLL FOUT L14: 600MHz */
	PLL2450X_PMS(500, 5, 2),

	/* KPLL FOUT L15: 500MHz */
	PLL2450X_PMS(500, 6, 2),

	/* KPLL FOUT L16: 400MHz */
	PLL2450X_PMS(400, 6, 2),

	/* KPLL FOUT L17: 300MHz */
	PLL2450X_PMS(500, 5, 3),

	/* KPLL FOUT L18: 200MHz */
	PLL2450X_PMS(400, 6, 3),
};

/*
 * ASV group voltage table
 */
static const unsigned int asv_voltage_5430_CA7[CPUFREQ_LEVEL_END_CA7] = {
	1225000,	/* L0  2000 */
	1225000,	/* L1  1900 */
	1225000,	/* L2  1800 */
	1225000,	/* L3  1700 */
	1225000,	/* L4  1600 */
	1225000,	/* L5  1500 */
	1187500,	/* L6  1400 */
	1150000,	/* L7  1300 */
	1112500,	/* L8  1200 */
	1075000,	/* L9  1100 */
	1037500,	/* L10 1000 */
	1000000,	/* L11  900 */
	 975000,	/* L12  800 */
	 950000,	/* L13  700 */
	 925000,	/* L14  600 */
	 925000,	/* L15  500 */
	 925000,	/* L16  400 */
	 925000,	/* L17  300 */
	 925000,	/* L18  200 */
};

/* Minimum memory throughput in megabytes per second */
static int exynos5430_bus_table_CA7[CPUFREQ_LEVEL_END_CA7] = {
#if defined(CONFIG_EXYNOS5430_HD)
	633000,		/* 2.0 GHz */
	633000,		/* 1.9 GHz */
	633000,		/* 1.8 GHz */
	633000,		/* 1.7 GHz */
	633000,		/* 1.6 GHz */
	633000,		/* 1.5 GHz */
	633000,		/* 1.4 GHz */
	633000,		/* 1.3 GHz */
	633000,		/* 1.2 GHz */
	413000,		/* 1.1 GHz */
	413000,		/* 1.0 GHz */
	158000,		/* 900 MHz */
	158000,		/* 800 MHz */
	158000,		/* 700 MHz */
	158000,		/* 600 MHz */
	0,		/* 500 MHz */
	0,		/* 400 MHz */
	0,		/* 300 MHz */
	0,		/* 200 MHz */
#else
	633000,		/* 2.0 GHz */
	633000,		/* 1.9 GHz */
	633000,		/* 1.8 GHz */
	633000,		/* 1.7 GHz */
	633000,		/* 1.6 GHz */
	633000,		/* 1.5 GHz */
	633000,		/* 1.4 GHz */
	633000,		/* 1.3 GHz */
	633000,		/* 1.2 GHz */
	633000,		/* 1.1 GHz */
	543000,		/* 1.0 GHz */
	158000,		/* 900 MHz */
	158000,		/* 800 MHz */
	136000,		/* 700 MHz */
	136000,		/* 600 MHz */
	0,		/* 500 MHz */
	0,		/* 400 MHz */
	0,		/* 300 MHz */
	0,		/* 200 MHz */
#endif
};

static void exynos5430_set_clkdiv_CA7(unsigned int div_index)
{
	unsigned int tmp, tmp1;

	/* Change Divider - KFC0 */
	tmp = exynos5430_clkdiv_table_CA7[div_index].clkdiv0;

	__raw_writel(tmp, EXYNOS5430_DIV_KFC0);

	while (__raw_readl(EXYNOS5430_DIV_STAT_KFC0) & 0x1111111)
		cpu_relax();

	/* Change Divider - KFC1 */
	tmp1 = exynos5430_clkdiv_table_CA7[div_index].clkdiv1;

	__raw_writel(tmp1, EXYNOS5430_DIV_KFC1);

	while (__raw_readl(EXYNOS5430_DIV_STAT_KFC1) & 0x11)
		cpu_relax();

#ifdef PRINT_DIV_VAL
	tmp = __raw_readl(EXYNOS5430_DIV_KFC0);
	tmp1 = __raw_readl(EXYNOS5430_DIV_KFC1);
	pr_info("%s: DIV_KFC0[0x%08x], DIV_KFC1[0x%08x]\n",
					__func__, tmp, tmp1);
#endif
}

static void exynos5430_set_kfc_pll_CA7(unsigned int new_index, unsigned int old_index)
{
	unsigned int tmp, pdiv;

	/* 1. before change to BUS_PLL, set div for BUS_PLL output */
	if ((new_index < L12) && (old_index < L12))
		exynos5430_set_clkdiv_CA7(L12); /* pll_safe_idx of CA7 */

	/* 2. CLKMUX_SEL_KFC2 = MOUT_BUS_PLL_USER, KFCCLK uses BUS_PLL_USER for lock time */
	if (clk_set_parent(mout_kfc, mout_bus_pll_user))
		pr_err("Unable to set parent %s of clock %s.\n",
				mout_bus_pll_user->name, mout_kfc->name);
	do {
		cpu_relax();
		tmp = __raw_readl(EXYNOS5430_SRC_STAT_KFC2);
		tmp &= EXYNOS5430_SRC_STAT_KFC2_KFC_MASK;
	} while (tmp != 0x2);

	/* 3. Set KFC_PLL Lock time */
	pdiv = ((exynos5430_kfc_pll_pms_table_CA7[new_index] &
		EXYNOS5430_PLL_PDIV_MASK) >> EXYNOS5430_PLL_PDIV_SHIFT);

	__raw_writel((pdiv * 150), EXYNOS5430_KFC_PLL_LOCK);

	/* 4. Change PLL PMS values */
	tmp = __raw_readl(EXYNOS5430_KFC_PLL_CON0);
	tmp &= ~(EXYNOS5430_PLL_MDIV_MASK |
		EXYNOS5430_PLL_PDIV_MASK |
		EXYNOS5430_PLL_SDIV_MASK);
	tmp |= exynos5430_kfc_pll_pms_table_CA7[new_index];
	__raw_writel(tmp, EXYNOS5430_KFC_PLL_CON0);

	/* 5. wait_lock_time */
	do {
		cpu_relax();
		tmp = __raw_readl(EXYNOS5430_KFC_PLL_CON0);
	} while (!(tmp & (0x1 << EXYNOS5430_KFC_PLL_CON0_LOCKED_SHIFT)));

	/* 6. CLKMUX_SEL_KFC2 = MOUT_KFC_PLL */
	if (clk_set_parent(mout_kfc, mout_kfc_pll))
		pr_err("Unable to set parent %s of clock %s.\n",
				mout_kfc_pll->name, mout_kfc->name);
	do {
		cpu_relax();
		tmp = __raw_readl(EXYNOS5430_SRC_STAT_KFC2);
		tmp &= EXYNOS5430_SRC_STAT_KFC2_KFC_MASK;
	} while (tmp != 0x1);

	/* 7. restore original div value */
	if ((new_index < L12) && (old_index < L12))
		exynos5430_set_clkdiv_CA7(new_index);
}

static bool exynos5430_pms_change_CA7(unsigned int old_index,
				      unsigned int new_index)
{
	unsigned int old_pm = (exynos5430_kfc_pll_pms_table_CA7[old_index] >>
				EXYNOS5430_PLL_PDIV_SHIFT);
	unsigned int new_pm = (exynos5430_kfc_pll_pms_table_CA7[new_index] >>
				EXYNOS5430_PLL_PDIV_SHIFT);

	return (old_pm == new_pm) ? 0 : 1;
}

static void exynos5430_set_frequency_CA7(unsigned int old_index,
					 unsigned int new_index)
{
	unsigned int tmp;

	if (old_index > new_index) {
		if (!exynos5430_pms_change_CA7(old_index, new_index)) {
			/* 1. Change the system clock divider values */
			exynos5430_set_clkdiv_CA7(new_index);
			/* 2. Change just s value in kfc_pll m,p,s value */
			tmp = __raw_readl(EXYNOS5430_KFC_PLL_CON0);
			tmp &= ~EXYNOS5430_PLL_SDIV_MASK;
			tmp |= (exynos5430_kfc_pll_pms_table_CA7[new_index] & EXYNOS5430_PLL_SDIV_MASK);
			__raw_writel(tmp, EXYNOS5430_KFC_PLL_CON0);
		} else {
			/* Clock Configuration Procedure */
			/* 1. Change the system clock divider values */
			exynos5430_set_clkdiv_CA7(new_index);
			/* 2. Change the kfc_pll m,p,s value */
			exynos5430_set_kfc_pll_CA7(new_index, old_index);
		}
	} else if (old_index < new_index) {
		if (!exynos5430_pms_change_CA7(old_index, new_index)) {
			/* 1. Change just s value in kfc_pll m,p,s value */
			tmp = __raw_readl(EXYNOS5430_KFC_PLL_CON0);
			tmp &= ~EXYNOS5430_PLL_SDIV_MASK;
			tmp |= (exynos5430_kfc_pll_pms_table_CA7[new_index] & EXYNOS5430_PLL_SDIV_MASK);
			__raw_writel(tmp, EXYNOS5430_KFC_PLL_CON0);
			/* 2. Change the system clock divider values */
			exynos5430_set_clkdiv_CA7(new_index);
		} else {
			/* Clock Configuration Procedure */
			/* 1. Change the kfc_pll m,p,s value */
			exynos5430_set_kfc_pll_CA7(new_index, old_index);
			/* 2. Change the system clock divider values */
			exynos5430_set_clkdiv_CA7(new_index);
		}
	}

	clk_set_rate(fout_kfc_pll, exynos5430_freq_table_CA7[new_index].frequency * 1000);
}

static void __init set_volt_table_CA7(void)
{
	unsigned int i;
	unsigned int asv_volt = 0;

	for (i = 0; i < CPUFREQ_LEVEL_END_CA7; i++) {
		asv_volt = get_match_volt(ID_KFC, exynos5430_freq_table_CA7[i].frequency);
		if (!asv_volt)
			exynos5430_volt_table_CA7[i] = asv_voltage_5430_CA7[i];
		else
			exynos5430_volt_table_CA7[i] = asv_volt;

		pr_info("CPUFREQ of CA7  L%d : %d uV\n", i,
				exynos5430_volt_table_CA7[i]);

		exynos5430_abb_table_CA7[i] =
			get_match_abb(ID_KFC, exynos5430_freq_table_CA7[i].frequency);

		pr_info("CPUFREQ of CA7  L%d : ABB %d\n", i,
				exynos5430_abb_table_CA7[i]);
	}

#if defined(CONFIG_SOC_EXYNOS5430_L)
	max_support_idx_CA7 = L7;	/* 1.3GHz */
#else
	max_support_idx_CA7 = L5;	/* 1.5GHz */
#endif
	min_support_idx_CA7 = L15;	/* 500MHz */

	pr_info("CPUFREQ of CA7 max_freq : L%d %u khz\n", max_support_idx_CA7,
		exynos5430_freq_table_CA7[max_support_idx_CA7].frequency);
	pr_info("CPUFREQ of CA7 min_freq : L%d %u khz\n", min_support_idx_CA7,
		exynos5430_freq_table_CA7[min_support_idx_CA7].frequency);
}

static bool exynos5430_is_alive_CA7(void)
{
	unsigned int tmp;

	tmp = __raw_readl(EXYNOS5430_KFC_PLL_CON1);
	tmp &= EXYNOS5430_PLL_BYPASS_MASK;
	tmp >>= EXYNOS5430_PLL_BYPASS_SHIFT;

	return !tmp ? true : false;
}

int __init exynos5_cpufreq_CA7_init(struct exynos_dvfs_info *info)
{
	int i;
	unsigned int tmp;
	unsigned long rate;

	set_volt_table_CA7();

	mout_kfc = __clk_lookup("mout_kfc");
	if (!mout_kfc) {
		pr_err("failed get mout_kfc clk\n");
		return -EINVAL;
	}

	mout_kfc_pll = __clk_lookup("mout_kfc_pll");
	if (!mout_kfc_pll) {
		pr_err("failed get mout_kfc_pll clk\n");
		goto err_mout_kfc_pll;
	}

	sclk_bus_pll = __clk_lookup("sclk_bus_pll");
	if (!sclk_bus_pll) {
		pr_err("failed get sclk_bus_pll clk\n");
		goto err_sclk_bus_pll;
	}

	mout_bus_pll_user = __clk_lookup("mout_bus_pll_kfc_user");
	if (!mout_bus_pll_user) {
		pr_err("failed get mout_bus_pll_kfc_user clk\n");
		goto err_mout_bus_pll_user;
	}

	if (clk_set_parent(mout_bus_pll_user, sclk_bus_pll)) {
		pr_err("Unable to set parent %s of clock %s.\n",
				sclk_bus_pll->name, mout_bus_pll_user->name);
		goto err_clk_set_parent;
	}

	rate = clk_get_rate(mout_bus_pll_user) / 1000;

	fout_kfc_pll = __clk_lookup("fout_kfc_pll");
	if (!fout_kfc_pll) {
		pr_err("failed get fout_kfc_pll clk\n");
		goto err_fout_kfc_pll;
	}

	clk_put(sclk_bus_pll);

	for (i = L0; i < CPUFREQ_LEVEL_END_CA7; i++) {
		exynos5430_clkdiv_table_CA7[i].index = i;

		/* CLK_DIV_KFC0 */
		tmp = __raw_readl(EXYNOS5430_DIV_KFC0);

		tmp &= ~(EXYNOS5430_DIV_KFC0_KFC1_MASK |
			EXYNOS5430_DIV_KFC0_KFC2_MASK |
			EXYNOS5430_DIV_KFC0_ACLK_KFC_MASK |
			EXYNOS5430_DIV_KFC0_PCLK_KFC_MASK |
			EXYNOS5430_DIV_KFC0_ATCLK_KFC_MASK |
			EXYNOS5430_DIV_KFC0_PCLK_DBG_KFC_MASK |
			EXYNOS5430_DIV_KFC0_CNTCLK_KFC_MASK);

		tmp |= ((clkdiv_cpu0_5430_CA7[i][0] << EXYNOS5430_DIV_KFC0_KFC1_SHIFT) |
			(clkdiv_cpu0_5430_CA7[i][1] << EXYNOS5430_DIV_KFC0_KFC2_SHIFT) |
			(clkdiv_cpu0_5430_CA7[i][2] << EXYNOS5430_DIV_KFC0_ACLK_KFC_SHIFT) |
			(clkdiv_cpu0_5430_CA7[i][3] << EXYNOS5430_DIV_KFC0_PCLK_KFC_SHIFT) |
			(clkdiv_cpu0_5430_CA7[i][4] << EXYNOS5430_DIV_KFC0_ATCLK_KFC_SHIFT) |
			(clkdiv_cpu0_5430_CA7[i][5] << EXYNOS5430_DIV_KFC0_PCLK_DBG_KFC_SHIFT) |
			(clkdiv_cpu0_5430_CA7[i][6] << EXYNOS5430_DIV_KFC0_CNTCLK_KFC_SHIFT));

		exynos5430_clkdiv_table_CA7[i].clkdiv0 = tmp;

		/* CLK_DIV_KFC1 */
		tmp = __raw_readl(EXYNOS5430_DIV_KFC1);

		tmp &= ~(EXYNOS5430_DIV_KFC1_KFC_PLL_MASK |
			EXYNOS5430_DIV_KFC1_SCLK_HPM_KFC_MASK);

		tmp |= ((clkdiv_cpu1_5430_CA7[i][0] << EXYNOS5430_DIV_KFC1_KFC_PLL_SHIFT) |
			(clkdiv_cpu1_5430_CA7[i][1] << EXYNOS5430_DIV_KFC1_SCLK_HPM_KFC_SHIFT));

		exynos5430_clkdiv_table_CA7[i].clkdiv1 = tmp;
	}

	info->mpll_freq_khz = rate;
	info->pll_safe_idx = L12;
	info->max_support_idx = max_support_idx_CA7;
	info->min_support_idx = min_support_idx_CA7;
	info->boost_freq = exynos5430_freq_table_CA7[L10].frequency;
	/* booting frequency is 1.3GHz */
	info->boot_cpu_min_qos = exynos5430_freq_table_CA7[L7].frequency;
	info->boot_cpu_max_qos = exynos5430_freq_table_CA7[L7].frequency;
	info->bus_table = exynos5430_bus_table_CA7;
	info->cpu_clk = fout_kfc_pll;

	info->volt_table = exynos5430_volt_table_CA7;
	info->abb_table = exynos5430_abb_table_CA7;
	info->freq_table = exynos5430_freq_table_CA7;
	info->set_freq = exynos5430_set_frequency_CA7;
	info->need_apll_change = exynos5430_pms_change_CA7;
	info->is_alive = exynos5430_is_alive_CA7;

#ifdef ENABLE_CLKOUT
	/* dividing KFC_CLK to 1/16 */
	tmp = __raw_readl(EXYNOS5430_CLKOUT_CMU_KFC);
	tmp &= ~0xfff;
	tmp |= 0xf01;
	__raw_writel(tmp, EXYNOS5430_CLKOUT_CMU_KFC);
#endif

	return 0;

err_fout_kfc_pll:
err_clk_set_parent:
	clk_put(mout_bus_pll_user);
err_mout_bus_pll_user:
	clk_put(sclk_bus_pll);
err_sclk_bus_pll:
	clk_put(mout_kfc_pll);
err_mout_kfc_pll:
	clk_put(mout_kfc);

	pr_debug("%s: failed initialization\n", __func__);
	return -EINVAL;
}