* [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension
@ 2012-11-13 12:51 Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 1/4] ARM: EXYNOS: pm_domain: Detect domain state on registration from DT Tomasz Figa
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Tomasz Figa @ 2012-11-13 12:51 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
This patch series fixes two issues with existing DT support for Exynos
power domains and extends it with the ability of binding devices to domains,
basically making it possible to use power domains with DT.
Based on for-next branch of Kgene's tree.
Changes since v2:
- Rebased to for-next of Kgene's tree.
Changes since v1:
- Added "samsung," prefix to "power-domain" property.
- Added power domain nodes to Exynos4 device tree sources.
Tomasz Figa (4):
ARM: EXYNOS: pm_domain: Detect domain state on registration from DT
ARM: EXYNOS: pm_domain: Fix power domain name initialization
ARM: EXYNOS: pm_domain: Bind devices to power domains using DT
ARM: dts: exynos4: Set up power domains
.../bindings/arm/exynos/power_domain.txt | 15 +++-
arch/arm/boot/dts/exynos4.dtsi | 30 +++++++
arch/arm/boot/dts/exynos4210.dtsi | 5 ++
arch/arm/mach-exynos/pm_domains.c | 93 +++++++++++++++++++++-
4 files changed, 135 insertions(+), 8 deletions(-)
--
1.8.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/4] ARM: EXYNOS: pm_domain: Detect domain state on registration from DT
2012-11-13 12:51 [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension Tomasz Figa
@ 2012-11-13 12:51 ` Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 2/4] ARM: EXYNOS: pm_domain: Fix power domain name initialization Tomasz Figa
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Tomasz Figa @ 2012-11-13 12:51 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
Initial state of power domains might vary on different boards and with
different bootloaders.
This patch adds detection of initial state of power domains when being
registered from DT.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Documentation/devicetree/bindings/arm/exynos/power_domain.txt | 4 ----
arch/arm/mach-exynos/pm_domains.c | 8 +++++---
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
index 6528e21..843b546 100644
--- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
+++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
@@ -9,10 +9,6 @@ Required Properties:
- reg: physical base address of the controller and length of memory mapped
region.
-Optional Properties:
-- samsung,exynos4210-pd-off: Specifies that the power domain is in turned-off
- state during boot and remains to be turned-off until explicitly turned-on.
-
Example:
lcd0: power-domain-lcd0 {
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index c0bc83a..d1abc1a 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -89,6 +89,7 @@ static __init int exynos_pm_dt_parse_domains(void)
for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
struct exynos_pm_domain *pd;
+ int on;
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd) {
@@ -97,14 +98,15 @@ static __init int exynos_pm_dt_parse_domains(void)
return -ENOMEM;
}
- if (of_get_property(np, "samsung,exynos4210-pd-off", NULL))
- pd->is_off = true;
pd->name = np->name;
pd->base = of_iomap(np, 0);
pd->pd.power_off = exynos_pd_power_off;
pd->pd.power_on = exynos_pd_power_on;
pd->pd.of_node = np;
- pm_genpd_init(&pd->pd, NULL, false);
+
+ on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
+
+ pm_genpd_init(&pd->pd, NULL, !on);
}
return 0;
}
--
1.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 2/4] ARM: EXYNOS: pm_domain: Fix power domain name initialization
2012-11-13 12:51 [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 1/4] ARM: EXYNOS: pm_domain: Detect domain state on registration from DT Tomasz Figa
@ 2012-11-13 12:51 ` Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 3/4] ARM: EXYNOS: pm_domain: Bind devices to power domains using DT Tomasz Figa
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Tomasz Figa @ 2012-11-13 12:51 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
This patch adds initialization of name field in generic power domain
struct.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
arch/arm/mach-exynos/pm_domains.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index d1abc1a..5b7ce7e 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -98,7 +98,8 @@ static __init int exynos_pm_dt_parse_domains(void)
return -ENOMEM;
}
- pd->name = np->name;
+ pd->pd.name = kstrdup(np->name, GFP_KERNEL);
+ pd->name = pd->pd.name;
pd->base = of_iomap(np, 0);
pd->pd.power_off = exynos_pd_power_off;
pd->pd.power_on = exynos_pd_power_on;
--
1.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 3/4] ARM: EXYNOS: pm_domain: Bind devices to power domains using DT
2012-11-13 12:51 [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 1/4] ARM: EXYNOS: pm_domain: Detect domain state on registration from DT Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 2/4] ARM: EXYNOS: pm_domain: Fix power domain name initialization Tomasz Figa
@ 2012-11-13 12:51 ` Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 4/4] ARM: dts: exynos4: Set up power domains Tomasz Figa
2012-11-13 13:00 ` [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension Tomasz Figa
4 siblings, 0 replies; 7+ messages in thread
From: Tomasz Figa @ 2012-11-13 12:51 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
This patch adds a way to specify bindings between devices and power
domains using device tree.
A device can be bound to particular power domain by adding a
power-domain property containing a phandle to the domain. The device
will be bound to the domain before binding a driver to it and unbound
after unbinding a driver from it.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
.../bindings/arm/exynos/power_domain.txt | 13 +++-
arch/arm/mach-exynos/pm_domains.c | 82 ++++++++++++++++++++++
2 files changed, 94 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
index 843b546..8ed914f 100644
--- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
+++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
@@ -4,14 +4,25 @@ Exynos processors include support for multiple power domains which are used
to gate power to one or more peripherals on the processor.
Required Properties:
-- compatiable: should be one of the following.
+- compatible: should be one of the following.
* samsung,exynos4210-pd - for exynos4210 type power domain.
- reg: physical base address of the controller and length of memory mapped
region.
+Node of a device using power domains must have a power-domain property defined
+with a phandle to respective power domain.
+
Example:
lcd0: power-domain-lcd0 {
compatible = "samsung,exynos4210-pd";
reg = <0x10023C00 0x10>;
};
+
+Example of the node using power domain:
+
+ node {
+ /* ... */
+ power-domain = <&lcd0>;
+ /* ... */
+ };
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 5b7ce7e..7b3b8a3 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -19,6 +19,8 @@
#include <linux/pm_domain.h>
#include <linux/delay.h>
#include <linux/of_address.h>
+#include <linux/of_platform.h>
+#include <linux/sched.h>
#include <mach/regs-pmu.h>
#include <plat/devs.h>
@@ -83,14 +85,89 @@ static struct exynos_pm_domain PD = { \
}
#ifdef CONFIG_OF
+static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
+ struct device *dev)
+{
+ int ret;
+
+ dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
+
+ while(1) {
+ ret = pm_genpd_add_device(&pd->pd, dev);
+ if (ret != -EAGAIN)
+ break;
+ cond_resched();
+ }
+
+ pm_genpd_dev_need_restore(dev, true);
+}
+
+static void exynos_remove_device_from_domain(struct device *dev)
+{
+ struct generic_pm_domain *genpd = dev_to_genpd(dev);
+ int ret;
+
+ dev_dbg(dev, "removing from power domain %s\n", genpd->name);
+
+ while(1) {
+ ret = pm_genpd_remove_device(genpd, dev);
+ if (ret != -EAGAIN)
+ break;
+ cond_resched();
+ }
+}
+
+static void exynos_read_domain_from_dt(struct device *dev)
+{
+ struct platform_device *pd_pdev;
+ struct exynos_pm_domain *pd;
+ struct device_node *node;
+
+ node = of_parse_phandle(dev->of_node, "power-domain", 0);
+ if (!node)
+ return;
+ pd_pdev = of_find_device_by_node(node);
+ if (!pd_pdev)
+ return;
+ pd = platform_get_drvdata(pd_pdev);
+ exynos_add_device_to_domain(pd, dev);
+}
+
+static int exynos_pm_notifier_call(struct notifier_block *nb,
+ unsigned long event, void *data)
+{
+ struct device *dev = data;
+
+ switch (event) {
+ case BUS_NOTIFY_BIND_DRIVER:
+ if (dev->of_node)
+ exynos_read_domain_from_dt(dev);
+
+ break;
+
+ case BUS_NOTIFY_UNBOUND_DRIVER:
+ exynos_remove_device_from_domain(dev);
+
+ break;
+ }
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block platform_nb = {
+ .notifier_call = exynos_pm_notifier_call,
+};
+
static __init int exynos_pm_dt_parse_domains(void)
{
+ struct platform_device *pdev;
struct device_node *np;
for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
struct exynos_pm_domain *pd;
int on;
+ pdev = of_find_device_by_node(np);
+
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd) {
pr_err("%s: failed to allocate memory for domain\n",
@@ -105,10 +182,15 @@ static __init int exynos_pm_dt_parse_domains(void)
pd->pd.power_on = exynos_pd_power_on;
pd->pd.of_node = np;
+ platform_set_drvdata(pdev, pd);
+
on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
pm_genpd_init(&pd->pd, NULL, !on);
}
+
+ bus_register_notifier(&platform_bus_type, &platform_nb);
+
return 0;
}
#else
--
1.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 4/4] ARM: dts: exynos4: Set up power domains
2012-11-13 12:51 [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension Tomasz Figa
` (2 preceding siblings ...)
2012-11-13 12:51 ` [PATCH v3 3/4] ARM: EXYNOS: pm_domain: Bind devices to power domains using DT Tomasz Figa
@ 2012-11-13 12:51 ` Tomasz Figa
2012-11-13 13:00 ` [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension Tomasz Figa
4 siblings, 0 replies; 7+ messages in thread
From: Tomasz Figa @ 2012-11-13 12:51 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, t.figa, tomasz.figa
This patch adds device tree nodes for power domains available
on Exynos 4 SoCs.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
arch/arm/boot/dts/exynos4.dtsi | 30 ++++++++++++++++++++++++++++++
arch/arm/boot/dts/exynos4210.dtsi | 5 +++++
2 files changed, 35 insertions(+)
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index a26c3dd..0c14f50 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -30,6 +30,36 @@
spi2 = &spi_2;
};
+ pd_mfc: mfc-power-domain@10023C40 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C40 0x20>;
+ };
+
+ pd_g3d: g3d-power-domain@10023C60 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C60 0x20>;
+ };
+
+ pd_lcd0: lcd0-power-domain@10023C80 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C80 0x20>;
+ };
+
+ pd_tv: tv-power-domain@10023C20 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C20 0x20>;
+ };
+
+ pd_cam: cam-power-domain@10023C00 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023C00 0x20>;
+ };
+
+ pd_gps: gps-power-domain@10023CE0 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023CE0 0x20>;
+ };
+
gic:interrupt-controller@10490000 {
compatible = "arm,cortex-a9-gic";
#interrupt-cells = <3>;
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 939f639..e31bfc4 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -31,6 +31,11 @@
pinctrl2 = &pinctrl_2;
};
+ pd_lcd1: lcd1-power-domain@10023CA0 {
+ compatible = "samsung,exynos4210-pd";
+ reg = <0x10023CA0 0x20>;
+ };
+
gic:interrupt-controller@10490000 {
cpu-offset = <0x8000>;
};
--
1.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension
2012-11-13 12:51 [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension Tomasz Figa
` (3 preceding siblings ...)
2012-11-13 12:51 ` [PATCH v3 4/4] ARM: dts: exynos4: Set up power domains Tomasz Figa
@ 2012-11-13 13:00 ` Tomasz Figa
2012-11-20 4:53 ` Kukjin Kim
4 siblings, 1 reply; 7+ messages in thread
From: Tomasz Figa @ 2012-11-13 13:00 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, kgene.kim,
thomas.abraham, rjw, m.szyprowski, tomasz.figa
Hi,
On Tuesday 13 of November 2012 13:51:51 Tomasz Figa wrote:
> This patch series fixes two issues with existing DT support for Exynos
> power domains and extends it with the ability of binding devices to
> domains, basically making it possible to use power domains with DT.
>
> Based on for-next branch of Kgene's tree.
>
> Changes since v2:
> - Rebased to for-next of Kgene's tree.
> Changes since v1:
> - Added "samsung," prefix to "power-domain" property.
> - Added power domain nodes to Exynos4 device tree sources.
>
> Tomasz Figa (4):
> ARM: EXYNOS: pm_domain: Detect domain state on registration from DT
> ARM: EXYNOS: pm_domain: Fix power domain name initialization
> ARM: EXYNOS: pm_domain: Bind devices to power domains using DT
> ARM: dts: exynos4: Set up power domains
>
> .../bindings/arm/exynos/power_domain.txt | 15 +++-
> arch/arm/boot/dts/exynos4.dtsi | 30 +++++++
> arch/arm/boot/dts/exynos4210.dtsi | 5 ++
> arch/arm/mach-exynos/pm_domains.c | 93
> +++++++++++++++++++++- 4 files changed, 135 insertions(+), 8
> deletions(-)
Sorry, please disregard this series, as I have sent wrong version by
mistake.
I will send correct one later.
Best regards,
--
Tomasz Figa
Samsung Poland R&D Center
SW Solution Development, Linux Platform
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension
2012-11-13 13:00 ` [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension Tomasz Figa
@ 2012-11-20 4:53 ` Kukjin Kim
0 siblings, 0 replies; 7+ messages in thread
From: Kukjin Kim @ 2012-11-20 4:53 UTC (permalink / raw)
To: 'Tomasz Figa', linux-samsung-soc
Cc: linux-pm, linux-arm-kernel, kyungmin.park, thomas.abraham, rjw,
m.szyprowski, tomasz.figa
Tomasz Figa wrote:
>
> Hi,
>
> On Tuesday 13 of November 2012 13:51:51 Tomasz Figa wrote:
> > This patch series fixes two issues with existing DT support for Exynos
> > power domains and extends it with the ability of binding devices to
> > domains, basically making it possible to use power domains with DT.
> >
> > Based on for-next branch of Kgene's tree.
> >
> > Changes since v2:
> > - Rebased to for-next of Kgene's tree.
> > Changes since v1:
> > - Added "samsung," prefix to "power-domain" property.
> > - Added power domain nodes to Exynos4 device tree sources.
> >
> > Tomasz Figa (4):
> > ARM: EXYNOS: pm_domain: Detect domain state on registration from DT
> > ARM: EXYNOS: pm_domain: Fix power domain name initialization
> > ARM: EXYNOS: pm_domain: Bind devices to power domains using DT
> > ARM: dts: exynos4: Set up power domains
> >
> > .../bindings/arm/exynos/power_domain.txt | 15 +++-
> > arch/arm/boot/dts/exynos4.dtsi | 30 +++++++
> > arch/arm/boot/dts/exynos4210.dtsi | 5 ++
> > arch/arm/mach-exynos/pm_domains.c | 93
> > +++++++++++++++++++++- 4 files changed, 135 insertions(+), 8
> > deletions(-)
>
> Sorry, please disregard this series, as I have sent wrong version by
> mistake.
>
> I will send correct one later.
>
OK.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-11-20 4:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-13 12:51 [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 1/4] ARM: EXYNOS: pm_domain: Detect domain state on registration from DT Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 2/4] ARM: EXYNOS: pm_domain: Fix power domain name initialization Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 3/4] ARM: EXYNOS: pm_domain: Bind devices to power domains using DT Tomasz Figa
2012-11-13 12:51 ` [PATCH v3 4/4] ARM: dts: exynos4: Set up power domains Tomasz Figa
2012-11-13 13:00 ` [PATCH v3 0/4] ARM: EXYNOS: Power domain DT support extension Tomasz Figa
2012-11-20 4:53 ` Kukjin Kim
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).