aboutsummaryrefslogtreecommitdiffstats
path: root/arch
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
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')
-rw-r--r--arch/arm/mach-imx/clk-imx1.c7
-rw-r--r--arch/arm/mach-imx/clk-imx21.c7
-rw-r--r--arch/arm/mach-imx/clk-imx25.c7
-rw-r--r--arch/arm/mach-imx/clk-imx27.c7
-rw-r--r--arch/arm/mach-imx/clk-imx31.c6
-rw-r--r--arch/arm/mach-imx/clk-imx35.c6
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c37
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c5
-rw-r--r--arch/arm/mach-imx/clk-imx6sl.c5
-rw-r--r--arch/arm/mach-imx/clk-imx6sx.c4
-rw-r--r--arch/arm/mach-imx/clk-vf610.c2
-rw-r--r--arch/arm/mach-imx/clk.c10
-rw-r--r--arch/arm/mach-imx/clk.h2
13 files changed, 32 insertions, 73 deletions
diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
index 96b1eb6631f0..42017e2c3aa7 100644
--- a/arch/arm/mach-imx/clk-imx1.c
+++ b/arch/arm/mach-imx/clk-imx1.c
@@ -44,8 +44,6 @@ static void __iomem *ccm __initdata;
44 44
45static void __init _mx1_clocks_init(unsigned long fref) 45static void __init _mx1_clocks_init(unsigned long fref)
46{ 46{
47 unsigned i;
48
49 clk[IMX1_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 47 clk[IMX1_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
50 clk[IMX1_CLK_CLK32] = imx_obtain_fixed_clock("clk32", fref); 48 clk[IMX1_CLK_CLK32] = imx_obtain_fixed_clock("clk32", fref);
51 clk[IMX1_CLK_CLK16M_EXT] = imx_clk_fixed("clk16m_ext", 16000000); 49 clk[IMX1_CLK_CLK16M_EXT] = imx_clk_fixed("clk16m_ext", 16000000);
@@ -72,10 +70,7 @@ static void __init _mx1_clocks_init(unsigned long fref)
72 clk[IMX1_CLK_MMA_GATE] = imx_clk_gate("mma_gate", "hclk", SCM_GCCR, 1); 70 clk[IMX1_CLK_MMA_GATE] = imx_clk_gate("mma_gate", "hclk", SCM_GCCR, 1);
73 clk[IMX1_CLK_USBD_GATE] = imx_clk_gate("usbd_gate", "clk48m", SCM_GCCR, 0); 71 clk[IMX1_CLK_USBD_GATE] = imx_clk_gate("usbd_gate", "clk48m", SCM_GCCR, 0);
74 72
75 for (i = 0; i < ARRAY_SIZE(clk); i++) 73 imx_check_clocks(clk, ARRAY_SIZE(clk));
76 if (IS_ERR(clk[i]))
77 pr_err("imx1 clk %d: register failed with %ld\n",
78 i, PTR_ERR(clk[i]));
79} 74}
80 75
81int __init mx1_clocks_init(unsigned long fref) 76int __init mx1_clocks_init(unsigned long fref)
diff --git a/arch/arm/mach-imx/clk-imx21.c b/arch/arm/mach-imx/clk-imx21.c
index bdc2e4630a08..4a20c665f938 100644
--- a/arch/arm/mach-imx/clk-imx21.c
+++ b/arch/arm/mach-imx/clk-imx21.c
@@ -70,8 +70,6 @@ static struct clk *clk[clk_max];
70 */ 70 */
71int __init mx21_clocks_init(unsigned long lref, unsigned long href) 71int __init mx21_clocks_init(unsigned long lref, unsigned long href)
72{ 72{
73 int i;
74
75 clk[ckil] = imx_clk_fixed("ckil", lref); 73 clk[ckil] = imx_clk_fixed("ckil", lref);
76 clk[ckih] = imx_clk_fixed("ckih", href); 74 clk[ckih] = imx_clk_fixed("ckih", href);
77 clk[fpm] = imx_clk_fixed_factor("fpm", "ckil", 512, 1); 75 clk[fpm] = imx_clk_fixed_factor("fpm", "ckil", 512, 1);
@@ -126,10 +124,7 @@ int __init mx21_clocks_init(unsigned long lref, unsigned long href)
126 clk[owire_gate] = imx_clk_gate("owire_gate", "ipg", CCM_PCCR1, 31); 124 clk[owire_gate] = imx_clk_gate("owire_gate", "ipg", CCM_PCCR1, 31);
127 clk[rtc_gate] = imx_clk_gate("rtc_gate", "ipg", CCM_PCCR1, 29); 125 clk[rtc_gate] = imx_clk_gate("rtc_gate", "ipg", CCM_PCCR1, 29);
128 126
129 for (i = 0; i < ARRAY_SIZE(clk); i++) 127 imx_check_clocks(clk, ARRAY_SIZE(clk));
130 if (IS_ERR(clk[i]))
131 pr_err("i.MX21 clk %d: register failed with %ld\n",
132 i, PTR_ERR(clk[i]));
133 128
134 clk_register_clkdev(clk[per1], "per1", NULL); 129 clk_register_clkdev(clk[per1], "per1", NULL);
135 clk_register_clkdev(clk[per2], "per2", NULL); 130 clk_register_clkdev(clk[per2], "per2", NULL);
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index 2423c09140c8..887b5080afdb 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -93,8 +93,6 @@ static struct clk *clk[clk_max];
93 93
94static int __init __mx25_clocks_init(unsigned long osc_rate) 94static int __init __mx25_clocks_init(unsigned long osc_rate)
95{ 95{
96 int i;
97
98 clk[dummy] = imx_clk_fixed("dummy", 0); 96 clk[dummy] = imx_clk_fixed("dummy", 0);
99 clk[osc] = imx_clk_fixed("osc", osc_rate); 97 clk[osc] = imx_clk_fixed("osc", osc_rate);
100 clk[mpll] = imx_clk_pllv1("mpll", "osc", ccm(CCM_MPCTL)); 98 clk[mpll] = imx_clk_pllv1("mpll", "osc", ccm(CCM_MPCTL));
@@ -224,10 +222,7 @@ static int __init __mx25_clocks_init(unsigned long osc_rate)
224 /* CCM_CGCR2(19): reserved in datasheet, but used as wdt in FSL kernel */ 222 /* CCM_CGCR2(19): reserved in datasheet, but used as wdt in FSL kernel */
225 clk[wdt_ipg] = imx_clk_gate("wdt_ipg", "ipg", ccm(CCM_CGCR2), 19); 223 clk[wdt_ipg] = imx_clk_gate("wdt_ipg", "ipg", ccm(CCM_CGCR2), 19);
226 224
227 for (i = 0; i < ARRAY_SIZE(clk); i++) 225 imx_check_clocks(clk, ARRAY_SIZE(clk));
228 if (IS_ERR(clk[i]))
229 pr_err("i.MX25 clk %d: register failed with %ld\n",
230 i, PTR_ERR(clk[i]));
231 226
232 clk_prepare_enable(clk[emi_ahb]); 227 clk_prepare_enable(clk[emi_ahb]);
233 228
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 8c55797dc3e2..d76aa5f13260 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -90,8 +90,6 @@ static struct clk_onecell_data clk_data;
90 90
91static void __init _mx27_clocks_init(unsigned long fref) 91static void __init _mx27_clocks_init(unsigned long fref)
92{ 92{
93 unsigned i;
94
95 BUG_ON(!ccm); 93 BUG_ON(!ccm);
96 94
97 clk[dummy] = imx_clk_fixed("dummy", 0); 95 clk[dummy] = imx_clk_fixed("dummy", 0);
@@ -201,10 +199,7 @@ static void __init _mx27_clocks_init(unsigned long fref)
201 clk[uart2_ipg_gate] = imx_clk_gate("uart2_ipg_gate", "ipg", CCM_PCCR1, 30); 199 clk[uart2_ipg_gate] = imx_clk_gate("uart2_ipg_gate", "ipg", CCM_PCCR1, 30);
202 clk[uart1_ipg_gate] = imx_clk_gate("uart1_ipg_gate", "ipg", CCM_PCCR1, 31); 200 clk[uart1_ipg_gate] = imx_clk_gate("uart1_ipg_gate", "ipg", CCM_PCCR1, 31);
203 201
204 for (i = 0; i < ARRAY_SIZE(clk); i++) 202 imx_check_clocks(clk, ARRAY_SIZE(clk));
205 if (IS_ERR(clk[i]))
206 pr_err("i.MX27 clk %d: register failed with %ld\n",
207 i, PTR_ERR(clk[i]));
208 203
209 clk_register_clkdev(clk[cpu_div], NULL, "cpu0"); 204 clk_register_clkdev(clk[cpu_div], NULL, "cpu0");
210 205
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index 4a9de0835eb1..286ef422cebc 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -51,7 +51,6 @@ static struct clk_onecell_data clk_data;
51int __init mx31_clocks_init(unsigned long fref) 51int __init mx31_clocks_init(unsigned long fref)
52{ 52{
53 void __iomem *base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR); 53 void __iomem *base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR);
54 int i;
55 struct device_node *np; 54 struct device_node *np;
56 55
57 clk[dummy] = imx_clk_fixed("dummy", 0); 56 clk[dummy] = imx_clk_fixed("dummy", 0);
@@ -114,10 +113,7 @@ int __init mx31_clocks_init(unsigned long fref)
114 clk[rtic_gate] = imx_clk_gate2("rtic_gate", "ahb", base + MXC_CCM_CGR2, 10); 113 clk[rtic_gate] = imx_clk_gate2("rtic_gate", "ahb", base + MXC_CCM_CGR2, 10);
115 clk[firi_gate] = imx_clk_gate2("firi_gate", "upll", base+MXC_CCM_CGR2, 12); 114 clk[firi_gate] = imx_clk_gate2("firi_gate", "upll", base+MXC_CCM_CGR2, 12);
116 115
117 for (i = 0; i < ARRAY_SIZE(clk); i++) 116 imx_check_clocks(clk, ARRAY_SIZE(clk));
118 if (IS_ERR(clk[i]))
119 pr_err("imx31 clk %d: register failed with %ld\n",
120 i, PTR_ERR(clk[i]));
121 117
122 np = of_find_compatible_node(NULL, NULL, "fsl,imx31-ccm"); 118 np = of_find_compatible_node(NULL, NULL, "fsl,imx31-ccm");
123 119
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index 71c86a2f856d..a0d2b57fd376 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -75,7 +75,6 @@ int __init mx35_clocks_init(void)
75 u32 pdr0, consumer_sel, hsp_sel; 75 u32 pdr0, consumer_sel, hsp_sel;
76 struct arm_ahb_div *aad; 76 struct arm_ahb_div *aad;
77 unsigned char *hsp_div; 77 unsigned char *hsp_div;
78 u32 i;
79 78
80 pdr0 = __raw_readl(base + MXC_CCM_PDR0); 79 pdr0 = __raw_readl(base + MXC_CCM_PDR0);
81 consumer_sel = (pdr0 >> 16) & 0xf; 80 consumer_sel = (pdr0 >> 16) & 0xf;
@@ -200,10 +199,7 @@ int __init mx35_clocks_init(void)
200 clk[iim_gate] = imx_clk_gate2("iim_gate", "ipg", base + MX35_CCM_CGR3, 2); 199 clk[iim_gate] = imx_clk_gate2("iim_gate", "ipg", base + MX35_CCM_CGR3, 2);
201 clk[gpu2d_gate] = imx_clk_gate2("gpu2d_gate", "ahb", base + MX35_CCM_CGR3, 4); 200 clk[gpu2d_gate] = imx_clk_gate2("gpu2d_gate", "ahb", base + MX35_CCM_CGR3, 4);
202 201
203 for (i = 0; i < ARRAY_SIZE(clk); i++) 202 imx_check_clocks(clk, ARRAY_SIZE(clk));
204 if (IS_ERR(clk[i]))
205 pr_err("i.MX35 clk %d: register failed with %ld\n",
206 i, PTR_ERR(clk[i]));
207 203
208 clk_register_clkdev(clk[pata_gate], NULL, "pata_imx"); 204 clk_register_clkdev(clk[pata_gate], NULL, "pata_imx");
209 clk_register_clkdev(clk[can1_gate], NULL, "flexcan.0"); 205 clk_register_clkdev(clk[can1_gate], NULL, "flexcan.0");
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");
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 540f257007a4..56c897ef454b 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -433,10 +433,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
433 clk[cko1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7); 433 clk[cko1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7);
434 clk[cko2] = imx_clk_gate("cko2", "cko2_podf", base + 0x60, 24); 434 clk[cko2] = imx_clk_gate("cko2", "cko2_podf", base + 0x60, 24);
435 435
436 for (i = 0; i < ARRAY_SIZE(clk); i++) 436 imx_check_clocks(clk, ARRAY_SIZE(clk));
437 if (IS_ERR(clk[i]))
438 pr_err("i.MX6q clk %d: register failed with %ld\n",
439 i, PTR_ERR(clk[i]));
440 437
441 clk_data.clks = clk; 438 clk_data.clks = clk;
442 clk_data.clk_num = ARRAY_SIZE(clk); 439 clk_data.clk_num = ARRAY_SIZE(clk);
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
index 7431bfafb17e..460241852418 100644
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -348,10 +348,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
348 clks[IMX6SL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 348 clks[IMX6SL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6);
349 clks[IMX6SL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); 349 clks[IMX6SL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8);
350 350
351 for (i = 0; i < ARRAY_SIZE(clks); i++) 351 imx_check_clocks(clks, ARRAY_SIZE(clks));
352 if (IS_ERR(clks[i]))
353 pr_err("i.MX6SL clk %d: register failed with %ld\n",
354 i, PTR_ERR(clks[i]));
355 352
356 clk_data.clks = clks; 353 clk_data.clks = clks;
357 clk_data.clk_num = ARRAY_SIZE(clks); 354 clk_data.clk_num = ARRAY_SIZE(clks);
diff --git a/arch/arm/mach-imx/clk-imx6sx.c b/arch/arm/mach-imx/clk-imx6sx.c
index 5211cf61abca..2e9610357f4c 100644
--- a/arch/arm/mach-imx/clk-imx6sx.c
+++ b/arch/arm/mach-imx/clk-imx6sx.c
@@ -443,9 +443,7 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
443 /* mask handshake of mmdc */ 443 /* mask handshake of mmdc */
444 writel_relaxed(BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR); 444 writel_relaxed(BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR);
445 445
446 for (i = 0; i < ARRAY_SIZE(clks); i++) 446 imx_check_clocks(clks, ARRAY_SIZE(clks));
447 if (IS_ERR(clks[i]))
448 pr_err("i.MX6sx clk %d: register failed with %ld\n", i, PTR_ERR(clks[i]));
449 447
450 clk_data.clks = clks; 448 clk_data.clks = clks;
451 clk_data.clk_num = ARRAY_SIZE(clks); 449 clk_data.clk_num = ARRAY_SIZE(clks);
diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c
index 22dc3ee21fd4..2435bc4612eb 100644
--- a/arch/arm/mach-imx/clk-vf610.c
+++ b/arch/arm/mach-imx/clk-vf610.c
@@ -303,6 +303,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
303 clk[VF610_CLK_DMAMUX2] = imx_clk_gate2("dmamux2", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(1)); 303 clk[VF610_CLK_DMAMUX2] = imx_clk_gate2("dmamux2", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(1));
304 clk[VF610_CLK_DMAMUX3] = imx_clk_gate2("dmamux3", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(2)); 304 clk[VF610_CLK_DMAMUX3] = imx_clk_gate2("dmamux3", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(2));
305 305
306 imx_check_clocks(clk, ARRAY_SIZE(clk));
307
306 clk_set_parent(clk[VF610_CLK_QSPI0_SEL], clk[VF610_CLK_PLL1_PFD4]); 308 clk_set_parent(clk[VF610_CLK_QSPI0_SEL], clk[VF610_CLK_PLL1_PFD4]);
307 clk_set_rate(clk[VF610_CLK_QSPI0_X4_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_SEL]) / 2); 309 clk_set_rate(clk[VF610_CLK_QSPI0_X4_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_SEL]) / 2);
308 clk_set_rate(clk[VF610_CLK_QSPI0_X2_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_X4_DIV]) / 2); 310 clk_set_rate(clk[VF610_CLK_QSPI0_X2_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_X4_DIV]) / 2);
diff --git a/arch/arm/mach-imx/clk.c b/arch/arm/mach-imx/clk.c
index edc35df7bed4..df12b5307175 100644
--- a/arch/arm/mach-imx/clk.c
+++ b/arch/arm/mach-imx/clk.c
@@ -7,6 +7,16 @@
7 7
8DEFINE_SPINLOCK(imx_ccm_lock); 8DEFINE_SPINLOCK(imx_ccm_lock);
9 9
10void __init imx_check_clocks(struct clk *clks[], unsigned int count)
11{
12 unsigned i;
13
14 for (i = 0; i < count; i++)
15 if (IS_ERR(clks[i]))
16 pr_err("i.MX clk %u: register failed with %ld\n",
17 i, PTR_ERR(clks[i]));
18}
19
10static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name) 20static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name)
11{ 21{
12 struct of_phandle_args phandle; 22 struct of_phandle_args phandle;
diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
index e29f6ebe9f39..7edb7dca7d57 100644
--- a/arch/arm/mach-imx/clk.h
+++ b/arch/arm/mach-imx/clk.h
@@ -6,6 +6,8 @@
6 6
7extern spinlock_t imx_ccm_lock; 7extern spinlock_t imx_ccm_lock;
8 8
9void imx_check_clocks(struct clk *clks[], unsigned int count);
10
9extern void imx_cscmr1_fixup(u32 *val); 11extern void imx_cscmr1_fixup(u32 *val);
10 12
11struct clk *imx_clk_pllv1(const char *name, const char *parent, 13struct clk *imx_clk_pllv1(const char *name, const char *parent,