clock.c 26.2 KB
Newer Older
K
Kukjin Kim 已提交
1
/* linux/arch/arm/mach-exynos4/clock.c
2
 *
K
Kukjin Kim 已提交
3 4
 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
5
 *
K
Kukjin Kim 已提交
6
 * EXYNOS4 - Clock support
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
 *
 * 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/io.h>

#include <plat/cpu-freq.h>
#include <plat/clock.h>
#include <plat/cpu.h>
#include <plat/pll.h>
#include <plat/s5p-clock.h>
#include <plat/clock-clksrc.h>

#include <mach/map.h>
#include <mach/regs-clock.h>

static struct clk clk_sclk_hdmi27m = {
	.name		= "sclk_hdmi27m",
	.id		= -1,
	.rate		= 27000000,
};

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
static struct clk clk_sclk_hdmiphy = {
	.name		= "sclk_hdmiphy",
	.id		= -1,
};

static struct clk clk_sclk_usbphy0 = {
	.name		= "sclk_usbphy0",
	.id		= -1,
	.rate		= 27000000,
};

static struct clk clk_sclk_usbphy1 = {
	.name		= "sclk_usbphy1",
	.id		= -1,
};

K
Kukjin Kim 已提交
49
static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
50 51 52 53
{
	return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable);
}

K
Kukjin Kim 已提交
54
static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
55 56 57 58
{
	return s5p_gatectrl(S5P_CLKSRC_MASK_CAM, clk, enable);
}

K
Kukjin Kim 已提交
59
static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
60 61 62 63
{
	return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable);
}

K
Kukjin Kim 已提交
64
static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable)
65 66 67 68
{
	return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable);
}

K
Kukjin Kim 已提交
69
static int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
70 71 72 73
{
	return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable);
}

K
Kukjin Kim 已提交
74
static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
75 76 77 78
{
	return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable);
}

K
Kukjin Kim 已提交
79
static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
80 81 82 83
{
	return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable);
}

K
Kukjin Kim 已提交
84
static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
J
Jongpill Lee 已提交
85 86 87 88
{
	return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
}

K
Kukjin Kim 已提交
89
static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
J
Jongpill Lee 已提交
90 91 92 93
{
	return s5p_gatectrl(S5P_CLKGATE_IP_IMAGE, clk, enable);
}

K
Kukjin Kim 已提交
94
static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
J
Jongpill Lee 已提交
95 96 97 98
{
	return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable);
}

K
Kukjin Kim 已提交
99
static int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
J
Jongpill Lee 已提交
100 101 102 103
{
	return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable);
}

K
Kukjin Kim 已提交
104
static int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
105 106 107 108
{
	return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable);
}

K
Kukjin Kim 已提交
109
static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
110 111 112 113
{
	return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable);
}

K
Kukjin Kim 已提交
114
static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
J
Jongpill Lee 已提交
115 116 117 118
{
	return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
}

119 120 121 122 123 124 125 126 127
/* Core list of CMU_CPU side */

static struct clksrc_clk clk_mout_apll = {
	.clk	= {
		.name		= "mout_apll",
		.id		= -1,
	},
	.sources	= &clk_src_apll,
	.reg_src	= { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 },
128 129 130 131 132 133 134 135
};

static struct clksrc_clk clk_sclk_apll = {
	.clk	= {
		.name		= "sclk_apll",
		.id		= -1,
		.parent		= &clk_mout_apll.clk,
	},
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 },
};

static struct clksrc_clk clk_mout_epll = {
	.clk	= {
		.name		= "mout_epll",
		.id		= -1,
	},
	.sources	= &clk_src_epll,
	.reg_src	= { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 },
};

static struct clksrc_clk clk_mout_mpll = {
	.clk = {
		.name		= "mout_mpll",
		.id		= -1,
	},
	.sources	= &clk_src_mpll,
	.reg_src	= { .reg = S5P_CLKSRC_CPU, .shift = 8, .size = 1 },
};

static struct clk *clkset_moutcore_list[] = {
158
	[0] = &clk_mout_apll.clk,
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
	[1] = &clk_mout_mpll.clk,
};

static struct clksrc_sources clkset_moutcore = {
	.sources	= clkset_moutcore_list,
	.nr_sources	= ARRAY_SIZE(clkset_moutcore_list),
};

static struct clksrc_clk clk_moutcore = {
	.clk	= {
		.name		= "moutcore",
		.id		= -1,
	},
	.sources	= &clkset_moutcore,
	.reg_src	= { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 },
};

static struct clksrc_clk clk_coreclk = {
	.clk	= {
		.name		= "core_clk",
		.id		= -1,
		.parent		= &clk_moutcore.clk,
	},
	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 },
};

static struct clksrc_clk clk_armclk = {
	.clk	= {
		.name		= "armclk",
		.id		= -1,
		.parent		= &clk_coreclk.clk,
	},
};

static struct clksrc_clk clk_aclk_corem0 = {
	.clk	= {
		.name		= "aclk_corem0",
		.id		= -1,
		.parent		= &clk_coreclk.clk,
	},
	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
};

static struct clksrc_clk clk_aclk_cores = {
	.clk	= {
		.name		= "aclk_cores",
		.id		= -1,
		.parent		= &clk_coreclk.clk,
	},
	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
};

static struct clksrc_clk clk_aclk_corem1 = {
	.clk	= {
		.name		= "aclk_corem1",
		.id		= -1,
		.parent		= &clk_coreclk.clk,
	},
	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 },
};

static struct clksrc_clk clk_periphclk = {
	.clk	= {
		.name		= "periphclk",
		.id		= -1,
		.parent		= &clk_coreclk.clk,
	},
	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 },
};

/* Core list of CMU_CORE side */

static struct clk *clkset_corebus_list[] = {
	[0] = &clk_mout_mpll.clk,
233
	[1] = &clk_sclk_apll.clk,
234 235 236 237 238 239 240 241 242 243 244 245 246
};

static struct clksrc_sources clkset_mout_corebus = {
	.sources	= clkset_corebus_list,
	.nr_sources	= ARRAY_SIZE(clkset_corebus_list),
};

static struct clksrc_clk clk_mout_corebus = {
	.clk	= {
		.name		= "mout_corebus",
		.id		= -1,
	},
	.sources	= &clkset_mout_corebus,
247
	.reg_src	= { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 },
248 249 250 251 252 253 254 255
};

static struct clksrc_clk clk_sclk_dmc = {
	.clk	= {
		.name		= "sclk_dmc",
		.id		= -1,
		.parent		= &clk_mout_corebus.clk,
	},
256
	.reg_div	= { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 },
257 258 259 260 261 262 263 264
};

static struct clksrc_clk clk_aclk_cored = {
	.clk	= {
		.name		= "aclk_cored",
		.id		= -1,
		.parent		= &clk_sclk_dmc.clk,
	},
265
	.reg_div	= { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 },
266 267 268 269 270 271 272 273
};

static struct clksrc_clk clk_aclk_corep = {
	.clk	= {
		.name		= "aclk_corep",
		.id		= -1,
		.parent		= &clk_aclk_cored.clk,
	},
274
	.reg_div	= { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 },
275 276 277 278 279 280 281 282
};

static struct clksrc_clk clk_aclk_acp = {
	.clk	= {
		.name		= "aclk_acp",
		.id		= -1,
		.parent		= &clk_mout_corebus.clk,
	},
283
	.reg_div	= { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 },
284 285 286 287 288 289 290 291
};

static struct clksrc_clk clk_pclk_acp = {
	.clk	= {
		.name		= "pclk_acp",
		.id		= -1,
		.parent		= &clk_aclk_acp.clk,
	},
292
	.reg_div	= { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 },
293 294 295 296 297 298
};

/* Core list of CMU_TOP side */

static struct clk *clkset_aclk_top_list[] = {
	[0] = &clk_mout_mpll.clk,
299
	[1] = &clk_sclk_apll.clk,
300 301
};

302
static struct clksrc_sources clkset_aclk = {
303 304 305 306 307 308 309 310 311
	.sources	= clkset_aclk_top_list,
	.nr_sources	= ARRAY_SIZE(clkset_aclk_top_list),
};

static struct clksrc_clk clk_aclk_200 = {
	.clk	= {
		.name		= "aclk_200",
		.id		= -1,
	},
312
	.sources	= &clkset_aclk,
313 314 315 316 317 318 319 320 321
	.reg_src	= { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 },
	.reg_div	= { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 },
};

static struct clksrc_clk clk_aclk_100 = {
	.clk	= {
		.name		= "aclk_100",
		.id		= -1,
	},
322
	.sources	= &clkset_aclk,
323 324 325 326 327 328 329 330 331
	.reg_src	= { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 },
	.reg_div	= { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 },
};

static struct clksrc_clk clk_aclk_160 = {
	.clk	= {
		.name		= "aclk_160",
		.id		= -1,
	},
332
	.sources	= &clkset_aclk,
333 334 335 336 337 338 339 340 341
	.reg_src	= { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 },
	.reg_div	= { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 },
};

static struct clksrc_clk clk_aclk_133 = {
	.clk	= {
		.name		= "aclk_133",
		.id		= -1,
	},
342
	.sources	= &clkset_aclk,
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
	.reg_src	= { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 },
	.reg_div	= { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 },
};

static struct clk *clkset_vpllsrc_list[] = {
	[0] = &clk_fin_vpll,
	[1] = &clk_sclk_hdmi27m,
};

static struct clksrc_sources clkset_vpllsrc = {
	.sources	= clkset_vpllsrc_list,
	.nr_sources	= ARRAY_SIZE(clkset_vpllsrc_list),
};

static struct clksrc_clk clk_vpllsrc = {
	.clk	= {
		.name		= "vpll_src",
		.id		= -1,
K
Kukjin Kim 已提交
361
		.enable		= exynos4_clksrc_mask_top_ctrl,
362
		.ctrlbit	= (1 << 0),
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
	},
	.sources	= &clkset_vpllsrc,
	.reg_src	= { .reg = S5P_CLKSRC_TOP1, .shift = 0, .size = 1 },
};

static struct clk *clkset_sclk_vpll_list[] = {
	[0] = &clk_vpllsrc.clk,
	[1] = &clk_fout_vpll,
};

static struct clksrc_sources clkset_sclk_vpll = {
	.sources	= clkset_sclk_vpll_list,
	.nr_sources	= ARRAY_SIZE(clkset_sclk_vpll_list),
};

static struct clksrc_clk clk_sclk_vpll = {
	.clk	= {
		.name		= "sclk_vpll",
		.id		= -1,
	},
	.sources	= &clkset_sclk_vpll,
	.reg_src	= { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 },
};

387
static struct clk init_clocks_off[] = {
388 389 390 391
	{
		.name		= "timers",
		.id		= -1,
		.parent		= &clk_aclk_100.clk,
K
Kukjin Kim 已提交
392
		.enable		= exynos4_clk_ip_peril_ctrl,
393
		.ctrlbit	= (1<<24),
J
Jongpill Lee 已提交
394 395 396
	}, {
		.name		= "csis",
		.id		= 0,
K
Kukjin Kim 已提交
397
		.enable		= exynos4_clk_ip_cam_ctrl,
J
Jongpill Lee 已提交
398 399 400 401
		.ctrlbit	= (1 << 4),
	}, {
		.name		= "csis",
		.id		= 1,
K
Kukjin Kim 已提交
402
		.enable		= exynos4_clk_ip_cam_ctrl,
J
Jongpill Lee 已提交
403 404 405 406
		.ctrlbit	= (1 << 5),
	}, {
		.name		= "fimc",
		.id		= 0,
K
Kukjin Kim 已提交
407
		.enable		= exynos4_clk_ip_cam_ctrl,
J
Jongpill Lee 已提交
408 409 410 411
		.ctrlbit	= (1 << 0),
	}, {
		.name		= "fimc",
		.id		= 1,
K
Kukjin Kim 已提交
412
		.enable		= exynos4_clk_ip_cam_ctrl,
J
Jongpill Lee 已提交
413 414 415 416
		.ctrlbit	= (1 << 1),
	}, {
		.name		= "fimc",
		.id		= 2,
K
Kukjin Kim 已提交
417
		.enable		= exynos4_clk_ip_cam_ctrl,
J
Jongpill Lee 已提交
418 419 420 421
		.ctrlbit	= (1 << 2),
	}, {
		.name		= "fimc",
		.id		= 3,
K
Kukjin Kim 已提交
422
		.enable		= exynos4_clk_ip_cam_ctrl,
J
Jongpill Lee 已提交
423 424 425 426
		.ctrlbit	= (1 << 3),
	}, {
		.name		= "fimd",
		.id		= 0,
K
Kukjin Kim 已提交
427
		.enable		= exynos4_clk_ip_lcd0_ctrl,
J
Jongpill Lee 已提交
428 429 430 431
		.ctrlbit	= (1 << 0),
	}, {
		.name		= "fimd",
		.id		= 1,
K
Kukjin Kim 已提交
432
		.enable		= exynos4_clk_ip_lcd1_ctrl,
J
Jongpill Lee 已提交
433
		.ctrlbit	= (1 << 0),
434 435 436 437 438 439
	}, {
		.name		= "sataphy",
		.id		= -1,
		.parent		= &clk_aclk_133.clk,
		.enable		= exynos4_clk_ip_fsys_ctrl,
		.ctrlbit	= (1 << 3),
440 441 442 443
	}, {
		.name		= "hsmmc",
		.id		= 0,
		.parent		= &clk_aclk_133.clk,
K
Kukjin Kim 已提交
444
		.enable		= exynos4_clk_ip_fsys_ctrl,
445 446 447 448 449
		.ctrlbit	= (1 << 5),
	}, {
		.name		= "hsmmc",
		.id		= 1,
		.parent		= &clk_aclk_133.clk,
K
Kukjin Kim 已提交
450
		.enable		= exynos4_clk_ip_fsys_ctrl,
451 452 453 454 455
		.ctrlbit	= (1 << 6),
	}, {
		.name		= "hsmmc",
		.id		= 2,
		.parent		= &clk_aclk_133.clk,
K
Kukjin Kim 已提交
456
		.enable		= exynos4_clk_ip_fsys_ctrl,
457 458 459 460 461
		.ctrlbit	= (1 << 7),
	}, {
		.name		= "hsmmc",
		.id		= 3,
		.parent		= &clk_aclk_133.clk,
K
Kukjin Kim 已提交
462
		.enable		= exynos4_clk_ip_fsys_ctrl,
463 464 465 466 467
		.ctrlbit	= (1 << 8),
	}, {
		.name		= "hsmmc",
		.id		= 4,
		.parent		= &clk_aclk_133.clk,
K
Kukjin Kim 已提交
468
		.enable		= exynos4_clk_ip_fsys_ctrl,
469
		.ctrlbit	= (1 << 9),
J
Jongpill Lee 已提交
470 471 472
	}, {
		.name		= "sata",
		.id		= -1,
473
		.parent		= &clk_aclk_133.clk,
K
Kukjin Kim 已提交
474
		.enable		= exynos4_clk_ip_fsys_ctrl,
J
Jongpill Lee 已提交
475
		.ctrlbit	= (1 << 10),
J
Jassi Brar 已提交
476 477 478
	}, {
		.name		= "pdma",
		.id		= 0,
K
Kukjin Kim 已提交
479
		.enable		= exynos4_clk_ip_fsys_ctrl,
J
Jassi Brar 已提交
480 481 482 483
		.ctrlbit	= (1 << 0),
	}, {
		.name		= "pdma",
		.id		= 1,
K
Kukjin Kim 已提交
484
		.enable		= exynos4_clk_ip_fsys_ctrl,
J
Jassi Brar 已提交
485
		.ctrlbit	= (1 << 1),
J
Jongpill Lee 已提交
486 487 488
	}, {
		.name		= "adc",
		.id		= -1,
K
Kukjin Kim 已提交
489
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
490
		.ctrlbit	= (1 << 15),
491 492 493 494 495
	}, {
		.name		= "keypad",
		.id		= -1,
		.enable		= exynos4_clk_ip_perir_ctrl,
		.ctrlbit	= (1 << 16),
C
Changhwan Youn 已提交
496 497 498
	}, {
		.name		= "rtc",
		.id		= -1,
K
Kukjin Kim 已提交
499
		.enable		= exynos4_clk_ip_perir_ctrl,
C
Changhwan Youn 已提交
500
		.ctrlbit	= (1 << 15),
J
Jongpill Lee 已提交
501 502 503
	}, {
		.name		= "watchdog",
		.id		= -1,
504
		.parent		= &clk_aclk_100.clk,
K
Kukjin Kim 已提交
505
		.enable		= exynos4_clk_ip_perir_ctrl,
J
Jongpill Lee 已提交
506 507 508 509
		.ctrlbit	= (1 << 14),
	}, {
		.name		= "usbhost",
		.id		= -1,
K
Kukjin Kim 已提交
510
		.enable		= exynos4_clk_ip_fsys_ctrl ,
J
Jongpill Lee 已提交
511 512 513 514
		.ctrlbit	= (1 << 12),
	}, {
		.name		= "otg",
		.id		= -1,
K
Kukjin Kim 已提交
515
		.enable		= exynos4_clk_ip_fsys_ctrl,
J
Jongpill Lee 已提交
516 517 518 519
		.ctrlbit	= (1 << 13),
	}, {
		.name		= "spi",
		.id		= 0,
K
Kukjin Kim 已提交
520
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
521 522 523 524
		.ctrlbit	= (1 << 16),
	}, {
		.name		= "spi",
		.id		= 1,
K
Kukjin Kim 已提交
525
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
526 527 528 529
		.ctrlbit	= (1 << 17),
	}, {
		.name		= "spi",
		.id		= 2,
K
Kukjin Kim 已提交
530
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
531
		.ctrlbit	= (1 << 18),
J
Jassi Brar 已提交
532 533 534
	}, {
		.name		= "iis",
		.id		= 0,
K
Kukjin Kim 已提交
535
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jassi Brar 已提交
536 537 538 539
		.ctrlbit	= (1 << 19),
	}, {
		.name		= "iis",
		.id		= 1,
K
Kukjin Kim 已提交
540
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jassi Brar 已提交
541 542 543 544
		.ctrlbit	= (1 << 20),
	}, {
		.name		= "iis",
		.id		= 2,
K
Kukjin Kim 已提交
545
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jassi Brar 已提交
546
		.ctrlbit	= (1 << 21),
J
Jassi Brar 已提交
547 548 549
	}, {
		.name		= "ac97",
		.id		= -1,
K
Kukjin Kim 已提交
550
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jassi Brar 已提交
551
		.ctrlbit	= (1 << 27),
J
Jongpill Lee 已提交
552 553 554
	}, {
		.name		= "fimg2d",
		.id		= -1,
K
Kukjin Kim 已提交
555
		.enable		= exynos4_clk_ip_image_ctrl,
J
Jongpill Lee 已提交
556 557 558 559 560
		.ctrlbit	= (1 << 0),
	}, {
		.name		= "i2c",
		.id		= 0,
		.parent		= &clk_aclk_100.clk,
K
Kukjin Kim 已提交
561
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
562 563 564 565 566
		.ctrlbit	= (1 << 6),
	}, {
		.name		= "i2c",
		.id		= 1,
		.parent		= &clk_aclk_100.clk,
K
Kukjin Kim 已提交
567
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
568 569 570 571 572
		.ctrlbit	= (1 << 7),
	}, {
		.name		= "i2c",
		.id		= 2,
		.parent		= &clk_aclk_100.clk,
K
Kukjin Kim 已提交
573
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
574 575 576 577 578
		.ctrlbit	= (1 << 8),
	}, {
		.name		= "i2c",
		.id		= 3,
		.parent		= &clk_aclk_100.clk,
K
Kukjin Kim 已提交
579
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
580 581 582 583 584
		.ctrlbit	= (1 << 9),
	}, {
		.name		= "i2c",
		.id		= 4,
		.parent		= &clk_aclk_100.clk,
K
Kukjin Kim 已提交
585
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
586 587 588 589 590
		.ctrlbit	= (1 << 10),
	}, {
		.name		= "i2c",
		.id		= 5,
		.parent		= &clk_aclk_100.clk,
K
Kukjin Kim 已提交
591
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
592 593 594 595 596
		.ctrlbit	= (1 << 11),
	}, {
		.name		= "i2c",
		.id		= 6,
		.parent		= &clk_aclk_100.clk,
K
Kukjin Kim 已提交
597
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
598 599 600 601 602
		.ctrlbit	= (1 << 12),
	}, {
		.name		= "i2c",
		.id		= 7,
		.parent		= &clk_aclk_100.clk,
K
Kukjin Kim 已提交
603
		.enable		= exynos4_clk_ip_peril_ctrl,
J
Jongpill Lee 已提交
604 605
		.ctrlbit	= (1 << 13),
	},
606 607 608
};

static struct clk init_clocks[] = {
609 610 611
	{
		.name		= "uart",
		.id		= 0,
K
Kukjin Kim 已提交
612
		.enable		= exynos4_clk_ip_peril_ctrl,
613 614 615 616
		.ctrlbit	= (1 << 0),
	}, {
		.name		= "uart",
		.id		= 1,
K
Kukjin Kim 已提交
617
		.enable		= exynos4_clk_ip_peril_ctrl,
618 619 620 621
		.ctrlbit	= (1 << 1),
	}, {
		.name		= "uart",
		.id		= 2,
K
Kukjin Kim 已提交
622
		.enable		= exynos4_clk_ip_peril_ctrl,
623 624 625 626
		.ctrlbit	= (1 << 2),
	}, {
		.name		= "uart",
		.id		= 3,
K
Kukjin Kim 已提交
627
		.enable		= exynos4_clk_ip_peril_ctrl,
628 629 630 631
		.ctrlbit	= (1 << 3),
	}, {
		.name		= "uart",
		.id		= 4,
K
Kukjin Kim 已提交
632
		.enable		= exynos4_clk_ip_peril_ctrl,
633 634 635 636
		.ctrlbit	= (1 << 4),
	}, {
		.name		= "uart",
		.id		= 5,
K
Kukjin Kim 已提交
637
		.enable		= exynos4_clk_ip_peril_ctrl,
638 639
		.ctrlbit	= (1 << 5),
	}
640 641 642 643 644 645
};

static struct clk *clkset_group_list[] = {
	[0] = &clk_ext_xtal_mux,
	[1] = &clk_xusbxti,
	[2] = &clk_sclk_hdmi27m,
646 647 648
	[3] = &clk_sclk_usbphy0,
	[4] = &clk_sclk_usbphy1,
	[5] = &clk_sclk_hdmiphy,
649 650 651 652 653 654 655 656 657 658
	[6] = &clk_mout_mpll.clk,
	[7] = &clk_mout_epll.clk,
	[8] = &clk_sclk_vpll.clk,
};

static struct clksrc_sources clkset_group = {
	.sources	= clkset_group_list,
	.nr_sources	= ARRAY_SIZE(clkset_group_list),
};

J
Jongpill Lee 已提交
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706
static struct clk *clkset_mout_g2d0_list[] = {
	[0] = &clk_mout_mpll.clk,
	[1] = &clk_sclk_apll.clk,
};

static struct clksrc_sources clkset_mout_g2d0 = {
	.sources	= clkset_mout_g2d0_list,
	.nr_sources	= ARRAY_SIZE(clkset_mout_g2d0_list),
};

static struct clksrc_clk clk_mout_g2d0 = {
	.clk	= {
		.name		= "mout_g2d0",
		.id		= -1,
	},
	.sources	= &clkset_mout_g2d0,
	.reg_src	= { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 },
};

static struct clk *clkset_mout_g2d1_list[] = {
	[0] = &clk_mout_epll.clk,
	[1] = &clk_sclk_vpll.clk,
};

static struct clksrc_sources clkset_mout_g2d1 = {
	.sources	= clkset_mout_g2d1_list,
	.nr_sources	= ARRAY_SIZE(clkset_mout_g2d1_list),
};

static struct clksrc_clk clk_mout_g2d1 = {
	.clk	= {
		.name		= "mout_g2d1",
		.id		= -1,
	},
	.sources	= &clkset_mout_g2d1,
	.reg_src	= { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 },
};

static struct clk *clkset_mout_g2d_list[] = {
	[0] = &clk_mout_g2d0.clk,
	[1] = &clk_mout_g2d1.clk,
};

static struct clksrc_sources clkset_mout_g2d = {
	.sources	= clkset_mout_g2d_list,
	.nr_sources	= ARRAY_SIZE(clkset_mout_g2d_list),
};

707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756
static struct clksrc_clk clk_dout_mmc0 = {
	.clk		= {
		.name		= "dout_mmc0",
		.id		= -1,
	},
	.sources = &clkset_group,
	.reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 },
	.reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 0, .size = 4 },
};

static struct clksrc_clk clk_dout_mmc1 = {
	.clk		= {
		.name		= "dout_mmc1",
		.id		= -1,
	},
	.sources = &clkset_group,
	.reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 },
	.reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 16, .size = 4 },
};

static struct clksrc_clk clk_dout_mmc2 = {
	.clk		= {
		.name		= "dout_mmc2",
		.id		= -1,
	},
	.sources = &clkset_group,
	.reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 },
	.reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 0, .size = 4 },
};

static struct clksrc_clk clk_dout_mmc3 = {
	.clk		= {
		.name		= "dout_mmc3",
		.id		= -1,
	},
	.sources = &clkset_group,
	.reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 },
	.reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 16, .size = 4 },
};

static struct clksrc_clk clk_dout_mmc4 = {
	.clk		= {
		.name		= "dout_mmc4",
		.id		= -1,
	},
	.sources = &clkset_group,
	.reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 },
	.reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 0, .size = 4 },
};

757 758 759 760 761
static struct clksrc_clk clksrcs[] = {
	{
		.clk	= {
			.name		= "uclk1",
			.id		= 0,
K
Kukjin Kim 已提交
762
			.enable		= exynos4_clksrc_mask_peril0_ctrl,
763
			.ctrlbit	= (1 << 0),
764 765 766 767 768 769 770 771
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 0, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 0, .size = 4 },
	}, {
		.clk		= {
			.name		= "uclk1",
			.id		= 1,
K
Kukjin Kim 已提交
772
			.enable		= exynos4_clksrc_mask_peril0_ctrl,
773
			.ctrlbit	= (1 << 4),
774 775 776 777 778 779 780 781
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 4, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 4, .size = 4 },
	}, {
		.clk		= {
			.name		= "uclk1",
			.id		= 2,
K
Kukjin Kim 已提交
782
			.enable		= exynos4_clksrc_mask_peril0_ctrl,
783
			.ctrlbit	= (1 << 8),
784 785 786 787 788 789 790 791
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 8, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 8, .size = 4 },
	}, {
		.clk		= {
			.name		= "uclk1",
			.id		= 3,
K
Kukjin Kim 已提交
792
			.enable		= exynos4_clksrc_mask_peril0_ctrl,
793
			.ctrlbit	= (1 << 12),
794 795 796 797 798 799 800 801
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 12, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 12, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_pwm",
			.id		= -1,
K
Kukjin Kim 已提交
802
			.enable		= exynos4_clksrc_mask_peril0_ctrl,
803 804 805 806 807
			.ctrlbit	= (1 << 24),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 },
808 809 810 811
	}, {
		.clk		= {
			.name		= "sclk_csis",
			.id		= 0,
K
Kukjin Kim 已提交
812
			.enable		= exynos4_clksrc_mask_cam_ctrl,
813 814 815 816 817 818 819 820 821
			.ctrlbit	= (1 << 24),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 24, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 24, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_csis",
			.id		= 1,
K
Kukjin Kim 已提交
822
			.enable		= exynos4_clksrc_mask_cam_ctrl,
823 824 825 826 827 828 829 830 831
			.ctrlbit	= (1 << 28),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 28, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_cam",
			.id		= 0,
K
Kukjin Kim 已提交
832
			.enable		= exynos4_clksrc_mask_cam_ctrl,
833 834 835 836 837 838 839 840 841
			.ctrlbit	= (1 << 16),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 16, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_cam",
			.id		= 1,
K
Kukjin Kim 已提交
842
			.enable		= exynos4_clksrc_mask_cam_ctrl,
843 844 845 846 847 848 849 850 851
			.ctrlbit	= (1 << 20),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 20, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 20, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_fimc",
			.id		= 0,
K
Kukjin Kim 已提交
852
			.enable		= exynos4_clksrc_mask_cam_ctrl,
853 854 855 856 857 858 859 860 861
			.ctrlbit	= (1 << 0),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 0, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 0, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_fimc",
			.id		= 1,
K
Kukjin Kim 已提交
862
			.enable		= exynos4_clksrc_mask_cam_ctrl,
863 864 865 866 867 868 869 870 871
			.ctrlbit	= (1 << 4),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 4, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 4, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_fimc",
			.id		= 2,
K
Kukjin Kim 已提交
872
			.enable		= exynos4_clksrc_mask_cam_ctrl,
873 874 875 876 877 878 879 880 881
			.ctrlbit	= (1 << 8),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 8, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 8, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_fimc",
			.id		= 3,
K
Kukjin Kim 已提交
882
			.enable		= exynos4_clksrc_mask_cam_ctrl,
883 884 885 886 887 888 889 890 891
			.ctrlbit	= (1 << 12),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 12, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 12, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_fimd",
			.id		= 0,
K
Kukjin Kim 已提交
892
			.enable		= exynos4_clksrc_mask_lcd0_ctrl,
893 894 895 896 897 898 899 900 901
			.ctrlbit	= (1 << 0),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_LCD0, .shift = 0, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_fimd",
			.id		= 1,
K
Kukjin Kim 已提交
902
			.enable		= exynos4_clksrc_mask_lcd1_ctrl,
903 904 905 906 907 908 909 910 911
			.ctrlbit	= (1 << 0),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_sata",
			.id		= -1,
K
Kukjin Kim 已提交
912
			.enable		= exynos4_clksrc_mask_fsys_ctrl,
913 914 915 916 917 918 919 920 921
			.ctrlbit	= (1 << 24),
		},
		.sources = &clkset_mout_corebus,
		.reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 },
		.reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_spi",
			.id		= 0,
K
Kukjin Kim 已提交
922
			.enable		= exynos4_clksrc_mask_peril1_ctrl,
923 924 925 926 927 928 929 930 931
			.ctrlbit	= (1 << 16),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 16, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 0, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_spi",
			.id		= 1,
K
Kukjin Kim 已提交
932
			.enable		= exynos4_clksrc_mask_peril1_ctrl,
933 934 935 936 937 938 939 940 941
			.ctrlbit	= (1 << 20),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 20, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 16, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_spi",
			.id		= 2,
K
Kukjin Kim 已提交
942
			.enable		= exynos4_clksrc_mask_peril1_ctrl,
943 944 945 946 947 948 949 950 951 952 953 954 955
			.ctrlbit	= (1 << 24),
		},
		.sources = &clkset_group,
		.reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 24, .size = 4 },
		.reg_div = { .reg = S5P_CLKDIV_PERIL2, .shift = 0, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_fimg2d",
			.id		= -1,
		},
		.sources = &clkset_mout_g2d,
		.reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 },
		.reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 },
956 957 958 959 960
	}, {
		.clk		= {
			.name		= "sclk_mmc",
			.id		= 0,
			.parent		= &clk_dout_mmc0.clk,
K
Kukjin Kim 已提交
961
			.enable		= exynos4_clksrc_mask_fsys_ctrl,
962 963 964 965 966 967 968 969
			.ctrlbit	= (1 << 0),
		},
		.reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 8, .size = 8 },
	}, {
		.clk		= {
			.name		= "sclk_mmc",
			.id		= 1,
			.parent         = &clk_dout_mmc1.clk,
K
Kukjin Kim 已提交
970
			.enable		= exynos4_clksrc_mask_fsys_ctrl,
971 972 973 974 975 976 977 978
			.ctrlbit	= (1 << 4),
		},
		.reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 24, .size = 8 },
	}, {
		.clk		= {
			.name		= "sclk_mmc",
			.id		= 2,
			.parent         = &clk_dout_mmc2.clk,
K
Kukjin Kim 已提交
979
			.enable		= exynos4_clksrc_mask_fsys_ctrl,
980 981 982 983 984 985 986 987
			.ctrlbit	= (1 << 8),
		},
		.reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 8, .size = 8 },
	}, {
		.clk		= {
			.name		= "sclk_mmc",
			.id		= 3,
			.parent         = &clk_dout_mmc3.clk,
K
Kukjin Kim 已提交
988
			.enable		= exynos4_clksrc_mask_fsys_ctrl,
989 990 991 992 993 994 995 996
			.ctrlbit	= (1 << 12),
		},
		.reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 },
	}, {
		.clk		= {
			.name		= "sclk_mmc",
			.id		= 4,
			.parent         = &clk_dout_mmc4.clk,
K
Kukjin Kim 已提交
997
			.enable		= exynos4_clksrc_mask_fsys_ctrl,
998 999 1000 1001
			.ctrlbit	= (1 << 16),
		},
		.reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 8, .size = 8 },
	}
1002 1003 1004 1005 1006
};

/* Clock initialization code */
static struct clksrc_clk *sysclks[] = {
	&clk_mout_apll,
1007
	&clk_sclk_apll,
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028
	&clk_mout_epll,
	&clk_mout_mpll,
	&clk_moutcore,
	&clk_coreclk,
	&clk_armclk,
	&clk_aclk_corem0,
	&clk_aclk_cores,
	&clk_aclk_corem1,
	&clk_periphclk,
	&clk_mout_corebus,
	&clk_sclk_dmc,
	&clk_aclk_cored,
	&clk_aclk_corep,
	&clk_aclk_acp,
	&clk_pclk_acp,
	&clk_vpllsrc,
	&clk_sclk_vpll,
	&clk_aclk_200,
	&clk_aclk_100,
	&clk_aclk_160,
	&clk_aclk_133,
1029 1030 1031 1032 1033
	&clk_dout_mmc0,
	&clk_dout_mmc1,
	&clk_dout_mmc2,
	&clk_dout_mmc3,
	&clk_dout_mmc4,
1034 1035
};

1036 1037
static int xtal_rate;

K
Kukjin Kim 已提交
1038
static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
1039 1040 1041 1042
{
	return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0), pll_4508);
}

K
Kukjin Kim 已提交
1043 1044
static struct clk_ops exynos4_fout_apll_ops = {
	.get_rate = exynos4_fout_apll_get_rate,
1045 1046
};

K
Kukjin Kim 已提交
1047
void __init_or_cpufreq exynos4_setup_clocks(void)
1048 1049 1050 1051 1052 1053 1054 1055 1056 1057
{
	struct clk *xtal_clk;
	unsigned long apll;
	unsigned long mpll;
	unsigned long epll;
	unsigned long vpll;
	unsigned long vpllsrc;
	unsigned long xtal;
	unsigned long armclk;
	unsigned long sclk_dmc;
1058 1059 1060 1061
	unsigned long aclk_200;
	unsigned long aclk_100;
	unsigned long aclk_160;
	unsigned long aclk_133;
1062 1063 1064 1065 1066 1067 1068 1069
	unsigned int ptr;

	printk(KERN_DEBUG "%s: registering clocks\n", __func__);

	xtal_clk = clk_get(NULL, "xtal");
	BUG_ON(IS_ERR(xtal_clk));

	xtal = clk_get_rate(xtal_clk);
1070 1071 1072

	xtal_rate = xtal;

1073 1074 1075 1076 1077 1078 1079
	clk_put(xtal_clk);

	printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);

	apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0), pll_4508);
	mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0), pll_4508);
	epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0),
1080
				__raw_readl(S5P_EPLL_CON1), pll_4600);
1081 1082 1083

	vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
	vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1084
				__raw_readl(S5P_VPLL_CON1), pll_4650);
1085

K
Kukjin Kim 已提交
1086
	clk_fout_apll.ops = &exynos4_fout_apll_ops;
1087 1088 1089 1090
	clk_fout_mpll.rate = mpll;
	clk_fout_epll.rate = epll;
	clk_fout_vpll.rate = vpll;

K
Kukjin Kim 已提交
1091
	printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
1092 1093 1094 1095
			apll, mpll, epll, vpll);

	armclk = clk_get_rate(&clk_armclk.clk);
	sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk);
K
Kukjin Kim 已提交
1096

1097 1098 1099 1100 1101
	aclk_200 = clk_get_rate(&clk_aclk_200.clk);
	aclk_100 = clk_get_rate(&clk_aclk_100.clk);
	aclk_160 = clk_get_rate(&clk_aclk_160.clk);
	aclk_133 = clk_get_rate(&clk_aclk_133.clk);

K
Kukjin Kim 已提交
1102
	printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
1103 1104 1105
			 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
			armclk, sclk_dmc, aclk_200,
			aclk_100, aclk_160, aclk_133);
1106 1107 1108

	clk_f.rate = armclk;
	clk_h.rate = sclk_dmc;
1109
	clk_p.rate = aclk_100;
1110 1111 1112 1113 1114 1115 1116 1117 1118

	for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
		s3c_set_clksrc(&clksrcs[ptr], true);
}

static struct clk *clks[] __initdata = {
	/* Nothing here yet */
};

K
Kukjin Kim 已提交
1119
void __init exynos4_register_clocks(void)
1120 1121 1122
{
	int ptr;

1123
	s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1124 1125 1126 1127 1128 1129 1130

	for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
		s3c_register_clksrc(sysclks[ptr], 1);

	s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
	s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));

1131 1132
	s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
	s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1133 1134 1135

	s3c_pwmclk_init();
}