Linux Samsung SOC development
 help / color / mirror / Atom feed
* [PATCH 1/3] clk: exynos5410: Add the definitions of new clock registers
@ 2014-07-30 14:36 Humberto Silva Naves
  2014-07-30 14:36 ` [PATCH 2/3] clk: exynos5410: Add suspend/resume handling Humberto Silva Naves
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Humberto Silva Naves @ 2014-07-30 14:36 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: Tomasz Figa, Humberto Silva Naves

Added clock register definitions for the majority of the relevant
clocks inside the SoC, including the definitions of all PLL's clocks.
The definitions are now ordered by name, in order to make the
driver more readable and reduce the chances of potential conflicts
when adding new entries. The different register groups (SRC, DIV, PLL,
GATE, etc) are separated by a blank line.

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
---
 drivers/clk/samsung/clk-exynos5410.c |  144 ++++++++++++++++++++++++++++------
 1 file changed, 122 insertions(+), 22 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5410.c b/drivers/clk/samsung/clk-exynos5410.c
index 231475b..72a533e 100644
--- a/drivers/clk/samsung/clk-exynos5410.c
+++ b/drivers/clk/samsung/clk-exynos5410.c
@@ -19,39 +19,139 @@
 
 #include "clk.h"
 
-#define APLL_LOCK               0x0
-#define APLL_CON0               0x100
-#define CPLL_LOCK               0x10020
-#define CPLL_CON0               0x10120
-#define MPLL_LOCK               0x4000
-#define MPLL_CON0               0x4100
-#define BPLL_LOCK               0x20010
-#define BPLL_CON0               0x20110
-#define KPLL_LOCK               0x28000
-#define KPLL_CON0               0x28100
+#define APLL_CON0		0x100
+#define APLL_LOCK		0x0
+#define BPLL_CON0		0x20110
+#define BPLL_LOCK		0x20010
+#define CPLL_CON0		0x10120
+#define CPLL_CON1		0x10124
+#define CPLL_LOCK		0x10020
+#define DPLL_CON0		0x10128
+#define DPLL_CON1		0x1012C
+#define DPLL_LOCK		0x10030
+#define EPLL_CON0		0x10130
+#define EPLL_CON1		0x10134
+#define EPLL_CON2		0x10138
+#define EPLL_LOCK		0x10040
+#define IPLL_CON0		0x10150
+#define IPLL_CON1		0x10154
+#define IPLL_LOCK		0x10060
+#define KPLL_CON0		0x28100
+#define KPLL_LOCK		0x28000
+#define MPLL_CON0		0x4100
+#define MPLL_LOCK		0x4000
+#define VPLL_CON0		0x10140
+#define VPLL_CON1		0x10144
+#define VPLL_CON2		0x10148
+#define VPLL_LOCK		0x10050
 
-#define SRC_CPU			0x200
-#define DIV_CPU0		0x500
+#define SRC_CDREX		0x20200
+#define SRC_CPERI0		0x4200
 #define SRC_CPERI1		0x4204
-#define DIV_TOP0		0x10510
-#define DIV_TOP1		0x10514
-#define DIV_FSYS1		0x1054c
-#define DIV_FSYS2		0x10550
-#define DIV_PERIC0		0x10558
+#define SRC_CPU			0x200
+#define SRC_DISP0_0		0x10224
+#define SRC_DISP0_1		0x10228
+#define SRC_DISP1_0		0x1022C
+#define SRC_DISP1_1		0x10230
+#define SRC_FSYS		0x10244
+#define SRC_GSCL		0x10220
+#define SRC_KFC			0x28200
+#define SRC_MAU			0x10240
+#define SRC_PERIC0		0x10250
+#define SRC_PERIC1		0x10254
 #define SRC_TOP0		0x10210
 #define SRC_TOP1		0x10214
 #define SRC_TOP2		0x10218
-#define SRC_FSYS		0x10244
-#define SRC_PERIC0		0x10250
+#define SRC_TOP3		0x1021C
+
+#define SRC_MASK_DISP0_0	0x10324
+#define SRC_MASK_DISP0_1	0x10328
+#define SRC_MASK_DISP1_0	0x1032C
+#define SRC_MASK_DISP1_1	0x10330
 #define SRC_MASK_FSYS		0x10340
+#define SRC_MASK_GEN		0x10344
+#define SRC_MASK_GSCL		0x10320
+#define SRC_MASK_MAU		0x10334
 #define SRC_MASK_PERIC0		0x10350
+#define SRC_MASK_PERIC1		0x10354
+#define SRC_MASK_TOP		0x10310
+
+#define DIV_CDREX		0x20500
+#define DIV_CDREX2		0x20504
+#define DIV_CPERI0		0x4500
+#define DIV_CPERI1		0x4504
+#define DIV_CPU0		0x500
+#define DIV_CPU1		0x504
+#define DIV_DISP0_0		0x10524
+#define DIV_DISP0_1		0x10528
+#define DIV_DISP1_0		0x1052C
+#define DIV_DISP1_1		0x10530
+#define DIV_FSYS0		0x10548
+#define DIV_FSYS1		0x1054C
+#define DIV_FSYS2		0x10550
+#define DIV_FSYS3		0x10554
+#define DIV_GEN			0x1053C
+#define DIV_GSCL		0x10520
+#define DIV_G2D			0x8500
+#define DIV_ISP0		0x0C300
+#define DIV_ISP1		0x0C304
+#define DIV_ISP2		0x0C308
+#define DIV_KFC0		0x28500
+#define DIV_MAU			0x10544
+#define DIV_PERIC0		0x10558
+#define DIV_PERIC1		0x1055C
+#define DIV_PERIC2		0x10560
+#define DIV_PERIC3		0x10564
+#define DIV_PERIC4		0x10568
+#define DIV_PERIC5		0x1056C
+#define DIV_TOP0		0x10510
+#define DIV_TOP1		0x10514
+#define DIV_TOP2		0x10518
+#define DIV_TOP3		0x1051C
+#define DIV2_RATIO0		0x10590
+#define DIV2_RATIO1		0x10594
+
+#define GATE_BUS_CDREX		0x20700
+#define GATE_BUS_CPU		0x700
+#define GATE_BUS_DISP0		0x10724
+#define GATE_BUS_DISP1		0x10728
 #define GATE_BUS_FSYS0		0x10740
+#define GATE_BUS_FSYS1		0x10744
+#define GATE_BUS_GEN		0x1073C
+#define GATE_BUS_GSCL0		0x10710
+#define GATE_BUS_GSCL1		0x10720
+#define GATE_BUS_G3D		0x10738
+#define GATE_BUS_MFC		0x10734
+
+#define GATE_IP_CDREX		0x20900
+#define GATE_IP_CORE		0x4900
+#define GATE_IP_DISP0		0x10924
+#define GATE_IP_DISP1		0x10928
 #define GATE_IP_FSYS		0x10944
+#define GATE_IP_GEN		0x10934
+#define GATE_IP_GSCL0		0x10910
+#define GATE_IP_GSCL1		0x10920
+#define GATE_IP_G2D		0x8800
+#define GATE_IP_G3D		0x10930
+#define GATE_IP_ISP0		0x0C800
+#define GATE_IP_ISP1		0x0C804
+#define GATE_IP_MFC		0x1092C
 #define GATE_IP_PERIC		0x10950
 #define GATE_IP_PERIS		0x10960
-#define SRC_CDREX		0x20200
-#define SRC_KFC			0x28200
-#define DIV_KFC0		0x28500
+
+#define GATE_TOP_SCLK_DISP0	0x10824
+#define GATE_TOP_SCLK_DISP1	0x10828
+#define GATE_TOP_SCLK_FSYS	0x10840
+#define GATE_TOP_SCLK_GEN	0x1082C
+#define GATE_TOP_SCLK_GSCL	0x10820
+#define GATE_TOP_SCLK_MAU	0x1083C
+#define GATE_TOP_SCLK_PERIC	0x10850
+
+#define GATE_SCLK_CPU		0x800
+#define SCLK_DIV_ISP		0x10580
+#define SCLK_DIV_ISP1		0x10584
+#define SCLK_SRC_ISP		0x10270
+
 
 /* list of PLLs */
 enum exynos5410_plls {
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] clk: exynos5410: Add suspend/resume handling
  2014-07-30 14:36 [PATCH 1/3] clk: exynos5410: Add the definitions of new clock registers Humberto Silva Naves
@ 2014-07-30 14:36 ` Humberto Silva Naves
  2014-07-31  6:04   ` Thomas Abraham
  2014-07-30 14:36 ` [PATCH 3/3] clk: exynos5410: Added clocks BPLL, DPLL, EPLL, IPLL, MPLL, and VPLL Humberto Silva Naves
  2014-07-31  6:04 ` [PATCH 1/3] clk: exynos5410: Add the definitions of new clock registers Thomas Abraham
  2 siblings, 1 reply; 6+ messages in thread
From: Humberto Silva Naves @ 2014-07-30 14:36 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: Tomasz Figa, Humberto Silva Naves

This patch implements all the necessary code that handles register
saving and restoring during a suspend/resume cycle.

To make this possible, the local variable reg_base from the function
exynos5410_clk_init was changed to global.

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
---
 drivers/clk/samsung/clk-exynos5410.c |  132 +++++++++++++++++++++++++++++++++-
 1 file changed, 131 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/samsung/clk-exynos5410.c b/drivers/clk/samsung/clk-exynos5410.c
index 72a533e..aaca65d 100644
--- a/drivers/clk/samsung/clk-exynos5410.c
+++ b/drivers/clk/samsung/clk-exynos5410.c
@@ -16,6 +16,7 @@
 #include <linux/clk-provider.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/syscore_ops.h>
 
 #include "clk.h"
 
@@ -160,6 +161,134 @@ enum exynos5410_plls {
 	nr_plls                 /* number of PLLs */
 };
 
+static void __iomem *reg_base;
+
+#ifdef CONFIG_PM_SLEEP
+static struct samsung_clk_reg_dump *exynos5410_save;
+
+/*
+ * list of controller registers to be saved and restored during a
+ * suspend/resume cycle.
+ */
+static unsigned long exynos5410_clk_regs[] __initdata = {
+	SRC_CDREX,
+	SRC_CPERI0,
+	SRC_CPERI1,
+	SRC_CPU,
+	SRC_DISP0_0,
+	SRC_DISP0_1,
+	SRC_DISP1_0,
+	SRC_DISP1_1,
+	SRC_FSYS,
+	SRC_GSCL,
+	SRC_KFC,
+	SRC_MAU,
+	SRC_PERIC0,
+	SRC_PERIC1,
+	SRC_TOP0,
+	SRC_TOP1,
+	SRC_TOP2,
+	SRC_TOP3,
+
+	DIV_CDREX,
+	DIV_CDREX2,
+	DIV_CPU0,
+	DIV_CPERI1,
+	DIV_DISP0_0,
+	DIV_DISP0_1,
+	DIV_DISP1_0,
+	DIV_DISP1_1,
+	DIV_FSYS0,
+	DIV_FSYS1,
+	DIV_FSYS2,
+	DIV_GEN,
+	DIV_GSCL,
+	DIV_G2D,
+	DIV_KFC0,
+	DIV_MAU,
+	DIV_PERIC0,
+	DIV_PERIC1,
+	DIV_PERIC2,
+	DIV_PERIC3,
+	DIV_PERIC4,
+	DIV_PERIC5,
+	DIV_TOP0,
+	DIV_TOP1,
+	DIV_TOP2,
+	DIV_TOP3,
+
+	GATE_BUS_DISP1,
+	GATE_BUS_FSYS0,
+
+	GATE_IP_CDREX,
+	GATE_IP_CORE,
+	GATE_IP_DISP0,
+	GATE_IP_DISP1,
+	GATE_IP_FSYS,
+	GATE_IP_GEN,
+	GATE_IP_GSCL0,
+	GATE_IP_GSCL1,
+	GATE_IP_G2D,
+	GATE_IP_G3D,
+	GATE_IP_MFC,
+	GATE_IP_PERIC,
+	GATE_IP_PERIS,
+
+	GATE_TOP_SCLK_DISP1,
+	GATE_TOP_SCLK_FSYS,
+	GATE_TOP_SCLK_GSCL,
+	GATE_TOP_SCLK_MAU,
+	GATE_TOP_SCLK_PERIC,
+
+	GATE_BUS_DISP1,
+	GATE_BUS_FSYS0,
+
+	GATE_SCLK_CPU,
+
+	SRC_MASK_DISP0_0,
+	SRC_MASK_DISP1_0,
+	SRC_MASK_FSYS,
+	SRC_MASK_MAU,
+	SRC_MASK_PERIC0,
+	SRC_MASK_PERIC1,
+};
+
+static int exynos5410_clk_suspend(void)
+{
+	samsung_clk_save(reg_base, exynos5410_save,
+				ARRAY_SIZE(exynos5410_clk_regs));
+
+	return 0;
+}
+
+static void exynos5410_clk_resume(void)
+{
+	samsung_clk_restore(reg_base, exynos5410_save,
+				ARRAY_SIZE(exynos5410_clk_regs));
+}
+
+static struct syscore_ops exynos5410_clk_syscore_ops = {
+	.suspend = exynos5410_clk_suspend,
+	.resume = exynos5410_clk_resume,
+};
+
+static void exynos5410_clk_sleep_init(void)
+{
+	exynos5410_save = samsung_clk_alloc_reg_dump(exynos5410_clk_regs,
+					ARRAY_SIZE(exynos5410_clk_regs));
+	if (!exynos5410_save) {
+		pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
+			__func__);
+		return;
+	}
+
+	register_syscore_ops(&exynos5410_clk_syscore_ops);
+}
+#else
+static void exynos5410_clk_sleep_init(void) {}
+#endif
+
+
 /* list of all parent clocks */
 PNAME(apll_p)		= { "fin_pll", "fout_apll", };
 PNAME(bpll_p)		= { "fin_pll", "fout_bpll", };
@@ -286,7 +415,6 @@ static struct samsung_pll_clock exynos5410_plls[nr_plls] __initdata = {
 static void __init exynos5410_clk_init(struct device_node *np)
 {
 	struct samsung_clk_provider *ctx;
-	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
 	if (!reg_base)
@@ -304,6 +432,8 @@ static void __init exynos5410_clk_init(struct device_node *np)
 	samsung_clk_register_gate(ctx, exynos5410_gate_clks,
 			ARRAY_SIZE(exynos5410_gate_clks));
 
+	exynos5410_clk_sleep_init();
+
 	samsung_clk_of_add_provider(np, ctx);
 
 	pr_debug("Exynos5410: clock setup completed.\n");
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] clk: exynos5410: Added clocks BPLL, DPLL, EPLL, IPLL, MPLL, and VPLL
  2014-07-30 14:36 [PATCH 1/3] clk: exynos5410: Add the definitions of new clock registers Humberto Silva Naves
  2014-07-30 14:36 ` [PATCH 2/3] clk: exynos5410: Add suspend/resume handling Humberto Silva Naves
@ 2014-07-30 14:36 ` Humberto Silva Naves
  2014-07-31  6:19   ` Thomas Abraham
  2014-07-31  6:04 ` [PATCH 1/3] clk: exynos5410: Add the definitions of new clock registers Thomas Abraham
  2 siblings, 1 reply; 6+ messages in thread
From: Humberto Silva Naves @ 2014-07-30 14:36 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: Tomasz Figa, Humberto Silva Naves

Added the remaining PLL clocks, and also registered the configuration
tables with the PLL coefficients for the supported frequencies.
These frequency tables are valid when a 24MHz clock is supplied as the
input clock source (which I believe is always the case). Furthermore,
the corresponding constants for these PLL clocks were addded to the
dt-bindings header file. While at it, the constant definitions were
reordered alphabetically.

Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
---
 drivers/clk/samsung/clk-exynos5410.c   |  128 +++++++++++++++++++++++++++++---
 include/dt-bindings/clock/exynos5410.h |   12 ++-
 2 files changed, 127 insertions(+), 13 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5410.c b/drivers/clk/samsung/clk-exynos5410.c
index aaca65d..7f4b3ea 100644
--- a/drivers/clk/samsung/clk-exynos5410.c
+++ b/drivers/clk/samsung/clk-exynos5410.c
@@ -156,9 +156,10 @@
 
 /* list of PLLs */
 enum exynos5410_plls {
-	apll, cpll, mpll,
-	bpll, kpll,
-	nr_plls                 /* number of PLLs */
+	apll, bpll, cpll,
+	dpll, epll, ipll,
+	kpll, mpll, vpll,
+	nr_plls			/* number of PLLs */
 };
 
 static void __iomem *reg_base;
@@ -398,17 +399,126 @@ static struct samsung_gate_clock exynos5410_gate_clks[] __initdata = {
 			SRC_MASK_PERIC0, 8, CLK_SET_RATE_PARENT, 0),
 };
 
+static struct samsung_pll_rate_table apll_24mhz_tbl[] __initdata = {
+	/* sorted in descending order */
+	/* PLL_35XX_RATE(rate, m, p, s) */
+	PLL_35XX_RATE(2100000000, 175, 2, 0),
+	PLL_35XX_RATE(2000000000, 250, 3, 0),
+	PLL_35XX_RATE(1900000000, 475, 6, 0),
+	PLL_35XX_RATE(1800000000, 225, 3, 0),
+	PLL_35XX_RATE(1700000000, 425, 6, 0),
+	PLL_35XX_RATE(1600000000, 200, 3, 0),
+	PLL_35XX_RATE(1500000000, 250, 4, 0),
+	PLL_35XX_RATE(1400000000, 175, 3, 0),
+	PLL_35XX_RATE(1300000000, 325, 6, 0),
+	PLL_35XX_RATE(1200000000, 100, 2, 0),
+	PLL_35XX_RATE(1100000000, 275, 3, 1),
+	PLL_35XX_RATE(1000000000, 250, 3, 1),
+	PLL_35XX_RATE(900000000, 150, 2, 1),
+	PLL_35XX_RATE(800000000, 200, 3, 1),
+	PLL_35XX_RATE(700000000, 175, 3, 1),
+	PLL_35XX_RATE(600000000, 100, 2, 1),
+	PLL_35XX_RATE(500000000, 250, 3, 2),
+	PLL_35XX_RATE(400000000, 200, 3, 2),
+	PLL_35XX_RATE(300000000, 100, 2, 2),
+	PLL_35XX_RATE(200000000, 200, 3, 3),
+	{ },
+};
+
+static struct samsung_pll_rate_table cpll_24mhz_tbl[] __initdata = {
+	/* sorted in descending order */
+	/* PLL_35XX_RATE(rate, m, p, s) */
+	PLL_35XX_RATE(666000000, 222, 4, 1),
+	PLL_35XX_RATE(640000000, 160, 3, 1),
+	PLL_35XX_RATE(320000000, 160, 3, 2),
+	{ },
+};
+
+static struct samsung_pll_rate_table dpll_24mhz_tbl[] __initdata = {
+	/* sorted in descending order */
+	/* PLL_35XX_RATE(rate, m, p, s) */
+	PLL_35XX_RATE(600000000, 200, 4, 1),
+	{ },
+};
+
+static struct samsung_pll_rate_table epll_24mhz_tbl[] __initdata = {
+	/* sorted in descending order */
+	/* PLL_36XX_RATE(rate, m, p, s, k) */
+	PLL_36XX_RATE(600000000, 100, 2, 1,      0),
+	PLL_36XX_RATE(400000000, 200, 3, 2,      0),
+	PLL_36XX_RATE(200000000, 200, 3, 3,      0),
+	PLL_36XX_RATE(180633600, 301, 5, 3,  -3670),
+	PLL_36XX_RATE( 67737600, 452, 5, 5, -27263),
+	PLL_36XX_RATE( 49152000, 197, 3, 5, -25690),
+	PLL_36XX_RATE( 45158401, 181, 3, 5, -24012),
+	{ },
+};
+
+static struct samsung_pll_rate_table ipll_24mhz_tbl[] __initdata = {
+	/* sorted in descending order */
+	/* PLL_35XX_RATE(rate, m, p, s, k) */
+	PLL_35XX_RATE(864000000, 288, 4, 1),
+	PLL_35XX_RATE(666000000, 222, 4, 1),
+	PLL_35XX_RATE(432000000, 288, 4, 2),
+	{ },
+};
+
+static struct samsung_pll_rate_table kpll_24mhz_tbl[] __initdata = {
+	/* sorted in descending order */
+	/* PLL_35XX_RATE(rate, m, p, s) */
+	PLL_35XX_RATE(1500000000, 250, 4, 0),
+	PLL_35XX_RATE(1400000000, 175, 3, 0),
+	PLL_35XX_RATE(1300000000, 325, 6, 0),
+	PLL_35XX_RATE(1200000000, 100, 2, 0),
+	PLL_35XX_RATE(1100000000, 275, 3, 1),
+	PLL_35XX_RATE(1000000000, 250, 3, 1),
+	PLL_35XX_RATE(900000000, 150, 2, 1),
+	PLL_35XX_RATE(800000000, 200, 3, 1),
+	PLL_35XX_RATE(700000000, 175, 3, 1),
+	PLL_35XX_RATE(600000000, 100, 2, 1),
+	PLL_35XX_RATE(500000000, 250, 3, 2),
+	PLL_35XX_RATE(400000000, 200, 3, 2),
+	PLL_35XX_RATE(300000000, 100, 2, 2),
+	PLL_35XX_RATE(200000000, 200, 3, 3),
+	{ },
+};
+
+static struct samsung_pll_rate_table vpll_24mhz_tbl[] __initdata = {
+	/* sorted in descending order */
+	/* PLL_36XX_RATE(rate, m, p, s, k) */
+	PLL_36XX_RATE(880000000, 220, 3, 1, 0),
+	PLL_36XX_RATE(640000000, 160, 3, 1, 0),
+	PLL_36XX_RATE(532000000, 133, 3, 1, 0),
+	PLL_36XX_RATE(480000000, 240, 3, 2, 0),
+	PLL_36XX_RATE(440000000, 220, 3, 2, 0),
+	PLL_36XX_RATE(350000000, 175, 3, 2, 0),
+	PLL_36XX_RATE(333000000, 111, 2, 2, 0),
+	PLL_36XX_RATE(266000000, 133, 3, 2, 0),
+	PLL_36XX_RATE(177000000, 118, 2, 3, 0),
+	PLL_36XX_RATE(123500000, 330, 4, 4, 0),
+	PLL_36XX_RATE( 89000000, 178, 3, 4, 0),
+	{ },
+};
+
 static struct samsung_pll_clock exynos5410_plls[nr_plls] __initdata = {
 	[apll] = PLL(pll_35xx, CLK_FOUT_APLL, "fout_apll", "fin_pll", APLL_LOCK,
-		APLL_CON0, NULL),
-	[cpll] = PLL(pll_35xx, CLK_FOUT_CPLL, "fout_cpll", "fin_pll", CPLL_LOCK,
-		CPLL_CON0, NULL),
-	[mpll] = PLL(pll_35xx, CLK_FOUT_MPLL, "fout_mpll", "fin_pll", MPLL_LOCK,
-		MPLL_CON0, NULL),
+		APLL_CON0, apll_24mhz_tbl),
 	[bpll] = PLL(pll_35xx, CLK_FOUT_BPLL, "fout_bpll", "fin_pll", BPLL_LOCK,
 		BPLL_CON0, NULL),
+	[cpll] = PLL(pll_35xx, CLK_FOUT_CPLL, "fout_cpll", "fin_pll", CPLL_LOCK,
+		CPLL_CON0, cpll_24mhz_tbl),
+	[dpll] = PLL(pll_35xx, CLK_FOUT_DPLL, "fout_dpll", "fin_pll", DPLL_LOCK,
+		DPLL_CON0, dpll_24mhz_tbl),
+	[epll] = PLL(pll_36xx, CLK_FOUT_EPLL, "fout_epll", "fin_pll", EPLL_LOCK,
+		EPLL_CON0, epll_24mhz_tbl),
+	[ipll] = PLL(pll_35xx, CLK_FOUT_IPLL, "fout_ipll", "fin_pll", IPLL_LOCK,
+		IPLL_CON0, ipll_24mhz_tbl),
 	[kpll] = PLL(pll_35xx, CLK_FOUT_KPLL, "fout_kpll", "fin_pll", KPLL_LOCK,
-		KPLL_CON0, NULL),
+		KPLL_CON0, kpll_24mhz_tbl),
+	[mpll] = PLL(pll_35xx, CLK_FOUT_MPLL, "fout_mpll", "fin_pll", MPLL_LOCK,
+		MPLL_CON0, NULL),
+	[vpll] = PLL(pll_36xx, CLK_FOUT_VPLL, "fout_vpll", "mout_vpllsrc",
+		VPLL_LOCK, VPLL_CON0, vpll_24mhz_tbl),
 };
 
 /* register exynos5410 clocks */
diff --git a/include/dt-bindings/clock/exynos5410.h b/include/dt-bindings/clock/exynos5410.h
index 9b180f0..46e85dc 100644
--- a/include/dt-bindings/clock/exynos5410.h
+++ b/include/dt-bindings/clock/exynos5410.h
@@ -4,10 +4,14 @@
 /* core clocks */
 #define CLK_FIN_PLL 1
 #define CLK_FOUT_APLL 2
-#define CLK_FOUT_CPLL 3
-#define CLK_FOUT_MPLL 4
-#define CLK_FOUT_BPLL 5
-#define CLK_FOUT_KPLL 6
+#define CLK_FOUT_BPLL 3
+#define CLK_FOUT_CPLL 4
+#define CLK_FOUT_DPLL 5
+#define CLK_FOUT_EPLL 6
+#define CLK_FOUT_IPLL 7
+#define CLK_FOUT_KPLL 8
+#define CLK_FOUT_MPLL 9
+#define CLK_FOUT_VPLL 10
 
 /* gate for special clocks (sclk) */
 #define CLK_SCLK_UART0 128
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] clk: exynos5410: Add the definitions of new clock registers
  2014-07-30 14:36 [PATCH 1/3] clk: exynos5410: Add the definitions of new clock registers Humberto Silva Naves
  2014-07-30 14:36 ` [PATCH 2/3] clk: exynos5410: Add suspend/resume handling Humberto Silva Naves
  2014-07-30 14:36 ` [PATCH 3/3] clk: exynos5410: Added clocks BPLL, DPLL, EPLL, IPLL, MPLL, and VPLL Humberto Silva Naves
@ 2014-07-31  6:04 ` Thomas Abraham
  2 siblings, 0 replies; 6+ messages in thread
From: Thomas Abraham @ 2014-07-31  6:04 UTC (permalink / raw)
  To: Humberto Silva Naves; +Cc: linux-samsung-soc@vger.kernel.org, Tomasz Figa

Hi Humberto,

On Wed, Jul 30, 2014 at 8:06 PM, Humberto Silva Naves <hsnaves@gmail.com> wrote:
> Added clock register definitions for the majority of the relevant
> clocks inside the SoC, including the definitions of all PLL's clocks.
> The definitions are now ordered by name, in order to make the

It would be good not to mix name ordering and addition of new
definitions. Also, it would be better if the new definitions are
ordered on the register address offset and not the name. It is easier
to check if a definition is available based on register offset than
the name.

> driver more readable and reduce the chances of potential conflicts
> when adding new entries. The different register groups (SRC, DIV, PLL,
> GATE, etc) are separated by a blank line.
>
> Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
> ---
>  drivers/clk/samsung/clk-exynos5410.c |  144 ++++++++++++++++++++++++++++------
>  1 file changed, 122 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/clk/samsung/clk-exynos5410.c b/drivers/clk/samsung/clk-exynos5410.c
> index 231475b..72a533e 100644
> --- a/drivers/clk/samsung/clk-exynos5410.c
> +++ b/drivers/clk/samsung/clk-exynos5410.c
> @@ -19,39 +19,139 @@
>
>  #include "clk.h"
>
> -#define APLL_LOCK               0x0
> -#define APLL_CON0               0x100
> -#define CPLL_LOCK               0x10020
> -#define CPLL_CON0               0x10120
> -#define MPLL_LOCK               0x4000
> -#define MPLL_CON0               0x4100
> -#define BPLL_LOCK               0x20010
> -#define BPLL_CON0               0x20110
> -#define KPLL_LOCK               0x28000
> -#define KPLL_CON0               0x28100
> +#define APLL_CON0              0x100
> +#define APLL_LOCK              0x0
> +#define BPLL_CON0              0x20110
> +#define BPLL_LOCK              0x20010
> +#define CPLL_CON0              0x10120
> +#define CPLL_CON1              0x10124
> +#define CPLL_LOCK              0x10020
> +#define DPLL_CON0              0x10128
> +#define DPLL_CON1              0x1012C
> +#define DPLL_LOCK              0x10030
> +#define EPLL_CON0              0x10130
> +#define EPLL_CON1              0x10134
> +#define EPLL_CON2              0x10138
> +#define EPLL_LOCK              0x10040
> +#define IPLL_CON0              0x10150
> +#define IPLL_CON1              0x10154
> +#define IPLL_LOCK              0x10060
> +#define KPLL_CON0              0x28100
> +#define KPLL_LOCK              0x28000
> +#define MPLL_CON0              0x4100
> +#define MPLL_LOCK              0x4000
> +#define VPLL_CON0              0x10140
> +#define VPLL_CON1              0x10144
> +#define VPLL_CON2              0x10148
> +#define VPLL_LOCK              0x10050
>
> -#define SRC_CPU                        0x200
> -#define DIV_CPU0               0x500
> +#define SRC_CDREX              0x20200
> +#define SRC_CPERI0             0x4200
>  #define SRC_CPERI1             0x4204
> -#define DIV_TOP0               0x10510
> -#define DIV_TOP1               0x10514
> -#define DIV_FSYS1              0x1054c
> -#define DIV_FSYS2              0x10550
> -#define DIV_PERIC0             0x10558
> +#define SRC_CPU                        0x200
> +#define SRC_DISP0_0            0x10224
> +#define SRC_DISP0_1            0x10228
> +#define SRC_DISP1_0            0x1022C
> +#define SRC_DISP1_1            0x10230
> +#define SRC_FSYS               0x10244
> +#define SRC_GSCL               0x10220
> +#define SRC_KFC                        0x28200
> +#define SRC_MAU                        0x10240
> +#define SRC_PERIC0             0x10250
> +#define SRC_PERIC1             0x10254
>  #define SRC_TOP0               0x10210
>  #define SRC_TOP1               0x10214
>  #define SRC_TOP2               0x10218
> -#define SRC_FSYS               0x10244
> -#define SRC_PERIC0             0x10250
> +#define SRC_TOP3               0x1021C
> +
> +#define SRC_MASK_DISP0_0       0x10324
> +#define SRC_MASK_DISP0_1       0x10328
> +#define SRC_MASK_DISP1_0       0x1032C
> +#define SRC_MASK_DISP1_1       0x10330
>  #define SRC_MASK_FSYS          0x10340
> +#define SRC_MASK_GEN           0x10344
> +#define SRC_MASK_GSCL          0x10320
> +#define SRC_MASK_MAU           0x10334
>  #define SRC_MASK_PERIC0                0x10350
> +#define SRC_MASK_PERIC1                0x10354
> +#define SRC_MASK_TOP           0x10310
> +
> +#define DIV_CDREX              0x20500
> +#define DIV_CDREX2             0x20504
> +#define DIV_CPERI0             0x4500
> +#define DIV_CPERI1             0x4504
> +#define DIV_CPU0               0x500
> +#define DIV_CPU1               0x504
> +#define DIV_DISP0_0            0x10524
> +#define DIV_DISP0_1            0x10528
> +#define DIV_DISP1_0            0x1052C
> +#define DIV_DISP1_1            0x10530
> +#define DIV_FSYS0              0x10548
> +#define DIV_FSYS1              0x1054C
> +#define DIV_FSYS2              0x10550
> +#define DIV_FSYS3              0x10554
> +#define DIV_GEN                        0x1053C
> +#define DIV_GSCL               0x10520
> +#define DIV_G2D                        0x8500
> +#define DIV_ISP0               0x0C300
> +#define DIV_ISP1               0x0C304
> +#define DIV_ISP2               0x0C308
> +#define DIV_KFC0               0x28500
> +#define DIV_MAU                        0x10544
> +#define DIV_PERIC0             0x10558
> +#define DIV_PERIC1             0x1055C
> +#define DIV_PERIC2             0x10560
> +#define DIV_PERIC3             0x10564
> +#define DIV_PERIC4             0x10568
> +#define DIV_PERIC5             0x1056C
> +#define DIV_TOP0               0x10510
> +#define DIV_TOP1               0x10514
> +#define DIV_TOP2               0x10518
> +#define DIV_TOP3               0x1051C
> +#define DIV2_RATIO0            0x10590
> +#define DIV2_RATIO1            0x10594
> +
> +#define GATE_BUS_CDREX         0x20700
> +#define GATE_BUS_CPU           0x700
> +#define GATE_BUS_DISP0         0x10724
> +#define GATE_BUS_DISP1         0x10728
>  #define GATE_BUS_FSYS0         0x10740
> +#define GATE_BUS_FSYS1         0x10744
> +#define GATE_BUS_GEN           0x1073C
> +#define GATE_BUS_GSCL0         0x10710
> +#define GATE_BUS_GSCL1         0x10720
> +#define GATE_BUS_G3D           0x10738
> +#define GATE_BUS_MFC           0x10734
> +
> +#define GATE_IP_CDREX          0x20900
> +#define GATE_IP_CORE           0x4900
> +#define GATE_IP_DISP0          0x10924
> +#define GATE_IP_DISP1          0x10928
>  #define GATE_IP_FSYS           0x10944
> +#define GATE_IP_GEN            0x10934
> +#define GATE_IP_GSCL0          0x10910
> +#define GATE_IP_GSCL1          0x10920
> +#define GATE_IP_G2D            0x8800
> +#define GATE_IP_G3D            0x10930
> +#define GATE_IP_ISP0           0x0C800
> +#define GATE_IP_ISP1           0x0C804
> +#define GATE_IP_MFC            0x1092C
>  #define GATE_IP_PERIC          0x10950
>  #define GATE_IP_PERIS          0x10960
> -#define SRC_CDREX              0x20200
> -#define SRC_KFC                        0x28200
> -#define DIV_KFC0               0x28500
> +
> +#define GATE_TOP_SCLK_DISP0    0x10824
> +#define GATE_TOP_SCLK_DISP1    0x10828
> +#define GATE_TOP_SCLK_FSYS     0x10840
> +#define GATE_TOP_SCLK_GEN      0x1082C
> +#define GATE_TOP_SCLK_GSCL     0x10820
> +#define GATE_TOP_SCLK_MAU      0x1083C
> +#define GATE_TOP_SCLK_PERIC    0x10850
> +
> +#define GATE_SCLK_CPU          0x800
> +#define SCLK_DIV_ISP           0x10580
> +#define SCLK_DIV_ISP1          0x10584
> +#define SCLK_SRC_ISP           0x10270
> +
>
>  /* list of PLLs */
>  enum exynos5410_plls {
> --
> 1.7.10.4

This patch can be merged with 2/3 patch of this series since that is
were these definitions are being used.

Thanks,
Thomas.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] clk: exynos5410: Add suspend/resume handling
  2014-07-30 14:36 ` [PATCH 2/3] clk: exynos5410: Add suspend/resume handling Humberto Silva Naves
@ 2014-07-31  6:04   ` Thomas Abraham
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Abraham @ 2014-07-31  6:04 UTC (permalink / raw)
  To: Humberto Silva Naves; +Cc: linux-samsung-soc@vger.kernel.org, Tomasz Figa

Hi Humberto,

On Wed, Jul 30, 2014 at 8:06 PM, Humberto Silva Naves <hsnaves@gmail.com> wrote:
> This patch implements all the necessary code that handles register
> saving and restoring during a suspend/resume cycle.
>
> To make this possible, the local variable reg_base from the function
> exynos5410_clk_init was changed to global.
>
> Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
> ---
>  drivers/clk/samsung/clk-exynos5410.c |  132 +++++++++++++++++++++++++++++++++-
>  1 file changed, 131 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/samsung/clk-exynos5410.c b/drivers/clk/samsung/clk-exynos5410.c
> index 72a533e..aaca65d 100644
> --- a/drivers/clk/samsung/clk-exynos5410.c
> +++ b/drivers/clk/samsung/clk-exynos5410.c
> @@ -16,6 +16,7 @@
>  #include <linux/clk-provider.h>
>  #include <linux/of.h>
>  #include <linux/of_address.h>
> +#include <linux/syscore_ops.h>
>
>  #include "clk.h"
>
> @@ -160,6 +161,134 @@ enum exynos5410_plls {
>         nr_plls                 /* number of PLLs */
>  };
>
> +static void __iomem *reg_base;
> +
> +#ifdef CONFIG_PM_SLEEP
> +static struct samsung_clk_reg_dump *exynos5410_save;
> +
> +/*
> + * list of controller registers to be saved and restored during a
> + * suspend/resume cycle.
> + */
> +static unsigned long exynos5410_clk_regs[] __initdata = {
> +       SRC_CDREX,
> +       SRC_CPERI0,
> +       SRC_CPERI1,
> +       SRC_CPU,
> +       SRC_DISP0_0,
> +       SRC_DISP0_1,
> +       SRC_DISP1_0,
> +       SRC_DISP1_1,
> +       SRC_FSYS,
> +       SRC_GSCL,
> +       SRC_KFC,
> +       SRC_MAU,
> +       SRC_PERIC0,
> +       SRC_PERIC1,
> +       SRC_TOP0,
> +       SRC_TOP1,
> +       SRC_TOP2,
> +       SRC_TOP3,
> +
> +       DIV_CDREX,
> +       DIV_CDREX2,
> +       DIV_CPU0,
> +       DIV_CPERI1,
> +       DIV_DISP0_0,
> +       DIV_DISP0_1,
> +       DIV_DISP1_0,
> +       DIV_DISP1_1,
> +       DIV_FSYS0,
> +       DIV_FSYS1,
> +       DIV_FSYS2,
> +       DIV_GEN,
> +       DIV_GSCL,
> +       DIV_G2D,
> +       DIV_KFC0,
> +       DIV_MAU,
> +       DIV_PERIC0,
> +       DIV_PERIC1,
> +       DIV_PERIC2,
> +       DIV_PERIC3,
> +       DIV_PERIC4,
> +       DIV_PERIC5,
> +       DIV_TOP0,
> +       DIV_TOP1,
> +       DIV_TOP2,
> +       DIV_TOP3,
> +
> +       GATE_BUS_DISP1,
> +       GATE_BUS_FSYS0,
> +
> +       GATE_IP_CDREX,
> +       GATE_IP_CORE,
> +       GATE_IP_DISP0,
> +       GATE_IP_DISP1,
> +       GATE_IP_FSYS,
> +       GATE_IP_GEN,
> +       GATE_IP_GSCL0,
> +       GATE_IP_GSCL1,
> +       GATE_IP_G2D,
> +       GATE_IP_G3D,
> +       GATE_IP_MFC,
> +       GATE_IP_PERIC,
> +       GATE_IP_PERIS,
> +
> +       GATE_TOP_SCLK_DISP1,
> +       GATE_TOP_SCLK_FSYS,
> +       GATE_TOP_SCLK_GSCL,
> +       GATE_TOP_SCLK_MAU,
> +       GATE_TOP_SCLK_PERIC,
> +
> +       GATE_BUS_DISP1,
> +       GATE_BUS_FSYS0,
> +
> +       GATE_SCLK_CPU,
> +
> +       SRC_MASK_DISP0_0,
> +       SRC_MASK_DISP1_0,
> +       SRC_MASK_FSYS,
> +       SRC_MASK_MAU,
> +       SRC_MASK_PERIC0,
> +       SRC_MASK_PERIC1,
> +};
> +
> +static int exynos5410_clk_suspend(void)
> +{
> +       samsung_clk_save(reg_base, exynos5410_save,
> +                               ARRAY_SIZE(exynos5410_clk_regs));
> +
> +       return 0;
> +}
> +
> +static void exynos5410_clk_resume(void)
> +{
> +       samsung_clk_restore(reg_base, exynos5410_save,
> +                               ARRAY_SIZE(exynos5410_clk_regs));
> +}
> +
> +static struct syscore_ops exynos5410_clk_syscore_ops = {
> +       .suspend = exynos5410_clk_suspend,
> +       .resume = exynos5410_clk_resume,
> +};
> +
> +static void exynos5410_clk_sleep_init(void)
> +{
> +       exynos5410_save = samsung_clk_alloc_reg_dump(exynos5410_clk_regs,
> +                                       ARRAY_SIZE(exynos5410_clk_regs));
> +       if (!exynos5410_save) {
> +               pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
> +                       __func__);
> +               return;
> +       }
> +
> +       register_syscore_ops(&exynos5410_clk_syscore_ops);
> +}
> +#else
> +static void exynos5410_clk_sleep_init(void) {}
> +#endif
> +
> +

Extra new line here can be removed.

>  /* list of all parent clocks */
>  PNAME(apll_p)          = { "fin_pll", "fout_apll", };
>  PNAME(bpll_p)          = { "fin_pll", "fout_bpll", };
> @@ -286,7 +415,6 @@ static struct samsung_pll_clock exynos5410_plls[nr_plls] __initdata = {
>  static void __init exynos5410_clk_init(struct device_node *np)
>  {
>         struct samsung_clk_provider *ctx;
> -       void __iomem *reg_base;
>
>         reg_base = of_iomap(np, 0);
>         if (!reg_base)
> @@ -304,6 +432,8 @@ static void __init exynos5410_clk_init(struct device_node *np)
>         samsung_clk_register_gate(ctx, exynos5410_gate_clks,
>                         ARRAY_SIZE(exynos5410_gate_clks));
>
> +       exynos5410_clk_sleep_init();
> +
>         samsung_clk_of_add_provider(np, ctx);
>
>         pr_debug("Exynos5410: clock setup completed.\n");
> --
> 1.7.10.4

Reviewed-by: Thomas Abraham <thomas.ab@samsung.com>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] clk: exynos5410: Added clocks BPLL, DPLL, EPLL, IPLL, MPLL, and VPLL
  2014-07-30 14:36 ` [PATCH 3/3] clk: exynos5410: Added clocks BPLL, DPLL, EPLL, IPLL, MPLL, and VPLL Humberto Silva Naves
@ 2014-07-31  6:19   ` Thomas Abraham
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Abraham @ 2014-07-31  6:19 UTC (permalink / raw)
  To: Humberto Silva Naves; +Cc: linux-samsung-soc@vger.kernel.org, Tomasz Figa

Hi Humberto,

On Wed, Jul 30, 2014 at 8:06 PM, Humberto Silva Naves <hsnaves@gmail.com> wrote:
> Added the remaining PLL clocks, and also registered the configuration
> tables with the PLL coefficients for the supported frequencies.
> These frequency tables are valid when a 24MHz clock is supplied as the
> input clock source (which I believe is always the case). Furthermore,
> the corresponding constants for these PLL clocks were addded to the
> dt-bindings header file. While at it, the constant definitions were
> reordered alphabetically.
>
> Signed-off-by: Humberto Silva Naves <hsnaves@gmail.com>
> ---
>  drivers/clk/samsung/clk-exynos5410.c   |  128 +++++++++++++++++++++++++++++---
>  include/dt-bindings/clock/exynos5410.h |   12 ++-
>  2 files changed, 127 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/clk/samsung/clk-exynos5410.c b/drivers/clk/samsung/clk-exynos5410.c
> index aaca65d..7f4b3ea 100644
> --- a/drivers/clk/samsung/clk-exynos5410.c
> +++ b/drivers/clk/samsung/clk-exynos5410.c
> @@ -156,9 +156,10 @@
>
>  /* list of PLLs */
>  enum exynos5410_plls {
> -       apll, cpll, mpll,
> -       bpll, kpll,
> -       nr_plls                 /* number of PLLs */
> +       apll, bpll, cpll,
> +       dpll, epll, ipll,
> +       kpll, mpll, vpll,
> +       nr_plls                 /* number of PLLs */
>  };
>
>  static void __iomem *reg_base;
> @@ -398,17 +399,126 @@ static struct samsung_gate_clock exynos5410_gate_clks[] __initdata = {
>                         SRC_MASK_PERIC0, 8, CLK_SET_RATE_PARENT, 0),
>  };
>
> +static struct samsung_pll_rate_table apll_24mhz_tbl[] __initdata = {
> +       /* sorted in descending order */
> +       /* PLL_35XX_RATE(rate, m, p, s) */
> +       PLL_35XX_RATE(2100000000, 175, 2, 0),
> +       PLL_35XX_RATE(2000000000, 250, 3, 0),
> +       PLL_35XX_RATE(1900000000, 475, 6, 0),
> +       PLL_35XX_RATE(1800000000, 225, 3, 0),
> +       PLL_35XX_RATE(1700000000, 425, 6, 0),
> +       PLL_35XX_RATE(1600000000, 200, 3, 0),
> +       PLL_35XX_RATE(1500000000, 250, 4, 0),
> +       PLL_35XX_RATE(1400000000, 175, 3, 0),
> +       PLL_35XX_RATE(1300000000, 325, 6, 0),
> +       PLL_35XX_RATE(1200000000, 100, 2, 0),
> +       PLL_35XX_RATE(1100000000, 275, 3, 1),
> +       PLL_35XX_RATE(1000000000, 250, 3, 1),
> +       PLL_35XX_RATE(900000000, 150, 2, 1),
> +       PLL_35XX_RATE(800000000, 200, 3, 1),
> +       PLL_35XX_RATE(700000000, 175, 3, 1),
> +       PLL_35XX_RATE(600000000, 100, 2, 1),
> +       PLL_35XX_RATE(500000000, 250, 3, 2),
> +       PLL_35XX_RATE(400000000, 200, 3, 2),
> +       PLL_35XX_RATE(300000000, 100, 2, 2),
> +       PLL_35XX_RATE(200000000, 200, 3, 3),
> +       { },
> +};
> +
> +static struct samsung_pll_rate_table cpll_24mhz_tbl[] __initdata = {
> +       /* sorted in descending order */
> +       /* PLL_35XX_RATE(rate, m, p, s) */
> +       PLL_35XX_RATE(666000000, 222, 4, 1),
> +       PLL_35XX_RATE(640000000, 160, 3, 1),
> +       PLL_35XX_RATE(320000000, 160, 3, 2),
> +       { },
> +};
> +
> +static struct samsung_pll_rate_table dpll_24mhz_tbl[] __initdata = {
> +       /* sorted in descending order */
> +       /* PLL_35XX_RATE(rate, m, p, s) */
> +       PLL_35XX_RATE(600000000, 200, 4, 1),
> +       { },
> +};
> +
> +static struct samsung_pll_rate_table epll_24mhz_tbl[] __initdata = {
> +       /* sorted in descending order */
> +       /* PLL_36XX_RATE(rate, m, p, s, k) */
> +       PLL_36XX_RATE(600000000, 100, 2, 1,      0),
> +       PLL_36XX_RATE(400000000, 200, 3, 2,      0),
> +       PLL_36XX_RATE(200000000, 200, 3, 3,      0),
> +       PLL_36XX_RATE(180633600, 301, 5, 3,  -3670),
> +       PLL_36XX_RATE( 67737600, 452, 5, 5, -27263),
> +       PLL_36XX_RATE( 49152000, 197, 3, 5, -25690),
> +       PLL_36XX_RATE( 45158401, 181, 3, 5, -24012),
> +       { },
> +};
> +
> +static struct samsung_pll_rate_table ipll_24mhz_tbl[] __initdata = {
> +       /* sorted in descending order */
> +       /* PLL_35XX_RATE(rate, m, p, s, k) */
> +       PLL_35XX_RATE(864000000, 288, 4, 1),
> +       PLL_35XX_RATE(666000000, 222, 4, 1),
> +       PLL_35XX_RATE(432000000, 288, 4, 2),
> +       { },
> +};
> +
> +static struct samsung_pll_rate_table kpll_24mhz_tbl[] __initdata = {
> +       /* sorted in descending order */
> +       /* PLL_35XX_RATE(rate, m, p, s) */
> +       PLL_35XX_RATE(1500000000, 250, 4, 0),
> +       PLL_35XX_RATE(1400000000, 175, 3, 0),
> +       PLL_35XX_RATE(1300000000, 325, 6, 0),
> +       PLL_35XX_RATE(1200000000, 100, 2, 0),
> +       PLL_35XX_RATE(1100000000, 275, 3, 1),
> +       PLL_35XX_RATE(1000000000, 250, 3, 1),
> +       PLL_35XX_RATE(900000000, 150, 2, 1),
> +       PLL_35XX_RATE(800000000, 200, 3, 1),
> +       PLL_35XX_RATE(700000000, 175, 3, 1),
> +       PLL_35XX_RATE(600000000, 100, 2, 1),
> +       PLL_35XX_RATE(500000000, 250, 3, 2),
> +       PLL_35XX_RATE(400000000, 200, 3, 2),
> +       PLL_35XX_RATE(300000000, 100, 2, 2),
> +       PLL_35XX_RATE(200000000, 200, 3, 3),
> +       { },
> +};
> +
> +static struct samsung_pll_rate_table vpll_24mhz_tbl[] __initdata = {
> +       /* sorted in descending order */
> +       /* PLL_36XX_RATE(rate, m, p, s, k) */
> +       PLL_36XX_RATE(880000000, 220, 3, 1, 0),
> +       PLL_36XX_RATE(640000000, 160, 3, 1, 0),
> +       PLL_36XX_RATE(532000000, 133, 3, 1, 0),
> +       PLL_36XX_RATE(480000000, 240, 3, 2, 0),
> +       PLL_36XX_RATE(440000000, 220, 3, 2, 0),
> +       PLL_36XX_RATE(350000000, 175, 3, 2, 0),
> +       PLL_36XX_RATE(333000000, 111, 2, 2, 0),
> +       PLL_36XX_RATE(266000000, 133, 3, 2, 0),
> +       PLL_36XX_RATE(177000000, 118, 2, 3, 0),
> +       PLL_36XX_RATE(123500000, 330, 4, 4, 0),
> +       PLL_36XX_RATE( 89000000, 178, 3, 4, 0),
> +       { },
> +};
> +
>  static struct samsung_pll_clock exynos5410_plls[nr_plls] __initdata = {
>         [apll] = PLL(pll_35xx, CLK_FOUT_APLL, "fout_apll", "fin_pll", APLL_LOCK,
> -               APLL_CON0, NULL),
> -       [cpll] = PLL(pll_35xx, CLK_FOUT_CPLL, "fout_cpll", "fin_pll", CPLL_LOCK,
> -               CPLL_CON0, NULL),
> -       [mpll] = PLL(pll_35xx, CLK_FOUT_MPLL, "fout_mpll", "fin_pll", MPLL_LOCK,
> -               MPLL_CON0, NULL),
> +               APLL_CON0, apll_24mhz_tbl),
>         [bpll] = PLL(pll_35xx, CLK_FOUT_BPLL, "fout_bpll", "fin_pll", BPLL_LOCK,
>                 BPLL_CON0, NULL),
> +       [cpll] = PLL(pll_35xx, CLK_FOUT_CPLL, "fout_cpll", "fin_pll", CPLL_LOCK,
> +               CPLL_CON0, cpll_24mhz_tbl),
> +       [dpll] = PLL(pll_35xx, CLK_FOUT_DPLL, "fout_dpll", "fin_pll", DPLL_LOCK,
> +               DPLL_CON0, dpll_24mhz_tbl),
> +       [epll] = PLL(pll_36xx, CLK_FOUT_EPLL, "fout_epll", "fin_pll", EPLL_LOCK,
> +               EPLL_CON0, epll_24mhz_tbl),
> +       [ipll] = PLL(pll_35xx, CLK_FOUT_IPLL, "fout_ipll", "fin_pll", IPLL_LOCK,
> +               IPLL_CON0, ipll_24mhz_tbl),
>         [kpll] = PLL(pll_35xx, CLK_FOUT_KPLL, "fout_kpll", "fin_pll", KPLL_LOCK,
> -               KPLL_CON0, NULL),
> +               KPLL_CON0, kpll_24mhz_tbl),
> +       [mpll] = PLL(pll_35xx, CLK_FOUT_MPLL, "fout_mpll", "fin_pll", MPLL_LOCK,
> +               MPLL_CON0, NULL),
> +       [vpll] = PLL(pll_36xx, CLK_FOUT_VPLL, "fout_vpll", "mout_vpllsrc",
> +               VPLL_LOCK, VPLL_CON0, vpll_24mhz_tbl),
>  };

It would be better to check the parent rate and then conditionally
assign the rate table.

>
>  /* register exynos5410 clocks */
> diff --git a/include/dt-bindings/clock/exynos5410.h b/include/dt-bindings/clock/exynos5410.h
> index 9b180f0..46e85dc 100644
> --- a/include/dt-bindings/clock/exynos5410.h
> +++ b/include/dt-bindings/clock/exynos5410.h
> @@ -4,10 +4,14 @@
>  /* core clocks */
>  #define CLK_FIN_PLL 1
>  #define CLK_FOUT_APLL 2
> -#define CLK_FOUT_CPLL 3
> -#define CLK_FOUT_MPLL 4
> -#define CLK_FOUT_BPLL 5
> -#define CLK_FOUT_KPLL 6
> +#define CLK_FOUT_BPLL 3
> +#define CLK_FOUT_CPLL 4
> +#define CLK_FOUT_DPLL 5
> +#define CLK_FOUT_EPLL 6
> +#define CLK_FOUT_IPLL 7
> +#define CLK_FOUT_KPLL 8
> +#define CLK_FOUT_MPLL 9
> +#define CLK_FOUT_VPLL 10

The reordering of the definitions could be avoided. It is not really
helping in anyway.

Thanks,
Thomas.

>
>  /* gate for special clocks (sclk) */
>  #define CLK_SCLK_UART0 128
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-31  6:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-30 14:36 [PATCH 1/3] clk: exynos5410: Add the definitions of new clock registers Humberto Silva Naves
2014-07-30 14:36 ` [PATCH 2/3] clk: exynos5410: Add suspend/resume handling Humberto Silva Naves
2014-07-31  6:04   ` Thomas Abraham
2014-07-30 14:36 ` [PATCH 3/3] clk: exynos5410: Added clocks BPLL, DPLL, EPLL, IPLL, MPLL, and VPLL Humberto Silva Naves
2014-07-31  6:19   ` Thomas Abraham
2014-07-31  6:04 ` [PATCH 1/3] clk: exynos5410: Add the definitions of new clock registers Thomas Abraham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox