From: Tomasz Figa <t.figa@samsung.com>
To: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
Kukjin Kim <kgene.kim@samsung.com>,
Mike Turquette <mturquette@linaro.org>,
Heiko Stuebner <heiko@sntech.de>,
Kyungmin Park <kyungmin.park@samsung.com>,
Rahul Sharma <rahul.sharma@samsung.com>,
Thomas Abraham <thomas.abraham@linaro.org>,
Tushar Behera <tushar.behera@linaro.org>,
Yadwinder Singh Brar <yadi.brar@samsung.com>,
Tomasz Figa <t.figa@samsung.com>
Subject: [PATCH 8/9] clk: samsung: exynos4: Add remaining suspend/resume handling
Date: Wed, 16 Oct 2013 13:08:17 +0200 [thread overview]
Message-ID: <1381921698-5060-9-git-send-email-t.figa@samsung.com> (raw)
In-Reply-To: <1381921698-5060-1-git-send-email-t.figa@samsung.com>
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
next prev parent reply other threads:[~2013-10-16 11:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Tomasz Figa [this message]
2013-10-16 11:08 ` [PATCH 9/9] ARM: EXYNOS: pm: Drop legacy Exynos4 clock " 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381921698-5060-9-git-send-email-t.figa@samsung.com \
--to=t.figa@samsung.com \
--cc=heiko@sntech.de \
--cc=kgene.kim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mturquette@linaro.org \
--cc=rahul.sharma@samsung.com \
--cc=thomas.abraham@linaro.org \
--cc=tushar.behera@linaro.org \
--cc=yadi.brar@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox