aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/clk-imx51-imx53.c
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-06-10 11:40:26 -0400
committerShawn Guo <shawn.guo@freescale.com>2014-07-18 04:10:12 -0400
commit229be9c14176989b0cb68d4d8aeba30486ec8e16 (patch)
tree4f7988a238a29854714e568afaf6310c36764db5 /arch/arm/mach-imx/clk-imx51-imx53.c
parentc349adde00e8aba6c05316ef8670836baff2d503 (diff)
ARM: i.MX clk: Move clock check function in common location
This patch moves clock check function in common i.MX location and switch i.MX clk drivers to use this new function. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Diffstat (limited to 'arch/arm/mach-imx/clk-imx51-imx53.c')
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index e293f6af8b6d..cf6e6309318e 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -131,8 +131,6 @@ static struct clk_onecell_data clk_data;
131 131
132static void __init mx5_clocks_common_init(void __iomem *ccm_base) 132static void __init mx5_clocks_common_init(void __iomem *ccm_base)
133{ 133{
134 int i;
135
136 imx5_pm_set_ccm_base(ccm_base); 134 imx5_pm_set_ccm_base(ccm_base);
137 135
138 clk[IMX5_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 136 clk[IMX5_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
@@ -287,11 +285,6 @@ static void __init mx5_clocks_common_init(void __iomem *ccm_base)
287 clk[IMX5_CLK_SAHARA_IPG_GATE] = imx_clk_gate2("sahara_ipg_gate", "ipg", MXC_CCM_CCGR4, 14); 285 clk[IMX5_CLK_SAHARA_IPG_GATE] = imx_clk_gate2("sahara_ipg_gate", "ipg", MXC_CCM_CCGR4, 14);
288 clk[IMX5_CLK_SATA_REF] = imx_clk_fixed_factor("sata_ref", "usb_phy1_gate", 1, 1); 286 clk[IMX5_CLK_SATA_REF] = imx_clk_fixed_factor("sata_ref", "usb_phy1_gate", 1, 1);
289 287
290 for (i = 0; i < ARRAY_SIZE(clk); i++)
291 if (IS_ERR(clk[i]))
292 pr_err("i.MX5 clk %d: register failed with %ld\n",
293 i, PTR_ERR(clk[i]));
294
295 clk_register_clkdev(clk[IMX5_CLK_UART1_PER_GATE], "per", "imx21-uart.0"); 288 clk_register_clkdev(clk[IMX5_CLK_UART1_PER_GATE], "per", "imx21-uart.0");
296 clk_register_clkdev(clk[IMX5_CLK_UART1_IPG_GATE], "ipg", "imx21-uart.0"); 289 clk_register_clkdev(clk[IMX5_CLK_UART1_IPG_GATE], "ipg", "imx21-uart.0");
297 clk_register_clkdev(clk[IMX5_CLK_UART2_PER_GATE], "per", "imx21-uart.1"); 290 clk_register_clkdev(clk[IMX5_CLK_UART2_PER_GATE], "per", "imx21-uart.1");
@@ -366,7 +359,6 @@ static void __init mx50_clocks_init(struct device_node *np)
366 void __iomem *ccm_base; 359 void __iomem *ccm_base;
367 void __iomem *pll_base; 360 void __iomem *pll_base;
368 unsigned long r; 361 unsigned long r;
369 int i;
370 362
371 pll_base = ioremap(MX53_DPLL1_BASE, SZ_16K); 363 pll_base = ioremap(MX53_DPLL1_BASE, SZ_16K);
372 WARN_ON(!pll_base); 364 WARN_ON(!pll_base);
@@ -383,6 +375,8 @@ static void __init mx50_clocks_init(struct device_node *np)
383 ccm_base = of_iomap(np, 0); 375 ccm_base = of_iomap(np, 0);
384 WARN_ON(!ccm_base); 376 WARN_ON(!ccm_base);
385 377
378 mx5_clocks_common_init(ccm_base);
379
386 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1, 380 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1,
387 lp_apm_sel, ARRAY_SIZE(lp_apm_sel)); 381 lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
388 clk[IMX5_CLK_ESDHC1_PER_GATE] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2); 382 clk[IMX5_CLK_ESDHC1_PER_GATE] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
@@ -403,17 +397,12 @@ static void __init mx50_clocks_init(struct device_node *np)
403 clk[IMX5_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3); 397 clk[IMX5_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3);
404 clk[IMX5_CLK_CKO2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24); 398 clk[IMX5_CLK_CKO2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24);
405 399
406 for (i = 0; i < ARRAY_SIZE(clk); i++) 400 imx_check_clocks(clk, ARRAY_SIZE(clk));
407 if (IS_ERR(clk[i]))
408 pr_err("i.MX50 clk %d: register failed with %ld\n",
409 i, PTR_ERR(clk[i]));
410 401
411 clk_data.clks = clk; 402 clk_data.clks = clk;
412 clk_data.clk_num = ARRAY_SIZE(clk); 403 clk_data.clk_num = ARRAY_SIZE(clk);
413 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 404 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
414 405
415 mx5_clocks_common_init(ccm_base);
416
417 /* set SDHC root clock to 200MHZ*/ 406 /* set SDHC root clock to 200MHZ*/
418 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000); 407 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000);
419 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000); 408 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000);
@@ -433,7 +422,6 @@ static void __init mx51_clocks_init(struct device_node *np)
433{ 422{
434 void __iomem *ccm_base; 423 void __iomem *ccm_base;
435 void __iomem *pll_base; 424 void __iomem *pll_base;
436 int i;
437 u32 val; 425 u32 val;
438 426
439 pll_base = ioremap(MX51_DPLL1_BASE, SZ_16K); 427 pll_base = ioremap(MX51_DPLL1_BASE, SZ_16K);
@@ -451,6 +439,8 @@ static void __init mx51_clocks_init(struct device_node *np)
451 ccm_base = of_iomap(np, 0); 439 ccm_base = of_iomap(np, 0);
452 WARN_ON(!ccm_base); 440 WARN_ON(!ccm_base);
453 441
442 mx5_clocks_common_init(ccm_base);
443
454 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1, 444 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1,
455 lp_apm_sel, ARRAY_SIZE(lp_apm_sel)); 445 lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
456 clk[IMX5_CLK_IPU_DI0_SEL] = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3, 446 clk[IMX5_CLK_IPU_DI0_SEL] = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3,
@@ -483,17 +473,12 @@ static void __init mx51_clocks_init(struct device_node *np)
483 mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel)); 473 mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel));
484 clk[IMX5_CLK_SPDIF1_GATE] = imx_clk_gate2("spdif1_gate", "spdif1_com_sel", MXC_CCM_CCGR5, 28); 474 clk[IMX5_CLK_SPDIF1_GATE] = imx_clk_gate2("spdif1_gate", "spdif1_com_sel", MXC_CCM_CCGR5, 28);
485 475
486 for (i = 0; i < ARRAY_SIZE(clk); i++) 476 imx_check_clocks(clk, ARRAY_SIZE(clk));
487 if (IS_ERR(clk[i]))
488 pr_err("i.MX51 clk %d: register failed with %ld\n",
489 i, PTR_ERR(clk[i]));
490 477
491 clk_data.clks = clk; 478 clk_data.clks = clk;
492 clk_data.clk_num = ARRAY_SIZE(clk); 479 clk_data.clk_num = ARRAY_SIZE(clk);
493 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 480 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
494 481
495 mx5_clocks_common_init(ccm_base);
496
497 clk_register_clkdev(clk[IMX5_CLK_HSI2C_GATE], NULL, "imx21-i2c.2"); 482 clk_register_clkdev(clk[IMX5_CLK_HSI2C_GATE], NULL, "imx21-i2c.2");
498 clk_register_clkdev(clk[IMX5_CLK_MX51_MIPI], "mipi_hsp", NULL); 483 clk_register_clkdev(clk[IMX5_CLK_MX51_MIPI], "mipi_hsp", NULL);
499 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx27-fec.0"); 484 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx27-fec.0");
@@ -546,7 +531,6 @@ static void __init mx53_clocks_init(struct device_node *np)
546{ 531{
547 void __iomem *ccm_base; 532 void __iomem *ccm_base;
548 void __iomem *pll_base; 533 void __iomem *pll_base;
549 int i;
550 unsigned long r; 534 unsigned long r;
551 535
552 pll_base = ioremap(MX53_DPLL1_BASE, SZ_16K); 536 pll_base = ioremap(MX53_DPLL1_BASE, SZ_16K);
@@ -568,6 +552,8 @@ static void __init mx53_clocks_init(struct device_node *np)
568 ccm_base = of_iomap(np, 0); 552 ccm_base = of_iomap(np, 0);
569 WARN_ON(!ccm_base); 553 WARN_ON(!ccm_base);
570 554
555 mx5_clocks_common_init(ccm_base);
556
571 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1, 557 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1,
572 lp_apm_sel, ARRAY_SIZE(lp_apm_sel)); 558 lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
573 clk[IMX5_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7); 559 clk[IMX5_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7);
@@ -617,17 +603,12 @@ static void __init mx53_clocks_init(struct device_node *np)
617 clk[IMX5_CLK_SPDIF_XTAL_SEL] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2, 603 clk[IMX5_CLK_SPDIF_XTAL_SEL] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
618 mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel)); 604 mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel));
619 605
620 for (i = 0; i < ARRAY_SIZE(clk); i++) 606 imx_check_clocks(clk, ARRAY_SIZE(clk));
621 if (IS_ERR(clk[i]))
622 pr_err("i.MX53 clk %d: register failed with %ld\n",
623 i, PTR_ERR(clk[i]));
624 607
625 clk_data.clks = clk; 608 clk_data.clks = clk;
626 clk_data.clk_num = ARRAY_SIZE(clk); 609 clk_data.clk_num = ARRAY_SIZE(clk);
627 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 610 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
628 611
629 mx5_clocks_common_init(ccm_base);
630
631 clk_register_clkdev(clk[IMX5_CLK_I2C3_GATE], NULL, "imx21-i2c.2"); 612 clk_register_clkdev(clk[IMX5_CLK_I2C3_GATE], NULL, "imx21-i2c.2");
632 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx25-fec.0"); 613 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx25-fec.0");
633 clk_register_clkdev(clk[IMX5_CLK_USB_PHY1_GATE], "usb_phy1", "mxc-ehci.0"); 614 clk_register_clkdev(clk[IMX5_CLK_USB_PHY1_GATE], "usb_phy1", "mxc-ehci.0");