aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-07-18 10:36:33 -0400
committerTomasz Figa <t.figa@samsung.com>2014-07-25 20:49:34 -0400
commit45c5b0a69016b68142d93f7609000c8efd51fdde (patch)
tree26075f3d2e8003ae02c23c0d583f5f57f2f02b32 /drivers/clk
parent42773b28e71d06daeceba106ea12c8be2e48011f (diff)
clk: samsung: exynos3250: Enable ARMCLK down feature
Enable ARMCLK down feature on Exynos3250 SoC. The frequency of ARMCLK will be reduced upon entering idle mode (WFI or WFE). The feature behaves like very fast cpufreq ondemand governor. The patch uses simillar settings as Exynos5250 (clk-exynos5250.c), except it disables clock up feature. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/samsung/clk-exynos3250.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/clk/samsung/clk-exynos3250.c b/drivers/clk/samsung/clk-exynos3250.c
index 9a43cc3e7401..dc85f8e7a2d7 100644
--- a/drivers/clk/samsung/clk-exynos3250.c
+++ b/drivers/clk/samsung/clk-exynos3250.c
@@ -87,6 +87,22 @@
87#define SRC_CPU 0x14200 87#define SRC_CPU 0x14200
88#define DIV_CPU0 0x14500 88#define DIV_CPU0 0x14500
89#define DIV_CPU1 0x14504 89#define DIV_CPU1 0x14504
90#define PWR_CTRL1 0x15020
91#define PWR_CTRL2 0x15024
92
93/* Below definitions are used for PWR_CTRL settings */
94#define PWR_CTRL1_CORE2_DOWN_RATIO(x) (((x) & 0x7) << 28)
95#define PWR_CTRL1_CORE1_DOWN_RATIO(x) (((x) & 0x7) << 16)
96#define PWR_CTRL1_DIV2_DOWN_EN (1 << 9)
97#define PWR_CTRL1_DIV1_DOWN_EN (1 << 8)
98#define PWR_CTRL1_USE_CORE3_WFE (1 << 7)
99#define PWR_CTRL1_USE_CORE2_WFE (1 << 6)
100#define PWR_CTRL1_USE_CORE1_WFE (1 << 5)
101#define PWR_CTRL1_USE_CORE0_WFE (1 << 4)
102#define PWR_CTRL1_USE_CORE3_WFI (1 << 3)
103#define PWR_CTRL1_USE_CORE2_WFI (1 << 2)
104#define PWR_CTRL1_USE_CORE1_WFI (1 << 1)
105#define PWR_CTRL1_USE_CORE0_WFI (1 << 0)
90 106
91/* list of PLLs to be registered */ 107/* list of PLLs to be registered */
92enum exynos3250_plls { 108enum exynos3250_plls {
@@ -168,6 +184,8 @@ static unsigned long exynos3250_cmu_clk_regs[] __initdata = {
168 SRC_CPU, 184 SRC_CPU,
169 DIV_CPU0, 185 DIV_CPU0,
170 DIV_CPU1, 186 DIV_CPU1,
187 PWR_CTRL1,
188 PWR_CTRL2,
171}; 189};
172 190
173static int exynos3250_clk_suspend(void) 191static int exynos3250_clk_suspend(void)
@@ -748,6 +766,27 @@ static struct samsung_pll_clock exynos3250_plls[nr_plls] __initdata = {
748 UPLL_LOCK, UPLL_CON0, NULL), 766 UPLL_LOCK, UPLL_CON0, NULL),
749}; 767};
750 768
769static void __init exynos3_core_down_clock(void)
770{
771 unsigned int tmp;
772
773 /*
774 * Enable arm clock down (in idle) and set arm divider
775 * ratios in WFI/WFE state.
776 */
777 tmp = (PWR_CTRL1_CORE2_DOWN_RATIO(7) | PWR_CTRL1_CORE1_DOWN_RATIO(7) |
778 PWR_CTRL1_DIV2_DOWN_EN | PWR_CTRL1_DIV1_DOWN_EN |
779 PWR_CTRL1_USE_CORE1_WFE | PWR_CTRL1_USE_CORE0_WFE |
780 PWR_CTRL1_USE_CORE1_WFI | PWR_CTRL1_USE_CORE0_WFI);
781 __raw_writel(tmp, reg_base + PWR_CTRL1);
782
783 /*
784 * Disable the clock up feature on Exynos4x12, in case it was
785 * enabled by bootloader.
786 */
787 __raw_writel(0x0, reg_base + PWR_CTRL2);
788}
789
751static void __init exynos3250_cmu_init(struct device_node *np) 790static void __init exynos3250_cmu_init(struct device_node *np)
752{ 791{
753 struct samsung_clk_provider *ctx; 792 struct samsung_clk_provider *ctx;
@@ -775,6 +814,8 @@ static void __init exynos3250_cmu_init(struct device_node *np)
775 samsung_clk_register_div(ctx, div_clks, ARRAY_SIZE(div_clks)); 814 samsung_clk_register_div(ctx, div_clks, ARRAY_SIZE(div_clks));
776 samsung_clk_register_gate(ctx, gate_clks, ARRAY_SIZE(gate_clks)); 815 samsung_clk_register_gate(ctx, gate_clks, ARRAY_SIZE(gate_clks));
777 816
817 exynos3_core_down_clock();
818
778 exynos3250_clk_sleep_init(); 819 exynos3250_clk_sleep_init();
779 820
780 samsung_clk_of_add_provider(np, ctx); 821 samsung_clk_of_add_provider(np, ctx);