Re: [PATCH v8 2/6] clk: samsung: add cpu clock configuration data and instantiate cpu clock

2014-07-29 Thread Tomasz Figa
Hi Thomas,

Just few minor comments for things I probably missed before.

On 29.07.2014 07:28, Thomas Abraham wrote:

[snip]

 @@ -1356,6 +1357,16 @@ static struct samsung_pll_clock 
 exynos4x12_plls[nr_plls] __initdata = {
   VPLL_LOCK, VPLL_CON0, NULL),
  };
  
 +static const struct exynos_cpuclk_cfg_data e4210_armclk_d[] __initconst = {
 + { 120, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 5), },
 + { 100, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 4), },
 + {  80, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
 + {  50, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
 + {  40, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },

I have noticed that the old driver does not have this operating point.
While it is probably OK to add this one and even few more for all
possible APLL settings, I am interested in how you obtained the values
for DIV0 and DIV1 registers for this configuration.

 + {  20, E4210_CPU_DIV0(0, 1, 1, 1, 3, 1), E4210_CPU_DIV1(0, 3), },
 + {  0 },
 +};

[snip]

 diff --git a/include/dt-bindings/clock/exynos5250.h 
 b/include/dt-bindings/clock/exynos5250.h
 index 4273891..855d809 100644
 --- a/include/dt-bindings/clock/exynos5250.h
 +++ b/include/dt-bindings/clock/exynos5250.h
 @@ -21,6 +21,7 @@
  #define CLK_FOUT_CPLL6
  #define CLK_FOUT_EPLL7
  #define CLK_FOUT_VPLL8
 +#define CLK_ARM_CLK  12

Why 12 not 9?

Best regards,
Tomasz
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v8 2/6] clk: samsung: add cpu clock configuration data and instantiate cpu clock

2014-07-29 Thread Thomas Abraham
Hi Tomasz,

On Tue, Jul 29, 2014 at 3:43 PM, Tomasz Figa tomasz.f...@gmail.com wrote:
 Hi Thomas,

 Just few minor comments for things I probably missed before.

 On 29.07.2014 07:28, Thomas Abraham wrote:

 [snip]

 @@ -1356,6 +1357,16 @@ static struct samsung_pll_clock 
 exynos4x12_plls[nr_plls] __initdata = {
   VPLL_LOCK, VPLL_CON0, NULL),
  };

 +static const struct exynos_cpuclk_cfg_data e4210_armclk_d[] __initconst = {
 + { 120, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 5), },
 + { 100, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 4), },
 + {  80, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
 + {  50, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
 + {  40, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },

 I have noticed that the old driver does not have this operating point.
 While it is probably OK to add this one and even few more for all
 possible APLL settings, I am interested in how you obtained the values
 for DIV0 and DIV1 registers for this configuration.

I found these values from an old internal repo. So far no trouble seen
with these values in all the testing.


 + {  20, E4210_CPU_DIV0(0, 1, 1, 1, 3, 1), E4210_CPU_DIV1(0, 3), },
 + {  0 },
 +};

 [snip]

 diff --git a/include/dt-bindings/clock/exynos5250.h 
 b/include/dt-bindings/clock/exynos5250.h
 index 4273891..855d809 100644
 --- a/include/dt-bindings/clock/exynos5250.h
 +++ b/include/dt-bindings/clock/exynos5250.h
 @@ -21,6 +21,7 @@
  #define CLK_FOUT_CPLL6
  #define CLK_FOUT_EPLL7
  #define CLK_FOUT_VPLL8
 +#define CLK_ARM_CLK  12

 Why 12 not 9?

Exynos4 uses 12 and so just wanted to keep it same for Exynos5250 as well.

Thanks,
Thomas.


 Best regards,
 Tomasz
 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v8 2/6] clk: samsung: add cpu clock configuration data and instantiate cpu clock

2014-07-29 Thread Tomasz Figa
On 29.07.2014 13:46, Thomas Abraham wrote:
 Hi Tomasz,
 
 On Tue, Jul 29, 2014 at 3:43 PM, Tomasz Figa tomasz.f...@gmail.com wrote:
 Hi Thomas,

 Just few minor comments for things I probably missed before.

 On 29.07.2014 07:28, Thomas Abraham wrote:

 [snip]

 @@ -1356,6 +1357,16 @@ static struct samsung_pll_clock 
 exynos4x12_plls[nr_plls] __initdata = {
   VPLL_LOCK, VPLL_CON0, NULL),
  };

 +static const struct exynos_cpuclk_cfg_data e4210_armclk_d[] __initconst = {
 + { 120, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 5), },
 + { 100, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 4), },
 + {  80, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
 + {  50, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
 + {  40, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },

 I have noticed that the old driver does not have this operating point.
 While it is probably OK to add this one and even few more for all
 possible APLL settings, I am interested in how you obtained the values
 for DIV0 and DIV1 registers for this configuration.
 
 I found these values from an old internal repo. So far no trouble seen
 with these values in all the testing.

OK.

 

 + {  20, E4210_CPU_DIV0(0, 1, 1, 1, 3, 1), E4210_CPU_DIV1(0, 3), },
 + {  0 },
 +};

 [snip]

 diff --git a/include/dt-bindings/clock/exynos5250.h 
 b/include/dt-bindings/clock/exynos5250.h
 index 4273891..855d809 100644
 --- a/include/dt-bindings/clock/exynos5250.h
 +++ b/include/dt-bindings/clock/exynos5250.h
 @@ -21,6 +21,7 @@
  #define CLK_FOUT_CPLL6
  #define CLK_FOUT_EPLL7
  #define CLK_FOUT_VPLL8
 +#define CLK_ARM_CLK  12

 Why 12 not 9?
 
 Exynos4 uses 12 and so just wanted to keep it same for Exynos5250 as well.

There is no need to align those numbers between different bindings,
because preprocessor macros are used anyway and leaving holes between
clocks only makes the namespace harder to maintain.

Best regards,
Tomasz
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v8 2/6] clk: samsung: add cpu clock configuration data and instantiate cpu clock

2014-07-29 Thread Thomas Abraham
On Tue, Jul 29, 2014 at 5:34 PM, Tomasz Figa tomasz.f...@gmail.com wrote:
 On 29.07.2014 13:46, Thomas Abraham wrote:
 Hi Tomasz,

 On Tue, Jul 29, 2014 at 3:43 PM, Tomasz Figa tomasz.f...@gmail.com wrote:
 Hi Thomas,

 Just few minor comments for things I probably missed before.

 On 29.07.2014 07:28, Thomas Abraham wrote:

 [snip]

 @@ -1356,6 +1357,16 @@ static struct samsung_pll_clock 
 exynos4x12_plls[nr_plls] __initdata = {
   VPLL_LOCK, VPLL_CON0, NULL),
  };

 +static const struct exynos_cpuclk_cfg_data e4210_armclk_d[] __initconst = 
 {
 + { 120, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 5), },
 + { 100, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 4), },
 + {  80, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
 + {  50, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
 + {  40, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },

 I have noticed that the old driver does not have this operating point.
 While it is probably OK to add this one and even few more for all
 possible APLL settings, I am interested in how you obtained the values
 for DIV0 and DIV1 registers for this configuration.

 I found these values from an old internal repo. So far no trouble seen
 with these values in all the testing.

 OK.



 + {  20, E4210_CPU_DIV0(0, 1, 1, 1, 3, 1), E4210_CPU_DIV1(0, 3), },
 + {  0 },
 +};

 [snip]

 diff --git a/include/dt-bindings/clock/exynos5250.h 
 b/include/dt-bindings/clock/exynos5250.h
 index 4273891..855d809 100644
 --- a/include/dt-bindings/clock/exynos5250.h
 +++ b/include/dt-bindings/clock/exynos5250.h
 @@ -21,6 +21,7 @@
  #define CLK_FOUT_CPLL6
  #define CLK_FOUT_EPLL7
  #define CLK_FOUT_VPLL8
 +#define CLK_ARM_CLK  12

 Why 12 not 9?

 Exynos4 uses 12 and so just wanted to keep it same for Exynos5250 as well.

 There is no need to align those numbers between different bindings,
 because preprocessor macros are used anyway and leaving holes between
 clocks only makes the namespace harder to maintain.

Ok. I will fix this.

Thanks,
Thomas.


 Best regards,
 Tomasz
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v8 2/6] clk: samsung: add cpu clock configuration data and instantiate cpu clock

2014-07-28 Thread Thomas Abraham
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,
Exynos5250 and Exynos5420.

Cc: Tomasz Figa t.f...@samsung.com
Signed-off-by: Thomas Abraham thomas...@samsung.com
---
 drivers/clk/samsung/clk-exynos4.c  |   15 +++
 drivers/clk/samsung/clk-exynos5250.c   |   25 ++
 drivers/clk/samsung/clk-exynos5420.c   |   45 
 include/dt-bindings/clock/exynos5250.h |1 +
 include/dt-bindings/clock/exynos5420.h |2 ++
 5 files changed, 88 insertions(+)

diff --git a/drivers/clk/samsung/clk-exynos4.c 
b/drivers/clk/samsung/clk-exynos4.c
index ac163d7..5388806 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -19,6 +19,7 @@
 #include linux/syscore_ops.h
 
 #include clk.h
+#include clk-cpu.h
 
 /* Exynos4 clock controller register offsets */
 #define SRC_LEFTBUS0x4200
@@ -1356,6 +1357,16 @@ static struct samsung_pll_clock exynos4x12_plls[nr_plls] 
__initdata = {
VPLL_LOCK, VPLL_CON0, NULL),
 };
 
+static const struct exynos_cpuclk_cfg_data e4210_armclk_d[] __initconst = {
+   { 120, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 5), },
+   { 100, E4210_CPU_DIV0(7, 1, 4, 3, 7, 3), E4210_CPU_DIV1(0, 4), },
+   {  80, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
+   {  50, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
+   {  40, E4210_CPU_DIV0(7, 1, 3, 3, 7, 3), E4210_CPU_DIV1(0, 3), },
+   {  20, E4210_CPU_DIV0(0, 1, 1, 1, 3, 1), E4210_CPU_DIV1(0, 3), },
+   {  0 },
+};
+
 static void __init exynos4_core_down_clock(enum exynos4_soc soc)
 {
unsigned int tmp;
@@ -1459,6 +1470,10 @@ static void __init exynos4_clk_init(struct device_node 
*np,
samsung_clk_register_fixed_factor(ctx,
exynos4210_fixed_factor_clks,
ARRAY_SIZE(exynos4210_fixed_factor_clks));
+   exynos_register_cpu_clock(ctx, CLK_ARM_CLK, armclk,
+   mout_core_p4210[0], mout_core_p4210[1], 0x14200,
+   e4210_armclk_d, ARRAY_SIZE(e4210_armclk_d),
+   CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1);
} else {
samsung_clk_register_mux(ctx, exynos4x12_mux_clks,
ARRAY_SIZE(exynos4x12_mux_clks));
diff --git a/drivers/clk/samsung/clk-exynos5250.c 
b/drivers/clk/samsung/clk-exynos5250.c
index 70ec3d2..e19e365 100644
--- a/drivers/clk/samsung/clk-exynos5250.c
+++ b/drivers/clk/samsung/clk-exynos5250.c
@@ -19,6 +19,7 @@
 #include linux/syscore_ops.h
 
 #include clk.h
+#include clk-cpu.h
 
 #define APLL_LOCK  0x0
 #define APLL_CON0  0x100
@@ -748,6 +749,26 @@ static struct samsung_pll_clock exynos5250_plls[nr_plls] 
__initdata = {
VPLL_LOCK, VPLL_CON0, NULL),
 };
 
+static const struct exynos_cpuclk_cfg_data exynos5250_armclk_d[] __initconst = 
{
+   { 170, E5250_CPU_DIV0(5, 3, 7, 7, 7, 3), E5250_CPU_DIV1(2, 0), },
+   { 160, E5250_CPU_DIV0(4, 1, 7, 7, 7, 3), E5250_CPU_DIV1(2, 0), },
+   { 150, E5250_CPU_DIV0(4, 1, 7, 7, 7, 2), E5250_CPU_DIV1(2, 0), },
+   { 140, E5250_CPU_DIV0(4, 1, 6, 7, 7, 2), E5250_CPU_DIV1(2, 0), },
+   { 130, E5250_CPU_DIV0(3, 1, 6, 7, 7, 2), E5250_CPU_DIV1(2, 0), },
+   { 120, E5250_CPU_DIV0(3, 1, 5, 7, 7, 2), E5250_CPU_DIV1(2, 0), },
+   { 110, E5250_CPU_DIV0(3, 1, 5, 7, 7, 3), E5250_CPU_DIV1(2, 0), },
+   { 100, E5250_CPU_DIV0(2, 1, 4, 7, 7, 1), E5250_CPU_DIV1(2, 0), },
+   {  90, E5250_CPU_DIV0(2, 1, 4, 7, 7, 1), E5250_CPU_DIV1(2, 0), },
+   {  80, E5250_CPU_DIV0(2, 1, 4, 7, 7, 1), E5250_CPU_DIV1(2, 0), },
+   {  70, E5250_CPU_DIV0(1, 1, 3, 7, 7, 1), E5250_CPU_DIV1(2, 0), },
+   {  60, E5250_CPU_DIV0(1, 1, 3, 7, 7, 1), E5250_CPU_DIV1(2, 0), },
+   {  50, E5250_CPU_DIV0(1, 1, 2, 7, 7, 1), E5250_CPU_DIV1(2, 0), },
+   {  40, E5250_CPU_DIV0(1, 1, 2, 7, 7, 1), E5250_CPU_DIV1(2, 0), },
+   {  30, E5250_CPU_DIV0(1, 1, 1, 7, 7, 1), E5250_CPU_DIV1(2, 0), },
+   {  20, E5250_CPU_DIV0(1, 1, 1, 7, 7, 1), E5250_CPU_DIV1(2, 0), },
+   {  0 },
+};
+
 static const struct of_device_id ext_clk_match[] __initconst = {
{ .compatible = samsung,clock-xxti, .data = (void *)0, },
{ },
@@ -797,6 +818,10 @@ static void __init exynos5250_clk_init(struct device_node 
*np)
ARRAY_SIZE(exynos5250_div_clks));
samsung_clk_register_gate(ctx, exynos5250_gate_clks,
ARRAY_SIZE(exynos5250_gate_clks));
+   exynos_register_cpu_clock(ctx, CLK_ARM_CLK, armclk,
+   mout_cpu_p[0], mout_cpu_p[1], 0x200,
+   exynos5250_armclk_d,