clock.c 28.5 KB
Newer Older
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
/* linux/arch/arm/mach-s5pv210/clock.c
 *
 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com/
 *
 * S5PV210 - Clock 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/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/sysdev.h>
#include <linux/io.h>

#include <mach/map.h>

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

34 35
static unsigned long xtal;

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
static struct clksrc_clk clk_mout_apll = {
	.clk	= {
		.name		= "mout_apll",
	},
	.sources	= &clk_src_apll,
	.reg_src	= { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 },
};

static struct clksrc_clk clk_mout_epll = {
	.clk	= {
		.name		= "mout_epll",
	},
	.sources	= &clk_src_epll,
	.reg_src	= { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 },
};

static struct clksrc_clk clk_mout_mpll = {
	.clk = {
		.name		= "mout_mpll",
	},
	.sources	= &clk_src_mpll,
	.reg_src	= { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 },
};

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
static struct clk *clkset_armclk_list[] = {
	[0] = &clk_mout_apll.clk,
	[1] = &clk_mout_mpll.clk,
};

static struct clksrc_sources clkset_armclk = {
	.sources	= clkset_armclk_list,
	.nr_sources	= ARRAY_SIZE(clkset_armclk_list),
};

static struct clksrc_clk clk_armclk = {
	.clk	= {
		.name		= "armclk",
	},
	.sources	= &clkset_armclk,
	.reg_src	= { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 },
	.reg_div	= { .reg = S5P_CLK_DIV0, .shift = 0, .size = 3 },
};

79 80 81 82 83 84 85 86
static struct clksrc_clk clk_hclk_msys = {
	.clk	= {
		.name		= "hclk_msys",
		.parent		= &clk_armclk.clk,
	},
	.reg_div	= { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 },
};

87 88 89 90 91 92 93 94
static struct clksrc_clk clk_pclk_msys = {
	.clk	= {
		.name		= "pclk_msys",
		.parent		= &clk_hclk_msys.clk,
	},
	.reg_div        = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 },
};

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
static struct clksrc_clk clk_sclk_a2m = {
	.clk	= {
		.name		= "sclk_a2m",
		.parent		= &clk_mout_apll.clk,
	},
	.reg_div	= { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 },
};

static struct clk *clkset_hclk_sys_list[] = {
	[0] = &clk_mout_mpll.clk,
	[1] = &clk_sclk_a2m.clk,
};

static struct clksrc_sources clkset_hclk_sys = {
	.sources	= clkset_hclk_sys_list,
	.nr_sources	= ARRAY_SIZE(clkset_hclk_sys_list),
};

static struct clksrc_clk clk_hclk_dsys = {
	.clk	= {
		.name	= "hclk_dsys",
	},
	.sources	= &clkset_hclk_sys,
	.reg_src        = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 },
	.reg_div        = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 4 },
};

122 123 124 125 126 127 128 129
static struct clksrc_clk clk_pclk_dsys = {
	.clk	= {
		.name	= "pclk_dsys",
		.parent	= &clk_hclk_dsys.clk,
	},
	.reg_div = { .reg = S5P_CLK_DIV0, .shift = 20, .size = 3 },
};

130 131 132 133 134 135 136 137 138
static struct clksrc_clk clk_hclk_psys = {
	.clk	= {
		.name	= "hclk_psys",
	},
	.sources	= &clkset_hclk_sys,
	.reg_src        = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 },
	.reg_div        = { .reg = S5P_CLK_DIV0, .shift = 24, .size = 4 },
};

139 140 141 142 143 144 145 146
static struct clksrc_clk clk_pclk_psys = {
	.clk	= {
		.name	= "pclk_psys",
		.parent	= &clk_hclk_psys.clk,
	},
	.reg_div        = { .reg = S5P_CLK_DIV0, .shift = 28, .size = 3 },
};

147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
static int s5pv210_clk_ip0_ctrl(struct clk *clk, int enable)
{
	return s5p_gatectrl(S5P_CLKGATE_IP0, clk, enable);
}

static int s5pv210_clk_ip1_ctrl(struct clk *clk, int enable)
{
	return s5p_gatectrl(S5P_CLKGATE_IP1, clk, enable);
}

static int s5pv210_clk_ip2_ctrl(struct clk *clk, int enable)
{
	return s5p_gatectrl(S5P_CLKGATE_IP2, clk, enable);
}

static int s5pv210_clk_ip3_ctrl(struct clk *clk, int enable)
{
	return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable);
}

167 168 169 170 171
static int s5pv210_clk_mask0_ctrl(struct clk *clk, int enable)
{
	return s5p_gatectrl(S5P_CLK_SRC_MASK0, clk, enable);
}

172 173 174 175 176
static int s5pv210_clk_mask1_ctrl(struct clk *clk, int enable)
{
	return s5p_gatectrl(S5P_CLK_SRC_MASK1, clk, enable);
}

177 178 179 180 181
static struct clk clk_sclk_hdmi27m = {
	.name		= "sclk_hdmi27m",
	.rate		= 27000000,
};

182 183 184 185 186 187 188 189 190 191 192 193
static struct clk clk_sclk_hdmiphy = {
	.name		= "sclk_hdmiphy",
};

static struct clk clk_sclk_usbphy0 = {
	.name		= "sclk_usbphy0",
};

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

194 195 196 197 198 199 200 201 202 203 204 205
static struct clk clk_pcmcdclk0 = {
	.name		= "pcmcdclk",
};

static struct clk clk_pcmcdclk1 = {
	.name		= "pcmcdclk",
};

static struct clk clk_pcmcdclk2 = {
	.name		= "pcmcdclk",
};

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
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",
		.enable		= s5pv210_clk_mask0_ctrl,
		.ctrlbit	= (1 << 7),
	},
	.sources	= &clkset_vpllsrc,
	.reg_src	= { .reg = S5P_CLK_SRC1, .shift = 28, .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",
	},
	.sources	= &clkset_sclk_vpll,
	.reg_src	= { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 },
};

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
static struct clk *clkset_moutdmc0src_list[] = {
	[0] = &clk_sclk_a2m.clk,
	[1] = &clk_mout_mpll.clk,
	[2] = NULL,
	[3] = NULL,
};

static struct clksrc_sources clkset_moutdmc0src = {
	.sources	= clkset_moutdmc0src_list,
	.nr_sources	= ARRAY_SIZE(clkset_moutdmc0src_list),
};

static struct clksrc_clk clk_mout_dmc0 = {
	.clk	= {
		.name		= "mout_dmc0",
	},
	.sources	= &clkset_moutdmc0src,
	.reg_src	= { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 },
};

static struct clksrc_clk clk_sclk_dmc0 = {
	.clk	= {
		.name		= "sclk_dmc0",
		.parent		= &clk_mout_dmc0.clk,
	},
	.reg_div	= { .reg = S5P_CLK_DIV6, .shift = 28, .size = 4 },
};

272 273 274 275 276 277 278 279 280
static unsigned long s5pv210_clk_imem_get_rate(struct clk *clk)
{
	return clk_get_rate(clk->parent) / 2;
}

static struct clk_ops clk_hclk_imem_ops = {
	.get_rate	= s5pv210_clk_imem_get_rate,
};

281 282 283 284 285 286 287 288 289
static unsigned long s5pv210_clk_fout_apll_get_rate(struct clk *clk)
{
	return s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508);
}

static struct clk_ops clk_fout_apll_ops = {
	.get_rate	= s5pv210_clk_fout_apll_get_rate,
};

290
static struct clk init_clocks_off[] = {
291
	{
292
		.name		= "pdma",
293
		.devname	= "s3c-pl330.0",
294 295 296 297 298
		.parent		= &clk_hclk_psys.clk,
		.enable		= s5pv210_clk_ip0_ctrl,
		.ctrlbit	= (1 << 3),
	}, {
		.name		= "pdma",
299
		.devname	= "s3c-pl330.1",
300 301 302 303
		.parent		= &clk_hclk_psys.clk,
		.enable		= s5pv210_clk_ip0_ctrl,
		.ctrlbit	= (1 << 4),
	}, {
304
		.name		= "rot",
305
		.parent		= &clk_hclk_dsys.clk,
306 307
		.enable		= s5pv210_clk_ip0_ctrl,
		.ctrlbit	= (1<<29),
M
Marek Szyprowski 已提交
308 309
	}, {
		.name		= "fimc",
310
		.devname	= "s5pv210-fimc.0",
M
Marek Szyprowski 已提交
311 312 313 314 315
		.parent		= &clk_hclk_dsys.clk,
		.enable		= s5pv210_clk_ip0_ctrl,
		.ctrlbit	= (1 << 24),
	}, {
		.name		= "fimc",
316
		.devname	= "s5pv210-fimc.1",
M
Marek Szyprowski 已提交
317 318 319 320 321
		.parent		= &clk_hclk_dsys.clk,
		.enable		= s5pv210_clk_ip0_ctrl,
		.ctrlbit	= (1 << 25),
	}, {
		.name		= "fimc",
322
		.devname	= "s5pv210-fimc.2",
M
Marek Szyprowski 已提交
323 324 325
		.parent		= &clk_hclk_dsys.clk,
		.enable		= s5pv210_clk_ip0_ctrl,
		.ctrlbit	= (1 << 26),
326 327 328 329 330 331
	}, {
		.name		= "mfc",
		.devname	= "s5p-mfc",
		.parent		= &clk_pclk_psys.clk,
		.enable		= s5pv210_clk_ip0_ctrl,
		.ctrlbit	= (1 << 16),
332 333
	}, {
		.name		= "otg",
334
		.parent		= &clk_hclk_psys.clk,
335 336 337 338
		.enable		= s5pv210_clk_ip1_ctrl,
		.ctrlbit	= (1<<16),
	}, {
		.name		= "usb-host",
339
		.parent		= &clk_hclk_psys.clk,
340 341 342 343
		.enable		= s5pv210_clk_ip1_ctrl,
		.ctrlbit	= (1<<17),
	}, {
		.name		= "lcd",
344
		.parent		= &clk_hclk_dsys.clk,
345 346 347 348
		.enable		= s5pv210_clk_ip1_ctrl,
		.ctrlbit	= (1<<0),
	}, {
		.name		= "cfcon",
349
		.parent		= &clk_hclk_psys.clk,
350 351 352 353
		.enable		= s5pv210_clk_ip1_ctrl,
		.ctrlbit	= (1<<25),
	}, {
		.name		= "hsmmc",
354
		.devname	= "s3c-sdhci.0",
355
		.parent		= &clk_hclk_psys.clk,
356 357 358 359
		.enable		= s5pv210_clk_ip2_ctrl,
		.ctrlbit	= (1<<16),
	}, {
		.name		= "hsmmc",
360
		.devname	= "s3c-sdhci.1",
361
		.parent		= &clk_hclk_psys.clk,
362 363 364 365
		.enable		= s5pv210_clk_ip2_ctrl,
		.ctrlbit	= (1<<17),
	}, {
		.name		= "hsmmc",
366
		.devname	= "s3c-sdhci.2",
367
		.parent		= &clk_hclk_psys.clk,
368 369 370 371
		.enable		= s5pv210_clk_ip2_ctrl,
		.ctrlbit	= (1<<18),
	}, {
		.name		= "hsmmc",
372
		.devname	= "s3c-sdhci.3",
373
		.parent		= &clk_hclk_psys.clk,
374 375 376 377
		.enable		= s5pv210_clk_ip2_ctrl,
		.ctrlbit	= (1<<19),
	}, {
		.name		= "systimer",
378
		.parent		= &clk_pclk_psys.clk,
379 380 381 382
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<16),
	}, {
		.name		= "watchdog",
383
		.parent		= &clk_pclk_psys.clk,
384 385 386 387
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<22),
	}, {
		.name		= "rtc",
388
		.parent		= &clk_pclk_psys.clk,
389 390 391 392
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<15),
	}, {
		.name		= "i2c",
393
		.devname	= "s3c2440-i2c.0",
394
		.parent		= &clk_pclk_psys.clk,
395 396 397 398
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<7),
	}, {
		.name		= "i2c",
399
		.devname	= "s3c2440-i2c.1",
400
		.parent		= &clk_pclk_psys.clk,
401
		.enable		= s5pv210_clk_ip3_ctrl,
402
		.ctrlbit	= (1 << 10),
403 404
	}, {
		.name		= "i2c",
405
		.devname	= "s3c2440-i2c.2",
406
		.parent		= &clk_pclk_psys.clk,
407 408 409 410
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<9),
	}, {
		.name		= "spi",
411
		.devname	= "s3c64xx-spi.0",
412
		.parent		= &clk_pclk_psys.clk,
413 414 415 416
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<12),
	}, {
		.name		= "spi",
417
		.devname	= "s3c64xx-spi.1",
418
		.parent		= &clk_pclk_psys.clk,
419 420 421 422
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<13),
	}, {
		.name		= "spi",
423
		.devname	= "s3c64xx-spi.2",
424
		.parent		= &clk_pclk_psys.clk,
425 426 427 428
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<14),
	}, {
		.name		= "timers",
429
		.parent		= &clk_pclk_psys.clk,
430 431 432 433
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<23),
	}, {
		.name		= "adc",
434
		.parent		= &clk_pclk_psys.clk,
435 436 437 438
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<24),
	}, {
		.name		= "keypad",
439
		.parent		= &clk_pclk_psys.clk,
440 441 442
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<21),
	}, {
443
		.name		= "iis",
444
		.devname	= "samsung-i2s.0",
445 446 447 448
		.parent		= &clk_p,
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1<<4),
	}, {
449
		.name		= "iis",
450
		.devname	= "samsung-i2s.1",
451 452
		.parent		= &clk_p,
		.enable		= s5pv210_clk_ip3_ctrl,
453
		.ctrlbit	= (1 << 5),
454
	}, {
455
		.name		= "iis",
456
		.devname	= "samsung-i2s.2",
457 458
		.parent		= &clk_p,
		.enable		= s5pv210_clk_ip3_ctrl,
459
		.ctrlbit	= (1 << 6),
460 461 462 463 464
	}, {
		.name		= "spdif",
		.parent		= &clk_p,
		.enable		= s5pv210_clk_ip3_ctrl,
		.ctrlbit	= (1 << 0),
465
	},
466 467 468 469
};

static struct clk init_clocks[] = {
	{
470 471 472 473 474 475
		.name		= "hclk_imem",
		.parent		= &clk_hclk_msys.clk,
		.ctrlbit	= (1 << 5),
		.enable		= s5pv210_clk_ip0_ctrl,
		.ops		= &clk_hclk_imem_ops,
	}, {
476
		.name		= "uart",
477
		.devname	= "s5pv210-uart.0",
478
		.parent		= &clk_pclk_psys.clk,
479
		.enable		= s5pv210_clk_ip3_ctrl,
480
		.ctrlbit	= (1 << 17),
481 482
	}, {
		.name		= "uart",
483
		.devname	= "s5pv210-uart.1",
484
		.parent		= &clk_pclk_psys.clk,
485
		.enable		= s5pv210_clk_ip3_ctrl,
486
		.ctrlbit	= (1 << 18),
487 488
	}, {
		.name		= "uart",
489
		.devname	= "s5pv210-uart.2",
490
		.parent		= &clk_pclk_psys.clk,
491
		.enable		= s5pv210_clk_ip3_ctrl,
492
		.ctrlbit	= (1 << 19),
493 494
	}, {
		.name		= "uart",
495
		.devname	= "s5pv210-uart.3",
496
		.parent		= &clk_pclk_psys.clk,
497
		.enable		= s5pv210_clk_ip3_ctrl,
498
		.ctrlbit	= (1 << 20),
499 500 501 502 503
	}, {
		.name		= "sromc",
		.parent		= &clk_hclk_psys.clk,
		.enable		= s5pv210_clk_ip1_ctrl,
		.ctrlbit	= (1 << 26),
504 505 506 507 508 509 510 511 512 513 514 515 516
	},
};

static struct clk *clkset_uart_list[] = {
	[6] = &clk_mout_mpll.clk,
	[7] = &clk_mout_epll.clk,
};

static struct clksrc_sources clkset_uart = {
	.sources	= clkset_uart_list,
	.nr_sources	= ARRAY_SIZE(clkset_uart_list),
};

517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
static struct clk *clkset_group1_list[] = {
	[0] = &clk_sclk_a2m.clk,
	[1] = &clk_mout_mpll.clk,
	[2] = &clk_mout_epll.clk,
	[3] = &clk_sclk_vpll.clk,
};

static struct clksrc_sources clkset_group1 = {
	.sources	= clkset_group1_list,
	.nr_sources	= ARRAY_SIZE(clkset_group1_list),
};

static struct clk *clkset_sclk_onenand_list[] = {
	[0] = &clk_hclk_psys.clk,
	[1] = &clk_hclk_dsys.clk,
};

static struct clksrc_sources clkset_sclk_onenand = {
	.sources	= clkset_sclk_onenand_list,
	.nr_sources	= ARRAY_SIZE(clkset_sclk_onenand_list),
};

539 540 541 542 543 544 545 546 547 548 549 550 551
static struct clk *clkset_sclk_dac_list[] = {
	[0] = &clk_sclk_vpll.clk,
	[1] = &clk_sclk_hdmiphy,
};

static struct clksrc_sources clkset_sclk_dac = {
	.sources	= clkset_sclk_dac_list,
	.nr_sources	= ARRAY_SIZE(clkset_sclk_dac_list),
};

static struct clksrc_clk clk_sclk_dac = {
	.clk		= {
		.name		= "sclk_dac",
552 553
		.enable		= s5pv210_clk_mask0_ctrl,
		.ctrlbit	= (1 << 2),
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
	},
	.sources	= &clkset_sclk_dac,
	.reg_src	= { .reg = S5P_CLK_SRC1, .shift = 8, .size = 1 },
};

static struct clksrc_clk clk_sclk_pixel = {
	.clk		= {
		.name		= "sclk_pixel",
		.parent		= &clk_sclk_vpll.clk,
	},
	.reg_div	= { .reg = S5P_CLK_DIV1, .shift = 0, .size = 4},
};

static struct clk *clkset_sclk_hdmi_list[] = {
	[0] = &clk_sclk_pixel.clk,
	[1] = &clk_sclk_hdmiphy,
};

static struct clksrc_sources clkset_sclk_hdmi = {
	.sources	= clkset_sclk_hdmi_list,
	.nr_sources	= ARRAY_SIZE(clkset_sclk_hdmi_list),
};

static struct clksrc_clk clk_sclk_hdmi = {
	.clk		= {
		.name		= "sclk_hdmi",
580 581
		.enable		= s5pv210_clk_mask0_ctrl,
		.ctrlbit	= (1 << 0),
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596
	},
	.sources	= &clkset_sclk_hdmi,
	.reg_src	= { .reg = S5P_CLK_SRC1, .shift = 0, .size = 1 },
};

static struct clk *clkset_sclk_mixer_list[] = {
	[0] = &clk_sclk_dac.clk,
	[1] = &clk_sclk_hdmi.clk,
};

static struct clksrc_sources clkset_sclk_mixer = {
	.sources	= clkset_sclk_mixer_list,
	.nr_sources	= ARRAY_SIZE(clkset_sclk_mixer_list),
};

597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616
static struct clk *clkset_sclk_audio0_list[] = {
	[0] = &clk_ext_xtal_mux,
	[1] = &clk_pcmcdclk0,
	[2] = &clk_sclk_hdmi27m,
	[3] = &clk_sclk_usbphy0,
	[4] = &clk_sclk_usbphy1,
	[5] = &clk_sclk_hdmiphy,
	[6] = &clk_mout_mpll.clk,
	[7] = &clk_mout_epll.clk,
	[8] = &clk_sclk_vpll.clk,
};

static struct clksrc_sources clkset_sclk_audio0 = {
	.sources	= clkset_sclk_audio0_list,
	.nr_sources	= ARRAY_SIZE(clkset_sclk_audio0_list),
};

static struct clksrc_clk clk_sclk_audio0 = {
	.clk		= {
		.name		= "sclk_audio",
617
		.devname	= "soc-audio.0",
618 619
		.enable		= s5pv210_clk_mask0_ctrl,
		.ctrlbit	= (1 << 24),
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645
	},
	.sources = &clkset_sclk_audio0,
	.reg_src = { .reg = S5P_CLK_SRC6, .shift = 0, .size = 4 },
	.reg_div = { .reg = S5P_CLK_DIV6, .shift = 0, .size = 4 },
};

static struct clk *clkset_sclk_audio1_list[] = {
	[0] = &clk_ext_xtal_mux,
	[1] = &clk_pcmcdclk1,
	[2] = &clk_sclk_hdmi27m,
	[3] = &clk_sclk_usbphy0,
	[4] = &clk_sclk_usbphy1,
	[5] = &clk_sclk_hdmiphy,
	[6] = &clk_mout_mpll.clk,
	[7] = &clk_mout_epll.clk,
	[8] = &clk_sclk_vpll.clk,
};

static struct clksrc_sources clkset_sclk_audio1 = {
	.sources	= clkset_sclk_audio1_list,
	.nr_sources	= ARRAY_SIZE(clkset_sclk_audio1_list),
};

static struct clksrc_clk clk_sclk_audio1 = {
	.clk		= {
		.name		= "sclk_audio",
646
		.devname	= "soc-audio.1",
647 648
		.enable		= s5pv210_clk_mask0_ctrl,
		.ctrlbit	= (1 << 25),
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674
	},
	.sources = &clkset_sclk_audio1,
	.reg_src = { .reg = S5P_CLK_SRC6, .shift = 4, .size = 4 },
	.reg_div = { .reg = S5P_CLK_DIV6, .shift = 4, .size = 4 },
};

static struct clk *clkset_sclk_audio2_list[] = {
	[0] = &clk_ext_xtal_mux,
	[1] = &clk_pcmcdclk0,
	[2] = &clk_sclk_hdmi27m,
	[3] = &clk_sclk_usbphy0,
	[4] = &clk_sclk_usbphy1,
	[5] = &clk_sclk_hdmiphy,
	[6] = &clk_mout_mpll.clk,
	[7] = &clk_mout_epll.clk,
	[8] = &clk_sclk_vpll.clk,
};

static struct clksrc_sources clkset_sclk_audio2 = {
	.sources	= clkset_sclk_audio2_list,
	.nr_sources	= ARRAY_SIZE(clkset_sclk_audio2_list),
};

static struct clksrc_clk clk_sclk_audio2 = {
	.clk		= {
		.name		= "sclk_audio",
675
		.devname	= "soc-audio.2",
676 677
		.enable		= s5pv210_clk_mask0_ctrl,
		.ctrlbit	= (1 << 26),
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694
	},
	.sources = &clkset_sclk_audio2,
	.reg_src = { .reg = S5P_CLK_SRC6, .shift = 8, .size = 4 },
	.reg_div = { .reg = S5P_CLK_DIV6, .shift = 8, .size = 4 },
};

static struct clk *clkset_sclk_spdif_list[] = {
	[0] = &clk_sclk_audio0.clk,
	[1] = &clk_sclk_audio1.clk,
	[2] = &clk_sclk_audio2.clk,
};

static struct clksrc_sources clkset_sclk_spdif = {
	.sources	= clkset_sclk_spdif_list,
	.nr_sources	= ARRAY_SIZE(clkset_sclk_spdif_list),
};

695 696 697 698 699
static struct clksrc_clk clk_sclk_spdif = {
	.clk		= {
		.name		= "sclk_spdif",
		.enable		= s5pv210_clk_mask0_ctrl,
		.ctrlbit	= (1 << 27),
700
		.ops		= &s5p_sclk_spdif_ops,
701 702 703 704 705
	},
	.sources = &clkset_sclk_spdif,
	.reg_src = { .reg = S5P_CLK_SRC6, .shift = 12, .size = 2 },
};

706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
static struct clk *clkset_group2_list[] = {
	[0] = &clk_ext_xtal_mux,
	[1] = &clk_xusbxti,
	[2] = &clk_sclk_hdmi27m,
	[3] = &clk_sclk_usbphy0,
	[4] = &clk_sclk_usbphy1,
	[5] = &clk_sclk_hdmiphy,
	[6] = &clk_mout_mpll.clk,
	[7] = &clk_mout_epll.clk,
	[8] = &clk_sclk_vpll.clk,
};

static struct clksrc_sources clkset_group2 = {
	.sources	= clkset_group2_list,
	.nr_sources	= ARRAY_SIZE(clkset_group2_list),
};

723 724
static struct clksrc_clk clksrcs[] = {
	{
725 726 727 728 729 730 731 732 733 734 735 736 737 738
		.clk	= {
			.name		= "sclk_dmc",
		},
		.sources = &clkset_group1,
		.reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 },
		.reg_div = { .reg = S5P_CLK_DIV6, .shift = 28, .size = 4 },
	}, {
		.clk	= {
			.name		= "sclk_onenand",
		},
		.sources = &clkset_sclk_onenand,
		.reg_src = { .reg = S5P_CLK_SRC0, .shift = 28, .size = 1 },
		.reg_div = { .reg = S5P_CLK_DIV6, .shift = 12, .size = 3 },
	}, {
739 740
		.clk	= {
			.name		= "uclk1",
741
			.devname	= "s5pv210-uart.0",
742 743
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 12),
744 745 746 747
		},
		.sources = &clkset_uart,
		.reg_src = { .reg = S5P_CLK_SRC4, .shift = 16, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV4, .shift = 16, .size = 4 },
748 749 750
	}, {
		.clk		= {
			.name		= "uclk1",
751
			.devname	= "s5pv210-uart.1",
752 753
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 13),
754 755 756 757 758 759 760
		},
		.sources = &clkset_uart,
		.reg_src = { .reg = S5P_CLK_SRC4, .shift = 20, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV4, .shift = 20, .size = 4 },
	}, {
		.clk		= {
			.name		= "uclk1",
761
			.devname	= "s5pv210-uart.2",
762 763
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 14),
764 765 766 767 768 769 770
		},
		.sources = &clkset_uart,
		.reg_src = { .reg = S5P_CLK_SRC4, .shift = 24, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV4, .shift = 24, .size = 4 },
	}, {
		.clk		= {
			.name		= "uclk1",
771
			.devname	= "s5pv210-uart.3",
772 773
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 15),
774 775 776 777
		},
		.sources = &clkset_uart,
		.reg_src = { .reg = S5P_CLK_SRC4, .shift = 28, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV4, .shift = 28, .size = 4 },
778 779 780
	}, {
		.clk	= {
			.name		= "sclk_mixer",
781 782
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 1),
783 784 785
		},
		.sources = &clkset_sclk_mixer,
		.reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 1 },
786 787 788
	}, {
		.clk	= {
			.name		= "sclk_fimc",
789
			.devname	= "s5pv210-fimc.0",
790 791
			.enable		= s5pv210_clk_mask1_ctrl,
			.ctrlbit	= (1 << 2),
792 793 794 795 796 797 798
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC3, .shift = 12, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 },
	}, {
		.clk	= {
			.name		= "sclk_fimc",
799
			.devname	= "s5pv210-fimc.1",
800 801
			.enable		= s5pv210_clk_mask1_ctrl,
			.ctrlbit	= (1 << 3),
802 803 804 805 806 807 808
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC3, .shift = 16, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV3, .shift = 16, .size = 4 },
	}, {
		.clk	= {
			.name		= "sclk_fimc",
809
			.devname	= "s5pv210-fimc.2",
810 811
			.enable		= s5pv210_clk_mask1_ctrl,
			.ctrlbit	= (1 << 4),
812 813 814 815 816 817 818
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC3, .shift = 20, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_cam",
819
			.devname	= "s5pv210-fimc.0",
820 821
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 3),
822 823 824 825 826 827 828
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC1, .shift = 12, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_cam",
829
			.devname	= "s5pv210-fimc.1",
830 831
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 4),
832 833 834 835 836 837 838
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC1, .shift = 16, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV1, .shift = 16, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_fimd",
839 840
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 5),
841 842 843 844 845 846 847
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC1, .shift = 20, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV1, .shift = 20, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_mmc",
848
			.devname	= "s3c-sdhci.0",
849 850
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 8),
851 852 853 854 855 856 857
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC4, .shift = 0, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV4, .shift = 0, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_mmc",
858
			.devname	= "s3c-sdhci.1",
859 860
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 9),
861 862 863 864 865 866 867
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC4, .shift = 4, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV4, .shift = 4, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_mmc",
868
			.devname	= "s3c-sdhci.2",
869 870
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 10),
871 872 873 874 875 876 877
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC4, .shift = 8, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV4, .shift = 8, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_mmc",
878
			.devname	= "s3c-sdhci.3",
879 880
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 11),
881 882 883 884 885 886 887
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC4, .shift = 12, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV4, .shift = 12, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_mfc",
888
			.devname	= "s5p-mfc",
889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915
			.enable		= s5pv210_clk_ip0_ctrl,
			.ctrlbit	= (1 << 16),
		},
		.sources = &clkset_group1,
		.reg_src = { .reg = S5P_CLK_SRC2, .shift = 4, .size = 2 },
		.reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_g2d",
			.enable		= s5pv210_clk_ip0_ctrl,
			.ctrlbit	= (1 << 12),
		},
		.sources = &clkset_group1,
		.reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 },
		.reg_div = { .reg = S5P_CLK_DIV2, .shift = 8, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_g3d",
			.enable		= s5pv210_clk_ip0_ctrl,
			.ctrlbit	= (1 << 8),
		},
		.sources = &clkset_group1,
		.reg_src = { .reg = S5P_CLK_SRC2, .shift = 0, .size = 2 },
		.reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_csis",
916 917
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 6),
918 919 920 921 922 923 924
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC1, .shift = 24, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV1, .shift = 28, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_spi",
925
			.devname	= "s3c64xx-spi.0",
926 927
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 16),
928 929 930 931 932 933 934
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC5, .shift = 0, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV5, .shift = 0, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_spi",
935
			.devname	= "s3c64xx-spi.1",
936 937
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 17),
938 939 940 941 942 943 944
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC5, .shift = 4, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV5, .shift = 4, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_pwi",
945 946
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 29),
947 948 949 950 951 952 953
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC6, .shift = 20, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV6, .shift = 24, .size = 4 },
	}, {
		.clk		= {
			.name		= "sclk_pwm",
954 955
			.enable		= s5pv210_clk_mask0_ctrl,
			.ctrlbit	= (1 << 19),
956 957 958 959
		},
		.sources = &clkset_group2,
		.reg_src = { .reg = S5P_CLK_SRC5, .shift = 12, .size = 4 },
		.reg_div = { .reg = S5P_CLK_DIV5, .shift = 12, .size = 4 },
960
	},
961 962 963
};

/* Clock initialisation code */
964
static struct clksrc_clk *sysclks[] = {
965 966 967
	&clk_mout_apll,
	&clk_mout_epll,
	&clk_mout_mpll,
968
	&clk_armclk,
969
	&clk_hclk_msys,
970 971
	&clk_sclk_a2m,
	&clk_hclk_dsys,
972
	&clk_hclk_psys,
973
	&clk_pclk_msys,
974
	&clk_pclk_dsys,
975
	&clk_pclk_psys,
976 977
	&clk_vpllsrc,
	&clk_sclk_vpll,
978 979 980
	&clk_sclk_dac,
	&clk_sclk_pixel,
	&clk_sclk_hdmi,
981 982
	&clk_mout_dmc0,
	&clk_sclk_dmc0,
983 984 985 986
	&clk_sclk_audio0,
	&clk_sclk_audio1,
	&clk_sclk_audio2,
	&clk_sclk_spdif,
987 988
};

989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
static u32 epll_div[][6] = {
	{  48000000, 0, 48, 3, 3, 0 },
	{  96000000, 0, 48, 3, 2, 0 },
	{ 144000000, 1, 72, 3, 2, 0 },
	{ 192000000, 0, 48, 3, 1, 0 },
	{ 288000000, 1, 72, 3, 1, 0 },
	{  32750000, 1, 65, 3, 4, 35127 },
	{  32768000, 1, 65, 3, 4, 35127 },
	{  45158400, 0, 45, 3, 3, 10355 },
	{  45000000, 0, 45, 3, 3, 10355 },
	{  45158000, 0, 45, 3, 3, 10355 },
	{  49125000, 0, 49, 3, 3, 9961 },
	{  49152000, 0, 49, 3, 3, 9961 },
	{  67737600, 1, 67, 3, 3, 48366 },
	{  67738000, 1, 67, 3, 3, 48366 },
	{  73800000, 1, 73, 3, 3, 47710 },
	{  73728000, 1, 73, 3, 3, 47710 },
	{  36000000, 1, 32, 3, 4, 0 },
	{  60000000, 1, 60, 3, 3, 0 },
	{  72000000, 1, 72, 3, 3, 0 },
	{  80000000, 1, 80, 3, 3, 0 },
	{  84000000, 0, 42, 3, 2, 0 },
	{  50000000, 0, 50, 3, 3, 0 },
};

static int s5pv210_epll_set_rate(struct clk *clk, unsigned long rate)
{
	unsigned int epll_con, epll_con_k;
	unsigned int i;

	/* Return if nothing changed */
	if (clk->rate == rate)
		return 0;

	epll_con = __raw_readl(S5P_EPLL_CON);
	epll_con_k = __raw_readl(S5P_EPLL_CON1);

	epll_con_k &= ~PLL46XX_KDIV_MASK;
	epll_con &= ~(1 << 27 |
			PLL46XX_MDIV_MASK << PLL46XX_MDIV_SHIFT |
			PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT |
			PLL46XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);

	for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
		if (epll_div[i][0] == rate) {
			epll_con_k |= epll_div[i][5] << 0;
			epll_con |= (epll_div[i][1] << 27 |
					epll_div[i][2] << PLL46XX_MDIV_SHIFT |
					epll_div[i][3] << PLL46XX_PDIV_SHIFT |
					epll_div[i][4] << PLL46XX_SDIV_SHIFT);
			break;
		}
	}

	if (i == ARRAY_SIZE(epll_div)) {
		printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n",
				__func__);
		return -EINVAL;
	}

	__raw_writel(epll_con, S5P_EPLL_CON);
	__raw_writel(epll_con_k, S5P_EPLL_CON1);

1052 1053 1054
	printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
			clk->rate, rate);

1055 1056 1057 1058 1059 1060 1061 1062 1063 1064
	clk->rate = rate;

	return 0;
}

static struct clk_ops s5pv210_epll_ops = {
	.set_rate = s5pv210_epll_set_rate,
	.get_rate = s5p_epll_get_rate,
};

1065 1066 1067
void __init_or_cpufreq s5pv210_setup_clocks(void)
{
	struct clk *xtal_clk;
1068
	unsigned long vpllsrc;
1069
	unsigned long armclk;
1070
	unsigned long hclk_msys;
1071
	unsigned long hclk_dsys;
1072
	unsigned long hclk_psys;
1073
	unsigned long pclk_msys;
1074
	unsigned long pclk_dsys;
1075
	unsigned long pclk_psys;
1076 1077 1078
	unsigned long apll;
	unsigned long mpll;
	unsigned long epll;
1079
	unsigned long vpll;
1080 1081 1082
	unsigned int ptr;
	u32 clkdiv0, clkdiv1;

1083 1084 1085 1086
	/* Set functions for clk_fout_epll */
	clk_fout_epll.enable = s5p_epll_enable;
	clk_fout_epll.ops = &s5pv210_epll_ops;

1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104
	printk(KERN_DEBUG "%s: registering clocks\n", __func__);

	clkdiv0 = __raw_readl(S5P_CLK_DIV0);
	clkdiv1 = __raw_readl(S5P_CLK_DIV1);

	printk(KERN_DEBUG "%s: clkdiv0 = %08x, clkdiv1 = %08x\n",
				__func__, clkdiv0, clkdiv1);

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

	xtal = clk_get_rate(xtal_clk);
	clk_put(xtal_clk);

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

	apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508);
	mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502);
1105 1106
	epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON),
				__raw_readl(S5P_EPLL_CON1), pll_4600);
1107 1108
	vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
	vpll = s5p_get_pll45xx(vpllsrc, __raw_readl(S5P_VPLL_CON), pll_4502);
1109

1110
	clk_fout_apll.ops = &clk_fout_apll_ops;
1111 1112
	clk_fout_mpll.rate = mpll;
	clk_fout_epll.rate = epll;
1113
	clk_fout_vpll.rate = vpll;
1114

1115 1116
	printk(KERN_INFO "S5PV210: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
			apll, mpll, epll, vpll);
1117

1118
	armclk = clk_get_rate(&clk_armclk.clk);
1119
	hclk_msys = clk_get_rate(&clk_hclk_msys.clk);
1120
	hclk_dsys = clk_get_rate(&clk_hclk_dsys.clk);
1121
	hclk_psys = clk_get_rate(&clk_hclk_psys.clk);
1122
	pclk_msys = clk_get_rate(&clk_pclk_msys.clk);
1123
	pclk_dsys = clk_get_rate(&clk_pclk_dsys.clk);
1124
	pclk_psys = clk_get_rate(&clk_pclk_psys.clk);
1125

1126 1127 1128
	printk(KERN_INFO "S5PV210: ARMCLK=%ld, HCLKM=%ld, HCLKD=%ld\n"
			 "HCLKP=%ld, PCLKM=%ld, PCLKD=%ld, PCLKP=%ld\n",
			armclk, hclk_msys, hclk_dsys, hclk_psys,
1129
			pclk_msys, pclk_dsys, pclk_psys);
1130 1131

	clk_f.rate = armclk;
1132
	clk_h.rate = hclk_psys;
1133
	clk_p.rate = pclk_psys;
1134 1135 1136 1137 1138 1139

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

static struct clk *clks[] __initdata = {
1140
	&clk_sclk_hdmi27m,
1141 1142 1143
	&clk_sclk_hdmiphy,
	&clk_sclk_usbphy0,
	&clk_sclk_usbphy1,
1144 1145 1146
	&clk_pcmcdclk0,
	&clk_pcmcdclk1,
	&clk_pcmcdclk2,
1147 1148 1149 1150 1151 1152
};

void __init s5pv210_register_clocks(void)
{
	int ptr;

1153
	s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1154

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

1158 1159 1160
	s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
	s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));

1161 1162
	s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
	s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1163 1164 1165

	s3c_pwmclk_init();
}