aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2013-11-08 14:54:31 -0500
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:47:09 -0400
commit06ea59d18fcf44b111fa8dffb2b71cb2032724b2 (patch)
treed8d267ce1592b3ea91882a9ee577c78d245870fd
parentbec47fba08fea380a353b93bd277019bdc5d3815 (diff)
ENGR00286960-1 arm: imx: initialize clock gate status
Some clocks gates need to be set to 2b'01 to allow CCM auto disabling them when system enters WAIT mode, this setting can save many runtime power. These clock gates are normally always enabled, so no need to add another status for clk gate enable function, just set them to right status when system boot up is good enough. Signed-off-by: Anson Huang <b20788@freescale.com>
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c27
-rw-r--r--arch/arm/mach-imx/clk-imx6sl.c21
2 files changed, 48 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 6f29fa652621..69a49f1338f7 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -24,6 +24,8 @@
24#include "common.h" 24#include "common.h"
25#include "hardware.h" 25#include "hardware.h"
26 26
27#define CCM_CCGR_OFFSET(index) (index * 2)
28
27static const char *step_sels[] = { "osc", "pll2_pfd2_396m", }; 29static const char *step_sels[] = { "osc", "pll2_pfd2_396m", };
28static const char *pll1_sw_sels[] = { "pll1_sys", "step", }; 30static const char *pll1_sw_sels[] = { "pll1_sys", "step", };
29static const char *periph_pre_sels[] = { "pll2_bus", "pll2_pfd2_396m", "pll2_pfd0_352m", "pll2_198m", }; 31static const char *periph_pre_sels[] = { "pll2_bus", "pll2_pfd2_396m", "pll2_pfd0_352m", "pll2_198m", };
@@ -437,6 +439,31 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
437 pr_err("i.MX6q clk %d: register failed with %ld\n", 439 pr_err("i.MX6q clk %d: register failed with %ld\n",
438 i, PTR_ERR(clk[i])); 440 i, PTR_ERR(clk[i]));
439 441
442 /* Initialize clock gate status */
443 writel_relaxed(1 << CCM_CCGR_OFFSET(11) |
444 3 << CCM_CCGR_OFFSET(1) |
445 3 << CCM_CCGR_OFFSET(0), base + 0x68);
446 if (cpu_is_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_1_0)
447 writel_relaxed(3 << CCM_CCGR_OFFSET(11) |
448 3 << CCM_CCGR_OFFSET(10), base + 0x6c);
449 else
450 writel_relaxed(3 << CCM_CCGR_OFFSET(10), base + 0x6c);
451 writel_relaxed(1 << CCM_CCGR_OFFSET(12) |
452 3 << CCM_CCGR_OFFSET(11) |
453 3 << CCM_CCGR_OFFSET(10) |
454 3 << CCM_CCGR_OFFSET(9) |
455 3 << CCM_CCGR_OFFSET(8), base + 0x70);
456 writel_relaxed(3 << CCM_CCGR_OFFSET(14) |
457 1 << CCM_CCGR_OFFSET(13) |
458 3 << CCM_CCGR_OFFSET(12) |
459 1 << CCM_CCGR_OFFSET(11) |
460 3 << CCM_CCGR_OFFSET(10), base + 0x74);
461 writel_relaxed(3 << CCM_CCGR_OFFSET(7) |
462 3 << CCM_CCGR_OFFSET(6) |
463 3 << CCM_CCGR_OFFSET(4), base + 0x78);
464 writel_relaxed(1 << CCM_CCGR_OFFSET(0), base + 0x7c);
465 writel_relaxed(0, base + 0x80);
466
440 clk_data.clks = clk; 467 clk_data.clks = clk;
441 clk_data.clk_num = ARRAY_SIZE(clk); 468 clk_data.clk_num = ARRAY_SIZE(clk);
442 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 469 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
index 0b078c4fb8b3..7ff93fa2e84f 100644
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -22,6 +22,8 @@
22#define PFD3_CLK_GATE (1 << 31) 22#define PFD3_CLK_GATE (1 << 31)
23#define CCDR_CH0_HS_BYP 17 23#define CCDR_CH0_HS_BYP 17
24 24
25#define CCM_CCGR_OFFSET(index) (index * 2)
26
25#include <linux/clk.h> 27#include <linux/clk.h>
26#include <linux/clkdev.h> 28#include <linux/clkdev.h>
27#include <linux/err.h> 29#include <linux/err.h>
@@ -365,6 +367,25 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
365 pr_err("i.MX6SL clk %d: register failed with %ld\n", 367 pr_err("i.MX6SL clk %d: register failed with %ld\n",
366 i, PTR_ERR(clks[i])); 368 i, PTR_ERR(clks[i]));
367 369
370 /* Initialize clock gate status */
371 writel_relaxed(1 << CCM_CCGR_OFFSET(11) |
372 3 << CCM_CCGR_OFFSET(1) |
373 3 << CCM_CCGR_OFFSET(0), base + 0x68);
374 writel_relaxed(3 << CCM_CCGR_OFFSET(10), base + 0x6c);
375 writel_relaxed(1 << CCM_CCGR_OFFSET(11) |
376 3 << CCM_CCGR_OFFSET(10) |
377 3 << CCM_CCGR_OFFSET(9) |
378 3 << CCM_CCGR_OFFSET(8), base + 0x70);
379 writel_relaxed(3 << CCM_CCGR_OFFSET(14) |
380 3 << CCM_CCGR_OFFSET(13) |
381 3 << CCM_CCGR_OFFSET(12) |
382 3 << CCM_CCGR_OFFSET(11) |
383 3 << CCM_CCGR_OFFSET(10), base + 0x74);
384 writel_relaxed(3 << CCM_CCGR_OFFSET(7) |
385 3 << CCM_CCGR_OFFSET(4), base + 0x78);
386 writel_relaxed(1 << CCM_CCGR_OFFSET(0), base + 0x7c);
387 writel_relaxed(0, base + 0x80);
388
368 clk_data.clks = clks; 389 clk_data.clks = clks;
369 clk_data.clk_num = ARRAY_SIZE(clks); 390 clk_data.clk_num = ARRAY_SIZE(clks);
370 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 391 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);