* [PATCH 0/9] Samsung clock PM consolidation part 1
@ 2013-10-16 11:08 Tomasz Figa
2013-10-16 11:08 ` [PATCH 1/9] clk: exynos4: Remove remnants of non-DT support Tomasz Figa
` (9 more replies)
0 siblings, 10 replies; 15+ messages in thread
From: Tomasz Figa @ 2013-10-16 11:08 UTC (permalink / raw)
To: linux-arm-kernel
This series reworks suspend/resume handling of Samsung clock drivers
to cover more SoC specific aspects that are beyond simple register
save and restore. The goal is to have all the suspend/resume code
that touches the clock controller in single place, which is the
clock driver.
On Exynos4210-based Trats, Exynos4412-based Trats2 and Exynos5250-based
Arndale boards (except suspend/resume, which is broken because of
unrelated reasons):
Tested-by: Tomasz Figa <t.figa@samsung.com>
Tomasz Figa (9):
clk: exynos4: Remove remnants of non-DT support
clk: samsung: Provide common helpers for register save/restore
clk: samsung: exynos4: Move suspend/resume handling to SoC driver
clk: samsung: exynos5250: Move suspend/resume handling to SoC driver
clk: samsung: exynos5420: Move suspend/resume handling to SoC driver
clk: samsung: s3c64xx: Move suspend/resume handling to SoC driver
clk: samsung: Drop old suspend/resume code
clk: samsung: exynos4: Add remaining suspend/resume handling
ARM: EXYNOS: pm: Drop legacy Exynos4 clock suspend/resume code
arch/arm/mach-exynos/pm.c | 125 +-------------------------
drivers/clk/samsung/clk-exynos4.c | 170 ++++++++++++++++++++++++++++++-----
drivers/clk/samsung/clk-exynos5250.c | 49 ++++++++--
drivers/clk/samsung/clk-exynos5420.c | 49 ++++++++--
drivers/clk/samsung/clk-exynos5440.c | 2 +-
drivers/clk/samsung/clk-s3c64xx.c | 79 +++++++++++++---
drivers/clk/samsung/clk.c | 71 ++++++---------
drivers/clk/samsung/clk.h | 14 ++-
8 files changed, 346 insertions(+), 213 deletions(-)
--
1.8.3.2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/9] clk: exynos4: Remove remnants of non-DT support
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
@ 2013-10-16 11:08 ` Tomasz Figa
2013-10-16 11:08 ` [PATCH 2/9] clk: samsung: Provide common helpers for register save/restore Tomasz Figa
` (8 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Tomasz Figa @ 2013-10-16 11:08 UTC (permalink / raw)
To: linux-arm-kernel
This patch simplifies a bit clock initialization code by removing
remnants of non-DT clock initialization, such as reg_base and xom values
passed in function parameters.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/clk/samsung/clk-exynos4.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
index ad5ff50..a29bb87 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -960,12 +960,13 @@ static unsigned long exynos4_get_xom(void)
return xom;
}
-static void __init exynos4_clk_register_finpll(unsigned long xom)
+static void __init exynos4_clk_register_finpll(void)
{
struct samsung_fixed_rate_clock fclk;
struct clk *clk;
unsigned long finpll_f = 24000000;
char *parent_name;
+ unsigned int xom = exynos4_get_xom();
parent_name = xom & 1 ? "xusbxti" : "xxti";
clk = clk_get(NULL, parent_name);
@@ -1090,9 +1091,10 @@ static struct samsung_pll_clock exynos4x12_plls[nr_plls] __initdata = {
/* register exynos4 clocks */
static void __init exynos4_clk_init(struct device_node *np,
- enum exynos4_soc exynos4_soc,
- void __iomem *reg_base, unsigned long xom)
+ enum exynos4_soc exynos4_soc)
{
+ void __iomem *reg_base;
+
reg_base = of_iomap(np, 0);
if (!reg_base)
panic("%s: failed to map registers\n", __func__);
@@ -1110,7 +1112,7 @@ static void __init exynos4_clk_init(struct device_node *np,
ARRAY_SIZE(exynos4_fixed_rate_ext_clks),
ext_clk_match);
- exynos4_clk_register_finpll(xom);
+ exynos4_clk_register_finpll();
if (exynos4_soc == EXYNOS4210) {
samsung_clk_register_mux(exynos4210_mux_early,
@@ -1188,12 +1190,12 @@ static void __init exynos4_clk_init(struct device_node *np,
static void __init exynos4210_clk_init(struct device_node *np)
{
- exynos4_clk_init(np, EXYNOS4210, NULL, exynos4_get_xom());
+ exynos4_clk_init(np, EXYNOS4210);
}
CLK_OF_DECLARE(exynos4210_clk, "samsung,exynos4210-clock", exynos4210_clk_init);
static void __init exynos4412_clk_init(struct device_node *np)
{
- exynos4_clk_init(np, EXYNOS4X12, NULL, exynos4_get_xom());
+ exynos4_clk_init(np, EXYNOS4X12);
}
CLK_OF_DECLARE(exynos4412_clk, "samsung,exynos4412-clock", exynos4412_clk_init);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/9] clk: samsung: Provide common helpers for register save/restore
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
2013-10-16 11:08 ` [PATCH 1/9] clk: exynos4: Remove remnants of non-DT support Tomasz Figa
@ 2013-10-16 11:08 ` Tomasz Figa
2013-10-16 11:08 ` [PATCH 3/9] clk: samsung: exynos4: Move suspend/resume handling to SoC driver Tomasz Figa
` (7 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Tomasz Figa @ 2013-10-16 11:08 UTC (permalink / raw)
To: linux-arm-kernel
As suspend/resume handlers are being moved to SoC specific code, due to
differencies in suspend/resume handling of particular SoCs, to minimize
code duplication this patch provides common register save/restore
helpers that save/restore given list of registers of clock controller.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/clk/samsung/clk.c | 32 ++++++++++++++++++++++++++++++++
drivers/clk/samsung/clk.h | 10 ++++++++++
2 files changed, 42 insertions(+)
diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c
index f503f32..c0a716b 100644
--- a/drivers/clk/samsung/clk.c
+++ b/drivers/clk/samsung/clk.c
@@ -22,6 +22,38 @@ static struct clk_onecell_data clk_data;
#endif
#ifdef CONFIG_PM_SLEEP
+void samsung_clk_save(void __iomem *base,
+ struct samsung_clk_reg_dump *rd,
+ unsigned int num_regs)
+{
+ for (; num_regs > 0; --num_regs, ++rd)
+ rd->value = readl(base + rd->offset);
+}
+
+void samsung_clk_restore(void __iomem *base,
+ const struct samsung_clk_reg_dump *rd,
+ unsigned int num_regs)
+{
+ for (; num_regs > 0; --num_regs, ++rd)
+ writel(rd->value, base + rd->offset);
+}
+
+struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(unsigned long *rdump,
+ unsigned long nr_rdump)
+{
+ struct samsung_clk_reg_dump *rd;
+ unsigned int i;
+
+ rd = kcalloc(nr_rdump, sizeof(*rd), GFP_KERNEL);
+ if (!rd)
+ return NULL;
+
+ for (i = 0; i < nr_rdump; ++i)
+ rd[i].offset = rdump[i];
+
+ return rd;
+}
+
static struct samsung_clk_reg_dump *reg_dump;
static unsigned long nr_reg_dump;
diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h
index 31b4174..ec8d46b 100644
--- a/drivers/clk/samsung/clk.h
+++ b/drivers/clk/samsung/clk.h
@@ -340,4 +340,14 @@ extern void __init samsung_clk_register_pll(struct samsung_pll_clock *pll_list,
extern unsigned long _get_rate(const char *clk_name);
+extern void samsung_clk_save(void __iomem *base,
+ struct samsung_clk_reg_dump *rd,
+ unsigned int num_regs);
+extern void samsung_clk_restore(void __iomem *base,
+ const struct samsung_clk_reg_dump *rd,
+ unsigned int num_regs);
+extern struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
+ unsigned long *rdump,
+ unsigned long nr_rdump);
+
#endif /* __SAMSUNG_CLK_H */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/9] clk: samsung: exynos4: Move suspend/resume handling to SoC driver
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
2013-10-16 11:08 ` [PATCH 1/9] clk: exynos4: Remove remnants of non-DT support Tomasz Figa
2013-10-16 11:08 ` [PATCH 2/9] clk: samsung: Provide common helpers for register save/restore Tomasz Figa
@ 2013-10-16 11:08 ` Tomasz Figa
2013-10-17 13:42 ` Yadwinder Singh Brar
2013-10-16 11:08 ` [PATCH 4/9] clk: samsung: exynos5250: " Tomasz Figa
` (6 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Tomasz Figa @ 2013-10-16 11:08 UTC (permalink / raw)
To: linux-arm-kernel
Since there are multiple differences in how suspend/resume of particular
Exynos SoCs must be handled, SoC driver is better place for
suspend/resume handlers and so this patch moves them.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/clk/samsung/clk-exynos4.c | 90 ++++++++++++++++++++++++++++++++++-----
1 file changed, 80 insertions(+), 10 deletions(-)
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
index a29bb87..1de7346 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -15,6 +15,7 @@
#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/syscore_ops.h>
#include "clk.h"
@@ -191,6 +192,16 @@ enum exynos4_clks {
nr_clks,
};
+static void __iomem *reg_base;
+static enum exynos4_soc exynos4_soc;
+
+/*
+ * Support for CMU save/restore across system suspends
+ */
+#ifdef CONFIG_PM_SLEEP
+static struct samsung_clk_reg_dump *exynos4_save_common;
+static struct samsung_clk_reg_dump *exynos4_save_soc;
+
/*
* list of controller registers to be saved and restored during a
* suspend/resume cycle.
@@ -288,6 +299,70 @@ static unsigned long exynos4_clk_regs[] __initdata = {
GATE_IP_CPU,
};
+static int exynos4_clk_suspend(void)
+{
+ samsung_clk_save(reg_base, exynos4_save_common,
+ ARRAY_SIZE(exynos4_clk_regs));
+
+ if (exynos4_soc == EXYNOS4210)
+ samsung_clk_save(reg_base, exynos4_save_soc,
+ ARRAY_SIZE(exynos4210_clk_save));
+ else
+ samsung_clk_save(reg_base, exynos4_save_soc,
+ ARRAY_SIZE(exynos4x12_clk_save));
+
+ return 0;
+}
+
+static void exynos4_clk_resume(void)
+{
+ samsung_clk_restore(reg_base, exynos4_save_common,
+ ARRAY_SIZE(exynos4_clk_regs));
+
+ if (exynos4_soc == EXYNOS4210)
+ samsung_clk_restore(reg_base, exynos4_save_soc,
+ ARRAY_SIZE(exynos4210_clk_save));
+ else
+ samsung_clk_restore(reg_base, exynos4_save_soc,
+ ARRAY_SIZE(exynos4x12_clk_save));
+}
+
+static struct syscore_ops exynos4_clk_syscore_ops = {
+ .suspend = exynos4_clk_suspend,
+ .resume = exynos4_clk_resume,
+};
+
+static void exynos4_clk_sleep_init(void)
+{
+ exynos4_save_common = samsung_clk_alloc_reg_dump(exynos4_clk_regs,
+ ARRAY_SIZE(exynos4_clk_regs));
+ if (!exynos4_save_common)
+ goto err_warn;
+
+ if (exynos4_soc == EXYNOS4210)
+ exynos4_save_soc = samsung_clk_alloc_reg_dump(
+ exynos4210_clk_save,
+ ARRAY_SIZE(exynos4210_clk_save));
+ else
+ exynos4_save_soc = samsung_clk_alloc_reg_dump(
+ exynos4x12_clk_save,
+ ARRAY_SIZE(exynos4x12_clk_save));
+ if (!exynos4_save_soc)
+ goto err_common;
+
+ register_syscore_ops(&exynos4_clk_syscore_ops);
+ return;
+
+err_common:
+ kfree(exynos4_save_common);
+err_warn:
+ pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
+ __func__);
+}
+#else
+static void exynos4_clk_sleep_init(void) {}
+#endif
+
/* list of all parent clock list */
PNAME(mout_apll_p) = { "fin_pll", "fout_apll", };
PNAME(mout_mpll_p) = { "fin_pll", "fout_mpll", };
@@ -1091,22 +1166,15 @@ static struct samsung_pll_clock exynos4x12_plls[nr_plls] __initdata = {
/* register exynos4 clocks */
static void __init exynos4_clk_init(struct device_node *np,
- enum exynos4_soc exynos4_soc)
+ enum exynos4_soc soc)
{
- void __iomem *reg_base;
+ exynos4_soc = soc;
reg_base = of_iomap(np, 0);
if (!reg_base)
panic("%s: failed to map registers\n", __func__);
- if (exynos4_soc == EXYNOS4210)
- samsung_clk_init(np, reg_base, nr_clks,
- exynos4_clk_regs, ARRAY_SIZE(exynos4_clk_regs),
- exynos4210_clk_save, ARRAY_SIZE(exynos4210_clk_save));
- else
- samsung_clk_init(np, reg_base, nr_clks,
- exynos4_clk_regs, ARRAY_SIZE(exynos4_clk_regs),
- exynos4x12_clk_save, ARRAY_SIZE(exynos4x12_clk_save));
+ samsung_clk_init(np, reg_base, nr_clks, NULL, 0, NULL, 0);
samsung_clk_of_register_fixed_ext(exynos4_fixed_rate_ext_clks,
ARRAY_SIZE(exynos4_fixed_rate_ext_clks),
@@ -1179,6 +1247,8 @@ static void __init exynos4_clk_init(struct device_node *np,
samsung_clk_register_alias(exynos4_aliases,
ARRAY_SIZE(exynos4_aliases));
+ exynos4_clk_sleep_init();
+
pr_info("%s clocks: sclk_apll = %ld, sclk_mpll = %ld\n"
"\tsclk_epll = %ld, sclk_vpll = %ld, arm_clk = %ld\n",
exynos4_soc == EXYNOS4210 ? "Exynos4210" : "Exynos4x12",
--
1.8.3.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/9] clk: samsung: exynos5250: Move suspend/resume handling to SoC driver
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
` (2 preceding siblings ...)
2013-10-16 11:08 ` [PATCH 3/9] clk: samsung: exynos4: Move suspend/resume handling to SoC driver Tomasz Figa
@ 2013-10-16 11:08 ` Tomasz Figa
2013-10-16 11:08 ` [PATCH 5/9] clk: samsung: exynos5420: " Tomasz Figa
` (5 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Tomasz Figa @ 2013-10-16 11:08 UTC (permalink / raw)
To: linux-arm-kernel
Since there are multiple differences in how suspend/resume of particular
Exynos SoCs must be handled, SoC driver is better place for
suspend/resume handlers and so this patch moves them.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/clk/samsung/clk-exynos5250.c | 49 ++++++++++++++++++++++++++++++++----
drivers/clk/samsung/clk.c | 5 ++--
drivers/clk/samsung/clk.h | 4 +--
3 files changed, 49 insertions(+), 9 deletions(-)
diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c
index 93b82db..8c1ce49 100644
--- a/drivers/clk/samsung/clk-exynos5250.c
+++ b/drivers/clk/samsung/clk-exynos5250.c
@@ -15,6 +15,7 @@
#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/syscore_ops.h>
#include "clk.h"
@@ -129,6 +130,11 @@ enum exynos5250_clks {
nr_clks,
};
+static void __iomem *reg_base;
+
+#ifdef CONFIG_PM_SLEEP
+static struct samsung_clk_reg_dump *exynos5250_save;
+
/*
* list of controller registers to be saved and restored during a
* suspend/resume cycle.
@@ -181,6 +187,41 @@ static unsigned long exynos5250_clk_regs[] __initdata = {
GATE_IP_ACP,
};
+static int exynos5250_clk_suspend(void)
+{
+ samsung_clk_save(reg_base, exynos5250_save,
+ ARRAY_SIZE(exynos5250_clk_regs));
+
+ return 0;
+}
+
+static void exynos5250_clk_resume(void)
+{
+ samsung_clk_restore(reg_base, exynos5250_save,
+ ARRAY_SIZE(exynos5250_clk_regs));
+}
+
+static struct syscore_ops exynos5250_clk_syscore_ops = {
+ .suspend = exynos5250_clk_suspend,
+ .resume = exynos5250_clk_resume,
+};
+
+static void exynos5250_clk_sleep_init(void)
+{
+ exynos5250_save = samsung_clk_alloc_reg_dump(exynos5250_clk_regs,
+ ARRAY_SIZE(exynos5250_clk_regs));
+ if (!exynos5250_save) {
+ pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
+ __func__);
+ return;
+ }
+
+ register_syscore_ops(&exynos5250_clk_syscore_ops);
+}
+#else
+static void exynos5250_clk_sleep_init(void) {}
+#endif
+
/* list of all parent clock list */
PNAME(mout_apll_p) = { "fin_pll", "fout_apll", };
PNAME(mout_cpu_p) = { "mout_apll", "mout_mpll", };
@@ -650,8 +691,6 @@ static struct of_device_id ext_clk_match[] __initdata = {
/* register exynox5250 clocks */
static void __init exynos5250_clk_init(struct device_node *np)
{
- void __iomem *reg_base;
-
if (np) {
reg_base = of_iomap(np, 0);
if (!reg_base)
@@ -660,9 +699,7 @@ static void __init exynos5250_clk_init(struct device_node *np)
panic("%s: unable to determine soc\n", __func__);
}
- samsung_clk_init(np, reg_base, nr_clks,
- exynos5250_clk_regs, ARRAY_SIZE(exynos5250_clk_regs),
- NULL, 0);
+ samsung_clk_init(np, reg_base, nr_clks, NULL, 0, NULL, 0);
samsung_clk_of_register_fixed_ext(exynos5250_fixed_rate_ext_clks,
ARRAY_SIZE(exynos5250_fixed_rate_ext_clks),
ext_clk_match);
@@ -688,6 +725,8 @@ static void __init exynos5250_clk_init(struct device_node *np)
samsung_clk_register_gate(exynos5250_gate_clks,
ARRAY_SIZE(exynos5250_gate_clks));
+ exynos5250_clk_sleep_init();
+
pr_info("Exynos5250: clock setup completed, armclk=%ld\n",
_get_rate("div_arm2"));
}
diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c
index c0a716b..ec761e3 100644
--- a/drivers/clk/samsung/clk.c
+++ b/drivers/clk/samsung/clk.c
@@ -38,8 +38,9 @@ void samsung_clk_restore(void __iomem *base,
writel(rd->value, base + rd->offset);
}
-struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(unsigned long *rdump,
- unsigned long nr_rdump)
+struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
+ const unsigned long *rdump,
+ unsigned long nr_rdump)
{
struct samsung_clk_reg_dump *rd;
unsigned int i;
diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h
index ec8d46b..93cb8a0 100644
--- a/drivers/clk/samsung/clk.h
+++ b/drivers/clk/samsung/clk.h
@@ -347,7 +347,7 @@ extern void samsung_clk_restore(void __iomem *base,
const struct samsung_clk_reg_dump *rd,
unsigned int num_regs);
extern struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
- unsigned long *rdump,
- unsigned long nr_rdump);
+ const unsigned long *rdump,
+ unsigned long nr_rdump);
#endif /* __SAMSUNG_CLK_H */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 5/9] clk: samsung: exynos5420: Move suspend/resume handling to SoC driver
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
` (3 preceding siblings ...)
2013-10-16 11:08 ` [PATCH 4/9] clk: samsung: exynos5250: " Tomasz Figa
@ 2013-10-16 11:08 ` Tomasz Figa
2013-10-16 11:08 ` [PATCH 6/9] clk: samsung: s3c64xx: " Tomasz Figa
` (4 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Tomasz Figa @ 2013-10-16 11:08 UTC (permalink / raw)
To: linux-arm-kernel
Since there are multiple differences in how suspend/resume of particular
Exynos SoCs must be handled, SoC driver is better place for
suspend/resume handlers and so this patch moves them.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/clk/samsung/clk-exynos5420.c | 49 ++++++++++++++++++++++++++++++++----
1 file changed, 44 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c
index 48c4a93..4ef1ee4 100644
--- a/drivers/clk/samsung/clk-exynos5420.c
+++ b/drivers/clk/samsung/clk-exynos5420.c
@@ -15,6 +15,7 @@
#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/syscore_ops.h>
#include "clk.h"
@@ -149,6 +150,11 @@ enum exynos5420_clks {
nr_clks,
};
+static void __iomem *reg_base;
+
+#ifdef CONFIG_PM_SLEEP
+static struct samsung_clk_reg_dump *exynos5420_save;
+
/*
* list of controller registers to be saved and restored during a
* suspend/resume cycle.
@@ -215,6 +221,41 @@ static unsigned long exynos5420_clk_regs[] __initdata = {
DIV_KFC0,
};
+static int exynos5420_clk_suspend(void)
+{
+ samsung_clk_save(reg_base, exynos5420_save,
+ ARRAY_SIZE(exynos5420_clk_regs));
+
+ return 0;
+}
+
+static void exynos5420_clk_resume(void)
+{
+ samsung_clk_restore(reg_base, exynos5420_save,
+ ARRAY_SIZE(exynos5420_clk_regs));
+}
+
+static struct syscore_ops exynos5420_clk_syscore_ops = {
+ .suspend = exynos5420_clk_suspend,
+ .resume = exynos5420_clk_resume,
+};
+
+static void exynos5420_clk_sleep_init(void)
+{
+ exynos5420_save = samsung_clk_alloc_reg_dump(exynos5420_clk_regs,
+ ARRAY_SIZE(exynos5420_clk_regs));
+ if (!exynos5420_save) {
+ pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
+ __func__);
+ return;
+ }
+
+ register_syscore_ops(&exynos5420_clk_syscore_ops);
+}
+#else
+static void exynos5420_clk_sleep_init(void) {}
+#endif
+
/* list of all parent clocks */
PNAME(mspll_cpu_p) = { "sclk_cpll", "sclk_dpll",
"sclk_mpll", "sclk_spll" };
@@ -767,8 +808,6 @@ static struct of_device_id ext_clk_match[] __initdata = {
/* register exynos5420 clocks */
static void __init exynos5420_clk_init(struct device_node *np)
{
- void __iomem *reg_base;
-
if (np) {
reg_base = of_iomap(np, 0);
if (!reg_base)
@@ -777,9 +816,7 @@ static void __init exynos5420_clk_init(struct device_node *np)
panic("%s: unable to determine soc\n", __func__);
}
- samsung_clk_init(np, reg_base, nr_clks,
- exynos5420_clk_regs, ARRAY_SIZE(exynos5420_clk_regs),
- NULL, 0);
+ samsung_clk_init(np, reg_base, nr_clks, NULL, 0, NULL, 0);
samsung_clk_of_register_fixed_ext(exynos5420_fixed_rate_ext_clks,
ARRAY_SIZE(exynos5420_fixed_rate_ext_clks),
ext_clk_match);
@@ -795,5 +832,7 @@ static void __init exynos5420_clk_init(struct device_node *np)
ARRAY_SIZE(exynos5420_div_clks));
samsung_clk_register_gate(exynos5420_gate_clks,
ARRAY_SIZE(exynos5420_gate_clks));
+
+ exynos5420_clk_sleep_init();
}
CLK_OF_DECLARE(exynos5420_clk, "samsung,exynos5420-clock", exynos5420_clk_init);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6/9] clk: samsung: s3c64xx: Move suspend/resume handling to SoC driver
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
` (4 preceding siblings ...)
2013-10-16 11:08 ` [PATCH 5/9] clk: samsung: exynos5420: " Tomasz Figa
@ 2013-10-16 11:08 ` Tomasz Figa
2013-10-16 11:08 ` [PATCH 7/9] clk: samsung: Drop old suspend/resume code Tomasz Figa
` (3 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Tomasz Figa @ 2013-10-16 11:08 UTC (permalink / raw)
To: linux-arm-kernel
Since there are multiple differences in how suspend/resume of particular
Exynos SoCs must be handled, SoC driver is better place for
suspend/resume handlers and so this patch moves them.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/clk/samsung/clk-s3c64xx.c | 79 +++++++++++++++++++++++++++++++++------
1 file changed, 68 insertions(+), 11 deletions(-)
diff --git a/drivers/clk/samsung/clk-s3c64xx.c b/drivers/clk/samsung/clk-s3c64xx.c
index 7d2c842..3189101 100644
--- a/drivers/clk/samsung/clk-s3c64xx.c
+++ b/drivers/clk/samsung/clk-s3c64xx.c
@@ -13,6 +13,7 @@
#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/syscore_ops.h>
#include <dt-bindings/clock/samsung,s3c64xx-clock.h>
@@ -61,6 +62,13 @@ enum s3c64xx_plls {
apll, mpll, epll,
};
+static void __iomem *reg_base;
+static bool is_s3c6400;
+
+#ifdef CONFIG_PM_SLEEP
+static struct samsung_clk_reg_dump *s3c64xx_save_common;
+static struct samsung_clk_reg_dump *s3c64xx_save_soc;
+
/*
* List of controller registers to be saved and restored during
* a suspend/resume cycle.
@@ -87,6 +95,60 @@ static unsigned long s3c6410_clk_regs[] __initdata = {
MEM0_GATE,
};
+static int s3c64xx_clk_suspend(void)
+{
+ samsung_clk_save(reg_base, s3c64xx_save_common,
+ ARRAY_SIZE(s3c64xx_clk_regs));
+
+ if (!is_s3c6400)
+ samsung_clk_save(reg_base, s3c64xx_save_soc,
+ ARRAY_SIZE(s3c6410_clk_regs));
+
+ return 0;
+}
+
+static void s3c64xx_clk_resume(void)
+{
+ samsung_clk_restore(reg_base, s3c64xx_save_common,
+ ARRAY_SIZE(s3c64xx_clk_regs));
+
+ if (!is_s3c6400)
+ samsung_clk_restore(reg_base, s3c64xx_save_soc,
+ ARRAY_SIZE(s3c6410_clk_regs));
+}
+
+static struct syscore_ops s3c64xx_clk_syscore_ops = {
+ .suspend = s3c64xx_clk_suspend,
+ .resume = s3c64xx_clk_resume,
+};
+
+static void s3c64xx_clk_sleep_init(void)
+{
+ s3c64xx_save_common = samsung_clk_alloc_reg_dump(s3c64xx_clk_regs,
+ ARRAY_SIZE(s3c64xx_clk_regs));
+ if (!s3c64xx_save_common)
+ goto err_warn;
+
+ if (!is_s3c6400) {
+ s3c64xx_save_soc = samsung_clk_alloc_reg_dump(s3c6410_clk_regs,
+ ARRAY_SIZE(s3c6410_clk_regs));
+ if (!s3c64xx_save_soc)
+ goto err_soc;
+ }
+
+ register_syscore_ops(&s3c64xx_clk_syscore_ops);
+ return;
+
+err_soc:
+ kfree(s3c64xx_save_common);
+err_warn:
+ pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
+ __func__);
+}
+#else
+static void s3c64xx_clk_sleep_init(void) {}
+#endif
+
/* List of parent clocks common for all S3C64xx SoCs. */
PNAME(spi_mmc_p) = { "mout_epll", "dout_mpll", "fin_pll", "clk27m" };
PNAME(uart_p) = { "mout_epll", "dout_mpll" };
@@ -391,11 +453,11 @@ static void __init s3c64xx_clk_register_fixed_ext(unsigned long fin_pll_f,
/* Register s3c64xx clocks. */
void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
- unsigned long xusbxti_f, bool is_s3c6400,
- void __iomem *reg_base)
+ unsigned long xusbxti_f, bool s3c6400,
+ void __iomem *base)
{
- unsigned long *soc_regs = NULL;
- unsigned long nr_soc_regs = 0;
+ reg_base = base;
+ is_s3c6400 = s3c6400;
if (np) {
reg_base = of_iomap(np, 0);
@@ -403,13 +465,7 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
panic("%s: failed to map registers\n", __func__);
}
- if (!is_s3c6400) {
- soc_regs = s3c6410_clk_regs;
- nr_soc_regs = ARRAY_SIZE(s3c6410_clk_regs);
- }
-
- samsung_clk_init(np, reg_base, NR_CLKS, s3c64xx_clk_regs,
- ARRAY_SIZE(s3c64xx_clk_regs), soc_regs, nr_soc_regs);
+ samsung_clk_init(np, reg_base, NR_CLKS, NULL, 0, NULL, 0);
/* Register external clocks. */
if (!np)
@@ -452,6 +508,7 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
samsung_clk_register_alias(s3c64xx_clock_aliases,
ARRAY_SIZE(s3c64xx_clock_aliases));
+ s3c64xx_clk_sleep_init();
pr_info("%s clocks: apll = %lu, mpll = %lu\n"
"\tepll = %lu, arm_clk = %lu\n",
--
1.8.3.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 7/9] clk: samsung: Drop old suspend/resume code
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
` (5 preceding siblings ...)
2013-10-16 11:08 ` [PATCH 6/9] clk: samsung: s3c64xx: " Tomasz Figa
@ 2013-10-16 11:08 ` Tomasz Figa
2013-10-16 11:08 ` [PATCH 8/9] clk: samsung: exynos4: Add remaining suspend/resume handling Tomasz Figa
` (2 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Tomasz Figa @ 2013-10-16 11:08 UTC (permalink / raw)
To: linux-arm-kernel
Since all SoC drivers have been moved to local suspend/resume handling,
the old code can be safely dropped.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/clk/samsung/clk-exynos4.c | 2 +-
drivers/clk/samsung/clk-exynos5250.c | 2 +-
drivers/clk/samsung/clk-exynos5420.c | 2 +-
drivers/clk/samsung/clk-exynos5440.c | 2 +-
drivers/clk/samsung/clk-s3c64xx.c | 2 +-
drivers/clk/samsung/clk.c | 54 +-----------------------------------
drivers/clk/samsung/clk.h | 4 +--
7 files changed, 7 insertions(+), 61 deletions(-)
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
index 1de7346..694c755 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -1174,7 +1174,7 @@ static void __init exynos4_clk_init(struct device_node *np,
if (!reg_base)
panic("%s: failed to map registers\n", __func__);
- samsung_clk_init(np, reg_base, nr_clks, NULL, 0, NULL, 0);
+ samsung_clk_init(np, reg_base, nr_clks);
samsung_clk_of_register_fixed_ext(exynos4_fixed_rate_ext_clks,
ARRAY_SIZE(exynos4_fixed_rate_ext_clks),
diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c
index 8c1ce49..ee866e3 100644
--- a/drivers/clk/samsung/clk-exynos5250.c
+++ b/drivers/clk/samsung/clk-exynos5250.c
@@ -699,7 +699,7 @@ static void __init exynos5250_clk_init(struct device_node *np)
panic("%s: unable to determine soc\n", __func__);
}
- samsung_clk_init(np, reg_base, nr_clks, NULL, 0, NULL, 0);
+ samsung_clk_init(np, reg_base, nr_clks);
samsung_clk_of_register_fixed_ext(exynos5250_fixed_rate_ext_clks,
ARRAY_SIZE(exynos5250_fixed_rate_ext_clks),
ext_clk_match);
diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c
index 4ef1ee4..9de5bfd 100644
--- a/drivers/clk/samsung/clk-exynos5420.c
+++ b/drivers/clk/samsung/clk-exynos5420.c
@@ -816,7 +816,7 @@ static void __init exynos5420_clk_init(struct device_node *np)
panic("%s: unable to determine soc\n", __func__);
}
- samsung_clk_init(np, reg_base, nr_clks, NULL, 0, NULL, 0);
+ samsung_clk_init(np, reg_base, nr_clks);
samsung_clk_of_register_fixed_ext(exynos5420_fixed_rate_ext_clks,
ARRAY_SIZE(exynos5420_fixed_rate_ext_clks),
ext_clk_match);
diff --git a/drivers/clk/samsung/clk-exynos5440.c b/drivers/clk/samsung/clk-exynos5440.c
index f865894..e3e460a 100644
--- a/drivers/clk/samsung/clk-exynos5440.c
+++ b/drivers/clk/samsung/clk-exynos5440.c
@@ -114,7 +114,7 @@ static void __init exynos5440_clk_init(struct device_node *np)
return;
}
- samsung_clk_init(np, reg_base, nr_clks, NULL, 0, NULL, 0);
+ samsung_clk_init(np, reg_base, nr_clks);
samsung_clk_of_register_fixed_ext(exynos5440_fixed_rate_ext_clks,
ARRAY_SIZE(exynos5440_fixed_rate_ext_clks), ext_clk_match);
diff --git a/drivers/clk/samsung/clk-s3c64xx.c b/drivers/clk/samsung/clk-s3c64xx.c
index 3189101..a43cbde 100644
--- a/drivers/clk/samsung/clk-s3c64xx.c
+++ b/drivers/clk/samsung/clk-s3c64xx.c
@@ -465,7 +465,7 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
panic("%s: failed to map registers\n", __func__);
}
- samsung_clk_init(np, reg_base, NR_CLKS, NULL, 0, NULL, 0);
+ samsung_clk_init(np, reg_base, NR_CLKS);
/* Register external clocks. */
if (!np)
diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c
index ec761e3..91bec3e 100644
--- a/drivers/clk/samsung/clk.c
+++ b/drivers/clk/samsung/clk.c
@@ -21,7 +21,6 @@ static void __iomem *reg_base;
static struct clk_onecell_data clk_data;
#endif
-#ifdef CONFIG_PM_SLEEP
void samsung_clk_save(void __iomem *base,
struct samsung_clk_reg_dump *rd,
unsigned int num_regs)
@@ -55,63 +54,12 @@ struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
return rd;
}
-static struct samsung_clk_reg_dump *reg_dump;
-static unsigned long nr_reg_dump;
-
-static int samsung_clk_suspend(void)
-{
- struct samsung_clk_reg_dump *rd = reg_dump;
- unsigned long i;
-
- for (i = 0; i < nr_reg_dump; i++, rd++)
- rd->value = __raw_readl(reg_base + rd->offset);
-
- return 0;
-}
-
-static void samsung_clk_resume(void)
-{
- struct samsung_clk_reg_dump *rd = reg_dump;
- unsigned long i;
-
- for (i = 0; i < nr_reg_dump; i++, rd++)
- __raw_writel(rd->value, reg_base + rd->offset);
-}
-
-static struct syscore_ops samsung_clk_syscore_ops = {
- .suspend = samsung_clk_suspend,
- .resume = samsung_clk_resume,
-};
-#endif /* CONFIG_PM_SLEEP */
-
/* setup the essentials required to support clock lookup using ccf */
void __init samsung_clk_init(struct device_node *np, void __iomem *base,
- unsigned long nr_clks, unsigned long *rdump,
- unsigned long nr_rdump, unsigned long *soc_rdump,
- unsigned long nr_soc_rdump)
+ unsigned long nr_clks)
{
reg_base = base;
-#ifdef CONFIG_PM_SLEEP
- if (rdump && nr_rdump) {
- unsigned int idx;
- reg_dump = kzalloc(sizeof(struct samsung_clk_reg_dump)
- * (nr_rdump + nr_soc_rdump), GFP_KERNEL);
- if (!reg_dump) {
- pr_err("%s: memory alloc for register dump failed\n",
- __func__);
- return;
- }
-
- for (idx = 0; idx < nr_rdump; idx++)
- reg_dump[idx].offset = rdump[idx];
- for (idx = 0; idx < nr_soc_rdump; idx++)
- reg_dump[nr_rdump + idx].offset = soc_rdump[idx];
- nr_reg_dump = nr_rdump + nr_soc_rdump;
- register_syscore_ops(&samsung_clk_syscore_ops);
- }
-#endif
-
clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL);
if (!clk_table)
panic("could not allocate clock lookup table\n");
diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h
index 93cb8a0..c7141ba 100644
--- a/drivers/clk/samsung/clk.h
+++ b/drivers/clk/samsung/clk.h
@@ -313,9 +313,7 @@ struct samsung_pll_clock {
_lock, _con, _rtable, _alias)
extern void __init samsung_clk_init(struct device_node *np, void __iomem *base,
- unsigned long nr_clks, unsigned long *rdump,
- unsigned long nr_rdump, unsigned long *soc_rdump,
- unsigned long nr_soc_rdump);
+ unsigned long nr_clks);
extern void __init samsung_clk_of_register_fixed_ext(
struct samsung_fixed_rate_clock *fixed_rate_clk,
unsigned int nr_fixed_rate_clk,
--
1.8.3.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 8/9] clk: samsung: exynos4: Add remaining suspend/resume handling
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
` (6 preceding siblings ...)
2013-10-16 11:08 ` [PATCH 7/9] clk: samsung: Drop old suspend/resume code Tomasz Figa
@ 2013-10-16 11:08 ` Tomasz Figa
2013-10-16 11:08 ` [PATCH 9/9] ARM: EXYNOS: pm: Drop legacy Exynos4 clock suspend/resume code Tomasz Figa
2014-02-05 4:45 ` [PATCH 0/9] Samsung clock PM consolidation part 1 Rahul Sharma
9 siblings, 0 replies; 15+ messages in thread
From: Tomasz Figa @ 2013-10-16 11:08 UTC (permalink / raw)
To: linux-arm-kernel
As of now, part of Exynos4 clock suspend/resume handling is located
in mach-exynos/pm.c, which is not where code accessing CMU registers
should reside.
This patch implements all the necessary suspend/resume handling code
in Exynos4 clock driver to allow dropping that old code.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/clk/samsung/clk-exynos4.c | 74 ++++++++++++++++++++++++++++++++++-----
1 file changed, 66 insertions(+), 8 deletions(-)
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
index 694c755..ca2a940 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -201,6 +201,7 @@ static enum exynos4_soc exynos4_soc;
#ifdef CONFIG_PM_SLEEP
static struct samsung_clk_reg_dump *exynos4_save_common;
static struct samsung_clk_reg_dump *exynos4_save_soc;
+static struct samsung_clk_reg_dump *exynos4_save_pll;
/*
* list of controller registers to be saved and restored during a
@@ -226,6 +227,17 @@ static unsigned long exynos4x12_clk_save[] __initdata = {
E4X12_MPLL_CON0,
};
+static unsigned long exynos4_clk_pll_regs[] __initdata = {
+ EPLL_LOCK,
+ VPLL_LOCK,
+ EPLL_CON0,
+ EPLL_CON1,
+ EPLL_CON2,
+ VPLL_CON0,
+ VPLL_CON1,
+ VPLL_CON2,
+};
+
static unsigned long exynos4_clk_regs[] __initdata = {
SRC_LEFTBUS,
DIV_LEFTBUS,
@@ -233,12 +245,6 @@ static unsigned long exynos4_clk_regs[] __initdata = {
SRC_RIGHTBUS,
DIV_RIGHTBUS,
GATE_IP_RIGHTBUS,
- EPLL_CON0,
- EPLL_CON1,
- EPLL_CON2,
- VPLL_CON0,
- VPLL_CON1,
- VPLL_CON2,
SRC_TOP0,
SRC_TOP1,
SRC_CAM,
@@ -299,23 +305,68 @@ static unsigned long exynos4_clk_regs[] __initdata = {
GATE_IP_CPU,
};
+static const struct samsung_clk_reg_dump src_mask_suspend[] = {
+ { .offset = SRC_MASK_TOP, .value = 0x00000001, },
+ { .offset = SRC_MASK_CAM, .value = 0x11111111, },
+ { .offset = SRC_MASK_TV, .value = 0x00000111, },
+ { .offset = SRC_MASK_LCD0, .value = 0x00001111, },
+ { .offset = SRC_MASK_MAUDIO, .value = 0x00000001, },
+ { .offset = SRC_MASK_FSYS, .value = 0x01011111, },
+ { .offset = SRC_MASK_PERIL0, .value = 0x01111111, },
+ { .offset = SRC_MASK_PERIL1, .value = 0x01110111, },
+ { .offset = SRC_MASK_DMC, .value = 0x00010000, },
+};
+
+static const struct samsung_clk_reg_dump src_mask_suspend_e4210[] = {
+ { .offset = E4210_SRC_MASK_LCD1, .value = 0x00001111, },
+};
+
+#define PLL_ENABLED (1 << 31)
+#define PLL_LOCKED (1 << 29)
+
+static void exynos4_clk_wait_for_pll(u32 reg)
+{
+ u32 pll_con;
+
+ pll_con = readl(reg_base + reg);
+ if (!(pll_con & PLL_ENABLED))
+ return;
+
+ while (!(pll_con & PLL_LOCKED)) {
+ cpu_relax();
+ pll_con = readl(reg_base + reg);
+ }
+}
+
static int exynos4_clk_suspend(void)
{
samsung_clk_save(reg_base, exynos4_save_common,
ARRAY_SIZE(exynos4_clk_regs));
- if (exynos4_soc == EXYNOS4210)
+ if (exynos4_soc == EXYNOS4210) {
samsung_clk_save(reg_base, exynos4_save_soc,
ARRAY_SIZE(exynos4210_clk_save));
- else
+ samsung_clk_restore(reg_base, src_mask_suspend_e4210,
+ ARRAY_SIZE(src_mask_suspend_e4210));
+ } else {
samsung_clk_save(reg_base, exynos4_save_soc,
ARRAY_SIZE(exynos4x12_clk_save));
+ }
+
+ samsung_clk_restore(reg_base, src_mask_suspend,
+ ARRAY_SIZE(src_mask_suspend));
return 0;
}
static void exynos4_clk_resume(void)
{
+ samsung_clk_restore(reg_base, exynos4_save_pll,
+ ARRAY_SIZE(exynos4_clk_pll_regs));
+
+ exynos4_clk_wait_for_pll(EPLL_CON0);
+ exynos4_clk_wait_for_pll(VPLL_CON0);
+
samsung_clk_restore(reg_base, exynos4_save_common,
ARRAY_SIZE(exynos4_clk_regs));
@@ -350,9 +401,16 @@ static void exynos4_clk_sleep_init(void)
if (!exynos4_save_soc)
goto err_common;
+ exynos4_save_pll = samsung_clk_alloc_reg_dump(exynos4_clk_pll_regs,
+ ARRAY_SIZE(exynos4_clk_pll_regs));
+ if (!exynos4_save_pll)
+ goto err_soc;
+
register_syscore_ops(&exynos4_clk_syscore_ops);
return;
+err_soc:
+ kfree(exynos4_save_soc);
err_common:
kfree(exynos4_save_common);
err_warn:
--
1.8.3.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 9/9] ARM: EXYNOS: pm: Drop legacy Exynos4 clock suspend/resume code
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
` (7 preceding siblings ...)
2013-10-16 11:08 ` [PATCH 8/9] clk: samsung: exynos4: Add remaining suspend/resume handling Tomasz Figa
@ 2013-10-16 11:08 ` Tomasz Figa
2014-02-05 4:45 ` [PATCH 0/9] Samsung clock PM consolidation part 1 Rahul Sharma
9 siblings, 0 replies; 15+ messages in thread
From: Tomasz Figa @ 2013-10-16 11:08 UTC (permalink / raw)
To: linux-arm-kernel
All the suspend/resume handling is already implemented in Exynos4 clock
driver, so this legacy code can be safely dropped.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
arch/arm/mach-exynos/pm.c | 125 +---------------------------------------------
1 file changed, 2 insertions(+), 123 deletions(-)
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 1f24e7f..1578d43 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -30,38 +30,11 @@
#include <plat/regs-srom.h>
#include <mach/regs-irq.h>
-#include <mach/regs-clock.h>
#include <mach/regs-pmu.h>
#include <mach/pm-core.h>
#include "common.h"
-static struct sleep_save exynos4_set_clksrc[] = {
- { .reg = EXYNOS4_CLKSRC_MASK_TOP , .val = 0x00000001, },
- { .reg = EXYNOS4_CLKSRC_MASK_CAM , .val = 0x11111111, },
- { .reg = EXYNOS4_CLKSRC_MASK_TV , .val = 0x00000111, },
- { .reg = EXYNOS4_CLKSRC_MASK_LCD0 , .val = 0x00001111, },
- { .reg = EXYNOS4_CLKSRC_MASK_MAUDIO , .val = 0x00000001, },
- { .reg = EXYNOS4_CLKSRC_MASK_FSYS , .val = 0x01011111, },
- { .reg = EXYNOS4_CLKSRC_MASK_PERIL0 , .val = 0x01111111, },
- { .reg = EXYNOS4_CLKSRC_MASK_PERIL1 , .val = 0x01110111, },
- { .reg = EXYNOS4_CLKSRC_MASK_DMC , .val = 0x00010000, },
-};
-
-static struct sleep_save exynos4210_set_clksrc[] = {
- { .reg = EXYNOS4210_CLKSRC_MASK_LCD1 , .val = 0x00001111, },
-};
-
-static struct sleep_save exynos4_epll_save[] = {
- SAVE_ITEM(EXYNOS4_EPLL_CON0),
- SAVE_ITEM(EXYNOS4_EPLL_CON1),
-};
-
-static struct sleep_save exynos4_vpll_save[] = {
- SAVE_ITEM(EXYNOS4_VPLL_CON0),
- SAVE_ITEM(EXYNOS4_VPLL_CON1),
-};
-
static struct sleep_save exynos5_sys_save[] = {
SAVE_ITEM(EXYNOS5_SYS_I2C_CFG),
};
@@ -101,10 +74,7 @@ static void exynos_pm_prepare(void)
s3c_pm_do_save(exynos_core_save, ARRAY_SIZE(exynos_core_save));
- if (!soc_is_exynos5250()) {
- s3c_pm_do_save(exynos4_epll_save, ARRAY_SIZE(exynos4_epll_save));
- s3c_pm_do_save(exynos4_vpll_save, ARRAY_SIZE(exynos4_vpll_save));
- } else {
+ if (soc_is_exynos5250()) {
s3c_pm_do_save(exynos5_sys_save, ARRAY_SIZE(exynos5_sys_save));
/* Disable USE_RETENTION of JPEG_MEM_OPTION */
tmp = __raw_readl(EXYNOS5_JPEG_MEM_OPTION);
@@ -120,15 +90,6 @@ static void exynos_pm_prepare(void)
/* ensure at least INFORM0 has the resume address */
__raw_writel(virt_to_phys(s3c_cpu_resume), S5P_INFORM0);
-
- /* Before enter central sequence mode, clock src register have to set */
-
- if (!soc_is_exynos5250())
- s3c_pm_do_restore_core(exynos4_set_clksrc, ARRAY_SIZE(exynos4_set_clksrc));
-
- if (soc_is_exynos4210())
- s3c_pm_do_restore_core(exynos4210_set_clksrc, ARRAY_SIZE(exynos4210_set_clksrc));
-
}
static int exynos_pm_add(struct device *dev, struct subsys_interface *sif)
@@ -139,73 +100,6 @@ static int exynos_pm_add(struct device *dev, struct subsys_interface *sif)
return 0;
}
-static unsigned long pll_base_rate;
-
-static void exynos4_restore_pll(void)
-{
- unsigned long pll_con, locktime, lockcnt;
- unsigned long pll_in_rate;
- unsigned int p_div, epll_wait = 0, vpll_wait = 0;
-
- if (pll_base_rate == 0)
- return;
-
- pll_in_rate = pll_base_rate;
-
- /* EPLL */
- pll_con = exynos4_epll_save[0].val;
-
- if (pll_con & (1 << 31)) {
- pll_con &= (PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT);
- p_div = (pll_con >> PLL46XX_PDIV_SHIFT);
-
- pll_in_rate /= 1000000;
-
- locktime = (3000 / pll_in_rate) * p_div;
- lockcnt = locktime * 10000 / (10000 / pll_in_rate);
-
- __raw_writel(lockcnt, EXYNOS4_EPLL_LOCK);
-
- s3c_pm_do_restore_core(exynos4_epll_save,
- ARRAY_SIZE(exynos4_epll_save));
- epll_wait = 1;
- }
-
- pll_in_rate = pll_base_rate;
-
- /* VPLL */
- pll_con = exynos4_vpll_save[0].val;
-
- if (pll_con & (1 << 31)) {
- pll_in_rate /= 1000000;
- /* 750us */
- locktime = 750;
- lockcnt = locktime * 10000 / (10000 / pll_in_rate);
-
- __raw_writel(lockcnt, EXYNOS4_VPLL_LOCK);
-
- s3c_pm_do_restore_core(exynos4_vpll_save,
- ARRAY_SIZE(exynos4_vpll_save));
- vpll_wait = 1;
- }
-
- /* Wait PLL locking */
-
- do {
- if (epll_wait) {
- pll_con = __raw_readl(EXYNOS4_EPLL_CON0);
- if (pll_con & (1 << EXYNOS4_EPLLCON0_LOCKED_SHIFT))
- epll_wait = 0;
- }
-
- if (vpll_wait) {
- pll_con = __raw_readl(EXYNOS4_VPLL_CON0);
- if (pll_con & (1 << EXYNOS4_VPLLCON0_LOCKED_SHIFT))
- vpll_wait = 0;
- }
- } while (epll_wait || vpll_wait);
-}
-
static struct subsys_interface exynos_pm_interface = {
.name = "exynos_pm",
.subsys = &exynos_subsys,
@@ -257,7 +151,6 @@ int s3c_irq_wake(struct irq_data *data, unsigned int state)
static __init int exynos_pm_drvinit(void)
{
const struct exynos_wkup_irq *wkup_irq;
- struct clk *pll_base;
unsigned int tmp;
if (soc_is_exynos5440())
@@ -283,15 +176,6 @@ static __init int exynos_pm_drvinit(void)
tmp |= ((0xFF << 8) | (0x1F << 1));
__raw_writel(tmp, S5P_WAKEUP_MASK);
- if (!soc_is_exynos5250()) {
- pll_base = clk_get(NULL, "xtal");
-
- if (!IS_ERR(pll_base)) {
- pll_base_rate = clk_get_rate(pll_base);
- clk_put(pll_base);
- }
- }
-
return subsys_interface_register(&exynos_pm_interface);
}
arch_initcall(exynos_pm_drvinit);
@@ -375,13 +259,8 @@ static void exynos_pm_resume(void)
s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save));
- if (!soc_is_exynos5250()) {
- exynos4_restore_pll();
-
-#ifdef CONFIG_SMP
+ if (IS_ENABLED(CONFIG_SMP) && !soc_is_exynos5250())
scu_enable(S5P_VA_SCU);
-#endif
- }
early_wakeup:
--
1.8.3.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/9] clk: samsung: exynos4: Move suspend/resume handling to SoC driver
2013-10-16 11:08 ` [PATCH 3/9] clk: samsung: exynos4: Move suspend/resume handling to SoC driver Tomasz Figa
@ 2013-10-17 13:42 ` Yadwinder Singh Brar
2013-10-17 14:16 ` Tomasz Figa
0 siblings, 1 reply; 15+ messages in thread
From: Yadwinder Singh Brar @ 2013-10-17 13:42 UTC (permalink / raw)
To: linux-arm-kernel
Hi Tomasz,
[ ... ]
> /*
> * list of controller registers to be saved and restored during a
> * suspend/resume cycle.
> @@ -288,6 +299,70 @@ static unsigned long exynos4_clk_regs[] __initdata = {
> GATE_IP_CPU,
> };
>
> +static int exynos4_clk_suspend(void)
> +{
> + samsung_clk_save(reg_base, exynos4_save_common,
> + ARRAY_SIZE(exynos4_clk_regs));
a doubt here, Is sizeof(exynos4_clk_regs) works with
exynos4_clk_regs[] as __initdata ?
> +
> + if (exynos4_soc == EXYNOS4210)
> + samsung_clk_save(reg_base, exynos4_save_soc,
> + ARRAY_SIZE(exynos4210_clk_save));
[ ... ]
> +static void exynos4_clk_sleep_init(void)
I think, this fuction can be placed in __init section.
Same in other patches as well.
Regards,
Yadwinder
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/9] clk: samsung: exynos4: Move suspend/resume handling to SoC driver
2013-10-17 13:42 ` Yadwinder Singh Brar
@ 2013-10-17 14:16 ` Tomasz Figa
2013-10-17 14:22 ` Yadwinder Singh Brar
0 siblings, 1 reply; 15+ messages in thread
From: Tomasz Figa @ 2013-10-17 14:16 UTC (permalink / raw)
To: linux-arm-kernel
On Thursday 17 of October 2013 19:12:08 Yadwinder Singh Brar wrote:
> Hi Tomasz,
>
> [ ... ]
> > /*
> > * list of controller registers to be saved and restored during a
> > * suspend/resume cycle.
> > @@ -288,6 +299,70 @@ static unsigned long exynos4_clk_regs[] __initdata = {
> > GATE_IP_CPU,
> > };
> >
> > +static int exynos4_clk_suspend(void)
> > +{
> > + samsung_clk_save(reg_base, exynos4_save_common,
> > + ARRAY_SIZE(exynos4_clk_regs));
>
> a doubt here, Is sizeof(exynos4_clk_regs) works with
> exynos4_clk_regs[] as __initdata ?
Hmm, this is a compile time constant, so I don't see why it couldn't work.
> > +
> > + if (exynos4_soc == EXYNOS4210)
> > + samsung_clk_save(reg_base, exynos4_save_soc,
> > + ARRAY_SIZE(exynos4210_clk_save));
>
> [ ... ]
> > +static void exynos4_clk_sleep_init(void)
>
> I think, this fuction can be placed in __init section.
That's right. Thanks for pointing this out.
Best regards,
Tomasz
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/9] clk: samsung: exynos4: Move suspend/resume handling to SoC driver
2013-10-17 14:16 ` Tomasz Figa
@ 2013-10-17 14:22 ` Yadwinder Singh Brar
0 siblings, 0 replies; 15+ messages in thread
From: Yadwinder Singh Brar @ 2013-10-17 14:22 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Oct 17, 2013 at 7:46 PM, Tomasz Figa <t.figa@samsung.com> wrote:
> On Thursday 17 of October 2013 19:12:08 Yadwinder Singh Brar wrote:
>> Hi Tomasz,
>>
>> [ ... ]
>> > /*
>> > * list of controller registers to be saved and restored during a
>> > * suspend/resume cycle.
>> > @@ -288,6 +299,70 @@ static unsigned long exynos4_clk_regs[] __initdata = {
>> > GATE_IP_CPU,
>> > };
>> >
>> > +static int exynos4_clk_suspend(void)
>> > +{
>> > + samsung_clk_save(reg_base, exynos4_save_common,
>> > + ARRAY_SIZE(exynos4_clk_regs));
>>
>> a doubt here, Is sizeof(exynos4_clk_regs) works with
>> exynos4_clk_regs[] as __initdata ?
>
> Hmm, this is a compile time constant, so I don't see why it couldn't work.
>
why this doubt came in mind is sizeof() is a operator.. like we can
use sizeof(x++).
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 0/9] Samsung clock PM consolidation part 1
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
` (8 preceding siblings ...)
2013-10-16 11:08 ` [PATCH 9/9] ARM: EXYNOS: pm: Drop legacy Exynos4 clock suspend/resume code Tomasz Figa
@ 2014-02-05 4:45 ` Rahul Sharma
2014-02-05 6:10 ` Tomasz Figa
9 siblings, 1 reply; 15+ messages in thread
From: Rahul Sharma @ 2014-02-05 4:45 UTC (permalink / raw)
To: linux-arm-kernel
Hi Tomasz,
Are you planning to respin this series? It is not applying on mike's for-next.
Regards,
Rahul Sharma.
On 16 October 2013 16:38, Tomasz Figa <t.figa@samsung.com> wrote:
> This series reworks suspend/resume handling of Samsung clock drivers
> to cover more SoC specific aspects that are beyond simple register
> save and restore. The goal is to have all the suspend/resume code
> that touches the clock controller in single place, which is the
> clock driver.
>
> On Exynos4210-based Trats, Exynos4412-based Trats2 and Exynos5250-based
> Arndale boards (except suspend/resume, which is broken because of
> unrelated reasons):
>
> Tested-by: Tomasz Figa <t.figa@samsung.com>
>
> Tomasz Figa (9):
> clk: exynos4: Remove remnants of non-DT support
> clk: samsung: Provide common helpers for register save/restore
> clk: samsung: exynos4: Move suspend/resume handling to SoC driver
> clk: samsung: exynos5250: Move suspend/resume handling to SoC driver
> clk: samsung: exynos5420: Move suspend/resume handling to SoC driver
> clk: samsung: s3c64xx: Move suspend/resume handling to SoC driver
> clk: samsung: Drop old suspend/resume code
> clk: samsung: exynos4: Add remaining suspend/resume handling
> ARM: EXYNOS: pm: Drop legacy Exynos4 clock suspend/resume code
>
> arch/arm/mach-exynos/pm.c | 125 +-------------------------
> drivers/clk/samsung/clk-exynos4.c | 170 ++++++++++++++++++++++++++++++-----
> drivers/clk/samsung/clk-exynos5250.c | 49 ++++++++--
> drivers/clk/samsung/clk-exynos5420.c | 49 ++++++++--
> drivers/clk/samsung/clk-exynos5440.c | 2 +-
> drivers/clk/samsung/clk-s3c64xx.c | 79 +++++++++++++---
> drivers/clk/samsung/clk.c | 71 ++++++---------
> drivers/clk/samsung/clk.h | 14 ++-
> 8 files changed, 346 insertions(+), 213 deletions(-)
>
> --
> 1.8.3.2
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 0/9] Samsung clock PM consolidation part 1
2014-02-05 4:45 ` [PATCH 0/9] Samsung clock PM consolidation part 1 Rahul Sharma
@ 2014-02-05 6:10 ` Tomasz Figa
0 siblings, 0 replies; 15+ messages in thread
From: Tomasz Figa @ 2014-02-05 6:10 UTC (permalink / raw)
To: linux-arm-kernel
Hi Rahul,
On 05.02.2014 05:45, Rahul Sharma wrote:
> Hi Tomasz,
>
> Are you planning to respin this series? It is not applying on mike's for-next.
Yes, I have already rebased it and was planning to resend it later today
or tomorrow after checking one more thing.
Best regards,
Tomasz
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2014-02-05 6:10 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-16 11:08 [PATCH 0/9] Samsung clock PM consolidation part 1 Tomasz Figa
2013-10-16 11:08 ` [PATCH 1/9] clk: exynos4: Remove remnants of non-DT support Tomasz Figa
2013-10-16 11:08 ` [PATCH 2/9] clk: samsung: Provide common helpers for register save/restore Tomasz Figa
2013-10-16 11:08 ` [PATCH 3/9] clk: samsung: exynos4: Move suspend/resume handling to SoC driver Tomasz Figa
2013-10-17 13:42 ` Yadwinder Singh Brar
2013-10-17 14:16 ` Tomasz Figa
2013-10-17 14:22 ` Yadwinder Singh Brar
2013-10-16 11:08 ` [PATCH 4/9] clk: samsung: exynos5250: " Tomasz Figa
2013-10-16 11:08 ` [PATCH 5/9] clk: samsung: exynos5420: " Tomasz Figa
2013-10-16 11:08 ` [PATCH 6/9] clk: samsung: s3c64xx: " Tomasz Figa
2013-10-16 11:08 ` [PATCH 7/9] clk: samsung: Drop old suspend/resume code Tomasz Figa
2013-10-16 11:08 ` [PATCH 8/9] clk: samsung: exynos4: Add remaining suspend/resume handling Tomasz Figa
2013-10-16 11:08 ` [PATCH 9/9] ARM: EXYNOS: pm: Drop legacy Exynos4 clock suspend/resume code Tomasz Figa
2014-02-05 4:45 ` [PATCH 0/9] Samsung clock PM consolidation part 1 Rahul Sharma
2014-02-05 6:10 ` Tomasz Figa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).