aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Abraham <thomas.ab@samsung.com>2015-04-03 12:43:46 -0400
committerMichael Turquette <mturquette@baylibre.com>2015-06-20 15:17:42 -0400
commit6ae5a0b46fd82055ad5950539e1b36e4922c233f (patch)
treefc995776e720c81c2f42ad3099b69d11276f7499
parentddeac8d968d41d13a52582d6e80395a329e9b1ff (diff)
clk: samsung: exynos4: add cpu clock configuration data and instantiate cpu clock
With the addition of the new Samsung specific cpu-clock type, the arm clock can be represented as a cpu-clock type. Add the CPU clock configuration data and instantiate the CPU clock type for Exynos4210. Changes by Bartlomiej: - fixed issue with wrong dividers being setup by Common Clock Framework (by an addition of CLK_RECALC_NEW_RATES clock flag to mout_apll clock, without this change cpufreq-dt driver showed ~10 mA larger energy consumption when compared to cpufreq-exynos one when "performance" cpufreq governor was used on Exynos4210 SoC based Origen board), this was probably meant to be workarounded by use of CLK_GET_RATE_NOCACHE and CLK_DIVIDER_READ_ONLY clock flags in the original patchset (in "[PATCH v12 6/6] clk: samsung: remove unused clock aliases and update clock flags") but using these flags is not sufficient to fix the issue observed - removed Exynos5250 and Exynos5420 support for now Cc: Tomasz Figa <tomasz.figa@gmail.com> Cc: Mike Turquette <mturquette@linaro.org> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Thomas Abraham <thomas.ab@samsung.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Michael Turquette <mturquette@baylibre.com>
-rw-r--r--drivers/clk/samsung/clk-exynos4.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
index 714d6ba782c8..cae2c048488d 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -19,6 +19,7 @@
19#include <linux/syscore_ops.h> 19#include <linux/syscore_ops.h>
20 20
21#include "clk.h" 21#include "clk.h"
22#include "clk-cpu.h"
22 23
23/* Exynos4 clock controller register offsets */ 24/* Exynos4 clock controller register offsets */
24#define SRC_LEFTBUS 0x4200 25#define SRC_LEFTBUS 0x4200
@@ -534,7 +535,8 @@ static struct samsung_fixed_factor_clock exynos4x12_fixed_factor_clks[] __initda
534/* list of mux clocks supported in all exynos4 soc's */ 535/* list of mux clocks supported in all exynos4 soc's */
535static struct samsung_mux_clock exynos4_mux_clks[] __initdata = { 536static struct samsung_mux_clock exynos4_mux_clks[] __initdata = {
536 MUX_FA(CLK_MOUT_APLL, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, 537 MUX_FA(CLK_MOUT_APLL, "mout_apll", mout_apll_p, SRC_CPU, 0, 1,
537 CLK_SET_RATE_PARENT, 0, "mout_apll"), 538 CLK_SET_RATE_PARENT | CLK_RECALC_NEW_RATES, 0,
539 "mout_apll"),
538 MUX(CLK_MOUT_HDMI, "mout_hdmi", mout_hdmi_p, SRC_TV, 0, 1), 540 MUX(CLK_MOUT_HDMI, "mout_hdmi", mout_hdmi_p, SRC_TV, 0, 1),
539 MUX(0, "mout_mfc1", sclk_evpll_p, SRC_MFC, 4, 1), 541 MUX(0, "mout_mfc1", sclk_evpll_p, SRC_MFC, 4, 1),
540 MUX(0, "mout_mfc", mout_mfc_p, SRC_MFC, 8, 1), 542 MUX(0, "mout_mfc", mout_mfc_p, SRC_MFC, 8, 1),
@@ -1378,6 +1380,22 @@ static void __init exynos4x12_core_down_clock(void)
1378 __raw_writel(0x0, reg_base + E4X12_PWR_CTRL2); 1380 __raw_writel(0x0, reg_base + E4X12_PWR_CTRL2);
1379} 1381}
1380 1382
1383#define E4210_CPU_DIV0(apll, pclk_dbg, atb, periph, corem1, corem0) \
1384 (((apll) << 24) | ((pclk_dbg) << 20) | ((atb) << 16) | \
1385 ((periph) << 12) | ((corem1) << 8) | ((corem0) << 4))
1386#define E4210_CPU_DIV1(hpm, copy) \
1387 (((hpm) << 4) | ((copy) << 0))
1388
1389static const struct exynos_cpuclk_cfg_data e4210_armclk_d[] __initconst = {
1390 { 1200000, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 5), },
1391 { 1000000, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 4), },
1392 { 800000, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
1393 { 500000, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
1394 { 400000, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
1395 { 200000, E4210_CPU_DIV0(0, 1, 1, 1, 3, 1), E4210_CPU_DIV1(0, 3), },
1396 { 0 },
1397};
1398
1381/* register exynos4 clocks */ 1399/* register exynos4 clocks */
1382static void __init exynos4_clk_init(struct device_node *np, 1400static void __init exynos4_clk_init(struct device_node *np,
1383 enum exynos4_soc soc) 1401 enum exynos4_soc soc)
@@ -1455,6 +1473,10 @@ static void __init exynos4_clk_init(struct device_node *np,
1455 samsung_clk_register_fixed_factor(ctx, 1473 samsung_clk_register_fixed_factor(ctx,
1456 exynos4210_fixed_factor_clks, 1474 exynos4210_fixed_factor_clks,
1457 ARRAY_SIZE(exynos4210_fixed_factor_clks)); 1475 ARRAY_SIZE(exynos4210_fixed_factor_clks));
1476 exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk",
1477 mout_core_p4210[0], mout_core_p4210[1], 0x14200,
1478 e4210_armclk_d, ARRAY_SIZE(e4210_armclk_d),
1479 CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1);
1458 } else { 1480 } else {
1459 samsung_clk_register_mux(ctx, exynos4x12_mux_clks, 1481 samsung_clk_register_mux(ctx, exynos4x12_mux_clks,
1460 ARRAY_SIZE(exynos4x12_mux_clks)); 1482 ARRAY_SIZE(exynos4x12_mux_clks));