From: Amit Daniel Kachhap <amit.daniel@samsung.com>
To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org
Cc: kgene.kim@samsung.com, linux-kernel@vger.kernel.org,
s.nawrocki@samsung.com, pankaj.dubey@samsung.com,
ulf.hansson@linaro.org, khilman@kernel.org,
linux-pm@vger.kernel.org, geert@linux-m68k.org,
rjw@rjwysocki.net, devicetree@vger.kernel.org,
Amit Daniel Kachhap <amit.daniel@samsung.com>
Subject: [PATCH RFC v2 06/12] driver: soc: exynos-pmu: Add exynos7 power domain on/off ops
Date: Mon, 24 Nov 2014 18:34:10 +0530 [thread overview]
Message-ID: <1416834256-11225-6-git-send-email-amit.daniel@samsung.com> (raw)
In-Reply-To: <1416834256-11225-1-git-send-email-amit.daniel@samsung.com>
This patch uses the restructuring done in PD handlers and adds PD
on/off/status handlers for exynos7. In this SoC, some extra settings
need to be done prior to turning on/off power domains. Some of those
settings are also different from different power domains so is uses
the power domain compatible name feature to distinguish between power
domains.
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
---
drivers/soc/samsung/exynos-pmu.c | 105 +++++++++++++++++++++++++++
include/linux/soc/samsung/exynos-regs-pmu.h | 17 +++++
2 files changed, 122 insertions(+)
diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c
index e690f65..b9631d5 100644
--- a/drivers/soc/samsung/exynos-pmu.c
+++ b/drivers/soc/samsung/exynos-pmu.c
@@ -1202,6 +1202,104 @@ static void exynos7_pmu_init(void)
}
}
+static int exynos7_pd_extraconf_base(const char *pd_name)
+{
+ if (!pd_name)
+ return -EINVAL;
+
+ if (!strcmp("samsung,exynos7-pd-mfc", pd_name))
+ return EXYNOS7_CLKRUN_CMU_MFC_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-hevc", pd_name))
+ return EXYNOS7_CLKRUN_CMU_HEVC_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-mscl", pd_name))
+ return EXYNOS7_CLKRUN_CMU_MSCL_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-g2d", pd_name))
+ return EXYNOS7_CLKRUN_CMU_G2D_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-fsys0", pd_name))
+ return EXYNOS7_CLKRUN_CMU_FSYS0_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-fsys1", pd_name))
+ return EXYNOS7_CLKRUN_CMU_FSYS1_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-aud", pd_name))
+ return EXYNOS7_CLKRUN_CMU_AUD_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-disp", pd_name))
+ return EXYNOS7_CLKRUN_CMU_DISP_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-vpp", pd_name))
+ return EXYNOS7_CLKRUN_CMU_VPP_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-vpp", pd_name))
+ return EXYNOS7_CLKRUN_CMU_VPP_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-isp0", pd_name))
+ return EXYNOS7_CLKRUN_CMU_ISP0_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-isp1", pd_name))
+ return EXYNOS7_CLKRUN_CMU_ISP1_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-cam0", pd_name))
+ return EXYNOS7_CLKRUN_CMU_CAM0_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-cam1", pd_name))
+ return EXYNOS7_CLKRUN_CMU_CAM1_SYS_PWR_REG;
+ else if (!strcmp("samsung,exynos7-pd-g3d", pd_name))
+ return EXYNOS7_CLKRUN_CMU_CAM1_SYS_PWR_REG;
+
+ pr_err("%s: Unsupported power domain\n", pd_name);
+ return 0;
+}
+
+static int exynos7_pd_powerdown(const char *pd_name, void __iomem *pd_addr)
+{
+ int off_base = exynos7_pd_extraconf_base(pd_name);
+
+ if (!off_base)
+ return -EINVAL;
+
+ /* Initialise the pd extraconf registers */
+ pmu_raw_writel(0, off_base + EXYNOS7_CLKRUN_CMU_PD_SYS_PWR_REG);
+ pmu_raw_writel(0, off_base + EXYNOS7_CLKSTOP_CMU_PD_SYS_PWR_REG);
+ pmu_raw_writel(0, off_base + EXYNOS7_DISABLE_PLL_CMU_PD_SYS_PWR_REG);
+ pmu_raw_writel(0, off_base + EXYNOS7_RESET_LOGIC_PD_SYS_PWR_REG);
+ pmu_raw_writel(0, off_base + EXYNOS7_MEMORY_PD_SYS_PWR_REG);
+ pmu_raw_writel(0, off_base + EXYNOS7_RESET_CMU_PD_SYS_PWR_REG);
+
+ if (!strcmp("samsung,exynos7-pd-fsys0", pd_name) ||
+ !strcmp("samsung,exynos7-pd-fsys1", pd_name))
+ pmu_raw_writel(1,
+ off_base + EXYNOS7_RESET_SLEEP_PD_SYS_PWR_REG);
+
+ if (!strcmp("samsung,exynos7-pd-aud", pd_name)) {
+ pmu_raw_writel(0, EXYNOS7_PAD_RETENTION_AUD_SYS_PWR_REG);
+ pmu_raw_writel(0, EXYNOS7_GPIO_MODE_AUD_SYS_PWR_REG);
+ }
+
+ writel_relaxed((EXYNOS7_USE_PROLONGED_LOGIC_RESET |
+ EXYNOS7_USE_SC_FEEDBACK), pd_addr + EXYNOS_PD_OPTION);
+
+ return 0;
+}
+
+static int exynos7_pd_poweron(const char *pd_name, void __iomem *pd_addr)
+{
+ if (exynos7_pd_powerdown(pd_name, pd_addr))
+ return -EINVAL;
+
+ return __exynos_pd_poweron_off(true, pd_name, pd_addr,
+ EXYNOS7_INT_LOCAL_PWR_EN);
+}
+
+static int exynos7_pd_poweroff(const char *pd_name, void __iomem *pd_addr)
+{
+ if (exynos7_pd_powerdown(pd_name, pd_addr))
+ return -EINVAL;
+
+ return __exynos_pd_poweron_off(false, pd_name, pd_addr,
+ EXYNOS7_INT_LOCAL_PWR_EN);
+}
+
+static bool exynos7_pd_status(void __iomem *pd_addr)
+{
+ unsigned int val;
+
+ val = readl_relaxed(pd_addr + EXYNOS_PD_STATUS) &
+ EXYNOS7_INT_LOCAL_PWR_EN;
+ return val ? true : false;
+}
+
static struct exynos_pmu_pd_ops exynos_pd_ops = {
.pd_on = exynos_pd_poweron,
.pd_off = exynos_pd_poweroff,
@@ -1238,12 +1336,19 @@ static struct exynos_pmu_data exynos5420_pmu_data = {
.pd_ops = &exynos_pd_ops,
};
+static struct exynos_pmu_pd_ops exynos7_pd_ops = {
+ .pd_on = exynos7_pd_poweron,
+ .pd_off = exynos7_pd_poweroff,
+ .pd_status = exynos7_pd_status,
+};
+
static const struct exynos_pmu_data exynos7_pmu_data = {
.pmu_config = exynos7_pmu_config,
.pmu_init = exynos7_pmu_init,
.pmu_config_extra = exynos7_pmu_config_extra,
.powerdown_conf = exynos7_powerdown_conf,
.powerup_conf = exynos7_powerup_conf,
+ .pd_ops = &exynos7_pd_ops,
};
/*
diff --git a/include/linux/soc/samsung/exynos-regs-pmu.h b/include/linux/soc/samsung/exynos-regs-pmu.h
index c61f91a..520595f 100644
--- a/include/linux/soc/samsung/exynos-regs-pmu.h
+++ b/include/linux/soc/samsung/exynos-regs-pmu.h
@@ -680,6 +680,8 @@ static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr)
#define EXYNOS7_VPP_SYS_PWR_REG (0x1438)
#define EXYNOS7_CLKRUN_CMU_AUD_SYS_PWR_REG (0x1440)
#define EXYNOS7_CLKRUN_CMU_BUS0_SYS_PWR_REG (0x1444)
+#define EXYNOS7_CLKRUN_CMU_CAM0_SYS_PWR_REG (0x1448)
+#define EXYNOS7_CLKRUN_CMU_CAM1_SYS_PWR_REG (0x144C)
#define EXYNOS7_CLKRUN_CMU_DISP_SYS_PWR_REG (0x1450)
#define EXYNOS7_CLKRUN_CMU_FSYS0_SYS_PWR_REG (0x1454)
#define EXYNOS7_CLKRUN_CMU_FSYS1_SYS_PWR_REG (0x1458)
@@ -824,6 +826,7 @@ static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr)
#define EXYNOS7_USE_STANDBYWFI (0x1 << 16)
#define EXYNOS7_USE_SC_FEEDBACK (0x1 << 1)
#define EXYNOS7_USE_SC_COUNTER (0x1 << 0)
+#define EXYNOS7_USE_PROLONGED_LOGIC_RESET (0x1 << 8)
/* EXYNOS7_PAD_RETENTION_AUD_OPTION */
#define PAD_INITIATE_WAKEUP (0x1 << 28)
@@ -841,4 +844,18 @@ static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr)
#define EXYNOS7_CORE_ARMCLK_STOPCTRL (0x1000)
+#define EXYNOS7_INT_LOCAL_PWR_EN 0xF
+
+/*
+ * Power domain register offsets from the EXYNOS7
+ * CLKRUN_CMU_HEVC_SYS_PWR_REG configuration register.
+ */
+#define EXYNOS7_CLKRUN_CMU_PD_SYS_PWR_REG (0x0)
+#define EXYNOS7_CLKSTOP_CMU_PD_SYS_PWR_REG (0x40)
+#define EXYNOS7_DISABLE_PLL_CMU_PD_SYS_PWR_REG (0x80)
+#define EXYNOS7_RESET_LOGIC_PD_SYS_PWR_REG (0xC0)
+#define EXYNOS7_MEMORY_PD_SYS_PWR_REG (0x100)
+#define EXYNOS7_RESET_CMU_PD_SYS_PWR_REG (0x140)
+#define EXYNOS7_RESET_SLEEP_PD_SYS_PWR_REG (0x180)
+
#endif /* __ASM_ARCH_REGS_PMU_H */
--
1.7.9.5
next prev parent reply other threads:[~2014-11-24 13:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 12:52 [PATCH RFC v2 00/12] soc: samsung: Modify and enhance power domain driver Amit Daniel Kachhap
2014-11-24 13:04 ` [PATCH RFC v2 01/12] arm: exynos: Add platform driver support for " Amit Daniel Kachhap
2014-11-24 13:04 ` [PATCH RFC v2 02/12] soc: exynos: Move exynos power domain file to driver/soc/samsung folder Amit Daniel Kachhap
2014-11-24 13:04 ` [PATCH RFC v2 03/12] soc: samsung: exynos-pmu: Register exynos pd driver as a mfd client Amit Daniel Kachhap
2014-11-24 13:04 ` [PATCH RFC v2 04/12] soc: samsung: Re-structure PMU driver to create pd on/off handlers Amit Daniel Kachhap
2014-11-24 13:04 ` [PATCH RFC v2 05/12] soc: samsung: pm_domain: Use unique compatible name for power domain Amit Daniel Kachhap
2014-11-24 13:04 ` Amit Daniel Kachhap [this message]
[not found] ` <1416834256-11225-6-git-send-email-amit.daniel-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-11-25 7:30 ` [PATCH RFC v2 06/12] driver: soc: exynos-pmu: Add exynos7 power domain on/off ops Ulf Hansson
2014-11-25 8:33 ` amit daniel kachhap
2014-11-24 13:04 ` [PATCH RFC v2 07/12] PM / Domains: export pm_genpd_lookup_name Amit Daniel Kachhap
2014-11-25 7:35 ` Ulf Hansson
2014-11-25 8:48 ` amit daniel kachhap
2014-11-27 14:20 ` Ulf Hansson
2014-11-28 8:52 ` amit daniel kachhap
2014-11-24 13:04 ` [PATCH RFC v2 08/12] soc: samsung: pm_domain: Add support for parent power domain Amit Daniel Kachhap
2014-11-25 7:59 ` Ulf Hansson
[not found] ` <CAPDyKFoBnViXQF=wDYp0x4gaOO4ht3a8KBeY6=k6_Zkkav28pQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-25 8:57 ` amit daniel kachhap
2014-11-25 9:19 ` Geert Uytterhoeven
2014-12-03 8:36 ` Marek Szyprowski
2014-11-24 13:04 ` [PATCH RFC v2 09/12] drivers: soc: pm_domain: Modify the parent clocks bindings Amit Daniel Kachhap
2014-11-24 13:04 ` [PATCH RFC v2 10/12] drivers: soc: samsung: Add support for clock enabling in power domain Amit Daniel Kachhap
[not found] ` <1416834256-11225-1-git-send-email-amit.daniel-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-11-24 13:04 ` [PATCH RFC v2 11/12] drivers: soc: samsung: Add support for clock rate save/restore " Amit Daniel Kachhap
2014-11-24 13:04 ` [PATCH RFC v2 12/12] arm64: Kconfig: Enable PM_GENERIC_DOMAINS for exynos7 Amit Daniel Kachhap
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=1416834256-11225-6-git-send-email-amit.daniel@samsung.com \
--to=amit.daniel@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=kgene.kim@samsung.com \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=pankaj.dubey@samsung.com \
--cc=rjw@rjwysocki.net \
--cc=s.nawrocki@samsung.com \
--cc=ulf.hansson@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).